From ae11528dd946c92fcf8274960264f27eb8892e4f Mon Sep 17 00:00:00 2001 From: LGram16 Date: Wed, 4 Feb 2026 00:16:34 +0900 Subject: [PATCH] initial commit --- .gitignore | 22 + Dockerfile | 29 + backend/config.py | 18 + backend/data/nasdaq.txt | 5285 +++ .../data/nasdaq_screener_1769693338554.csv | 6979 ++++ backend/database.py | 112 + backend/kis_api.py | 379 + backend/main.py | 313 + backend/master_loader.py | 253 + backend/migrate_db.py | 37 + backend/migrate_db_v2.py | 57 + backend/migrate_db_v3.py | 18 + backend/news_ai.py | 147 + backend/telegram_notifier.py | 43 + backend/test_db_verification.py | 29 + backend/test_telegram_toggle.py | 43 + backend/tmp_master/kosdaq_code.mst | 1828 ++ backend/tmp_master/kospi_code.mst | 2482 ++ backend/trader.py | 214 + backend/websocket_manager.py | 182 + frontend/css/style.css | 228 + frontend/index.html | 446 + frontend/news.html | 66 + frontend/settings.html | 188 + frontend/stocks.html | 180 + frontend/trade.html | 377 + requirements.txt | 12 + run.bat | 26 + test_migration.py | 48 + 목표.md | 14 + 한국투자증권(API)/.gitignore | 167 + .../MCP/Kis Trading MCP/.dockerignore | 77 + .../MCP/Kis Trading MCP/.env.live | 4 + .../MCP/Kis Trading MCP/.gitignore | 23 + .../MCP/Kis Trading MCP/.python-version | 1 + .../MCP/Kis Trading MCP/Dockerfile | 63 + .../MCP/Kis Trading MCP/Readme.md | 391 + .../MCP/Kis Trading MCP/configs/auth.json | 105 + .../MCP/Kis Trading MCP/configs/domestic_bond.json | 1022 + .../configs/domestic_futureoption.json | 1311 + .../MCP/Kis Trading MCP/configs/domestic_stock.json | 4881 +++ .../MCP/Kis Trading MCP/configs/elw.json | 172 + .../MCP/Kis Trading MCP/configs/etfetn.json | 70 + .../configs/overseas_futureoption.json | 1670 + .../MCP/Kis Trading MCP/configs/overseas_stock.json | 2914 ++ .../MCP/Kis Trading MCP/model/__init__.py | 29 + .../MCP/Kis Trading MCP/model/auth.py | 11 + .../MCP/Kis Trading MCP/model/base.py | 5 + .../MCP/Kis Trading MCP/model/domestic_bond.py | 12 + .../Kis Trading MCP/model/domestic_futureoption.py | 12 + .../MCP/Kis Trading MCP/model/domestic_stock.py | 12 + .../MCP/Kis Trading MCP/model/elw.py | 12 + .../MCP/Kis Trading MCP/model/etfetn.py | 12 + .../Kis Trading MCP/model/overseas_futureoption.py | 12 + .../MCP/Kis Trading MCP/model/overseas_stock.py | 12 + .../MCP/Kis Trading MCP/model/updated.py | 15 + .../MCP/Kis Trading MCP/module/__init__.py | 3 + .../MCP/Kis Trading MCP/module/decorator.py | 32 + .../MCP/Kis Trading MCP/module/factory.py | 6 + .../MCP/Kis Trading MCP/module/middleware.py | 46 + .../MCP/Kis Trading MCP/module/plugin/__init__.py | 4 + .../MCP/Kis Trading MCP/module/plugin/database.py | 540 + .../Kis Trading MCP/module/plugin/environment.py | 43 + .../MCP/Kis Trading MCP/module/plugin/kis.py | 163 + .../Kis Trading MCP/module/plugin/master_file.py | 1593 + .../MCP/Kis Trading MCP/pyproject.toml | 17 + .../MCP/Kis Trading MCP/server.py | 105 + .../MCP/Kis Trading MCP/tools/__init__.py | 8 + .../MCP/Kis Trading MCP/tools/auth.py | 9 + .../MCP/Kis Trading MCP/tools/base.py | 818 + .../MCP/Kis Trading MCP/tools/domestic_bond.py | 10 + .../Kis Trading MCP/tools/domestic_futureoption.py | 15 + .../MCP/Kis Trading MCP/tools/domestic_stock.py | 9 + .../MCP/Kis Trading MCP/tools/elw.py | 9 + .../MCP/Kis Trading MCP/tools/etfetn.py | 9 + .../Kis Trading MCP/tools/overseas_futureoption.py | 9 + .../MCP/Kis Trading MCP/tools/overseas_stock.py | 9 + .../MCP/MCP AI 도구 연결 방법.md | 383 + 한국투자증권(API)/MCP/README.MD | 78 + 한국투자증권(API)/README.md | 314 + 한국투자증권(API)/docs/convention.md | 112 + .../examples_llm/auth/auth_token/auth_token.py | 120 + .../examples_llm/auth/auth_token/chk_auth_token.py | 104 + .../auth/auth_ws_token/auth_ws_token.py | 127 + .../auth/auth_ws_token/chk_auth_ws_token.py | 104 + .../examples_llm/domestic_bond/avg_unit/avg_unit.py | 171 + .../domestic_bond/avg_unit/chk_avg_unit.py | 184 + .../bond_asking_price/bond_asking_price.py | 97 + .../bond_asking_price/chk_bond_asking_price.py | 133 + .../domestic_bond/bond_ccnl/bond_ccnl.py | 85 + .../domestic_bond/bond_ccnl/chk_bond_ccnl.py | 112 + .../bond_index_ccnl/bond_index_ccnl.py | 84 + .../bond_index_ccnl/chk_bond_index_ccnl.py | 124 + .../examples_llm/domestic_bond/buy/buy.py | 112 + .../examples_llm/domestic_bond/buy/chk_buy.py | 114 + .../chk_inquire_asking_price.py | 123 + .../inquire_asking_price/inquire_asking_price.py | 116 + .../inquire_balance/chk_inquire_balance.py | 111 + .../inquire_balance/inquire_balance.py | 147 + .../domestic_bond/inquire_ccnl/chk_inquire_ccnl.py | 99 + .../domestic_bond/inquire_ccnl/inquire_ccnl.py | 117 + .../inquire_daily_ccld/chk_inquire_daily_ccld.py | 156 + .../inquire_daily_ccld/inquire_daily_ccld.py | 202 + .../chk_inquire_daily_itemchartprice.py | 95 + .../inquire_daily_itemchartprice.py | 114 + .../inquire_daily_price/chk_inquire_daily_price.py | 99 + .../inquire_daily_price/inquire_daily_price.py | 119 + .../inquire_price/chk_inquire_price.py | 107 + .../domestic_bond/inquire_price/inquire_price.py | 114 + .../inquire_psbl_order/chk_inquire_psbl_order.py | 104 + .../inquire_psbl_order/inquire_psbl_order.py | 132 + .../chk_inquire_psbl_rvsecncl.py | 114 + .../inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py | 136 + .../domestic_bond/issue_info/chk_issue_info.py | 176 + .../domestic_bond/issue_info/issue_info.py | 121 + .../order_rvsecncl/chk_order_rvsecncl.py | 115 + .../domestic_bond/order_rvsecncl/order_rvsecncl.py | 113 + .../search_bond_info/chk_search_bond_info.py | 171 + .../search_bond_info/search_bond_info.py | 115 + .../examples_llm/domestic_bond/sell/chk_sell.py | 124 + .../examples_llm/domestic_bond/sell/sell.py | 127 + .../chk_commodity_futures_realtime_conclusion.py | 116 + .../commodity_futures_realtime_conclusion.py | 108 + .../chk_commodity_futures_realtime_quote.py | 104 + .../commodity_futures_realtime_quote.py | 96 + .../chk_display_board_callput.py | 130 + .../display_board_callput/display_board_callput.py | 91 + .../chk_display_board_futures.py | 91 + .../display_board_futures/display_board_futures.py | 69 + .../chk_display_board_option_list.py | 71 + .../display_board_option_list.py | 63 + .../display_board_top/chk_display_board_top.py | 96 + .../display_board_top/display_board_top.py | 79 + .../exp_price_trend/chk_exp_price_trend.py | 92 + .../exp_price_trend/exp_price_trend.py | 70 + .../fuopt_ccnl_notice/chk_fuopt_ccnl_notice.py | 89 + .../fuopt_ccnl_notice/fuopt_ccnl_notice.py | 81 + .../futures_exp_ccnl/chk_futures_exp_ccnl.py | 74 + .../futures_exp_ccnl/futures_exp_ccnl.py | 64 + .../chk_index_futures_realtime_conclusion.py | 116 + .../index_futures_realtime_conclusion.py | 109 + .../chk_index_futures_realtime_quote.py | 104 + .../index_futures_realtime_quote.py | 97 + .../chk_index_option_realtime_conclusion.py | 124 + .../index_option_realtime_conclusion.py | 121 + .../chk_index_option_realtime_quote.py | 104 + .../index_option_realtime_quote.py | 95 + .../chk_inquire_asking_price.py | 129 + .../inquire_asking_price/inquire_asking_price.py | 81 + .../inquire_balance/chk_inquire_balance.py | 136 + .../inquire_balance/inquire_balance.py | 138 + .../chk_inquire_balance_settlement_pl.py | 109 + .../inquire_balance_settlement_pl.py | 120 + .../chk_inquire_balance_valuation_pl.py | 134 + .../inquire_balance_valuation_pl.py | 129 + .../inquire_ccnl/chk_inquire_ccnl.py | 128 + .../inquire_ccnl/inquire_ccnl.py | 172 + .../inquire_ccnl_bstime/chk_inquire_ccnl_bstime.py | 108 + .../inquire_ccnl_bstime/inquire_ccnl_bstime.py | 134 + .../chk_inquire_daily_amount_fee.py | 127 + .../inquire_daily_amount_fee.py | 127 + .../chk_inquire_daily_fuopchartprice.py | 130 + .../inquire_daily_fuopchartprice.py | 109 + .../inquire_deposit/chk_inquire_deposit.py | 102 + .../inquire_deposit/inquire_deposit.py | 64 + .../inquire_ngt_balance/chk_inquire_ngt_balance.py | 144 + .../inquire_ngt_balance/inquire_ngt_balance.py | 131 + .../inquire_ngt_ccnl/chk_inquire_ngt_ccnl.py | 122 + .../inquire_ngt_ccnl/inquire_ngt_ccnl.py | 164 + .../inquire_price/chk_inquire_price.py | 145 + .../inquire_price/inquire_price.py | 91 + .../chk_inquire_psbl_ngt_order.py | 84 + .../inquire_psbl_ngt_order.py | 94 + .../inquire_psbl_order/chk_inquire_psbl_order.py | 83 + .../inquire_psbl_order/inquire_psbl_order.py | 101 + .../chk_inquire_time_fuopchartprice.py | 132 + .../inquire_time_fuopchartprice.py | 104 + .../chk_krx_ngt_futures_asking_price.py | 103 + .../krx_ngt_futures_asking_price.py | 99 + .../chk_krx_ngt_futures_ccnl.py | 115 + .../krx_ngt_futures_ccnl/krx_ngt_futures_ccnl.py | 108 + .../chk_krx_ngt_futures_ccnl_notice.py | 85 + .../krx_ngt_futures_ccnl_notice.py | 78 + .../chk_krx_ngt_option_asking_price.py | 103 + .../krx_ngt_option_asking_price.py | 97 + .../krx_ngt_option_ccnl/chk_krx_ngt_option_ccnl.py | 121 + .../krx_ngt_option_ccnl/krx_ngt_option_ccnl.py | 114 + .../chk_krx_ngt_option_exp_ccnl.py | 74 + .../krx_ngt_option_exp_ccnl.py | 67 + .../chk_krx_ngt_option_notice.py | 86 + .../krx_ngt_option_notice/krx_ngt_option_notice.py | 78 + .../ngt_margin_detail/chk_ngt_margin_detail.py | 166 + .../ngt_margin_detail/ngt_margin_detail.py | 74 + .../option_exp_ccnl/chk_option_exp_ccnl.py | 73 + .../option_exp_ccnl/option_exp_ccnl.py | 64 + .../domestic_futureoption/order/chk_order.py | 87 + .../domestic_futureoption/order/order.py | 149 + .../order_rvsecncl/chk_order_rvsecncl.py | 92 + .../order_rvsecncl/order_rvsecncl.py | 113 + .../chk_stock_futures_realtime_conclusion.py | 116 + .../stock_futures_realtime_conclusion.py | 108 + .../chk_stock_futures_realtime_quote.py | 135 + .../stock_futures_realtime_quote.py | 128 + .../chk_stock_option_asking_price.py | 134 + .../stock_option_asking_price.py | 124 + .../stock_option_ccnl/chk_stock_option_ccnl.py | 119 + .../stock_option_ccnl/stock_option_ccnl.py | 110 + .../after_hour_balance/after_hour_balance.py | 172 + .../after_hour_balance/chk_after_hour_balance.py | 117 + .../asking_price_krx/asking_price_krx.py | 85 + .../asking_price_krx/chk_asking_price_krx.py | 155 + .../asking_price_nxt/asking_price_nxt.py | 130 + .../asking_price_nxt/chk_asking_price_nxt.py | 151 + .../asking_price_total/asking_price_total.py | 129 + .../asking_price_total/chk_asking_price_total.py | 151 + .../domestic_stock/bulk_trans_num/bulk_trans_num.py | 187 + .../bulk_trans_num/chk_bulk_trans_num.py | 121 + .../capture_uplowprice/capture_uplowprice.py | 98 + .../capture_uplowprice/chk_capture_uplowprice.py | 91 + .../domestic_stock/ccnl_krx/ccnl_krx.py | 85 + .../domestic_stock/ccnl_krx/chk_ccnl_krx.py | 149 + .../domestic_stock/ccnl_notice/ccnl_notice.py | 78 + .../domestic_stock/ccnl_notice/chk_ccnl_notice.py | 117 + .../domestic_stock/ccnl_nxt/ccnl_nxt.py | 75 + .../domestic_stock/ccnl_nxt/chk_ccnl_nxt.py | 128 + .../domestic_stock/ccnl_total/ccnl_total.py | 111 + .../domestic_stock/ccnl_total/chk_ccnl_total.py | 126 + .../domestic_stock/chk_holiday/chk_chk_holiday.py | 74 + .../domestic_stock/chk_holiday/chk_holiday.py | 109 + .../comp_interest/chk_comp_interest.py | 130 + .../domestic_stock/comp_interest/comp_interest.py | 135 + .../chk_comp_program_trade_daily.py | 145 + .../comp_program_trade_daily.py | 69 + .../chk_comp_program_trade_today.py | 85 + .../comp_program_trade_today.py | 81 + .../credit_balance/chk_credit_balance.py | 137 + .../domestic_stock/credit_balance/credit_balance.py | 164 + .../credit_by_company/chk_credit_by_company.py | 96 + .../credit_by_company/credit_by_company.py | 151 + .../chk_daily_credit_balance.py | 122 + .../daily_credit_balance/daily_credit_balance.py | 112 + .../daily_loan_trans/chk_daily_loan_trans.py | 84 + .../daily_loan_trans/daily_loan_trans.py | 74 + .../daily_short_sale/chk_daily_short_sale.py | 118 + .../daily_short_sale/daily_short_sale.py | 77 + .../domestic_stock/disparity/chk_disparity.py | 119 + .../domestic_stock/disparity/disparity.py | 169 + .../dividend_rate/chk_dividend_rate.py | 106 + .../domestic_stock/dividend_rate/dividend_rate.py | 160 + .../estimate_perform/chk_estimate_perform.py | 163 + .../estimate_perform/estimate_perform.py | 138 + .../domestic_stock/exp_ccnl_krx/chk_exp_ccnl_krx.py | 145 + .../domestic_stock/exp_ccnl_krx/exp_ccnl_krx.py | 107 + .../domestic_stock/exp_ccnl_nxt/chk_exp_ccnl_nxt.py | 127 + .../domestic_stock/exp_ccnl_nxt/exp_ccnl_nxt.py | 109 + .../exp_ccnl_total/chk_exp_ccnl_total.py | 127 + .../domestic_stock/exp_ccnl_total/exp_ccnl_total.py | 106 + .../exp_closing_price/chk_exp_closing_price.py | 83 + .../exp_closing_price/exp_closing_price.py | 82 + .../exp_index_trend/chk_exp_index_trend.py | 97 + .../exp_index_trend/exp_index_trend.py | 124 + .../exp_price_trend/chk_exp_price_trend.py | 103 + .../exp_price_trend/exp_price_trend.py | 75 + .../exp_total_index/chk_exp_total_index.py | 136 + .../exp_total_index/exp_total_index.py | 158 + .../exp_trans_updown/chk_exp_trans_updown.py | 117 + .../exp_trans_updown/exp_trans_updown.py | 177 + .../chk_finance_balance_sheet.py | 100 + .../finance_balance_sheet/finance_balance_sheet.py | 122 + .../chk_finance_financial_ratio.py | 98 + .../finance_financial_ratio.py | 122 + .../chk_finance_growth_ratio.py | 93 + .../finance_growth_ratio/finance_growth_ratio.py | 122 + .../chk_finance_income_statement.py | 103 + .../finance_income_statement.py | 119 + .../chk_finance_other_major_ratios.py | 93 + .../finance_other_major_ratios.py | 116 + .../chk_finance_profit_ratio.py | 94 + .../finance_profit_ratio/finance_profit_ratio.py | 128 + .../finance_ratio/chk_finance_ratio.py | 114 + .../domestic_stock/finance_ratio/finance_ratio.py | 166 + .../chk_finance_stability_ratio.py | 93 + .../finance_stability_ratio.py | 118 + .../domestic_stock/fluctuation/chk_fluctuation.py | 115 + .../domestic_stock/fluctuation/fluctuation.py | 126 + .../chk_foreign_institution_total.py | 100 + .../foreign_institution_total.py | 94 + .../frgnmem_pchs_trend/chk_frgnmem_pchs_trend.py | 82 + .../frgnmem_pchs_trend/frgnmem_pchs_trend.py | 71 + .../chk_frgnmem_trade_estimate.py | 84 + .../frgnmem_trade_estimate.py | 82 + .../frgnmem_trade_trend/chk_frgnmem_trade_trend.py | 131 + .../frgnmem_trade_trend/frgnmem_trade_trend.py | 171 + .../domestic_stock/hts_top_view/chk_hts_top_view.py | 87 + .../domestic_stock/hts_top_view/hts_top_view.py | 98 + .../domestic_stock/index_ccnl/chk_index_ccnl.py | 124 + .../domestic_stock/index_ccnl/index_ccnl.py | 73 + .../index_exp_ccnl/chk_index_exp_ccnl.py | 128 + .../domestic_stock/index_exp_ccnl/index_exp_ccnl.py | 72 + .../index_program_trade/chk_index_program_trade.py | 215 + .../index_program_trade/index_program_trade.py | 95 + .../chk_inquire_account_balance.py | 121 + .../inquire_account_balance.py | 78 + .../chk_inquire_asking_price_exp_ccn.py | 171 + .../inquire_asking_price_exp_ccn.py | 82 + .../inquire_balance/chk_inquire_balance.py | 147 + .../inquire_balance/inquire_balance.py | 170 + .../chk_inquire_balance_rlz_pl.py | 148 + .../inquire_balance_rlz_pl.py | 163 + .../domestic_stock/inquire_ccnl/chk_inquire_ccnl.py | 76 + .../domestic_stock/inquire_ccnl/inquire_ccnl.py | 75 + .../chk_inquire_credit_psamount.py | 90 + .../inquire_credit_psamount.py | 98 + .../inquire_daily_ccld/chk_inquire_daily_ccld.py | 140 + .../inquire_daily_ccld/inquire_daily_ccld.py | 211 + .../chk_inquire_daily_indexchartprice.py | 151 + .../inquire_daily_indexchartprice.py | 182 + .../chk_inquire_daily_itemchartprice.py | 136 + .../inquire_daily_itemchartprice.py | 107 + .../chk_inquire_daily_overtimeprice.py | 115 + .../inquire_daily_overtimeprice.py | 82 + .../inquire_daily_price/chk_inquire_daily_price.py | 84 + .../inquire_daily_price/inquire_daily_price.py | 91 + .../chk_inquire_daily_trade_volume.py | 95 + .../inquire_daily_trade_volume.py | 83 + .../inquire_elw_price/chk_inquire_elw_price.py | 134 + .../inquire_elw_price/inquire_elw_price.py | 133 + .../chk_inquire_index_category_price.py | 147 + .../inquire_index_category_price.py | 153 + .../chk_inquire_index_daily_price.py | 148 + .../inquire_index_daily_price.py | 134 + .../inquire_index_price/chk_inquire_index_price.py | 122 + .../inquire_index_price/inquire_index_price.py | 117 + .../chk_inquire_index_tickprice.py | 94 + .../inquire_index_tickprice.py | 114 + .../chk_inquire_index_timeprice.py | 96 + .../inquire_index_timeprice.py | 118 + .../inquire_investor/chk_inquire_investor.py | 89 + .../inquire_investor/inquire_investor.py | 78 + .../chk_inquire_investor_daily_by_market.py | 115 + .../inquire_investor_daily_by_market.py | 90 + .../chk_inquire_investor_time_by_market.py | 140 + .../inquire_investor_time_by_market.py | 64 + .../inquire_member/chk_inquire_member.py | 136 + .../domestic_stock/inquire_member/inquire_member.py | 75 + .../chk_inquire_member_daily.py | 83 + .../inquire_member_daily/inquire_member_daily.py | 92 + .../chk_inquire_overtime_asking_price.py | 149 + .../inquire_overtime_asking_price.py | 64 + .../chk_inquire_overtime_price.py | 110 + .../inquire_overtime_price.py | 66 + .../chk_inquire_period_profit.py | 123 + .../inquire_period_profit/inquire_period_profit.py | 151 + .../chk_inquire_period_trade_profit.py | 128 + .../inquire_period_trade_profit.py | 143 + .../inquire_price/chk_inquire_price.py | 151 + .../domestic_stock/inquire_price/inquire_price.py | 78 + .../inquire_price_2/chk_inquire_price_2.py | 123 + .../inquire_price_2/inquire_price_2.py | 63 + .../inquire_psbl_order/chk_inquire_psbl_order.py | 84 + .../inquire_psbl_order/inquire_psbl_order.py | 118 + .../chk_inquire_psbl_rvsecncl.py | 92 + .../inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py | 118 + .../inquire_psbl_sell/chk_inquire_psbl_sell.py | 107 + .../inquire_psbl_sell/inquire_psbl_sell.py | 120 + .../chk_inquire_time_dailychartprice.py | 109 + .../inquire_time_dailychartprice.py | 94 + .../chk_inquire_time_indexchartprice.py | 143 + .../inquire_time_indexchartprice.py | 177 + .../chk_inquire_time_itemchartprice.py | 102 + .../inquire_time_itemchartprice.py | 104 + .../chk_inquire_time_itemconclusion.py | 107 + .../inquire_time_itemconclusion.py | 88 + .../chk_inquire_time_overtimeconclusion.py | 118 + .../inquire_time_overtimeconclusion.py | 88 + .../inquire_vi_status/chk_inquire_vi_status.py | 113 + .../inquire_vi_status/inquire_vi_status.py | 158 + .../domestic_stock/intgr_margin/chk_intgr_margin.py | 278 + .../domestic_stock/intgr_margin/intgr_margin.py | 85 + .../intstock_grouplist/chk_intstock_grouplist.py | 73 + .../intstock_grouplist/intstock_grouplist.py | 75 + .../intstock_multprice/chk_intstock_multprice.py | 103 + .../intstock_multprice/intstock_multprice.py | 309 + .../chk_intstock_stocklist_by_group.py | 106 + .../intstock_stocklist_by_group.py | 103 + .../invest_opbysec/chk_invest_opbysec.py | 109 + .../domestic_stock/invest_opbysec/invest_opbysec.py | 158 + .../invest_opinion/chk_invest_opinion.py | 105 + .../domestic_stock/invest_opinion/invest_opinion.py | 150 + .../chk_investor_program_trade_today.py | 88 + .../investor_program_trade_today.py | 58 + .../chk_investor_trade_by_stock_daily.py | 247 + .../investor_trade_by_stock_daily.py | 156 + .../chk_investor_trend_estimate.py | 73 + .../investor_trend_estimate.py | 63 + .../ksdinfo_bonus_issue/chk_ksdinfo_bonus_issue.py | 102 + .../ksdinfo_bonus_issue/ksdinfo_bonus_issue.py | 124 + .../ksdinfo_cap_dcrs/chk_ksdinfo_cap_dcrs.py | 102 + .../ksdinfo_cap_dcrs/ksdinfo_cap_dcrs.py | 120 + .../ksdinfo_dividend/chk_ksdinfo_dividend.py | 110 + .../ksdinfo_dividend/ksdinfo_dividend.py | 138 + .../ksdinfo_forfeit/chk_ksdinfo_forfeit.py | 99 + .../ksdinfo_forfeit/ksdinfo_forfeit.py | 123 + .../ksdinfo_list_info/chk_ksdinfo_list_info.py | 99 + .../ksdinfo_list_info/ksdinfo_list_info.py | 124 + .../chk_ksdinfo_mand_deposit.py | 96 + .../ksdinfo_mand_deposit/ksdinfo_mand_deposit.py | 128 + .../chk_ksdinfo_merger_split.py | 105 + .../ksdinfo_merger_split/ksdinfo_merger_split.py | 122 + .../chk_ksdinfo_paidin_capin.py | 106 + .../ksdinfo_paidin_capin/ksdinfo_paidin_capin.py | 126 + .../ksdinfo_pub_offer/chk_ksdinfo_pub_offer.py | 105 + .../ksdinfo_pub_offer/ksdinfo_pub_offer.py | 121 + .../ksdinfo_purreq/chk_ksdinfo_purreq.py | 100 + .../domestic_stock/ksdinfo_purreq/ksdinfo_purreq.py | 126 + .../ksdinfo_rev_split/chk_ksdinfo_rev_split.py | 99 + .../ksdinfo_rev_split/ksdinfo_rev_split.py | 132 + .../chk_ksdinfo_sharehld_meet.py | 98 + .../ksdinfo_sharehld_meet/ksdinfo_sharehld_meet.py | 122 + .../lendable_by_company/chk_lendable_by_company.py | 132 + .../lendable_by_company/lendable_by_company.py | 166 + .../domestic_stock/market_cap/chk_market_cap.py | 93 + .../domestic_stock/market_cap/market_cap.py | 133 + .../market_status_krx/chk_market_status_krx.py | 100 + .../market_status_krx/market_status_krx.py | 73 + .../market_status_nxt/chk_market_status_nxt.py | 82 + .../market_status_nxt/market_status_nxt.py | 74 + .../market_status_total/chk_market_status_total.py | 80 + .../market_status_total/market_status_total.py | 73 + .../domestic_stock/market_time/chk_market_time.py | 75 + .../domestic_stock/market_time/market_time.py | 48 + .../domestic_stock/market_value/chk_market_value.py | 110 + .../domestic_stock/market_value/market_value.py | 167 + .../domestic_stock/member_krx/chk_member_krx.py | 191 + .../domestic_stock/member_krx/member_krx.py | 143 + .../domestic_stock/member_nxt/chk_member_nxt.py | 159 + .../domestic_stock/member_nxt/member_nxt.py | 142 + .../domestic_stock/member_total/chk_member_total.py | 154 + .../domestic_stock/member_total/member_total.py | 138 + .../domestic_stock/mktfunds/chk_mktfunds.py | 85 + .../domestic_stock/mktfunds/mktfunds.py | 59 + .../near_new_highlow/chk_near_new_highlow.py | 112 + .../near_new_highlow/near_new_highlow.py | 160 + .../domestic_stock/news_title/chk_news_title.py | 112 + .../domestic_stock/news_title/news_title.py | 141 + .../domestic_stock/order_cash/chk_order_cash.py | 75 + .../domestic_stock/order_cash/order_cash.py | 139 + .../domestic_stock/order_credit/chk_order_credit.py | 84 + .../domestic_stock/order_credit/order_credit.py | 182 + .../domestic_stock/order_resv/chk_order_resv.py | 73 + .../domestic_stock/order_resv/order_resv.py | 145 + .../order_resv_ccnl/chk_order_resv_ccnl.py | 101 + .../order_resv_ccnl/order_resv_ccnl.py | 154 + .../order_resv_rvsecncl/chk_order_resv_rvsecncl.py | 84 + .../order_resv_rvsecncl/order_resv_rvsecncl.py | 137 + .../order_rvsecncl/chk_order_rvsecncl.py | 87 + .../domestic_stock/order_rvsecncl/order_rvsecncl.py | 136 + .../chk_overtime_asking_price_krx.py | 161 + .../overtime_asking_price_krx.py | 115 + .../overtime_ccnl_krx/chk_overtime_ccnl_krx.py | 144 + .../overtime_ccnl_krx/overtime_ccnl_krx.py | 109 + .../chk_overtime_exp_ccnl_krx.py | 144 + .../overtime_exp_ccnl_krx/overtime_exp_ccnl_krx.py | 106 + .../chk_overtime_exp_trans_fluct.py | 87 + .../overtime_exp_trans_fluct.py | 92 + .../chk_overtime_fluctuation.py | 154 + .../overtime_fluctuation/overtime_fluctuation.py | 172 + .../overtime_volume/chk_overtime_volume.py | 143 + .../overtime_volume/overtime_volume.py | 172 + .../domestic_stock/pbar_tratio/chk_pbar_tratio.py | 105 + .../domestic_stock/pbar_tratio/pbar_tratio.py | 81 + .../chk_pension_inquire_balance.py | 129 + .../pension_inquire_balance.py | 130 + .../chk_pension_inquire_daily_ccld.py | 87 + .../pension_inquire_daily_ccld.py | 129 + .../chk_pension_inquire_deposit.py | 74 + .../pension_inquire_deposit.py | 70 + .../chk_pension_inquire_present_balance.py | 111 + .../pension_inquire_present_balance.py | 86 + .../chk_pension_inquire_psbl_order.py | 83 + .../pension_inquire_psbl_order.py | 104 + .../period_rights/chk_period_rights.py | 116 + .../domestic_stock/period_rights/period_rights.py | 140 + .../chk_prefer_disparate_ratio.py | 120 + .../prefer_disparate_ratio.py | 156 + .../profit_asset_index/chk_profit_asset_index.py | 111 + .../profit_asset_index/profit_asset_index.py | 169 + .../chk_program_trade_by_stock.py | 84 + .../program_trade_by_stock.py | 66 + .../chk_program_trade_by_stock_daily.py | 83 + .../program_trade_by_stock_daily.py | 67 + .../program_trade_krx/chk_program_trade_krx.py | 103 + .../program_trade_krx/program_trade_krx.py | 77 + .../program_trade_nxt/chk_program_trade_nxt.py | 86 + .../program_trade_nxt/program_trade_nxt.py | 73 + .../program_trade_total/chk_program_trade_total.py | 85 + .../program_trade_total/program_trade_total.py | 75 + .../psearch_result/chk_psearch_result.py | 93 + .../domestic_stock/psearch_result/psearch_result.py | 74 + .../psearch_title/chk_psearch_title.py | 74 + .../domestic_stock/psearch_title/psearch_title.py | 67 + .../quote_balance/chk_quote_balance.py | 99 + .../domestic_stock/quote_balance/quote_balance.py | 148 + .../domestic_stock/search_info/chk_search_info.py | 99 + .../domestic_stock/search_info/search_info.py | 121 + .../search_stock_info/chk_search_stock_info.py | 154 + .../search_stock_info/search_stock_info.py | 117 + .../domestic_stock/short_sale/chk_short_sale.py | 117 + .../domestic_stock/short_sale/short_sale.py | 160 + .../top_interest_stock/chk_top_interest_stock.py | 116 + .../top_interest_stock/top_interest_stock.py | 160 + .../traded_by_company/chk_traded_by_company.py | 118 + .../traded_by_company/traded_by_company.py | 182 + .../tradprt_byamt/chk_tradprt_byamt.py | 78 + .../domestic_stock/tradprt_byamt/tradprt_byamt.py | 70 + .../domestic_stock/volume_power/chk_volume_power.py | 111 + .../domestic_stock/volume_power/volume_power.py | 155 + .../domestic_stock/volume_rank/chk_volume_rank.py | 111 + .../domestic_stock/volume_rank/volume_rank.py | 135 + .../elw/compare_stocks/chk_compare_stocks.py | 87 + .../elw/compare_stocks/compare_stocks.py | 111 + .../examples_llm/elw/cond_search/chk_cond_search.py | 251 + .../examples_llm/elw/cond_search/cond_search.py | 349 + .../elw/elw_asking_price/chk_elw_asking_price.py | 193 + .../elw/elw_asking_price/elw_asking_price.py | 137 + .../examples_llm/elw/elw_ccnl/chk_elw_ccnl.py | 169 + .../examples_llm/elw/elw_ccnl/elw_ccnl.py | 77 + .../elw/elw_exp_ccnl/chk_elw_exp_ccnl.py | 159 + .../examples_llm/elw/elw_exp_ccnl/elw_exp_ccnl.py | 121 + .../elw/expiration_stocks/chk_expiration_stocks.py | 128 + .../elw/expiration_stocks/expiration_stocks.py | 179 + .../examples_llm/elw/indicator/chk_indicator.py | 123 + .../examples_llm/elw/indicator/indicator.py | 180 + .../chk_indicator_trend_ccnl.py | 104 + .../indicator_trend_ccnl/indicator_trend_ccnl.py | 114 + .../chk_indicator_trend_daily.py | 107 + .../indicator_trend_daily/indicator_trend_daily.py | 109 + .../chk_indicator_trend_minute.py | 109 + .../indicator_trend_minute.py | 141 + .../elw/lp_trade_trend/chk_lp_trade_trend.py | 132 + .../elw/lp_trade_trend/lp_trade_trend.py | 124 + .../elw/newly_listed/chk_newly_listed.py | 107 + .../examples_llm/elw/newly_listed/newly_listed.py | 160 + .../elw/quick_change/chk_quick_change.py | 130 + .../examples_llm/elw/quick_change/quick_change.py | 193 + .../examples_llm/elw/sensitivity/chk_sensitivity.py | 129 + .../examples_llm/elw/sensitivity/sensitivity.py | 188 + .../chk_sensitivity_trend_ccnl.py | 103 + .../sensitivity_trend_ccnl.py | 114 + .../chk_sensitivity_trend_daily.py | 103 + .../sensitivity_trend_daily.py | 118 + .../elw/udrl_asset_list/chk_udrl_asset_list.py | 99 + .../elw/udrl_asset_list/udrl_asset_list.py | 121 + .../elw/udrl_asset_price/chk_udrl_asset_price.py | 151 + .../elw/udrl_asset_price/udrl_asset_price.py | 209 + .../examples_llm/elw/updown_rate/chk_updown_rate.py | 153 + .../examples_llm/elw/updown_rate/updown_rate.py | 200 + .../chk_volatility_trend_ccnl.py | 100 + .../volatility_trend_ccnl/volatility_trend_ccnl.py | 119 + .../chk_volatility_trend_daily.py | 108 + .../volatility_trend_daily.py | 117 + .../chk_volatility_trend_minute.py | 103 + .../volatility_trend_minute.py | 142 + .../chk_volatility_trend_tick.py | 95 + .../volatility_trend_tick/volatility_trend_tick.py | 119 + .../examples_llm/elw/volume_rank/chk_volume_rank.py | 162 + .../examples_llm/elw/volume_rank/volume_rank.py | 203 + .../etfetn/etf_nav_trend/chk_etf_nav_trend.py | 84 + .../etfetn/etf_nav_trend/etf_nav_trend.py | 75 + .../chk_inquire_component_stock_price.py | 116 + .../inquire_component_stock_price.py | 85 + .../etfetn/inquire_price/chk_inquire_price.py | 128 + .../etfetn/inquire_price/inquire_price.py | 64 + .../chk_nav_comparison_daily_trend.py | 82 + .../nav_comparison_daily_trend.py | 79 + .../chk_nav_comparison_time_trend.py | 81 + .../nav_comparison_time_trend.py | 73 + .../chk_nav_comparison_trend.py | 107 + .../nav_comparison_trend/nav_comparison_trend.py | 69 + 한국투자증권(API)/examples_llm/kis_auth.py | 799 + .../asking_price/asking_price.py | 99 + .../asking_price/chk_asking_price.py | 105 + .../examples_llm/overseas_futureoption/ccnl/ccnl.py | 85 + .../overseas_futureoption/ccnl/chk_ccnl.py | 92 + .../ccnl_notice/ccnl_notice.py | 88 + .../ccnl_notice/chk_ccnl_notice.py | 100 + .../daily_ccnl/chk_daily_ccnl.py | 137 + .../overseas_futureoption/daily_ccnl/daily_ccnl.py | 186 + .../chk_inquire_asking_price.py | 124 + .../inquire_asking_price/inquire_asking_price.py | 133 + .../inquire_ccld/chk_inquire_ccld.py | 132 + .../inquire_ccld/inquire_ccld.py | 145 + .../inquire_daily_ccld/chk_inquire_daily_ccld.py | 148 + .../inquire_daily_ccld/inquire_daily_ccld.py | 206 + .../inquire_daily_order/chk_inquire_daily_order.py | 132 + .../inquire_daily_order/inquire_daily_order.py | 166 + .../inquire_deposit/chk_inquire_deposit.py | 119 + .../inquire_deposit/inquire_deposit.py | 127 + .../inquire_period_ccld/chk_inquire_period_ccld.py | 155 + .../inquire_period_ccld/inquire_period_ccld.py | 193 + .../chk_inquire_period_trans.py | 118 + .../inquire_period_trans/inquire_period_trans.py | 157 + .../inquire_price/chk_inquire_price.py | 125 + .../inquire_price/inquire_price.py | 101 + .../inquire_psamount/chk_inquire_psamount.py | 107 + .../inquire_psamount/inquire_psamount.py | 138 + .../chk_inquire_time_futurechartprice.py | 135 + .../inquire_time_futurechartprice.py | 187 + .../chk_inquire_time_optchartprice.py | 95 + .../inquire_time_optchartprice.py | 151 + .../inquire_unpd/chk_inquire_unpd.py | 111 + .../inquire_unpd/inquire_unpd.py | 128 + .../investor_unpd_trend/chk_investor_unpd_trend.py | 135 + .../investor_unpd_trend/investor_unpd_trend.py | 156 + .../margin_detail/chk_margin_detail.py | 143 + .../margin_detail/margin_detail.py | 127 + .../market_time/chk_market_time.py | 112 + .../market_time/market_time.py | 134 + .../monthly_ccnl/chk_monthly_ccnl.py | 137 + .../monthly_ccnl/monthly_ccnl.py | 187 + .../opt_asking_price/chk_opt_asking_price.py | 124 + .../opt_asking_price/opt_asking_price.py | 131 + .../opt_daily_ccnl/chk_opt_daily_ccnl.py | 97 + .../opt_daily_ccnl/opt_daily_ccnl.py | 137 + .../opt_detail/chk_opt_detail.py | 89 + .../overseas_futureoption/opt_detail/opt_detail.py | 77 + .../opt_monthly_ccnl/chk_opt_monthly_ccnl.py | 100 + .../opt_monthly_ccnl/opt_monthly_ccnl.py | 145 + .../opt_price/chk_opt_price.py | 99 + .../overseas_futureoption/opt_price/opt_price.py | 72 + .../opt_tick_ccnl/chk_opt_tick_ccnl.py | 100 + .../opt_tick_ccnl/opt_tick_ccnl.py | 154 + .../opt_weekly_ccnl/chk_opt_weekly_ccnl.py | 102 + .../opt_weekly_ccnl/opt_weekly_ccnl.py | 149 + .../overseas_futureoption/order/chk_order.py | 123 + .../overseas_futureoption/order/order.py | 159 + .../order_notice/chk_order_notice.py | 100 + .../order_notice/order_notice.py | 91 + .../order_rvsecncl/chk_order_rvsecncl.py | 113 + .../order_rvsecncl/order_rvsecncl.py | 135 + .../chk_search_contract_detail.py | 119 + .../search_contract_detail.py | 114 + .../search_opt_detail/chk_search_opt_detail.py | 90 + .../search_opt_detail/search_opt_detail.py | 198 + .../stock_detail/chk_stock_detail.py | 111 + .../stock_detail/stock_detail.py | 101 + .../tick_ccnl/chk_tick_ccnl.py | 141 + .../overseas_futureoption/tick_ccnl/tick_ccnl.py | 180 + .../weekly_ccnl/chk_weekly_ccnl.py | 141 + .../weekly_ccnl/weekly_ccnl.py | 181 + .../overseas_stock/algo_ordno/algo_ordno.py | 110 + .../overseas_stock/algo_ordno/chk_algo_ordno.py | 79 + .../overseas_stock/asking_price/asking_price.py | 76 + .../overseas_stock/asking_price/chk_asking_price.py | 84 + .../overseas_stock/brknews_title/brknews_title.py | 87 + .../brknews_title/chk_brknews_title.py | 93 + .../overseas_stock/ccnl_notice/ccnl_notice.py | 92 + .../overseas_stock/ccnl_notice/chk_ccnl_notice.py | 94 + .../colable_by_company/chk_colable_by_company.py | 95 + .../colable_by_company/colable_by_company.py | 153 + .../countries_holiday/chk_countries_holiday.py | 96 + .../countries_holiday/countries_holiday.py | 114 + .../overseas_stock/dailyprice/chk_dailyprice.py | 140 + .../overseas_stock/dailyprice/dailyprice.py | 177 + .../daytime_order/chk_daytime_order.py | 113 + .../overseas_stock/daytime_order/daytime_order.py | 145 + .../chk_daytime_order_rvsecncl.py | 116 + .../daytime_order_rvsecncl.py | 144 + .../chk_delayed_asking_price_asia.py | 87 + .../delayed_asking_price_asia.py | 77 + .../overseas_stock/delayed_ccnl/chk_delayed_ccnl.py | 93 + .../overseas_stock/delayed_ccnl/delayed_ccnl.py | 88 + .../foreign_margin/chk_foreign_margin.py | 105 + .../overseas_stock/foreign_margin/foreign_margin.py | 109 + .../industry_price/chk_industry_price.py | 81 + .../overseas_stock/industry_price/industry_price.py | 104 + .../industry_theme/chk_industry_theme.py | 102 + .../overseas_stock/industry_theme/industry_theme.py | 120 + .../inquire_algo_ccnl/chk_inquire_algo_ccnl.py | 103 + .../inquire_algo_ccnl/inquire_algo_ccnl.py | 127 + .../chk_inquire_asking_price.py | 163 + .../inquire_asking_price/inquire_asking_price.py | 165 + .../inquire_balance/chk_inquire_balance.py | 134 + .../inquire_balance/inquire_balance.py | 181 + .../overseas_stock/inquire_ccnl/chk_inquire_ccnl.py | 158 + .../overseas_stock/inquire_ccnl/inquire_ccnl.py | 200 + .../chk_inquire_daily_chartprice.py | 145 + .../inquire_daily_chartprice.py | 175 + .../overseas_stock/inquire_nccs/chk_inquire_nccs.py | 131 + .../overseas_stock/inquire_nccs/inquire_nccs.py | 148 + .../chk_inquire_paymt_stdr_balance.py | 185 + .../inquire_paymt_stdr_balance.py | 200 + .../chk_inquire_period_profit.py | 156 + .../inquire_period_profit/inquire_period_profit.py | 214 + .../chk_inquire_period_trans.py | 160 + .../inquire_period_trans/inquire_period_trans.py | 206 + .../chk_inquire_present_balance.py | 223 + .../inquire_present_balance.py | 215 + .../inquire_psamount/chk_inquire_psamount.py | 119 + .../inquire_psamount/inquire_psamount.py | 147 + .../inquire_search/chk_inquire_search.py | 181 + .../overseas_stock/inquire_search/inquire_search.py | 243 + .../chk_inquire_time_indexchartprice.py | 137 + .../inquire_time_indexchartprice.py | 157 + .../chk_inquire_time_itemchartprice.py | 143 + .../inquire_time_itemchartprice.py | 177 + .../overseas_stock/market_cap/chk_market_cap.py | 105 + .../overseas_stock/market_cap/market_cap.py | 112 + .../overseas_stock/new_highlow/chk_new_highlow.py | 107 + .../overseas_stock/new_highlow/new_highlow.py | 134 + .../overseas_stock/news_title/chk_news_title.py | 87 + .../overseas_stock/news_title/news_title.py | 110 + .../examples_llm/overseas_stock/order/chk_order.py | 122 + .../examples_llm/overseas_stock/order/order.py | 191 + .../overseas_stock/order_resv/chk_order_resv.py | 75 + .../overseas_stock/order_resv/order_resv.py | 194 + .../order_resv_ccnl/chk_order_resv_ccnl.py | 78 + .../order_resv_ccnl/order_resv_ccnl.py | 106 + .../order_resv_list/chk_order_resv_list.py | 131 + .../order_resv_list/order_resv_list.py | 148 + .../order_rvsecncl/chk_order_rvsecncl.py | 122 + .../overseas_stock/order_rvsecncl/order_rvsecncl.py | 143 + .../period_rights/chk_period_rights.py | 92 + .../overseas_stock/period_rights/period_rights.py | 128 + .../examples_llm/overseas_stock/price/chk_price.py | 112 + .../examples_llm/overseas_stock/price/price.py | 127 + .../overseas_stock/price_detail/chk_price_detail.py | 134 + .../overseas_stock/price_detail/price_detail.py | 112 + .../overseas_stock/price_fluct/chk_price_fluct.py | 106 + .../overseas_stock/price_fluct/price_fluct.py | 126 + .../quot_inquire_ccnl/chk_quot_inquire_ccnl.py | 78 + .../quot_inquire_ccnl/quot_inquire_ccnl.py | 110 + .../rights_by_ice/chk_rights_by_ice.py | 79 + .../overseas_stock/rights_by_ice/rights_by_ice.py | 77 + .../overseas_stock/search_info/chk_search_info.py | 151 + .../overseas_stock/search_info/search_info.py | 109 + .../overseas_stock/trade_growth/chk_trade_growth.py | 106 + .../overseas_stock/trade_growth/trade_growth.py | 120 + .../overseas_stock/trade_pbmn/chk_trade_pbmn.py | 105 + .../overseas_stock/trade_pbmn/trade_pbmn.py | 127 + .../trade_turnover/chk_trade_turnover.py | 108 + .../overseas_stock/trade_turnover/trade_turnover.py | 122 + .../overseas_stock/trade_vol/chk_trade_vol.py | 105 + .../overseas_stock/trade_vol/trade_vol.py | 127 + .../overseas_stock/updown_rate/chk_updown_rate.py | 107 + .../overseas_stock/updown_rate/updown_rate.py | 125 + .../overseas_stock/volume_power/chk_volume_power.py | 107 + .../overseas_stock/volume_power/volume_power.py | 121 + .../overseas_stock/volume_surge/chk_volume_surge.py | 106 + .../overseas_stock/volume_surge/volume_surge.py | 120 + .../examples_user/auth/auth_examples.py | 31 + .../examples_user/auth/auth_functions.py | 216 + .../domestic_bond/domestic_bond_examples.py | 165 + .../domestic_bond/domestic_bond_examples_ws.py | 53 + .../domestic_bond/domestic_bond_functions.py | 1685 + .../domestic_bond/domestic_bond_functions_ws.py | 233 + .../domestic_futureoption_examples.py | 296 + .../domestic_futureoption_examples_ws.py | 148 + .../domestic_futureoption_functions.py | 2165 ++ .../domestic_futureoption_functions_ws.py | 1710 + .../domestic_stock/domestic_stock_examples.py | 1256 + .../domestic_stock/domestic_stock_examples_ws.py | 181 + .../domestic_stock/domestic_stock_functions.py | 13463 ++++++++ .../domestic_stock/domestic_stock_functions_ws.py | 2129 ++ .../examples_user/elw/elw_examples.py | 165 + .../examples_user/elw/elw_examples_ws.py | 46 + .../examples_user/elw/elw_functions.py | 3021 ++ .../examples_user/elw/elw_functions_ws.py | 307 + .../examples_user/etfetn/etfetn_examples.py | 54 + .../examples_user/etfetn/etfetn_examples_ws.py | 34 + .../examples_user/etfetn/etfetn_functions.py | 317 + .../examples_user/etfetn/etfetn_functions_ws.py | 72 + 한국투자증권(API)/examples_user/kis_auth.py | 799 + .../overseas_futureoption_examples.py | 250 + .../overseas_futureoption_examples_ws.py | 52 + .../overseas_futureoption_functions.py | 4060 +++ .../overseas_futureoption_functions_ws.py | 324 + .../overseas_stock/overseas_stock_examples.py | 414 + .../overseas_stock/overseas_stock_examples_ws.py | 52 + .../overseas_stock/overseas_stock_functions.py | 5814 ++++ .../overseas_stock/overseas_stock_functions_ws.py | 295 + 한국투자증권(API)/kis_devlp.yaml | 35 + 한국투자증권(API)/legacy/README.md | 478 + 한국투자증권(API)/legacy/Sample01/README.md | 12 + .../legacy/Sample01/kis_api01.py | 170 + .../legacy/Sample01/kis_api02.py | 53 + .../legacy/Sample01/kis_api03.py | 151 + .../legacy/Sample01/kis_api04.py | 132 + 한국투자증권(API)/legacy/Sample01/kis_auth.py | 355 + .../legacy/Sample01/kis_devlp.yaml | 67 + .../legacy/Sample01/kis_domfuopt.py | 366 + .../legacy/Sample01/kis_domstk.py | 1357 + .../legacy/Sample01/kis_domstk_ws.py | 487 + .../legacy/Sample01/kis_ovrseafuopt.py | 1173 + .../legacy/Sample01/kis_ovrseafuopt_ws.py | 508 + .../legacy/Sample01/kis_ovrseastk.py | 1581 + .../legacy/Sample01/kis_ovrseastk_ws.py | 468 + .../legacy/Sample02/CSharp/Common.cs | 499 + .../legacy/Sample02/CSharp/KIS_OverseaStk.cs | 1585 + .../legacy/Sample02/CSharp/Program.cs | 166 + .../legacy/Sample02/CSharp/kis_devlp_Sample.yaml | 34 + .../legacy/Sample02/Make/POST 인풋예제1.PNG | Bin 0 -> 55334 bytes .../legacy/Sample02/Make/POST 인풋예제2.PNG | Bin 0 -> 13843 bytes 한국투자증권(API)/legacy/postman/README.md | 333 + .../postman/모의계좌_POSTMAN_샘플코드_v1.6.json | 5634 ++++ .../legacy/postman/모의계좌_POSTMAN_환경변수.json | 1 + .../postman/실전계좌_POSTMAN_샘플코드_v2.6.json | 26763 ++++++++++++++++ .../legacy/postman/실전계좌_POSTMAN_환경변수.json | 1 + 한국투자증권(API)/legacy/rest/README.md | 64 + 한국투자증권(API)/legacy/rest/config.yaml | 14 + .../legacy/rest/current_price_samle.py | 54 + .../legacy/rest/get_interest_stocks_price.py | 141 + .../legacy/rest/get_ovsfut_chart_price.py | 150 + .../legacy/rest/get_ovsstk_chart_price.py | 182 + 한국투자증권(API)/legacy/rest/kis_api.py | 663 + 한국투자증권(API)/legacy/rest/kis_auth.py | 208 + 한국투자증권(API)/legacy/rest/kis_devlp.yaml | 28 + 한국투자증권(API)/legacy/rest/kisdev_vi.yaml | 20 + 한국투자증권(API)/legacy/rest/vba_sample.xlsm | Bin 0 -> 79260 bytes ...투자증권 오픈API엑셀_샘플(국내주식시세주문).xlsm | Bin 0 -> 138921 bytes .../legacy/websocket/delphi/KISWebSocket.dpr | 14 + .../legacy/websocket/delphi/KISWebSocket.dproj | 1119 + .../legacy/websocket/delphi/MainForm.dfm | 183 + .../legacy/websocket/delphi/MainForm.pas | 306 + .../websocket/python/multi_processing_sample_ws.py | 560 + .../legacy/websocket/python/ops_ws_sample.py | 299 + .../legacy/websocket/python/ws_commodity_future.py | 283 + .../websocket/python/ws_domestic+overseas_stock.py | 397 + .../legacy/websocket/python/ws_domestic_future.py | 633 + .../websocket/python/ws_domestic_overseas_all.py | 1508 + .../legacy/websocket/python/ws_domestic_stock.py | 312 + .../legacy/websocket/python/ws_overseas_future.py | 288 + .../legacy/websocket/python/ws_overseas_stock.py | 303 + 한국투자증권(API)/pyproject.toml | 15 + 한국투자증권(API)/requirements.txt | 21 + .../stocks_info/domestic_bond_code.py | 64 + .../stocks_info/domestic_cme_future_code.py | 44 + .../stocks_info/domestic_commodity_future_code.py | 68 + .../stocks_info/domestic_elw_code.py | 105 + .../stocks_info/domestic_eurex_option_code.py | 68 + .../stocks_info/domestic_index_future_code.py | 34 + .../stocks_info/domestic_stock_future_code.py | 39 + .../stocks_info/kis_konex_code_mst.py | 112 + .../stocks_info/kis_kosdaq_code_mst.py | 104 + .../stocks_info/kis_kospi_code_mst.py | 108 + 한국투자증권(API)/stocks_info/member_code.py | 51 + .../stocks_info/overseas_future_code.py | 61 + .../stocks_info/overseas_index_code.py | 81 + .../stocks_info/overseas_stock_code.py | 75 + 한국투자증권(API)/stocks_info/sector_code.py | 35 + 한국투자증권(API)/stocks_info/theme_code.py | 36 + 한국투자증권(API)/stocks_info/업종코드정보.h | 9 + .../stocks_info/종목마스터정보(ELW).h | 40 + .../stocks_info/종목마스터정보(상품선물옵션).h | 26 + .../stocks_info/종목마스터정보(주식선물옵션).h | 18 + .../stocks_info/종목마스터정보(지수선물옵션).h | 23 + .../stocks_info/종목마스터정보(채권).h | 22 + .../stocks_info/종목마스터정보(코넥스).h | 56 + .../stocks_info/종목마스터정보(코스닥).h | 89 + .../stocks_info/종목마스터정보(코스피).h | 99 + .../stocks_info/종목마스터정보(회원사).h | 9 + 한국투자증권(API)/stocks_info/테마코드정보.h | 10 + 한국투자증권(API)/stocks_info/해외선물정보.h | 27 + 한국투자증권(API)/stocks_info/해외옵션정보.h | 54 + .../해외종목코드정보(미국,중국,일본,홍콩,베트남).h | 35 + .../stocks_info/해외주식옵션정보.h | 54 + .../stocks_info/해외주식지수정보.h | 29 + 867 files changed, 209640 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 backend/config.py create mode 100644 backend/data/nasdaq.txt create mode 100644 backend/data/nasdaq_screener_1769693338554.csv create mode 100644 backend/database.py create mode 100644 backend/kis_api.py create mode 100644 backend/main.py create mode 100644 backend/master_loader.py create mode 100644 backend/migrate_db.py create mode 100644 backend/migrate_db_v2.py create mode 100644 backend/migrate_db_v3.py create mode 100644 backend/news_ai.py create mode 100644 backend/telegram_notifier.py create mode 100644 backend/test_db_verification.py create mode 100644 backend/test_telegram_toggle.py create mode 100644 backend/tmp_master/kosdaq_code.mst create mode 100644 backend/tmp_master/kospi_code.mst create mode 100644 backend/trader.py create mode 100644 backend/websocket_manager.py create mode 100644 frontend/css/style.css create mode 100644 frontend/index.html create mode 100644 frontend/news.html create mode 100644 frontend/settings.html create mode 100644 frontend/stocks.html create mode 100644 frontend/trade.html create mode 100644 requirements.txt create mode 100644 run.bat create mode 100644 test_migration.py create mode 100644 목표.md create mode 100644 한국투자증권(API)/.gitignore create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/.dockerignore create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/.env.live create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/.gitignore create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/.python-version create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/Dockerfile create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/Readme.md create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/auth.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_bond.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_futureoption.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_stock.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/elw.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/etfetn.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_futureoption.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_stock.json create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/__init__.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/auth.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/base.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_bond.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_futureoption.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_stock.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/elw.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/etfetn.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_futureoption.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_stock.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/model/updated.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/__init__.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/decorator.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/factory.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/middleware.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/__init__.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/database.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/environment.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/kis.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/master_file.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/pyproject.toml create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/server.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/__init__.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/auth.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/base.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_bond.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_futureoption.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_stock.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/elw.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/etfetn.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_futureoption.py create mode 100644 한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_stock.py create mode 100644 한국투자증권(API)/MCP/MCP AI 도구 연결 방법.md create mode 100644 한국투자증권(API)/MCP/README.MD create mode 100644 한국투자증권(API)/README.md create mode 100644 한국투자증권(API)/docs/convention.md create mode 100644 한국투자증권(API)/examples_llm/auth/auth_token/auth_token.py create mode 100644 한국투자증권(API)/examples_llm/auth/auth_token/chk_auth_token.py create mode 100644 한국투자증권(API)/examples_llm/auth/auth_ws_token/auth_ws_token.py create mode 100644 한국투자증권(API)/examples_llm/auth/auth_ws_token/chk_auth_ws_token.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/avg_unit/avg_unit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/avg_unit/chk_avg_unit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/bond_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/chk_bond_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/bond_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/chk_bond_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/bond_index_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/chk_bond_index_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/buy/buy.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/buy/chk_buy.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/chk_inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/chk_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/chk_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/chk_inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/chk_inquire_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/inquire_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_price/chk_inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_price/inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/chk_inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/issue_info/chk_issue_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/issue_info/issue_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/chk_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/chk_search_bond_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/search_bond_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/sell/chk_sell.py create mode 100644 한국투자증권(API)/examples_llm/domestic_bond/sell/sell.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/chk_commodity_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/commodity_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/chk_commodity_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/commodity_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/chk_display_board_callput.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/display_board_callput.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/chk_display_board_futures.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/display_board_futures.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/chk_display_board_option_list.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/display_board_option_list.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/chk_display_board_top.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/display_board_top.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/chk_exp_price_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/exp_price_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/chk_fuopt_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/fuopt_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/chk_futures_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/futures_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/chk_index_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/index_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/chk_index_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/index_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/chk_index_option_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/index_option_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/chk_index_option_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/index_option_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/chk_inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/chk_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/chk_inquire_balance_settlement_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/inquire_balance_settlement_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/chk_inquire_balance_valuation_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/inquire_balance_valuation_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/chk_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/chk_inquire_ccnl_bstime.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/inquire_ccnl_bstime.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/chk_inquire_daily_amount_fee.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/inquire_daily_amount_fee.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/chk_inquire_daily_fuopchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/inquire_daily_fuopchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/chk_inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/chk_inquire_ngt_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/inquire_ngt_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/chk_inquire_ngt_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/inquire_ngt_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/chk_inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/chk_inquire_psbl_ngt_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/inquire_psbl_ngt_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/chk_inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/chk_inquire_time_fuopchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/inquire_time_fuopchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/chk_krx_ngt_futures_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/krx_ngt_futures_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/chk_krx_ngt_futures_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/krx_ngt_futures_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/chk_krx_ngt_futures_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/krx_ngt_futures_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/chk_krx_ngt_option_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/krx_ngt_option_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/chk_krx_ngt_option_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/krx_ngt_option_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/chk_krx_ngt_option_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/krx_ngt_option_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/chk_krx_ngt_option_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/krx_ngt_option_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/chk_ngt_margin_detail.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/ngt_margin_detail.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/chk_option_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/option_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/order/chk_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/order/order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/chk_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/chk_stock_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/stock_futures_realtime_conclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/chk_stock_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/stock_futures_realtime_quote.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/chk_stock_option_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/stock_option_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/chk_stock_option_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/stock_option_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/after_hour_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/chk_after_hour_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/asking_price_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/chk_asking_price_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/asking_price_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/chk_asking_price_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/asking_price_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/chk_asking_price_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/bulk_trans_num.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/chk_bulk_trans_num.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/capture_uplowprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/chk_capture_uplowprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/chk_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/chk_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/ccnl_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/chk_ccnl_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/ccnl_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/chk_ccnl_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_chk_holiday.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_holiday.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_interest/chk_comp_interest.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_interest/comp_interest.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/chk_comp_program_trade_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/comp_program_trade_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/chk_comp_program_trade_today.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/comp_program_trade_today.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/credit_balance/chk_credit_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/credit_balance/credit_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/chk_credit_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/credit_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/chk_daily_credit_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/daily_credit_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/chk_daily_loan_trans.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/daily_loan_trans.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/chk_daily_short_sale.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/daily_short_sale.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/disparity/chk_disparity.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/disparity/disparity.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/chk_dividend_rate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/dividend_rate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/chk_estimate_perform.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/estimate_perform.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/chk_exp_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/exp_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/chk_exp_ccnl_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/exp_ccnl_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/chk_exp_ccnl_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/exp_ccnl_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/chk_exp_closing_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/exp_closing_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/chk_exp_index_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/exp_index_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/chk_exp_price_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/exp_price_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/chk_exp_total_index.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/exp_total_index.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/chk_exp_trans_updown.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/exp_trans_updown.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/chk_finance_balance_sheet.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/finance_balance_sheet.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/chk_finance_financial_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/finance_financial_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/chk_finance_growth_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/finance_growth_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/chk_finance_income_statement.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/finance_income_statement.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/chk_finance_other_major_ratios.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/finance_other_major_ratios.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/chk_finance_profit_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/finance_profit_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/chk_finance_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/finance_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/chk_finance_stability_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/finance_stability_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/fluctuation/chk_fluctuation.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/fluctuation/fluctuation.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/chk_foreign_institution_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/foreign_institution_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/chk_frgnmem_pchs_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/frgnmem_pchs_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/chk_frgnmem_trade_estimate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/frgnmem_trade_estimate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/chk_frgnmem_trade_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/frgnmem_trade_trend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/chk_hts_top_view.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/hts_top_view.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/chk_index_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/index_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/chk_index_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/index_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/chk_index_program_trade.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/index_program_trade.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/chk_inquire_account_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/inquire_account_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/chk_inquire_asking_price_exp_ccn.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/inquire_asking_price_exp_ccn.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/chk_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/chk_inquire_balance_rlz_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/inquire_balance_rlz_pl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/chk_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/chk_inquire_credit_psamount.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/inquire_credit_psamount.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/chk_inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/chk_inquire_daily_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/inquire_daily_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/chk_inquire_daily_overtimeprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/inquire_daily_overtimeprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/chk_inquire_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/inquire_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/chk_inquire_daily_trade_volume.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/inquire_daily_trade_volume.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/chk_inquire_elw_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/inquire_elw_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/chk_inquire_index_category_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/inquire_index_category_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/chk_inquire_index_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/inquire_index_daily_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/chk_inquire_index_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/inquire_index_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/chk_inquire_index_tickprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/inquire_index_tickprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/chk_inquire_index_timeprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/inquire_index_timeprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/chk_inquire_investor.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/inquire_investor.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/chk_inquire_investor_daily_by_market.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/inquire_investor_daily_by_market.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/chk_inquire_investor_time_by_market.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/inquire_investor_time_by_market.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_member/chk_inquire_member.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_member/inquire_member.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/chk_inquire_member_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/inquire_member_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/chk_inquire_overtime_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/inquire_overtime_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/chk_inquire_overtime_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/inquire_overtime_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/chk_inquire_period_profit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/inquire_period_profit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/chk_inquire_period_trade_profit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/inquire_period_trade_profit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_price/chk_inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_price/inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/chk_inquire_price_2.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/inquire_price_2.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/chk_inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/chk_inquire_psbl_sell.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/inquire_psbl_sell.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/chk_inquire_time_dailychartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/inquire_time_dailychartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/chk_inquire_time_itemconclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/inquire_time_itemconclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/chk_inquire_time_overtimeconclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/inquire_time_overtimeconclusion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/chk_inquire_vi_status.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/inquire_vi_status.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/chk_intgr_margin.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/intgr_margin.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/chk_intstock_grouplist.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/intstock_grouplist.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/chk_intstock_multprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/intstock_multprice.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/chk_intstock_stocklist_by_group.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/intstock_stocklist_by_group.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/chk_invest_opbysec.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/invest_opbysec.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/chk_invest_opinion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/invest_opinion.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/chk_investor_program_trade_today.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/investor_program_trade_today.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/chk_investor_trade_by_stock_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/investor_trade_by_stock_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/chk_investor_trend_estimate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/investor_trend_estimate.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/chk_ksdinfo_bonus_issue.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/ksdinfo_bonus_issue.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/chk_ksdinfo_cap_dcrs.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/ksdinfo_cap_dcrs.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/chk_ksdinfo_dividend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/ksdinfo_dividend.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/chk_ksdinfo_forfeit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/ksdinfo_forfeit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/chk_ksdinfo_list_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/ksdinfo_list_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/chk_ksdinfo_mand_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/ksdinfo_mand_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/chk_ksdinfo_merger_split.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/ksdinfo_merger_split.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/chk_ksdinfo_paidin_capin.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/ksdinfo_paidin_capin.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/chk_ksdinfo_pub_offer.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/ksdinfo_pub_offer.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/chk_ksdinfo_purreq.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/ksdinfo_purreq.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/chk_ksdinfo_rev_split.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/ksdinfo_rev_split.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/chk_ksdinfo_sharehld_meet.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/ksdinfo_sharehld_meet.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/chk_lendable_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/lendable_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_cap/chk_market_cap.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_cap/market_cap.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/chk_market_status_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/market_status_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/chk_market_status_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/market_status_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_total/chk_market_status_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_status_total/market_status_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_time/chk_market_time.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_time/market_time.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_value/chk_market_value.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/market_value/market_value.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_krx/chk_member_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_krx/member_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_nxt/chk_member_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_nxt/member_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_total/chk_member_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/member_total/member_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/mktfunds/chk_mktfunds.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/mktfunds/mktfunds.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/chk_near_new_highlow.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/near_new_highlow.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/news_title/chk_news_title.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/news_title/news_title.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_cash/chk_order_cash.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_cash/order_cash.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_credit/chk_order_credit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_credit/order_credit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv/chk_order_resv.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv/order_resv.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/chk_order_resv_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/order_resv_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/chk_order_resv_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/order_resv_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/chk_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/chk_overtime_asking_price_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/overtime_asking_price_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/chk_overtime_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/overtime_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/chk_overtime_exp_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/overtime_exp_ccnl_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/chk_overtime_exp_trans_fluct.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/overtime_exp_trans_fluct.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/chk_overtime_fluctuation.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/overtime_fluctuation.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/chk_overtime_volume.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/overtime_volume.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/chk_pbar_tratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/pbar_tratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/chk_pension_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/pension_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/chk_pension_inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/pension_inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/chk_pension_inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/pension_inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/chk_pension_inquire_present_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/pension_inquire_present_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/chk_pension_inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/pension_inquire_psbl_order.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/period_rights/chk_period_rights.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/period_rights/period_rights.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/chk_prefer_disparate_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/prefer_disparate_ratio.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/chk_profit_asset_index.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/profit_asset_index.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/chk_program_trade_by_stock.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/program_trade_by_stock.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/chk_program_trade_by_stock_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/program_trade_by_stock_daily.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/chk_program_trade_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/program_trade_krx.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/chk_program_trade_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/program_trade_nxt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/chk_program_trade_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/program_trade_total.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/psearch_result/chk_psearch_result.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/psearch_result/psearch_result.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/psearch_title/chk_psearch_title.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/psearch_title/psearch_title.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/quote_balance/chk_quote_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/quote_balance/quote_balance.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/search_info/chk_search_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/search_info/search_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/chk_search_stock_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/search_stock_info.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/short_sale/chk_short_sale.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/short_sale/short_sale.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/chk_top_interest_stock.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/top_interest_stock.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/chk_traded_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/traded_by_company.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/chk_tradprt_byamt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/tradprt_byamt.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/volume_power/chk_volume_power.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/volume_power/volume_power.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/volume_rank/chk_volume_rank.py create mode 100644 한국투자증권(API)/examples_llm/domestic_stock/volume_rank/volume_rank.py create mode 100644 한국투자증권(API)/examples_llm/elw/compare_stocks/chk_compare_stocks.py create mode 100644 한국투자증권(API)/examples_llm/elw/compare_stocks/compare_stocks.py create mode 100644 한국투자증권(API)/examples_llm/elw/cond_search/chk_cond_search.py create mode 100644 한국투자증권(API)/examples_llm/elw/cond_search/cond_search.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_asking_price/chk_elw_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_asking_price/elw_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_ccnl/chk_elw_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_ccnl/elw_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/chk_elw_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/elw_exp_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/expiration_stocks/chk_expiration_stocks.py create mode 100644 한국투자증권(API)/examples_llm/elw/expiration_stocks/expiration_stocks.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator/chk_indicator.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator/indicator.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/chk_indicator_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/indicator_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_daily/chk_indicator_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_daily/indicator_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_minute/chk_indicator_trend_minute.py create mode 100644 한국투자증권(API)/examples_llm/elw/indicator_trend_minute/indicator_trend_minute.py create mode 100644 한국투자증권(API)/examples_llm/elw/lp_trade_trend/chk_lp_trade_trend.py create mode 100644 한국투자증권(API)/examples_llm/elw/lp_trade_trend/lp_trade_trend.py create mode 100644 한국투자증권(API)/examples_llm/elw/newly_listed/chk_newly_listed.py create mode 100644 한국투자증권(API)/examples_llm/elw/newly_listed/newly_listed.py create mode 100644 한국투자증권(API)/examples_llm/elw/quick_change/chk_quick_change.py create mode 100644 한국투자증권(API)/examples_llm/elw/quick_change/quick_change.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity/chk_sensitivity.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity/sensitivity.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/chk_sensitivity_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/sensitivity_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/chk_sensitivity_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/sensitivity_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/udrl_asset_list/chk_udrl_asset_list.py create mode 100644 한국투자증권(API)/examples_llm/elw/udrl_asset_list/udrl_asset_list.py create mode 100644 한국투자증권(API)/examples_llm/elw/udrl_asset_price/chk_udrl_asset_price.py create mode 100644 한국투자증권(API)/examples_llm/elw/udrl_asset_price/udrl_asset_price.py create mode 100644 한국투자증권(API)/examples_llm/elw/updown_rate/chk_updown_rate.py create mode 100644 한국투자증권(API)/examples_llm/elw/updown_rate/updown_rate.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/chk_volatility_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/volatility_trend_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_daily/chk_volatility_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_daily/volatility_trend_daily.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_minute/chk_volatility_trend_minute.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_minute/volatility_trend_minute.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_tick/chk_volatility_trend_tick.py create mode 100644 한국투자증권(API)/examples_llm/elw/volatility_trend_tick/volatility_trend_tick.py create mode 100644 한국투자증권(API)/examples_llm/elw/volume_rank/chk_volume_rank.py create mode 100644 한국투자증권(API)/examples_llm/elw/volume_rank/volume_rank.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/chk_etf_nav_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/etf_nav_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/chk_inquire_component_stock_price.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/inquire_component_stock_price.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/inquire_price/chk_inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/inquire_price/inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/chk_nav_comparison_daily_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/nav_comparison_daily_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/chk_nav_comparison_time_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/nav_comparison_time_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/chk_nav_comparison_trend.py create mode 100644 한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/nav_comparison_trend.py create mode 100644 한국투자증권(API)/examples_llm/kis_auth.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/chk_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/chk_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/chk_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/chk_daily_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/daily_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/chk_inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/chk_inquire_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/inquire_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/chk_inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/inquire_daily_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/chk_inquire_daily_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/inquire_daily_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/chk_inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/inquire_deposit.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/chk_inquire_period_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/inquire_period_ccld.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/chk_inquire_period_trans.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/inquire_period_trans.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/chk_inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/inquire_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/chk_inquire_psamount.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/inquire_psamount.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/chk_inquire_time_futurechartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/inquire_time_futurechartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/chk_inquire_time_optchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/inquire_time_optchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/chk_inquire_unpd.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/inquire_unpd.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/chk_investor_unpd_trend.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/investor_unpd_trend.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/chk_margin_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/margin_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/market_time/chk_market_time.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/market_time/market_time.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/chk_monthly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/monthly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/chk_opt_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/opt_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/chk_opt_daily_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/opt_daily_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/chk_opt_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/opt_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/chk_opt_monthly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/opt_monthly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/chk_opt_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/opt_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/chk_opt_tick_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/opt_tick_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/chk_opt_weekly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/opt_weekly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order/chk_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order/order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/chk_order_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/order_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/chk_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/chk_search_contract_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/search_contract_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/chk_search_opt_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/search_opt_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/chk_stock_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/stock_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/chk_tick_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/tick_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/chk_weekly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/weekly_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/algo_ordno.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/chk_algo_ordno.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/asking_price/asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/asking_price/chk_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/brknews_title/brknews_title.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/brknews_title/chk_brknews_title.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/chk_ccnl_notice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/chk_colable_by_company.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/colable_by_company.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/chk_countries_holiday.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/countries_holiday.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/dailyprice/chk_dailyprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/dailyprice/dailyprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/daytime_order/chk_daytime_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/daytime_order/daytime_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/chk_daytime_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/daytime_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/chk_delayed_asking_price_asia.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/delayed_asking_price_asia.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/chk_delayed_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/delayed_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/chk_foreign_margin.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/foreign_margin.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/industry_price/chk_industry_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/industry_price/industry_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/industry_theme/chk_industry_theme.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/industry_theme/industry_theme.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/chk_inquire_algo_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/inquire_algo_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/chk_inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/inquire_asking_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/chk_inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/inquire_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/chk_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/chk_inquire_daily_chartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/inquire_daily_chartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/chk_inquire_nccs.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/inquire_nccs.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/chk_inquire_paymt_stdr_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/inquire_paymt_stdr_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/chk_inquire_period_profit.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/inquire_period_profit.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/chk_inquire_period_trans.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/inquire_period_trans.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/chk_inquire_present_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/inquire_present_balance.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/chk_inquire_psamount.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/inquire_psamount.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_search/chk_inquire_search.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_search/inquire_search.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/market_cap/chk_market_cap.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/market_cap/market_cap.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/new_highlow/chk_new_highlow.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/new_highlow/new_highlow.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/news_title/chk_news_title.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/news_title/news_title.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order/chk_order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order/order.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv/chk_order_resv.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv/order_resv.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/chk_order_resv_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/order_resv_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/chk_order_resv_list.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/order_resv_list.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/chk_order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/order_rvsecncl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/period_rights/chk_period_rights.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/period_rights/period_rights.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price/chk_price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price/price.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price_detail/chk_price_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price_detail/price_detail.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price_fluct/chk_price_fluct.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/price_fluct/price_fluct.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/chk_quot_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/quot_inquire_ccnl.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/chk_rights_by_ice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/rights_by_ice.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/search_info/chk_search_info.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/search_info/search_info.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_growth/chk_trade_growth.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_growth/trade_growth.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/chk_trade_pbmn.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/trade_pbmn.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/chk_trade_turnover.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/trade_turnover.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_vol/chk_trade_vol.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/trade_vol/trade_vol.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/updown_rate/chk_updown_rate.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/updown_rate/updown_rate.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/volume_power/chk_volume_power.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/volume_power/volume_power.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/volume_surge/chk_volume_surge.py create mode 100644 한국투자증권(API)/examples_llm/overseas_stock/volume_surge/volume_surge.py create mode 100644 한국투자증권(API)/examples_user/auth/auth_examples.py create mode 100644 한국투자증권(API)/examples_user/auth/auth_functions.py create mode 100644 한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples.py create mode 100644 한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions.py create mode 100644 한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples.py create mode 100644 한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions.py create mode 100644 한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples.py create mode 100644 한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions.py create mode 100644 한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/elw/elw_examples.py create mode 100644 한국투자증권(API)/examples_user/elw/elw_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/elw/elw_functions.py create mode 100644 한국투자증권(API)/examples_user/elw/elw_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/etfetn/etfetn_examples.py create mode 100644 한국투자증권(API)/examples_user/etfetn/etfetn_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/etfetn/etfetn_functions.py create mode 100644 한국투자증권(API)/examples_user/etfetn/etfetn_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/kis_auth.py create mode 100644 한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples.py create mode 100644 한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions.py create mode 100644 한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions_ws.py create mode 100644 한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples.py create mode 100644 한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples_ws.py create mode 100644 한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions.py create mode 100644 한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions_ws.py create mode 100644 한국투자증권(API)/kis_devlp.yaml create mode 100644 한국투자증권(API)/legacy/README.md create mode 100644 한국투자증권(API)/legacy/Sample01/README.md create mode 100644 한국투자증권(API)/legacy/Sample01/kis_api01.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_api02.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_api03.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_api04.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_auth.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_devlp.yaml create mode 100644 한국투자증권(API)/legacy/Sample01/kis_domfuopt.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_domstk.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_domstk_ws.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt_ws.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_ovrseastk.py create mode 100644 한국투자증권(API)/legacy/Sample01/kis_ovrseastk_ws.py create mode 100644 한국투자증권(API)/legacy/Sample02/CSharp/Common.cs create mode 100644 한국투자증권(API)/legacy/Sample02/CSharp/KIS_OverseaStk.cs create mode 100644 한국투자증권(API)/legacy/Sample02/CSharp/Program.cs create mode 100644 한국투자증권(API)/legacy/Sample02/CSharp/kis_devlp_Sample.yaml create mode 100644 한국투자증권(API)/legacy/Sample02/Make/POST 인풋예제1.PNG create mode 100644 한국투자증권(API)/legacy/Sample02/Make/POST 인풋예제2.PNG create mode 100644 한국투자증권(API)/legacy/postman/README.md create mode 100644 한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_샘플코드_v1.6.json create mode 100644 한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_환경변수.json create mode 100644 한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_샘플코드_v2.6.json create mode 100644 한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_환경변수.json create mode 100644 한국투자증권(API)/legacy/rest/README.md create mode 100644 한국투자증권(API)/legacy/rest/config.yaml create mode 100644 한국투자증권(API)/legacy/rest/current_price_samle.py create mode 100644 한국투자증권(API)/legacy/rest/get_interest_stocks_price.py create mode 100644 한국투자증권(API)/legacy/rest/get_ovsfut_chart_price.py create mode 100644 한국투자증권(API)/legacy/rest/get_ovsstk_chart_price.py create mode 100644 한국투자증권(API)/legacy/rest/kis_api.py create mode 100644 한국투자증권(API)/legacy/rest/kis_auth.py create mode 100644 한국투자증권(API)/legacy/rest/kis_devlp.yaml create mode 100644 한국투자증권(API)/legacy/rest/kisdev_vi.yaml create mode 100644 한국투자증권(API)/legacy/rest/vba_sample.xlsm create mode 100644 한국투자증권(API)/legacy/rest/한국투자증권 오픈API엑셀_샘플(국내주식시세주문).xlsm create mode 100644 한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dpr create mode 100644 한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dproj create mode 100644 한국투자증권(API)/legacy/websocket/delphi/MainForm.dfm create mode 100644 한국투자증권(API)/legacy/websocket/delphi/MainForm.pas create mode 100644 한국투자증권(API)/legacy/websocket/python/multi_processing_sample_ws.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ops_ws_sample.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_commodity_future.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_domestic+overseas_stock.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_domestic_future.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_domestic_overseas_all.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_domestic_stock.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_overseas_future.py create mode 100644 한국투자증권(API)/legacy/websocket/python/ws_overseas_stock.py create mode 100644 한국투자증권(API)/pyproject.toml create mode 100644 한국투자증권(API)/requirements.txt create mode 100644 한국투자증권(API)/stocks_info/domestic_bond_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_cme_future_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_commodity_future_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_elw_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_eurex_option_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_index_future_code.py create mode 100644 한국투자증권(API)/stocks_info/domestic_stock_future_code.py create mode 100644 한국투자증권(API)/stocks_info/kis_konex_code_mst.py create mode 100644 한국투자증권(API)/stocks_info/kis_kosdaq_code_mst.py create mode 100644 한국투자증권(API)/stocks_info/kis_kospi_code_mst.py create mode 100644 한국투자증권(API)/stocks_info/member_code.py create mode 100644 한국투자증권(API)/stocks_info/overseas_future_code.py create mode 100644 한국투자증권(API)/stocks_info/overseas_index_code.py create mode 100644 한국투자증권(API)/stocks_info/overseas_stock_code.py create mode 100644 한국투자증권(API)/stocks_info/sector_code.py create mode 100644 한국투자증권(API)/stocks_info/theme_code.py create mode 100644 한국투자증권(API)/stocks_info/업종코드정보.h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(ELW).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(상품선물옵션).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(주식선물옵션).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(지수선물옵션).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(채권).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(코넥스).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(코스닥).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(코스피).h create mode 100644 한국투자증권(API)/stocks_info/종목마스터정보(회원사).h create mode 100644 한국투자증권(API)/stocks_info/테마코드정보.h create mode 100644 한국투자증권(API)/stocks_info/해외선물정보.h create mode 100644 한국투자증권(API)/stocks_info/해외옵션정보.h create mode 100644 한국투자증권(API)/stocks_info/해외종목코드정보(미국,중국,일본,홍콩,베트남).h create mode 100644 한국투자증권(API)/stocks_info/해외주식옵션정보.h create mode 100644 한국투자증권(API)/stocks_info/해외주식지수정보.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d998f2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +__pycache__/ +*.py[cod] +*$py.class +*.so +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Project specific +settings.yaml +kis_stock.db +kis_stock.db-shm +kis_stock.db-wal +kis_token.tmp +*.log + +# KIS Sample +한국투자증권/kis_devlp.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b04b753 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Python 3.11 Full Image (Fix for Segmentation Fault in slim) +FROM python:3.11 + +# Set working directory +WORKDIR /app + +# Upgrade pip +RUN pip install --upgrade pip setuptools wheel + +# Install core dependencies first +RUN pip install fastapi uvicorn sqlalchemy requests pandas pyyaml jinja2 python-multipart websockets python-telegram-bot watchfiles + +# Install heavy dependencies separately (to debug Segfault) +RUN pip install google-generativeai + +# Copy application code +COPY backend /app/backend +COPY frontend /app/frontend +COPY settings.yaml /app/settings.yaml + +# Set Env Defaults +ENV PYTHONUNBUFFERED=1 + +# Expose Port 80 +EXPOSE 80 + +# Run Application (Port 80) +WORKDIR /app/backend +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"] \ No newline at end of file diff --git a/backend/config.py b/backend/config.py new file mode 100644 index 0000000..a3976d2 --- /dev/null +++ b/backend/config.py @@ -0,0 +1,18 @@ +import os +import yaml + +CONFIG_FILE = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "settings.yaml") + +def load_config(): + if not os.path.exists(CONFIG_FILE): + return {} + with open(CONFIG_FILE, 'r', encoding='utf-8') as f: + return yaml.safe_load(f) + +def save_config(config_data): + with open(CONFIG_FILE, 'w', encoding='utf-8') as f: + yaml.dump(config_data, f, allow_unicode=True) + +def get_kis_config(): + config = load_config() + return config.get('kis', {}) diff --git a/backend/data/nasdaq.txt b/backend/data/nasdaq.txt new file mode 100644 index 0000000..a4b3273 --- /dev/null +++ b/backend/data/nasdaq.txt @@ -0,0 +1,5285 @@ +Symbol|Security Name|Market Category|Test Issue|Financial Status|Round Lot Size|ETF|NextShares +AACB|Artius II Acquisition Inc. - Class A Ordinary Shares|G|N|N|100|N|N +AACBR|Artius II Acquisition Inc. - Rights|G|N|N|100|N|N +AACBU|Artius II Acquisition Inc. - Units|G|N|N|100|N|N +AACG|ATA Creativity Global - American Depositary Shares, each representing two common shares|S|N|N|100|N|N +AADR|AdvisorShares Dorsey Wright ADR ETF|G|N|N|100|Y|N +AAEQ|Alpha Architect US Equity 2 ETF|G|N|N|100|Y|N +AAL|American Airlines Group, Inc. - Common Stock|Q|N|N|100|N|N +AALG|Leverage Shares 2X Long AAL Daily ETF|G|N|N|100|Y|N +AAME|Atlantic American Corporation - Common Stock|G|N|N|100|N|N +AAOI|Applied Optoelectronics, Inc. - Common Stock|G|N|N|100|N|N +AAON|AAON, Inc. - Common Stock|Q|N|N|100|N|N +AAPB|GraniteShares 2x Long AAPL Daily ETF|G|N|N|100|Y|N +AAPD|Direxion Daily AAPL Bear 1X Shares|G|N|N|100|Y|N +AAPG|Ascentage Pharma Group International - American Depository Shares|G|N|N|100|N|N +AAPL|Apple Inc. - Common Stock|Q|N|N|100|N|N +AAPU|Direxion Daily AAPL Bull 2X Shares|G|N|N|100|Y|N +AARD|Aardvark Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +AAUS|Alpha Architect US Equity ETF|G|N|N|100|Y|N +AAVM|Alpha Architect Global Factor Equity ETF|G|N|N|100|Y|N +AAXJ|iShares MSCI All Country Asia ex Japan ETF|G|N|N|100|Y|N +ABAT|American Battery Technology Company - Common Stock|S|N|N|100|N|N +ABCL|AbCellera Biologics Inc. - Common Shares|Q|N|N|100|N|N +ABCS|Alpha Blue Capital US Small-Mid Cap Dynamic ETF|G|N|N|100|Y|N +ABEO|Abeona Therapeutics Inc. - Common Stock|S|N|N|100|N|N +ABI|VictoryShares Pioneer Asset-Based Income ETF|G|N|N|100|Y|N +ABIG|Argent Large Cap ETF|G|N|N|100|Y|N +ABLV|Able View Global Inc. - Class B Ordinary Shares|S|N|D|100|N|N +ABLVW|Able View Global Inc. - Warrant|S|N|N|100|N|N +ABNB|Airbnb, Inc. - Class A Common Stock|Q|N|N|100|N|N +ABNG|Leverage Shares 2x Long ABNB Daily ETF|G|N|N|100|Y|N +ABOS|Acumen Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +ABP|Abpro Holdings, Inc - Common Stock|S|N|N|100|N|N +ABPWW|Abpro Holdings, Inc - Warrant|S|N|N|100|N|N +ABSI|Absci Corporation - Common Stock|Q|N|N|100|N|N +ABTC|American Bitcoin Corp. - Class A Common Stock|S|N|N|100|N|N +ABTS|Abits Group Inc - Ordinary Shares|S|N|N|100|N|N +ABUS|Arbutus Biopharma Corporation - Common Stock|Q|N|N|100|N|N +ABVC|ABVC BioPharma, Inc. - Common Stock|S|N|N|100|N|N +ABVE|Above Food Ingredients Inc. - Common Stock|G|N|E|100|N|N +ABVEW|Above Food Ingredients Inc. - Warrant|G|N|E|100|N|N +ABVX|Abivax SA - American Depositary Shares|G|N|N|100|N|N +ACAD|ACADIA Pharmaceuticals Inc. - Common Stock|Q|N|N|100|N|N +ACB|Aurora Cannabis Inc. - Common Shares|S|N|N|100|N|N +ACCL|Acco Group Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +ACDC|ProFrac Holding Corp. - Class A Common Stock|Q|N|N|100|N|N +ACEP|ARS Core Equity Portfolio ETF|G|N|N|100|Y|N +ACET|Adicet Bio, Inc. - Common Stock|S|N|N|100|N|N +ACFN|Acorn Energy, Inc. - Common Stock|S|N|N|100|N|N +ACGL|Arch Capital Group Ltd. - Common Stock|Q|N|N|100|N|N +ACGLN|Arch Capital Group Ltd. - Depositary Shares, each Representing a 1/1,000th Interest in a 4.550% Non-Cumulative Preferred Share, Series G|Q|N|N|100|N|N +ACGLO|Arch Capital Group Ltd. - Depositary Shares Each Representing 1/1,000th Interest in a Share of5.45% Non-Cumulative Preferred Shares, Series F|Q|N|N|100|N|N +ACHC|Acadia Healthcare Company, Inc. - Common Stock|Q|N|N|100|N|N +ACHV|Achieve Life Sciences, Inc. - Common Shares|S|N|N|100|N|N +ACIC|American Coastal Insurance Corporation - Common Stock|S|N|N|100|N|N +ACIU|AC Immune SA - Common Stock|G|N|N|100|N|N +ACIW|ACI Worldwide, Inc. - Common Stock|Q|N|N|100|N|N +ACLS|Axcelis Technologies, Inc. - Common Stock|Q|N|N|100|N|N +ACLX|Arcellx, Inc. - Common Stock|Q|N|N|100|N|N +ACMR|ACM Research, Inc. - Class A Common Stock|G|N|N|100|N|N +ACNB|ACNB Corporation - Common Stock|S|N|N|100|N|N +ACNT|Ascent Industries Co. - Common Stock|G|N|N|100|N|N +ACOG|Alpha Cognition Inc. - Common Stock|S|N|N|100|N|N +ACON|Aclarion, Inc. - Common Stock|S|N|N|100|N|N +ACONW|Aclarion, Inc. - Warrant|S|N|N|100|N|N +ACRS|Aclaris Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ACRV|Acrivon Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +ACT|Enact Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ACTG|Acacia Research Corporation - Common Stock|Q|N|N|100|N|N +ACTU|Actuate Therapeutics, Inc. - Common stock|G|N|N|100|N|N +ACWI|iShares MSCI ACWI ETF|G|N|N|100|Y|N +ACWX|iShares MSCI ACWI ex U.S. ETF|G|N|N|100|Y|N +ACXP|Acurx Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +ADACU|American Drive Acquisition Company - Units|G|N|N|100|N|N +ADAG|Adagene Inc. - ADS, each representing 1.25 ordinary shares|G|N|N|100|N|N +ADAM|Adamas Trust, Inc. - Common Stock|Q|N|N|100|N|N +ADAMG|Adamas Trust, Inc. - 9.125% Senior Notes Due 2030|Q|N|N|100|N|N +ADAMH|Adamas Trust, Inc. - 9.875% Senior Notes Due 2030|G|N|N|100|N|N +ADAMI|Adamas Trust, Inc. - 9.125% Senior Notes Due 2029|Q|N|N|100|N|N +ADAML|Adamas Trust, Inc. - 6.875% Series F Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock, $0.01 par value per share|Q|N|N|100|N|N +ADAMM|Adamas Trust, Inc. - 7.875% Series E Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +ADAMN|Adamas Trust, Inc. - 8.00% Series D Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +ADAMO|Adamas Trust, Inc. - 9.250% Senior Notes Due 2031|Q|N|N|100|N|N +ADAMZ|Adamas Trust, Inc. - 7.000% Series G Cumulative Redeemable Preferred Stock, $0.01 par value per share|Q|N|N|100|N|N +ADBE|Adobe Inc. - Common Stock|Q|N|N|40|N|N +ADBG|Leverage Shares 2X Long ADBE Daily ETF|G|N|N|100|Y|N +ADEA|Adeia Inc. - Common Stock|Q|N|N|100|N|N +ADGM|Adagio Medical Holdings, Inc - Common Stock|S|N|N|100|N|N +ADI|Analog Devices, Inc. - Common Stock|Q|N|N|100|N|N +ADIL|Adial Pharmaceuticals, Inc - Common Stock|S|N|D|100|N|N +ADMA|ADMA Biologics Inc - Common Stock|G|N|N|100|N|N +ADP|Automatic Data Processing, Inc. - Common Stock|Q|N|N|40|N|N +ADPT|Adaptive Biotechnologies Corporation - Common Stock|Q|N|N|100|N|N +ADSE|ADS-TEC ENERGY PLC - Ordinary Shares|S|N|N|100|N|N +ADSEW|ADS-TEC ENERGY PLC - Warrant|S|N|N|100|N|N +ADSK|Autodesk, Inc. - Common Stock|Q|N|N|40|N|N +ADTN|ADTRAN Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ADTX|Aditxt, Inc. - Common Stock|S|N|D|100|N|N +ADUR|Aduro Clean Technologies Inc. - Common Stock|S|N|N|100|N|N +ADUS|Addus HomeCare Corporation - Common Stock|Q|N|N|100|N|N +ADV|Advantage Solutions Inc. - Class A Common Stock|Q|N|D|100|N|N +ADVB|Advanced Biomed Inc. - Common Stock|S|N|D|100|N|N +ADXN|Addex Therapeutics Ltd - American Depositary Shares|S|N|N|100|N|N +AEAQ|Activate Energy Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +AEAQU|Activate Energy Acquisition Corp. - Unit|G|N|N|100|N|N +AEAQW|Activate Energy Acquisition Corp. - Warrant|G|N|N|100|N|N +AEBI|Aebi Schmidt Holding AG - Common Stock|Q|N|N|100|N|N +AEC|Anfield Energy Inc. - Common Shares|S|N|N|100|N|N +AEHL|Antelope Enterprise Holdings Limited - Class A Ordinary Shares|S|N|E|100|N|N +AEHR|Aehr Test Systems - Common Stock|S|N|N|100|N|N +AEI|Alset Inc. - Common Stock|S|N|N|100|N|N +AEIS|Advanced Energy Industries, Inc. - Common Stock|Q|N|N|100|N|N +AEMD|Aethlon Medical, Inc. - Common Stock|S|N|N|100|N|N +AENT|Alliance Entertainment Holding Corporation - common stock|S|N|N|100|N|N +AENTW|Alliance Entertainment Holding Corporation - Warrants|S|N|N|100|N|N +AEP|American Electric Power Company, Inc. - Common Stock|Q|N|N|100|N|N +AERT|Aeries Technology, Inc. - Class A Ordinary Share|S|N|D|100|N|N +AERTW|Aeries Technology, Inc. - Warrant|S|N|N|100|N|N +AEVA|Aeva Technologies, Inc. - Common Stock|Q|N|N|100|N|N +AEVAW|Aeva Technologies, Inc. - Redeemable Warrants|Q|N|N|100|N|N +AEYE|AudioEye, Inc. - Common Stock|S|N|N|100|N|N +AFBI|Affinity Bancshares, Inc. - Common Stock|S|N|N|100|N|N +AFCG|Advanced Flower Capital Inc. - Common Stock|G|N|N|100|N|N +AFJK|Aimei Health Technology Co., Ltd - Ordinary Share|G|N|N|100|N|N +AFJKR|Aimei Health Technology Co., Ltd - Right|G|N|N|100|N|N +AFJKU|Aimei Health Technology Co., Ltd - Unit|G|N|N|100|N|N +AFOS|ARS Focused Opportunity Strategy ETF|G|N|N|100|Y|N +AFRI|Forafric Global PLC - Ordinary Shares|S|N|N|100|N|N +AFRIW|Forafric Global PLC - Warrants|S|N|N|100|N|N +AFRM|Affirm Holdings, Inc. - Class A Common Stock|Q|N|N|100|N|N +AFSC|abrdn Focused U.S. Small Cap Active ETF|G|N|N|100|Y|N +AFYA|Afya Limited - Class A Common Shares|Q|N|N|100|N|N +AGAE|Allied Gaming & Entertainment Inc. - Common Stock|S|N|D|100|N|N +AGCC|Agencia Comercial Spirits Ltd - Class A Ordinary Share|S|N|N|100|N|N +AGEM|abrdn Emerging Markets Dividend Active ETF|G|N|N|100|Y|N +AGEN|Agenus Inc. - Common Stock|S|N|N|100|N|N +AGGA|EA Astoria Dynamic Core US Fixed Income ETF|G|N|N|100|Y|N +AGH|Aureus Greenway Holdings Inc. - Common Stock|S|N|N|100|N|N +AGIO|Agios Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +AGIX|KraneShares Artificial Intelligence & Technology ETF|G|N|N|100|Y|N +AGMH|AGM Group Holdings Inc. - Class A Ordinary Shares|S|N|N|100|N|N +AGMI|Themes Silver Miners ETF|G|N|N|100|Y|N +AGNC|AGNC Investment Corp. - Common Stock|Q|N|N|100|N|N +AGNCL|AGNC Investment Corp. - Depositary Shares Each Representing a 1/1,000th Interest in a Share of 7.75% Series G Fixed-Rate Reset Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNCM|AGNC Investment Corp. - Depositary Shares rep 6.875% Series D Fixed-to-Floating Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNCN|AGNC Investment Corp. - Depositary Shares Each Representing a 1/1,000th Interest in a Share of 7.00% Series C Fixed-To-Floating Rate Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNCO|AGNC Investment Corp. - Depositary Shares, each representing a 1/1,000th interest in a share of Series E Fixed-to-Floating Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNCP|AGNC Investment Corp. - Depositary Shares Each Representing a 1/1,000th Interest in a Share of 6.125% Series F Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNCZ|AGNC Investment Corp. - Depositary Shares Each Representing a 1/1,000th Interest in a Share of 8.75% Series H Fixed-Rate Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +AGNG|Global X Aging Population ETF|G|N|N|100|Y|N +AGPU|Axe Compute Inc. - Common Stock|S|N|N|100|N|N +AGRZ|Agroz Inc. - Ordinary Shares|S|N|N|100|N|N +AGYS|Agilysys, Inc. - Common Stock|Q|N|N|100|N|N +AGZD|WisdomTree Interest Rate Hedged U.S. Aggregate Bond Fund|G|N|N|100|Y|N +AHCO|AdaptHealth Corp. - Common Stock|S|N|N|100|N|N +AHG|Akso Health Group - American Depositary Shares|S|N|N|100|N|N +AHMA|Ambitions Enterprise Management Co. L.L.C - Class A Ordinary Shares|S|N|N|100|N|N +AIA|iShares Asia 50 ETF|G|N|N|100|Y|N +AIFD|TCW Artificial Intelligence ETF|G|N|N|100|Y|N +AIFF|Firefly Neuroscience, Inc. - Common Stock|S|N|N|100|N|N +AIFU|AIFU Inc. - Class A Ordinary Share|Q|N|N|100|N|N +AIHS|Senmiao Technology Limited - Common Stock|S|N|D|100|N|N +AIIO|Robo.ai Inc. - Class B Ordinary Shares|S|N|D|100|N|N +AIIOW|Robo.ai Inc. - Warrant|S|N|N|100|N|N +AIMD|Ainos, Inc. - Common Stock|S|N|N|100|N|N +AIMDW|Ainos, Inc. - warrants|S|N|N|100|N|N +AIOT|PowerFleet, Inc. - Common Stock|G|N|N|100|N|N +AIP|Arteris, Inc. - Common Stock|G|N|N|100|N|N +AIPI|REX AI Equity Premium Income ETF|G|N|N|100|Y|N +AIPO|Defiance AI & Power Infrastructure ETF|G|N|N|100|Y|N +AIQ|Global X Artificial Intelligence & Technology ETF|G|N|N|100|Y|N +AIRE|reAlpha Tech Corp. - Common Stock|S|N|D|100|N|N +AIRG|Airgain, Inc. - Common Stock|S|N|N|100|N|N +AIRJ|AirJoule Technologies Corporation - Class A Common Stock|S|N|N|100|N|N +AIRJW|AirJoule Technologies Corporation - Warrant|S|N|N|100|N|N +AIRO|AIRO Group Holdings, Inc. - Common Stock|G|N|N|100|N|N +AIRR|First Trust RBA American Industrial Renaissance ETF|G|N|N|100|Y|N +AIRS|AirSculpt Technologies, Inc. - Common Stock|G|N|N|100|N|N +AIRT|Air T, Inc. - Common Stock|S|N|N|100|N|N +AIRTP|Air T, Inc. - Trust Preferred Securities|G|N|N|100|N|N +AISP|Airship AI Holdings, Inc - Class A Common Stock|G|N|N|100|N|N +AISPW|Airship AI Holdings, Inc - Warrants|S|N|N|100|N|N +AIXC|AIxCrypto Holdings, Inc. - Common Stock|S|N|N|100|N|N +AIXI|XIAO-I Corporation - American Depositary Shares|G|N|D|100|N|N +AKAM|Akamai Technologies, Inc. - Common Stock|Q|N|N|100|N|N +AKAN|Akanda Corp. - Common Shares|S|N|N|100|N|N +AKBA|Akebia Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +AKTS|Aktis Oncology, Inc. - Common stock|Q|N|N|100|N|N +AKTX|Akari Therapeutics Plc - American Depositary Shares|S|N|D|100|N|N +ALAB|Astera Labs, Inc. - Common Stock|Q|N|N|100|N|N +ALAR|Alarum Technologies Ltd. - American Depositary Shares|S|N|N|100|N|N +ALBG|Leverage Shares 2X Long ALB Daily ETF|G|N|N|100|Y|N +ALBT|Avalon GloboCare Corp. - Common Stock|S|N|N|100|N|N +ALCO|Alico, Inc. - Common Stock|Q|N|N|100|N|N +ALCY|Alchemy Investments Acquisition Corp 1 - Class A Ordinary Shares|S|N|N|100|N|N +ALCYU|Alchemy Investments Acquisition Corp 1 - Units|S|N|N|100|N|N +ALCYW|Alchemy Investments Acquisition Corp 1 - Warrants|S|N|N|100|N|N +ALDF|Aldel Financial II Inc. - Class A Ordinary Shares|G|N|N|100|N|N +ALDFU|Aldel Financial II Inc. - Units|G|N|N|100|N|N +ALDFW|Aldel Financial II Inc. - Warrants|G|N|N|100|N|N +ALDX|Aldeyra Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +ALEC|Alector, Inc. - Common Stock|Q|N|N|100|N|N +ALF|Centurion Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +ALFUU|Centurion Acquisition Corp. - Unit|G|N|N|100|N|N +ALFUW|Centurion Acquisition Corp. - Warrant|G|N|N|100|N|N +ALGM|Allegro MicroSystems, Inc. - Common Stock|Q|N|N|100|N|N +ALGN|Align Technology, Inc. - Common Stock|Q|N|N|100|N|N +ALGS|Aligos Therapeutics, Inc. - Common stock|S|N|N|100|N|N +ALGT|Allegiant Travel Company - Common Stock|Q|N|N|100|N|N +ALHC|Alignment Healthcare, Inc. - Common Stock|Q|N|N|100|N|N +ALIL|Argent Focused Small Cap ETF|G|N|N|100|Y|N +ALIS|Calisa Acquisition Corp - Ordinary shares|G|N|N|100|N|N +ALISR|Calisa Acquisition Corp - Right|G|N|N|100|N|N +ALISU|Calisa Acquisition Corp - Units|G|N|N|100|N|N +ALKS|Alkermes plc - Ordinary Shares|Q|N|N|100|N|N +ALKT|Alkami Technology, Inc. - Common Stock|Q|N|N|100|N|N +ALLO|Allogene Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ALLR|Allarity Therapeutics, Inc. - Common stock|S|N|N|100|N|N +ALLT|Allot Ltd. - Ordinary Shares|Q|N|N|100|N|N +ALLW|SPDR Bridgewater All Weather ETF|G|N|N|100|Y|N +ALM|Almonty Industries Inc. - Common Shares|S|N|N|100|N|N +ALMS|Alumis Inc. - Common Stock|Q|N|N|100|N|N +ALMU|Aeluma, Inc. - Common Stock|S|N|N|100|N|N +ALNT|Allient Inc. - Common Stock|G|N|N|100|N|N +ALNY|Alnylam Pharmaceuticals, Inc. - Common Stock|Q|N|N|40|N|N +ALOT|AstroNova, Inc. - Common Stock|G|N|N|100|N|N +ALOVU|Aldabra 4 Liquidity Opportunity Vehicle, Inc. - Units|G|N|N|100|N|N +ALPS|ALPS Group Inc - Ordinary Share|G|N|N|100|N|N +ALRM|Alarm.com Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ALRS|Alerus Financial Corporation - Common Stock|S|N|N|100|N|N +ALT|Altimmune, Inc. - Common Stock|G|N|N|100|N|N +ALTI|AlTi Global, Inc. - Class A Common Stock|S|N|N|100|N|N +ALTO|Alto Ingredients, Inc. - Common Stock|S|N|N|100|N|N +ALTS|ALT5 Sigma Corporation - Common Stock|S|N|D|100|N|N +ALTY|Global X Alternative Income ETF|G|N|N|100|Y|N +ALVO|Alvotech - Ordinary Shares|G|N|N|100|N|N +ALVOW|Alvotech - Warrant|G|N|N|100|N|N +ALXO|ALX Oncology Holdings Inc. - Common Stock|Q|N|N|100|N|N +ALZN|Alzamend Neuro, Inc. - Common Stock|S|N|N|100|N|N +AMAL|Amalgamated Financial Corp. - Common Stock|G|N|N|100|N|N +AMAT|Applied Materials, Inc. - Common Stock|Q|N|N|100|N|N +AMBA|Ambarella, Inc. - Ordinary Shares|Q|N|N|100|N|N +AMBR|Amber International Holding Limited - American Depositary Shares|G|N|N|100|N|N +AMCI|AMC Robotics Corporation - Common Stock|S|N|N|100|N|N +AMCX|AMC Networks Inc. - Class A Common Stock|Q|N|N|100|N|N +AMD|Advanced Micro Devices, Inc. - Common Stock|Q|N|N|100|N|N +AMDD|Direxion Daily AMD Bear 1X Shares|G|N|N|100|Y|N +AMDG|Leverage Shares 2X Long AMD Daily ETF|G|N|N|100|Y|N +AMDL|GraniteShares 2x Long AMD Daily ETF|G|N|N|100|Y|N +AMGN|Amgen Inc. - Common Stock|Q|N|N|40|N|N +AMID|Argent Mid Cap ETF|G|N|N|100|Y|N +AMIX|Autonomix Medical, Inc. - Common Stock|S|N|D|100|N|N +AMKR|Amkor Technology, Inc. - Common Stock|Q|N|N|100|N|N +AMLX|Amylyx Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +AMOD|Alpha Modus Holdings, Inc. - Class A Common Stock|S|N|D|100|N|N +AMODW|Alpha Modus Holdings, Inc. - Warrant|S|N|N|100|N|N +AMPG|Amplitech Group, Inc. - Common Stock|S|N|N|100|N|N +AMPGW|Amplitech Group, Inc. - Warrants|S|N|N|100|N|N +AMPH|Amphastar Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +AMPL|Amplitude, Inc. - Class A Common Stock|S|N|N|100|N|N +AMRN|Amarin Corporation plc - American Depositary Shares|S|N|N|100|N|N +AMRX|Amneal Pharmaceuticals, Inc. - Class A Common Stock|Q|N|N|100|N|N +AMSC|American Superconductor Corporation - Common Stock|Q|N|N|100|N|N +AMSF|AMERISAFE, Inc. - Common Stock|Q|N|N|100|N|N +AMST|Amesite Inc. - Common Stock|S|N|D|100|N|N +AMTX|Aemetis, Inc - Common Stock|G|N|N|100|N|N +AMUN|abrdn Ultra Short Municipal Income Active ETF|G|N|N|100|Y|N +AMUU|Direxion Daily AMD Bull 2X Shares|G|N|N|100|Y|N +AMWD|American Woodmark Corporation - Common Stock|Q|N|N|100|N|N +AMYY|GraniteShares YieldBOOST AMD ETF|G|N|N|100|Y|N +AMZD|Direxion Daily AMZN Bear 1X Shares|G|N|N|100|Y|N +AMZN|Amazon.com, Inc. - Common Stock|Q|N|N|100|N|N +AMZU|Direxion Daily AMZN Bull 2X Shares|G|N|N|100|Y|N +AMZZ|GraniteShares 2x Long AMZN Daily ETF|G|N|N|100|Y|N +ANAB|AnaptysBio, Inc. - Common Stock|Q|N|N|100|N|N +ANDE|The Andersons, Inc. - Common Stock|Q|N|N|100|N|N +ANEB|Anebulo Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +ANEL|Defiance Daily Target 2x Long ANET ETF|G|N|N|100|Y|N +ANGH|Anghami Inc. - Ordinary Shares|S|N|N|100|N|N +ANGHW|Anghami Inc. - Warrants|S|N|N|100|N|N +ANGI|Angi Inc. - Class A Common Stock|Q|N|N|100|N|N +ANGL|VanEck Fallen Angel High Yield Bond ETF|G|N|N|100|Y|N +ANGO|AngioDynamics, Inc. - Common Stock|Q|N|N|100|N|N +ANIK|Anika Therapeutics Inc. - Common Stock|Q|N|N|100|N|N +ANIP|ANI Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +ANIX|Anixa Biosciences, Inc. - Common Stock|S|N|N|100|N|N +ANL|Adlai Nortye Ltd. - American Depositary Shares|G|N|N|100|N|N +ANNA|AleAnna, Inc. - Class A Common Stock|S|N|N|100|N|N +ANNAW|AleAnna, Inc. - Warrant|S|N|N|100|N|N +ANNX|Annexon, Inc. - common stock|Q|N|N|100|N|N +ANPA|Rich Sparkle Holdings Limited - Ordinary Shares|S|N|N|100|N|N +ANSC|Agriculture & Natural Solutions Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +ANSCU|Agriculture & Natural Solutions Acquisition Corporation - Unit|G|N|N|100|N|N +ANSCW|Agriculture & Natural Solutions Acquisition Corporation - Warrant|G|N|N|100|N|N +ANTA|Antalpha Platform Holding Company - Class A Ordinary Shares|G|N|N|100|N|N +ANTX|AN2 Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ANY|Sphere 3D Corp. - Common Shares|S|N|D|100|N|N +AOHY|Angel Oak High Yield Opportunities ETF|G|N|N|100|Y|N +AOSL|Alpha and Omega Semiconductor Limited - Common Shares|Q|N|N|100|N|N +AOTG|AOT Growth and Innovation ETF|G|N|N|100|Y|N +AOUT|American Outdoor Brands, Inc. - Common Stock|Q|N|N|100|N|N +APA|APA Corporation - Common Stock|Q|N|N|100|N|N +APAC|StoneBridge Acquisition II Corporation - Class A Ordinary Shares|S|N|N|100|N|N +APACR|StoneBridge Acquisition II Corporation - Rights|S|N|N|100|N|N +APACU|StoneBridge Acquisition II Corporation - Units|S|N|N|100|N|N +APAD|A Paradise Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +APADR|A Paradise Acquisition Corp. - Rights|G|N|N|100|N|N +APADU|A Paradise Acquisition Corp. - Unit|G|N|N|100|N|N +APEI|American Public Education, Inc. - Common Stock|Q|N|N|100|N|N +APGE|Apogee Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +API|Agora, Inc. - ADS|Q|N|N|100|N|N +APLD|Applied Digital Corporation - Common Stock|Q|N|N|100|N|N +APLM|Apollomics Inc. - Class A Ordinary Shares|S|N|N|100|N|N +APLMW|Apollomics Inc. - Warrant|S|N|N|100|N|N +APLS|Apellis Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +APLT|Applied Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +APM|Aptorum Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +APOG|Apogee Enterprises, Inc. - Common Stock|Q|N|N|100|N|N +APP|Applovin Corporation - Class A Common Stock|Q|N|N|40|N|N +APPF|AppFolio, Inc. - Class A Common Stock|G|N|N|40|N|N +APPN|Appian Corporation - Class A Common Stock|G|N|N|100|N|N +APPS|Digital Turbine, Inc. - Common Stock|S|N|N|100|N|N +APPX|Tradr 2X Long APP Daily ETF|G|N|N|100|Y|N +APRE|Aprea Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +APVO|Aptevo Therapeutics Inc. - Common Stock|S|N|N|100|N|N +APWC|Asia Pacific Wire & Cable Corporation Limited - Common shares, Par value .01 per share|S|N|N|100|N|N +APXT|Apex Treasury Corporation - Class A Ordinary Share|G|N|N|100|N|N +APXTU|Apex Treasury Corporation - Units|G|N|N|100|N|N +APXTW|Apex Treasury Corporation - Warrants|G|N|N|100|N|N +APYX|Apyx Medical Corporation - Common Stock|Q|N|N|100|N|N +AQB|AquaBounty Technologies, Inc. - Common Stock|S|N|N|100|N|N +AQMS|Aqua Metals, Inc. - Common Stock|S|N|N|100|N|N +AQST|Aquestive Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +AQWA|Global X Clean Water ETF|G|N|N|100|Y|N +ARAI|Arrive AI Inc. - Common Stock|G|N|N|100|N|N +ARAY|Accuray Incorporated - Common Stock|Q|N|N|100|N|N +ARBB|ARB IOT Group Limited - Ordinary Shares|S|N|N|100|N|N +ARBE|Arbe Robotics Ltd. - Ordinary Shares|S|N|N|100|N|N +ARBEW|Arbe Robotics Ltd. - Warrant|S|N|N|100|N|N +ARBK|Argo Blockchain plc - American Depositary Shares|Q|N|N|100|N|N +ARCB|ArcBest Corporation - Common Stock|Q|N|N|100|N|N +ARCC|Ares Capital Corporation - Closed End Fund|Q|N|N|100|N|N +ARCIU|Archimedes Tech SPAC Partners III Co. - Unit|G|N|N|100|N|N +ARCT|Arcturus Therapeutics Holdings Inc. - Common Stock|G|N|N|100|N|N +ARDX|Ardelyx, Inc. - Common Stock|G|N|N|100|N|N +AREB|American Rebel Holdings, Inc. - Common Stock|S|N|N|100|N|N +AREBW|American Rebel Holdings, Inc. - warrants|S|N|N|100|N|N +AREC|American Resources Corporation - Class A Common Stock|S|N|D|100|N|N +ARGX|argenx SE - American Depositary Shares|Q|N|N|40|N|N +ARHS|Arhaus, Inc. - Class A Common Stock|Q|N|N|100|N|N +ARKO|ARKO Corp. - Common Stock|S|N|N|100|N|N +ARKR|Ark Restaurants Corp. - Common Stock|G|N|N|100|N|N +ARLP|Alliance Resource Partners, L.P. - Common Units Representing Limited Partnership Interests|Q|N|N|100|N|N +ARM|Arm Holdings plc - American Depositary Shares|Q|N|N|100|N|N +ARMG|Leverage Shares 2X Long ARM Daily ETF|G|N|N|100|Y|N +AROW|Arrow Financial Corporation - Common Stock|Q|N|N|100|N|N +ARQ|Arq, Inc. - Common Stock|G|N|N|100|N|N +ARQQ|Arqit Quantum Inc. - Ordinary Shares|S|N|N|100|N|N +ARQQW|Arqit Quantum Inc. - Warrants|S|N|N|100|N|N +ARQT|Arcutis Biotherapeutics, Inc. - Common stock|Q|N|N|100|N|N +ARRY|Array Technologies, Inc. - Common Stock|G|N|N|100|N|N +ARTCU|Art Technology Acquisition Corp. - Units|G|N|N|100|N|N +ARTL|Artelo Biosciences, Inc. - Common Stock|S|N|D|100|N|N +ARTNA|Artesian Resources Corporation - Class A Non-Voting Common Stock|Q|N|N|100|N|N +ARTV|Artiva Biotherapeutics, Inc. - Common Stock|G|N|N|100|N|N +ARTW|Art's-Way Manufacturing Co., Inc. - Common Stock|S|N|N|100|N|N +ARVN|Arvinas, Inc. - Common Stock|Q|N|N|100|N|N +ARVR|First Trust Indxx Metaverse ETF|G|N|N|100|Y|N +ARWR|Arrowhead Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +ASBP|Aspire Biopharma Holdings, Inc. - Common Stock|S|N|D|100|N|N +ASBPW|Aspire Biopharma Holdings, Inc. - Warrant|S|N|N|100|N|N +ASCI|abrdn International Small Cap Active ETF|G|N|N|100|Y|N +ASLE|AerSale Corporation - Common Stock|S|N|N|100|N|N +ASMB|Assembly Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +ASMG|Leverage Shares 2X Long ASML Daily ETF|G|N|N|100|Y|N +ASML|ASML Holding N.V. - New York Registry Shares|Q|N|N|40|N|N +ASND|Ascendis Pharma A/S - American Depositary Shares|Q|N|N|100|N|N +ASNS|Actelis Networks, Inc. - Common Stock|S|N|N|100|N|N +ASO|Academy Sports and Outdoors, Inc. - Common Stock|Q|N|N|100|N|N +ASPC|A SPAC III Acquisition Corp. - Class A Ordinary Shares|S|N|N|100|N|N +ASPCR|A SPAC III Acquisition Corp. - Right|S|N|N|100|N|N +ASPCU|A SPAC III Acquisition Corp. - Unit|S|N|N|100|N|N +ASPI|ASP Isotopes Inc. - Common Stock|S|N|N|100|N|N +ASPS|Altisource Portfolio Solutions S.A. - Common Stock|Q|N|N|100|N|N +ASPSW|Altisource Portfolio Solutions S.A. - Net Settle Stakeholder Warrants|Q|N|N|100|N|N +ASPSZ|Altisource Portfolio Solutions S.A. - Cash Exercise Stakeholder Warrants|Q|N|N|100|N|N +ASRT|Assertio Holdings, Inc. - Common Stock|S|N|N|100|N|N +ASRV|AmeriServ Financial Inc. - Common Stock|G|N|N|100|N|N +ASST|Strive, Inc. - Class A Common Stock|G|N|N|100|N|N +ASTC|Astrotech Corporation - Common Stock|S|N|N|100|N|N +ASTE|Astec Industries, Inc. - Common Stock|Q|N|N|100|N|N +ASTH|Astrana Health Inc. - Common Stock|S|N|N|100|N|N +ASTI|Ascent Solar Technologies, Inc - Common Stock|S|N|N|100|N|N +ASTL|Algoma Steel Group Inc. - Common Shares|G|N|N|100|N|N +ASTLW|Algoma Steel Group Inc. - Warrant|G|N|N|100|N|N +ASTS|AST SpaceMobile, Inc. - Class A Common Stock|Q|N|N|100|N|N +ASUR|Asure Software Inc - Common Stock|S|N|N|100|N|N +ASYS|Amtech Systems, Inc. - Common Stock|Q|N|N|100|N|N +ATAI|AtaiBeckley Inc. - Common Stock|G|N|N|100|N|N +ATAT|Atour Lifestyle Holdings Limited - American Depositary Shares|Q|N|N|100|N|N +ATCX|Atlas Critical Minerals Corporation - Common Stock|S|N|N|100|N|N +ATEC|Alphatec Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ATER|Aterian, Inc. - Common Stock|S|N|D|100|N|N +ATEX|Anterix Inc. - Common Stock|S|N|N|100|N|N +ATGL|Alpha Technology Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +ATHE|Alterity Therapeutics Limited - American Depositary Shares|S|N|N|100|N|N +ATHR|Aether Holdings, Inc. - Common Stock|S|N|N|100|N|N +ATII|Archimedes Tech SPAC Partners II Co. - Ordinary Shares|G|N|N|100|N|N +ATIIU|Archimedes Tech SPAC Partners II Co. - Unit|G|N|N|100|N|N +ATIIW|Archimedes Tech SPAC Partners II Co. - Warrant|G|N|N|100|N|N +ATLC|Atlanticus Holdings Corporation - Common Stock|Q|N|N|100|N|N +ATLCL|Atlanticus Holdings Corporation - 6.125% Senior Notes due 2026|G|N|N|100|N|N +ATLCP|Atlanticus Holdings Corporation - 7.625% Series B Cumulative Perpetual Preferred Stock, no par value per share|Q|N|N|100|N|N +ATLCZ|Atlanticus Holdings Corporation - 9.25% Senior Notes due 2029|G|N|N|100|N|N +ATLN|Atlantic International Corp. - Common Stock|G|N|N|100|N|N +ATLO|Ames National Corporation - Common Stock|S|N|N|100|N|N +ATLX|Atlas Lithium Corporation - Common Stock|S|N|N|100|N|N +ATNI|ATN International, Inc. - Common Stock|Q|N|N|100|N|N +ATOM|Atomera Incorporated - Common Stock|S|N|N|100|N|N +ATON|AlphaTON Capital Corp. - Common Stock|S|N|N|100|N|N +ATOS|Atossa Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +ATPC|Agape ATP Corporation - Common Stock|S|N|N|100|N|N +ATRA|Atara Biotherapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ATRC|AtriCure, Inc. - Common Stock|G|N|N|100|N|N +ATRO|Astronics Corporation - Common Stock|Q|N|N|100|N|N +ATXG|Addentax Group Corp. - Common Stock|S|N|D|100|N|N +ATYR|aTyr Pharma, Inc. - Common Stock|S|N|D|100|N|N +AUBN|Auburn National Bancorporation, Inc. - Common Stock|G|N|N|100|N|N +AUDC|AudioCodes Ltd. - Ordinary Shares|Q|N|N|100|N|N +AUGO|Aura Minerals Inc. - Common Shares|Q|N|N|100|N|N +AUID|authID Inc. - Common Stock|S|N|N|100|N|N +AUMI|Themes Gold Miners ETF|G|N|N|100|Y|N +AUPH|Aurinia Pharmaceuticals Inc - Common Shares|G|N|N|100|N|N +AUR|Aurora Innovation, Inc. - Class A Common Stock|Q|N|N|100|N|N +AURA|Aura Biosciences, Inc. - Common Stock|G|N|N|100|N|N +AURE|Aurelion Inc. - Class A Ordinary Shares|S|N|D|100|N|N +AUROW|Aurora Innovation, Inc. - Warrant|Q|N|N|100|N|N +AUTL|Autolus Therapeutics plc - American Depositary Shares|Q|N|N|100|N|N +AUUD|Auddia Inc. - Common Stock|S|N|N|100|N|N +AUUDW|Auddia Inc. - Warrants|S|N|N|100|N|N +AVAH|Aveanna Healthcare Holdings Inc. - Common Stock|Q|N|N|100|N|N +AVAV|AeroVironment, Inc. - Common Stock|Q|N|N|40|N|N +AVBH|Avidbank Holdings, Inc. - Common Stock|Q|N|N|100|N|N +AVBP|ArriVent BioPharma, Inc. - Common Stock|G|N|N|100|N|N +AVDL|Avadel Pharmaceuticals plc - Ordinary Share|G|N|N|100|N|N +AVGB|Avantis Credit ETF|G|N|N|100|Y|N +AVGG|Leverage Shares 2X Long AVGO Daily ETF|G|N|N|100|Y|N +AVGO|Broadcom Inc. - Common Stock|Q|N|N|40|N|N +AVGU|GraniteShares 2x Long AVGO Daily ETF|G|N|N|100|Y|N +AVGX|Defiance Daily Target 2X Long AVGO ETF|G|N|N|100|Y|N +AVIR|Atea Pharmaceuticals, Inc. - common stock|Q|N|N|100|N|N +AVL|Direxion Daily AVGO Bull 2X Shares|G|N|N|100|Y|N +AVNW|Aviat Networks, Inc. - Common Stock|Q|N|N|100|N|N +AVO|Mission Produce, Inc. - Common Stock|Q|N|N|100|N|N +AVPT|AvePoint, Inc. - Class A Common Stock|Q|N|N|100|N|N +AVR|Anteris Technologies Global Corp. - Common Stock|G|N|N|100|N|N +AVS|Direxion Daily AVGO Bear 1X Shares|G|N|N|100|Y|N +AVT|Avnet, Inc. - Common Stock|Q|N|N|100|N|N +AVTX|Avalo Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +AVUQ|Avantis U.S. Quality ETF|G|N|N|100|Y|N +AVX|Avax One Technology Ltd. - Common Shares|S|N|N|100|N|N +AVXC|Avantis Emerging Markets ex-China Equity ETF|G|N|N|100|Y|N +AVXL|Anavex Life Sciences Corp. - Common Stock|Q|N|N|100|N|N +AVXX|Defiance Daily Target 2x Long AVAV ETF|G|N|N|100|Y|N +AWRE|Aware, Inc. - Common Stock|G|N|N|100|N|N +AXG|Solowin Holdings - Class A Ordinary Share|S|N|N|100|N|N +AXGN|Axogen, Inc. - Common Stock|S|N|N|100|N|N +AXIN|Axiom Intelligence Acquisition Corp 1 - Class A Ordinary Shares|G|N|N|100|N|N +AXINR|Axiom Intelligence Acquisition Corp 1 - Right|G|N|N|100|N|N +AXINU|Axiom Intelligence Acquisition Corp 1 - Units|G|N|N|100|N|N +AXON|Axon Enterprise, Inc. - Common Stock|Q|N|N|40|N|N +AXSM|Axsome Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +AXTI|AXT Inc - Common Stock|Q|N|D|100|N|N +AYTU|Aytu BioPharma, Inc. - Common Stock|S|N|N|100|N|N +AZ|A2Z Cust2Mate Solutions Corp. - Common Shares|S|N|D|100|N|N +AZI|Autozi Internet Technology (Global) Ltd. - Class A Ordinary Shares|G|N|D|100|N|N +AZN|AstraZeneca PLC - American Depositary Shares|Q|N|N|100|N|N +AZTA|Azenta, Inc. - Common Stock|Q|N|N|100|N|N +AZYY|GraniteShares YieldBoost AMZN ETF|G|N|N|100|Y|N +BABX|GraniteShares 2x Long BABA Daily ETF|G|N|N|100|Y|N +BACC|Blue Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +BACCR|Blue Acquisition Corp. - Right|G|N|N|100|N|N +BACCU|Blue Acquisition Corp. - Unit|G|N|N|100|N|N +BACQ|Inflection Point Acquisition Corp. IV - Class A Ordinary Shares|G|N|N|100|N|N +BACQR|Inflection Point Acquisition Corp. IV - Right|G|N|N|100|N|N +BACQU|Inflection Point Acquisition Corp. IV - Unit|G|N|N|100|N|N +BAER|Bridger Aerospace Group Holdings, Inc. - Common Stock|G|N|N|100|N|N +BAERW|Bridger Aerospace Group Holdings, Inc. - Warrant|G|N|N|100|N|N +BAFE|Brown Advisory Flexible Equity ETF|G|N|N|100|Y|N +BAFN|BayFirst Financial Corp. - Common Stock|S|N|N|100|N|N +BAIG|Leverage Shares 2X Long BBAI Daily ETF|G|N|N|100|Y|N +BALQ|iShares Nasdaq Premium Income Active ETF|G|N|N|100|Y|N +BAND|Bandwidth Inc. - Class A Common Stock|Q|N|N|100|N|N +BANF|BancFirst Corporation - Common Stock|Q|N|N|100|N|N +BANFP|BancFirst Corporation - 7.2% Cumulative Trust Preferred Securities|Q|N|N|100|N|N +BANL|CBL International Limited - Class B Ordinary Shares|S|N|D|100|N|N +BANR|Banner Corporation - Common Stock|Q|N|N|100|N|N +BANX|ArrowMark Financial Corp. - Closed End Fund|Q|N|N|100|N|N +BANXR|ArrowMark Financial Corp. - Right|Q|N|N|100|N|N +BAOS|Baosheng Media Group Holdings Limited - Ordinary shares|S|N|N|100|N|N +BASG|Brown Advisory Sustainable Growth ETF|G|N|N|100|Y|N +BASV|Brown Advisory Sustainable Value ETF|G|N|N|100|Y|N +BATRA|Atlanta Braves Holdings, Inc. - Series A Common Stock|Q|N|N|100|N|N +BATRK|Atlanta Braves Holdings, Inc. - Series C Common Stock|Q|N|N|100|N|N +BAYA|Bayview Acquisition Corp - Ordinary Share|G|N|D|100|N|N +BAYAR|Bayview Acquisition Corp - Right|G|N|D|100|N|N +BAYAU|Bayview Acquisition Corp - Unit|G|N|D|100|N|N +BBB|CYBER HORNET S&P 500 and Bitcoin 75/25 Strategy ETF|G|N|N|100|Y|N +BBCP|Concrete Pumping Holdings, Inc. - Common Stock|S|N|N|100|N|N +BBCQ|Bleichroeder Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +BBCQU|Bleichroeder Acquisition Corp. II - Units|G|N|N|100|N|N +BBCQW|Bleichroeder Acquisition Corp. II - Warrants|G|N|N|100|N|N +BBGI|Beasley Broadcast Group, Inc. - Class A Common Stock|S|N|N|100|N|N +BBH|VanEck Biotech ETF|G|N|N|100|Y|N +BBIO|BridgeBio Pharma, Inc. - Common Stock|Q|N|N|100|N|N +BBLG|Bone Biologics Corp - Common Stock|S|N|N|100|N|N +BBLGW|Bone Biologics Corp - warrants|S|N|N|100|N|N +BBNX|Beta Bionics, Inc. - Common Stock|G|N|N|100|N|N +BBOT|BridgeBio Oncology Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +BBSI|Barrett Business Services, Inc. - Common Stock|Q|N|N|100|N|N +BBYY|GraniteShares YieldBOOST BABA ETF|G|N|N|100|Y|N +BCAB|BioAtla, Inc. - Common Stock|S|N|D|100|N|N +BCAL|California BanCorp - Common Stock|S|N|N|100|N|N +BCAR|D. Boral ARC Acquisition I Corp. - Class A Ordinary Shares|G|N|N|100|N|N +BCARU|D. Boral ARC Acquisition I Corp. - Units|G|N|N|100|N|N +BCARW|D. Boral ARC Acquisition I Corp. - Warrant|G|N|N|100|N|N +BCAX|Bicara Therapeutics Inc. - Common Stock|G|N|N|100|N|N +BCBP|BCB Bancorp, Inc. (NJ) - Common Stock|G|N|N|100|N|N +BCDA|BioCardia, Inc. - Common Stock|S|N|N|100|N|N +BCFN|Baron Financials ETF|G|N|N|100|Y|N +BCG|Binah Capital Group, Inc. - Common Stock|G|N|N|100|N|N +BCGWW|Binah Capital Group, Inc. - Warrants|S|N|N|100|N|N +BCIC|BCP Investment Corporation - Closed End Fund|Q|N|N|100|N|N +BCLO|iShares BBB-B CLO Active ETF|G|N|N|100|Y|N +BCML|BayCom Corp - Common Stock|Q|N|N|100|N|N +BCPC|Balchem Corporation - Common Stock|Q|N|N|100|N|N +BCRX|BioCryst Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +BCTK|Baron Technology ETF|G|N|N|100|Y|N +BCTX|BriaCell Therapeutics Corp. - Common Shares|S|N|N|100|N|N +BCTXL|BriaCell Therapeutics Corp. - Warrants|S|N|N|100|N|N +BCTXW|BriaCell Therapeutics Corp. - Warrant expiring 2026|S|N|N|100|N|N +BCTXZ|BriaCell Therapeutics Corp. - Warrant|S|N|N|100|N|N +BCYC|Bicycle Therapeutics plc - American Depositary Shares|Q|N|N|100|N|N +BDCI|BTC Development Corp. - Class A Ordinary Shares|G|N|N|100|N|N +BDCIU|BTC Development Corp. - Unit|G|N|N|100|N|N +BDCIW|BTC Development Corp. - Warrant|G|N|N|100|N|N +BDGS|Bridges Capital Tactical ETF|G|N|N|100|Y|N +BDMD|Baird Medical Investment Holdings Ltd - Ordinary Share|S|N|N|100|N|N +BDMDW|Baird Medical Investment Holdings Ltd - Warrant|S|N|N|100|N|N +BDRX|Biodexa Pharmaceuticals plc - American Depositary Shares|S|N|N|100|N|N +BDSX|Biodesix, Inc. - Common Stock|G|N|N|100|N|N +BDTX|Black Diamond Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +BDVL|iShares Disciplined Volatility Equity Active ETF|G|N|N|100|Y|N +BDYN|iShares Dynamic Equity Active ETF|G|N|N|100|Y|N +BEAG|Bold Eagle Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +BEAGR|Bold Eagle Acquisition Corp. - Right|G|N|N|100|N|N +BEAGU|Bold Eagle Acquisition Corp. - Units|G|N|N|100|N|N +BEAM|Beam Therapeutics Inc. - Common Stock|Q|N|N|100|N|N +BEAT|Heartbeam, Inc. - Common Stock|S|N|N|100|N|N +BEATW|Heartbeam, Inc. - Warrant|S|N|N|100|N|N +BEDY|BNY Mellon Enhanced Dividend and Income ETF|G|N|N|100|Y|N +BEEM|Beam Global - Common Stock|S|N|N|100|N|N +BEEP|Mobile Infrastructure Corporation - Common Stock|G|N|N|100|N|N +BEEX|The Beehive ETF|G|N|N|100|Y|N +BEEZ|Honeytree U.S. Equity ETF|G|N|N|100|Y|N +BEG|Leverage Shares 2x Long BE Daily ETF|G|N|N|100|Y|N +BELFA|Bel Fuse Inc. - Class A Common Stock|Q|N|N|100|N|N +BELFB|Bel Fuse Inc. - Class B Common Stock|Q|N|N|100|N|N +BELT|iShares U.S. Select Equity Active ETF|G|N|N|100|Y|N +BENF|Beneficient - Class A Common Stock|S|N|N|100|N|N +BENFW|Beneficient - Warrant|S|N|N|100|N|N +BETR|Better Home & Finance Holding Company - Class A Common Stock|G|N|N|100|N|N +BETRW|Better Home & Finance Holding Company - Warrant|G|N|N|100|N|N +BFC|Bank First Corporation - Common Stock|S|N|N|100|N|N +BFRG|Bullfrog AI Holdings, Inc. - Common Stock|S|N|D|100|N|N +BFRGW|Bullfrog AI Holdings, Inc. - Warrants|S|N|D|100|N|N +BFRI|Biofrontera Inc. - Common Stock|S|N|D|100|N|N +BFRIW|Biofrontera Inc. - Warrants|S|N|N|100|N|N +BFST|Business First Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +BGC|BGC Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +BGIN|Bgin Blockchain Limited - Class A Ordinary Shares|G|N|N|100|N|N +BGL|Blue Gold Limited - Class A ordinary shares|G|N|N|100|N|N +BGLC|BioNexus Gene Lab Corp - Common stock|S|N|N|100|N|N +BGLWW|Blue Gold Limited - Warrant|S|N|N|100|N|N +BGM|BGM Group Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +BGMS|Bio Green Med Solution, Inc. - Common Stock|S|N|N|100|N|N +BGMSP|Bio Green Med Solution, Inc. - 6% Convertible Preferred Stock|S|N|D|100|N|N +BGRN|iShares USD Green Bond ETF|G|N|N|100|Y|N +BGRO|iShares Large Cap Growth Active ETF|G|N|N|100|Y|N +BHAT|Blue Hat Interactive Entertainment Technology - Ordinary Shares|S|N|N|100|N|N +BHF|Brighthouse Financial, Inc. - Common Stock|Q|N|N|100|N|N +BHFAL|Brighthouse Financial, Inc. - Junior Subordinated Debentures due 2058|Q|N|N|100|N|N +BHFAM|Brighthouse Financial, Inc. - Depositary shares each representing a 1/1,000th Interest in a Share of 4.625% Non-Cumulative Preferred Stock, Series D|Q|N|N|100|N|N +BHFAN|Brighthouse Financial, Inc. - depositary shares, each representing a 1/1,000th interest in a share of 5.375% Non-Cumulative Preferred Stock, Series C|Q|N|N|100|N|N +BHFAO|Brighthouse Financial, Inc. - Depositary Shares, each representing a 1/1,000th interest in a share of 6.750% Non-Cumulative Preferred Stock, Series B|Q|N|N|100|N|N +BHFAP|Brighthouse Financial, Inc. - Depositary Shares 6.6% Non-Cumulative Preferred Stock, Series A|Q|N|N|100|N|N +BHRB|Burke & Herbert Financial Services Corp. - Common Stock|S|N|N|100|N|N +BHST|BioHarvest Sciences Inc. - Common Stock|G|N|N|100|N|N +BIAF|bioAffinity Technologies, Inc. - Common Stock|S|N|N|100|N|N +BIAFW|bioAffinity Technologies, Inc. - Warrant|S|N|N|100|N|N +BIB|ProShares Ultra Nasdaq Biotechnology|G|N|N|100|Y|N +BIDG|Leverage Shares 2X Long BIDU Daily ETF|G|N|N|100|Y|N +BIDU|Baidu, Inc. - American Depositary Shares, each representing 8 ordinary share|Q|N|N|100|N|N +BIIB|Biogen Inc. - Common Stock|Q|N|N|100|N|N +BILI|Bilibili Inc. - American Depositary Shares|Q|N|N|100|N|N +BIOA|BioAge Labs, Inc. - Common Stock|Q|N|N|100|N|N +BIOX|Bioceres Crop Solutions Corp. - Ordinary Shares|Q|N|N|100|N|N +BIRD|Allbirds, Inc. - Class A Common Stock|Q|N|N|100|N|N +BIS|ProShares UltraShort Nasdaq Biotechnology|G|N|N|100|Y|N +BITF|Bitfarms Ltd. - Common Stock|G|N|N|100|N|N +BITS|Global X Blockchain & Bitcoin Strategy ETF|G|N|N|100|Y|N +BIVI|BioVie Inc. - Common stock|S|N|N|100|N|N +BIVIW|BioVie Inc. - Warrant|S|N|N|100|N|N +BIXI|Bitcoin Infrastructure Acquisition Corp Ltd. - Class A Ordinary Shares|G|N|N|100|N|N +BIXIU|Bitcoin Infrastructure Acquisition Corp Ltd. - Units|G|N|N|100|N|N +BIXIW|Bitcoin Infrastructure Acquisition Corp Ltd. - Warrants|G|N|N|100|N|N +BIYA|Baiya International Group Inc. - Ordinary Shares|S|N|N|100|N|N +BJDX|Bluejay Diagnostics, Inc. - Common Stock|S|N|N|100|N|N +BJK|VanEck Gaming ETF|G|N|N|100|Y|N +BJRI|BJ's Restaurants, Inc. - Common Stock|Q|N|N|100|N|N +BKCH|Global X Blockchain ETF|G|N|N|100|Y|N +BKHA|Black Hawk Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +BKHAR|Black Hawk Acquisition Corporation - Rights|G|N|N|100|N|N +BKHAU|Black Hawk Acquisition Corporation - Units|G|N|N|100|N|N +BKMI|BNY Mellon Municipal Intermediate ETF|G|N|N|100|Y|N +BKMS|BNY Mellon Municipal Short Duration ETF|G|N|N|100|Y|N +BKNG|Booking Holdings Inc. - Common Stock|Q|N|N|10|N|N +BKR|Baker Hughes Company - Common Stock|Q|N|N|100|N|N +BKYI|BIO-key International, Inc. - Common Stock|S|N|D|100|N|N +BL|BlackLine, Inc. - Common Stock|Q|N|N|100|N|N +BLBD|Blue Bird Corporation - Common Stock|G|N|N|100|N|N +BLBX|Blackboxstocks Inc. - Common Stock|S|N|N|100|N|N +BLCN|Siren NexGen Economy ETF|G|N|N|100|Y|N +BLCR|iShares Large Cap Core Active ETF|G|N|N|100|Y|N +BLDP|Ballard Power Systems, Inc. - Common Shares|G|N|N|100|N|N +BLFS|BioLife Solutions, Inc. - Common Stock|S|N|N|100|N|N +BLFY|Blue Foundry Bancorp - Common Stock|Q|N|N|100|N|N +BLIN|Bridgeline Digital, Inc. - Common Stock|S|N|N|100|N|N +BLIV|BeLive Holdings - ordinary shares|S|N|N|100|N|N +BLKB|Blackbaud, Inc. - Common Stock|Q|N|N|100|N|N +BLLN|BillionToOne, Inc. - Class A common stock|Q|N|N|100|N|N +BLMN|Bloomin' Brands, Inc. - Common Stock|Q|N|N|100|N|N +BLNE|Beeline Holdings, Inc. - Common Stock|S|N|N|100|N|N +BLNK|Blink Charging Co. - Common Stock|S|N|N|100|N|N +BLRKU|Bluerock Acquisition Corp. - Units|G|N|N|100|N|N +BLRX|BioLineRx Ltd. - American Depositary Shares|S|N|N|100|N|N +BLSG|Leverage Shares 2X Long BLSH Daily ETF|G|N|N|100|Y|N +BLTE|Belite Bio, Inc - American Depositary Shares|S|N|N|100|N|N +BLUW|Blue Water Acquisition Corp. III - Class A Ordinary Shares|G|N|N|100|N|N +BLUWU|Blue Water Acquisition Corp. III - Unit.|G|N|N|100|N|N +BLUWW|Blue Water Acquisition Corp. III - Warrant.|G|N|N|100|N|N +BLZE|Backblaze, Inc. - Common Stock|G|N|N|100|N|N +BLZR|Trailblazer Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +BLZRU|Trailblazer Acquisition Corp. - Unit|G|N|N|100|N|N +BLZRW|Trailblazer Acquisition Corp. - Warrant|G|N|N|100|N|N +BMAX|REX Bitcoin Corporate Treasury Convertible Bond ETF|G|N|N|100|Y|N +BMBL|Bumble Inc. - common stock|Q|N|N|100|N|N +BMDL|VictoryShares WestEnd Economic Cycle Bond ETF|G|N|N|100|Y|N +BMEA|Biomea Fusion, Inc. - Common Stock|Q|N|N|100|N|N +BMGL|Basel Medical Group Ltd - ordinary shares|S|N|E|100|N|N +BMHL|Bluemount Holdings Limited - Class B Ordinary Shares|S|N|N|100|N|N +BMM|Blue Moon Metals Inc. - Common Shares|S|N|N|100|N|N +BMNG|Leverage Shares 2X Long BMNR Daily ETF|G|N|N|100|Y|N +BMOP|BNY Mellon Municipal Opportunities ETF|G|N|N|100|Y|N +BMR|Beamr Imaging Ltd. - Ordinary Share|S|N|N|100|N|N +BMRA|Biomerica, Inc. - Common Stock|S|N|N|100|N|N +BMRC|Bank of Marin Bancorp - Common Stock|Q|N|N|100|N|N +BMRN|BioMarin Pharmaceutical Inc. - Common Stock|Q|N|N|100|N|N +BNAI|Brand Engagement Network Inc. - Common Stock|S|N|N|100|N|N +BNAIW|Brand Engagement Network Inc. - Warrant|S|N|N|100|N|N +BNBX|BNB Plus Corp. - Common Stock|S|N|N|100|N|N +BNC|CEA Industries Inc. - Common Stock|S|N|N|100|N|N +BNCWW|CEA Industries Inc. - Warrant|S|N|N|100|N|N +BND|Vanguard Total Bond Market ETF|G|N|N|100|Y|N +BNDP|Vanguard Core-Plus Bond Index ETF|G|N|N|100|Y|N +BNDW|Vanguard Total World Bond ETF|G|N|N|100|Y|N +BNDX|Vanguard Total International Bond ETF|G|N|N|100|Y|N +BNGO|Bionano Genomics, Inc. - Common Stock|S|N|N|100|N|N +BNKK|Bonk, Inc. - Common Stock|S|N|N|100|N|N +BNR|Burning Rock Biotech Limited - American Depositary Shares|G|N|N|100|N|N +BNRG|Brenmiller Energy Ltd - Ordinary Shares|S|N|N|100|N|N +BNTC|Benitec Biopharma Inc. - Common Stock|S|N|N|100|N|N +BNTX|BioNTech SE - American Depositary Shares|Q|N|N|100|N|N +BNZI|Banzai International, Inc. - Class A Common Stock|S|N|N|100|N|N +BNZIW|Banzai International, Inc. - Warrant|S|N|N|100|N|N +BODI|The Beachbody Company, Inc. - Class A Common Stock|S|N|N|100|N|N +BOED|Direxion Daily BA Bear 1X Shares|G|N|N|100|Y|N +BOEG|Leverage Shares 2X Long BA Daily ETF|G|N|N|100|Y|N +BOEU|Direxion Daily BA Bull 2X Shares|G|N|N|100|Y|N +BOF|BranchOut Food Inc. - Common Stock|S|N|N|100|N|N +BOKF|BOK Financial Corporation - Common Stock|Q|N|N|100|N|N +BOLD|Boundless Bio, Inc. - Common Stock|Q|N|N|100|N|N +BOLT|Bolt Biotherapeutics, Inc. - Common Stock|S|N|N|100|N|N +BON|Bon Natural Life Limited - Class A Ordinary Shares|S|N|N|100|N|N +BOOM|DMC Global Inc. - Common Stock|Q|N|N|100|N|N +BOSC|B.O.S. Better Online Solutions - Ordinary Shares|S|N|N|100|N|N +BOTJ|Bank of the James Financial Group, Inc. - Common Stock|S|N|N|100|N|N +BOTT|Themes Humanoid Robotics ETF|G|N|N|100|Y|N +BOTZ|Global X Robotics & Artificial Intelligence ETF|G|N|N|100|Y|N +BOXL|Boxlight Corporation - Class A Common Stock|S|N|N|100|N|N +BPAC|Blueport Acquisition Ltd - Class A Ordinary Shares|S|N|N|100|N|N +BPACR|Blueport Acquisition Ltd - Rights|S|N|N|100|N|N +BPACU|Blueport Acquisition Ltd - Units|S|N|N|100|N|N +BPOP|Popular, Inc. - Common Stock|Q|N|N|100|N|N +BPOPM|Popular, Inc. - Popular Capital Trust II - 6.125% Cumulative Monthly Income Trust Preferred Securities|Q|N|N|100|N|N +BPRN|Princeton Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +BPYPM|Brookfield Property Partners L.P. - 6.25% Class A Cumulative Redeemable Preferred Units, Series 1|Q|N|N|100|N|N +BPYPN|Brookfield Property Partners L.P. - 5.750% Class A Cumulative Redeemable Perpetual Preferred Units, Series 3|Q|N|N|100|N|N +BPYPO|Brookfield Property Partners L.P. - 6.375% Class A Cumulative Redeemable Perpetual Preferred Units, Series 2|Q|N|N|100|N|N +BPYPP|Brookfield Property Partners L.P. - 6.50% Class A Cumulative Redeemable Perpetual Preferred Units|Q|N|N|100|N|N +BRAG|Bragg Gaming Group Inc. - Common Shares|Q|N|N|100|N|N +BRBI|BRBI BR Partners S.A. - ADSs|S|N|N|100|N|N +BRCB|Black Rock Coffee Bar, Inc. - Class A Common Stock|G|N|N|100|N|N +BREM|iShares Emerging Markets Bond Active ETF|G|N|N|100|Y|N +BRFH|Barfresh Food Group Inc. - Common Stock|S|N|N|100|N|N +BRHY|iShares High Yield Active ETF|G|N|N|100|Y|N +BRID|Bridgford Foods Corporation - Common Stock|G|N|N|100|N|N +BRKD|Direxion Daily BRKB Bear 1X Shares|G|N|N|100|Y|N +BRKR|Bruker Corporation - Common Stock|Q|N|N|100|N|N +BRKRP|Bruker Corporation - 6.375% Mandatory Convertible Preferred Stock, Series A|Q|N|N|40|N|N +BRKU|Direxion Daily BRKB Bull 2X Shares|G|N|N|100|Y|N +BRLS|Borealis Foods Inc. - Class A Common Shares|S|N|D|100|N|N +BRLSW|Borealis Foods Inc. - Warrant|S|N|D|100|N|N +BRLT|Brilliant Earth Group, Inc. - Class A Common Stock|G|N|N|100|N|N +BRNS|Barinthus Biotherapeutics plc - American Depositary Shares|G|N|D|100|N|N +BRNY|Burney U.S. Factor Rotation ETF|G|N|N|100|Y|N +BRR|ProCap Financial, Inc. - Common Stock|G|N|N|100|N|N +BRRR|Coinshares Bitcoin ETF|G|N|N|100|Y|N +BRRWW|ProCap Financial, Inc. - Warrant.|S|N|N|100|N|N +BRTR|iShares Total Return Active ETF|G|N|N|100|Y|N +BRTX|BioRestorative Therapies, Inc. - Common Stock|S|N|N|100|N|N +BRZE|Braze, Inc. - Class A Common Stock|Q|N|N|100|N|N +BSAA|BEST SPAC I Acquisition Corp. - Class A Ordinary Shares|S|N|N|100|N|N +BSAAR|BEST SPAC I Acquisition Corp. - Rights|S|N|N|100|N|N +BSAAU|BEST SPAC I Acquisition Corp. - Unit|S|N|N|100|N|N +BSBK|Bogota Financial Corp. - Common Stock|S|N|N|100|N|N +BSCQ|Invesco BulletShares 2026 Corporate Bond ETF|G|N|N|100|Y|N +BSCR|Invesco BulletShares 2027 Corporate Bond ETF|G|N|N|100|Y|N +BSCS|Invesco BulletShares 2028 Corporate Bond ETF|G|N|N|100|Y|N +BSCT|Invesco BulletShares 2029 Corporate Bond ETF|G|N|N|100|Y|N +BSCU|Invesco BulletShares 2030 Corporate Bond ETF|G|N|N|100|Y|N +BSCV|Invesco BulletShares 2031 Corporate Bond ETF|G|N|N|100|Y|N +BSCW|Invesco BulletShares 2032 Corporate Bond ETF|G|N|N|100|Y|N +BSCX|Invesco BulletShares 2033 Corporate Bond ETF|G|N|N|100|Y|N +BSCY|Invesco BulletShares 2034 Corporate Bond ETF|G|N|N|100|Y|N +BSCZ|Invesco BulletShares 2035 Corporate Bond ETF|G|N|N|100|Y|N +BSET|Bassett Furniture Industries, Incorporated - Common Stock|Q|N|N|100|N|N +BSJQ|Invesco BulletShares 2026 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJR|Invesco BulletShares 2027 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJS|Invesco BulletShares 2028 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJT|Invesco BulletShares 2029 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJU|Invesco BulletShares 2030 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJV|Invesco BulletShares 2031 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJW|Invesco BulletShares 2032 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSJX|Invesco BulletShares 2033 High Yield Corporate Bond ETF|G|N|N|100|Y|N +BSMQ|Invesco BulletShares 2026 Municipal Bond ETF|G|N|N|100|Y|N +BSMR|Invesco BulletShares 2027 Municipal Bond ETF|G|N|N|100|Y|N +BSMS|Invesco BulletShares 2028 Municipal Bond ETF|G|N|N|100|Y|N +BSMT|Invesco BulletShares 2029 Municipal Bond ETF|G|N|N|100|Y|N +BSMU|Invesco BulletShares 2030 Municipal Bond ETF|G|N|N|100|Y|N +BSMV|Invesco BulletShares 2031 Municipal Bond ETF|G|N|N|100|Y|N +BSMW|Invesco BulletShares 2032 Municipal Bond ETF|G|N|N|100|Y|N +BSMY|Invesco BulletShares 2034 Municipal Bond ETF|G|N|N|100|Y|N +BSMZ|Invesco BulletShares 2035 Municipal Bond ETF|G|N|N|100|Y|N +BSRR|Sierra Bancorp - Common Stock|Q|N|N|100|N|N +BSSX|Invesco BulletShares 2033 Municipal Bond ETF|G|N|N|100|Y|N +BSVN|Bank7 Corp. - Common stock|Q|N|N|100|N|N +BSVO|EA Bridgeway Omni Small-Cap Value ETF|G|N|N|100|Y|N +BSY|Bentley Systems, Incorporated - Class B Common Stock|Q|N|N|100|N|N +BTAI|BioXcel Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +BTBD|BT Brands, Inc. - Common Stock|S|N|D|100|N|N +BTBDW|BT Brands, Inc. - Warrant|S|N|D|100|N|N +BTBT|Bit Digital, Inc. - Ordinary Share|S|N|N|100|N|N +BTCS|BTCS Inc. - Common Stock|S|N|N|100|N|N +BTCT|BTC Digital Ltd. - Ordinary Shares|S|N|N|100|N|N +BTDR|Bitdeer Technologies Group - Ordinary Shares|S|N|N|100|N|N +BTF|CoinShares Bitcoin and Ether ETF|G|N|N|100|Y|N +BTGD|STKd 100% Bitcoin & 100% Gold ETF|G|N|N|100|Y|N +BTM|Bitcoin Depot Inc. - Class A Common Stock|S|N|N|100|N|N +BTMD|Biote Corp. - Class A common stock|G|N|N|100|N|N +BTMWW|Bitcoin Depot Inc. - Warrant|S|N|N|100|N|N +BTOC|Armlogi Holding Corp. - common stock|G|N|D|100|N|N +BTOG|Bit Origin Limited - Class A Ordinary Shares|S|N|D|100|N|N +BTQ|BTQ Technologies Corp. - Common Stock|G|N|N|100|N|N +BTSG|BrightSpring Health Services, Inc. - Common Stock|Q|N|N|100|N|N +BTSGU|BrightSpring Health Services, Inc. - Tangible Equity Unit|Q|N|N|100|N|N +BTTC|Black Titan Corp - Ordinary Shares|S|N|N|100|N|N +BU|Defiance Daily Target 2X Long BU ETF|G|N|N|100|Y|N +BUFC|AB Conservative Buffer ETF|G|N|N|100|Y|N +BUFI|AB International Buffer ETF|G|N|N|100|Y|N +BUFM|AB Moderate Buffer ETF|G|N|N|100|Y|N +BUG|Global X Cybersecurity ETF|G|N|N|100|Y|N +BULD|Pacer BlueStar Engineering the Future ETF|G|N|N|100|Y|N +BULG|Leverage Shares 2X Long BULL Daily ETF|G|N|N|100|Y|N +BULL|Webull Corporation - Class A Ordinary Shares|S|N|N|100|N|N +BULLW|Webull Corporation - Warrants|S|N|N|100|N|N +BULX|GraniteShares 2x Long BULL Daily ETF|G|N|N|100|Y|N +BUSE|First Busey Corporation - Common Stock|Q|N|N|100|N|N +BUSEP|First Busey Corporation - Depositary Shares, Each Representing a 1/40th Interest in a Share of 8.25% Fixed-Rate Series B Non-Cumulative Perpetual Preferred Stock, $0.001 par value|Q|N|N|100|N|N +BUUU|BUUU Group Limited - Class A Ordinary Share|S|N|N|100|N|N +BVC|BitVentures Limited - Ordinary Share|S|N|N|100|N|N +BVFL|BV Financial, Inc. - Common Stock|S|N|N|100|N|N +BVS|Bioventus Inc. - Class A Common Stock|Q|N|N|100|N|N +BWAY|BrainsWay Ltd. - American Depositary Shares|G|N|N|100|N|N +BWB|Bridgewater Bancshares, Inc. - Common Stock|S|N|N|100|N|N +BWBBP|Bridgewater Bancshares, Inc. - Depositary Shares, Each Representing a 1/100th Interest in a Share of 5.875% Non-Cumulative Perpetual Preferred Stock, Series A|S|N|N|100|N|N +BWEN|Broadwind, Inc. - Common Stock|S|N|N|100|N|N +BWFG|Bankwell Financial Group, Inc. - Common Stock|G|N|N|100|N|N +BWIN|The Baldwin Insurance Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +BWMN|Bowman Consulting Group Ltd. - Common Stock|G|N|N|100|N|N +BYAH|Park Ha Biological Technology Co., Ltd. - ordinary shares|S|N|D|100|N|N +BYFC|Broadway Financial Corporation - Class A Common Stock|S|N|E|100|N|N +BYND|Beyond Meat, Inc. - Common stock|Q|N|N|100|N|N +BYRN|Byrna Technologies, Inc. - Common Stock|S|N|N|100|N|N +BYSI|BeyondSpring, Inc. - Ordinary Shares|S|N|N|100|N|N +BZ|KANZHUN LIMITED - American Depository Shares|Q|N|N|100|N|N +BZAI|Blaize Holdings, Inc. - Common Stock|G|N|N|100|N|N +BZAIW|Blaize Holdings, Inc. - Warrant|S|N|N|100|N|N +BZFD|BuzzFeed, Inc. - Class A Common Stock|S|N|N|100|N|N +BZFDW|BuzzFeed, Inc. - Warrant|S|N|N|100|N|N +BZUN|Baozun Inc. - American Depositary Shares|Q|N|N|100|N|N +CA|Xtrackers California Municipal Bonds ETF|G|N|N|100|Y|N +CAAS|China Automotive Systems, Inc. - Ordinary Share|S|N|N|100|N|N +CABA|Cabaletta Bio, Inc. - Common Stock|Q|N|N|100|N|N +CABR|Caring Brands, Inc. - Common Stock|S|N|N|100|N|N +CAC|Camden National Corporation - Common Stock|Q|N|N|100|N|N +CACC|Credit Acceptance Corporation - Common Stock|Q|N|N|40|N|N +CADL|Candel Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +CAEP|Cantor Equity Partners III, Inc. - Class A Ordinary Shares|G|N|N|100|N|N +CAFG|Pacer US Small Cap Cash Cows Growth Leaders ETF|G|N|N|100|Y|N +CAI|Caris Life Sciences, Inc. - Common Stock|Q|N|N|100|N|N +CAIQ|Calamos Nasdaq Autocallable Income ETF|G|N|N|100|Y|N +CAKE|The Cheesecake Factory Incorporated - Common Stock|Q|N|N|100|N|N +CALC|CalciMedica, Inc. - Common Stock|S|N|N|100|N|N +CALI|iShares Short-Term California Muni Active ETF|G|N|N|100|Y|N +CALM|Cal-Maine Foods, Inc. - Common Stock|Q|N|N|100|N|N +CAMP|CAMP4 Therapeutics Corporation - Common Stock|G|N|N|100|N|N +CAMT|Camtek Ltd. - Ordinary Shares|G|N|N|100|N|N +CAN|Canaan Inc. - American Depositary Shares|G|N|D|100|N|N +CANC|Tema Oncology ETF|G|N|N|100|Y|N +CANQ|Calamos Nasdaq Equity & Income ETF|G|N|N|100|Y|N +CAPN|Cayson Acquisition Corp - Ordinary Shares|G|N|N|100|N|N +CAPNR|Cayson Acquisition Corp - Right|G|N|N|100|N|N +CAPNU|Cayson Acquisition Corp - Units|G|N|N|100|N|N +CAPR|Capricor Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CAPS|Capstone Holding Corp. - Common Stock|S|N|D|100|N|N +CAPT|Captivision Inc. - Ordinary Shares|G|N|H|100|N|N +CAPTW|Captivision Inc. - Warrant|S|N|E|100|N|N +CAR|Avis Budget Group, Inc. - Common Stock|Q|N|N|100|N|N +CARE|Carter Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +CARG|CarGurus, Inc. - Class A Common Stock|Q|N|N|100|N|N +CARL|Carlsmed, Inc. - Common Stock|Q|N|N|100|N|N +CART|Maplebear Inc. - Common Stock|Q|N|N|100|N|N +CARY|Angel Oak Income ETF|G|N|N|100|Y|N +CARZ|First Trust S-Network Future Vehicles & Technology ETF|G|N|N|100|Y|N +CASH|Pathward Financial, Inc. - Common Stock|Q|N|N|100|N|N +CASI|CASI Pharmaceuticals, Inc. - Ordinary Shares|S|N|D|100|N|N +CASS|Cass Information Systems, Inc - Common Stock|Q|N|N|100|N|N +CASY|Caseys General Stores, Inc. - Common Stock|Q|N|N|40|N|N +CATH|Global X S&P 500 Catholic Values ETF|G|N|N|100|Y|N +CATY|Cathay General Bancorp - Common Stock|Q|N|N|100|N|N +CBAT|CBAK Energy Technology, Inc. - Common Stock|S|N|D|100|N|N +CBC|Central Bancompany, Inc. - Class A Common Stock|Q|N|N|100|N|N +CBFV|CB Financial Services, Inc. - Common Stock|G|N|N|100|N|N +CBIO|Crescent Biopharma, Inc. - Common Stock|S|N|N|100|N|N +CBK|Commercial Bancgroup, Inc. - Common Stock|S|N|N|100|N|N +CBLL|CeriBell, Inc. - Common Stock|Q|N|N|100|N|N +CBNK|Capital Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +CBRL|Cracker Barrel Old Country Store, Inc. - Common Stock|Q|N|N|100|N|N +CBSH|Commerce Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +CBUS|Cibus, Inc. - Class A Common Stock|S|N|N|100|N|N +CCAP|Crescent Capital BDC, Inc. - Common Stock|G|N|N|100|N|N +CCB|Coastal Financial Corporation - Common Stock|Q|N|N|100|N|N +CCBG|Capital City Bank Group - Common Stock|Q|N|N|100|N|N +CCC|CCC Intelligent Solutions Holdings Inc. - Common Stock|Q|N|N|100|N|N +CCCC|C4 Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +CCCX|Churchill Capital Corp X - Class A Ordinary Shares|G|N|N|100|N|N +CCCXU|Churchill Capital Corp X - Unit|G|N|N|100|N|N +CCCXW|Churchill Capital Corp X - Warrants|G|N|N|100|N|N +CCD|Calamos Dynamic Convertible & Income Fund - Closed End Fund|Q|N|N|100|N|N +CCEC|Capital Clean Energy Carriers Corp. - Common Share|Q|N|N|100|N|N +CCEP|Coca-Cola Europacific Partners plc - Ordinary Shares|Q|N|N|100|N|N +CCFE|Concourse Capital Focused Equity ETF|G|N|N|100|Y|N +CCG|Cheche Group Inc. - Class A Ordinary Shares|S|N|D|100|N|N +CCGWW|Cheche Group Inc. - Warrant|S|N|N|100|N|N +CCHH|CCH Holdings Ltd - Ordinary Shares|S|N|N|100|N|N +CCII|Cohen Circle Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +CCIIU|Cohen Circle Acquisition Corp. II - Unit|G|N|N|100|N|N +CCIIW|Cohen Circle Acquisition Corp. II - Warrant|G|N|N|100|N|N +CCIX|Churchill Capital Corp IX - Ordinary Shares|G|N|N|100|N|N +CCIXU|Churchill Capital Corp IX - Unit|G|N|N|100|N|N +CCIXW|Churchill Capital Corp IX - Warrant|G|N|N|100|N|N +CCLD|CareCloud, Inc. - Common Stock|G|N|D|100|N|N +CCLDO|CareCloud, Inc. - 8.75% Series B Cumulative Redeemable Perpetual Preferred Stock|G|N|D|100|N|N +CCNE|CNB Financial Corporation - Common Stock|Q|N|N|100|N|N +CCNEP|CNB Financial Corporation - Depositary shares, each representing a 1/40th ownership interest in a share of 7.125% Series A Fixed- Rate Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +CCNR|ALPS/CoreCommodity Natural Resources ETF|G|N|N|100|Y|N +CCOI|Cogent Communications Holdings, Inc. - Common Stock|Q|N|N|100|N|N +CCRN|Cross Country Healthcare, Inc. - Common Stock|Q|N|N|100|N|N +CCSB|Carbon Collective Short Duration Green Bond ETF|G|N|N|100|Y|N +CCSI|Consensus Cloud Solutions, Inc. - Common Stock|Q|N|N|100|N|N +CCSO|Carbon Collective Climate Solutions U.S. Equity ETF|G|N|N|100|Y|N +CCTG|CCSC Technology International Holdings Limited - Class A Ordinary Shares|S|N|D|100|N|N +CCXIU|Churchill Capital Corp XI - Units|G|N|N|100|N|N +CD|Chaince Digital Holdings Inc. - American Ordinary Shares|G|N|N|100|N|N +CDC|VictoryShares US EQ Income Enhanced Volatility Wtd ETF|G|N|N|100|Y|N +CDIG|City Different Investments Global Equity ETF|G|N|N|100|Y|N +CDIO|Cardio Diagnostics Holdings Inc. - Common stock|S|N|N|100|N|N +CDIOW|Cardio Diagnostics Holdings Inc. - Warrant|S|N|N|100|N|N +CDL|VictoryShares US Large Cap High Div Volatility Wtd ETF|G|N|N|100|Y|N +CDLX|Cardlytics, Inc. - Common Stock|G|N|N|100|N|N +CDNA|CareDx, Inc. - Common Stock|G|N|N|100|N|N +CDNL|Cardinal Infrastructure Group Inc. - Class A Common Stock|Q|N|N|100|N|N +CDNS|Cadence Design Systems, Inc. - Common Stock|Q|N|N|40|N|N +CDRO|Codere Online Luxembourg, S.A. - Ordinary Shares|S|N|N|100|N|N +CDROW|Codere Online Luxembourg, S.A. - Warrants|S|N|N|100|N|N +CDT|CDT Equity Inc. - Common Stock|S|N|N|100|N|N +CDTG|CDT Environmental Technology Investment Holdings Limited - ordinary shares|S|N|D|100|N|N +CDTTW|CDT Equity Inc. - Warrant|S|N|N|100|N|N +CDW|CDW Corporation - Common Stock|Q|N|N|100|N|N +CDXS|Codexis, Inc. - Common Stock|Q|N|N|100|N|N +CDZI|Cadiz, Inc. - Common Stock|G|N|N|100|N|N +CDZIP|Cadiz, Inc. - Depositary Shares|G|N|N|100|N|N +CECO|CECO Environmental Corp. - Common Stock|Q|N|N|100|N|N +CEFA|Global X S&P Catholic Values Developed ex-U.S. ETF|G|N|N|100|Y|N +CEG|Constellation Energy Corporation - Common Stock When-Issued|Q|N|N|40|N|N +CELC|Celcuity Inc. - Common Stock|S|N|N|100|N|N +CELH|Celsius Holdings, Inc. - Common Stock|S|N|N|100|N|N +CELU|Celularity Inc. - Class A Common Stock|S|N|N|100|N|N +CELUW|Celularity Inc. - Warrant|S|N|N|100|N|N +CELZ|Creative Medical Technology Holdings, Inc. - Common Stock|S|N|N|100|N|N +CENN|Cenntro Inc. - Common Stock|S|N|D|100|N|N +CENT|Central Garden & Pet Company - Common Stock|Q|N|N|100|N|N +CENTA|Central Garden & Pet Company - Class A Common Stock Nonvoting|Q|N|N|100|N|N +CENX|Century Aluminum Company - Common Stock|Q|N|N|100|N|N +CEPF|Cantor Equity Partners IV, Inc. - Class A Ordinary Shares|G|N|N|100|N|N +CEPI|REX Crypto Equity Premium Income ETF|G|N|N|100|Y|N +CEPO|Cantor Equity Partners I, Inc. - Class A Ordinary Shares|G|N|N|100|N|N +CEPT|Cantor Equity Partners II, Inc. - Class A ordinary share|G|N|N|100|N|N +CEPV|Cantor Equity Partners V, Inc. - Class A Ordinary Shares|G|N|N|100|N|N +CERS|Cerus Corporation - Common Stock|G|N|N|100|N|N +CERT|Certara, Inc. - Common Stock|Q|N|N|100|N|N +CETX|Cemtrex Inc. - Common Stock|S|N|N|100|N|N +CETY|Clean Energy Technologies, Inc. - Common Stock|S|N|N|100|N|N +CEVA|CEVA, Inc. - Common Stock|Q|N|N|100|N|N +CFA|VictoryShares US 500 Volatility Wtd ETF|G|N|N|100|Y|N +CFBK|CF Bankshares Inc. - Common Stock|S|N|N|100|N|N +CFFI|C&F Financial Corporation - Common Stock|Q|N|N|100|N|N +CFFN|Capitol Federal Financial, Inc. - Common Stock|Q|N|N|100|N|N +CFLT|Confluent, Inc. - Class A Common Stock|Q|N|N|100|N|N +CFO|VictoryShares US 500 Enhanced Volatility Wtd ETF|G|N|N|100|Y|N +CG|The Carlyle Group Inc. - Common Stock|Q|N|N|100|N|N +CGABL|The Carlyle Group Inc. - 4.625% Subordinated Notes due 2061|Q|N|N|100|N|N +CGBD|Carlyle Secured Lending, Inc. - Closed End Fund|Q|N|N|100|N|N +CGC|Canopy Growth Corporation - Common Shares|Q|N|N|100|N|N +CGCT|Cartesian Growth Corporation III - Class A Ordinary Shares|G|N|N|100|N|N +CGCTU|Cartesian Growth Corporation III - unit|G|N|N|100|N|N +CGCTW|Cartesian Growth Corporation III - Warrant|G|N|N|100|N|N +CGEM|Cullinan Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +CGEN|Compugen Ltd. - Ordinary Shares|S|N|N|100|N|N +CGNT|Cognyte Software Ltd. - Ordinary Shares|Q|N|N|100|N|N +CGNX|Cognex Corporation - Common Stock|Q|N|N|100|N|N +CGO|Calamos Global Total Return Fund - Closed End Fund|Q|N|N|100|N|N +CGON|CG Oncology, Inc. - Common stock|Q|N|N|100|N|N +CGTL|Creative Global Technology Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +CGTX|Cognition Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CHA|Chagee Holdings Limited - American Depositary Shares, each representing 1 Class A ordinary share|Q|N|N|100|N|N +CHAC|Crane Harbor Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +CHACR|Crane Harbor Acquisition Corp. - Rights|G|N|N|100|N|N +CHACU|Crane Harbor Acquisition Corp. - Units|G|N|N|100|N|N +CHAI|Core AI Holdings, Inc. - Common Shares|S|N|N|100|N|N +CHAR|Charlton Aria Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +CHARR|Charlton Aria Acquisition Corporation - Rights|G|N|N|100|N|N +CHARU|Charlton Aria Acquisition Corporation - Units|G|N|N|100|N|N +CHCI|Comstock Holding Companies, Inc. - Class A Common Stock|S|N|N|100|N|N +CHCO|City Holding Company - Common Stock|Q|N|N|100|N|N +CHDN|Churchill Downs, Incorporated - Common Stock|Q|N|N|100|N|N +CHEC|Chenghe Acquisition III Co. - Class A Ordinary Shares|G|N|N|100|N|N +CHECU|Chenghe Acquisition III Co. - Units|G|N|N|100|N|N +CHECW|Chenghe Acquisition III Co. - Warrants|G|N|N|100|N|N +CHEF|The Chefs' Warehouse, Inc. - Common Stock|Q|N|N|100|N|N +CHGX|Stance Sustainable Beta ETF|G|N|N|100|Y|N +CHI|Calamos Convertible Opportunities and Income Fund - Closed End Fund|Q|N|N|100|N|N +CHKP|Check Point Software Technologies Ltd. - Ordinary Shares|Q|N|N|100|N|N +CHMG|Chemung Financial Corp - Common Stock|Q|N|N|100|N|N +CHNR|China Natural Resources, Inc. - Common Shares|S|N|N|100|N|N +CHPG|ChampionsGate Acquisition Corporation - Class A Ordinary Share|G|N|N|100|N|N +CHPGR|ChampionsGate Acquisition Corporation - Rights|G|N|N|100|N|N +CHPGU|ChampionsGate Acquisition Corporation - Unit|G|N|N|100|N|N +CHPS|Xtrackers Semiconductor Select Equity ETF|G|N|N|100|Y|N +CHPX|Global X AI Semiconductor & Quantum ETF|G|N|N|100|Y|N +CHR|Cheer Holding, Inc. - Class A Ordinary Share|S|N|N|100|N|N +CHRD|Chord Energy Corporation - Common Stock|Q|N|N|100|N|N +CHRI|Global X S&P 500 Christian Values ETF|G|N|N|100|Y|N +CHRS|Coherus Oncology, Inc. - Common Stock|G|N|N|100|N|N +CHRW|C.H. Robinson Worldwide, Inc. - Common Stock|Q|N|N|100|N|N +CHSCL|CHS Inc - Class B Cumulative Redeemable Preferred Stock, Series 4|Q|N|N|100|N|N +CHSCM|CHS Inc - Class B Reset Rate Cumulative Redeemable Preferred Stock, Series 3|Q|N|N|100|N|N +CHSCN|CHS Inc - Preferred Class B Series 2 Reset Rate|Q|N|N|100|N|N +CHSCO|CHS Inc - Class B Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +CHSCP|CHS Inc - 8% Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +CHSN|Chanson International Holding - Class A Ordinary Shares|S|N|N|100|N|N +CHTR|Charter Communications, Inc. - Class A Common Stock|Q|N|N|40|N|N +CHW|Calamos Global Dynamic Income Fund - Closed End Fund|Q|N|N|100|N|N +CHY|Calamos Convertible and High Income Fund - Closed End Fund|Q|N|N|100|N|N +CHYM|Chime Financial, Inc. - Class A Common Stock|Q|N|N|100|N|N +CIBR|First Trust NASDAQ Cybersecurity ETF|G|N|N|100|Y|N +CIFG|Leverage Shares 2X Long CIFR Daily ETF|G|N|N|100|Y|N +CIFR|Cipher Mining Inc. - Common Stock|Q|N|N|100|N|N +CIGI|Colliers International Group Inc. - Subordinate Voting Shares|Q|N|N|100|N|N +CIGL|Concorde International Group Ltd - Class A Ordinary Shares|S|N|N|100|N|N +CIIT|Tianci International, Inc. - Common Stock|S|N|D|100|N|N +CIL|VictoryShares International Volatility Wtd ETF|G|N|N|100|Y|N +CINF|Cincinnati Financial Corporation - Common Stock|Q|N|N|100|N|N +CING|Cingulate Inc. - Common Stock|S|N|N|100|N|N +CINGW|Cingulate Inc. - Warrants|S|N|N|100|N|N +CISO|CISO Global, Inc. - Common Stock|S|N|D|100|N|N +CISS|C3is Inc. - Common Stock|S|N|N|100|N|N +CIVB|Civista Bancshares, Inc. - Common Stock|S|N|N|100|N|N +CJMB|Callan JMB Inc. - Common Stock|S|N|N|100|N|N +CLAR|Clarus Corporation - Common Stock|Q|N|N|100|N|N +CLBK|Columbia Financial, Inc. - Common Stock|Q|N|N|100|N|N +CLBT|Cellebrite DI Ltd. - Ordinary Shares|Q|N|N|100|N|N +CLDX|Celldex Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CLFD|Clearfield, Inc. - Common Stock|G|N|N|100|N|N +CLGN|CollPlant Biotechnologies Ltd. - Ordinary Shares|S|N|N|100|N|N +CLIK|Click Holdings Limited - Ordinary Share|S|N|N|100|N|N +CLIR|ClearSign Technologies Corporation - Common Stock|S|N|D|100|N|N +CLLS|Cellectis S.A. - American Depositary Shares|G|N|N|100|N|N +CLMB|Climb Global Solutions, Inc. - Common Stock|G|N|N|100|N|N +CLMT|Calumet, Inc - Common Stock|Q|N|N|100|N|N +CLNE|Clean Energy Fuels Corp. - Common Stock|Q|N|N|100|N|N +CLNN|Clene Inc. - Common Stock|S|N|N|100|N|N +CLOA|iShares AAA CLO Active ETF|G|N|N|100|Y|N +CLOD|Themes Cloud Computing ETF|G|N|N|100|Y|N +CLOU|Global X Cloud Computing ETF|G|N|N|100|Y|N +CLOV|Clover Health Investments, Corp. - Class A Common stock|Q|N|N|100|N|N +CLPS|CLPS Incorporation - Common Stock|G|N|N|100|N|N +CLPT|ClearPoint Neuro Inc. - Common Stock|S|N|N|100|N|N +CLRB|Cellectar Biosciences, Inc. - Common Stock|S|N|N|100|N|N +CLRO|ClearOne, Inc. - Common Stock|S|N|N|100|N|N +CLSK|CleanSpark, Inc. - Common Stock|S|N|N|100|N|N +CLSKW|CleanSpark, Inc. - Warrant|S|N|N|100|N|N +CLSM|ETC Cabana Target Leading Sector Moderate ETF|G|N|N|100|Y|N +CLST|Catalyst Bancorp, Inc. - common stock|S|N|N|100|N|N +CLWT|Euro Tech Holdings Company Limited - Ordinary Shares|S|N|N|100|N|N +CLYM|Climb Bio, Inc. - Common Stock|G|N|N|100|N|N +CMBM|Cambium Networks Corporation - Ordinary Shares|G|N|H|100|N|N +CMBO|Wayfinder Dynamic U.S. Interest Rate ETF|G|N|N|100|Y|N +CMCO|Columbus McKinnon Corporation - Common Stock|Q|N|N|100|N|N +CMCSA|Comcast Corporation - Class A Common Stock|Q|N|N|100|N|N +CMCT|Creative Media - Common Stock|S|N|N|100|N|N +CME|CME Group Inc. - Class A Common Stock|Q|N|N|40|N|N +CMGG|Leverage Shares 2X Long CMG Daily ETF|G|N|N|100|Y|N +CMMB|Chemomab Therapeutics Ltd. - American Depositary Shares|S|N|N|100|N|N +CMND|Clearmind Medicine Inc. - Common Shares|S|N|N|100|N|N +CMPR|Cimpress plc - Ordinary Shares|Q|N|N|100|N|N +CMPS|COMPASS Pathways Plc - American Depository Shares|Q|N|N|100|N|N +CMPX|Compass Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CMRC|Commerce.com, Inc. - Series 1 Common Stock|G|N|N|100|N|N +CMTL|Comtech Telecommunications Corp. - Common Stock|Q|N|N|100|N|N +CNCG|Leverage Shares 2X Long CNC Daily ETF|G|N|N|100|Y|N +CNCK|Coincheck Group N.V. - Ordinary Shares|G|N|N|100|N|N +CNCKW|Coincheck Group N.V. - Warrants|S|N|N|100|N|N +CNDT|Conduent Incorporated - Common Stock|Q|N|N|100|N|N +CNET|ZW Data Action Technologies Inc. - Common Stock|S|N|N|100|N|N +CNEY|CN Energy Group Inc. - Class A Ordinary Shares|S|N|D|100|N|N +CNOB|ConnectOne Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +CNOBP|ConnectOne Bancorp, Inc. - Depositary Shares (each representing a 1/40th interest in a share of 5.25% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series A, par value $0.00 per share)|Q|N|N|100|N|N +CNQQ|Rayliant-ChinaAMC Transformative China Tech ETF|G|N|N|100|Y|N +CNSP|CNS Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +CNTA|Centessa Pharmaceuticals plc - American Depositary Shares|Q|N|N|100|N|N +CNTB|Connect Biopharma Holdings Limited - Ordinary Shares|G|N|N|100|N|N +CNTX|Context Therapeutics Inc. - Common Stock|S|N|N|100|N|N +CNTY|Century Casinos, Inc. - Common Stock|S|N|N|100|N|N +CNVS|Cineverse Corp. - Class A Common Stock|S|N|N|100|N|N +CNXC|Concentrix Corporation - Common Stock|Q|N|N|100|N|N +CNXN|PC Connection, Inc. - Common Stock|Q|N|N|100|N|N +COCH|Envoy Medical, Inc. - Class A Common Stock|S|N|D|100|N|N +COCHW|Envoy Medical, Inc. - Warrant|S|N|D|100|N|N +COCO|The Vita Coco Company, Inc. - Common Stock|Q|N|N|100|N|N +COCP|Cocrystal Pharma, Inc. - Common Stock|S|N|N|100|N|N +CODA|Coda Octopus Group, Inc. - Common stock|S|N|N|100|N|N +COEP|Coeptis Therapeutics Holdings, Inc. - Common Stock|S|N|D|100|N|N +COEPW|Coeptis Therapeutics Holdings, Inc. - Warrants|S|N|D|100|N|N +COFS|ChoiceOne Financial Services, Inc. - Common Stock|S|N|N|100|N|N +COGT|Cogent Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +COHU|Cohu, Inc. - Common Stock|Q|N|N|100|N|N +COIG|Leverage Shares 2X Long COIN Daily ETF|G|N|N|100|Y|N +COIN|Coinbase Global, Inc. - 3Class A Common Stock|Q|N|N|40|N|N +COKE|Coca-Cola Consolidated, Inc. - Common Stock|Q|N|N|100|N|N +COLA|Columbus Acquisition Corp - Ordinary Shares|G|N|N|100|N|N +COLAR|Columbus Acquisition Corp - Rights|G|N|N|100|N|N +COLAU|Columbus Acquisition Corp - Unit|G|N|N|100|N|N +COLB|Columbia Banking System, Inc. - Common Stock|Q|N|N|100|N|N +COLL|Collegium Pharmaceutical, Inc. - Common Stock|Q|N|N|100|N|N +COLM|Columbia Sportswear Company - Common Stock|Q|N|N|100|N|N +COMT|iShares GSCI Commodity Dynamic Roll Strategy ETF|G|N|N|100|Y|N +CONI|GraniteShares 2x Short COIN Daily ETF|G|N|N|100|Y|N +CONL|GraniteShares 2x Long COIN Daily ETF|G|N|N|100|Y|N +CONX|Direxion Daily COIN Bull 2X ETF|G|N|N|100|Y|N +COO|The Cooper Companies, Inc. - Common Stock|Q|N|N|100|N|N +COOT|Australian Oilseeds Holdings Limited - Ordinary Shares|S|N|D|100|N|N +COOTW|Australian Oilseeds Holdings Limited - Warrant|S|N|N|100|N|N +COPJ|Sprott Junior Copper Miners ETF|G|N|N|100|Y|N +COPP|Sprott Copper Miners ETF|G|N|N|100|Y|N +CORO|iShares International Country Rotation Active ETF|G|N|N|100|Y|N +CORT|Corcept Therapeutics Incorporated - Common Stock|S|N|N|100|N|N +CORZ|Core Scientific, Inc. - Common Stock|Q|N|N|100|N|N +CORZW|Core Scientific, Inc. - Tranche 1 Warrants|Q|N|N|100|N|N +CORZZ|Core Scientific, Inc. - Tranche 2 Warrants|Q|N|N|100|N|N +COSM|Cosmos Health Inc. - Common Stock|S|N|D|100|N|N +COST|Costco Wholesale Corporation - Common Stock|Q|N|N|40|N|N +COTG|Leverage Shares 2X Long COST Daily ETF|G|N|N|100|Y|N +COWG|Pacer US Large Cap Cash Cows Growth Leaders ETF|G|N|N|100|Y|N +COWS|Amplify Cash Flow Dividend Leaders ETF|G|N|N|100|Y|N +COYA|Coya Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +COYY|GraniteShares YieldBOOST COIN ETF|G|N|N|100|Y|N +CPAG|F/m Compoundr U.S. Aggregate Bond ETF|G|N|N|100|Y|N +CPB|The Campbell's Company - Common Stock|Q|N|N|100|N|N +CPBI|Central Plains Bancshares, Inc. - Common Stock|S|N|N|100|N|N +CPHC|Canterbury Park Holding Corporation - Common Stock|G|N|N|100|N|N +CPHY|F/m Compoundr High Yield Bond ETF|G|N|N|100|Y|N +CPIX|Cumberland Pharmaceuticals Inc. - Common Stock|Q|N|N|100|N|N +CPLS|AB Core Plus Bond ETF|G|N|N|100|Y|N +CPOP|Pop Culture Group Co., Ltd - Class A Ordinary Shares|S|N|D|100|N|N +CPRT|Copart, Inc. - Common Stock|Q|N|N|100|N|N +CPRX|Catalyst Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +CPSH|CPS Technologies Corp. - Common Stock|S|N|N|100|N|N +CPSS|Consumer Portfolio Services, Inc. - Common Stock|G|N|N|100|N|N +CPZ|Calamos Long/Short Equity & Dynamic Income Trust - Closed End Fund|Q|N|N|100|N|N +CRAC|Crown Reserve Acquisition Corp. I - Class A Ordinary Shares|G|N|N|100|N|N +CRACR|Crown Reserve Acquisition Corp. I - Rights|G|N|N|100|N|N +CRACU|Crown Reserve Acquisition Corp. I - Unit|G|N|N|100|N|N +CRACW|Crown Reserve Acquisition Corp. I - Warrant|G|N|N|100|N|N +CRAI|CRA International,Inc. - Common Stock|Q|N|N|100|N|N +CRAN|Crane Harbor Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +CRANR|Crane Harbor Acquisition Corp. II - Rights|G|N|N|100|N|N +CRANU|Crane Harbor Acquisition Corp. II - Units|G|N|N|100|N|N +CRAQ|Cal Redwood Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +CRAQR|Cal Redwood Acquisition Corp. - Right|G|N|N|100|N|N +CRAQU|Cal Redwood Acquisition Corp. - Units|G|N|N|100|N|N +CRBP|Corbus Pharmaceuticals Holdings, Inc. - Common Stock|S|N|N|100|N|N +CRBU|Caribou Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +CRCG|Leverage Shares 2X Long CRCL Daily ETF|G|N|N|100|Y|N +CRCT|Cricut, Inc. - Class A common stock|Q|N|N|100|N|N +CRDF|Cardiff Oncology, Inc. - Common Stock|S|N|N|100|N|N +CRDL|Cardiol Therapeutics Inc. - Class A Common Shares|S|N|N|100|N|N +CRDO|Credo Technology Group Holding Ltd - Ordinary Shares|Q|N|N|100|N|N +CRE|Cre8 Enterprise Limited - Class A Ordinary Shares|S|N|D|100|N|N +CREG|Smart Powerr Corp. - Common Stock|S|N|N|100|N|N +CRESW|Cresud S.A.C.I.F. y A. - Warrant|S|N|N|100|N|N +CRESY|Cresud S.A.C.I.F. y A. - American Depositary Shares, each representing ten shares of Common Stock|Q|N|N|100|N|N +CREV|Carbon Revolution Public Limited Company - Ordinary Shares|G|N|H|100|N|N +CREVW|Carbon Revolution Public Limited Company - Warrant|S|N|E|100|N|N +CREX|Creative Realities, Inc. - Common Stock|S|N|N|100|N|N +CRGO|Freightos Limited - Ordinary shares|S|N|N|100|N|N +CRGOW|Freightos Limited - Warrants|S|N|N|100|N|N +CRIS|Curis, Inc. - Common Stock|S|N|D|100|N|N +CRMD|CorMedix Inc. - Common Stock|G|N|N|100|N|N +CRMG|Leverage Shares 2X Long CRM Daily ETF|G|N|N|100|Y|N +CRML|Critical Metals Corp. - Ordinary Shares|G|N|N|100|N|N +CRMLW|Critical Metals Corp. - Warrants|S|N|N|100|N|N +CRMT|America's Car-Mart, Inc. - Common Stock|Q|N|N|100|N|N +CRNC|Cerence Inc. - Common Stock|Q|N|N|100|N|N +CRNT|Ceragon Networks Ltd. - Ordinary Shares|Q|N|N|100|N|N +CRNX|Crinetics Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +CRON|Cronos Group Inc. - Common Share|G|N|N|100|N|N +CROX|Crocs, Inc. - Common Stock|Q|N|N|100|N|N +CRSP|CRISPR Therapeutics AG - Common Shares|G|N|N|100|N|N +CRSR|Corsair Gaming, Inc. - Common Stock|Q|N|N|100|N|N +CRTO|Criteo S.A. - American Depositary Shares|Q|N|N|100|N|N +CRUS|Cirrus Logic, Inc. - Common Stock|Q|N|N|100|N|N +CRVL|CorVel Corp. - Common Stock|Q|N|N|100|N|N +CRVO|CervoMed Inc. - Common Stock|S|N|N|100|N|N +CRVS|Corvus Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +CRWD|CrowdStrike Holdings, Inc. - Class A Common Stock|Q|N|N|40|N|N +CRWG|Leverage Shares 2X Long CRWV Daily ETF|G|N|N|100|Y|N +CRWL|GraniteShares 2x Long CRWD Daily ETF|G|N|N|100|Y|N +CRWS|Crown Crafts, Inc. - Common Stock|S|N|N|100|N|N +CRWV|CoreWeave, Inc. - Class A Common Stock|Q|N|N|100|N|N +CSAI|Cloudastructure, Inc. - Class A Common Stock|S|N|N|100|N|N +CSB|VictoryShares US Small Cap High Div Volatility Wtd ETF|G|N|N|100|Y|N +CSBR|Champions Oncology, Inc. - Common Stock|S|N|N|100|N|N +CSCL|Direxion Daily CSCO Bull 2X ETF|G|N|N|100|Y|N +CSCO|Cisco Systems, Inc. - Common Stock|Q|N|N|100|N|N +CSCS|Direxion Daily CSCO Bear 1X ETF|G|N|N|100|Y|N +CSGP|CoStar Group, Inc. - Common Stock|Q|N|N|100|N|N +CSGS|CSG Systems International, Inc. - Common Stock|Q|N|N|100|N|N +CSIQ|Canadian Solar Inc. - Common Shares|Q|N|N|100|N|N +CSPI|CSP Inc. - Common Stock|G|N|N|100|N|N +CSQ|Calamos Strategic Total Return Fund - Closed End Fund|Q|N|N|100|N|N +CSTE|Caesarstone Ltd. - Ordinary Shares|Q|N|N|100|N|N +CSTL|Castle Biosciences, Inc. - Common stock|G|N|N|100|N|N +CSWC|Capital Southwest Corporation - Common Stock|Q|N|N|100|N|N +CSX|CSX Corporation - Common Stock|Q|N|N|100|N|N +CTAS|Cintas Corporation - Common Stock|Q|N|N|100|N|N +CTBI|Community Trust Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +CTEC|Global X CleanTech ETF|G|N|N|100|Y|N +CTKB|Cytek Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +CTLP|Cantaloupe, Inc. - Common Stock|Q|N|N|100|N|N +CTMX|CytomX Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +CTNM|Contineum Therapeutics, Inc. - Common stock|Q|N|N|100|N|N +CTNT|Cheetah Net Supply Chain Service Inc. - Class A Common Stock|S|N|N|100|N|N +CTOR|Citius Oncology, Inc. - Common Stock|S|N|N|100|N|N +CTRM|Castor Maritime Inc. - Common Shares|S|N|N|100|N|N +CTRN|Citi Trends, Inc. - Common Stock|Q|N|N|100|N|N +CTSH|Cognizant Technology Solutions Corporation - Class A Common Stock|Q|N|N|100|N|N +CTSO|Cytosorbents Corporation - Common Stock|S|N|D|100|N|N +CTW|CTW Cayman - Class A Ordinary Shares|S|N|N|100|N|N +CTXR|Citius Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +CUB|Lionheart Holdings - Class A Ordinary Shares|G|N|N|100|N|N +CUBWU|Lionheart Holdings - Unit|G|N|N|100|N|N +CUBWW|Lionheart Holdings - Warrant|G|N|N|100|N|N +CUE|Cue Biopharma, Inc. - Common Stock|S|N|D|100|N|N +CUPR|Cuprina Holdings (Cayman) Limited - Ordinary shares|S|N|D|100|N|N +CURI|CuriosityStream Inc. - Class A Common Stock|S|N|N|100|N|N +CURR|Currenc Group Inc. - Ordinary Shares|G|N|D|100|N|N +CURX|Curanex Pharmaceuticals Inc - Common Stock|S|N|D|100|N|N +CUSD|CrossingBridge Ultra-Short Duration ETF|G|N|N|100|Y|N +CV|CapsoVision, Inc. - Common Stock|S|N|N|100|N|N +CVBF|CVB Financial Corporation - Common Stock|Q|N|N|100|N|N +CVCO|Cavco Industries, Inc. - Common Stock|Q|N|N|40|N|N +CVGI|Commercial Vehicle Group, Inc. - Common Stock|Q|N|N|100|N|N +CVGW|Calavo Growers, Inc. - Common Stock|Q|N|N|100|N|N +CVKD|Cadrenal Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CVLT|Commvault Systems, Inc. - Common Stock|Q|N|N|100|N|N +CVNX|Defiance Daily Target 2X Long CVNA ETF|G|N|N|100|Y|N +CVRX|CVRx, Inc. - Common Stock|Q|N|N|100|N|N +CVV|CVD Equipment Corporation - Common Stock|S|N|N|100|N|N +CWBC|Community West Bancshares - Common Stock|S|N|N|100|N|N +CWCO|Consolidated Water Co. Ltd. - Ordinary Shares|Q|N|N|100|N|N +CWD|CaliberCos Inc. - Class A Common Stock|S|N|N|100|N|N +CWST|Casella Waste Systems, Inc. - Class A Common Stock|Q|N|N|100|N|N +CXAI|CXApp Inc. - Class A Common Stock|S|N|D|100|N|N +CXAIW|CXApp Inc. - Warrant|S|N|N|100|N|N +CXDO|Crexendo, Inc. - Common Stock|S|N|N|100|N|N +CXSE|WisdomTree China ex-State-Owned Enterprises Fund|G|N|N|100|Y|N +CYBR|CyberArk Software Ltd. - Ordinary Shares|Q|N|N|40|N|N +CYCN|Cyclerion Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +CYCU|Cycurion, Inc. - Common Stock|G|N|N|100|N|N +CYCUW|Cycurion, Inc. - Warrants|S|N|N|100|N|N +CYN|Cyngn Inc. - Common stock|S|N|N|100|N|N +CYPH|Cypherpunk Technologies Inc. - Common Stock|S|N|N|100|N|N +CYRX|CryoPort, Inc. - Common Stock|S|N|N|100|N|N +CYTK|Cytokinetics, Incorporated - Common Stock|Q|N|N|100|N|N +CZAR|Themes Natural Monopoly ETF|G|N|N|100|Y|N +CZFS|Citizens Financial Services, Inc. - Common Stock|S|N|N|100|N|N +CZNC|Citizens & Northern Corp - Common Stock|S|N|N|100|N|N +CZR|Caesars Entertainment, Inc. - Common Stock|Q|N|N|100|N|N +CZWI|Citizens Community Bancorp, Inc. - Common Stock|G|N|N|100|N|N +DAAQ|Digital Asset Acquisition Corp. - Class A Ordinary shares|G|N|N|100|N|N +DAAQU|Digital Asset Acquisition Corp. - Units|G|N|N|100|N|N +DAAQW|Digital Asset Acquisition Corp. - Warrant|G|N|N|100|N|N +DADS|Digital Asset Debt Strategy ETF|G|N|N|100|Y|N +DAIC|CID HoldCo, Inc. - Common Stock|G|N|N|100|N|N +DAICW|CID HoldCo, Inc. - Warrants|G|N|N|100|N|N +DAIO|Data I/O Corporation - Common Stock|S|N|N|100|N|N +DAK|Dakota Active Equity ETF|G|N|N|100|Y|N +DAKT|Daktronics, Inc. - Common Stock|Q|N|N|100|N|N +DALI|First Trust Dorsey Wright DALI Equity ETF|G|N|N|100|Y|N +DAPP|VanEck Digital Transformation ETF|G|N|N|100|Y|N +DARE|Dare Bioscience, Inc. - Common Stock|S|N|N|100|N|N +DASH|DoorDash, Inc. - Common Stock|Q|N|N|40|N|N +DAVE|Dave Inc. - Class A Common Stock|G|N|N|100|N|N +DAVEW|Dave Inc. - Warrants|G|N|N|100|N|N +DAWN|Day One Biopharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +DAX|Global X DAX Germany ETF|G|N|N|100|Y|N +DBGI|Digital Brands Group, Inc. - Common Stock|S|N|N|100|N|N +DBSC|Deepwater Beachfront Small Cap ETF|G|N|N|100|Y|N +DBVT|DBV Technologies S.A. - American Depositary Shares|S|N|N|100|N|N +DBX|Dropbox, Inc. - Class A Common Stock|Q|N|N|100|N|N +DCBO|Docebo Inc. - Common Shares|Q|N|N|100|N|N +DCGO|DocGo Inc. - Common Stock|S|N|N|100|N|N +DCOM|Dime Community Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +DCOMG|Dime Community Bancshares, Inc. - 9.000% Fixed-to-Floating Rate Subordinated Notes due 2034|G|N|N|100|N|N +DCOMP|Dime Community Bancshares, Inc. - Fixed-Rate Non-Cumulative Perpetual Preferred Stock, Series A|Q|N|N|100|N|N +DCOY|Decoy Therapeutics Inc. - Common Stock|S|N|D|100|N|N +DCTH|Delcath Systems, Inc. - Common Stock|S|N|N|100|N|N +DCX|Digital Currency X Technology Inc. - Class A Ordinary Shares|S|N|D|100|N|N +DDI|DoubleDown Interactive Co., Ltd. - American Depository Shares|Q|N|N|100|N|N +DDIV|First Trust Dorsey Wright Momentum & Dividend ETF|G|N|N|100|Y|N +DDOG|Datadog, Inc. - Class A Common Stock|Q|N|N|100|N|N +DECO|SPDR Galaxy Digital Asset Ecosystem ETF|G|N|N|100|Y|N +DEFT|Defi Technologies, Inc. - Common Stock|S|N|N|100|N|N +DEMZ|Democratic Large Cap Core ETF|G|N|N|100|Y|N +DERM|Journey Medical Corporation - Common Stock|S|N|N|100|N|N +DEVS|DevvStream Corp. - Common Stock|S|N|D|100|N|N +DFDV|DeFi Development Corp. - Common Stock|S|N|N|100|N|N +DFDVW|DeFi Development Corp. - Warrant|S|N|N|100|N|N +DFGP|Dimensional Global Core Plus Fixed Income ETF|G|N|N|100|Y|N +DFGX|Dimensional Global ex US Core Fixed Income ETF|G|N|N|100|Y|N +DFLI|Dragonfly Energy Holdings Corp - Common Stock|S|N|N|100|N|N +DFLIW|Dragonfly Energy Holdings Corp - Warrant|S|N|N|100|N|N +DFSC|DEFSEC Technologies Inc. - common stock, no R/S concurrent with offering|S|N|N|100|N|N +DFSCW|DEFSEC Technologies Inc. - warrant|S|N|N|100|N|N +DFTX|Definium Therapeutics, Inc. - Common Shares|Q|N|N|100|N|N +DGCB|Dimensional Global Credit ETF|G|N|N|100|Y|N +DGICA|Donegal Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +DGICB|Donegal Group, Inc. - Class B Common Stock|Q|N|N|100|N|N +DGII|Digi International Inc. - Common Stock|Q|N|N|100|N|N +DGLO|First Trust RBA Deglobalization ETF|G|N|N|100|Y|N +DGNX|Diginex Limited - Ordinary Shares|S|N|N|100|N|N +DGRE|WisdomTree Emerging Markets Quality Dividend Growth Fund|G|N|N|100|Y|N +DGRS|WisdomTree U.S. SmallCap Quality Dividend Growth Fund|G|N|N|100|Y|N +DGRW|WisdomTree U.S. Quality Dividend Growth Fund|G|N|N|100|Y|N +DGXX|Digi Power X Inc. - Common Subordinate Voting Shares|S|N|N|100|N|N +DH|Definitive Healthcare Corp. - Class A Common Stock|Q|N|N|100|N|N +DHC|Diversified Healthcare Trust - Common Shares of Beneficial Interest|Q|N|N|100|N|N +DHCNI|Diversified Healthcare Trust - 5.625% Senior Notes due 2042|Q|N|N|100|N|N +DHCNL|Diversified Healthcare Trust - 6.25% Senior Notes Due 2046|Q|N|N|100|N|N +DHIL|Diamond Hill Investment Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +DIBS|1stdibs.com, Inc. - Common Stock|G|N|N|100|N|N +DIME|CoinShares Altcoins ETF|G|N|N|100|Y|N +DIOD|Diodes Incorporated - Common Stock|Q|N|N|100|N|N +DIVD|Altrius Global Dividend ETF|G|N|N|100|Y|N +DJCO|Daily Journal Corp. (S.C.) - Common Stock|S|N|N|40|N|N +DJT|Trump Media & Technology Group Corp. - Common Stock|G|N|N|100|N|N +DJTWW|Trump Media & Technology Group Corp. - Warrants|G|N|N|100|N|N +DKI|DarkIris Inc. - Class A Ordinary Shares|S|N|D|100|N|N +DKNG|DraftKings Inc. - Class A Common Stock|Q|N|N|100|N|N +DKNX|Defiance Daily Target 2X Long DKNG ETF|G|N|N|100|Y|N +DLHC|DLH Holdings Corp. - Common Stock|S|N|N|100|N|N +DLLL|GraniteShares 2x Long DELL Daily ETF|G|N|N|100|Y|N +DLO|DLocal Limited - Class A Common Shares|Q|N|N|100|N|N +DLPN|Dolphin Entertainment, Inc. - Common Stock|S|N|N|100|N|N +DLTH|Duluth Holdings Inc. - Class B Common Stock|Q|N|N|100|N|N +DLTR|Dollar Tree, Inc. - Common Stock|Q|N|N|100|N|N +DLXY|Delixy Holdings Limited - Ordinary Shares|S|N|N|100|N|N +DMAA|Drugs Made In America Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +DMAAR|Drugs Made In America Acquisition Corp. - Rights|G|N|N|100|N|N +DMAAU|Drugs Made In America Acquisition Corp. - Units|G|N|N|100|N|N +DMAC|DiaMedica Therapeutics Inc. - Common Stock|S|N|N|100|N|N +DMAT|Global X Disruptive Materials ETF|G|N|N|100|Y|N +DMII|Drugs Made In America Acquisition II Corp. - Ordinary Shares|G|N|N|100|N|N +DMIIR|Drugs Made In America Acquisition II Corp. - Right|G|N|N|100|N|N +DMIIU|Drugs Made In America Acquisition II Corp. - Unit|G|N|N|100|N|N +DMLP|Dorchester Minerals, L.P. - Common Units Representing Limited Partnership Interests|Q|N|D|100|N|N +DMRC|Digimarc Corporation - Common Stock|Q|N|N|100|N|N +DMXF|iShares ESG Advanced MSCI EAFE ETF|G|N|N|100|Y|N +DNLI|Denali Therapeutics Inc. - Common Stock|Q|N|N|100|N|N +DNMX|Dynamix Corporation III - Class A Ordinary Shares|G|N|N|100|N|N +DNMXU|Dynamix Corporation III - Unit|G|N|N|100|N|N +DNMXW|Dynamix Corporation III - Warrants|G|N|N|100|N|N +DNTH|Dianthus Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +DNUT|Krispy Kreme, Inc. - Common Stock|Q|N|N|100|N|N +DOCU|DocuSign, Inc. - Common Stock|Q|N|N|100|N|N +DOGZ|Dogness (International) Corporation - Class A Common Stock|S|N|N|100|N|N +DOMH|Dominari Holdings Inc. - Common Stock|S|N|N|100|N|N +DOMO|Domo, Inc. - Class B Common Stock|G|N|N|100|N|N +DOO|BRP Inc. - Common Subordinate Voting Shares|Q|N|N|100|N|N +DORM|Dorman Products, Inc. - Common Stock|Q|N|N|100|N|N +DOX|Amdocs Limited - Ordinary Shares|Q|N|N|100|N|N +DOYU|DouYu International Holdings Limited - American Depositary Shares|Q|N|N|100|N|N +DPRO|Draganfly Inc. - Common Shares|S|N|N|100|N|N +DPZ|Domino's Pizza Inc - Common Stock|Q|N|N|40|N|N +DRCT|Direct Digital Holdings, Inc. - Class A Common Stock|S|N|D|100|N|N +DRDB|Roman DBDR Acquisition Corp. II - Ordinary shares|G|N|N|100|N|N +DRDBU|Roman DBDR Acquisition Corp. II - Unit|G|N|N|100|N|N +DRDBW|Roman DBDR Acquisition Corp. II - Warrants|G|N|N|100|N|N +DRH|Diamondrock Hospitality Company - Common Stock|Q|N|N|100|N|N +DRIO|DarioHealth Corp. - Common Stock|S|N|N|100|N|N +DRIV|Global X Autonomous & Electric Vehicles ETF|G|N|N|100|Y|N +DRMA|Dermata Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +DRMAW|Dermata Therapeutics, Inc. - Warrant|S|N|N|100|N|N +DRNZ|REX Drone ETF|G|N|N|100|Y|N +DRS|Leonardo DRS, Inc. - Common Stock|Q|N|N|100|N|N +DRTS|Alpha Tau Medical Ltd. - Ordinary Shares|S|N|N|100|N|N +DRTSW|Alpha Tau Medical Ltd. - Warrant|S|N|N|100|N|N +DRUG|Bright Minds Biosciences Inc. - common stock|S|N|N|100|N|N +DRVN|Driven Brands Holdings Inc. - Common Stock|Q|N|N|100|N|N +DSACU|Daedalus Special Acquisition Corp. - Unit|G|N|N|100|N|N +DSGN|Design Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +DSGR|Distribution Solutions Group, Inc. - Common Stock|Q|N|N|100|N|N +DSGX|The Descartes Systems Group Inc. - Common Stock|Q|N|N|100|N|N +DSP|Viant Technology Inc. - common stock|Q|N|N|100|N|N +DSWL|Deswell Industries, Inc. - Common Shares|G|N|N|100|N|N +DSY|Big Tree Cloud Holdings Limited - Ordinary Shares|G|N|D|100|N|N +DSYWW|Big Tree Cloud Holdings Limited - Warrants|S|N|N|100|N|N +DTCK|Davis Commodities Limited - Class A Ordinary Shares|S|N|D|100|N|N +DTCR|Global X Data Center & Digital Infrastructure ETF|G|N|N|100|Y|N +DTCX|Datacentrex, Inc. - Common Stock|S|N|N|100|N|N +DTI|Drilling Tools International Corporation - Common Stock|S|N|N|100|N|N +DTIL|Precision BioSciences, Inc. - Common Stock|S|N|N|100|N|N +DTSQ|DT Cloud Star Acquisition Corporation - Ordinary Shares|G|N|D|100|N|N +DTSQR|DT Cloud Star Acquisition Corporation - Right|G|N|D|100|N|N +DTSQU|DT Cloud Star Acquisition Corporation - Units|G|N|D|100|N|N +DTSS|Datasea Inc. - Common Stock|S|N|N|100|N|N +DTST|Data Storage Corporation - Common Stock|S|N|N|100|N|N +DTSTW|Data Storage Corporation - Warrant|S|N|N|100|N|N +DUKH|Ocean Park High Income ETF|G|N|N|100|Y|N +DUKX|Ocean Park International ETF|G|N|N|100|Y|N +DUO|Fangdd Network Group Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +DUOG|Leverage Shares 2X Long DUOL Daily ETF|G|N|N|100|Y|N +DUOL|Duolingo, Inc. - Class A Common Stock|Q|N|N|40|N|N +DUOT|Duos Technologies Group, Inc. - Common Stock|S|N|N|100|N|N +DVAL|BrandywineGLOBAL-Dynamic US Large Cap Value ETF|G|N|N|100|Y|N +DVAX|Dynavax Technologies Corporation - Common Stock|Q|N|N|100|N|N +DVGR|DAC 3D Dividend Growth ETF|G|N|N|100|Y|N +DVIN|WEBs Industrials XLI Defined Volatility ETF|G|N|N|100|Y|N +DVLT|Datavault AI Inc. - Common Stock|S|N|N|100|N|N +DVLU|First Trust Dorsey Wright Momentum & Value ETF|G|N|N|100|Y|N +DVOL|First Trust Dorsey Wright Momentum & Low Volatility ETF|G|N|N|100|Y|N +DVQQ|WEBs QQQ Defined Volatility ETF|G|N|N|100|Y|N +DVRE|WEBs Real Estate XLRE Defined Volatility ETF|G|N|N|100|Y|N +DVSP|WEBs SPY Defined Volatility ETF|G|N|N|100|Y|N +DVUT|WEBs Utilities XLU Defined Volatility ETF|G|N|N|100|Y|N +DVXB|WEBs Materials XLB Defined Volatility ETF|G|N|N|100|Y|N +DVXC|WEBs Communication Services XLC Defined Volatility ETF|G|N|N|100|Y|N +DVXE|WEBs Energy XLE Defined Volatility ETF|G|N|N|100|Y|N +DVXF|WEBs Financial XLF Defined Volatility ETF|G|N|N|100|Y|N +DVXK|WEBs Technology XLK Defined Volatility ETF|G|N|N|100|Y|N +DVXP|WEBs Consumer Staples XLP Defined Volatility ETF|G|N|N|100|Y|N +DVXV|WEBs Health Care XLV Defined Volatility ETF|G|N|N|100|Y|N +DVXY|WEBs Consumer Discretionary XLY Defined Volatility ETF|G|N|N|100|Y|N +DVY|iShares Select Dividend ETF|G|N|N|100|Y|N +DWAS|Invesco Dorsey Wright SmallCap Momentum ETF|G|N|N|100|Y|N +DWAW|AdvisorShares Dorsey Wright FSM All Cap World ETF|G|N|N|100|Y|N +DWSH|AdvisorShares Dorsey Wright Short ETF|G|N|N|100|Y|N +DWSN|Dawson Geophysical Company - Common Stock|Q|N|N|100|N|N +DWTX|Dogwood Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +DWUS|AdvisorShares Dorsey Wright FSM US Core ETF|G|N|N|100|Y|N +DXCM|DexCom, Inc. - Common Stock|Q|N|N|100|N|N +DXLG|Destination XL Group, Inc. - Common Stock|G|N|N|100|N|N +DXPE|DXP Enterprises, Inc. - Common Stock|Q|N|N|100|N|N +DXR|Daxor Corporation - Closed End Fund|S|N|N|100|N|N +DXST|Decent Holding Inc. - Class A Ordinary Shares|S|N|N|100|N|N +DYAI|Dyadic International, Inc. - Common Stock|S|N|D|100|N|N +DYFI|IDX Dynamic Fixed Income ETF|G|N|N|100|Y|N +DYN|Dyne Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +DYNB|Hartford Dynamic Bond ETF|G|N|N|100|Y|N +DYOR|Insight Digital Partners II - Class A Ordinary Shares|G|N|N|100|N|N +DYORU|Insight Digital Partners II - Units|G|N|N|100|N|N +DYORW|Insight Digital Partners II - Warrants|G|N|N|100|N|N +DYTA|SGI Dynamic Tactical ETF|G|N|N|100|Y|N +EA|Electronic Arts Inc. - Common Stock|Q|N|N|100|N|N +EASY|Liberty One Defensive Dividend Growth ETF|G|N|N|100|Y|N +EBAY|eBay Inc. - Common Stock|Q|N|N|100|N|N +EBC|Eastern Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +EBI|Longview Advantage ETF|G|N|N|100|Y|N +EBIZ|Global X E-commerce ETF|G|N|N|100|Y|N +EBMT|Eagle Bancorp Montana, Inc. - Common Stock|G|N|N|100|N|N +EBON|Ebang International Holdings Inc. - Class A Ordinary Shares|Q|N|N|100|N|N +ECBK|ECB Bancorp, Inc. - Common Stock|S|N|N|100|N|N +ECOR|electroCore, Inc. - Common Stock|S|N|N|100|N|N +ECOW|Pacer Emerging Markets Cash Cows 100 ETF|G|N|N|100|Y|N +ECPG|Encore Capital Group Inc - Common Stock|Q|N|N|100|N|N +ECX|ECARX Holdings Inc. - Class A Ordinary shares|G|N|N|100|N|N +ECXWW|ECARX Holdings Inc. - Warrants|S|N|N|100|N|N +EDAP|EDAP TMS S.A. - American Depositary Shares, each representing One Ordinary Share|G|N|N|100|N|N +EDBL|Edible Garden AG Incorporated - Common Stock|S|N|N|100|N|N +EDBLW|Edible Garden AG Incorporated - Warrant|S|N|N|100|N|N +EDHL|Everbright Digital Holding Limited - Ordinary Shares|S|N|D|100|N|N +EDIT|Editas Medicine, Inc. - Common Stock|Q|N|N|100|N|N +EDRY|EuroDry Ltd. - Common Shares|S|N|N|100|N|N +EDSA|Edesa Biotech, Inc. - Common Shares|S|N|N|100|N|N +EDTK|Skillful Craftsman Education Technology Limited - Ordinary Share|S|N|N|100|N|N +EDUC|Educational Development Corporation - Common Stock|G|N|N|100|N|N +EEFT|Euronet Worldwide, Inc. - Common Stock|Q|N|N|100|N|N +EEIQ|EpicQuest Education Group International Limited - Common Stock|S|N|D|100|N|N +EEMA|iShares MSCI Emerging Markets Asia ETF|G|N|N|100|Y|N +EFAS|Global X MSCI SuperDividend EAFE ETF|G|N|N|100|Y|N +EFOI|Energy Focus, Inc. - Common Stock|S|N|N|100|N|N +EFRA|iShares Environmental Infrastructure and Industrials ETF|G|N|N|100|Y|N +EFSC|Enterprise Financial Services Corporation - Common Stock|Q|N|N|100|N|N +EFSCP|Enterprise Financial Services Corporation - Depositary Shares Each Representing a 1/40th Interest in a Share of 5% Fixed Rate Non-Cumulative Perpetual Preferred Stock, Series A|Q|N|N|100|N|N +EFSI|Eagle Financial Services Inc - Common Stock|S|N|N|100|N|N +EFTY|Etoiles Capital Group Co., Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +EGAN|eGain Corporation - Common Stock|S|N|N|100|N|N +EGBN|Eagle Bancorp, Inc. - Common Stock|S|N|N|100|N|N +EGGQ|NestYield Visionary ETF|G|N|N|100|Y|N +EGHA|EGH Acquisition Corp. - Class A ordinary shares|G|N|N|100|N|N +EGHAR|EGH Acquisition Corp. - rights|G|N|N|100|N|N +EGHAU|EGH Acquisition Corp. - Unit|G|N|N|100|N|N +EGHT|8x8 Inc - Common stock|Q|N|N|100|N|N +EH|EHang Holdings Limited - ADS|G|N|N|100|N|N +EHGO|Eshallgo Inc. - Class A Ordinary Shares|S|N|D|100|N|N +EHLD|Euroholdings Ltd. - Common Stock|S|N|N|100|N|N +EHLS|Even Herd Long Short ETF|G|N|N|100|Y|N +EHTH|eHealth, Inc. - Common Stock|Q|N|N|100|N|N +EJH|E-Home Household Service Holdings Limited - Ordinary shares|S|N|N|100|N|N +EKG|First Trust Nasdaq Lux Digital Health Solutions ETF|G|N|N|100|Y|N +EKSO|Ekso Bionics Holdings, Inc. - Common Stock|S|N|N|100|N|N +ELAB|PMGC Holdings Inc. - Common Stock|S|N|N|100|N|N +ELBM|Electra Battery Materials Corporation - Common Stock|S|N|N|100|N|N +ELDN|Eledon Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +ELE|Elemental Royalty Corporation - Common Stock|S|N|N|100|N|N +ELFY|ALPS Electrification Infrastructure ETF|G|N|N|100|Y|N +ELIL|Direxion Daily LLY Bull 2X Shares|G|N|N|100|Y|N +ELIS|Direxion Daily LLY Bear 1X Shares|G|N|N|100|Y|N +ELOG|Eastern International Ltd. - Ordinary Shares|S|N|N|100|N|N +ELPW|Elong Power Holding Limited - Class A Ordinary Shares|G|N|D|100|N|N +ELSE|Electro-Sensors, Inc. - Common Stock|S|N|N|100|N|N +ELTK|Eltek Ltd. - Ordinary Shares|S|N|N|100|N|N +ELTX|Elicio Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +ELUT|Elutia, Inc. - Class A Common Stock|S|N|D|100|N|N +ELVA|Electrovaya Inc. - Common Shares|S|N|N|100|N|N +ELVN|Enliven Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ELVR|Elevra Lithium Limited - American Depository Shares|S|N|N|100|N|N +ELWT|Elauwit Connection, Inc. - Common Stock|S|N|N|100|N|N +EM|Smart Share Global Limited - American Depositary Shares|S|N|E|100|N|N +EMAT|Evolution Metals & Technologies Corp. - Common Stock|G|N|N|100|N|N +EMB|iShares J.P. Morgan USD Emerging Markets Bond ETF|G|N|N|100|Y|N +EMBC|Embecta Corp. - Common Stock|Q|N|N|100|N|N +EMCB|WisdomTree Emerging Markets Corporate Bond Fund|G|N|N|100|Y|N +EMEQ|Nomura Focused Emerging Markets Equity ETF|G|N|N|100|Y|N +EMIF|iShares Emerging Markets Infrastructure ETF|G|N|N|100|Y|N +EMIS|Emmis Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +EMISR|Emmis Acquisition Corp. - Rights|G|N|N|100|N|N +EML|Eastern Company (The) - Common Stock|G|N|N|100|N|N +EMPD|Empery Digital Inc. - Common stock|Q|N|N|100|N|N +EMPG|Empro Group Inc. - Ordinary shares|S|N|N|100|N|N +EMXC|iShares MSCI Emerging Markets ex China ETF|G|N|N|100|Y|N +EMXF|iShares ESG Advanced MSCI EM ETF|G|N|N|100|Y|N +ENDW|Cambria Endowment Style ETF|G|N|N|100|Y|N +ENGN|enGene Holdings Inc. - Common Stock|S|N|N|100|N|N +ENGNW|enGene Holdings Inc. - Warrants|S|N|N|100|N|N +ENGS|Energys Group Limited - Ordinary Shares|S|N|D|100|N|N +ENHU|iShares Enhanced Large Cap Core Active ETF|G|N|N|100|Y|N +ENLT|Enlight Renewable Energy Ltd. - Ordinary Shares|Q|N|N|100|N|N +ENLV|Enlivex Therapeutics Ltd. - Ordinary Shares|S|N|N|100|N|N +ENPH|Enphase Energy, Inc. - Common Stock|G|N|N|100|N|N +ENSC|Ensysce Biosciences, Inc. - Common Stock|S|N|N|100|N|N +ENSG|The Ensign Group, Inc. - Common Stock|Q|N|N|100|N|N +ENTA|Enanta Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +ENTG|Entegris, Inc. - Common Stock|Q|N|N|100|N|N +ENTX|Entera Bio Ltd. - Ordinary Shares|S|N|N|100|N|N +ENVB|Enveric Biosciences, Inc. - Common Stock|S|N|N|100|N|N +ENVX|Enovix Corporation - Common Stock|Q|N|N|100|N|N +ENZL|iShares MSCI New Zealand ETF|G|N|N|100|Y|N +EOLS|Evolus, Inc. - Common Stock|G|N|N|100|N|N +EOSE|Eos Energy Enterprises, Inc. - Common Stock|S|N|N|100|N|N +EPOW|Sunrise New Energy Co., Ltd - Class A Ordinary Shares|S|N|N|100|N|N +EPRX|Eupraxia Pharmaceuticals Inc. - Common Stock|S|N|N|100|N|N +EPSM|Epsium Enterprise Limited - Class A Ordinary Shares|S|N|N|100|N|N +EPSN|Epsilon Energy Ltd. - Common Shares|G|N|N|100|N|N +EQ|Equillium, Inc. - Common Stock|S|N|N|100|N|N +EQIX|Equinix, Inc. - Common Stock|Q|N|N|40|N|N +EQPT|EquipmentShare.com Inc - Class A Common Stock|Q|N|N|100|N|N +EQRR|ProShares Equities for Rising Rates ETF|G|N|N|100|Y|N +ERAS|Erasca, Inc. - Common Stock|Q|N|N|100|N|N +ERET|iShares Environmentally Aware Real Estate ETF|G|N|N|100|Y|N +ERIC|Ericsson - American Depositary Shares each representing 1 underlying Class B share|Q|N|N|100|N|N +ERIE|Erie Indemnity Company - Class A Common Stock|Q|N|N|40|N|N +ERII|Energy Recovery, Inc. - Common Stock|Q|N|N|100|N|N +ERNA|Ernexa Therapeutics Inc. - Common Stock|S|N|N|100|N|N +ERNZ|TrueShares Active Yield ETF|G|N|N|100|Y|N +ESCA|Escalade, Incorporated - Common Stock|G|N|N|100|N|N +ESEA|Euroseas Ltd. - Common Stock|S|N|N|100|N|N +ESGD|iShares ESG Aware MSCI EAFE ETF|G|N|N|100|Y|N +ESGE|iShares ESG Aware MSCI EM ETF|G|N|N|100|Y|N +ESGL|ESGL Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +ESGLW|ESGL Holdings Limited - Warrants|S|N|N|100|N|N +ESGU|iShares ESG Aware MSCI USA ETF|G|N|N|100|Y|N +ESHA|ESH Acquisition Corp. - Class A Common Stock|S|N|N|100|N|N +ESHAR|ESH Acquisition Corp. - Right|S|N|N|100|N|N +ESLA|Estrella Immunopharma, Inc. - Common Stock|S|N|D|100|N|N +ESLAW|Estrella Immunopharma, Inc. - Warrant|S|N|D|100|N|N +ESLT|Elbit Systems Ltd. - Ordinary Shares|Q|N|N|40|N|N +ESMV|iShares ESG Optimized MSCI USA Min Vol Factor ETF|G|N|N|100|Y|N +ESN|Essential 40 Stock ETF|G|N|N|100|Y|N +ESOA|Energy Services of America Corporation - Common Stock|S|N|N|100|N|N +ESPO|VanEck Video Gaming and eSports ETF|G|N|N|100|Y|N +ESPR|Esperion Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +ESQ|Esquire Financial Holdings, Inc. - Common Stock|S|N|N|100|N|N +ESTA|Establishment Labs Holdings Inc. - Common Shares|S|N|N|100|N|N +ETEC|iShares Breakthrough Environmental Solutions ETF|G|N|N|100|Y|N +ETHA|iShares Ethereum Trust ETF|G|N|N|100|Y|N +ETHM|Dynamix Corporation - Class A Ordinary Share|G|N|N|100|N|N +ETHMU|Dynamix Corporation - Unit|G|N|N|100|N|N +ETHMW|Dynamix Corporation - Warrant|G|N|N|100|N|N +ETHZ|ETHZilla Corporation - Common Stock|S|N|N|100|N|N +ETON|Eton Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +ETOR|eToro Group Ltd. - Class A Common Shares|Q|N|N|100|N|N +ETRL|GraniteShares 2x Long ETOR Daily ETF|G|N|N|100|Y|N +ETS|Elite Express Holding Inc. - Class A Common Stock|S|N|D|100|N|N +EU|enCore Energy Corp. - Common Stock|S|N|N|100|N|N +EUDA|Euda Health Holdings Limited - Ordinary Shares|S|N|N|100|N|N +EUDAW|Euda Health Holdings Limited - Warrant|S|N|N|100|N|N +EUFN|iShares MSCI Europe Financials ETF|G|N|N|100|Y|N +EURK|Eureka Acquisition Corp - Class A Ordinary Share|S|N|N|100|N|N +EURKR|Eureka Acquisition Corp - Right|S|N|N|100|N|N +EURKU|Eureka Acquisition Corp - Unit|S|N|N|100|N|N +EVAX|Evaxion A/S - American Depositary Share|S|N|N|100|N|N +EVCM|EverCommerce Inc. - Common Stock|Q|N|N|100|N|N +EVER|EverQuote, Inc. - Class A Common Stock|G|N|N|100|N|N +EVGN|Evogene Ltd. - Ordinary Shares|S|N|N|100|N|N +EVGO|EVgo Inc. - Common Stock|Q|N|N|100|N|N +EVGOW|EVgo Inc. - Warrants, each whole warrant exercisable for one share of Class A Common Stock at an exercise price of $11.50|Q|N|N|100|N|N +EVLV|Evolv Technologies Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +EVLVW|Evolv Technologies Holdings, Inc. - Warrant|S|N|N|100|N|N +EVMT|Invesco Electric Vehicle Metals Commodity Strategy No K-1 ETF|G|N|N|100|Y|N +EVO|Evotec SE - American Depositary Shares each representing 1/2 of one ordinary share|Q|N|N|100|N|N +EVOX|Evolution Global Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +EVOXU|Evolution Global Acquisition Corp - Units|G|N|N|100|N|N +EVOXW|Evolution Global Acquisition Corp - Warrants|G|N|N|100|N|N +EVRG|Evergy, Inc. - Common Stock|Q|N|N|100|N|N +EVSD|Eaton Vance Short Duration Income ETF|G|N|N|100|Y|N +EVTV|Envirotech Vehicles, Inc. - Common stock|S|N|D|100|N|N +EVYM|Eaton Vance High Income Municipal ETF|G|N|N|100|Y|N +EWBC|East West Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +EWCZ|European Wax Center, Inc. - Class A Common Stock|Q|N|N|100|N|N +EWJV|iShares MSCI Japan Value ETF|G|N|N|100|Y|N +EWTX|Edgewise Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +EWZS|iShares MSCI Brazil Small-Cap ETF|G|N|N|100|Y|N +EXAS|Exact Sciences Corporation - Common Stock|S|N|N|100|N|N +EXC|Exelon Corporation - Common Stock|Q|N|N|100|N|N +EXE|Expand Energy Corporation - Common Stock|Q|N|N|100|N|N +EXEEL|Expand Energy Corporation - Class C Warrants|Q|N|N|100|N|N +EXEEW|Expand Energy Corporation - Class A Warrants|S|N|N|100|N|N +EXEEZ|Expand Energy Corporation - Class B Warrants|S|N|N|100|N|N +EXEL|Exelixis, Inc. - Common Stock|Q|N|N|100|N|N +EXFY|Expensify, Inc. - Class A Common Stock|Q|N|N|100|N|N +EXLS|ExlService Holdings, Inc. - Common Stock|Q|N|N|100|N|N +EXOZ|eXoZymes Inc. - Common Stock|S|N|N|100|N|N +EXPE|Expedia Group, Inc. - Common Stock|Q|N|N|100|N|N +EXPI|eXp World Holdings, Inc. - Common Stock|G|N|N|100|N|N +EXPO|Exponent, Inc. - Common Stock|Q|N|N|100|N|N +EXTR|Extreme Networks, Inc. - Common Stock|Q|N|N|100|N|N +EXUS|Nomura Focused International Core ETF|G|N|N|100|Y|N +EYE|National Vision Holdings, Inc. - Common Stock|Q|N|N|100|N|N +EYEG|AB Corporate Bond ETF|G|N|N|100|Y|N +EYPT|EyePoint, Inc. - Common Stock|G|N|N|100|N|N +EZGO|EZGO Technologies Ltd. - Ordinary Shares|S|N|N|100|N|N +EZMO|AlphaDroid Broad Markets Momentum ETF|G|N|N|100|Y|N +EZPW|EZCORP, Inc. - Class A Non-Voting Common Stock|Q|N|N|100|N|N +EZRA|Reliance Global Group, Inc. - Common Stock|S|N|D|100|N|N +EZRAW|Reliance Global Group, Inc. - Series A Warrants|S|N|N|100|N|N +EZRO|AlphaDroid Defensive Sector Rotation ETF|G|N|N|100|Y|N +FA|First Advantage Corporation - Common Stock|Q|N|N|100|N|N +FAAR|First Trust Alternative Absolute Return Strategy ETF|G|N|N|100|Y|N +FAB|First Trust Multi Cap Value AlphaDEX Fund|G|N|N|100|Y|N +FACT|FACT II Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +FACTU|FACT II Acquisition Corp. - Unit|G|N|N|100|N|N +FACTW|FACT II Acquisition Corp. - Warrant|G|N|N|100|N|N +FAD|First Trust Multi Cap Growth AlphaDEX Fund|G|N|N|100|Y|N +FALN|iShares Fallen Angels USD Bond ETF|G|N|N|100|Y|N +FAMI|Farmmi, INC. - Ordinary Shares|S|N|N|100|N|N +FANG|Diamondback Energy, Inc. - Common Stock|Q|N|N|100|N|N +FARM|Farmer Brothers Company - Common Stock|Q|N|N|100|N|N +FAST|Fastenal Company - Common Stock|Q|N|N|100|N|N +FAT|FAT Brands Inc. - Common Stock|S|N|D|100|N|N +FATBB|FAT Brands Inc. - Class B Common Stock|S|N|D|100|N|N +FATBP|FAT Brands Inc. - 8.25% Series B Cumulative Preferred Stock|S|N|D|100|N|N +FATE|Fate Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +FATN|FatPipe, Inc. - common stock|S|N|N|100|N|N +FBGL|FBS Global Limited - Ordinary Shares|S|N|D|100|N|N +FBIO|Fortress Biotech, Inc. - Common Stock|S|N|N|100|N|N +FBIOP|Fortress Biotech, Inc. - 9.375% Series A Cumulative Redeemable Perpetual Preferred Stock|S|N|N|100|N|N +FBIZ|First Business Financial Services, Inc. - Common Stock|Q|N|N|100|N|N +FBL|GraniteShares 2x Long META Daily ETF|G|N|N|100|Y|N +FBLA|FB Bancorp, Inc. - Common Stock|S|N|N|100|N|N +FBLG|FibroBiologics, Inc. - Common Stock|S|N|D|100|N|N +FBNC|First Bancorp - Common Stock|Q|N|N|100|N|N +FBOT|Fidelity Disruptive Automation ETF|G|N|N|100|Y|N +FBRX|Forte Biosciences, Inc. - Common Stock|S|N|N|100|N|N +FBYD|Falcon's Beyond Global, Inc. - Class A Common Stock|G|N|N|100|N|N +FBYDW|Falcon's Beyond Global, Inc. - Warrants|S|N|N|100|N|N +FBYY|GraniteShares YieldBOOST META ETF|G|N|N|100|Y|N +FCA|First Trust China AlphaDEX Fund|G|N|N|100|Y|N +FCAL|First Trust California Municipal High income ETF|G|N|N|100|Y|N +FCAP|First Capital, Inc. - Common Stock|S|N|N|100|N|N +FCBC|First Community Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +FCCO|First Community Corporation - Common Stock|S|N|N|100|N|N +FCEF|First Trust Income Opportunities ETF|G|N|N|100|Y|N +FCEL|FuelCell Energy, Inc. - Common Stock|G|N|N|100|N|N +FCFS|FirstCash Holdings, Inc. - Common Stock|Q|N|N|100|N|N +FCHL|Fitness Champs Holdings Limited - Ordinary Shares|S|N|D|100|N|N +FCNCA|First Citizens BancShares, Inc. - Class A Common Stock|Q|N|N|10|N|N +FCNCO|First Citizens BancShares, Inc. - 5.625% Non-Cumulative Perpetual Preferred Stock, Series C|Q|N|N|100|N|N +FCNCP|First Citizens BancShares, Inc. - Depositary Shares Each Representing a 1/40th Interest in a Share of 5.375% Non-Cumulative Perpetual Preferred Stock, Series A|Q|N|N|100|N|N +FCTE|SMI 3Fourteen Full-Cycle Trend ETF|G|N|N|100|Y|N +FCUV|Focus Universal Inc. - Common Stock|S|N|N|100|N|N +FCVT|First Trust SSI Strategic Convertible Securities ETF|G|N|N|100|Y|N +FDBC|Fidelity D & D Bancorp, Inc. - Common Stock|G|N|N|100|N|N +FDCF|Fidelity Disruptive Communications ETF|G|N|N|100|Y|N +FDFF|Fidelity Disruptive Finance ETF|G|N|N|100|Y|N +FDIF|Fidelity Disruptors ETF|G|N|N|100|Y|N +FDIG|Fidelity Crypto Industry and Digital Payments ETF|G|N|N|100|Y|N +FDIV|MarketDesk Focused U.S. Dividend ETF|G|N|N|100|Y|N +FDMT|4D Molecular Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +FDNI|First Trust Dow Jones International Internet ETF|G|N|N|100|Y|N +FDRS|Founder-Led ETF|G|N|N|100|Y|N +FDRX|Founder-Led 2X Daily ETF|G|N|N|100|Y|N +FDSB|Fifth District Bancorp, Inc. - Common Stock|S|N|N|100|N|N +FDT|First Trust Developed Markets Ex-US AlphaDEX Fund|G|N|N|100|Y|N +FDTS|First Trust Developed Markets ex-US Small Cap AlphaDEX Fund|G|N|N|100|Y|N +FDTX|Fidelity Disruptive Technology ETF|G|N|N|100|Y|N +FDUS|Fidus Investment Corporation - Closed End Fund|Q|N|N|100|N|N +FEAM|5E Advanced Materials, Inc. - Common Stock|Q|N|N|100|N|N +FEAT|YieldMax Dorsey Wright Featured 5 Income ETF|G|N|N|100|Y|N +FEBO|Fenbo Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +FEED|ENvue Medical, Inc. - Common Stock|S|N|N|100|N|N +FEIM|Frequency Electronics, Inc. - Common Stock|G|N|N|100|N|N +FELE|Franklin Electric Co., Inc. - Common Stock|Q|N|N|100|N|N +FEM|First Trust Emerging Markets AlphaDEX Fund|G|N|N|100|Y|N +FEMB|First Trust Emerging Markets Local Currency Bond ETF|G|N|N|100|Y|N +FEMS|First Trust Emerging Markets Small Cap AlphaDEX Fund|G|N|N|100|Y|N +FEMY|Femasys Inc. - Common Stock|S|N|D|100|N|N +FENC|Fennec Pharmaceuticals Inc. - Common Stock|S|N|N|100|N|N +FEP|First Trust Europe AlphaDEX Fund|G|N|N|100|Y|N +FEPI|REX FANG & Innovation Equity Premium Income ETF|G|N|N|100|Y|N +FER|Ferrovial SE - Ordinary Shares|Q|N|N|100|N|N +FERA|Fifth Era Acquisition Corp I - Class A Ordinary Shares|G|N|N|100|N|N +FERAR|Fifth Era Acquisition Corp I - Rights|G|N|N|100|N|N +FERAU|Fifth Era Acquisition Corp I - Units|G|N|N|100|N|N +FEUZ|First Trust Eurozone AlphaDEX ETF|G|N|N|100|Y|N +FEX|First Trust Large Cap Core AlphaDEX Fund|G|N|N|100|Y|N +FFAI|Faraday Future Intelligent Electric Inc. - Class A Common Stock|S|N|N|100|N|N +FFAIW|Faraday Future Intelligent Electric Inc. - Warrant|S|N|N|100|N|N +FFBC|First Financial Bancorp. - Common Stock|Q|N|N|100|N|N +FFIC|Flushing Financial Corporation - Common Stock|Q|N|N|100|N|N +FFIN|First Financial Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +FFIV|F5, Inc. - Common Stock|Q|N|N|40|N|N +FFUT|Fidelity Managed Futures ETF|G|N|N|100|Y|N +FGBI|First Guaranty Bancshares, Inc. - Common Stock|G|N|N|100|N|N +FGBIP|First Guaranty Bancshares, Inc. - 6.75% Series A Fixed-Rate Non-Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +FGI|FGI Industries Ltd. - Ordinary Shares|S|N|N|100|N|N +FGIIU|FG Imperii Acquisition Corp. - Units|G|N|N|100|N|N +FGIWW|FGI Industries Ltd. - warrant|S|N|N|100|N|N +FGL|Founder Group Limited - Class A Ordinary Shares|S|N|D|100|N|N +FGM|First Trust Germany AlphaDEX Fund|G|N|N|100|Y|N +FGMC|FG Merger II Corp. - Common stock|G|N|N|100|N|N +FGMCR|FG Merger II Corp. - Rights|G|N|N|100|N|N +FGMCU|FG Merger II Corp. - Unit|G|N|N|100|N|N +FGNX|FG Nexus Inc. - Common Stock|G|N|N|100|N|N +FGNXP|FG Nexus Inc. - 8.00% Cumulative Series A Preferred Stock|G|N|N|100|N|N +FGSI|FT Vest Growth Strength & Target Income ETF|G|N|N|100|Y|N +FHB|First Hawaiian, Inc. - Common Stock|Q|N|N|100|N|N +FHTX|Foghorn Therapeutics Inc. - Common Stock|G|N|N|100|N|N +FIBK|First Interstate BancSystem, Inc. - Common Stock|Q|N|N|100|N|N +FICS|First Trust International Developed Capital Strength ETF|G|N|N|100|Y|N +FID|First Trust S&P International Dividend Aristocrats ETF|G|N|N|100|Y|N +FIEE|FiEE, Inc - Common Stock|S|N|N|100|N|N +FIGG|Leverage Shares 2x Long FIG Daily ETF|G|N|N|100|Y|N +FIGR|Figure Technology Solutions, Inc. - Class A Common Stock|Q|N|N|100|N|N +FIGX|FIGX Capital Acquisition Corp. - Class A ordinary share|G|N|N|100|N|N +FIGXU|FIGX Capital Acquisition Corp. - Units|G|N|N|100|N|N +FIGXW|FIGX Capital Acquisition Corp. - one-half of one redeemable warrant.|G|N|N|100|N|N +FINW|FinWise Bancorp - Common Stock|G|N|N|100|N|N +FINX|Global X FinTech ETF|G|N|N|100|Y|N +FIP|FTAI Infrastructure Inc. - Common Stock|Q|N|N|100|N|N +FISI|Financial Institutions, Inc. - Common Stock|Q|N|N|100|N|N +FISV|Fiserv, Inc. - Common Stock|Q|N|N|100|N|N +FITB|Fifth Third Bancorp - Common Stock|Q|N|N|100|N|N +FITBI|Fifth Third Bancorp - Depositary Share repstg 1/1000th Ownership Interest Perp Pfd Series I|Q|N|N|100|N|N +FITBO|Fifth Third Bancorp - Depositary Shares each representing a 1/1000th ownership interest in a share of Non-Cumulative Perpetual Preferred Stock, Series K|Q|N|N|100|N|N +FITBP|Fifth Third Bancorp - Depositary Shares each representing 1/40th share of Fifth Third 6.00% Non-Cumulative Perpetual Class B Preferred Stock, Series A|Q|N|N|100|N|N +FIVE|Five Below, Inc. - Common Stock|Q|N|N|100|N|N +FIVN|Five9, Inc. - Common Stock|G|N|N|100|N|N +FIVY|YieldMax Dorsey Wright Hybrid 5 Income ETF|G|N|N|100|Y|N +FIXD|First Trust Smith Opportunistic Fixed Income ETF|G|N|N|100|Y|N +FIZZ|National Beverage Corp. - Common Stock|Q|N|N|100|N|N +FJP|First Trust Japan AlphaDEX Fund|G|N|N|100|Y|N +FKU|First Trust United Kingdom AlphaDEX Fund|G|N|N|100|Y|N +FKWL|Franklin Wireless Corp. - common stock|S|N|N|100|N|N +FLD|Fold Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +FLDB|Fidelity Low Duration Bond ETF|G|N|N|100|Y|N +FLDDW|Fold Holdings, Inc. - Warrant|S|N|N|100|N|N +FLEX|Flex Ltd. - Ordinary Shares|Q|N|N|100|N|N +FLGT|Fulgent Genetics, Inc. - Common Stock|G|N|N|100|N|N +FLL|Full House Resorts, Inc. - Common Stock|S|N|N|100|N|N +FLN|First Trust Latin America AlphaDEX Fund|G|N|N|100|Y|N +FLNC|Fluence Energy, Inc. - Class A Common Stock|Q|N|N|100|N|N +FLNT|Fluent, Inc. - Common Stock|S|N|N|100|N|N +FLUX|Flux Power Holdings, Inc. - Common Stock|S|N|N|100|N|N +FLWS|1-800-FLOWERS.COM, Inc. - Class A Common Stock|Q|N|N|100|N|N +FLX|BingEx Limited - American Depositary Shares|Q|N|N|100|N|N +FLXS|Flexsteel Industries, Inc. - Common Stock|Q|N|N|100|N|N +FLY|Firefly Aerospace Inc. - Common Stock|G|N|N|100|N|N +FLYE|Fly-E Group, Inc. - Common Stock|S|N|N|100|N|N +FLYW|Flywire Corporation - Voting Common Stock|Q|N|N|100|N|N +FMAO|Farmers & Merchants Bancorp, Inc. - Common Stock|S|N|N|100|N|N +FMB|First Trust Managed Municipal ETF|G|N|N|100|Y|N +FMBH|First Mid Bancshares, Inc. - Common Stock|G|N|N|100|N|N +FMED|Fidelity Disruptive Medicine ETF|G|N|N|100|Y|N +FMET|Fidelity Metaverse ETF|G|N|N|100|Y|N +FMFC|Kandal M Venture Limited - Class A ordinary Shares|S|N|D|100|N|N +FMHI|First Trust Municipal High Income ETF|G|N|N|100|Y|N +FMNB|Farmers National Banc Corp. - Common Stock|S|N|N|100|N|N +FMST|Foremost Clean Energy Ltd. - Common Shares|S|N|N|100|N|N +FMSTW|Foremost Clean Energy Ltd. - Warrant|S|N|N|100|N|N +FMTM|MarketDesk Focused U.S. Momentum ETF|G|N|N|100|Y|N +FMUB|Fidelity Municipal Bond Opportunities ETF|G|N|N|100|Y|N +FMUN|Fidelity Systematic Municipal Bond Index ETF|G|N|N|100|Y|N +FNGR|FingerMotion, Inc. - common stock|S|N|N|100|N|N +FNK|First Trust Mid Cap Value AlphaDEX Fund|G|N|N|100|Y|N +FNKO|Funko, Inc. - Class A Common Stock|Q|N|N|100|N|N +FNLC|First Bancorp, Inc (ME) - Common Stock|Q|N|N|100|N|N +FNWB|First Northwest Bancorp - Common Stock|G|N|N|100|N|N +FNWD|Finward Bancorp - common stock|S|N|N|100|N|N +FNX|First Trust Mid Cap Core AlphaDEX Fund|G|N|N|100|Y|N +FNY|First Trust Mid Cap Growth AlphaDEX Fund|G|N|N|100|Y|N +FOFO|Hang Feng Technology Innovation Co., Ltd. - Ordinary Shares|S|N|N|100|N|N +FOLD|Amicus Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +FONR|Fonar Corporation - Common Stock|S|N|N|100|N|N +FORA|Forian Inc. - Common Stock|S|N|N|100|N|N +FORM|FormFactor, Inc. - Common Stock|Q|N|N|100|N|N +FORR|Forrester Research, Inc. - Common Stock|Q|N|N|100|N|N +FORTY|Formula Systems (1985) Ltd. - American Depositary Shares|Q|N|N|100|N|N +FOSL|Fossil Group, Inc. - Common Stock|Q|N|N|100|N|N +FOX|Fox Corporation - Class B Common Stock|Q|N|N|100|N|N +FOXA|Fox Corporation - Class A Common Stock|Q|N|N|100|N|N +FOXF|Fox Factory Holding Corp. - Common Stock|Q|N|N|100|N|N +FOXX|Foxx Development Holdings Inc. - Common Stock|S|N|D|100|N|N +FOXXW|Foxx Development Holdings Inc. - Warrant|S|N|D|100|N|N +FPA|First Trust Asia Pacific Ex-Japan AlphaDEX Fund|G|N|N|100|Y|N +FPXE|First Trust IPOX Europe Equity Opportunities ETF|G|N|N|100|Y|N +FPXI|First Trust International Equity Opportunities ETF|G|N|N|100|Y|N +FRAF|Franklin Financial Services Corporation - Common Stock|S|N|N|100|N|N +FRBA|First Bank - Common Stock|G|N|N|100|N|N +FRD|Friedman Industries Inc. - Common Stock|Q|N|N|100|N|N +FRDD|Direxion Daily F Bear 1X ETF|G|N|N|100|Y|N +FRDU|Direxion Daily F Bull 2X ETF|G|N|N|100|Y|N +FRGT|Freight Technologies, Inc. - Ordinary Shares|S|N|N|100|N|N +FRHC|Freedom Holding Corp. - Common Stock|S|N|N|100|N|N +FRME|First Merchants Corporation - Common Stock|Q|N|N|100|N|N +FRMEP|First Merchants Corporation - Depository Shares, each representing a 1/100th interest in a share of 7.50% Non-Cumulative Perpetual Preferred Stock, A|Q|N|N|100|N|N +FRMI|Fermi Inc. - Common Stock|Q|N|N|100|N|N +FROG|JFrog Ltd. - Ordinary shares|Q|N|N|100|N|N +FRPH|FRP Holdings, Inc. - Common Stock|Q|N|N|100|N|N +FRPT|Freshpet, Inc. - Common Stock|G|N|N|100|N|N +FRSH|Freshworks Inc. - Class A Common Stock|Q|N|N|100|N|N +FRST|Primis Financial Corp. - Common Stock|G|N|N|100|N|N +FRSX|Foresight Autonomous Holdings Ltd. - American Depositary Shares|S|N|N|100|N|N +FRWD|Nomura Transformational Technologies ETF|G|N|N|100|Y|N +FSBC|Five Star Bancorp - Common Stock|Q|N|N|100|N|N +FSBW|FS Bancorp, Inc. - Common Stock|S|N|N|100|N|N +FSCS|First Trust SMID Capital Strength ETF|G|N|N|100|Y|N +FSEA|First Seacoast Bancorp, Inc. - Common Stock|S|N|N|100|N|N +FSFG|First Savings Financial Group, Inc. - Common Stock|S|N|N|100|N|N +FSGS|First Trust SMID Growth Strength ETF|G|N|N|100|Y|N +FSHP|Flag Ship Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +FSHPR|Flag Ship Acquisition Corp. - Right|G|N|N|100|N|N +FSHPU|Flag Ship Acquisition Corp. - Unit|G|N|N|100|N|N +FSLR|First Solar, Inc. - Common Stock|Q|N|N|100|N|N +FSLY|Fastly, Inc. - Class A Common Stock|Q|N|N|100|N|N +FSTR|L.B. Foster Company - Common Stock|Q|N|N|100|N|N +FSUN|FirstSun Capital Bancorp - Common Stock|Q|N|N|100|N|N +FSV|FirstService Corporation - Common Shares|Q|N|N|100|N|N +FSZ|First Trust Switzerland AlphaDEX Fund|G|N|N|100|Y|N +FTA|First Trust Large Cap Value AlphaDEX Fund|G|N|N|100|Y|N +FTAG|First Trust Indxx Global Agriculture ETF|G|N|N|100|Y|N +FTAI|FTAI Aviation Ltd. - Common Stock|Q|N|N|100|N|N +FTAIM|FTAI Aviation Ltd. - 9.500% Fixed-Rate Reset Series D Cumulative Perpetual Redeemable Preferred Shares|Q|N|N|100|N|N +FTAIN|FTAI Aviation Ltd. - 8.25% Fixed-Rate Reset Series C Cumulative Perpetual Redeemable Preferred Shares|Q|N|N|100|N|N +FTC|First Trust Large Cap Growth AlphaDEX Fund|G|N|N|100|Y|N +FTCI|FTC Solar, Inc. - Common Stock|S|N|N|100|N|N +FTCS|First Trust Capital Strength ETF|G|N|N|100|Y|N +FTDR|Frontdoor, Inc. - Common Stock|Q|N|N|100|N|N +FTDS|First Trust Dividend Strength ETF|G|N|N|100|Y|N +FTEK|Fuel Tech, Inc. - Common Stock|S|N|N|100|N|N +FTEL|Fitell Corporation - Class A Ordinary Shares|S|N|N|100|N|N +FTFT|Future FinTech Group Inc. - Common Stock|S|N|N|100|N|N +FTGC|First Trust Global Tactical Commodity Strategy Fund|G|N|N|100|Y|N +FTGS|First Trust Growth Strength ETF|G|N|N|100|Y|N +FTHI|First Trust BuyWrite Income ETF|G|N|N|100|Y|N +FTHM|Fathom Holdings Inc. - Common Stock|S|N|N|100|N|N +FTLF|FitLife Brands, Inc. - Common Stock|S|N|N|100|N|N +FTNT|Fortinet, Inc. - Common Stock|Q|N|N|100|N|N +FTQI|First Trust Nasdaq BuyWrite Income ETF|G|N|N|100|Y|N +FTRE|Fortrea Holdings Inc. - Common Stock|Q|N|N|100|N|N +FTRI|First Trust Indxx Global Natural Resources Income ETF|G|N|N|100|Y|N +FTRK|FAST TRACK GROUP - Ordinary shares|S|N|D|100|N|N +FTSL|First Trust Senior Loan Fund|G|N|N|100|Y|N +FTSM|First Trust Enhanced Short Maturity ETF|G|N|N|100|Y|N +FTXG|First Trust Nasdaq Food & Beverage ETF|G|N|N|100|Y|N +FTXH|First Trust Nasdaq Pharmaceuticals ETF|G|N|N|100|Y|N +FTXL|First Trust Nasdaq Semiconductor ETF|G|N|N|100|Y|N +FTXN|First Trust Nasdaq Oil & Gas ETF|G|N|N|100|Y|N +FTXO|First Trust Nasdaq Bank ETF|G|N|N|100|Y|N +FTXR|First Trust Nasdaq Transportation ETF|G|N|N|100|Y|N +FUFU|BitFuFu Inc. - Class A Ordinary Shares|S|N|N|100|N|N +FUFUW|BitFuFu Inc. - Warrant|S|N|N|100|N|N +FULC|Fulcrum Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +FULT|Fulton Financial Corporation - Common Stock|Q|N|N|100|N|N +FULTP|Fulton Financial Corporation - Depositary Shares Each Representing a 1/40th Interest in a Share of Fixed Rate Non-Cumulative Perpetual Preferred Stock, Series A|Q|N|N|100|N|N +FUNC|First United Corporation - Common Stock|Q|N|N|100|N|N +FUND|Sprott Focus Trust, Inc. - Closed End Fund|Q|N|N|100|N|N +FUSB|First US Bancshares, Inc. - Common Stock|S|N|N|100|N|N +FUSE|Fusemachines Inc. - Common stock|G|N|H|100|N|N +FUSEW|Fusemachines Inc. - Warrants|S|N|E|100|N|N +FUTG|Leverage Shares 2x Long FUTU Daily ETF|G|N|N|100|Y|N +FUTU|Futu Holdings Limited - American Depositary Shares|G|N|N|100|N|N +FV|First Trust Dorsey Wright Focus 5 ETF|G|N|N|100|Y|N +FVC|First Trust Dorsey Wright Dynamic Focus 5 ETF|G|N|N|100|Y|N +FVCB|FVCBankcorp, Inc. - Common Stock|S|N|N|100|N|N +FVN|Future Vision II Acquisition Corporation - Ordinary Shares|S|N|N|100|N|N +FVNNR|Future Vision II Acquisition Corporation - Right|S|N|N|100|N|N +FVNNU|Future Vision II Acquisition Corporation - Units|S|N|N|100|N|N +FWDI|Forward Industries, Inc. - Common Stock|S|N|N|100|N|N +FWONA|Liberty Media Corporation - Series A Liberty Formula One Common Stock|Q|N|N|100|N|N +FWONK|Liberty Media Corporation - Series C Liberty Formula One Common Stock|Q|N|N|100|N|N +FWRD|Forward Air Corporation - Common Stock|Q|N|N|100|N|N +FWRG|First Watch Restaurant Group, Inc. - Common Stock|Q|N|N|100|N|N +FXNC|First National Corporation - Common Stock|S|N|N|100|N|N +FYC|First Trust Small Cap Growth AlphaDEX Fund|G|N|N|100|Y|N +FYT|First Trust Small Cap Value AlphaDEX Fund|G|N|N|100|Y|N +FYX|First Trust Small Cap Core AlphaDEX Fund|G|N|N|100|Y|N +GABC|German American Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +GAIA|Gaia, Inc. - Class A Common Stock|G|N|N|100|N|N +GAIN|Gladstone Investment Corporation - Business Development Company|Q|N|N|100|N|N +GAINI|Gladstone Investment Corporation - 7.875% Notes due 2030|Q|N|N|100|N|N +GAINN|Gladstone Investment Corporation - 5.00% Notes Due 2026|Q|N|N|100|N|N +GAINZ|Gladstone Investment Corporation - 4.875% Notes due 2028|Q|N|N|100|N|N +GALT|Galectin Therapeutics Inc. - Common Stock|S|N|N|100|N|N +GAMB|Gambling.com Group Limited - Ordinary Shares|G|N|N|100|N|N +GAME|GameSquare Holdings, Inc. - Common stock|S|N|D|100|N|N +GANX|Gain Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +GARY|Mango Growth ETF|G|N|N|100|Y|N +GASS|StealthGas, Inc. - common stock|Q|N|N|100|N|N +GAUZ|Gauzy Ltd. - Ordinary Shares|G|N|N|100|N|N +GBDC|Golub Capital BDC, Inc. - Closed End Fund|Q|N|N|100|N|N +GBFH|GBank Financial Holdings Inc. - Common Stock|S|N|N|100|N|N +GBIO|Generation Bio Co. - Common stock|Q|N|N|100|N|N +GBLI|Global Indemnity Group, LLC - Class A Common Shares|Q|N|N|100|N|N +GBUG|Sprott Active Gold & Silver Miners ETF|G|N|N|100|Y|N +GCBC|Greene County Bancorp, Inc. - Common Stock|S|N|N|100|N|N +GCL|GCL Global Holdings Ltd - Ordinary Shares|Q|N|N|100|N|N +GCLWW|GCL Global Holdings Ltd - Warrants|Q|N|N|100|N|N +GCMG|GCM Grosvenor Inc. - Class A Common Stock|G|N|N|100|N|N +GCT|GigaCloud Technology Inc - Class A Ordinary Shares|G|N|N|100|N|N +GCTK|GlucoTrack, Inc. - Common Stock|S|N|N|100|N|N +GDC|GD Culture Group Limited - Common Stock|S|N|N|100|N|N +GDEN|Golden Entertainment, Inc. - Common Stock|G|N|N|100|N|N +GDEV|GDEV Inc. - Ordinary Shares|G|N|N|100|N|N +GDEVW|GDEV Inc. - Warrant|G|N|N|100|N|N +GDFN|Tema International Defense Innovation ETF|G|N|N|100|Y|N +GDHG|Golden Heaven Group Holdings Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +GDRX|GoodRx Holdings, Inc. - Class A Common Stock|Q|N|N|100|N|N +GDS|GDS Holdings Limited - American Depositary Shares|G|N|N|100|N|N +GDTC|CytoMed Therapeutics Limited - Ordinary Shares|S|N|N|100|N|N +GDYN|Grid Dynamics Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +GECC|Great Elm Capital Corp. - Closed End Fund|G|N|N|100|N|N +GECCG|Great Elm Capital Corp. - 7.75% Notes Due 2030|G|N|N|100|N|N +GECCH|Great Elm Capital Corp. - 8.125% Notes Due 2029|G|N|N|100|N|N +GECCI|Great Elm Capital Corp. - 8.50% NOTES DUE 2029|G|N|N|100|N|N +GECCO|Great Elm Capital Corp. - 5.875% Notes due 2026|G|N|N|100|N|N +GEG|Great Elm Group, Inc. - Common Stock|Q|N|N|100|N|N +GEGGL|Great Elm Group, Inc. - 7.25% Notes due 2027|G|N|N|100|N|N +GEHC|GE HealthCare Technologies Inc. - Common Stock|Q|N|N|100|N|N +GELS|Gelteq Limited - Ordinary Shares|S|N|N|100|N|N +GEME|Pacific North of South EM Equity Active ETF|G|N|N|100|Y|N +GEMG|Leverage Shares 2X Long GEMI Daily ETF|G|N|N|100|Y|N +GEMI|Gemini Space Station, Inc. - Class A Common Stock|Q|N|N|100|N|N +GEN|Gen Digital Inc. - Common Stock|Q|N|N|100|N|N +GENK|GEN Restaurant Group, Inc. - Class A Common Stock|G|N|N|100|N|N +GENVR|Gen Digital Inc. - Contingent Value Rights|G|N|N|100|N|N +GEOS|Geospace Technologies Corporation - Common Stock|Q|N|N|100|N|N +GERN|Geron Corporation - Common Stock|Q|N|N|100|N|N +GEVG|Leverage Shares 2X Long GEV Daily ETF|G|N|N|100|Y|N +GEVO|Gevo, Inc. - Common Stock|S|N|N|100|N|N +GEW|Cambria Global EW ETF|G|N|N|100|Y|N +GFAI|Guardforce AI Co., Limited - Ordinary Shares|S|N|D|100|N|N +GFAIW|Guardforce AI Co., Limited - Warrant|S|N|N|100|N|N +GFGF|Guru Favorite Stocks ETF|G|N|N|100|Y|N +GFLW|VictoryShares Free Cash Flow Growth ETF|G|N|N|100|Y|N +GFS|GlobalFoundries Inc. - Ordinary Share|Q|N|N|100|N|N +GGAL|Grupo Financiero Galicia S.A. - American Depositary Shares, Class B Shares underlying|S|N|N|100|N|N +GGLL|Direxion Daily GOOGL Bull 2X Shares|G|N|N|100|Y|N +GGLS|Direxion Daily GOOGL Bear 1X Shares|G|N|N|100|Y|N +GGR|Gogoro Inc. - Ordinary Shares|S|N|N|100|N|N +GGROW|Gogoro Inc. - Warrant|S|N|N|100|N|N +GH|Guardant Health, Inc. - Common Stock|Q|N|N|100|N|N +GHRS|GH Research PLC - Ordinary Shares|G|N|N|100|N|N +GIBO|GIBO Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +GIBOW|GIBO Holdings Limited - Warrants|S|N|N|100|N|N +GIFT|Giftify, Inc. - Common Stock|S|N|N|100|N|N +GIG|GigCapital7 Corp. - Class A Ordinary Share|G|N|N|100|N|N +GIGGU|GigCapital7 Corp. - Unit|G|N|N|100|N|N +GIGGW|GigCapital7 Corp. - Warrant|G|N|N|100|N|N +GIGM|GigaMedia Limited - Ordinary Shares|S|N|N|100|N|N +GIII|G-III Apparel Group, LTD. - Common Stock|Q|N|N|100|N|N +GILD|Gilead Sciences, Inc. - Common Stock|Q|N|N|100|N|N +GILT|Gilat Satellite Networks Ltd. - Ordinary Shares|Q|N|N|100|N|N +GIND|Goldman Sachs India Equity ETF|G|N|N|100|Y|N +GINX|SGI Enhanced Global Income ETF|G|N|N|100|Y|N +GIPR|Generation Income Properties Inc. - Common stock|S|N|D|100|N|N +GIPRW|Generation Income Properties Inc. - Warrant|S|N|D|100|N|N +GITS|Global Interactive Technologies, Inc. Common Stock - Common Stock|S|N|N|100|N|N +GIW|GigCapital8 Corp. - Class A Ordinary Shares|G|N|N|100|N|N +GIWWR|GigCapital8 Corp. - Rights|G|N|N|100|N|N +GIWWU|GigCapital8 Corp. - Units|G|N|N|100|N|N +GIXXU|GigCapital9 Corp. - Units|G|N|N|100|N|N +GKAT|Scharf Global Opportunity ETF|G|N|N|100|Y|N +GLAD|Gladstone Capital Corporation - Closed End Fund|Q|N|N|100|N|N +GLBE|Global-E Online Ltd. - ordinary shares|Q|N|N|100|N|N +GLBS|Globus Maritime Limited - Common Stock|S|N|N|100|N|N +GLCR|GlacierShares Nasdaq Iceland ETF|G|N|N|100|Y|N +GLDB|IDX Alternative FIAT ETF|G|N|N|100|Y|N +GLDD|Great Lakes Dredge & Dock Corporation - Common Stock|Q|N|N|100|N|N +GLDI|ETRACS Gold Shares Covered Call ETNs due February 2, 2033|G|N|N|100|Y|N +GLDY|Defiance Gold Enhanced Options Income ETF|G|N|N|100|Y|N +GLE|Global Engine Group Holding Limited - Class A Ordinary Shares|S|N|D|100|N|N +GLGG|Leverage Shares 2X Long GLXY Daily ETF|G|N|N|100|Y|N +GLIBA|GCI Liberty, Inc. - Series A GCI Group Common Stock|Q|N|N|100|N|N +GLIBK|GCI Liberty, Inc. - Series C GCI Group Common Stock|Q|N|N|100|N|N +GLMD|Galmed Pharmaceuticals Ltd. - Ordinary Shares|S|N|N|100|N|N +GLNG|Golar LNG Limited - Common Shares|Q|N|N|100|N|N +GLOO|Gloo Holdings, Inc. - Common Stock|Q|N|N|100|N|N +GLOW|VictoryShares WestEnd Global Equity ETF|G|N|N|100|Y|N +GLPG|Galapagos NV - American Depositary Shares|Q|N|N|100|N|N +GLPI|Gaming and Leisure Properties, Inc. - Common Stock|Q|N|N|100|N|N +GLRE|Greenlight Reinsurance, Ltd. - Class A Ordinary Shares|Q|N|N|100|N|N +GLSI|Greenwich LifeSciences, Inc. - Common stock|S|N|N|100|N|N +GLTO|Galecto, Inc. - Common Stock|S|N|N|100|N|N +GLUE|Monte Rosa Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +GLXG|Galaxy Payroll Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +GLXY|Galaxy Digital Inc. - Class A common stock|Q|N|N|100|N|N +GMAB|Genmab A/S - American Depositary Shares|Q|N|N|100|N|N +GMGI|Golden Matrix Group, Inc. - Common Stock|S|N|D|100|N|N +GMHS|Gamehaus Holdings Inc. - Class A Ordinary Shares|S|N|N|100|N|N +GMM|Global Mofy AI Limited - Class A Ordinary Shares|S|N|N|100|N|N +GNLN|Greenlane Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +GNLX|Genelux Corporation - Common Stock|S|N|N|100|N|N +GNMA|iShares GNMA Bond ETF|G|N|N|100|Y|N +GNOM|Global X Genomics & Biotechnology ETF|G|N|N|100|Y|N +GNPX|Genprex, Inc. - Common Stock|S|N|N|100|N|N +GNSS|Genasys Inc. - Common Stock|S|N|N|100|N|N +GNTA|Genenta Science S.p.A. - American Depositary Shares|S|N|N|100|N|N +GNTX|Gentex Corporation - Common Stock|Q|N|N|100|N|N +GO|Grocery Outlet Holding Corp. - Common Stock|Q|N|N|100|N|N +GOAI|Eva Live Inc. - Common Stock|S|N|N|100|N|N +GOCO|GoHealth, Inc. - Class A Common Stock|S|N|N|100|N|N +GOGO|Gogo Inc. - Common Stock|Q|N|N|100|N|N +GOOD|Gladstone Commercial Corporation - Real Estate Investment Trust|Q|N|N|100|N|N +GOODN|Gladstone Commercial Corporation - 6.625% Series E Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +GOODO|Gladstone Commercial Corporation - 6.00% Series G Cumulative Redeemable Preferred Stock, par value $0.001 per share|Q|N|N|100|N|N +GOOG|Alphabet Inc. - Class C Capital Stock|Q|N|N|100|N|N +GOOGL|Alphabet Inc. - Class A Common Stock|Q|N|N|100|N|N +GOSS|Gossamer Bio, Inc. - Common Stock|Q|N|N|100|N|N +GOU|GraniteShares 2x Long GOOGL Daily ETF|G|N|N|100|Y|N +GOVI|Invesco Equal Weight 0-30 Year Treasury ETF|G|N|N|100|Y|N +GOVX|GeoVax Labs, Inc. - Common Stock|S|N|N|100|N|N +GP|GreenPower Motor Company Inc. - Common Shares|S|N|D|100|N|N +GPAC|General Purpose Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +GPACU|General Purpose Acquisition Corp. - Units|G|N|N|100|N|N +GPACW|General Purpose Acquisition Corp. - Warrant|G|N|N|100|N|N +GPAT|GP-Act III Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +GPATU|GP-Act III Acquisition Corp. - Units|G|N|N|100|N|N +GPATW|GP-Act III Acquisition Corp. - Warrants|G|N|N|100|N|N +GPCR|Structure Therapeutics Inc. - American Depositary Shares|G|N|N|100|N|N +GPIQ|Goldman Sachs Nasdaq-100 Premium Income ETF|G|N|N|100|Y|N +GPIX|Goldman Sachs S&P 500 Premium Income ETF|G|N|N|100|Y|N +GPRE|Green Plains, Inc. - Common Stock|Q|N|N|100|N|N +GPRF|Goldman Sachs Access U.S. Preferred Stock and Hybrid Securities ETF|G|N|N|100|Y|N +GPRO|GoPro, Inc. - Class A Common Stock|Q|N|N|100|N|N +GPT|Intelligent Alpha Atlas ETF|G|N|N|100|Y|N +GQQQ|Astoria US Quality Growth Kings ETF|G|N|N|100|Y|N +GRAB|Grab Holdings Limited - Class A Ordinary Shares|Q|N|N|100|N|N +GRABW|Grab Holdings Limited - Warrant|Q|N|N|100|N|N +GRAG|Leverage Shares 2X Long GRAB Daily ETF|G|N|N|100|Y|N +GRAL|GRAIL, Inc. - Common Stock|Q|N|N|100|N|N +GRAN|Grande Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +GRCE|Grace Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +GRDX|GridAI Technologies Corp. - Common Stock|S|N|N|100|N|N +GREE|Greenidge Generation Holdings Inc. - Class A Common Stock|Q|N|N|100|N|N +GREEL|Greenidge Generation Holdings Inc. - 8.50% Senior Notes due 2026|Q|N|N|100|N|N +GRFS|Grifols, S.A. - American Depositary Shares|Q|N|N|100|N|N +GRI|GRI Bio, Inc. - Common Stock|S|N|N|100|N|N +GRID|First Trust NASDAQ Clean Edge Smart Grid Infrastructure Index Fund|G|N|N|100|Y|N +GRIN|VictoryShares International Free Cash Flow Growth ETF|G|N|N|100|Y|N +GRNQ|Greenpro Capital Corp. - Common Stock|S|N|N|100|N|N +GROW|U.S. Global Investors, Inc. - Class A Common Stock|S|N|N|100|N|N +GRPN|Groupon, Inc. - Common Stock|Q|N|N|100|N|N +GRRR|Gorilla Technology Group Inc. - Ordinary shares|S|N|N|100|N|N +GRRRW|Gorilla Technology Group Inc. - Warrant|S|N|N|100|N|N +GRVY|GRAVITY Co., Ltd. - American depositary shares, each representing one common share.|G|N|N|100|N|N +GRW|TCW Durable Growth ETF|G|N|N|100|Y|N +GRWG|GrowGeneration Corp. - Common Stock|S|N|N|100|N|N +GSAT|Globalstar, Inc. - Common Stock|Q|N|N|100|N|N +GSBC|Great Southern Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +GSGO|Goldman Sachs Growth Opportunities ETF|G|N|N|100|Y|N +GSHD|Goosehead Insurance, Inc. - Class A Common Stock|Q|N|N|100|N|N +GSHR|Gesher Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +GSHRU|Gesher Acquisition Corp. II - Units|G|N|N|100|N|N +GSHRW|Gesher Acquisition Corp. II - Warrants|G|N|N|100|N|N +GSIB|Themes Global Systemically Important Banks ETF|G|N|N|100|Y|N +GSIT|GSI Technology, Inc. - Common Stock|Q|N|N|100|N|N +GSIW|Garden Stage Limited - Ordinary Shares|S|N|D|100|N|N +GSM|Ferroglobe PLC - Ordinary Shares|S|N|N|100|N|N +GSRF|GSR IV Acquisition Corp. - Class A ordinary share|G|N|N|100|N|N +GSRFR|GSR IV Acquisition Corp. - Rights|G|N|N|100|N|N +GSRFU|GSR IV Acquisition Corp. - Units|G|N|N|100|N|N +GSUN|Golden Sun Health Technology Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +GT|The Goodyear Tire & Rubber Company - Common Stock|Q|N|N|100|N|N +GTBP|GT Biopharma, Inc. - Common Stock|S|N|D|100|N|N +GTEC|Greenland Technologies Holding Corporation - Ordinary Shares|S|N|N|100|N|N +GTEN|Gores Holdings X, Inc. - Class A ordinary shares|G|N|N|100|N|N +GTENU|Gores Holdings X, Inc. - Units|G|N|N|100|N|N +GTENW|Gores Holdings X, Inc. - Warrants|G|N|N|100|N|N +GTERA|Globa Terra Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +GTERR|Globa Terra Acquisition Corporation - Rights|G|N|N|100|N|N +GTERU|Globa Terra Acquisition Corporation - Units|G|N|N|100|N|N +GTERW|Globa Terra Acquisition Corporation - Warrants|G|N|N|100|N|N +GTIM|Good Times Restaurants Inc. - Common Stock|S|N|N|100|N|N +GTLB|GitLab Inc. - Class A Common Stock|Q|N|N|100|N|N +GTM|ZoomInfo Technologies Inc. - Common Stock|Q|N|N|100|N|N +GTOP|Goldman Sachs Technology Opportunities ETF|G|N|N|100|Y|N +GTPE|Goldman Sachs MSCI World Private Equity Return Tracker ETF|G|N|N|100|Y|N +GTR|WisdomTree Target Range Fund|G|N|N|100|Y|N +GTX|Garrett Motion Inc. - Common Stock|Q|N|N|100|N|N +GURE|Gulf Resources, Inc. - Common Stock|S|N|N|100|N|N +GUSE|Goldman Sachs Enhanced U.S. Equity ETF|G|N|N|100|Y|N +GUTS|Fractyl Health, Inc. - Common Stock|G|N|N|100|N|N +GV|Visionary Holdings Inc. - Common Shares|S|N|E|100|N|N +GVH|Globavend Holdings Limited - Ord Shares|S|N|N|100|N|N +GVLE|Goldman Sachs Value Opportunities ETF|G|N|N|100|Y|N +GWAV|Greenwave Technology Solutions, Inc. - Common Stock|S|N|E|100|N|N +GWRS|Global Water Resources, Inc. - common stock|G|N|N|100|N|N +GXAI|Gaxos.ai Inc. - Common Stock|S|N|N|100|N|N +GXDW|Global X Dorsey Wright Thematic ETF|G|N|N|100|Y|N +GYRE|Gyre Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +GYRO|Gyrodyne , LLC - Common Stock|S|N|N|100|N|N +HAFC|Hanmi Financial Corporation - Common Stock|Q|N|N|100|N|N +HAIN|The Hain Celestial Group, Inc. - Common Stock|Q|N|N|100|N|N +HALO|Halozyme Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +HAO|Haoxi Health Technology Limited - Class A Ord Share|S|N|N|100|N|N +HAS|Hasbro, Inc. - Common Stock|Q|N|N|100|N|N +HAVA|Harvard Ave Acquisition Corporation - Class A Ordinary Share|G|N|N|100|N|N +HAVAR|Harvard Ave Acquisition Corporation - Rights that convert on a 1/10th of 1 basis to Class A ordinary Shares|G|N|N|100|N|N +HAVAU|Harvard Ave Acquisition Corporation - Unit|G|N|N|100|N|N +HBAN|Huntington Bancshares Incorporated - Common Stock|Q|N|N|100|N|N +HBANL|Huntington Bancshares Incorporated - Depositary Shares, Each Representing a 1/40th Interest in a Share of 6.875% Series J Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +HBANM|Huntington Bancshares Incorporated - Depositary Shares each representing a 1/1000th interest in a share of Huntington Series I Preferred Stock|Q|N|N|100|N|N +HBANP|Huntington Bancshares Incorporated - Depositary Shares 4.500% Series H Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +HBCP|Home Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +HBDC|Hilton BDC Corporate Bond ETF|G|N|N|100|Y|N +HBIO|Harvard Bioscience, Inc. - Common Stock|S|N|D|100|N|N +HBNB|Hotel101 Global Holdings Corp. - Class A Ordinary Shares|S|N|N|100|N|N +HBNC|Horizon Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +HBR|Canary HBAR ETF|G|N|N|100|Y|N +HBT|HBT Financial, Inc. - Common Stock|Q|N|N|100|N|N +HCAC|Hall Chadwick Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +HCACR|Hall Chadwick Acquisition Corp. - Rights|G|N|N|100|N|N +HCACU|Hall Chadwick Acquisition Corp. - Unit|G|N|N|100|N|N +HCAI|Huachen AI Parking Management Technology Holding Co., Ltd. - Class A Ordinary Shares|S|N|D|100|N|N +HCAT|Health Catalyst, Inc - Common stock|Q|N|N|100|N|N +HCHL|Happy City Holdings Limited - Class A Ordinary shares|S|N|N|100|N|N +HCKT|The Hackett Group, Inc. - Common Stock|Q|N|N|100|N|N +HCM|HUTCHMED (China) Limited - American Depositary Shares|Q|N|N|100|N|N +HCMA|HCM III Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +HCMAU|HCM III Acquisition Corp. - Units|G|N|N|100|N|N +HCMAW|HCM III Acquisition Corp. - Warrants|G|N|N|100|N|N +HCOW|Amplify COWS Covered Call ETF|G|N|N|100|Y|N +HCSG|Healthcare Services Group, Inc. - Common Stock|Q|N|N|100|N|N +HCTI|Healthcare Triangle, Inc. - Common Stock|S|N|N|100|N|N +HCWB|HCW Biologics Inc. - Common Stock|S|N|N|100|N|N +HDL|SUPER HI INTERNATIONAL HOLDING LTD. - American Depositary Shares|G|N|N|100|N|N +HDSN|Hudson Technologies, Inc. - Common Stock|S|N|N|100|N|N +HEAL|Global X HealthTech ETF|G|N|N|100|Y|N +HECO|SPDR Galaxy Hedged Digital Asset Ecosystem ETF|G|N|N|100|Y|N +HEJD|VictoryShares Hedged Equity Income ETF|G|N|N|100|Y|N +HELE|Helen of Troy Limited - Common Stock|Q|N|N|100|N|N +HELP|Cybin Inc. - Common Stock|G|N|N|100|N|N +HEPS|D-Market Electronic Services & Trading - American Depositary Shares|Q|N|N|100|N|N +HEQQ|JPMorgan Nasdaq Hedged Equity Laddered Overlay ETF|G|N|N|100|Y|N +HERD|Pacer Cash Cows Fund of Funds ETF|G|N|N|100|Y|N +HERE|Here Group Limited - American Depositary Shares|G|N|N|100|N|N +HERO|Global X Video Games & Esports ETF|G|N|N|100|Y|N +HERZ|Herzfeld Credit Income Fund, Inc. - Closed End Fund|S|N|N|100|N|N +HFBL|Home Federal Bancorp, Inc. of Louisiana - Common Stock|S|N|N|100|N|N +HFFG|HF Foods Group Inc. - Common Stock|S|N|N|100|N|N +HFSP|TradersAI Large Cap Equity & Cash ETF|G|N|N|100|Y|N +HFWA|Heritage Financial Corporation - Common Stock|Q|N|N|100|N|N +HGBL|Heritage Global Inc. - Common Stock|S|N|N|100|N|N +HHS|Harte Hanks, Inc. - Common Stock|G|N|N|100|N|N +HIDE|Alpha Architect High Inflation and Deflation ETF|G|N|N|100|Y|N +HIFS|Hingham Institution for Savings - Common Stock|G|N|N|40|N|N +HIHO|Highway Holdings Limited - Common Stock|S|N|N|100|N|N +HIMX|Himax Technologies, Inc. - American depositary shares, each of which represents two ordinary shares.|Q|N|N|100|N|N +HIMZ|Defiance Daily Target 2X Long HIMS ETF|G|N|N|100|Y|N +HIND|Vyome Holdings, Inc. - Common Stock|S|N|N|100|N|N +HISF|First Trust High Income Strategic Focus ETF|G|N|N|100|Y|N +HIT|Health In Tech, Inc. - Class A Common Stock|S|N|N|100|N|N +HITI|High Tide Inc. - Common Shares|S|N|N|100|N|N +HIVE|HIVE Digital Technologies Ltd - Common Shares|S|N|N|100|N|N +HKIT|Hitek Global Inc. - Class A Ordinary Share|S|N|N|100|N|N +HKPD|Cellyan Biotechnology Co., Ltd - Class A Ordinary Shares|S|N|D|100|N|N +HLAL|Wahed FTSE USA Shariah ETF|G|N|N|100|Y|N +HLIT|Harmonic Inc. - Common Stock|Q|N|N|100|N|N +HLMN|Hillman Solutions Corp. - Common Stock|G|N|N|100|N|N +HLNE|Hamilton Lane Incorporated - Class A Common Stock|Q|N|N|100|N|N +HLP|Hongli Group Inc. - Ordinary Shares|S|N|N|100|N|N +HLXC|Helix Acquisition Corp. III - Class A Ordinary Shares|G|N|N|100|N|N +HMR|Heidmar Maritime Holdings Corp. - Common Stock|S|N|N|100|N|N +HMYY|GraniteShares YieldBoost HIMS ETF|G|N|N|100|Y|N +HNDL|Strategy Shares Nasdaq 7HANDL Index ETF|G|N|N|100|Y|N +HNNA|Hennessy Advisors, Inc. - Common Stock|G|N|N|100|N|N +HNNAZ|Hennessy Advisors, Inc. - 4.875% Notes due 2026|G|N|N|100|N|N +HNRG|Hallador Energy Company - Common Stock|S|N|N|100|N|N +HNST|The Honest Company, Inc. - Common Stock|Q|N|N|100|N|N +HNVR|Hanover Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +HODU|Direxion Daily HOOD Bull 2X ETF|G|N|N|100|Y|N +HOFT|Hooker Furnishings Corporation - Common Stock|Q|N|N|100|N|N +HOLO|MicroCloud Hologram Inc. - Ordinary Shares|S|N|N|100|N|N +HOLOW|MicroCloud Hologram Inc. - Warrant|S|N|N|100|N|N +HOLX|Hologic, Inc. - Common Stock|Q|N|N|100|N|N +HON|Honeywell International Inc. - Common Stock|Q|N|N|100|N|N +HOOD|Robinhood Markets, Inc. - Class A Common Stock|Q|N|N|100|N|N +HOOG|Leverage Shares 2X Long HOOD Daily ETF|G|N|N|100|Y|N +HOOX|Defiance Daily Target 2X Long HOOD ETF|G|N|N|100|Y|N +HOPE|Hope Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +HOTH|Hoth Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +HOUR|Hour Loop, Inc. - common stock|S|N|N|100|N|N +HOVNP|Hovnanian Enterprises Inc - Depositary Share representing 1/1000th of 7.625% Series A Preferred Stock|G|N|N|100|N|N +HOVR|New Horizon Aircraft Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +HOVRW|New Horizon Aircraft Ltd. - Warrant|S|N|N|100|N|N +HOWL|Werewolf Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +HOYY|GraniteShares YieldBOOST HOOD ETF|G|N|N|100|Y|N +HPAI|Helport AI Limited - Ordinary Shares|S|N|N|100|N|N +HPAIW|Helport AI Limited - Warrants|S|N|N|100|N|N +HPK|HighPeak Energy, Inc. - Common Stock|G|N|N|100|N|N +HQGO|Hartford US Quality Growth ETF|G|N|N|100|Y|N +HQI|HireQuest, Inc. - Common Stock|S|N|N|100|N|N +HQY|HealthEquity, Inc. - Common Stock|Q|N|N|100|N|N +HRMY|Harmony Biosciences Holdings, Inc. - Common Stock|G|N|N|100|N|N +HROW|Harrow, Inc. - Common Stock|G|N|N|100|N|N +HRTS|Tema Heart & Health ETF|G|N|N|100|Y|N +HRTX|Heron Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +HRZN|Horizon Technology Finance Corporation - Common Stock|Q|N|N|100|N|N +HSAI|Hesai Group - American Depositary Share, each ADS represents one Class B ordinary share|Q|N|N|100|N|N +HSCS|HeartSciences Inc. - Common Stock|S|N|N|100|N|N +HSCSW|HeartSciences Inc. - Warrant|S|N|N|100|N|N +HSDT|Solana Company - Class A Common Stock|S|N|N|100|N|N +HSIC|Henry Schein, Inc. - Common Stock|Q|N|N|100|N|N +HSPT|Horizon Space Acquisition II Corp. - Ordinary share|G|N|N|100|N|N +HSPTR|Horizon Space Acquisition II Corp. - Right|G|N|N|100|N|N +HSPTU|Horizon Space Acquisition II Corp. - Units|G|N|N|100|N|N +HST|Host Hotels & Resorts, Inc. - Common Stock|Q|N|N|100|N|N +HSTM|HealthStream, Inc. - Common Stock|Q|N|N|100|N|N +HTBK|Heritage Commerce Corp - Common Stock|Q|N|N|100|N|N +HTCO|High-Trend International Group - Class A Ordinary Shares|S|N|N|100|N|N +HTCR|Heartcore Enterprises, Inc. - Common Stock|S|N|D|100|N|N +HTFL|Heartflow, Inc. - Common Stock|Q|N|N|100|N|N +HTHT|H World Group Limited - American Depositary Shares|Q|N|N|100|N|N +HTLD|Heartland Express, Inc. - Common Stock|Q|N|N|100|N|N +HTLM|HomesToLife Ltd - Ordinary Shares|S|N|N|100|N|N +HTO|H2O America - Common Stock|Q|N|N|100|N|N +HTOO|Fusion Fuel Green PLC - Ordinary Shares|S|N|N|100|N|N +HTZ|Hertz Global Holdings, Inc - Common Stock|Q|N|N|100|N|N +HTZWW|Hertz Global Holdings, Inc - Warrant|Q|N|N|100|N|N +HUBC|Hub Cyber Security Ltd. - Ordinary Shares|S|N|D|100|N|N +HUBCW|Hub Cyber Security Ltd. - Warrant expiring 2/27/28|S|N|D|100|N|N +HUBCZ|Hub Cyber Security Ltd. - Warrant|S|N|D|100|N|N +HUBG|Hub Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +HUDI|Huadi International Group Co., Ltd. - Ordinary Shares|S|N|N|100|N|N +HUHU|HUHUTECH International Group Inc. - Ordinary Shares|S|N|N|100|N|N +HUIZ|Huize Holding Limited - American Depositary Shares|G|N|N|100|N|N +HUMA|Humacyte, Inc. - Common Stock|Q|N|N|100|N|N +HUMAW|Humacyte, Inc. - Warrant|Q|N|N|100|N|N +HURA|TuHURA Biosciences, Inc. - Common Stock|S|N|N|100|N|N +HURC|Hurco Companies, Inc. - Common Stock|Q|N|N|100|N|N +HURN|Huron Consulting Group Inc. - Common Stock|Q|N|N|100|N|N +HUT|Hut 8 Corp. - Common Stock|Q|N|N|100|N|N +HUTG|Leverage Shares 2X Long HUT Daily ETF|G|N|N|100|Y|N +HVII|Hennessy Capital Investment Corp. VII - Ordinary Shares|G|N|N|100|N|N +HVIIR|Hennessy Capital Investment Corp. VII - Rights|G|N|N|100|N|N +HVIIU|Hennessy Capital Investment Corp. VII - Unit|G|N|N|100|N|N +HVMC|Highview Merger Corp. - Class A Ordinary Share|G|N|N|100|N|N +HVMCU|Highview Merger Corp. - Units|G|N|N|100|N|N +HVMCW|Highview Merger Corp. - Warrants|G|N|N|100|N|N +HWAY|Themes US Infrastructure ETF|G|N|N|100|Y|N +HWBK|Hawthorn Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +HWC|Hancock Whitney Corporation - Common Stock|Q|N|N|100|N|N +HWCPZ|Hancock Whitney Corporation - 6.25% Subordinated Notes due 2060|Q|N|N|100|N|N +HWH|HWH International Inc. - Common Stock|S|N|N|100|N|N +HWKN|Hawkins, Inc. - Common Stock|Q|N|N|100|N|N +HWSM|Hotchkis & Wiley SMID Cap Diversified Value Fund|G|N|N|100|Y|N +HXHX|Haoxin Holdings Limited - Class A Ordinary Shares|S|N|D|100|N|N +HYBI|NEOS Enhanced Income Credit Select ETF|G|N|N|100|Y|N +HYDR|Global X Hydrogen ETF|G|N|N|100|Y|N +HYFM|Hydrofarm Holdings Group, Inc. - Common Stock|S|N|N|100|N|N +HYFT|MindWalk Holdings Corp. - Common Stock|S|N|N|100|N|N +HYLS|First Trust Tactical High Yield ETF|G|N|N|100|Y|N +HYMC|Hycroft Mining Holding Corporation - Class A Common Stock|S|N|N|100|N|N +HYNE|Hoyne Bancorp, Inc. - Common Stock|S|N|N|100|N|N +HYP|Golden Eagle Dynamic Hypergrowth ETF|G|N|N|100|Y|N +HYPD|Hyperion DeFi, Inc. - Common Stock|S|N|N|100|N|N +HYPR|Hyperfine, Inc. - Class A Common Stock|G|N|N|100|N|N +HYXF|iShares ESG Advanced High Yield Corporate Bond ETF|G|N|N|100|Y|N +HYZD|WisdomTree Interest Rate Hedged High Yield Bond Fund|G|N|N|100|Y|N +IAC|IAC Inc. - Common Stock|Q|N|N|100|N|N +IALT|iShares Systematic Alternatives Active ETF|G|N|N|100|Y|N +IART|Integra LifeSciences Holdings Corporation - Common Stock|Q|N|N|100|N|N +IBAC|IB Acquisition Corp. - Common Stock|G|N|N|100|N|N +IBACR|IB Acquisition Corp. - Right|G|N|N|100|N|N +IBAT|iShares Energy Storage & Materials ETF|G|N|N|100|Y|N +IBB|iShares Biotechnology ETF|G|N|N|100|Y|N +IBBQ|Invesco Nasdaq Biotechnology ETF|G|N|N|100|Y|N +IBCP|Independent Bank Corporation - Common Stock|Q|N|N|100|N|N +IBEX|IBEX Limited - Common Share|G|N|N|100|N|N +IBG|Innovation Beverage Group Limited - Ordinary Shares|S|N|D|100|N|N +IBGA|iShares iBonds Dec 2044 Term Treasury ETF|G|N|N|100|Y|N +IBGB|iShares iBonds Dec 2045 Term Treasury ETF|G|N|N|100|Y|N +IBGK|iShares iBonds Dec 2054 Term Treasury ETF|G|N|N|100|Y|N +IBGL|iShares iBonds Dec 2055 Term Treasury ETF|G|N|N|100|Y|N +IBIO|iBio, Inc. - Common Stock|S|N|N|100|N|N +IBIT|iShares Bitcoin Trust ETF|G|N|N|100|Y|N +IBKR|Interactive Brokers Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +IBOC|International Bancshares Corporation - Common Stock|Q|N|N|100|N|N +IBOT|VanEck Robotics ETF|G|N|N|100|Y|N +IBRX|ImmunityBio, Inc. - Common Stock|Q|N|N|100|N|N +IBTG|iShares iBonds Dec 2026 Term Treasury ETF|G|N|N|100|Y|N +IBTH|iShares iBonds Dec 2027 Term Treasury ETF|G|N|N|100|Y|N +IBTI|iShares iBonds Dec 2028 Term Treasury ETF|G|N|N|100|Y|N +IBTJ|iShares iBonds Dec 2029 Term Treasury ETF|G|N|N|100|Y|N +IBTK|iShares iBonds Dec 2030 Term Treasury ETF|G|N|N|100|Y|N +IBTL|iShares iBonds Dec 2031 Term Treasury ETF|G|N|N|100|Y|N +IBTM|iShares iBonds Dec 2032 Term Treasury ETF|G|N|N|100|Y|N +IBTO|iShares iBonds Dec 2033 Term Treasury ETF|G|N|N|100|Y|N +IBTP|iShares iBonds Dec 2034 Term Treasury ETF|G|N|N|100|Y|N +IBTQ|iShares iBonds Dec 2035 Term Treasury ETF|G|N|N|100|Y|N +ICCC|ImmuCell Corporation - Common Stock|S|N|N|100|N|N +ICCM|IceCure Medical Ltd. - Ordinary Shares|S|N|D|100|N|N +ICFI|ICF International, Inc. - Common Stock|Q|N|N|100|N|N +ICG|Intchains Group Limited - American Depositary Shares|S|N|N|100|N|N +ICHR|Ichor Holdings - Ordinary Shares|Q|N|N|100|N|N +ICLN|iShares Global Clean Energy ETF|G|N|N|100|Y|N +ICLR|ICON plc - Ordinary Shares|Q|N|N|100|N|N +ICMB|Investcorp Credit Management BDC, Inc. - Common Stock|Q|N|N|100|N|N +ICON|Icon Energy Corp. - Common stock|S|N|N|100|N|N +ICOP|iShares Copper and Metals Mining ETF|G|N|N|100|Y|N +ICU|SeaStar Medical Holding Corporation - Common Stock|S|N|N|100|N|N +ICUCW|SeaStar Medical Holding Corporation - Warrant|S|N|N|100|N|N +ICUI|ICU Medical, Inc. - Common Stock|Q|N|N|100|N|N +IDAI|T Stamp Inc. - Class A Common Stock|S|N|N|100|N|N +IDCC|InterDigital, Inc. - Common Stock|Q|N|N|40|N|N +IDEF|iShares Defense Industrials Active ETF|G|N|N|100|Y|N +IDN|Intellicheck, Inc. - Common Stock|G|N|N|100|N|N +IDXX|IDEXX Laboratories, Inc. - Common Stock|Q|N|N|40|N|N +IDYA|IDEAYA Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +IEAGU|Infinite Eagle Acquisition Corp. - Unit|G|N|N|100|N|N +IEF|iShares 7-10 Year Treasury Bond ETF|G|N|N|100|Y|N +IEI|iShares 3-7 Year Treasury Bond ETF|G|N|N|100|Y|N +IEP|Icahn Enterprises L.P. - Depositary Units representing Limited Partner Interests|Q|N|N|100|N|N +IESC|IES Holdings, Inc. - Common Stock|G|N|N|40|N|N +IEUS|iShares MSCI Europe Small-Cap ETF|G|N|N|100|Y|N +IFBD|Infobird Co., Ltd - Ordinary Shares|S|N|N|100|N|N +IFGL|iShares International Developed Real Estate ETF|G|N|N|100|Y|N +IFLO|VictoryShares International Free Cash Flow ETF|G|N|N|100|Y|N +IFRX|InflaRx N.V. - Common Stock|Q|N|N|100|N|N +IFV|First Trust Dorsey Wright International Focus 5 ETF|G|N|N|100|Y|N +IGAC|Invest Green Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +IGACR|Invest Green Acquisition Corporation - Rights|G|N|N|100|N|N +IGACU|Invest Green Acquisition Corporation - Units|G|N|N|100|N|N +IGF|iShares Global Infrastructure ETF|G|N|N|100|Y|N +IGIB|iShares 5-10 Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +IGIC|International General Insurance Holdings Ltd. - Ordinary Shares|S|N|N|100|N|N +IGOV|iShares International Treasury Bond ETF|G|N|N|100|Y|N +IGSB|iShares 1-5 Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +IHRT|iHeartMedia, Inc. - Class A Common Stock|Q|N|N|100|N|N +IHYF|Invesco High Yield Bond Factor ETF|G|N|N|100|Y|N +III|Information Services Group, Inc. - Common Stock|G|N|N|100|N|N +IIIV|i3 Verticals, Inc. - Common Stock|Q|N|N|100|N|N +IINN|Inspira Technologies Oxy B.H.N. Ltd. - Ordinary Shares|S|N|N|100|N|N +IINNW|Inspira Technologies Oxy B.H.N. Ltd. - Warrant|S|N|N|100|N|N +IJT|iShares S&P SmallCap 600 Growth ETF|G|N|N|100|Y|N +IKT|Inhibikase Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +ILAG|Intelligent Living Application Group Inc. - Ordinary Shares|S|N|N|100|N|N +ILIT|iShares Lithium Miners and Producers ETF|G|N|N|100|Y|N +ILMN|Illumina, Inc. - Common Stock|Q|N|N|100|N|N +ILPT|Industrial Logistics Properties Trust - Common Shares of Beneficial Interest|Q|N|N|100|N|N +IMA|ImageneBio, Inc. - Common Stock|S|N|N|100|N|N +IMCC|IM Cannabis Corp. - Common Shares|S|N|N|100|N|N +IMCR|Immunocore Holdings plc - American Depositary Shares|Q|N|N|100|N|N +IMCV|iShares Morningstar Mid-Cap Value ETF|G|N|N|100|Y|N +IMDX|Insight Molecular Diagnostics Inc. - Common Stock|S|N|N|100|N|N +IMG|CIMG Inc. - Common Stock|S|N|D|100|N|N +IMKTA|Ingles Markets, Incorporated - Class A Common Stock|Q|N|N|100|N|N +IMMP|Immutep Limited - American Depositary Shares|G|N|N|100|N|N +IMMR|Immersion Corporation - Common Stock|Q|N|E|100|N|N +IMMX|Immix Biopharma, Inc. - Common Stock|S|N|N|100|N|N +IMNM|Immunome, Inc. - Common Stock|S|N|N|100|N|N +IMNN|Imunon, Inc. - Common Stock|S|N|N|100|N|N +IMOM|Alpha Architect International Quantitative Momentum ETF|G|N|N|100|Y|N +IMOS|ChipMOS TECHNOLOGIES INC. - American Depositary Shares|Q|N|N|100|N|N +IMPP|Imperial Petroleum Inc. - Common Shares|S|N|N|100|N|N +IMPPP|Imperial Petroleum Inc. - 8.75% Series A Cumulative Redeemable Perpetual Preferred Shares|S|N|N|100|N|N +IMRN|Immuron Limited - American Depositary Shares|S|N|N|100|N|N +IMRX|Immuneering Corporation - Class A Common Stock|G|N|N|100|N|N +IMSR|Terrestrial Energy Inc. - Common Stock|Q|N|N|100|N|N +IMSRW|Terrestrial Energy Inc. - Warrant|Q|N|N|100|N|N +IMTE|Integrated Media Technology Limited - Ordinary Shares|S|N|H|100|N|N +IMTX|Immatics N.V. - Ordinary Shares|S|N|N|100|N|N +IMUX|Immunic, Inc. - Common Stock|S|N|D|100|N|N +IMVT|Immunovant, Inc. - Common Stock|Q|N|N|100|N|N +IMXI|International Money Express, Inc. - Common Stock|S|N|N|100|N|N +INAB|IN8bio, Inc. - Common Stock|S|N|N|100|N|N +INAC|Indigo Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +INACR|Indigo Acquisition Corp. - Right|G|N|N|100|N|N +INACU|Indigo Acquisition Corp. - Unit|G|N|N|100|N|N +INBK|First Internet Bancorp - Common Stock|Q|N|N|100|N|N +INBKZ|First Internet Bancorp - Fixed-to-Floating Rate Subordinated Notes Due 2029|Q|N|N|100|N|N +INBS|Intelligent Bio Solutions Inc. - Common Stock|S|N|N|100|N|N +INBX|Inhibrx Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +INCR|Intercure Ltd. - ordinary shares|G|N|N|100|N|N +INCY|Incyte Corporation - Common Stock|Q|N|N|100|N|N +IND|Xtrackers Nifty 500 India ETF|G|N|N|100|Y|N +INDB|Independent Bank Corp. - Common Stock|Q|N|N|100|N|N +INDH|WisdomTree India Hedged Equity Fund|G|N|N|100|Y|N +INDI|indie Semiconductor, Inc. - Class A Common Stock|S|N|N|100|N|N +INDP|Indaptus Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +INDV|Indivior Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +INDY|iShares India 50 ETF|G|N|N|100|Y|N +INEO|INNEOVA Holdings Limited - Class A Ordinary Shares|S|N|D|100|N|N +INGN|Inogen, Inc - Common Stock|Q|N|N|100|N|N +INHD|Inno Holdings Inc. - Common Stock|S|N|N|100|N|N +INKT|MiNK Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +INLF|INLIF LIMITED - Class A Ordinary shares|S|N|D|100|N|N +INM|InMed Pharmaceuticals Inc. - Common Shares|S|N|N|100|N|N +INMB|INmune Bio Inc. - Common stock|S|N|N|100|N|N +INMD|InMode Ltd. - Ordinary Shares|Q|N|N|100|N|N +INNV|InnovAge Holding Corp. - Common Stock|Q|N|N|100|N|N +INO|Inovio Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +INOD|Innodata Inc. - Common Stock|G|N|N|100|N|N +INRO|iShares U.S. Industry Rotation Active ETF|G|N|N|100|Y|N +INSE|Inspired Entertainment, Inc. - Common Stock|S|N|N|100|N|N +INSG|Inseego Corp. - Common Stock|Q|N|N|100|N|N +INSM|Insmed Incorporated - Common Stock|Q|N|N|100|N|N +INTA|Intapp, Inc. - Common Stock|Q|N|N|100|N|N +INTC|Intel Corporation - Common Stock|Q|N|N|100|N|N +INTG|The Intergroup Corporation - Common Stock|S|N|N|100|N|N +INTJ|Intelligent Group Limited - Class A Ordinary Shares|S|N|D|100|N|N +INTR|Inter & Co. Inc. - Class A Common Shares|Q|N|N|100|N|N +INTS|Intensity Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +INTU|Intuit Inc. - Common Stock|Q|N|N|40|N|N +INTW|GraniteShares 2x Long INTC Daily ETF|G|N|N|100|Y|N +INTZ|Intrusion Inc. - Common Stock|S|N|N|100|N|N +INV|Innventure, Inc. - Common Stock|G|N|N|100|N|N +INVA|Innoviva, Inc. - Common Stock|Q|N|N|100|N|N +INVE|Identiv, Inc. - Common Stock|S|N|N|100|N|N +INVZ|Innoviz Technologies Ltd. - Ordinary shares|S|N|N|100|N|N +INVZW|Innoviz Technologies Ltd. - Warrant|S|N|N|100|N|N +IOBT|IO Biotech, Inc. - Common Stock|Q|N|D|100|N|N +IONL|GraniteShares 2x Long IONQ Daily ETF|G|N|N|100|Y|N +IONR|ioneer Ltd - American Depositary Shares|S|N|N|100|N|N +IONS|Ionis Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +IONX|Defiance Daily Target 2X Long IONQ ETF|G|N|N|100|Y|N +IONZ|Defiance Daily Target 2x Short IONQ ETF|G|N|N|100|Y|N +IOSP|Innospec Inc. - Common Stock|Q|N|N|100|N|N +IOTR|iOThree Limited - Ordinary Shares|S|N|N|100|N|N +IOVA|Iovance Biotherapeutics, Inc. - Common Stock|G|N|N|100|N|N +IOYY|GraniteShares YieldBOOST IONQ ETF|G|N|N|100|Y|N +IPAR|Interparfums, Inc. - Common Stock|Q|N|N|100|N|N +IPCX|Inflection Point Acquisition Corp. III - Class A ordinary shares|G|N|N|100|N|N +IPCXR|Inflection Point Acquisition Corp. III - Rights|G|N|N|100|N|N +IPCXU|Inflection Point Acquisition Corp. III - Units|G|N|N|100|N|N +IPDN|Professional Diversity Network, Inc. - Common Stock|S|N|N|100|N|N +IPEX|Inflection Point Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +IPEXR|Inflection Point Acquisition Corp. - Right|G|N|N|100|N|N +IPEXU|Inflection Point Acquisition Corp. - Unit|G|N|N|100|N|N +IPGP|IPG Photonics Corporation - Common Stock|Q|N|N|100|N|N +IPHA|Innate Pharma S.A. - American Depositary Shares|Q|N|N|100|N|N +IPKW|Invesco International BuyBack Achievers ETF|G|N|N|100|Y|N +IPM|Intelligent Protection Management Corp. - Common Stock|S|N|N|100|N|N +IPOD|Dune Acquisition Corporation II - Class A ordinary shares|G|N|N|100|N|N +IPODU|Dune Acquisition Corporation II - Units|G|N|N|100|N|N +IPODW|Dune Acquisition Corporation II - Warrants|G|N|N|100|N|N +IPSC|Century Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +IPST|Heritage Distilling Holding Company, Inc. - Common Stock|S|N|N|100|N|N +IPW|iPower Inc. - Common Stock|S|N|N|100|N|N +IPWR|Ideal Power Inc. - Common Stock|S|N|N|100|N|N +IPX|IperionX Limited - American Depositary Share|S|N|N|100|N|N +IQ|iQIYI, Inc. - American Depositary Shares|Q|N|N|100|N|N +IQQQ|ProShares Nasdaq-100 High Income ETF|G|N|N|100|Y|N +IQST|iQSTEL Inc. - Common Stock|S|N|N|100|N|N +IRD|Opus Genetics, Inc. - Common Stock|S|N|N|100|N|N +IRDM|Iridium Communications Inc - Common Stock|Q|N|N|100|N|N +IREG|Leverage Shares 2X Long IREN Daily ETF|G|N|N|100|Y|N +IREN|IREN Limited - Ordinary Shares|Q|N|N|100|N|N +IRHOU|Iron Horse Acquisitions II Corp. - Units|G|N|N|100|N|N +IRIX|IRIDEX Corporation - Common Stock|S|N|N|100|N|N +IRMD|iRadimed Corporation - Common Stock|G|N|N|100|N|N +IRON|Disc Medicine, Inc. - Common Stock|G|N|N|100|N|N +IROQ|IF Bancorp, Inc. - Common Stock|S|N|N|100|N|N +IRTC|iRhythm Holdings, Inc. - Common Stock|Q|N|N|100|N|N +IRWD|Ironwood Pharmaceuticals, Inc. - Class A Common Stock|Q|N|N|100|N|N +ISBA|Isabella Bank Corporation - Common stock|S|N|N|100|N|N +ISHG|iShares 1-3 Year International Treasury Bond ETF|G|N|N|100|Y|N +ISHP|First Trust S-Network E-Commerce ETF|G|N|N|100|Y|N +ISPC|iSpecimen Inc. - Common Stock|S|N|D|100|N|N +ISPO|Inspirato Incorporated - Class A Common Stock|G|N|N|100|N|N +ISPOW|Inspirato Incorporated - Warrant|G|N|N|100|N|N +ISPR|Ispire Technology Inc. - Common Stock|S|N|N|100|N|N +ISRG|Intuitive Surgical, Inc. - Common Stock|Q|N|N|40|N|N +ISSC|Innovative Solutions and Support, Inc. - Common Stock|Q|N|N|100|N|N +ISTB|iShares Core 1-5 Year USD Bond ETF|G|N|N|100|Y|N +ISTR|Investar Holding Corporation - Common Stock|G|N|N|100|N|N +ISUL|GraniteShares 2x Long ISRG Daily ETF|G|N|N|100|Y|N +ITHA|ITHAX Acquisition Corp III - Class A Ordinary Shares|G|N|N|100|N|N +ITHAU|ITHAX Acquisition Corp III - Units|G|N|N|100|N|N +ITHAW|ITHAX Acquisition Corp III - Warrants|G|N|N|100|N|N +ITIC|Investors Title Company - Common Stock|Q|N|N|40|N|N +ITOC|iTonic Holdings Ltd - Class A Ordinary Shares|S|N|D|100|N|N +ITRI|Itron, Inc. - Common Stock|Q|N|N|100|N|N +ITRM|Iterum Therapeutics plc - Ordinary Share|S|N|D|100|N|N +ITRN|Ituran Location and Control Ltd. - Ordinary Shares|Q|N|N|100|N|N +IUS|Invesco RAFI Strategic US ETF|G|N|N|100|Y|N +IUSB|iShares Core Universal USD Bond ETF|G|N|N|100|Y|N +IUSG|iShares Core S&P U.S. Growth ETF|G|N|N|100|Y|N +IUSV|iShares Core S&P U.S. Value ETF|G|N|N|100|Y|N +IVA|Inventiva S.A. - American Depository Shares|G|N|N|100|N|N +IVAL|Alpha Architect International Quantitative Value ETF|G|N|N|100|Y|N +IVDA|Iveda Solutions, Inc. - Common Stock|S|N|N|100|N|N +IVDAW|Iveda Solutions, Inc. - Warrant|S|N|N|100|N|N +IVF|INVO Fertility, Inc. - Common Stock|S|N|N|100|N|N +IVSI|Applied Finance IVS International Large ETF|G|N|N|100|Y|N +IVSS|Applied Finance IVS US SMID ETF|G|N|N|100|Y|N +IVVD|Invivyd, Inc. - Common Stock|G|N|N|100|N|N +IXHL|Incannex Healthcare Inc. - Common Stock|S|N|D|100|N|N +IXUS|iShares Core MSCI Total International Stock ETF|G|N|N|100|Y|N +IZEA|IZEA Worldwide, Inc. - Common Stock|S|N|N|100|N|N +IZM|ICZOOM Group Inc. - Class A Ordinary Shares|S|N|N|100|N|N +JACK|Jack In The Box Inc. - Common Stock|Q|N|N|100|N|N +JAGX|Jaguar Health, Inc. - Common Stock|S|N|N|100|N|N +JAKK|JAKKS Pacific, Inc. - Common Stock|Q|N|N|100|N|N +JAMF|Jamf Holding Corp. - Common Stock|Q|N|N|100|N|N +JANX|Janux Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +JAPN|Horizon Kinetics Japan Owner Operator ETF|G|N|N|100|Y|N +JAZZ|Jazz Pharmaceuticals plc - Ordinary Shares|Q|N|N|100|N|N +JBDI|JBDI Holdings Limited - Ordinary Shares|S|N|D|100|N|N +JBHT|J.B. Hunt Transport Services, Inc. - Common Stock|Q|N|N|100|N|N +JBIO|Jade Biosciences, Inc. - Common Stock|S|N|N|100|N|N +JBLU|JetBlue Airways Corporation - Common Stock|Q|N|N|100|N|N +JBSS|John B. Sanfilippo & Son, Inc. - Common Stock|Q|N|N|100|N|N +JCAP|Jefferson Capital, Inc. - Common Stock|Q|N|N|100|N|N +JCSE|JE Cleantech Holdings Limited - Ordinary Shares|S|N|N|100|N|N +JCTC|Jewett-Cameron Trading Company - Common Shares|S|N|N|100|N|N +JD|JD.com, Inc. - American Depositary Shares|Q|N|N|100|N|N +JDOC|JPMorgan Healthcare Leaders ETF|G|N|N|100|Y|N +JDZG|JIADE LIMITED - Class A Ordinary Shares|S|N|N|100|N|N +JEM|707 Cayman Holdings Limited - Ordinary Shares|S|N|D|100|N|N +JEPQ|JPMorgan Nasdaq Equity Premium Income ETF|G|N|N|100|Y|N +JF|J and Friends Holdings Limited - American Depositary Shares|G|N|N|100|N|N +JFB|JFB Construction Holdings - Class A Common Stock|S|N|N|100|N|N +JFBR|Jeffs' Brands Ltd - Ordinary Shares|S|N|N|100|N|N +JFBRW|Jeffs' Brands Ltd - Warrant|S|N|N|100|N|N +JFIN|Jiayin Group Inc. - American Depositary Shares|G|N|N|100|N|N +JFU|9F Inc. - American Depositary Shares|G|N|N|100|N|N +JG|Aurora Mobile Limited - American Depositary Shares|S|N|N|100|N|N +JGLO|JPMorgan Global Select Equity ETF|G|N|N|100|Y|N +JHAI|Janus Henderson Global Artificial Intelligence ETF|G|N|N|100|Y|N +JIVE|JPMorgan International Value ETF|G|N|N|100|Y|N +JJSF|J & J Snack Foods Corp. - Common Stock|Q|N|N|100|N|N +JKHY|Jack Henry & Associates, Inc. - Common Stock|Q|N|N|100|N|N +JL|J-Long Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +JLHL|Julong Holding Limited - Class A Ordinary Shares|S|N|N|100|N|N +JMID|Janus Henderson Mid Cap Growth Alpha ETF|G|N|N|100|Y|N +JMSB|John Marshall Bancorp, Inc. - Common Stock|S|N|N|100|N|N +JOUT|Johnson Outdoors Inc. - Class A Common Stock|Q|N|N|100|N|N +JOYY|JOYY Inc. - American Depositary Shares|Q|N|N|100|N|N +JPEF|JPMorgan Equity Focus ETF|G|N|N|100|Y|N +JPY|Lazard Japanese Equity ETF|G|N|N|100|Y|N +JRSH|Jerash Holdings (US), Inc. - Common Stock|S|N|N|100|N|N +JRVR|James River Group Holdings, Inc. - Common Stock|Q|N|N|100|N|N +JSM|Navient Corporation - 6% Senior Notes due December 15, 2043|Q|N|N|100|N|N +JSMD|Janus Henderson Small/Mid Cap Growth Alpha ETF|G|N|N|100|Y|N +JSML|Janus Henderson Small Cap Growth Alpha ETF|G|N|N|100|Y|N +JSPR|Jasper Therapeutics, Inc. - Class A Common Stock|S|N|N|100|N|N +JSPRW|Jasper Therapeutics, Inc. - Warrant|S|N|N|100|N|N +JTAI|Jet.AI Inc. - Common Stock|S|N|N|100|N|N +JTEK|JPMorgan U.S. Tech Leaders ETF|G|N|N|100|Y|N +JUNS|Jupiter Neurosciences, Inc. - Common Stock|S|N|N|100|N|N +JVA|Coffee Holding Co., Inc. - Common Stock|S|N|N|100|N|N +JWEL|Jowell Global Ltd. - Ordinary Shares|S|N|N|100|N|N +JXG|JX Luxventure Group Inc. - Common Stock|S|N|N|100|N|N +JYD|Jayud Global Logistics Limited - Class A Ordinary Shares|S|N|N|100|N|N +JYNT|The Joint Corp. - Common Stock|S|N|N|100|N|N +JZ|Jianzhi Education Technology Group Company Limited - American Depositary Shares|S|N|N|100|N|N +JZXN|Jiuzi Holdings, Inc. - Ordinary Shares|S|N|N|100|N|N +KALA|KALA BIO, Inc. - Common Stock|S|N|D|100|N|N +KALU|Kaiser Aluminum Corporation - Common Stock|Q|N|N|100|N|N +KALV|KalVista Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +KARO|Karooooo Ltd. - Ordinary shares|S|N|N|100|N|N +KAT|Scharf ETF|G|N|N|100|Y|N +KBAB|KraneShares 2x Long BABA Daily ETF|G|N|N|100|Y|N +KBDU|KraneShares 2x Long BIDU Daily ETF|G|N|N|100|Y|N +KBON|Karbon Capital Partners Corp. - Class A Ordinary Shares|G|N|N|100|N|N +KBONU|Karbon Capital Partners Corp. - Units|G|N|N|100|N|N +KBONW|Karbon Capital Partners Corp. - Warrant|G|N|N|100|N|N +KBSX|FST Corp. - Ordinary Shares|G|N|N|100|N|N +KBWB|Invesco KBW Bank ETF|G|N|N|100|Y|N +KBWD|Invesco KBW High Dividend Yield Financial ETF|G|N|N|100|Y|N +KBWP|Invesco KBW Property & Casualty Insurance ETF|G|N|N|100|Y|N +KBWR|Invesco KBW Regional Banking ETF|G|N|N|100|Y|N +KBWY|Invesco KBW Premium Yield Equity REIT ETF|G|N|N|100|Y|N +KC|Kingsoft Cloud Holdings Limited - American Depositary Shares|Q|N|N|100|N|N +KCHV|Kochav Defense Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +KCHVR|Kochav Defense Acquisition Corp. - Right|G|N|N|100|N|N +KCHVU|Kochav Defense Acquisition Corp. - Units|G|N|N|100|N|N +KDK|Kodiak AI, Inc. - Common Stock|G|N|N|100|N|N +KDKRW|Kodiak AI, Inc. - Warrant|S|N|N|100|N|N +KDP|Keurig Dr Pepper Inc. - Common Stock|Q|N|N|100|N|N +KE|Kimball Electronics, Inc. - Common Stock|Q|N|N|100|N|N +KEAT|Keating Active ETF|G|N|N|100|Y|N +KELYA|Kelly Services, Inc. - Class A Common Stock|Q|N|N|100|N|N +KELYB|Kelly Services, Inc. - Class B Common Stock|Q|N|N|100|N|N +KEQU|Kewaunee Scientific Corporation - Common Stock|G|N|N|100|N|N +KFFB|Kentucky First Federal Bancorp - Common Stock|G|N|N|100|N|N +KFII|K&F Growth Acquisition Corp. II - Class A Ordinary shares|G|N|N|100|N|N +KFIIR|K&F Growth Acquisition Corp. II - Rights|G|N|N|100|N|N +KFIIU|K&F Growth Acquisition Corp. II - Unit|G|N|N|100|N|N +KG|Kestrel Group, Ltd. - Common Stock|S|N|N|100|N|N +KGEI|Kolibri Global Energy Inc. - Common stock|S|N|N|100|N|N +KHC|The Kraft Heinz Company - Common Stock|Q|N|N|100|N|N +KIDS|OrthoPediatrics Corp. - Common Stock|G|N|N|100|N|N +KIDZ|Classover Holdings, Inc. - Class B Common Stock|S|N|D|100|N|N +KIDZW|Classover Holdings, Inc. - Warrants|S|N|N|100|N|N +KINS|Kingstone Companies, Inc - Common Stock|S|N|N|100|N|N +KIQQ|KraneShares InspereX Nasdaq Dynamic Buffered High Income Index ETF|G|N|N|100|Y|N +KITT|Nauticus Robotics, Inc. - Common stock|S|N|D|100|N|N +KITTW|Nauticus Robotics, Inc. - Warrant|S|N|D|100|N|N +KJD|KraneShares 2x Long JD Daily ETF|G|N|N|100|Y|N +KLAC|KLA Corporation - Common Stock|Q|N|N|40|N|N +KLAG|Leverage Shares 2x Long KLAC Daily ETF|G|N|N|100|Y|N +KLIC|Kulicke and Soffa Industries, Inc. - Common Stock|Q|N|N|100|N|N +KLRS|Kalaris Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +KLTO|Klotho Neurosciences, Inc. - Common Stock|S|N|D|100|N|N +KLTOW|Klotho Neurosciences, Inc. - Warrants|S|N|N|100|N|N +KLTR|Kaltura, Inc. - Common Stock|Q|N|N|100|N|N +KLXE|KLX Energy Services Holdings, Inc. - Common Stock|Q|N|N|100|N|N +KMB|Kimberly-Clark Corporation - Common Stock|Q|N|N|100|N|N +KMDA|Kamada Ltd. - Ordinary Shares|Q|N|N|100|N|N +KMLI|KraneShares 2x Long MELI Daily ETF|G|N|N|100|Y|N +KMRK|K-Tech Solutions Company Limited - Class A Ordinary Shares|S|N|N|100|N|N +KMTS|Kestra Medical Technologies, Ltd. - Common Stock|Q|N|N|100|N|N +KNDI|Kandi Technologies Group, Inc. - Ordinary Shares|Q|N|N|100|N|N +KNGZ|First Trust S&P 500 Diversified Dividend Aristocrats ETF|G|N|N|100|Y|N +KNSA|Kiniksa Pharmaceuticals International, plc - Class A Ordinary Shares|Q|N|N|100|N|N +KOD|Kodiak Sciences Inc - Common Stock|G|N|N|100|N|N +KOID|KraneShares Global Humanoid and Embodied Intelligence Index ETF|G|N|N|100|Y|N +KOPN|Kopin Corporation - Common Stock|S|N|N|100|N|N +KOSS|Koss Corporation - Common Stock|S|N|N|100|N|N +KOYN|CSLM Digital Asset Acquisition Corp III - Class A Ordinary Shares|G|N|N|100|N|N +KOYNU|CSLM Digital Asset Acquisition Corp III - Units|G|N|N|100|N|N +KOYNW|CSLM Digital Asset Acquisition Corp III - Warrants|G|N|N|100|N|N +KPDD|KraneShares 2x Long PDD Daily ETF|G|N|N|100|Y|N +KPLT|Katapult Holdings, Inc. - Common Stock|G|N|N|100|N|N +KPLTW|Katapult Holdings, Inc. - Warrant|G|N|N|100|N|N +KPRX|Kiora Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +KPTI|Karyopharm Therapeutics Inc. - Common Stock|Q|N|N|100|N|N +KQQQ|Kurv Technology Titans Select ETF|G|N|N|100|Y|N +KRAQU|KRAKacquisition Corp - Unit|G|N|N|100|N|N +KRKR|36Kr Holdings Inc. - American Depositary Shares|S|N|N|100|N|N +KRMA|Global X Conscious Companies ETF|G|N|N|100|Y|N +KRMD|KORU Medical Systems, Inc. - Common Stock|S|N|N|100|N|N +KRNT|Kornit Digital Ltd. - Ordinary Shares|Q|N|N|100|N|N +KRNY|Kearny Financial - Common Stock|Q|N|N|100|N|N +KROP|Global X AgTech & Food Innovation ETF|G|N|N|100|Y|N +KROS|Keros Therapeutics, Inc. - common stock|G|N|N|100|N|N +KRRO|Korro Bio, Inc. - Common Stock|S|N|N|100|N|N +KRT|Karat Packaging Inc. - Common Stock|Q|N|N|100|N|N +KRUS|Kura Sushi USA, Inc. - Class A Common Stock|G|N|N|100|N|N +KRYS|Krystal Biotech, Inc. - Common Stock|Q|N|N|100|N|N +KSCP|Knightscope, Inc. - Class A Common Stock|S|N|N|100|N|N +KSPI|Joint Stock Company Kaspi.kz - American Depository Shares|Q|N|N|100|N|N +KTCC|Key Tronic Corporation - Common Stock|G|N|N|100|N|N +KTOS|Kratos Defense & Security Solutions, Inc. - Common Stock|Q|N|N|100|N|N +KTTA|Pasithea Therapeutics Corp. - Common Stock|S|N|N|100|N|N +KTTAW|Pasithea Therapeutics Corp. - Warrant|S|N|N|100|N|N +KTWOU|K2 Capital Acquisition Corporation - Units|G|N|N|100|N|N +KURA|Kura Oncology, Inc. - Common Stock|Q|N|N|100|N|N +KUST|Kustom Entertainment, Inc. - Common Stock|S|N|N|100|N|N +KVAC|Keen Vision Acquisition Corporation - Ordinary Shares|G|N|N|100|N|N +KVACU|Keen Vision Acquisition Corporation - Units|G|N|N|100|N|N +KVACW|Keen Vision Acquisition Corporation - Warrant|G|N|N|100|N|N +KVHI|KVH Industries, Inc. - Common Stock|Q|N|N|100|N|N +KWM|K Wave Media, Ltd. - Ordinary Shares|G|N|D|100|N|N +KWMWW|K Wave Media, Ltd. - Warrant|S|N|N|100|N|N +KXIN|Kaixin Holdings - Ordinary Shares|S|N|N|100|N|N +KYIV|Kyivstar Group Ltd. - Common Shares|Q|N|N|100|N|N +KYIVW|Kyivstar Group Ltd. - Warrant|S|N|N|100|N|N +KYMR|Kymera Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +KYNB|Kyntra Bio, Inc. - Common Stock|Q|N|N|100|N|N +KYTX|Kyverna Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +KZIA|Kazia Therapeutics Limited - American Depositary Shares|S|N|N|100|N|N +KZR|Kezar Life Sciences, Inc. - Common Stock|S|N|N|100|N|N +LAB|Standard BioTools Inc. - Common Stock|Q|N|N|100|N|N +LACG|Leverage Shares 2X Long LAC Daily ETF|G|N|N|100|Y|N +LAES|SEALSQ Corp - Ordinary Shares|Q|N|N|100|N|N +LAFA|LaFayette Acquisition Corp. - Ordinary Share|G|N|N|100|N|N +LAFAR|LaFayette Acquisition Corp. - Rights|G|N|N|100|N|N +LAFAU|LaFayette Acquisition Corp. - Unit|G|N|N|100|N|N +LAKE|Lakeland Industries, Inc. - Common Stock|G|N|N|100|N|N +LAMR|Lamar Advertising Company - Class A Common Stock|Q|N|N|100|N|N +LAND|Gladstone Land Corporation - Common Stock|G|N|N|100|N|N +LANDM|Gladstone Land Corporation - 5.00% Series D Cumulative Term Preferred Stock|G|N|N|100|N|N +LANDO|Gladstone Land Corporation - 6.00% Series B Cumulative Redeemable Preferred Stock|G|N|N|100|N|N +LANDP|Gladstone Land Corporation - 6.00% Series C Cumulative Redeemable Preferred Stock|G|N|N|100|N|N +LARK|Landmark Bancorp Inc. - Common Stock|G|N|N|100|N|N +LASE|Laser Photonics Corporation - Common Stock|S|N|N|100|N|N +LASR|nLIGHT, Inc. - Common Stock|Q|N|N|100|N|N +LATA|Galata Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +LATAU|Galata Acquisition Corp. II - Units|G|N|N|100|N|N +LATAW|Galata Acquisition Corp. II - Warrant|G|N|N|100|N|N +LAUR|Laureate Education, Inc. - Common Stock|Q|N|N|100|N|N +LAWR|Robot Consulting Co., Ltd. - ADS|S|N|N|100|N|N +LAYS|STKd 100% NVDA & 100% AMD ETF|G|N|N|100|Y|N +LBGJ|Li Bang International Corporation Inc. - Class A Ordinary Shares|S|N|D|100|N|N +LBRDA|Liberty Broadband Corporation - Class A Common Stock|Q|N|N|100|N|N +LBRDK|Liberty Broadband Corporation - Class C Common Stock|Q|N|N|100|N|N +LBRDP|Liberty Broadband Corporation - Series A Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +LBRX|LB Pharmaceuticals Inc - Common Stock|G|N|N|100|N|N +LBTYA|Liberty Global Ltd. - Class A Common Shares|Q|N|N|100|N|N +LBTYB|Liberty Global Ltd. - Class B Common Shares|Q|N|N|100|N|N +LBTYK|Liberty Global Ltd. - Class C Common Shares|Q|N|N|100|N|N +LCCC|Lakeshore Acquisition III Corp. - Ordinary Shares|G|N|N|100|N|N +LCCCR|Lakeshore Acquisition III Corp. - Rights|G|N|N|100|N|N +LCCCU|Lakeshore Acquisition III Corp. - Unit|G|N|N|100|N|N +LCDL|GraniteShares 2x Long LCID Daily ETF|G|N|N|100|Y|N +LCDS|JPMorgan Fundamental Data Science Large Core ETF|G|N|N|100|Y|N +LCFY|Locafy Limited - Ordinary Share|S|N|N|100|N|N +LCFYW|Locafy Limited - Warrant|S|N|N|100|N|N +LCID|Lucid Group, Inc. - Common Stock|Q|N|N|100|N|N +LCNB|LCNB Corporation - Common Stock|S|N|N|100|N|N +LCUT|Lifetime Brands, Inc. - Common Stock|Q|N|N|100|N|N +LDEM|iShares ESG MSCI EM Leaders ETF|G|N|N|100|Y|N +LDRX|SGI Enhanced Market Leaders ETF|G|N|N|100|Y|N +LDSF|First Trust Low Duration Strategic Focus ETF|G|N|N|100|Y|N +LDWY|Lendway, Inc. - Common Stock|S|N|N|100|N|N +LE|Lands' End, Inc. - Common Stock|S|N|N|100|N|N +LECO|Lincoln Electric Holdings, Inc. - Common Shares|Q|N|N|100|N|N +LEDS|SemiLEDS Corporation - Common Stock|S|N|N|100|N|N +LEE|Lee Enterprises, Incorporated - Common Stock|Q|N|N|100|N|N +LEGH|Legacy Housing Corporation - Common Stock|Q|N|N|100|N|N +LEGN|Legend Biotech Corporation - American Depositary Shares|Q|N|N|100|N|N +LEGR|First Trust Indxx Innovative Transaction & Process ETF|G|N|N|100|Y|N +LENZ|LENZ Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +LESL|Leslie's, Inc. - Common Stock|Q|N|N|100|N|N +LEXI|Alexis Practical Tactical ETF|G|N|N|100|Y|N +LEXX|Lexaria Bioscience Corp. - Common Stock|S|N|N|100|N|N +LFAC|Leapfrog Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +LFACU|Leapfrog Acquisition Corporation - Units|G|N|N|100|N|N +LFACW|Leapfrog Acquisition Corporation - Warrants|G|N|N|100|N|N +LFCR|Lifecore Biomedical, Inc. - Common Stock|Q|N|N|100|N|N +LFMD|LifeMD, Inc. - Common Stock|G|N|N|100|N|N +LFMDP|LifeMD, Inc. - 8.875% Series A Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +LFS|LEIFRAS Co., Ltd. - American Depositary Shares|S|N|N|100|N|N +LFSC|F/m Emerald Life Sciences Innovation ETF|G|N|N|100|Y|N +LFST|LifeStance Health Group, Inc. - Common Stock|Q|N|N|100|N|N +LFUS|Littelfuse, Inc. - Common Stock|Q|N|N|40|N|N +LFVN|Lifevantage Corporation - Common Stock|S|N|N|100|N|N +LFWD|Lifeward Ltd. - Ordinary Shares|S|N|D|100|N|N +LGCB|Linkage Global Inc - Class A Ordinary Shares|S|N|N|100|N|N +LGCF|Themes US Cash Flow Champions ETF|G|N|N|100|Y|N +LGCL|Lucas GC Limited - Class A Ordinary Shares|S|N|N|100|N|N +LGHL|Lion Group Holding Ltd. - American Depositary Share|S|N|N|100|N|N +LGIH|LGI Homes, Inc. - Common Stock|Q|N|N|100|N|N +LGN|Legence Corp. - Class A Common stock|Q|N|N|100|N|N +LGND|Ligand Pharmaceuticals Incorporated - Common Stock|G|N|N|100|N|N +LGO|Largo Inc. - Common Shares|Q|N|N|100|N|N +LGRO|Level Four Large Cap Growth Active ETF|G|N|N|100|Y|N +LGVN|Longeveron Inc. - Class A Common stock|S|N|D|100|N|N +LHAI|Linkhome Holdings Inc. - Common stock|S|N|N|100|N|N +LHSW|Lianhe Sowell International Group Ltd - Class A Ordinary Shares|S|N|N|100|N|N +LI|Li Auto Inc. - American Depositary Shares|Q|N|N|100|N|N +LICN|Lichen International Limited - Class A Ordinary Shares|S|N|N|100|N|N +LIDR|AEye, Inc. - Class A Common Stock|S|N|N|100|N|N +LIDRW|AEye, Inc. - Warrant|S|N|N|100|N|N +LIEN|Chicago Atlantic BDC, Inc. - Common Stock|G|N|N|100|N|N +LIF|Life360, Inc. - Common Stock|Q|N|N|100|N|N +LILA|Liberty Latin America Ltd. - Class A Common Stock|Q|N|N|100|N|N +LILAK|Liberty Latin America Ltd. - Class C Common Stock|Q|N|N|100|N|N +LIMN|Liminatus Pharma, Inc. - Class A Common Stock|G|N|D|100|N|N +LIMNW|Liminatus Pharma, Inc. - Warrants|S|N|N|100|N|N +LIN|Linde plc - Ordinary Shares|Q|N|N|40|N|N +LINC|Lincoln Educational Services Corporation - Common Stock|Q|N|N|100|N|N +LIND|Lindblad Expeditions Holdings Inc. - Common Stock|S|N|N|100|N|N +LINE|Lineage, Inc. - Common Stock|Q|N|N|100|N|N +LINK|Interlink Electronics, Inc. - Common Stock|S|N|N|100|N|N +LINT|Direxion Daily INTC Bull 2X ETF|G|N|N|100|Y|N +LIQT|LiqTech International, Inc. - Common Stock|S|N|N|100|N|N +LITE|Lumentum Holdings Inc. - Common Stock|Q|N|N|100|N|N +LITM|Snow Lake Resources Ltd. - Common Shares|S|N|N|100|N|N +LITP|Sprott Lithium Miners ETF|G|N|N|100|Y|N +LITS|Lite Strategy, Inc. - Common Stock|S|N|N|100|N|N +LIVE|Live Ventures Incorporated - Common Stock|S|N|N|100|N|N +LIVN|LivaNova PLC - Ordinary Shares|Q|N|N|100|N|N +LIXT|Lixte Biotechnology Holdings, Inc. - Common Stock|S|N|N|100|N|N +LKFN|Lakeland Financial Corporation - Common Stock|Q|N|N|100|N|N +LKQ|LKQ Corporation - Common Stock|Q|N|N|100|N|N +LKSP|Lake Superior Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +LKSPR|Lake Superior Acquisition Corp. - Rights|G|N|N|100|N|N +LKSPU|Lake Superior Acquisition Corp. - Units|G|N|N|100|N|N +LLYVA|Liberty Live Holdings, Inc. - Series A Liberty Live Group Common Stock|Q|N|N|100|N|N +LLYVK|Liberty Live Holdings, Inc. - Series C Liberty Live Group Common Stock|Q|N|N|100|N|N +LMAT|LeMaitre Vascular, Inc. - Common Stock|G|N|N|100|N|N +LMB|Limbach Holdings, Inc. - Common Stock|S|N|N|100|N|N +LMBS|First Trust Low Duration Opportunities ETF|G|N|N|100|Y|N +LMFA|LM Funding America, Inc. - Common Stock|S|N|D|100|N|N +LMNR|Limoneira Co - Common Stock|Q|N|N|100|N|N +LMNX|Defiance Daily Target 2x Long LMND ETF|G|N|N|100|Y|N +LMRI|Lumexa Imaging Holdings, Inc. - Common Stock|Q|N|N|100|N|N +LMTL|Direxion Daily LMT Bull 2X ETF|G|N|N|100|Y|N +LMTS|Direxion Daily LMT Bear 1X ETF|G|N|N|100|Y|N +LNAI|Lunai Bioworks Inc. - Common Stock|S|N|D|100|N|N +LNKB|LINKBANCORP, Inc. - Common Stock|S|N|N|100|N|N +LNKS|Linkers Industries Limited - Class A Ordinary Shares|S|N|D|100|N|N +LNSR|LENSAR, Inc. - Common Stock|S|N|N|100|N|N +LNT|Alliant Energy Corporation - Common Stock|Q|N|N|100|N|N +LNTH|Lantheus Holdings, Inc. - Common Stock|G|N|N|100|N|N +LNZA|LanzaTech Global, Inc. - Common Stock|S|N|N|100|N|N +LNZAW|LanzaTech Global, Inc. - Warrant|S|N|N|100|N|N +LOAN|Manhattan Bridge Capital, Inc - Common Stock|S|N|N|100|N|N +LOBO|LOBO TECHNOLOGIES LTD. - Class A Ordinary Shares|S|N|D|100|N|N +LOCO|El Pollo Loco Holdings, Inc. - Common Stock|Q|N|N|100|N|N +LOGI|Logitech International S.A. - Registered Shares|Q|N|N|100|N|N +LOGO|Alpha Brands Consumption Leaders ETF|G|N|N|100|Y|N +LOKV|Live Oak Acquisition Corp. V - Class A Ordinary Shares|G|N|N|100|N|N +LOKVU|Live Oak Acquisition Corp. V - Units|G|N|N|100|N|N +LOKVW|Live Oak Acquisition Corp. V - Warrants|G|N|N|100|N|N +LONA|LeonaBio, Inc. - Common Stock|S|N|N|100|N|N +LOOP|Loop Industries, Inc. - Common Stock|G|N|N|100|N|N +LOPE|Grand Canyon Education, Inc. - Common Stock|Q|N|N|100|N|N +LOT|Lotus Technology Inc. - American Depositary Shares|Q|N|N|100|N|N +LOTI|Liberty One Tactical Income ETF|G|N|N|100|Y|N +LOTWW|Lotus Technology Inc. - Warrants|S|N|N|100|N|N +LOVE|The Lovesac Company - Common Stock|G|N|N|100|N|N +LPAA|Launch One Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +LPAAU|Launch One Acquisition Corp. - Unit|G|N|N|100|N|N +LPAAW|Launch One Acquisition Corp. - Warrant|G|N|N|100|N|N +LPBB|Launch Two Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +LPBBU|Launch Two Acquisition Corp. - Unit|G|N|N|100|N|N +LPBBW|Launch Two Acquisition Corp. - Warrant|G|N|N|100|N|N +LPCN|Lipocine Inc. - Common Stock|S|N|N|100|N|N +LPCVU|Launchpad Cadenza Acquisition Corp I - Unit|G|N|N|100|N|N +LPLA|LPL Financial Holdings Inc. - Common Stock|Q|N|N|40|N|N +LPRO|Open Lending Corporation - Common Stock|G|N|N|100|N|N +LPSN|LivePerson, Inc. - Common Stock|Q|N|N|100|N|N +LPTH|LightPath Technologies, Inc. - Class A Common Stock|S|N|N|100|N|N +LQDA|Liquidia Corporation - Common Stock|S|N|N|100|N|N +LQDT|Liquidity Services, Inc. - Common Stock|Q|N|N|100|N|N +LRCX|Lam Research Corporation - Common Stock|Q|N|N|100|N|N +LRE|Lead Real Estate Co., Ltd - American Depositary Shares|S|N|N|100|N|N +LRGE|ClearBridge Large Cap Growth Select ETF|G|N|N|100|Y|N +LRHC|La Rosa Holdings Corp. - Common Stock|S|N|N|100|N|N +LRMR|Larimar Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +LRND|NYLI U.S. Large Cap R&D Leaders ETF|G|N|N|100|Y|N +LSAK|Lesaka Technologies, Inc. - Common Stock|Q|N|N|100|N|N +LSBK|Lake Shore Bancorp, Inc. - Common Stock|G|N|N|100|N|N +LSCC|Lattice Semiconductor Corporation - Common Stock|Q|N|N|100|N|N +LSE|Leishen Energy Holding Co., Ltd. - Ordinary Shares|S|N|D|100|N|N +LSH|Lakeside Holding Limited - Common Stock|S|N|D|100|N|N +LSTA|Lisata Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +LSTR|Landstar System, Inc. - Common Stock|Q|N|N|100|N|N +LTBR|Lightbridge Corporation - Common Stock|S|N|N|100|N|N +LTCC|Canary Litecoin ETF|G|N|N|100|Y|N +LTRN|Lantern Pharma Inc. - Common Stock|S|N|N|100|N|N +LTRX|Lantronix, Inc. - Common Stock|S|N|N|100|N|N +LTRYW|Lottery.com, Inc. - Warrant|G|N|N|100|N|N +LUCD|Lucid Diagnostics Inc. - Common Stock|S|N|N|100|N|N +LUCY|Innovative Eyewear, Inc. - Common Stock|S|N|N|100|N|N +LUCYW|Innovative Eyewear, Inc. - Warrants|S|N|N|100|N|N +LULG|Leverage Shares 2X Long LULU Daily ETF|G|N|N|100|Y|N +LULU|lululemon athletica inc. - Common Stock|Q|N|N|100|N|N +LUNG|Pulmonx Corporation - Common Stock|Q|N|N|100|N|N +LUNR|Intuitive Machines, Inc. - Class A Common Stock|G|N|N|100|N|N +LVHD|Franklin U.S. Low Volatility High Dividend Index ETF|G|N|N|100|Y|N +LVLU|Lulu's Fashion Lounge Holdings, Inc. - Common Stock|S|N|N|100|N|N +LVO|LiveOne, Inc. - Common Stock|S|N|D|100|N|N +LVRO|Lavoro Limited - Class A Ordinary Shares|G|N|N|100|N|N +LVROW|Lavoro Limited - Warrant|G|N|N|100|N|N +LWAC|LightWave Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +LWACU|LightWave Acquisition Corp. - Units|G|N|N|100|N|N +LWACW|LightWave Acquisition Corp. - Warrants|G|N|N|100|N|N +LWAY|Lifeway Foods, Inc. - Common Stock|G|N|N|100|N|N +LWLG|Lightwave Logic, Inc. - Common Stock|S|N|N|100|N|N +LX|LexinFintech Holdings Ltd. - American Depositary Shares|Q|N|N|100|N|N +LXEH|Lixiang Education Holding Co., Ltd. - American Depositary Shares|G|N|D|100|N|N +LXEO|Lexeo Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +LXRX|Lexicon Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +LYEL|Lyell Immunopharma, Inc. - Common Stock|Q|N|N|100|N|N +LYFT|Lyft, Inc. - Class A Common Stock|Q|N|N|100|N|N +LYRA|Lyra Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +LYTS|LSI Industries Inc. - Common Stock|Q|N|N|100|N|N +LZ|LegalZoom.com, Inc. - Common Stock|Q|N|N|100|N|N +LZMH|LZ Technology Holdings Limited - Class B Ordinary Shares|S|N|N|100|N|N +MAAS|Maase Inc. - Class A Ordinary Shares|G|N|N|100|N|N +MAAY|GraniteShares YieldBOOST MARA ETF|G|N|N|100|Y|N +MACI|Melar Acquisition Corp. I - Class A Ordinary Shares|G|N|N|100|N|N +MACIU|Melar Acquisition Corp. I - Unit|G|N|N|100|N|N +MACIW|Melar Acquisition Corp. I - Warrant|G|N|N|100|N|N +MAGH|Magnitude International Ltd - Ordinary Shares|S|N|N|100|N|N +MAMA|Mama's Creations, Inc. - Common Stock|S|N|N|100|N|N +MAMK|MaxsMaking Inc. - Class A Ordinary Shares|S|N|N|100|N|N +MAMO|Massimo Group - Common Stock|S|N|N|100|N|N +MANH|Manhattan Associates, Inc. - Common Stock|Q|N|N|100|N|N +MAPS|WM Technology, Inc. - Class A Common Stock|Q|N|N|100|N|N +MAPSW|WM Technology, Inc. - Warrants|Q|N|N|100|N|N +MAR|Marriott International - Class A Common Stock|Q|N|N|40|N|N +MARA|MARA Holdings, Inc. - Common Stock|S|N|N|100|N|N +MARPS|Marine Petroleum Trust - Units of Beneficial Interest|S|N|N|100|N|N +MASI|Masimo Corporation - Common Stock|Q|N|N|100|N|N +MASK|3 E Network Technology Group Ltd - Class A Ordinary Shares|S|N|D|100|N|N +MASS|908 Devices Inc. - Common Stock|G|N|N|100|N|N +MAT|Mattel, Inc. - Common Stock|Q|N|N|100|N|N +MATE|Man Active Trend Enhanced ETF|G|N|N|100|Y|N +MATH|Metalpha Technology Holding Limited - Ordinary Shares|S|N|N|100|N|N +MATW|Matthews International Corporation - Class A Common Stock|Q|N|N|100|N|N +MAXI|Simplify Bitcoin Strategy PLUS Income ETF|G|N|N|100|Y|N +MAXN|Maxeon Solar Technologies, Ltd. - Ordinary Shares|Q|N|N|100|N|N +MAYS|J. W. Mays, Inc. - Common Stock|S|N|N|100|N|N +MAZE|Maze Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +MB|MasterBeef Group - Ordinary Shares|S|N|N|100|N|N +MBAI|Check-Cap Ltd. - Ordinary Share|S|N|N|100|N|N +MBAV|M3-Brigade Acquisition V Corp. - Class A Ordinary shares|G|N|N|100|N|N +MBAVU|M3-Brigade Acquisition V Corp. - Units|G|N|N|100|N|N +MBAVW|M3-Brigade Acquisition V Corp. - Warrant|G|N|N|100|N|N +MBB|iShares MBS ETF|G|N|N|100|Y|N +MBBC|Marathon Bancorp, Inc. - Common Stock|S|N|N|100|N|N +MBCN|Middlefield Banc Corp. - Common Stock|S|N|N|100|N|N +MBIN|Merchants Bancorp - Common Stock|S|N|N|100|N|N +MBINL|Merchants Bancorp - Depositary Shares, Each Representing a 1/40th Interest in a Share of 7.625% Fixed Rate Series E Non-Cumulative Perpetual Preferred Stock, without par value|S|N|N|100|N|N +MBINM|Merchants Bancorp - Depositary Shares, Each Representing a 1/40th Interest in a Share of 8.25% Fixed-Rate Reset Series D Non-Cumulative Perpetual Preferred Stock|S|N|N|100|N|N +MBINN|Merchants Bancorp - Depositary Shares 6.00% Fixed Rate Series C Non-Cumulative Perpetual Preferred Stock|S|N|N|100|N|N +MBIO|Mustang Bio, Inc. - Common Stock|S|N|N|100|N|N +MBLY|Mobileye Global Inc. - Class A Common Stock|Q|N|N|100|N|N +MBNKO|Medallion Bank - Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series G, par value $1.00 per share|S|N|N|100|N|N +MBOT|Microbot Medical Inc. - Common Stock|S|N|N|100|N|N +MBRX|Moleculin Biotech, Inc. - Common Stock|S|N|N|100|N|N +MBS|Angel Oak Mortgage-Backed Securities ETF|G|N|N|100|Y|N +MBUU|Malibu Boats, Inc. - Common Stock|G|N|N|100|N|N +MBVI|M3-Brigade Acquisition VI Corp. - Class A Ordinary Shares|G|N|N|100|N|N +MBVIU|M3-Brigade Acquisition VI Corp. - Units|G|N|N|100|N|N +MBVIW|M3-Brigade Acquisition VI Corp. - Warrant|G|N|N|100|N|N +MBWM|Mercantile Bank Corporation - Common Stock|Q|N|N|100|N|N +MBX|MBX Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +MCBS|MetroCity Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +MCDS|JPMorgan Fundamental Data Science Mid Core ETF|G|N|N|100|Y|N +MCFT|MasterCraft Boat Holdings, Inc. - Common Stock|G|N|N|100|N|N +MCGA|Yorkville Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +MCGAU|Yorkville Acquisition Corp. - Unit|G|N|N|100|N|N +MCGAW|Yorkville Acquisition Corp. - Warrant|G|N|N|100|N|N +MCHB|Mechanics Bancorp - Class A Common Stock|Q|N|N|100|N|N +MCHI|iShares MSCI China ETF|G|N|N|100|Y|N +MCHP|Microchip Technology Incorporated - Common Stock|Q|N|N|100|N|N +MCHPP|Microchip Technology Incorporated - Depositary Shares Each Representing a 1/20th Interest in a Share of 7.50% Series A Mandatory Convertible Preferred Stock|Q|N|N|100|N|N +MCHS|Matthews China Discovery Active ETF|G|N|N|100|Y|N +MCHX|Marchex, Inc. - Class B Common Stock|Q|N|N|100|N|N +MCRB|Seres Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +MCRI|Monarch Casino & Resort, Inc. - Common Stock|Q|N|N|100|N|N +MCTA|Charming Medical Limited - Class A Ordinary Shares|S|N|N|100|N|N +MCW|Mister Car Wash, Inc. - Common Stock|Q|N|N|100|N|N +MDAI|Spectral AI, Inc. - Class A Common Stock|S|N|N|100|N|N +MDAIW|Spectral AI, Inc. - Warrants|S|N|N|100|N|N +MDB|MongoDB, Inc. - Class A Common Stock|G|N|N|40|N|N +MDBH|MDB Capital Holdings, LLC - Class A common |S|N|N|100|N|N +MDCX|Medicus Pharma Ltd. - Common Stock|S|N|N|100|N|N +MDCXW|Medicus Pharma Ltd. - Warrant|S|N|N|100|N|N +MDGL|Madrigal Pharmaceuticals, Inc. - Common Stock|Q|N|N|40|N|N +MDIA|Mediaco Holding Inc. - Class A Common Stock|S|N|D|100|N|N +MDIV|Multi-Asset Diversified Income Index Fund|G|N|N|100|Y|N +MDLN|Medline Inc. - Class A common stock|Q|N|N|100|N|N +MDLZ|Mondelez International, Inc. - Class A Common Stock|Q|N|N|100|N|N +MDRR|Medalist Diversified REIT, Inc. - Common Stock|S|N|N|100|N|N +MDWD|MediWound Ltd. - Ordinary Shares|G|N|N|100|N|N +MDXG|MiMedx Group, Inc - Common Stock|S|N|N|100|N|N +MDXH|MDxHealth SA - Ordinary Shares|S|N|N|100|N|N +MEDP|Medpace Holdings, Inc. - Common Stock|Q|N|N|40|N|N +MEDX|Horizon Kinetics Medical ETF|G|N|N|100|Y|N +MEGL|Magic Empire Global Limited - Class A Ordinary Shares|S|N|N|100|N|N +MEHA|Functional Brands, Inc. - Common Stock|S|N|D|100|N|N +MELI|MercadoLibre, Inc. - Common Stock|Q|N|N|10|N|N +MEMA|Man Active Emerging Markets Alternative ETF|G|N|N|100|Y|N +MEMS|Matthews Emerging Markets Discovery Active ETF|G|N|N|100|Y|N +MENS|Jyong Biotech Ltd. - Ordinary shares|G|N|N|100|N|N +MEOH|Methanex Corporation - Common Stock|Q|N|N|100|N|N +MERC|Mercer International Inc. - Common Stock|Q|N|N|100|N|N +MESHU|Meshflow Acquisition Corp. - Units|G|N|N|100|N|N +MESO|Mesoblast Limited - American Depositary Shares|Q|N|N|100|N|N +META|Meta Platforms, Inc. - Class A Common Stock|Q|N|N|40|N|N +METC|Ramaco Resources, Inc. - Class A Common Stock|Q|N|N|100|N|N +METCB|Ramaco Resources, Inc. - Class B Common Stock|Q|N|N|100|N|N +METCI|Ramaco Resources, Inc. - 8.250% Senior Notes due 2030|G|N|N|100|N|N +METCZ|Ramaco Resources, Inc. - 8.375% Senior Notes due 2029|Q|N|N|100|N|N +METD|Direxion Daily META Bear 1X Shares|G|N|N|100|Y|N +METL|Sprott Active Metals & Miners ETF|G|N|N|100|Y|N +METU|Direxion Daily META Bull 2X Shares|G|N|N|100|Y|N +MFI|mF International Limited - Class A Ordinary Shares|S|N|N|100|N|N +MFIC|MidCap Financial Investment Corporation - Closed End Fund|Q|N|N|100|N|N +MFICL|MidCap Financial Investment Corporation - 8.00% Notes due 2028|Q|N|N|100|N|N +MFIG|Motley Fool Innovative Growth ETF|G|N|N|100|Y|N +MFIN|Medallion Financial Corp. - Common Stock|Q|N|N|100|N|N +MFLX|First Trust Flexible Municipal High Income ETF|G|N|N|100|Y|N +MFMO|Motley Fool Momentum Factor ETF|G|N|N|100|Y|N +MFVL|Motley Fool Value Factor ETF|G|N|N|100|Y|N +MGEE|MGE Energy Inc. - Common Stock|Q|N|N|100|N|N +MGIC|Magic Software Enterprises Ltd. - Ordinary Shares|Q|N|N|100|N|N +MGIH|Millennium Group International Holdings Limited - Ordinary Shares|S|N|N|100|N|N +MGN|Megan Holdings Limited - Ordinary shares.|S|N|N|100|N|N +MGNI|Magnite, Inc. - Common Stock|Q|N|N|100|N|N +MGNX|MacroGenics, Inc. - Common Stock|Q|N|N|100|N|N +MGPI|MGP Ingredients, Inc. - Common Stock|Q|N|N|100|N|N +MGRC|McGrath RentCorp - Common Stock|Q|N|N|100|N|N +MGRT|Mega Fortune Company Limited - Ordinary Shares|S|N|N|100|N|N +MGRX|Mangoceuticals, Inc. - Common Stock|S|N|N|100|N|N +MGTX|MeiraGTx Holdings plc - Ordinary Shares|Q|N|N|100|N|N +MGX|Metagenomi Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +MGYR|Magyar Bancorp, Inc. - Common Stock|G|N|N|100|N|N +MIDD|The Middleby Corporation - Common Stock|Q|N|N|100|N|N +MIGI|Mawson Infrastructure Group Inc. - Common Stock|S|N|N|100|N|N +MILN|Global X Millennial Consumer ETF|G|N|N|100|Y|N +MIMI|Mint Incorporation Limited - Class A Ordinary Shares|S|N|D|100|N|N +MIND|MIND Technology, Inc. - Common Stock|S|N|N|100|N|N +MIRA|MIRA Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +MIRM|Mirum Pharmaceuticals, Inc. - common stock|G|N|N|100|N|N +MIST|Milestone Pharmaceuticals Inc. - Common Shares|Q|N|N|100|N|N +MITK|Mitek Systems, Inc. - Common Stock|S|N|N|100|N|N +MKAM|MKAM ETF|G|N|N|100|Y|N +MKDW|MKDWELL Tech Inc. - Ordinary Shares|S|N|D|100|N|N +MKDWW|MKDWELL Tech Inc. - Warrants|S|N|N|100|N|N +MKLY|McKinley Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +MKLYR|McKinley Acquisition Corporation - Rights|G|N|N|100|N|N +MKLYU|McKinley Acquisition Corporation - Units|G|N|N|100|N|N +MKSI|MKS Inc. - Common Stock|Q|N|N|100|N|N +MKTW|MarketWise, Inc. - Class A Common Stock|G|N|N|100|N|N +MKTX|MarketAxess Holdings, Inc. - Common Stock|Q|N|N|100|N|N +MKZR|MacKenzie Realty Capital, Inc. - Common Stock|S|N|N|100|N|N +MLAAU|Mountain Lake Acquisition Corp. II - Units|G|N|N|100|N|N +MLAB|Mesa Laboratories, Inc. - Common Stock|Q|N|N|100|N|N +MLAC|Mountain Lake Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +MLACR|Mountain Lake Acquisition Corp. - Right|G|N|N|100|N|N +MLACU|Mountain Lake Acquisition Corp. - Units|G|N|N|100|N|N +MLCI|Mount Logan Capital Inc. - Common Stock|S|N|N|100|N|N +MLCO|Melco Resorts & Entertainment Limited - American Depositary Shares |Q|N|N|100|N|N +MLEC|Moolec Science SA - Ordinary Shares|S|N|H|100|N|N +MLECW|Moolec Science SA - Warrant|S|N|H|100|N|N +MLGO|MicroAlgo, Inc. - Ordinary Shares|S|N|N|100|N|N +MLKN|MillerKnoll, Inc. - Common Stock|Q|N|N|100|N|N +MLTX|MoonLake Immunotherapeutics - Class A Ordinary Shares|S|N|N|100|N|N +MLYS|Mineralys Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +MMLP|Martin Midstream Partners L.P. - Common Units Representing Limited Partnership Interests|Q|N|N|100|N|N +MMSI|Merit Medical Systems, Inc. - Common Stock|Q|N|N|100|N|N +MMTX|Miluna Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +MMTXU|Miluna Acquisition Corp - Units|G|N|N|100|N|N +MMTXW|Miluna Acquisition Corp - Warrant|G|N|N|100|N|N +MMYT|MakeMyTrip Limited - Ordinary Shares|Q|N|N|100|N|N +MNDO|MIND C.T.I. Ltd. - Ordinary Shares|G|N|N|100|N|N +MNDR|Mobile-health Network Solutions - Class A Ordinary Shares|S|N|N|100|N|N +MNDY|monday.com Ltd. - Ordinary Shares|Q|N|N|100|N|N +MNKD|MannKind Corporation - Common Stock|G|N|N|100|N|N +MNOV|MediciNova, Inc. - Common Stock|G|N|N|100|N|N +MNPR|Monopar Therapeutics Inc. - Common Stock|S|N|N|100|N|N +MNRO|Monro, Inc. - Common Stock|Q|N|N|100|N|N +MNSB|MainStreet Bancshares, Inc. - Common Stock|S|N|N|100|N|N +MNSBP|MainStreet Bancshares, Inc. - Depositary Shares|S|N|N|100|N|N +MNST|Monster Beverage Corporation - Common Stock|Q|N|N|100|N|N +MNTK|Montauk Renewables, Inc. - Common Stock|S|N|N|100|N|N +MNTS|Momentus Inc. - Class A Common Stock|S|N|N|100|N|N +MNTSW|Momentus Inc. - Warrant|S|N|N|100|N|N +MNY|MoneyHero Limited - Class A Ordinary Shares|G|N|N|100|N|N +MNYWW|MoneyHero Limited - Warrants|G|N|N|100|N|N +MNZL|Manzil Russell Halal USA Broad Market ETF|G|N|N|100|Y|N +MOB|Mobilicom Limited - Ordinary Shares|S|N|N|100|N|N +MOBBW|Mobilicom Limited - Warrants|S|N|N|100|N|N +MOBX|Mobix Labs, Inc. - Class A Common Stock|S|N|D|100|N|N +MOBXW|Mobix Labs, Inc. - Warrants|S|N|D|100|N|N +MODD|Modular Medical, Inc. - common stock|S|N|D|100|N|N +MODL|VictoryShares WestEnd U.S. Sector ETF|G|N|N|100|Y|N +MOFG|MidWestOne Financial Group, Inc. - Common Stock|Q|N|N|100|N|N +MOLN|Molecular Partners AG - American Depositary Shares|Q|N|N|100|N|N +MOMO|Hello Group Inc. - American Depositary Shares|Q|N|N|100|N|N +MOOD|Relative Sentiment Tactical Allocation ETF|G|N|N|100|Y|N +MORN|Morningstar, Inc. - Common Stock|Q|N|N|100|N|N +MOVE|Movano Inc. - Common Stock|S|N|D|100|N|N +MPAA|Motorcar Parts of America, Inc. - Common Stock|Q|N|N|100|N|N +MPB|Mid Penn Bancorp - Common Stock|G|N|N|100|N|N +MPG|Leverage Shares 2X Long MP Daily ETF|G|N|N|100|Y|N +MPLT|MapLight Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +MPWR|Monolithic Power Systems, Inc. - Common Stock|Q|N|N|40|N|N +MQ|Marqeta, Inc. - Class A Common Stock|Q|N|N|100|N|N +MQQQ|Tradr 2X Long Innovation 100 Monthly ETF|G|N|N|100|Y|N +MRAL|GraniteShares 2x Long MARA Daily ETF|G|N|N|100|Y|N +MRAM|Everspin Technologies, Inc. - Common Stock|G|N|N|100|N|N +MRBK|Meridian Corporation - Common Stock|Q|N|N|100|N|N +MRCC|Monroe Capital Corporation - Closed End Fund|Q|N|N|100|N|N +MRCY|Mercury Systems Inc - Common Stock|Q|N|N|100|N|N +MREO|Mereo BioPharma Group plc - American Depositary Shares|S|N|N|100|N|N +MRKR|Marker Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +MRM|MEDIROM Healthcare Technologies Inc. - American Depositary Share|S|N|N|100|N|N +MRNA|Moderna, Inc. - Common Stock|Q|N|N|100|N|N +MRNO|Murano Global Investments PLC - Ordinary Shares|S|N|N|100|N|N +MRNOW|Murano Global Investments PLC - Warrants|S|N|N|100|N|N +MRTN|Marten Transport, Ltd. - Common Stock|Q|N|N|100|N|N +MRVI|Maravai LifeSciences Holdings, Inc. - Class A common stock|Q|N|N|100|N|N +MRVL|Marvell Technology, Inc. - Common Stock|Q|N|N|100|N|N +MRX|Marex Group plc - Ordinary Shares|Q|N|N|100|N|N +MSAI|MultiSensor AI Holdings, Inc. - Common Stock|S|N|D|100|N|N +MSAIW|MultiSensor AI Holdings, Inc. - Warrants|S|N|N|100|N|N +MSBI|Midland States Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +MSBIP|Midland States Bancorp, Inc. - Depositary Shares Each Representing a 1/40th Interest in a Share of 7.750% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series A|Q|N|N|100|N|N +MSDD|GraniteShares 2x Short MSTR Daily ETF|G|N|N|100|Y|N +MSEX|Middlesex Water Company - Common Stock|Q|N|N|100|N|N +MSFD|Direxion Daily MSFT Bear 1X Shares|G|N|N|100|Y|N +MSFL|GraniteShares 2x Long MSFT Daily ETF|G|N|N|100|Y|N +MSFT|Microsoft Corporation - Common Stock|Q|N|N|40|N|N +MSFU|Direxion Daily MSFT Bull 2X Shares|G|N|N|100|Y|N +MSGM|Motorsport Games Inc. - Class A Common Stock|S|N|N|100|N|N +MSGY|Masonglory Limited - Ordinary Shares|S|N|N|100|N|N +MSS|Maison Solutions Inc. - Class A Common Stock|S|N|D|100|N|N +MST|Defiance Leveraged Long + Income MSTR ETF|G|N|N|100|Y|N +MSTP|GraniteShares 2x Long MSTR Daily ETF|G|N|N|100|Y|N +MSTR|Strategy Inc - Class A Common Stock|Q|N|N|40|N|N +MSTX|Defiance Daily Target 2x Long MSTR ETF|G|N|N|100|Y|N +MSW|Ming Shing Group Holdings Limited - Ordinary Shares|S|N|N|100|N|N +MTC|MMTec, Inc. - Common Shares|S|N|N|100|N|N +MTCH|Match Group, Inc. - Common Stock|Q|N|N|100|N|N +MTEK|Maris-Tech Ltd. - ordinary shares|S|N|N|100|N|N +MTEKW|Maris-Tech Ltd. - Warrants|S|N|N|100|N|N +MTEN|Mingteng International Corporation Inc. - Class A Ordinary Shares|S|N|N|100|N|N +MTEX|Mannatech, Incorporated - Common Stock|S|N|N|100|N|N +MTLS|Materialise NV - American Depositary Shares|Q|N|N|100|N|N +MTRX|Matrix Service Company - Common Stock|Q|N|N|100|N|N +MTSI|MACOM Technology Solutions Holdings, Inc. - Common Stock|Q|N|N|100|N|N +MTVA|MetaVia Inc. - Common Stock|S|N|N|100|N|N +MTYY|GraniteShares YieldBOOST MSTR ETF|G|N|N|100|Y|N +MU|Micron Technology, Inc. - Common Stock|Q|N|N|100|N|N +MUD|Direxion Daily MU Bear 1X Shares|G|N|N|100|Y|N +MULL|GraniteShares 2x Long MU Daily ETF|G|N|N|100|Y|N +MULT|Franklin Multisector Income ETF|G|N|N|100|Y|N +MUU|Direxion Daily MU Bull 2X Shares|G|N|N|100|Y|N +MVBF|MVB Financial Corp. - Common Stock|S|N|N|100|N|N +MVIS|MicroVision, Inc. - Common Stock|G|N|D|100|N|N +MVLL|GraniteShares 2x Long MRVL Daily ETF|G|N|N|100|Y|N +MVST|Microvast Holdings, Inc. - Common Stock|S|N|N|100|N|N +MVSTW|Microvast Holdings, Inc. - Warrant|S|N|N|100|N|N +MWYN|Marwynn Holdings, Inc. - Common stock|S|N|N|100|N|N +MXCT|MaxCyte, Inc. - Common Stock|Q|N|N|100|N|N +MXL|MaxLinear, Inc - Common Stock|Q|N|N|100|N|N +MYCF|State Street My2026 Corporate Bond ETF|G|N|N|100|Y|N +MYCG|State Street My2027 Corporate Bond ETF|G|N|N|100|Y|N +MYCH|State Street My2028 Corporate Bond ETF|G|N|N|100|Y|N +MYCI|State Street My2029 Corporate Bond ETF|G|N|N|100|Y|N +MYCJ|State Street My2030 Corporate Bond ETF|G|N|N|100|Y|N +MYCK|State Street My2031 Corporate Bond ETF|G|N|N|100|Y|N +MYCL|State Street My2032 Corporate Bond ETF|G|N|N|100|Y|N +MYCM|State Street My2033 Corporate Bond ETF|G|N|N|100|Y|N +MYCN|State Street My2034 Corporate Bond ETF|G|N|N|100|Y|N +MYCO|State Street My2035 Corporate Bond ETF|G|N|N|100|Y|N +MYFW|First Western Financial, Inc. - Common Stock|Q|N|N|100|N|N +MYGN|Myriad Genetics, Inc. - Common Stock|Q|N|N|100|N|N +MYMF|State Street My2026 Municipal Bond ETF|G|N|N|100|Y|N +MYMG|State Street My2027 Municipal Bond ETF|G|N|N|100|Y|N +MYMH|State Street My2028 Municipal Bond ETF|G|N|N|100|Y|N +MYMI|State Street My2029 Municipal Bond ETF|G|N|N|100|Y|N +MYMJ|State Street My2030 Municipal Bond ETF|G|N|N|100|Y|N +MYMK|State Street My2031 Municipal Bond ETF|G|N|N|100|Y|N +MYNZ|Mainz Biomed N.V. - Ordinary Shares|S|N|N|100|N|N +MYPS|PLAYSTUDIOS, Inc. - Class A Common Stock|G|N|D|100|N|N +MYPSW|PLAYSTUDIOS, Inc. - Warrant|G|N|N|100|N|N +MYRG|MYR Group, Inc. - Common Stock|Q|N|N|100|N|N +MYSE|Myseum, Inc. - Common Stock|S|N|N|100|N|N +MYSEW|Myseum, Inc. - Series A Warrant|S|N|N|100|N|N +MYSZ|My Size, Inc. - Common Stock|S|N|N|100|N|N +MZTI|The Marzetti Company - Common Stock|Q|N|N|100|N|N +NA|Nano Labs Ltd - Class A Ordinary Shares|G|N|N|100|N|N +NAAS|NaaS Technology Inc. - American Depositary Shares|S|N|N|100|N|N +NAGE|Niagen Bioscience, Inc. - Common Stock|S|N|N|100|N|N +NAII|Natural Alternatives International, Inc. - Common Stock|G|N|N|100|N|N +NAKA|Nakamoto Inc. - Common Stock|G|N|D|100|N|N +NAMI|Jinxin Technology Holding Company - American Depositary Shares|S|N|N|100|N|N +NAMM|Namib Minerals - Ordinary Shares|G|N|N|100|N|N +NAMMW|Namib Minerals - Warrants|S|N|N|100|N|N +NAMS|NewAmsterdam Pharma Company N.V. - Ordinary Shares|G|N|N|100|N|N +NAMSW|NewAmsterdam Pharma Company N.V. - Warrant|G|N|N|100|N|N +NATH|Nathan's Famous, Inc. - Common Stock|Q|N|N|100|N|N +NATO|Themes Transatlantic Defense ETF|G|N|N|100|Y|N +NATR|Nature's Sunshine Products, Inc. - Common Stock|S|N|N|100|N|N +NAUT|Nautilus Biotechnology, Inc. - Common Stock|S|N|N|100|N|N +NAVI|Navient Corporation - Common Stock|Q|N|N|100|N|N +NAVN|Navan, Inc. - Class A Common Stock|Q|N|N|100|N|N +NB|NioCorp Developments Ltd. - Common Stock|G|N|N|100|N|N +NBBK|NB Bancorp, Inc. - Common Stock|S|N|N|100|N|N +NBIG|Leverage Shares 2X Long NBIS Daily ETF|G|N|N|100|Y|N +NBIL|GraniteShares 2x Long NBIS Daily ETF|G|N|N|100|Y|N +NBIS|Nebius Group N.V. - Class A Ordinary Shares|Q|N|N|100|N|N +NBIX|Neurocrine Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +NBN|Northeast Bank - Common Stock|G|N|N|100|N|N +NBP|NovaBridge Biosciences - American Depositary Shares|G|N|N|100|N|N +NBTB|NBT Bancorp Inc. - Common Stock|Q|N|N|100|N|N +NBTX|Nanobiotix S.A. - ADSs|Q|N|N|100|N|N +NCEL|NewcelX Ltd. - Ordinary Shares|S|N|N|100|N|N +NCEW|New Century Logistics Limited - Ordinary Shares|S|N|N|100|N|N +NCI|Neo-Concept International Group Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +NCIQ|Hashdex Nasdaq Crypto Index US ETF|G|N|N|100|Y|N +NCMI|National CineMedia, Inc. - Common Stock|Q|N|N|100|N|N +NCNA|NuCana plc - American Depositary Shares|S|N|N|100|N|N +NCNO|nCino, Inc. - Common Stock|Q|N|N|100|N|N +NCPB|Nuveen Core Plus Bond ETF|G|N|N|100|Y|N +NCPL|Netcapital Inc. - Common Stock|S|N|N|100|N|N +NCPLW|Netcapital Inc. - warrants|S|N|N|100|N|N +NCRA|Nocera, Inc. - common stock|S|N|N|100|N|N +NCSM|NCS Multistage Holdings, Inc. - Common Stock|S|N|N|100|N|N +NCT|Intercont (Cayman) Limited - Class A Ordinary shares|S|N|D|100|N|N +NCTY|The9 Limited - American Depository Shares|S|N|N|100|N|N +NDAA|Ned Davis Research 360 Dynamic Allocation ETF|G|N|N|100|Y|N +NDAQ|Nasdaq, Inc. - Common Stock|Q|N|N|100|N|N +NDLS|Noodles & Company - Common Stock|Q|N|D|100|N|N +NDRA|ENDRA Life Sciences Inc. - Common Stock|S|N|N|100|N|N +NDSN|Nordson Corporation - Common Stock|Q|N|N|100|N|N +NECB|NorthEast Community Bancorp, Inc. - Common Stock|S|N|N|100|N|N +NEGG|Newegg Commerce, Inc. - Common Shares|S|N|N|100|N|N +NEMG|Leverage Shares 2x Long NEM Daily ETF|G|N|N|100|Y|N +NEO|NeoGenomics, Inc. - Common Stock|S|N|N|100|N|N +NEOG|Neogen Corporation - Common Stock|Q|N|N|100|N|N +NEON|Neonode Inc. - Common Stock|S|N|N|100|N|N +NEOV|NeoVolta Inc. - Common Stock|S|N|N|100|N|N +NEOVW|NeoVolta Inc. - Warrant|S|N|N|100|N|N +NEPH|Nephros, Inc. - Common Stock|S|N|N|100|N|N +NERV|Minerva Neurosciences, Inc - Common Stock|S|N|N|100|N|N +NESR|National Energy Services Reunited Corp - Ordinary Shares|S|N|N|100|N|N +NETG|Leverage Shares 2X Long NET Daily ETF|G|N|N|100|Y|N +NEUP|Neuphoria Therapeutics Inc. - Common Stock|G|N|N|100|N|N +NEWT|NewtekOne, Inc. - Common Stock|G|N|N|100|N|N +NEWTG|NewtekOne, Inc. - 8.50% Fixed Rate Senior Notes due 2029|G|N|N|100|N|N +NEWTH|NewtekOne, Inc. - 8.625% Fixed Rate Senior Notes due 2029|G|N|N|100|N|N +NEWTI|NewtekOne, Inc. - 8.00% Fixed Rate Senior Notes due 2028|G|N|N|100|N|N +NEWTO|NewtekOne, Inc. - 8.50% Fixed Rate Senior Notes due 2031|G|N|N|100|N|N +NEWTP|NewtekOne, Inc. - Depositary Shares, Each Representing a 1/40th Interest in a Share of 8.500% Fixed Rate Reset Non-Cumulative Perpetual Preferred Stock, Series B|G|N|N|100|N|N +NEWTZ|NewtekOne, Inc. - 5.50% Notes Due 2026|G|N|N|100|N|N +NEWZ|StockSnips AI-Powered Sentiment US All Cap ETF|G|N|N|100|Y|N +NEXM|NexMetals Mining Corp. - Common Stock|S|N|N|100|N|N +NEXN|Nexxen International Ltd. - Ordinary Shares|G|N|N|100|N|N +NEXT|NextDecade Corporation - Common Stock|S|N|N|100|N|N +NFBK|Northfield Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +NFE|New Fortress Energy Inc. - Class A Common Stock|Q|N|N|100|N|N +NFLX|Netflix, Inc. - Common Stock|Q|N|N|10|N|N +NFTY|First Trust India Nifty 50 Equal Weight ETF|G|N|N|100|Y|N +NFXL|Direxion Daily NFLX Bull 2X Shares|G|N|N|100|Y|N +NFXS|Direxion Daily NFLX Bear 1X Shares|G|N|N|100|Y|N +NGEN|NervGen Pharma Corp. - Common stock|S|N|N|100|N|N +NGNE|Neurogene Inc. - Common Stock|G|N|N|100|N|N +NHIC|NewHold Investment Corp III - Class A Ordinary shares|G|N|N|100|N|N +NHICU|NewHold Investment Corp III - Units|G|N|N|100|N|N +NHICW|NewHold Investment Corp III - Warrants|G|N|N|100|N|N +NHPAP|National Healthcare Properties, Inc. - 7.375% Series A Cumulative Redeemable Perpetual Preferred Stock|G|N|N|100|N|N +NHPBP|National Healthcare Properties, Inc. - 7.125% Series B Cumulative Redeemable Perpetual Preferred Stock|G|N|N|100|N|N +NHTC|Natural Health Trends Corp. - Commn Stock|S|N|N|100|N|N +NICE|NICE Ltd - American Depositary Shares each representing one Ordinary Share|Q|N|N|100|N|N +NIKL|Sprott Nickel Miners ETF|G|N|N|100|Y|N +NIOBW|NioCorp Developments Ltd. - Warrant|S|N|N|100|N|N +NIOG|Leverage Shares 2X Long NIO Daily ETF|G|N|N|100|Y|N +NIPG|NIP Group Inc. - American Depositary Shares|G|N|N|100|N|N +NISN|NiSun Intl Enterprise Development Group Co, Ltd - Class A Common Shares|S|N|N|100|N|N +NITO|N2OFF, Inc. - Common Stock|S|N|N|100|N|N +NIU|Niu Technologies - American Depositary Shares|G|N|N|100|N|N +NIVF|NewGenIvf Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +NIVFW|NewGenIvf Group Limited - Warrants|S|N|N|100|N|N +NIXT|Research Affiliates Deletions ETF|G|N|N|100|Y|N +NIXX|Nixxy, Inc. - Common Stock|S|N|N|100|N|N +NIXXW|Nixxy, Inc. - Warrant|S|N|N|100|N|N +NKLR|Terra Innovatum Global N.V. - Ordinary shares|G|N|N|100|N|N +NKSH|National Bankshares, Inc. - Common Stock|S|N|N|100|N|N +NKTR|Nektar Therapeutics - Common Stock|S|N|N|100|N|N +NKTX|Nkarta, Inc. - Common Stock|Q|N|N|100|N|N +NMFC|New Mountain Finance Corporation - Common Stock|Q|N|N|100|N|N +NMFCZ|New Mountain Finance Corporation - 8.250% Notes due 2028|G|N|N|100|N|N +NMIH|NMI Holdings Inc - Common Stock|G|N|N|100|N|N +NMP|NMP Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +NMPAR|NMP Acquisition Corp. - Right|G|N|N|100|N|N +NMPAU|NMP Acquisition Corp. - Units|G|N|N|100|N|N +NMRA|Neumora Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +NMRK|Newmark Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +NMTC|NeuroOne Medical Technologies Corporation - Common Stock|S|N|D|100|N|N +NN|NextNav Inc. - Common stock|S|N|N|100|N|N +NNAVW|NextNav Inc. - Warrant|S|N|N|100|N|N +NNBR|NN, Inc. - Common Stock|Q|N|N|100|N|N +NNDM|Nano Dimension Ltd. - American Depositary Shares|S|N|N|100|N|N +NNE|Nano Nuclear Energy Inc. - common stock|S|N|N|100|N|N +NNNN|Anbio Biotechnology - Class A Ordinary Shares|G|N|N|100|N|N +NNOX|NANO-X IMAGING LTD - Ordinary Shares|G|N|N|100|N|N +NODK|NI Holdings, Inc. - Common Stock|S|N|N|100|N|N +NOEM|CO2 Energy Transition Corp. - Common Stock|G|N|N|100|N|N +NOEMR|CO2 Energy Transition Corp. - Right|G|N|N|100|N|N +NOEMU|CO2 Energy Transition Corp. - Unit|G|N|N|100|N|N +NOEMW|CO2 Energy Transition Corp. - Warrant|G|N|N|100|N|N +NOMA|NOMADAR Corp. - Class A Common Stock|S|N|N|100|N|N +NOTV|Inotiv, Inc. - Common Stock|S|N|D|100|N|N +NOVT|Novanta Inc. - Common Shares|Q|N|N|100|N|N +NOVTU|Novanta Inc. - Tangible Equity Units|Q|N|N|100|N|N +NOWL|GraniteShares 2x Long NOW Daily ETF|G|N|N|100|Y|N +NPAC|New Providence Acquisition Corp. III - Ordinary Shares|G|N|N|100|N|N +NPACU|New Providence Acquisition Corp. III - Units|G|N|N|100|N|N +NPACW|New Providence Acquisition Corp. III - Warrants|G|N|N|100|N|N +NPCE|Neuropace, Inc. - Common Stock|G|N|N|100|N|N +NPFI|Nuveen Preferred and Income ETF|G|N|N|100|Y|N +NPT|Texxon Holding Limited - Ordinary shares|S|N|N|100|N|N +NRC|National Research Corporation - Common Stock|Q|N|N|100|N|N +NRDS|NerdWallet, Inc. - Class A Common Stock|G|N|N|100|N|N +NRES|Xtrackers RREEF Global Natural Resources ETF|G|N|N|100|Y|N +NRIM|Northrim BanCorp Inc - Common Stock|Q|N|N|100|N|N +NRIX|Nurix Therapeutics, Inc. - Common stock|G|N|N|100|N|N +NRSN|NeuroSense Therapeutics Ltd. - Ordinary Shares|S|N|N|100|N|N +NRSNW|NeuroSense Therapeutics Ltd. - Warrant|S|N|N|100|N|N +NRXP|NRX Pharmaceuticals, Inc. - Common Stock|S|N|D|100|N|N +NRXPW|NRX Pharmaceuticals, Inc. - Warrant|S|N|D|100|N|N +NSCR|Nuveen Sustainable Core ETF|G|N|N|100|Y|N +NSI|National Security Emerging Markets Index ETF|G|N|N|100|Y|N +NSIT|Insight Enterprises, Inc. - Common Stock|Q|N|N|100|N|N +NSPR|InspireMD Inc. - Common Stock|S|N|N|100|N|N +NSSC|NAPCO Security Technologies, Inc. - Common Stock|Q|N|N|100|N|N +NSTS|NSTS Bancorp, Inc. - Common Stock|S|N|N|100|N|N +NSYS|Nortech Systems Incorporated - Common Stock|S|N|N|100|N|N +NTAP|NetApp, Inc. - Common Stock|Q|N|N|100|N|N +NTCL|NETCLASS TECHNOLOGY INC - Class A Ordinary Shares|S|N|N|100|N|N +NTCT|NetScout Systems, Inc. - Common Stock|Q|N|N|100|N|N +NTES|NetEase, Inc. - American Depositary Shares, each representing 5 ordinary shares|Q|N|N|100|N|N +NTGR|NETGEAR, Inc. - Common Stock|Q|N|N|100|N|N +NTHI|NeOnc Technologies Holdings, Inc. - Common Stock|G|N|N|100|N|N +NTIC|Northern Technologies International Corporation - Common Stock|G|N|N|100|N|N +NTLA|Intellia Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +NTNX|Nutanix, Inc. - Class A Common Stock|Q|N|N|100|N|N +NTRA|Natera, Inc. - Common Stock|Q|N|N|100|N|N +NTRB|Nutriband Inc. - Common Stock|S|N|N|100|N|N +NTRBW|Nutriband Inc. - Warrant|S|N|N|100|N|N +NTRP|NextTrip, Inc. - Common Stock|S|N|N|100|N|N +NTRS|Northern Trust Corporation - Common Stock|Q|N|N|100|N|N +NTRSO|Northern Trust Corporation - Depositary Shares Each Representing a 1/1,000th Interest in a Share of Series E Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +NTSK|Netskope, Inc. - Class A Common Stock|Q|N|N|100|N|N +NTWK|NETSOL Technologies Inc. - Common Stock|S|N|N|100|N|N +NTWO|Newbury Street II Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +NTWOU|Newbury Street II Acquisition Corp - Unit|G|N|N|100|N|N +NTWOW|Newbury Street II Acquisition Corp - Warrant|G|N|N|100|N|N +NUAI|New Era Energy & Digital, Inc. - Common Stock|G|N|N|100|N|N +NUAIW|New Era Energy & Digital, Inc. - Warrants|S|N|N|100|N|N +NUG|Leverage Shares 2X Long NU Daily ETF|G|N|N|100|Y|N +NUGY|GraniteShares YieldBOOST Gold Miners ETF|G|N|N|100|Y|N +NUKK|Nukkleus Inc. - Ordinary Shares|G|N|N|100|N|N +NUKKW|Nukkleus Inc. - Warrants|S|N|N|100|N|N +NUSB|Nuveen Ultra Short Income ETF|G|N|N|100|Y|N +NUTR|Nusatrip Incorporated - Common Stock|S|N|N|100|N|N +NUTX|Nutex Health Inc. - Common Stock|S|N|N|100|N|N +NUVL|Nuvalent, Inc. - Class A Common Stock|Q|N|N|100|N|N +NUWE|Nuwellis, Inc. - Common Stock|S|N|N|100|N|N +NVA|Nova Minerals Limited - American Depositary Shares|S|N|N|100|N|N +NVAWW|Nova Minerals Limited - Warrant|S|N|N|100|N|N +NVAX|Novavax, Inc. - Common Stock|Q|N|N|100|N|N +NVCR|NovoCure Limited - Ordinary Shares|Q|N|N|100|N|N +NVCT|Nuvectis Pharma, Inc. - Common Stock|S|N|N|100|N|N +NVD|GraniteShares 2x Short NVDA Daily ETF|G|N|N|100|Y|N +NVDA|NVIDIA Corporation - Common Stock|Q|N|N|100|N|N +NVDD|Direxion Daily NVDA Bear 1X Shares|G|N|N|100|Y|N +NVDG|Leverage Shares 2X Long NVDA Daily ETF|G|N|N|100|Y|N +NVDL|GraniteShares 2x Long NVDA Daily ETF|G|N|N|100|Y|N +NVDS|Tradr 1.5X Short NVDA Daily ETF|G|N|N|100|Y|N +NVDU|Direxion Daily NVDA Bull 2X Shares|G|N|N|100|Y|N +NVEC|NVE Corporation - Common Stock|S|N|N|100|N|N +NVMI|Nova Ltd. - Ordinary Shares|Q|N|N|40|N|N +NVNI|Nvni Group Limited - Ordinary Shares|S|N|N|100|N|N +NVNIW|Nvni Group Limited - Warrants|S|N|N|100|N|N +NVNO|enVVeno Medical Corporation - Common Stock|S|N|D|100|N|N +NVTS|Navitas Semiconductor Corporation - Common Stock|G|N|N|100|N|N +NVVE|Nuvve Holding Corp. - Common Stock|S|N|N|100|N|N +NVVEW|Nuvve Holding Corp. - Warrant|S|N|N|100|N|N +NVX|NOVONIX Limited - American Depository Shares|G|N|N|100|N|N +NVYY|GraniteShares YieldBOOST NVDA ETF|G|N|N|100|Y|N +NWBI|Northwest Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +NWE|NorthWestern Energy Group, Inc. - Common Stock|Q|N|N|100|N|N +NWFL|Norwood Financial Corp. - Common Stock|G|N|N|100|N|N +NWGL|CL Workshop Group Limited - American Depositary Shares|S|N|N|100|N|N +NWL|Newell Brands Inc. - Common Stock|Q|N|N|100|N|N +NWPX|NWPX Infrastructure, Inc. - Common Stock|Q|N|N|100|N|N +NWS|News Corporation - Class B Common Stock|Q|N|N|100|N|N +NWSA|News Corporation - Class A Common Stock|Q|N|N|100|N|N +NWTG|Newton Golf Company, Inc. - Common Stock|S|N|D|100|N|N +NXGL|NexGel, Inc - Common Stock|S|N|N|100|N|N +NXGLW|NexGel, Inc - Warrant|S|N|N|100|N|N +NXL|Nexalin Technology, Inc. - Common Stock|S|N|D|100|N|N +NXPI|NXP Semiconductors N.V. - Common Stock|Q|N|N|100|N|N +NXPL|NextPlat Corp - Common Stock|S|N|D|100|N|N +NXPLW|NextPlat Corp - Warrants|S|N|N|100|N|N +NXST|Nexstar Media Group, Inc. - Common Stock|Q|N|N|100|N|N +NXT|Nextpower Inc. - Class A Common Stock|Q|N|N|100|N|N +NXTC|NextCure, Inc. - Common Stock|Q|N|N|100|N|N +NXTG|First Trust Indxx NextG ETF|G|N|N|100|Y|N +NXTT|Next Technology Holding Inc. - Ordinary Shares|S|N|N|100|N|N +NXXT|NextNRG, Inc. - Common Stock|S|N|N|100|N|N +NYAX|Nayax Ltd. - Ordinary Shares|Q|N|N|100|N|N +NYXH|Nyxoah SA - Ordinary Shares|G|N|N|100|N|N +NZAC|SPDR MSCI ACWI Climate Paris Aligned ETF|G|N|N|100|Y|N +NZUS|State Street SPDR MSCI USA Climate Paris Aligned ETF|G|N|N|100|Y|N +OABI|OmniAb, Inc. - Common Stock|G|N|N|100|N|N +OABIW|OmniAb, Inc. - Warrant|S|N|N|100|N|N +OACC|Oaktree Acquisition Corp. III Life Sciences - Class A Ordinary Share|G|N|N|100|N|N +OACCU|Oaktree Acquisition Corp. III Life Sciences - Unit|G|N|N|100|N|N +OACCW|Oaktree Acquisition Corp. III Life Sciences - Warrant|G|N|N|100|N|N +OAKU|Oak Woods Acquisition Corporation - Class A Ordinary Shares|S|N|D|100|N|N +OAKUR|Oak Woods Acquisition Corporation - Right|S|N|D|100|N|N +OAKUU|Oak Woods Acquisition Corporation - Unit|S|N|D|100|N|N +OAKUW|Oak Woods Acquisition Corporation - Warrant|S|N|D|100|N|N +OBA|Oxley Bridge Acquisition Limited - Class A Ordinary Shares|G|N|N|100|N|N +OBAWU|Oxley Bridge Acquisition Limited - Unit|G|N|N|100|N|N +OBAWW|Oxley Bridge Acquisition Limited - Warrants|G|N|N|100|N|N +OBIL|US Treasury 12 Month Bill ETF|G|N|N|100|Y|N +OBIO|Orchestra BioMed Holdings, Inc. - Ordinary Shares|G|N|N|100|N|N +OBT|Orange County Bancorp, Inc. - Common Stock|S|N|N|100|N|N +OBTC|Osprey Bitcoin Trust|G|N|N|100|Y|N +OCC|Optical Cable Corporation - Common Stock|G|N|N|100|N|N +OCCI|OFS Credit Company, Inc. - Closed End Fund|S|N|N|100|N|N +OCCIM|OFS Credit Company, Inc. - 7.875% Series F Term Preferred Stock|S|N|N|100|N|N +OCCIN|OFS Credit Company, Inc. - 5.25% Series E Term Preferred Stock Due 2026|S|N|N|100|N|N +OCCIO|OFS Credit Company, Inc. - 6.125% Series C Term Preferred Stock|S|N|N|100|N|N +OCFC|OceanFirst Financial Corp. - Common Stock|Q|N|N|100|N|N +OCG|Oriental Culture Holding LTD - Ordinary Shares|S|N|N|100|N|N +OCGN|Ocugen, Inc. - Common Stock|S|N|N|100|N|N +OCS|Oculis Holding AG - Ordinary shares|G|N|N|100|N|N +OCSAW|Oculis Holding AG - Warrants|G|N|N|100|N|N +OCSL|Oaktree Specialty Lending Corporation - Closed End Fund|Q|N|N|100|N|N +OCUL|Ocular Therapeutix, Inc. - Common Stock|G|N|N|100|N|N +ODD|ODDITY Tech Ltd. - Class A Ordinary Shares|G|N|N|100|N|N +ODDS|Pacer BlueStar Digital Entertainment ETF|G|N|N|100|Y|N +ODFL|Old Dominion Freight Line, Inc. - Common Stock|Q|N|N|100|N|N +ODVWZ|Osisko Development Corp. - Warrant|S|N|N|100|N|N +ODYS|Odysight.ai Inc. - Common Stock|S|N|N|100|N|N +OESX|Orion Energy Systems, Inc. - Common Stock|S|N|N|100|N|N +OFAL|OFA Group - Class A Ordinary Shares|S|N|D|100|N|N +OFIX|Orthofix Medical Inc. - Common Stock|Q|N|N|100|N|N +OFLX|Omega Flex, Inc. - Common Stock|G|N|N|100|N|N +OFS|OFS Capital Corporation - Closed End Fund|Q|N|N|100|N|N +OFSSH|OFS Capital Corporation - 4.95% Notes due 2028|Q|N|N|100|N|N +OFSSO|OFS Capital Corporation - 7.50% Notes due 2028|G|N|N|100|N|N +OGI|Organigram Global Inc. - Common Shares|Q|N|N|100|N|N +OIMAU|OneIM Acquisition Corp. - Units|G|N|N|100|N|N +OKLL|Defiance Daily Target 2x Long OKLO ETF|G|N|N|100|Y|N +OKTA|Okta, Inc. - Class A Common Stock|Q|N|N|100|N|N +OKTG|Leverage Shares 2X Long OKTA Daily ETF|G|N|N|100|Y|N +OKUR|OnKure Therapeutics, Inc. - Class A Common Stock|G|N|N|100|N|N +OKYO|OKYO Pharma Limited - Ordinary Shares|S|N|N|100|N|N +OLB|The OLB Group, Inc. - Common Stock|S|N|N|100|N|N +OLED|Universal Display Corporation - Common Stock|Q|N|N|100|N|N +OLLI|Ollie's Bargain Outlet Holdings, Inc. - Common Stock|G|N|N|100|N|N +OLMA|Olema Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +OLOX|Olenox Industries Inc. - Common Stock|S|N|N|100|N|N +OLPX|Olaplex Holdings, Inc. - Common Stock|Q|N|N|100|N|N +OM|Outset Medical, Inc. - Common Stock|Q|N|N|100|N|N +OMAB|Grupo Aeroportuario del Centro Norte S.A.B. de C.V. - American Depositary Shares each representing 8 Series B shares|Q|N|N|100|N|N +OMCL|Omnicell, Inc. - Common Stock|Q|N|N|100|N|N +OMDA|Omada Health, Inc. - Common Stock|Q|N|N|100|N|N +OMER|Omeros Corporation - Common Stock|G|N|N|100|N|N +OMEX|Odyssey Marine Exploration, Inc. - Common Stock|S|N|N|100|N|N +OMH|Ohmyhome Limited - Class A Ordinary Shares|S|N|N|100|N|N +OMSE|OMS Energy Technologies Inc. - Ordinary Shares|S|N|N|100|N|N +ON|ON Semiconductor Corporation - Common Stock|Q|N|N|100|N|N +ONB|Old National Bancorp - Common Stock|Q|N|N|100|N|N +ONBPO|Old National Bancorp - Depositary Shares, Each Representing a 1/40th Interest in a Share of Series C Preferred Stock|Q|N|N|100|N|N +ONBPP|Old National Bancorp - Depositary Shares, Each Representing a 1/40th Interest in a Share of Series A Preferred Stock|Q|N|N|100|N|N +ONC|BeOne Medicines Ltd. - American Depositary Shares|Q|N|N|40|N|N +ONCH|1RT Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +ONCHU|1RT Acquisition Corp. - Units|G|N|N|100|N|N +ONCHW|1RT Acquisition Corp. - Warrant|G|N|N|100|N|N +ONCO|Onconetix, Inc. - Common Stock|S|N|N|100|N|N +ONCY|Oncolytics Biotech Inc. - Common Shares|S|N|N|100|N|N +ONDG|Leverage Shares 2X Long ONDS Daily ETF|G|N|N|100|Y|N +ONDS|Ondas Inc - Common Stock|S|N|N|100|N|N +ONEG|OneConstruction Group Limited - Ordinary Shares|S|N|N|100|N|N +ONEQ|Fidelity Nasdaq Composite Index ETF|G|N|N|100|Y|N +ONEW|OneWater Marine Inc. - Class A Common Stock|G|N|N|100|N|N +ONFO|Onfolio Holdings Inc. - Common Stock|S|N|D|100|N|N +ONFOW|Onfolio Holdings Inc. - Warrant|S|N|N|100|N|N +ONMD|OneMedNet Corp - Class A Common Stock|S|N|N|100|N|N +ONMDW|OneMedNet Corp - Warrant|S|N|N|100|N|N +OOQB|One One Nasdaq-100 and Bitcoin ETF|G|N|N|100|Y|N +OOSB|One One S&P 500 and Bitcoin ETF|G|N|N|100|Y|N +OPAL|OPAL Fuels Inc. - Class A Common Stock|S|N|N|100|N|N +OPBK|OP Bancorp - Common Stock|G|N|N|100|N|N +OPCH|Option Care Health, Inc. - Common Stock|Q|N|N|100|N|N +OPEG|Leverage Shares 2X Long OPEN Daily ETF|G|N|N|100|Y|N +OPEN|Opendoor Technologies Inc - Common Stock|Q|N|N|100|N|N +OPENL|Opendoor Technologies Inc - Series A Warrants, each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $13.00 per warrant|Q|N|N|100|N|N +OPENW|Opendoor Technologies Inc - Series K Warrants, each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $9.00 per warrant|Q|N|N|100|N|N +OPENZ|Opendoor Technologies Inc - Series Z Warrants, each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $17.00 per warrant|Q|N|N|100|N|N +OPK|Opko Health, Inc. - Common Stock|Q|N|N|100|N|N +OPPJ|WisdomTree Japan Opportunities Fund|G|N|N|100|Y|N +OPRA|Opera Limited - American Depositary Shares|Q|N|N|100|N|N +OPRT|Oportun Financial Corporation - common stock|Q|N|N|100|N|N +OPRX|OptimizeRx Corporation - Common Stock|S|N|N|100|N|N +OPTX|Syntec Optics Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +OPTXW|Syntec Optics Holdings, Inc. - Warrant|S|N|N|100|N|N +OPTZ|Optimize Strategy Index ETF|G|N|N|100|Y|N +OPXS|Optex Systems Holdings, Inc. - Common Stock|S|N|N|100|N|N +ORBS|Eightco Holdings Inc. - Common Stock|S|N|N|100|N|N +ORCS|Direxion Daily ORCL Bear 1X ETF|G|N|N|100|Y|N +ORCU|Direxion Daily ORCL Bull 2X ETF|G|N|N|100|Y|N +ORCX|Defiance Daily Target 2X Long ORCL ETF|G|N|N|100|Y|N +ORGN|Origin Materials, Inc. - Class A Common Stock|S|N|D|100|N|N +ORGNW|Origin Materials, Inc. - Warrant|S|N|N|100|N|N +ORGO|Organogenesis Holdings Inc. - Class A |S|N|N|100|N|N +ORIC|Oric Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +ORIO|Orion Digital Corp. - Common Shares|S|N|N|100|N|N +ORIQ|Origin Investment Corp I - Ordinary Shares|G|N|N|100|N|N +ORIQU|Origin Investment Corp I - Units|G|N|N|100|N|N +ORIQW|Origin Investment Corp I - Redeemable Warrant|G|N|N|100|N|N +ORIS|Oriental Rise Holdings Limited - Ordinary Shares|S|N|N|100|N|N +ORKA|Oruka Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +ORKT|Orangekloud Technology Inc. - Class A Ordinary Shares|S|N|N|100|N|N +ORLG|Leverage Shares 2X Long ORLY Daily ETF|G|N|N|100|Y|N +ORLY|O'Reilly Automotive, Inc. - Common Stock|Q|N|N|100|N|N +ORMP|Oramed Pharmaceuticals Inc. - Common Stock|S|N|N|100|N|N +ORR|Militia Long/Short Equity ETF|G|N|N|100|Y|N +ORRF|Orrstown Financial Services, Inc. - Common Stock|S|N|N|100|N|N +OS|OneStream, Inc. - Class A Common Stock|Q|N|N|100|N|N +OSBC|Old Second Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +OSCG|Leverage Shares 2X Long OSCR Daily ETF|G|N|N|100|Y|N +OSCX|Defiance Daily Target 2x Long OSCR ETF|G|N|N|100|Y|N +OSIS|OSI Systems, Inc. - Common Stock|Q|N|N|100|N|N +OSPN|OneSpan Inc. - Common Stock|S|N|N|100|N|N +OSRH|OSR Holdings, Inc. - Common Stock|S|N|D|100|N|N +OSRHW|OSR Holdings, Inc. - Warrant|S|N|N|100|N|N +OSS|One Stop Systems, Inc. - Common Stock|S|N|N|100|N|N +OST|Ostin Technology Group Co., Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +OSUR|OraSure Technologies, Inc. - Common Stock|Q|N|N|100|N|N +OSW|OneSpaWorld Holdings Limited - Common Shares|S|N|N|100|N|N +OTEX|Open Text Corporation - Common Shares|Q|N|N|100|N|N +OTGA|OTG Acquisition Corp. I - Class A Ordinary Share|G|N|N|100|N|N +OTGAU|OTG Acquisition Corp. I - Unit|G|N|N|100|N|N +OTGAW|OTG Acquisition Corp. I - Warrants|G|N|N|100|N|N +OTGL|OTG Latin America ETF|G|N|N|100|Y|N +OTLK|Outlook Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +OTLY|Oatly Group AB - American Depositary Shares|Q|N|N|100|N|N +OTTR|Otter Tail Corporation - Common Stock|Q|N|N|100|N|N +OUST|Ouster, Inc. - Common Stock|Q|N|N|100|N|N +OUSTZ|Ouster, Inc. - Warrants|S|N|N|100|N|N +OVBC|Ohio Valley Banc Corp. - Common Stock|G|N|N|100|N|N +OVID|Ovid Therapeutics Inc. - Common Stock|S|N|N|100|N|N +OVLY|Oak Valley Bancorp (CA) - Common Stock|S|N|N|100|N|N +OWLS|OBOOK Holdings Inc. - Class A Common Shares|G|N|N|100|N|N +OXBR|Oxbridge Re Holdings Limited - Ordinary Shares|S|N|N|100|N|N +OXBRW|Oxbridge Re Holdings Limited - Warrant|S|N|N|100|N|N +OXLC|Oxford Lane Capital Corp. - Closed End Fund|Q|N|N|100|N|N +OXLCG|Oxford Lane Capital Corp. - 7.95% Notes due 2032|Q|N|N|100|N|N +OXLCI|Oxford Lane Capital Corp. - 8.75% Notes due 2030|Q|N|N|100|N|N +OXLCL|Oxford Lane Capital Corp. - 6.75% Notes due 2031|Q|N|N|100|N|N +OXLCN|Oxford Lane Capital Corp. - 7.125% Series 2029 Term Preferred Stock|Q|N|N|100|N|N +OXLCO|Oxford Lane Capital Corp. - Preferred Stock Shares, 6.00% Series 2029|Q|N|N|100|N|N +OXLCP|Oxford Lane Capital Corp. - 6.25% Series 2027 Term Preferred Shares|Q|N|N|100|N|N +OXLCZ|Oxford Lane Capital Corp. - 5.00% Notes due 2027|Q|N|N|100|N|N +OXSQ|Oxford Square Capital Corp. - Closed End Fund|Q|N|N|100|N|N +OXSQG|Oxford Square Capital Corp. - 5.50% Notes due 2028|Q|N|N|100|N|N +OXSQH|Oxford Square Capital Corp. - 7.75% Notes due 2030|Q|N|N|100|N|N +OYSE|Oyster Enterprises II Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +OYSER|Oyster Enterprises II Acquisition Corp - Rights|G|N|N|100|N|N +OYSEU|Oyster Enterprises II Acquisition Corp - Units|G|N|N|100|N|N +OZEM|Roundhill GLP-1 & Weight Loss ETF|G|N|N|100|Y|N +OZK|Bank OZK - Common Stock|Q|N|N|100|N|N +OZKAP|Bank OZK - 4.625% Series A Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +PAA|Plains All American Pipeline, L.P. - Common Units representing Limited Partner Interests|Q|N|N|100|N|N +PABD|iShares Paris-Aligned Climate Optimized MSCI World ex USA ETF|G|N|N|100|Y|N +PABU|iShares Paris-Aligned Climate Optimized MSCI USA ETF|G|N|N|100|Y|N +PACB|Pacific Biosciences of California, Inc. - Common Stock|Q|N|N|100|N|N +PACH|Pioneer Acquisition I Corp - Class A Ordinary Shares|G|N|N|100|N|N +PACHU|Pioneer Acquisition I Corp - Units|G|N|N|100|N|N +PACHW|Pioneer Acquisition I Corp - Warrants|G|N|N|100|N|N +PAGP|Plains GP Holdings, L.P. - Class A Shares representing limited partner interests|Q|N|N|100|N|N +PAHC|Phibro Animal Health Corporation - Class A Common Stock|G|N|N|100|N|N +PAL|Proficient Auto Logistics, Inc. - Common Stock|Q|N|N|100|N|N +PALD|Direxion Daily PANW Bear 1X Shares|G|N|N|100|Y|N +PALI|Palisade Bio, Inc. - Common Stock|S|N|N|100|N|N +PALU|Direxion Daily PANW Bull 2X Shares|G|N|N|100|Y|N +PAMT|PAMT CORP - Common Stock|G|N|N|100|N|N +PANG|Leverage Shares 2X Long PANW Daily ETF|G|N|N|100|Y|N +PANL|Pangaea Logistics Solutions Ltd. - Common Stock|S|N|N|100|N|N +PANW|Palo Alto Networks, Inc. - Common Stock|Q|N|N|100|N|N +PARK|Park Dental Partners, Inc. - Common Stock|S|N|N|100|N|N +PASG|Passage Bio, Inc. - Common Stock|S|N|N|100|N|N +PASW|Ping An Biomedical Co., Ltd. - Ordinary Shares|S|N|D|100|N|N +PATK|Patrick Industries, Inc. - Common Stock|Q|N|N|100|N|N +PATN|Pacer Nasdaq International Patent Leaders ETF|G|N|N|100|Y|N +PAVM|PAVmed Inc. - Common Stock|S|N|N|100|N|N +PAVS|Paranovus Entertainment Technology Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +PAX|Patria Investments Limited - Class A Common Shares|Q|N|N|100|N|N +PAYO|Payoneer Global Inc. - Common Stock|G|N|N|100|N|N +PAYS|Paysign, Inc. - Common Stock|S|N|N|100|N|N +PAYX|Paychex, Inc. - Common Stock|Q|N|N|100|N|N +PBEU|Portfolio Building Block European Banks Index ETF|G|N|N|100|Y|N +PBFS|Pioneer Bancorp, Inc. - Common Stock|S|N|N|100|N|N +PBHC|Pathfinder Bancorp, Inc. - Common Stock|S|N|N|100|N|N +PBM|Psyence Biomedical Ltd. - Ordinary Shares|S|N|N|100|N|N +PBMWW|Psyence Biomedical Ltd. - Warrant|S|N|N|100|N|N +PBOG|Portfolio Building Block Integrated Oil and Gas and Exploration and Production Index ETF|G|N|N|100|Y|N +PBPH|Portfolio Building Block World Pharma and Biotech Index ETF|G|N|N|100|Y|N +PBQQ|PGIM Laddered Nasdaq-100 Buffer 12 ETF|G|N|N|100|Y|N +PBRG|Leverage Shares 2X Long PBR Daily ETF|G|N|N|100|Y|N +PBYI|Puma Biotechnology Inc - Common Stock|Q|N|N|100|N|N +PC|Premium Catering (Holdings) Limited - Ordinary Shares|S|N|N|100|N|N +PCAP|ProCap Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +PCAPU|ProCap Acquisition Corp - Unit|G|N|N|100|N|N +PCAPW|ProCap Acquisition Corp - Warrant|G|N|N|100|N|N +PCAR|PACCAR Inc. - Common Stock|Q|N|N|100|N|N +PCB|PCB Bancorp - Common Stock|Q|N|N|100|N|N +PCH|PotlatchDeltic Corporation - Common Stock|Q|N|N|100|N|N +PCLA|PicoCELA Inc. - American Depositary Shares|S|N|D|100|N|N +PCMM|BondBloxx Private Credit CLO ETF|G|N|N|100|Y|N +PCRX|Pacira BioSciences, Inc. - Common Stock|Q|N|N|100|N|N +PCSA|Processa Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +PCSC|Perceptive Capital Solutions Corp - Class A Ordinary Shares|G|N|N|100|N|N +PCT|PureCycle Technologies, Inc. - Common stock|S|N|N|100|N|N +PCTTU|PureCycle Technologies, Inc. - Unit|S|N|N|100|N|N +PCTTW|PureCycle Technologies, Inc. - Warrant|S|N|N|100|N|N +PCTY|Paylocity Holding Corporation - Common Stock|Q|N|N|100|N|N +PCVX|Vaxcyte, Inc. - Common Stock|Q|N|N|100|N|N +PCYO|Pure Cycle Corporation - Common Stock|S|N|N|100|N|N +PDBA|Invesco Agriculture Commodity Strategy No K-1 ETF|G|N|N|100|Y|N +PDBC|Invesco Optimum Yield Diversified Commodity Strategy No K-1 ETF|G|N|N|100|Y|N +PDC|Perpetuals.com Ltd - American Depositary Shares|S|N|N|100|N|N +PDD|PDD Holdings Inc. - American Depositary Shares|Q|N|N|100|N|N +PDDL|GraniteShares 2x Long PDD Daily ETF|G|N|N|100|Y|N +PDEX|Pro-Dex, Inc. - Common Stock|S|N|N|100|N|N +PDFS|PDF Solutions, Inc. - Common Stock|Q|N|N|100|N|N +PDLB|Ponce Financial Group, Inc. - Common Stock|G|N|N|100|N|N +PDP|Invesco Dorsey Wright Momentum ETF|G|N|N|100|Y|N +PDSB|PDS Biotechnology Corporation - Common Stock|S|N|N|100|N|N +PDYN|Palladyne AI Corp. - Common stock|G|N|N|100|N|N +PDYNW|Palladyne AI Corp. - Warrant|G|N|N|100|N|N +PEBK|Peoples Bancorp of North Carolina, Inc. - Common Stock|G|N|N|100|N|N +PEBO|Peoples Bancorp Inc. - Common Stock|Q|N|N|100|N|N +PECO|Phillips Edison & Company, Inc. - Common Stock|Q|N|N|100|N|N +PEGA|Pegasystems Inc. - Common Stock|Q|N|N|100|N|N +PELI|Pelican Acquisition Corporation - Ordinary Shares|G|N|N|100|N|N +PELIR|Pelican Acquisition Corporation - Right|G|N|N|100|N|N +PELIU|Pelican Acquisition Corporation - Unit|G|N|N|100|N|N +PENG|Penguin Solutions, Inc. - Common Stock|Q|N|N|100|N|N +PENN|PENN Entertainment, Inc. - Common Stock|Q|N|N|100|N|N +PEP|PepsiCo, Inc. - Common Stock|Q|N|N|100|N|N +PEPG|PepGen Inc. - Common Stock|Q|N|N|100|N|N +PEPS|Parametric Equity Plus ETF|G|N|N|100|Y|N +PERI|Perion Network Ltd - Ordinary Shares|Q|N|N|100|N|N +PESI|Perma-Fix Environmental Services, Inc. - Common Stock|S|N|N|100|N|N +PETS|PetMed Express, Inc. - Common Stock|Q|N|N|100|N|N +PETZ|TDH Holdings, Inc. - Common Shares|S|N|N|100|N|N +PEY|Invesco High Yield Equity Dividend Achievers ETF|G|N|N|100|Y|N +PEZ|Invesco Dorsey Wright Consumer Cyclicals Momentum ETF|G|N|N|100|Y|N +PFAI|Pinnacle Food Group Limited - Class A Common Shares|S|N|N|100|N|N +PFBC|Preferred Bank - Common Stock|Q|N|N|100|N|N +PFDE|Pathfinder Disciplined US Equity ETF|G|N|N|100|Y|N +PFF|iShares Preferred and Income Securities ETF|G|N|N|100|Y|N +PFG|Principal Financial Group Inc - Common Stock|Q|N|N|100|N|N +PFI|Invesco Dorsey Wright Financial Momentum ETF|G|N|N|100|Y|N +PFIS|Peoples Financial Services Corp. - Common Stock|Q|N|N|100|N|N +PFM|Invesco Dividend Achievers ETF|G|N|N|100|Y|N +PFOE|Pathfinder Focused Opportunities ETF|G|N|N|100|Y|N +PFSA|Profusa, Inc. - Common Stock|G|N|D|100|N|N +PFX|PhenixFIN Corporation - Common Stock|G|N|N|100|N|N +PFXNZ|PhenixFIN Corporation - 5.25% Notes due 2028|G|N|N|100|N|N +PGAC|Pantages Capital Acquisition Corporation - Class A Ordinary Shares|G|N|N|100|N|N +PGACR|Pantages Capital Acquisition Corporation - Right|G|N|N|100|N|N +PGACU|Pantages Capital Acquisition Corporation - Unit|G|N|N|100|N|N +PGC|Peapack-Gladstone Financial Corporation - Common Stock|Q|N|N|100|N|N +PGEN|Precigen, Inc. - Common Stock|Q|N|N|100|N|N +PGJ|Invesco Golden Dragon China ETF|G|N|N|100|Y|N +PGNY|Progyny, Inc. - Common Stock|Q|N|N|100|N|N +PGY|Pagaya Technologies Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +PGYWW|Pagaya Technologies Ltd. - Warrants|S|N|N|100|N|N +PHAR|Pharming Group N.V. - ADS, each representing 10 ordinary shares|G|N|N|100|N|N +PHAT|Phathom Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +PHIO|Phio Pharmaceuticals Corp. - Common Stock|S|N|N|100|N|N +PHO|Invesco Water Resources ETF|G|N|N|100|Y|N +PHOE|Phoenix Asia Holdings Limited - Ordinary Shares|S|N|N|100|N|N +PHUN|Phunware, Inc. - Common Stock|S|N|N|100|N|N +PHVS|Pharvaris N.V. - Ordinary Shares|Q|N|N|100|N|N +PI|Impinj, Inc. - Common Stock|Q|N|N|100|N|N +PICS|Picpay Holdings Netherlands N.V. - Class A Common Shares|Q|N|N|100|N|N +PID|Invesco International Dividend Achievers ETF|G|N|N|100|Y|N +PIE|Invesco Dorsey Wright Emerging Markets Momentum ETF|G|N|N|100|Y|N +PIII|P3 Health Partners Inc. - Class A Common Stock|S|N|D|100|N|N +PIIIW|P3 Health Partners Inc. - Warrant|S|N|D|100|N|N +PIO|Invesco Global Water ETF|G|N|N|100|Y|N +PIZ|Invesco Dorsey Wright Developed Markets Momentum ETF|G|N|N|100|Y|N +PKBK|Parke Bancorp, Inc. - Common Stock|S|N|N|100|N|N +PKOH|Park-Ohio Holdings Corp. - Common Stock|Q|N|N|100|N|N +PKW|Invesco BuyBack Achievers ETF|G|N|N|100|Y|N +PLAB|Photronics, Inc. - Common Stock|Q|N|N|100|N|N +PLAY|Dave & Buster's Entertainment, Inc. - Common Stock|Q|N|N|100|N|N +PLBC|Plumas Bancorp - Common Stock|S|N|N|100|N|N +PLBL|Polibeli Group Ltd - Class A Ordinary Shares|G|N|N|100|N|N +PLBY|Playboy, Inc. - Common Stock|G|N|D|100|N|N +PLCE|Children's Place, Inc. (The) - Common Stock|Q|N|N|100|N|N +PLMK|Plum Acquisition Corp. IV - Class A Ordinary Shares|G|N|N|100|N|N +PLMKU|Plum Acquisition Corp. IV - Unit|G|N|N|100|N|N +PLMKW|Plum Acquisition Corp. IV - Warrants|G|N|N|100|N|N +PLMR|Palomar Holdings, Inc. - Common stock|Q|N|N|100|N|N +PLPC|Preformed Line Products Company - Common Stock|Q|N|N|100|N|N +PLRX|Pliant Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +PLRZ|Polyrizon Ltd. - Ordinary Shares|S|N|N|100|N|N +PLSE|Pulse Biosciences, Inc - Common Stock|S|N|N|100|N|N +PLSM|Pulsenmore Ltd. - Ordinary Shares|S|N|N|100|N|N +PLTD|Direxion Daily PLTR Bear 1X Shares|G|N|N|100|Y|N +PLTG|Leverage Shares 2X Long PLTR Daily ETF|G|N|N|100|Y|N +PLTK|Playtika Holding Corp. - Common Stock|Q|N|N|100|N|N +PLTR|Palantir Technologies Inc. - Class A Common Stock|Q|N|N|100|N|N +PLTS|Platinum Analytics Cayman Limited - Class A Ordinary Shares|S|N|N|100|N|N +PLTU|Direxion Daily PLTR Bull 2X Shares|G|N|N|100|Y|N +PLTZ|Defiance Daily Target 2x Short PLTR ETF|G|N|N|100|Y|N +PLUG|Plug Power, Inc. - Common Stock|S|N|N|100|N|N +PLUL|Leverage Shares 2X Long PLUG Daily ETF|G|N|N|100|Y|N +PLUR|Pluri Inc. - Common Stock|S|N|D|100|N|N +PLUS|ePlus inc. - Common Stock|Q|N|N|100|N|N +PLUT|Plutus Financial Group Limited - Ordinary Shares|S|N|N|100|N|N +PLXS|Plexus Corp. - Common Stock|Q|N|N|100|N|N +PLYY|GraniteShares YieldBOOST PLTR ETF|G|N|N|100|Y|N +PMAX|Powell Max Limited - Class A Ordinary Shares|S|N|N|100|N|N +PMBS|PIMCO Mortgage-Backed Securities Active Exchange-Traded Fund|G|N|N|100|Y|N +PMCB|PharmaCyte Biotech, Inc. - Common Stock|S|N|D|100|N|N +PMEC|Primech Holdings Ltd. - Ordinary Shares|S|N|N|100|N|N +PMN|ProMIS Neurosciences Inc. - Common Shares|S|N|N|100|N|N +PMTR|Perimeter Acquisition Corp. I - Class A Ordinary Shares|G|N|N|100|N|N +PMTRU|Perimeter Acquisition Corp. I - Unit|G|N|N|100|N|N +PMTRW|Perimeter Acquisition Corp. I - Warrant|G|N|N|100|N|N +PMTS|CPI Card Group Inc. - Common Stock|G|N|N|100|N|N +PMVP|PMV Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +PN|Skycorp Solar Group Limited - Ordinary Shares|S|N|D|100|N|N +PNBK|Patriot National Bancorp Inc. - Common Stock|G|N|N|100|N|N +PNQI|Invesco Nasdaq Internet ETF|G|N|N|100|Y|N +PNRG|PrimeEnergy Resources Corporation - Common Stock|S|N|N|100|N|N +PNTG|The Pennant Group, Inc. - Common Stock|Q|N|N|100|N|N +POCI|Precision Optics Corporation, Inc. - Common stock|S|N|N|100|N|N +PODC|PodcastOne, Inc. - Common Stock|S|N|N|100|N|N +PODD|Insulet Corporation - Common Stock|Q|N|N|40|N|N +POET|POET Technologies Inc. - Common Shares|S|N|N|100|N|N +POLA|Polar Power, Inc. - Common Stock|S|N|N|100|N|N +POLE|Andretti Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +POLEU|Andretti Acquisition Corp. II - Unit|G|N|N|100|N|N +POLEW|Andretti Acquisition Corp. II - Warrant|G|N|N|100|N|N +POM|POMDOCTOR LIMITED - American Depositary Shares|G|N|N|100|N|N +PONY|Pony AI Inc. - American Depositary Shares|Q|N|N|100|N|N +POOL|Pool Corporation - Common Stock|Q|N|N|40|N|N +POWI|Power Integrations, Inc. - Common Stock|Q|N|N|100|N|N +POWL|Powell Industries, Inc. - Common Stock|Q|N|N|40|N|N +POWW|Outdoor Holding Company - Common Stock|S|N|N|100|N|N +POWWP|Outdoor Holding Company - 8.75% Series A Cumulative Redeemable Perpetual Preferred Stock|S|N|N|100|N|N +PPBT|Purple Biotech Ltd. - American Depositary Shares|S|N|D|100|N|N +PPC|Pilgrim's Pride Corporation - Common Stock|Q|N|N|100|N|N +PPCB|Propanc Biopharma, Inc. - Common Stock|S|N|D|100|N|N +PPH|VanEck Pharmaceutical ETF|G|N|N|100|Y|N +PPHC|Public Policy Holding Company, Inc. - Common Stock|G|N|N|100|N|N +PPI|Astoria Real Assets ETF|G|N|N|100|Y|N +PPIH|Perma-Pipe International Holdings, Inc. - Common Stock|G|N|N|100|N|N +PPSI|Pioneer Power Solutions, Inc. - Common Stock|S|N|N|100|N|N +PPTA|Perpetua Resources Corp. - Common Shares|S|N|N|100|N|N +PQAP|PGIM Nasdaq-100 Buffer 12 ETF - April|G|N|N|100|Y|N +PQJA|PGIM Nasdaq-100 Buffer 12 ETF - January|G|N|N|100|Y|N +PQJL|PGIM Nasdaq-100 Buffer 12 ETF - July|G|N|N|100|Y|N +PQOC|PGIM Nasdaq-100 Buffer 12 ETF - October|G|N|N|100|Y|N +PRAA|PRA Group, Inc. - Common Stock|Q|N|N|100|N|N +PRAX|Praxis Precision Medicines, Inc. - Common Stock|Q|N|N|100|N|N +PRCH|Porch Group, Inc. - Common Stock|S|N|N|100|N|N +PRCT|PROCEPT BioRobotics Corporation - Common Stock|G|N|N|100|N|N +PRDO|Perdoceo Education Corporation - Common Stock|Q|N|N|100|N|N +PRE|Prenetics Global Limited - Class A Ordinary Share|G|N|N|100|N|N +PRENW|Prenetics Global Limited - Warrant|S|N|N|100|N|N +PRFX|PRF Technologies Ltd. - Ordinary Shares|S|N|N|100|N|N +PRFZ|Invesco RAFI US 1500 Small-Mid ETF|G|N|N|100|Y|N +PRGS|Progress Software Corporation - Common Stock|Q|N|N|100|N|N +PRHI|Presurance Holdings, Inc. - Common Stock|S|N|N|100|N|N +PRHIZ|Presurance Holdings, Inc. - 9.75% Senior Unsecured Notes due 2028|G|N|N|100|N|N +PRLD|Prelude Therapeutics Incorporated - Common Stock|Q|N|N|100|N|N +PRME|Prime Medicine, Inc. - Common Stock|G|N|N|100|N|N +PRMR|PeakShares RMR Prime Equity ETF|G|N|N|100|Y|N +PRN|Invesco Dorsey Wright Industrials Momentum ETF|G|N|N|100|Y|N +PROF|Profound Medical Corp. - common stock|S|N|N|100|N|N +PROK|ProKidney Corp. - Class A Ordinary Shares|S|N|N|100|N|N +PROP|Prairie Operating Co. - Common Stock|S|N|N|100|N|N +PROV|Provident Financial Holdings, Inc. - Common Stock|Q|N|N|100|N|N +PRPL|Purple Innovation, Inc. - Common Stock|Q|N|D|100|N|N +PRPO|Precipio, Inc. - Common Stock|S|N|N|100|N|N +PRQR|ProQR Therapeutics N.V. - Ordinary Shares|S|N|N|100|N|N +PRSO|Peraso Inc. - Common Stock|S|N|N|100|N|N +PRTA|Prothena Corporation plc - Ordinary Shares|Q|N|N|100|N|N +PRTC|PureTech Health plc - American Depositary Shares|G|N|N|100|N|N +PRTH|Priority Technology Holdings, Inc. - Common Stock|S|N|N|100|N|N +PRTS|CarParts.com, Inc. - Common Stock|S|N|D|100|N|N +PRVA|Privia Health Group, Inc. - Common Stock|Q|N|N|100|N|N +PRZO|ParaZero Technologies Ltd. - Ordinary Shares|S|N|N|100|N|N +PSC|Principal U.S. Small-Cap ETF|G|N|N|100|Y|N +PSCC|Invesco S&P SmallCap Consumer Staples ETF|G|N|N|100|Y|N +PSCD|Invesco S&P SmallCap Consumer Discretionary ETF|G|N|N|100|Y|N +PSCE|Invesco S&P SmallCap Energy ETF|G|N|N|100|Y|N +PSCF|Invesco S&P SmallCap Financials ETF|G|N|N|100|Y|N +PSCH|Invesco S&P SmallCap Health Care ETF|G|N|N|100|Y|N +PSCI|Invesco S&P SmallCap Industrials ETF|G|N|N|100|Y|N +PSCM|Invesco S&P SmallCap Materials ETF|G|N|N|100|Y|N +PSCT|Invesco S&P SmallCap Information Technology ETF|G|N|N|100|Y|N +PSCU|Invesco S&P SmallCap Utilities & Communication Services ETF|G|N|N|100|Y|N +PSEC|Prospect Capital Corporation - Closed End Fund|Q|N|N|100|N|N +PSET|Principal Quality ETF|G|N|N|100|Y|N +PSHG|Performance Shipping Inc. - Common Shares|S|N|N|100|N|N +PSIG|PS International Group Ltd. - Ordinary Shares|S|N|N|100|N|N +PSIX|Power Solutions International, Inc. - Common Stock|S|N|N|100|N|N +PSKY|Paramount Skydance Corporation - Class B Common Stock|Q|N|N|100|N|N +PSL|Invesco Dorsey Wright Consumer Staples Momentum ETF|G|N|N|100|Y|N +PSMT|PriceSmart, Inc. - Common Stock|Q|N|N|100|N|N +PSNL|Personalis, Inc. - Common Stock|G|N|N|100|N|N +PSNY|Polestar Automotive Holding UK Limited - Class A ADS|G|N|N|100|N|N +PSNYW|Polestar Automotive Holding UK Limited - Class C-1 ADS (ADW)|G|N|N|100|N|N +PSTR|PeakShares Sector Rotation ETF|G|N|N|100|Y|N +PSTV|PLUS THERAPEUTICS, Inc. - Common Stock|S|N|D|100|N|N +PSWD|Xtrackers Cybersecurity Select Equity ETF|G|N|N|100|Y|N +PTC|PTC Inc. - Common Stock|Q|N|N|100|N|N +PTCT|PTC Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +PTEN|Patterson-UTI Energy, Inc. - Common Stock|Q|N|N|100|N|N +PTF|Invesco Dorsey Wright Technology Momentum ETF|G|N|N|100|Y|N +PTGX|Protagonist Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +PTH|Invesco Dorsey Wright Healthcare Momentum ETF|G|N|N|100|Y|N +PTIR|GraniteShares 2x Long PLTR Daily ETF|G|N|N|100|Y|N +PTLE|PTL LTD - Class A Ordinary Shares|S|N|D|100|N|N +PTLO|Portillo's Inc. - Class A Common Stock|Q|N|N|100|N|N +PTNM|Pitanium Limited - Class A Ordinary Shares|S|N|N|100|N|N +PTNQ|Pacer Trendpilot 100 ETF|G|N|N|100|Y|N +PTON|Peloton Interactive, Inc. - Common Stock|Q|N|N|100|N|N +PTORU|Praetorian Acquisition Corp. - Units|G|N|N|100|N|N +PTRN|Pattern Group Inc. - Series A Common Stock|Q|N|N|100|N|N +PUBM|PubMatic, Inc. - Class A Common Stock|G|N|N|100|N|N +PUI|Invesco Dorsey Wright Utilities Momentum ETF|G|N|N|100|Y|N +PULM|Pulmatrix, Inc. - Common Stock|S|N|N|100|N|N +PURR|Hyperliquid Strategies Inc - Common Stock|S|N|N|100|N|N +PVLA|Palvella Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +PWP|Perella Weinberg Partners - Class A Common Stock|Q|N|N|100|N|N +PWRD|TCW Transform Systems ETF|G|N|N|100|Y|N +PXI|Invesco Dorsey Wright Energy Momentum ETF|G|N|N|100|Y|N +PXLW|Pixelworks, Inc. - Common Stock|S|N|N|100|N|N +PXS|Pyxis Tankers Inc. - Common Stock|S|N|N|100|N|N +PY|Principal Value ETF|G|N|N|100|Y|N +PYPD|PolyPid Ltd. - Ordinary Shares|S|N|N|100|N|N +PYPG|Leverage Shares 2X Long PYPL Daily ETF|G|N|N|100|Y|N +PYPL|PayPal Holdings, Inc. - Common Stock|Q|N|N|100|N|N +PYXS|Pyxis Oncology, Inc. - Common Stock|Q|N|N|100|N|N +PYZ|Invesco Dorsey Wright Basic Materials Momentum ETF|G|N|N|100|Y|N +PZZA|Papa John's International, Inc. - Common Stock|Q|N|N|100|N|N +QABA|First Trust NASDAQ ABA Community Bank Index Fund|G|N|N|100|Y|N +QALT|SEI DBi Multi-Strategy Alternative ETF|G|N|N|100|Y|N +QAT|iShares MSCI Qatar ETF|G|N|N|100|Y|N +QB|ProShares Nasdaq-100 Dynamic Buffer ETF|G|N|N|100|Y|N +QBIG|Invesco Top QQQ ETF|G|N|N|100|Y|N +QBTZ|Defiance Daily Target 2x Short QBTS ETF|G|N|N|100|Y|N +QBUF|Innovator Nasdaq-100 10 Buffer ETF Quarterly|G|N|N|100|Y|N +QBY|GraniteShares YieldBoost QBTS ETF|G|N|N|100|Y|N +QCLN|First Trust NASDAQ Clean Edge Green Energy Index Fund|G|N|N|100|Y|N +QCLR|Global X NASDAQ 100 Collar 95-110 ETF|G|N|N|100|Y|N +QCLS|Q/C Technologies, Inc. - Common Stock|S|N|N|100|N|N +QCMD|Direxion Daily QCOM Bear 1X ETF|G|N|N|100|Y|N +QCML|GraniteShares 2x Long QCOM Daily ETF|G|N|N|100|Y|N +QCMU|Direxion Daily QCOM Bull 2X ETF|G|N|N|100|Y|N +QCOM|QUALCOMM Incorporated - Common Stock|Q|N|N|100|N|N +QCRH|QCR Holdings, Inc. - Common Stock|G|N|N|100|N|N +QDEL|QuidelOrtho Corporation - Common Stock|Q|N|N|100|N|N +QDTY|YieldMax Nasdaq 100 0DTE Covered Call Strategy ETF|G|N|N|100|Y|N +QETA|Quetta Acquisition Corporation - Common Stock|G|N|D|100|N|N +QETAR|Quetta Acquisition Corporation - Right|G|N|D|100|N|N +QETAU|Quetta Acquisition Corporation - Unit|G|N|D|100|N|N +QFIN|Qfin Holdings, Inc. - American Depositary Shares|Q|N|N|100|N|N +QGRD|Horizon Nasdaq-100 Defined Risk ETF|G|N|N|100|Y|N +QH|Quhuo Limited - American Depository Shares|G|N|N|100|N|N +QHDG|Innovator Hedged Nasdaq-100 ETF|G|N|N|100|Y|N +QIPT|Quipt Home Medical Corp. - Common Shares|S|N|N|100|N|N +QLDY|Defiance Nasdaq 100 LightningSpread Income ETF|G|N|N|100|Y|N +QLYS|Qualys, Inc. - Common Stock|Q|N|N|100|N|N +QMCO|Quantum Corporation - Common Stock|G|N|N|100|N|N +QMID|WisdomTree U.S. MidCap Quality Growth Fund|G|N|N|100|Y|N +QMMM|QMMM Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +QMOM|Alpha Architect U.S. Quantitative Momentum ETF|G|N|N|100|Y|N +QNCX|Quince Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +QNRX|Quoin Pharmaceuticals, Ltd. - American Depositary Shares|S|N|N|100|N|N +QNST|QuinStreet, Inc. - Common Stock|Q|N|N|100|N|N +QNTM|Quantum Biopharma Ltd. - Class B Subordinate Voting Shares|S|N|N|100|N|N +QNXT|iShares Nasdaq-100 ex Top 30 ETF|G|N|N|100|Y|N +QOWZ|Invesco Nasdaq Free Cash Flow Achievers ETF|G|N|N|100|Y|N +QPUX|Defiance 2X Daily Long Pure Quantum ETF|G|N|N|100|Y|N +QQA|Invesco QQQ Income Advantage ETF|G|N|N|100|Y|N +QQDN|ProShares UltraShort QQQ Mega|G|N|N|100|Y|N +QQEW|First Trust Nasdaq-100 Select Equal Weight ETF|G|N|N|100|Y|N +QQHG|Invesco QQQ Hedged Advantage ETF|G|N|N|100|Y|N +QQJG|Invesco ESG NASDAQ Next Gen 100 ETF|G|N|N|100|Y|N +QQLV|Invesco QQQ Low Volatility ETF|G|N|N|100|Y|N +QQMG|Invesco ESG NASDAQ 100 ETF|G|N|N|100|Y|N +QQQ|Invesco QQQ Trust, Series 1|G|N|N|40|Y|N +QQQA|ProShares Nasdaq-100 Dorsey Wright Momentum ETF|G|N|N|100|Y|N +QQQE|Direxion NASDAQ-100 Equal Weighted Index Shares|G|N|N|100|Y|N +QQQG|Pacer Nasdaq 100 Top 50 Cash Cows Growth Leaders ETF|G|N|N|100|Y|N +QQQH|NEOS Nasdaq-100 Hedged Equity Income ETF|G|N|N|100|Y|N +QQQI|NEOS Nasdaq 100 High Income ETF|G|N|N|100|Y|N +QQQJ|Invesco NASDAQ Next Gen 100 ETF|G|N|N|100|Y|N +QQQM|Invesco NASDAQ 100 ETF|G|N|N|100|Y|N +QQQP|Tradr 2X Long Innovation 100 Quarterly ETF|G|N|N|100|Y|N +QQQS|Invesco NASDAQ Future Gen 200 ETF|G|N|N|100|Y|N +QQQT|Defiance Nasdaq 100 Income Target ETF|G|N|N|100|Y|N +QQQX|Nuveen NASDAQ 100 Dynamic Overwrite Fund - Closed End Fund|Q|N|N|100|N|N +QQQY|Defiance Nasdaq 100 Weekly Distribution ETF|G|N|N|100|Y|N +QQUP|ProShares Ultra QQQ Mega|G|N|N|100|Y|N +QQWZ|Pacer Cash COWZ 100-Nasdaq 100 Rotator ETF|G|N|N|100|Y|N +QQXL|ProShares Ultra QQQ Top 30|G|N|N|100|Y|N +QQXT|First Trust NASDAQ-100 Ex-Technology Sector Index Fund|G|N|N|100|Y|N +QRHC|Quest Resource Holding Corporation - Common Stock|S|N|N|100|N|N +QRMI|Global X NASDAQ 100 Risk Managed Income ETF|G|N|N|100|Y|N +QRVO|Qorvo, Inc. - Common Stock|Q|N|N|100|N|N +QS|QuantumScape Corporation - Common Stock|Q|N|N|100|N|N +QSEA|Quartzsea Acquisition Corporation - Ordinary Shares|G|N|N|100|N|N +QSEAR|Quartzsea Acquisition Corporation - Rights|G|N|N|100|N|N +QSEAU|Quartzsea Acquisition Corporation - Units|G|N|N|100|N|N +QSI|Quantum-Si Incorporated - Class A Common Stock|G|N|N|100|N|N +QSIAW|Quantum-Si Incorporated - Warrant|G|N|N|100|N|N +QSIX|Pacer Metaurus Nasdaq 100 Dividend Multiplier 600 ETF|G|N|N|100|Y|N +QSML|WisdomTree U.S. SmallCap Quality Growth Fund|G|N|N|100|Y|N +QTEC|First Trust NASDAQ-100-Technology Sector Index Fund|G|N|N|100|Y|N +QTI|QT Imaging Holdings, Inc. - Common Stock|S|N|N|100|N|N +QTOP|iShares Nasdaq Top 30 Stocks ETF|G|N|N|100|Y|N +QTR|Global X NASDAQ 100 Tail Risk ETF|G|N|N|100|Y|N +QTRX|Quanterix Corporation - Common Stock|G|N|N|100|N|N +QTTB|Q32 Bio Inc. - Common Stock|S|N|N|100|N|N +QTUM|Defiance Quantum ETF|G|N|N|100|Y|N +QUBT|Quantum Computing Inc. - Common Stock|S|N|N|100|N|N +QUIK|QuickLogic Corporation - Common Stock|S|N|N|100|N|N +QUMS|Quantumsphere Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +QUMSR|Quantumsphere Acquisition Corp. - Rights|G|N|N|100|N|N +QUMSU|Quantumsphere Acquisition Corp. - Units|G|N|N|100|N|N +QURE|uniQure N.V. - Ordinary Shares|Q|N|N|100|N|N +QVAL|Alpha Architect U.S. Quantitative Value ETF|G|N|N|100|Y|N +QVCGA|QVC Group, Inc. - Series A Common Stock|S|N|N|100|N|N +QVCGP|QVC Group, Inc. - 8.0% Fixed Rate Cumulative Redeemable Preferred Stock|S|N|N|100|N|N +QXQ|SGI Enhanced Nasdaq-100 ETF|G|N|N|100|Y|N +QYLD|Global X NASDAQ 100 Covered Call ETF|G|N|N|100|Y|N +QYLG|Global X Nasdaq 100 Covered Call & Growth ETF|G|N|N|100|Y|N +RAA|SMI 3Fourteen REAL Asset Allocation ETF|G|N|N|100|Y|N +RAAQ|Real Asset Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +RAAQU|Real Asset Acquisition Corp. - Unit|G|N|N|100|N|N +RAAQW|Real Asset Acquisition Corp. - Warrants|G|N|N|100|N|N +RADX|Radiopharm Theranostics Limited - American Depositary Shares|S|N|N|100|N|N +RAIL|Freightcar America, Inc. - Common Stock|Q|N|N|100|N|N +RAIN|Rain Enhancement Technologies Holdco, Inc. - Class A Common Stock|S|N|N|100|N|N +RAINW|Rain Enhancement Technologies Holdco, Inc. - Warrants|S|N|N|100|N|N +RAND|Rand Capital Corporation - Closed End Fund|S|N|N|100|N|N +RANG|Range Capital Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +RANGR|Range Capital Acquisition Corp. - Rights|G|N|N|100|N|N +RANGU|Range Capital Acquisition Corp. - Units|G|N|N|100|N|N +RANI|Rani Therapeutics Holdings, Inc. - Class A Common Stock|G|N|N|100|N|N +RAPP|Rapport Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +RAPT|RAPT Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +RARE|Ultragenyx Pharmaceutical Inc. - Common Stock|Q|N|N|100|N|N +RAUS|RACWI US ETF|G|N|N|100|Y|N +RAVE|Rave Restaurant Group, Inc. - Common Stock|S|N|N|100|N|N +RAY|Raytech Holding Limited - Ordinary Shares|S|N|N|100|N|N +RAYA|Erayak Power Solution Group Inc. - Class A Ordinary Shares|S|N|N|100|N|N +RBB|RBB Bancorp - Common Stock|Q|N|N|100|N|N +RBBN|Ribbon Communications Inc. - Common Stock|Q|N|N|100|N|N +RBCAA|Republic Bancorp, Inc. - Class A Common Stock|Q|N|N|100|N|N +RBIL|F/m Ultrashort Treasury Inflation-Protected Security (TIPS) ETF|G|N|N|100|Y|N +RBKB|Rhinebeck Bancorp, Inc. - Common Stock|S|N|N|100|N|N +RBNE|Robin Energy Ltd. - Common Stock|S|N|N|100|N|N +RCAT|Red Cat Holdings, Inc. - Common Stock|S|N|N|100|N|N +RCEL|Avita Medical, Inc. - Common Stock|S|N|N|100|N|N +RCGE|RockCreek Global Equality ETF|G|N|N|100|Y|N +RCKT|Rocket Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +RCKTW|Rocket Pharmaceuticals, Inc. - Warrant|S|N|N|100|N|N +RCKY|Rocky Brands, Inc. - Common Stock|Q|N|N|100|N|N +RCMT|RCM Technologies, Inc. - Common Stock|G|N|N|100|N|N +RCON|Recon Technology, Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +RCT|RedCloud Holdings plc - Ordinary Shares|S|N|N|100|N|N +RDAC|Rising Dragon Acquisition Corp. - Ordinary Shares|S|N|N|100|N|N +RDACR|Rising Dragon Acquisition Corp. - Rights|S|N|N|100|N|N +RDACU|Rising Dragon Acquisition Corp. - Unit|S|N|N|100|N|N +RDAG|Republic Digital Acquisition Company - Class A Ordinary Shares|G|N|N|100|N|N +RDAGU|Republic Digital Acquisition Company - Unit|G|N|N|100|N|N +RDAGW|Republic Digital Acquisition Company - Warrants|G|N|N|100|N|N +RDCM|Radcom Ltd. - Ordinary Shares|S|N|N|100|N|N +RDGT|Ridgetech, Inc. - Ordinary Shares|S|N|N|100|N|N +RDHL|Redhill Biopharma Ltd. - American Depositary Shares|S|N|N|100|N|N +RDI|Reading International Inc - Class A Non-voting Common Stock|S|N|N|100|N|N +RDIB|Reading International Inc - Class B Voting Common Stock|S|N|N|100|N|N +RDNT|RadNet, Inc. - Common Stock|G|N|N|100|N|N +RDNW|RideNow Group, Inc. - Class B Common Stock|S|N|N|100|N|N +RDTL|GraniteShares 2x Long RDDT Daily ETF|G|N|N|100|Y|N +RDTY|YieldMax R2000 0DTE Covered Strategy ETF|G|N|N|100|Y|N +RDVT|Red Violet, Inc. - Common Stock |S|N|N|100|N|N +RDVY|First Trust Rising Dividend Achievers ETF|G|N|N|100|Y|N +RDWR|Radware Ltd. - Ordinary Shares|Q|N|N|100|N|N +RDZN|Roadzen, Inc. - Ordinary Shares|G|N|N|100|N|N +RDZNW|Roadzen, Inc. - Warrants|S|N|N|100|N|N +REAI|Intelligent Real Estate ETF|G|N|N|100|Y|N +REAL|The RealReal, Inc. - Common Stock|Q|N|N|100|N|N +REAX|The Real Brokerage, Inc. - Common Shares|S|N|N|100|N|N +REBN|Reborn Coffee, Inc. - Common Stock|S|N|N|100|N|N +RECT|Rectitude Holdings Ltd - Ordinary Shares|S|N|N|100|N|N +REE|REE Automotive Ltd. - Class A Ordinary Shares|S|N|D|100|N|N +REFI|Chicago Atlantic Real Estate Finance, Inc. - Common Stock|G|N|N|100|N|N +REFR|Research Frontiers Incorporated - Common Stock|S|N|N|100|N|N +REG|Regency Centers Corporation - Common Stock|Q|N|N|100|N|N +REGCO|Regency Centers Corporation - 5.875% Series B Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +REGCP|Regency Centers Corporation - 6.25% Series A Cumulative Redeemable Preferred Stock|Q|N|N|100|N|N +REGN|Regeneron Pharmaceuticals, Inc. - Common Stock|Q|N|N|40|N|N +REIT|ALPS Active REIT ETF|G|N|N|100|Y|N +REKR|Rekor Systems, Inc. - Common Stock|S|N|N|100|N|N +RELL|Richardson Electronics, Ltd. - Common Stock|Q|N|N|100|N|N +RELY|Remitly Global, Inc. - Common stock|Q|N|N|100|N|N +REMG|Russell Investments Emerging Markets Equity ETF|G|N|N|100|Y|N +RENT|Rent the Runway, Inc. - Class A Common Stock|G|N|N|100|N|N +RENX|RenX Enterprises Corp. - Common Stock|S|N|N|100|N|N +REPL|Replimune Group, Inc. - Common Stock|Q|N|N|100|N|N +RETO|ReTo Eco-Solutions, Inc. - Class A Shares|S|N|N|100|N|N +REVB|Revelation Biosciences, Inc. - Common Stock|S|N|N|100|N|N +REVBW|Revelation Biosciences, Inc. - Warrant|S|N|N|100|N|N +REYN|Reynolds Consumer Products Inc. - Common Stock|Q|N|N|100|N|N +RFAI|RF Acquisition Corp II - Ordinary Shares|G|N|N|100|N|N +RFAIR|RF Acquisition Corp II - Right|G|N|N|100|N|N +RFAIU|RF Acquisition Corp II - Unit|G|N|N|100|N|N +RFDI|First Trust RiverFront Dynamic Developed International ETF|G|N|N|100|Y|N +RFEM|First Trust RiverFront Dynamic Emerging Markets ETF|G|N|N|100|Y|N +RFIL|RF Industries, Ltd. - Common Stock|G|N|N|100|N|N +RGC|Regencell Bioscience Holdings Limited - Ordinary Shares|S|N|N|100|N|N +RGCO|RGC Resources Inc. - Common Stock|G|N|N|100|N|N +RGEN|Repligen Corporation - Common Stock|Q|N|N|100|N|N +RGLD|Royal Gold, Inc. - Common Stock|Q|N|N|100|N|N +RGLO|Russell Investments Global Equity ETF|G|N|N|100|Y|N +RGNX|REGENXBIO Inc. - Common Stock|Q|N|N|100|N|N +RGP|Resources Connection, Inc. - Common Stock|Q|N|N|100|N|N +RGS|Regis Corporation - Common Stock|G|N|N|100|N|N +RGTI|Rigetti Computing, Inc. - Common stock|S|N|N|100|N|N +RGTIW|Rigetti Computing, Inc. - Redeemable warrants, each whole warrant exercisable for one Class A ordinary share at an exercise price of $11.50|S|N|N|100|N|N +RGTX|Defiance Daily Target 2X Long RGTI ETF|G|N|N|100|Y|N +RGTZ|Defiance Daily Target 2x Short RGTI ETF|G|N|N|100|Y|N +RGYY|GraniteShares YieldBoost RGTI ETF|G|N|N|100|Y|N +RIBB|Ribbon Acquisition Corp - Class A Ordinary Shares|S|N|N|100|N|N +RIBBR|Ribbon Acquisition Corp - Rights|S|N|N|100|N|N +RIBBU|Ribbon Acquisition Corp - Unit|S|N|N|100|N|N +RICK|RCI Hospitality Holdings, Inc. - Common Stock|G|N|N|100|N|N +RIFR|Russell Investments Global Infrastructure ETF|G|N|N|100|Y|N +RIGL|Rigel Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +RILY|BRC Group Holdings, Inc. - Common Stock|G|N|N|100|N|N +RILYG|BRC Group Holdings, Inc. - 5.00% Senior Notes due 2026|G|N|N|100|N|N +RILYK|BRC Group Holdings, Inc. - 5.50% Senior Notes Due 2026|G|N|N|100|N|N +RILYL|BRC Group Holdings, Inc. - Depositary Shares, each representing a 1/1000th fractional interest in a share of Series B Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +RILYN|BRC Group Holdings, Inc. - 6.50% Senior Notes Due 2026|G|N|N|100|N|N +RILYP|BRC Group Holdings, Inc. - Depositary Shares, each representing a 1/1000th fractional interest in a share of Series A Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +RILYT|BRC Group Holdings, Inc. - 6.00% Senior Notes Due 2028|G|N|N|100|N|N +RILYZ|BRC Group Holdings, Inc. - 5.25% Senior Notes due 2028|G|N|N|100|N|N +RIME|Algorhythm Holdings, Inc. - Common Stock|S|N|D|100|N|N +RING|iShares MSCI Global Gold Miners ETF|G|N|N|100|Y|N +RINT|Russell Investments International Developed Equity ETF|G|N|N|100|Y|N +RIOT|Riot Platforms, Inc. - Common Stock|S|N|N|100|N|N +RITR|Reitar Logtech Holdings Limited - Ordinary shares|S|N|N|100|N|N +RIVN|Rivian Automotive, Inc. - Class A Common Stock|Q|N|N|100|N|N +RJET|Republic Airways Holdings Inc. - Common Stock|Q|N|N|100|N|N +RKDA|Arcadia Biosciences, Inc. - Common Stock|S|N|N|100|N|N +RKLB|Rocket Lab Corporation - Common Stock|S|N|N|100|N|N +RKLX|Defiance Daily Target 2X Long RKLB ETF|G|N|N|100|Y|N +RKLZ|Defiance Daily Target 2x Short RKLB ETF|G|N|N|100|Y|N +RKNG|Defiance Retail Kings ETF|G|N|N|100|Y|N +RLAY|Relay Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +RLMD|Relmada Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +RLYB|Rallybio Corporation - Common Stock|S|N|D|100|N|N +RMBI|Richmond Mutual Bancorporation, Inc. - Common Stock|S|N|N|100|N|N +RMBS|Rambus, Inc. - Common Stock|Q|N|N|100|N|N +RMCF|Rocky Mountain Chocolate Factory, Inc. - Common Stock|S|N|N|100|N|N +RMCO|Royalty Management Holding Corporation - Class A Common Stock|S|N|N|100|N|N +RMCOW|Royalty Management Holding Corporation - Warrant|S|N|N|100|N|N +RMNI|Rimini Street, Inc. - Common Stock|G|N|N|100|N|N +RMR|The RMR Group Inc. - Class A Common Stock|S|N|N|100|N|N +RMSG|Real Messenger Corporation - Ordinary Shares|S|N|N|100|N|N +RMSGW|Real Messenger Corporation - Warrants|S|N|N|100|N|N +RMTI|Rockwell Medical, Inc. - Common Stock|S|N|N|100|N|N +RNA|Avidity Biosciences, Inc. - Common Stock|G|N|N|100|N|N +RNAC|Cartesian Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +RNAZ|TransCode Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +RNEM|Emerging Markets Equity Select ETF|G|N|N|100|Y|N +RNGT|Range Capital Acquisition Corp II - Class A Ordinary Shares|G|N|N|100|N|N +RNGTU|Range Capital Acquisition Corp II - Units|G|N|N|100|N|N +RNGTW|Range Capital Acquisition Corp II - Warrants|G|N|N|100|N|N +RNIN|Bushido Capital US SMID Cap Equity ETF|G|N|N|100|Y|N +RNRG|Global X Renewable Energy Producers ETF|G|N|N|100|Y|N +RNTX|Rein Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +RNW|ReNew Energy Global plc - Class A Shares|Q|N|N|100|N|N +RNWWW|ReNew Energy Global plc - Warrant|Q|N|N|100|N|N +RNXT|RenovoRx, Inc. - Common Stock|S|N|D|100|N|N +ROAD|Construction Partners, Inc. - Common Stock|Q|N|N|100|N|N +ROBT|First Trust Nasdaq Artificial Intelligence and Robotics ETF|G|N|N|100|Y|N +ROCK|Gibraltar Industries, Inc. - Common Stock|Q|N|N|100|N|N +ROE|Astoria US Equal Weight Quality Kings ETF|G|N|N|100|Y|N +ROIV|Roivant Sciences Ltd. - Common Shares|Q|N|N|100|N|N +ROKU|Roku, Inc. - Class A Common Stock|Q|N|N|100|N|N +ROMA|Roma Green Finance Limited - Class A Ordinary Shares|S|N|N|100|N|N +ROOT|Root, Inc. - Common Stock|Q|N|N|100|N|N +ROP|Roper Technologies, Inc. - Common Stock|Q|N|N|40|N|N +ROST|Ross Stores, Inc. - Common Stock|Q|N|N|100|N|N +RPAY|Repay Holdings Corporation - Class A Common Stock|S|N|N|100|N|N +RPD|Rapid7, Inc. - Common Stock|G|N|N|100|N|N +RPGL|Republic Power Group Limited - Class A Ordinary Shares|S|N|D|100|N|N +RPID|Rapid Micro Biosystems, Inc. - Class A Common Stock|S|N|N|100|N|N +RPRX|Royalty Pharma plc - Class A Ordinary Shares|Q|N|N|100|N|N +RR|Richtech Robotics Inc. - Class B Common Stock|S|N|N|100|N|N +RRBI|Red River Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +RRGB|Red Robin Gourmet Burgers, Inc. - Common Stock|Q|N|N|100|N|N +RRR|Red Rock Resorts, Inc. - Class A Common Stock|Q|N|N|100|N|N +RSSS|Research Solutions, Inc - Common Stock|S|N|N|100|N|N +RSVR|Reservoir Media, Inc.. - Common Stock|G|N|N|100|N|N +RSVRW|Reservoir Media, Inc.. - Warrant|G|N|N|100|N|N +RTAC|Renatus Tactical Acquisition Corp I - Class A Ordinary Shares|G|N|N|100|N|N +RTACU|Renatus Tactical Acquisition Corp I - Unit|G|N|N|100|N|N +RTACW|Renatus Tactical Acquisition Corp I - Warrant|G|N|N|100|N|N +RTH|VanEck Retail ETF|G|N|N|40|Y|N +RTXG|Leverage Shares 2X Long RTX Daily ETF|G|N|N|100|Y|N +RTYY|GraniteShares YieldBoost RIOT ETF|G|N|N|100|Y|N +RUBI|Rubico Inc. - Common Stock|S|N|N|100|N|N +RUM|Rumble Inc. - Class A Common Stock|G|N|N|100|N|N +RUMBW|Rumble Inc. - Warrant|G|N|N|100|N|N +RUN|Sunrun Inc. - Common Stock|Q|N|N|100|N|N +RUNN|Running Oak Efficient Growth ETF|G|N|N|100|Y|N +RUSC|Russell Investments U.S. Small Cap Equity ETF|G|N|N|100|Y|N +RUSHA|Rush Enterprises, Inc. - Class A Common Stock|Q|N|N|100|N|N +RUSHB|Rush Enterprises, Inc. - Class B Common Stock|Q|N|N|100|N|N +RVMD|Revolution Medicines, Inc. - Common Stock|Q|N|N|100|N|N +RVMDW|Revolution Medicines, Inc. - Warrant|Q|N|N|100|N|N +RVNL|GraniteShares 2x Long RIVN Daily ETF|G|N|N|100|Y|N +RVPH|Reviva Pharmaceuticals Holdings, Inc. - Common Stock|S|N|D|100|N|N +RVSB|Riverview Bancorp Inc - Common Stock|Q|N|N|100|N|N +RVSN|Rail Vision Ltd. - Ordinary Shares|S|N|D|100|N|N +RVSNW|Rail Vision Ltd. - Warrant|S|N|N|100|N|N +RVYL|Ryvyl Inc. - Common Stock|S|N|N|100|N|N +RWAY|Runway Growth Finance Corp. - Common Stock|Q|N|N|100|N|N +RWAYL|Runway Growth Finance Corp. - 7.50% Notes due 2027|Q|N|N|100|N|N +RWAYZ|Runway Growth Finance Corp. - 8.00% Notes due 2027|Q|N|N|100|N|N +RXRX|Recursion Pharmaceuticals, Inc. - Class A Common Stock|Q|N|N|100|N|N +RXST|RxSight, Inc. - Common Stock|G|N|N|100|N|N +RXT|Rackspace Technology, Inc. - Common Stock|Q|N|N|100|N|N +RYAAY|Ryanair Holdings plc - American Depositary Shares, each representing five Ordinary Shares|Q|N|N|100|N|N +RYET|Ruanyun Edai Technology Inc. - Ordinary shares|S|N|N|100|N|N +RYM|RYTHM, Inc. - Common Stock|S|N|N|100|N|N +RYOJ|rYojbaba Co., Ltd. - Common Shares|S|N|N|100|N|N +RYTM|Rhythm Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +RZLT|Rezolute, Inc. - Common Stock (NV)|S|N|N|100|N|N +RZLV|Rezolve AI PLC - Ordinary Shares|G|N|N|100|N|N +RZLVW|Rezolve AI PLC - Warrants|S|N|N|100|N|N +SAAQU|Space Asset Acquisition Corp. - Units|G|N|N|100|N|N +SABR|Sabre Corporation - Common Stock|Q|N|N|100|N|N +SABS|SAB Biotherapeutics, Inc. - Common Stock|S|N|N|100|N|N +SABSW|SAB Biotherapeutics, Inc. - Warrant|S|N|N|100|N|N +SAFT|Safety Insurance Group, Inc. - Common Stock|Q|N|N|100|N|N +SAFX|XCF Global, Inc. - Class A Common Stock|S|N|D|100|N|N +SAGT|SAGTEC GLOBAL LIMITED - Class A Ordinary shares|S|N|N|100|N|N +SAIA|Saia, Inc. - Common Stock|Q|N|N|40|N|N +SAIC|Science Applications International Corporation - Common Stock|Q|N|N|100|N|N +SAIH|SAIHEAT Limited - Class A Ordinary Shares|S|N|N|100|N|N +SAIHW|SAIHEAT Limited - Warrant|S|N|N|100|N|N +SAIL|SailPoint, Inc. - Common Stock|Q|N|N|100|N|N +SAMG|Silvercrest Asset Management Group Inc. - Common Stock|G|N|N|100|N|N +SANA|Sana Biotechnology, Inc. - Common Stock|Q|N|N|100|N|N +SANG|Sangoma Technologies Corporation - Common Shares|Q|N|N|100|N|N +SANM|Sanmina Corporation - Common Stock|Q|N|N|100|N|N +SARK|Tradr 1X Short Innovation Daily ETF|G|N|N|100|Y|N +SATA|Strive, Inc. - Variable Rate Series A Perpetual Preferred Stock|G|N|N|100|N|N +SATG|Leverage Shares 2X Long SATS Daily ETF|G|N|N|100|Y|N +SATL|Satellogic Inc. - Class A Common Stock|S|N|N|100|N|N +SATLW|Satellogic Inc. - Warrant|S|N|N|100|N|N +SATS|EchoStar Corporation - Common stock|Q|N|N|100|N|N +SAVA|Cassava Sciences, Inc. - Common Stock|S|N|N|100|N|N +SBAC|SBA Communications Corporation - Class A Common Stock|Q|N|N|100|N|N +SBC|SBC Medical Group Holdings Incorporated - Common Stock|G|N|N|100|N|N +SBCF|Seacoast Banking Corporation of Florida - Common Stock|Q|N|N|100|N|N +SBCWW|SBC Medical Group Holdings Incorporated - Warrants|S|N|N|100|N|N +SBET|SharpLink Gaming, Inc. - Common Stock|S|N|N|100|N|N +SBFG|SB Financial Group, Inc. - Common Stock|S|N|N|100|N|N +SBFM|Sunshine Biopharma Inc. - Common stock|S|N|N|100|N|N +SBFMW|Sunshine Biopharma Inc. - Warrant|S|N|N|100|N|N +SBGI|Sinclair, Inc. - Class A Common Stock|Q|N|N|100|N|N +SBLK|Star Bulk Carriers Corp. - Common Shares|Q|N|N|100|N|N +SBLX|StableX Technologies, Inc. - Common Stock|S|N|N|100|N|N +SBRA|Sabra Health Care REIT, Inc. - Common Stock|Q|N|N|100|N|N +SBU|Leverage Shares 2X Long SBUX Daily ETF|G|N|N|100|Y|N +SBUX|Starbucks Corporation - Common Stock|Q|N|N|100|N|N +SCAG|Scage Future - American Depositary Shares|G|N|N|100|N|N +SCAGW|Scage Future - Warrants|S|N|N|100|N|N +SCDS|JPMorgan Fundamental Data Science Small Core ETF|G|N|N|100|Y|N +SCHL|Scholastic Corporation - Common Stock|Q|N|N|100|N|N +SCII|SC II Acquisition Corp. - Class A ordinary share|G|N|N|100|N|N +SCIIR|SC II Acquisition Corp. - Rights|G|N|N|100|N|N +SCIIU|SC II Acquisition Corp. - Units|G|N|N|100|N|N +SCKT|Socket Mobile, Inc. - Common Stock|S|N|N|100|N|N +SCLS|Stoneport Advisors Commodity Long Short ETF|G|N|N|100|Y|N +SCLX|Scilex Holding Company - Common Stock|S|N|N|100|N|N +SCLXW|Scilex Holding Company - Warrant|S|N|N|100|N|N +SCNI|Scinai Immunotherapeutics Ltd. - American Depositary Shares|S|N|N|100|N|N +SCNX|Scienture Holdings, Inc. - Common Stock|S|N|D|100|N|N +SCOR|comScore, Inc. - Common Stock|Q|N|N|100|N|N +SCPQU|Social Commerce Partners Corporation - Unit|G|N|N|100|N|N +SCSC|ScanSource, Inc. - Common Stock|Q|N|N|100|N|N +SCVL|Shoe Carnival, Inc. - Common Stock|Q|N|N|100|N|N +SCWO|374Water Inc. - common stock|S|N|N|100|N|N +SCYX|SCYNEXIS, Inc. - Common Stock|S|N|D|100|N|N +SCZ|iShares MSCI EAFE Small-Cap ETF|G|N|N|100|Y|N +SCZM|Santacruz Silver Mining Ltd. - Common Shares|S|N|N|100|N|N +SDA|SunCar Technology Group Inc. - Ordinary Shares|S|N|N|100|N|N +SDAWW|SunCar Technology Group Inc. - Warrant|S|N|N|100|N|N +SDG|iShares MSCI Global Sustainable Development Goals ETF|G|N|N|100|Y|N +SDGR|Schrodinger, Inc. - Common Stock|Q|N|N|100|N|N +SDHI|Siddhi Acquisition Corp - Class A Common stock|G|N|N|100|N|N +SDHIR|Siddhi Acquisition Corp - Right|G|N|N|100|N|N +SDHIU|Siddhi Acquisition Corp - Unit|G|N|N|100|N|N +SDM|Smart Digital Group Limited - Ordinary Shares|S|N|N|100|N|N +SDOT|Sadot Group Inc. - Common Stock|S|N|D|100|N|N +SDSI|American Century Short Duration Strategic Income ETF|G|N|N|100|Y|N +SDST|Stardust Power Inc. - Common Stock|S|N|N|100|N|N +SDSTW|Stardust Power Inc. - Warrant|S|N|N|100|N|N +SDTY|YieldMax S&P 500 0DTE Covered Call Strategy ETF|G|N|N|100|Y|N +SDVY|First Trust SMID Cap Rising Dividend Achievers ETF|G|N|N|100|Y|N +SEAT|Vivid Seats Inc. - Class A common stock|Q|N|N|100|N|N +SEATW|Vivid Seats Inc. - Warrant|Q|N|N|100|N|N +SEDG|SolarEdge Technologies, Inc. - Common Stock|Q|N|N|100|N|N +SEED|Origin Agritech Limited - Ordinary Shares|S|N|N|100|N|N +SEEM|SEI Select Emerging Markets Equity ETF|G|N|N|100|Y|N +SEER|Seer, Inc. - Class A Common Stock|Q|N|N|100|N|N +SEGG|Lottery.com, Inc. - Common Stock|G|N|N|100|N|N +SEIC|SEI Investments Company - Common Stock|Q|N|N|100|N|N +SEIE|SEI Select International Equity ETF|G|N|N|100|Y|N +SEIS|SEI Select Small Cap ETF|G|N|N|100|Y|N +SELF|Global Self Storage, Inc. - Common Stock|S|N|N|100|N|N +SELX|Semilux International Ltd. - Ordinary Shares|S|N|D|100|N|N +SEMY|GraniteShares YieldBOOST Semiconductor ETF|G|N|N|100|Y|N +SENEA|Seneca Foods Corp. - Class A Common Stock|Q|N|N|100|N|N +SENEB|Seneca Foods Corp. - Class B Common Stock|Q|N|N|100|N|N +SENS|Senseonics Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SEPN|Septerna, Inc. - Common Stock|G|N|N|100|N|N +SERA|Sera Prognostics, Inc. - Class A Common Stock|G|N|N|100|N|N +SERV|Serve Robotics Inc. - Common Stock|S|N|N|100|N|N +SETM|Sprott Critical Materials ETF|G|N|N|100|Y|N +SEV|Aptera Motors Corp. - Class B Common Stock|S|N|N|100|N|N +SEVN|Seven Hills Realty Trust - Common Stock|S|N|N|100|N|N +SEZL|Sezzle Inc. - Common Stock|S|N|N|100|N|N +SFBC|Sound Financial Bancorp, Inc. - Common Stock|S|N|N|100|N|N +SFD|Smithfield Foods, Inc. - Common Stock|Q|N|N|100|N|N +SFHG|Samfine Creation Holdings Group Limited - Class A Ordinary Share|S|N|D|100|N|N +SFIX|Stitch Fix, Inc. - Class A Common Stock|Q|N|N|100|N|N +SFLO|VictoryShares Small Cap Free Cash Flow ETF|G|N|N|100|Y|N +SFM|Sprouts Farmers Market, Inc. - Common Stock|Q|N|N|100|N|N +SFNC|Simmons First National Corporation - Common Stock|Q|N|N|100|N|N +SFST|Southern First Bancshares, Inc. - Common Stock|G|N|N|100|N|N +SFWL|Shengfeng Development Limited - Class A Ordinary Shares|S|N|N|100|N|N +SGA|Saga Communications, Inc. - Class A Common Stock|G|N|N|100|N|N +SGC|Superior Group of Companies, Inc. - Common Stock|G|N|N|100|N|N +SGHT|Sight Sciences, Inc. - Common Stock|Q|N|N|100|N|N +SGLY|Singularity Future Technology Ltd. - Common Stock|S|N|D|100|N|N +SGML|Sigma Lithium Corporation - common shares|S|N|N|100|N|N +SGMO|Sangamo Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +SGMT|Sagimet Biosciences Inc. - Series A Common Stock|G|N|N|100|N|N +SGRP|SPAR Group, Inc. - Common Stock|S|N|D|100|N|N +SGRY|Surgery Partners, Inc. - Common Stock|Q|N|N|100|N|N +SHBI|Shore Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +SHC|Sotera Health Company - Common Stock|Q|N|N|100|N|N +SHEN|Shenandoah Telecommunications Co - Common Stock|Q|N|N|100|N|N +SHFS|SHF Holdings, Inc. - Class A Common Stock|S|N|N|100|N|N +SHFSW|SHF Holdings, Inc. - Warrants|S|N|N|100|N|N +SHIM|Shimmick Corporation - Common Stock|S|N|N|100|N|N +SHIP|Seanergy Maritime Holdings Corp. - Common Stock|S|N|N|100|N|N +SHLS|Shoals Technologies Group, Inc. - Class A Common Stock|G|N|N|100|N|N +SHMD|SCHMID Group N.V. - Class A Ordinary Shares|G|N|E|100|N|N +SHMDW|SCHMID Group N.V. - Warrants|S|N|E|100|N|N +SHOO|Steven Madden, Ltd. - Common Stock|Q|N|N|100|N|N +SHOP|Shopify Inc. - Class A Subordinate Voting Shares|Q|N|N|100|N|N +SHPD|Direxion Daily SHOP Bear 1X ETF|G|N|N|100|Y|N +SHPH|Shuttle Pharmaceuticals Holdings, Inc. - common stock|S|N|N|100|N|N +SHPU|Direxion Daily SHOP Bull 2X ETF|G|N|N|100|Y|N +SHRY|First Trust Bloomberg Shareholder Yield ETF|G|N|N|100|Y|N +SHV|iShares 0-1 Year Treasury Bond ETF|G|N|N|100|Y|N +SHY|iShares 1-3 Year Treasury Bond ETF|G|N|N|100|Y|N +SIBN|SI-BONE, Inc. - Common Stock|G|N|N|100|N|N +SIDU|Sidus Space, Inc. - Class A Common Stock|S|N|N|100|N|N +SIEB|Siebert Financial Corp. - Common Stock|S|N|N|100|N|N +SIFY|Sify Technologies Limited - American Depository Shares|S|N|N|100|N|N +SIGA|SIGA Technologies Inc. - Common Stock|G|N|N|100|N|N +SIGI|Selective Insurance Group, Inc. - Common Stock|Q|N|N|100|N|N +SIGIP|Selective Insurance Group, Inc. - Depositary Shares, each representing a 1/1,000th interest in a share of 4.60% Non-Cumulative Preferred Stock, Series B|Q|N|N|100|N|N +SILC|Silicom Ltd - Ordinary Shares|Q|N|N|100|N|N +SILO|Silo Pharma, Inc. - Common Stock|S|N|D|100|N|N +SIMA|SIM Acquisition Corp. I - Class A Ordinary Shares|G|N|N|100|N|N +SIMAU|SIM Acquisition Corp. I - Unit|G|N|N|100|N|N +SIMAW|SIM Acquisition Corp. I - Warrant|G|N|N|100|N|N +SIMO|Silicon Motion Technology Corporation - American Depositary Shares, each representing four ordinary shares|Q|N|N|100|N|N +SINT|SiNtx Technologies, Inc. - Common Stock|S|N|N|100|N|N +SION|Sionna Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +SIRI|SiriusXM Holdings Inc. - Common Stock|Q|N|N|100|N|N +SITM|SiTime Corporation - Common Stock|G|N|N|40|N|N +SIXG|Defiance Connective Technologies ETF|G|N|N|100|Y|N +SJ|Scienjoy Holding Corporation - Class A Ordinary Shares|S|N|D|100|N|N +SJCP|SanJac Alpha Core Plus Bond ETF|G|N|N|100|Y|N +SJLD|SanJac Alpha Low Duration ETF|G|N|N|100|Y|N +SKBL|Skyline Builders Group Holding Limited - Class A Ordinary Shares|S|N|N|100|N|N +SKIN|The Beauty Health Company - Class A Common Stock|S|N|N|100|N|N +SKK|SKK Holdings Limited - Ordinary Shares|S|N|D|100|N|N +SKOR|FlexShares Credit-Scored US Corporate Bond Index Fund|G|N|N|100|Y|N +SKRE|Tuttle Capital Daily 2X Inverse Regional Banks ETF|G|N|N|100|Y|N +SKWD|Skyward Specialty Insurance Group, Inc. - Common Stock|Q|N|N|100|N|N +SKYE|Skye Bioscience, Inc. - Common Stock|G|N|N|100|N|N +SKYQ|Sky Quarry Inc. - Common Stock|S|N|D|100|N|N +SKYT|SkyWater Technology, Inc. - Common Stock|S|N|N|100|N|N +SKYU|ProShares Ultra Cloud Computing|G|N|N|100|Y|N +SKYW|SkyWest, Inc. - Common Stock|Q|N|N|100|N|N +SKYX|SKYX Platforms Corp. - Common Stock|S|N|N|100|N|N +SKYY|First Trust Cloud Computing ETF|G|N|N|100|Y|N +SLAB|Silicon Laboratories, Inc. - Common Stock|Q|N|N|100|N|N +SLDB|Solid Biosciences Inc. - Common Stock|Q|N|N|100|N|N +SLDE|Slide Insurance Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SLDP|Solid Power, Inc. - Class A Common Stock|Q|N|N|100|N|N +SLDPW|Solid Power, Inc. - Warrant|Q|N|N|100|N|N +SLE|Super League Enterprise, Inc. - Common Stock|S|N|N|100|N|N +SLGB|Smart Logistics Global Limited - Ordinary Shares|S|N|N|100|N|N +SLGL|Sol-Gel Technologies Ltd. - Ordinary Shares|S|N|N|100|N|N +SLM|SLM Corporation - Common Stock|Q|N|N|100|N|N +SLMBP|SLM Corporation - Floating Rate Non-Cumulative Preferred Stock, Series B|Q|N|N|100|N|N +SLMT|Brera Holdings PLC - Class B Ordinary Shares|S|N|N|100|N|N +SLN|Silence Therapeutics Plc - American Depository Share|G|N|N|100|N|N +SLNG|Stabilis Solutions, Inc. - Common Stock|S|N|N|100|N|N +SLNH|Soluna Holdings, Inc. - Common Stock|S|N|N|100|N|N +SLNHP|Soluna Holdings, Inc. - 9.0% Series A Cumulative Perpetual Preferred Stock|S|N|N|100|N|N +SLNO|Soleno Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +SLP|Simulations Plus, Inc. - Common Stock|Q|N|N|100|N|N +SLQD|iShares 0-5 Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +SLRC|SLR Investment Corp. - Closed End Fund|Q|N|N|100|N|N +SLS|SELLAS Life Sciences Group, Inc. - Common Stock|S|N|N|100|N|N +SLSN|Solesence, Inc. - Common stock|S|N|N|100|N|N +SLVO|ETRACS Silver Shares Covered Call ETNs due April 21, 2033|G|N|N|100|Y|N +SLVR|Sprott Silver Miners & Physical Silver ETF|G|N|N|100|Y|N +SLXN|Silexion Therapeutics Corp - Ordinary Shares|S|N|N|100|N|N +SLXNW|Silexion Therapeutics Corp - Warrant|S|N|N|100|N|N +SMBC|Southern Missouri Bancorp, Inc. - Common Stock|G|N|N|100|N|N +SMCF|Themes US Small Cap Cash Flow Champions ETF|G|N|N|100|Y|N +SMCI|Super Micro Computer, Inc. - Common Stock|Q|N|N|100|N|N +SMCL|GraniteShares 2x Long SMCI Daily ETF|G|N|N|100|Y|N +SMCO|Hilton Small-MidCap Opportunity ETF|G|N|N|100|Y|N +SMCX|Defiance Daily Target 2X Long SMCI ETF|G|N|N|100|Y|N +SMCZ|Defiance Daily Target 2X Short SMCI ETF|G|N|N|100|Y|N +SMH|VanEck Semiconductor ETF|G|N|N|40|Y|N +SMHX|VanEck Fabless Semiconductor ETF|G|N|N|100|Y|N +SMID|Smith-Midland Corporation - Common Stock|S|N|N|100|N|N +SMMT|Summit Therapeutics Inc. - Common Stock|G|N|N|100|N|N +SMOM|Symmetry Panoramic Sector Momentum ETF|G|N|N|100|Y|N +SMPL|The Simply Good Foods Company - Common Stock|S|N|N|100|N|N +SMRI|Bushido Capital US Equity ETF|G|N|N|100|Y|N +SMSI|Smith Micro Software, Inc. - Common Stock|S|N|D|100|N|N +SMST|Defiance Daily Target 2x Short MSTR ETF|G|N|N|100|Y|N +SMTC|Semtech Corporation - Common Stock|Q|N|N|100|N|N +SMTI|Sanara MedTech Inc. - Common Stock|S|N|N|100|N|N +SMTK|SmartKem, Inc. - Common Stock|S|N|D|100|N|N +SMX|SMX (Security Matters) Public Limited Company - Ordinary Shares|S|N|N|100|N|N +SMXT|Solarmax Technology Inc. - Common Stock|S|N|N|100|N|N +SMXWW|SMX (Security Matters) Public Limited Company - Warrant|S|N|N|100|N|N +SMYY|GraniteShares YieldBOOST SMCI ETF|G|N|N|100|Y|N +SNAG|Leverage Shares 2x Long SNAP Daily ETF|G|N|N|100|Y|N +SNAL|Snail, Inc. - Class A Common Stock|S|N|D|100|N|N +SNBR|Sleep Number Corporation - Common Stock|Q|N|N|100|N|N +SNCR|Synchronoss Technologies, Inc. - Common Stock|S|N|N|100|N|N +SNCY|Sun Country Airlines Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SND|Smart Sand, Inc. - Common Stock|Q|N|N|100|N|N +SNDK|Sandisk Corporation - Common Stock|Q|N|N|100|N|N +SNDL|SNDL Inc. - Common Shares|S|N|N|100|N|N +SNDX|Syndax Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +SNES|SenesTech, Inc. - Common Stock|S|N|N|100|N|N +SNEX|StoneX Group Inc. - Common Stock|Q|N|N|100|N|N +SNFCA|Security National Financial Corporation - Class A Common Stock|G|N|N|100|N|N +SNGX|Soligenix, Inc. - Common Stock|S|N|N|100|N|N +SNOA|Sonoma Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +SNPS|Synopsys, Inc. - Common Stock|Q|N|N|40|N|N +SNSE|Sensei Biotherapeutics, Inc. - Common Stock|S|N|N|100|N|N +SNSR|Global X Internet of Things ETF|G|N|N|100|Y|N +SNT|Senstar Technologies Corporation - Common Shares|G|N|N|100|N|N +SNTG|Sentage Holdings Inc. - Class A Ordinary Shares|S|N|N|100|N|N +SNTI|Senti Biosciences, Inc. - Common Stock|S|N|N|100|N|N +SNWV|SANUWAVE Health, Inc. - Common Stock|G|N|N|100|N|N +SNY|Sanofi - American Depositary Shares|Q|N|N|100|N|N +SNYR|Synergy CHC Corp. - Common Stock|S|N|N|100|N|N +SOBR|SOBR Safe, Inc. - Common Stock|S|N|N|100|N|N +SOCA|Solarius Capital Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +SOCAU|Solarius Capital Acquisition Corp. - Units|G|N|N|100|N|N +SOCAW|Solarius Capital Acquisition Corp. - Warrant|G|N|N|100|N|N +SOCL|Global X Social Media ETF|G|N|N|100|Y|N +SOFI|SoFi Technologies, Inc. - Common Stock|Q|N|N|100|N|N +SOFX|Defiance Daily Target 2X Long SOFI ETF|G|N|N|100|Y|N +SOGP|Sound Group Inc. - American Depositary Shares|S|N|N|100|N|N +SOHO|Sotherly Hotels Inc. - Common Stock|S|N|N|100|N|N +SOHOB|Sotherly Hotels Inc. - 8.0% Series B Cumulative Redeemable Perpetual Preferred Stock|G|N|N|100|N|N +SOHON|Sotherly Hotels Inc. - 8.25% Series D Cumulative Redeemable Perpetual Preferred Stock|G|N|N|100|N|N +SOHOO|Sotherly Hotels Inc. - 7.875% Series C Cumulative Redeemable Perpetual Preferred Stock|G|N|N|100|N|N +SOHU|Sohu.com Limited - American Depositary Shares|Q|N|N|100|N|N +SOLC|Canary Marinade Solana ETF|G|N|N|100|Y|N +SOLS|Solstice Advanced Materials Inc. - Common Stock|Q|N|N|100|N|N +SOLT|2x Solana ETF|G|N|N|100|Y|N +SOLZ|Solana ETF|G|N|N|100|Y|N +SONM|Sonim Technologies, Inc. - Common Stock|S|N|D|100|N|N +SONO|Sonos, Inc. - Common Stock|Q|N|N|100|N|N +SOPA|Society Pass Incorporated - Common Stock|S|N|N|100|N|N +SOPH|SOPHiA GENETICS SA - Ordinary Shares|Q|N|N|100|N|N +SORA|AsiaStrategy - Ordinary Shares|S|N|N|100|N|N +SORNU|Soren Acquisition Corp. - Unit|G|N|N|100|N|N +SOTK|Sono-Tek Corporation - Common Stock|S|N|N|100|N|N +SOUN|SoundHound AI, Inc. - Class A Common Stock|G|N|N|100|N|N +SOUNW|SoundHound AI, Inc. - Warrant|G|N|N|100|N|N +SOUX|Defiance Daily Target 2X Long SOUN ETF|G|N|N|100|Y|N +SOWG|Sow Good Inc. - Common Stock|S|N|D|100|N|N +SOXQ|Invesco PHLX Semiconductor ETF|G|N|N|100|Y|N +SOXX|iShares PHLX SOX Semiconductor Sector Index Fund|G|N|N|40|Y|N +SPAI|Safe Pro Group Inc. - Common Stock|S|N|N|100|N|N +SPAM|Themes Cybersecurity ETF|G|N|N|100|Y|N +SPAQ|Horizon Kinetics SPAC Active ETF|G|N|N|100|Y|N +SPBC|Simplify US Equity PLUS Bitcoin Strategy ETF|G|N|N|100|Y|N +SPCB|SuperCom, Ltd. - Ordinary Shares|S|N|N|100|N|N +SPCT|Liberty One Spectrum ETF|G|N|N|100|Y|N +SPCX|SPAC and New Issue ETF|G|N|N|100|Y|N +SPEG|Silver Pegasus Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +SPEGR|Silver Pegasus Acquisition Corp - Rights|G|N|N|100|N|N +SPEGU|Silver Pegasus Acquisition Corp - Unit|G|N|N|100|N|N +SPFI|South Plains Financial, Inc. - Common Stock|Q|N|N|100|N|N +SPHL|Springview Holdings Ltd - Ordinary shares|S|N|N|100|N|N +SPIT|F/m Emerald Special Situations ETF|G|N|N|100|Y|N +SPKL|Spark I Acquisition Corp. - Class A Ordinary Share|G|N|N|100|N|N +SPKLU|Spark I Acquisition Corp. - Unit|G|N|N|100|N|N +SPKLW|Spark I Acquisition Corp. - Warrant|G|N|N|100|N|N +SPOG|Leverage Shares 2X Long SPOT Daily ETF|G|N|N|100|Y|N +SPOK|Spok Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SPPL|SIMPPLE LTD. - Ordinary Shares|S|N|N|100|N|N +SPRB|Spruce Biosciences, Inc. - Common Stock|S|N|N|100|N|N +SPRC|SciSparc Ltd. - Ordinary Shares|S|N|D|100|N|N +SPRO|Spero Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +SPRX|Spear Alpha ETF|G|N|N|100|Y|N +SPRY|ARS Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +SPSC|SPS Commerce, Inc. - Common Stock|Q|N|N|100|N|N +SPT|Sprout Social, Inc - Class A Common Stock|S|N|N|100|N|N +SPWH|Sportsman's Warehouse Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SPWR|SunPower Inc. - Common Stock|G|N|N|100|N|N +SPWRW|SunPower Inc. - Warrant|S|N|N|100|N|N +SPXD|Xtrackers S&P 500 Diversified Sector Weight ETF|G|N|N|100|Y|N +SPYQ|Tradr 2X Long SPY Quarterly ETF|G|N|N|100|Y|N +SQFT|Presidio Property Trust, Inc. - Class A Common Stock|S|N|N|100|N|N +SQFTP|Presidio Property Trust, Inc. - 9.375% Series D Cumulative Redeemable Perpetual Preferred Stock, $0.01 par value per share|S|N|N|100|N|N +SQFTW|Presidio Property Trust, Inc. - Series A Common Stock Purchase Warrants|S|N|N|100|N|N +SQLV|Royce Quant Small-Cap Quality Value ETF|G|N|N|100|Y|N +SQQQ|ProShares UltraPro Short QQQ|G|N|N|100|Y|N +SRAD|Sportradar Group AG - Class A Ordinary Shares|Q|N|N|100|N|N +SRBK|SR Bancorp, Inc. - Common stock|S|N|N|100|N|N +SRCE|1st Source Corporation - Common Stock|Q|N|N|100|N|N +SRET|Global X SuperDividend REIT ETF|G|N|N|100|Y|N +SRPT|Sarepta Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +SRRK|Scholar Rock Holding Corporation - Common Stock|Q|N|N|100|N|N +SRTA|Strata Critical Medical, Inc. - Class A Common Stock|S|N|N|100|N|N +SRTAW|Strata Critical Medical, Inc. - Warrants|S|N|N|100|N|N +SRTS|Sensus Healthcare, Inc. - Common Stock|S|N|N|100|N|N +SRZN|Surrozen, Inc. - Common Stock|S|N|N|100|N|N +SRZNW|Surrozen, Inc. - Warrant|S|N|N|100|N|N +SSBI|Summit State Bank - Common Stock|G|N|N|100|N|N +SSEA|Starry Sea Acquisition Corp - Ordinary Shares|S|N|N|100|N|N +SSEAR|Starry Sea Acquisition Corp - Rights|S|N|N|100|N|N +SSEAU|Starry Sea Acquisition Corp - Unit|S|N|N|100|N|N +SSII|SS Innovations International Inc. - Common Stock|S|N|N|100|N|N +SSKN|Strata Skin Sciences, Inc. - Common Stock|S|N|D|100|N|N +SSM|Sono Group N.V. - Ordinary Shares|S|N|N|100|N|N +SSNC|SS&C Technologies Holdings, Inc. - Common Stock|Q|N|N|100|N|N +SSP|E.W. Scripps Company (The) - Class A Common Stock|Q|N|N|100|N|N +SSRM|SSR Mining Inc. - Common Stock|Q|N|N|100|N|N +SSSS|SuRo Capital Corp. - Closed End Fund|Q|N|N|100|N|N +SSSSL|SuRo Capital Corp. - 6.00% Notes due 2026|G|N|N|100|N|N +SSTI|SoundThinking, Inc. - Common Stock|S|N|N|100|N|N +SSYS|Stratasys, Ltd. - Common Stock|Q|N|N|100|N|N +STAA|STAAR Surgical Company - Common Stock|G|N|N|100|N|N +STAI|ScanTech AI Systems Inc. - Common stock|G|N|D|100|N|N +STAK|STAK Inc. - Class A Ordinary Shares|S|N|D|100|N|N +STBA|S&T Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +STEP|StepStone Group Inc. - Class A Common Stock|Q|N|N|100|N|N +STEX|Streamex Corp. - Common Stock|S|N|N|100|N|N +STFS|Star Fashion Culture Holdings Limited - Class A Ordinary Shares|S|N|D|100|N|N +STGW|Stagwell Inc. - Class A Common Stock|Q|N|N|100|N|N +STHO|Star Holdings - Shares of Beneficial Interest|G|N|N|100|N|N +STI|Solidion Technology, Inc. - Common Stock|S|N|N|100|N|N +STIM|Neuronetics, Inc. - Common Stock|G|N|N|100|N|N +STKE|Sol Strategies Inc. - Common Shares|Q|N|N|100|N|N +STKH|Steakholder Foods Ltd. - American Depositary Shares|S|N|N|100|N|N +STKL|SunOpta, Inc. - Common Stock|Q|N|N|100|N|N +STKS|The ONE Group Hospitality, Inc. - Common Stock|S|N|N|100|N|N +STLD|Steel Dynamics, Inc. - Common Stock|Q|N|N|100|N|N +STNC|Hennessy Sustainable ETF|G|N|N|100|Y|N +STNE|StoneCo Ltd. - Class A Common Share|Q|N|N|100|N|N +STOK|Stoke Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +STRA|Strategic Education, Inc. - Common Stock|Q|N|N|100|N|N +STRC|Strategy Inc - Variable Rate Series A Perpetual Stretch Preferred Stock|Q|N|N|100|N|N +STRD|Strategy Inc - 10.00% Series A Perpetual Stride Preferred Stock|Q|N|N|100|N|N +STRF|Strategy Inc - 10.00% Series A Perpetual Strife Preferred Stock|Q|N|N|100|N|N +STRK|Strategy Inc - 8.00% Series A Perpetual Strike Preferred Stock|Q|N|N|100|N|N +STRL|Sterling Infrastructure, Inc. - Common Stock|Q|N|N|40|N|N +STRO|Sutro Biopharma, Inc. - Common Stock|G|N|N|100|N|N +STRR|Star Equity Holdings, Inc. - Common Stock|Q|N|N|100|N|N +STRRP|Star Equity Holdings, Inc. - 10% Series A Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +STRS|Stratus Properties Inc. - Common Stock|Q|N|N|100|N|N +STRT|STRATTEC SECURITY CORPORATION - Common Stock|G|N|N|100|N|N +STRZ|Starz Entertainment Corp. - Common Shares|Q|N|N|100|N|N +STSS|Sharps Technology Inc. - Common Stock|S|N|N|100|N|N +STSSW|Sharps Technology Inc. - Warrant|S|N|N|100|N|N +STTK|Shattuck Labs, Inc. - Common Stock|Q|N|N|100|N|N +STX|Seagate Technology Holdings PLC - Ordinary Shares (Ireland)|Q|N|N|100|N|N +SUGP|SU Group Holdings Limited - Ordinary Shares|S|N|N|100|N|N +SUIG|Sui Group Holdings Limited - Common Stock|S|N|N|100|N|N +SUNE|SUNation Energy, Inc. - Common Stock|S|N|N|100|N|N +SUNS|Sunrise Realty Trust, Inc. - Common Stock|S|N|N|100|N|N +SUPN|Supernus Pharmaceuticals, Inc. - Common Stock|G|N|N|100|N|N +SUPP|TCW Transform Supply Chain ETF|G|N|N|100|Y|N +SUPX|SuperX AI Technology Limited - Ordinary Shares|S|N|N|100|N|N +SURG|SurgePays, Inc. - Common Stock|S|N|N|100|N|N +SUSB|iShares ESG Aware 1-5 Year USD Corporate Bond ETF|G|N|N|100|Y|N +SUSC|iShares ESG Aware USD Corporate Bond ETF|G|N|N|100|Y|N +SUSL|iShares ESG MSCI USA Leaders ETF|G|N|N|100|Y|N +SUUN|PowerBank Corporation - Common Stock|G|N|N|100|N|N +SVA|Sinovac Biotech, Ltd. - Ordinary Shares (Antigua/Barbudo)|Q|N|E|100|N|N +SVAC|Spring Valley Acquisition Corp. III - Class A Ordinary Shares|G|N|N|100|N|N +SVACU|Spring Valley Acquisition Corp. III - Unit|G|N|N|100|N|N +SVACW|Spring Valley Acquisition Corp. III - Warrant|G|N|N|100|N|N +SVAQU|Silicon Valley Acquisition Corp. - Units|G|N|N|100|N|N +SVC|Service Properties Trust - Shares of Beneficial Interest|Q|N|N|100|N|N +SVCC|Stellar V Capital Corp. - Class A Ordinary Shares|G|N|N|100|N|N +SVCCU|Stellar V Capital Corp. - Unit|G|N|N|100|N|N +SVCCW|Stellar V Capital Corp. - Warrant|G|N|N|100|N|N +SVCO|Silvaco Group, Inc. - Common Stock|Q|N|N|100|N|N +SVRA|Savara, Inc. - Common Stock|Q|N|N|100|N|N +SVRE|SaverOne 2014 Ltd. - American Depositary Shares|S|N|N|100|N|N +SVREW|SaverOne 2014 Ltd. - Warrant|S|N|N|100|N|N +SVRN|OceanPal Inc. - Common Stock|S|N|N|100|N|N +SWAG|Stran & Company, Inc. - Common Stock|S|N|N|100|N|N +SWAGW|Stran & Company, Inc. - Warrant|S|N|N|100|N|N +SWBI|Smith & Wesson Brands, Inc. - Common Stock|Q|N|N|100|N|N +SWIM|Latham Group, Inc. - Common Stock|Q|N|N|100|N|N +SWKH|SWK Holdings Corporation - Common Stock|G|N|N|100|N|N +SWKHL|SWK Holdings Corporation - 9.00% Senior Notes due 2027|G|N|N|100|N|N +SWKS|Skyworks Solutions, Inc. - Common Stock|Q|N|N|100|N|N +SWP|SWP Growth & Income ETF|G|N|N|100|Y|N +SWVL|Swvl Holdings Corp - Ordinary Shares|S|N|D|100|N|N +SWVLW|Swvl Holdings Corp - Warrant|S|N|D|100|N|N +SXTC|China SXT Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +SXTP|60 Degrees Pharmaceuticals, Inc. - Common Stock|S|N|D|100|N|N +SXTPW|60 Degrees Pharmaceuticals, Inc. - Warrant|S|N|N|100|N|N +SY|So-Young International Inc. - American Depository Shares|S|N|N|100|N|N +SYBT|Stock Yards Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +SYM|Symbotic Inc. - Class A Common Stock|G|N|N|100|N|N +SYNA|Synaptics Incorporated - Common Stock|Q|N|N|100|N|N +SYPR|Sypris Solutions, Inc. - Common Stock|G|N|N|100|N|N +SYRE|Spyre Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +SYZ|Lazard US Systematic Small Cap Equity ETF|G|N|N|100|Y|N +SZZL|Sizzle Acquisition Corp. II - Class A ordinary shares|G|N|N|100|N|N +SZZLR|Sizzle Acquisition Corp. II - Right|G|N|N|100|N|N +SZZLU|Sizzle Acquisition Corp. II - Unit|G|N|N|100|N|N +TACH|Titan Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +TACHU|Titan Acquisition Corp. - Units|G|N|N|100|N|N +TACHW|Titan Acquisition Corp. - Warrants|G|N|N|100|N|N +TACO|Berto Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +TACOU|Berto Acquisition Corp. - unit|G|N|N|100|N|N +TACOW|Berto Acquisition Corp. - Warrant|G|N|N|100|N|N +TACT|TransAct Technologies Incorporated - Common Stock|G|N|N|100|N|N +TALK|Talkspace, Inc. - Common Stock|S|N|N|100|N|N +TALKW|Talkspace, Inc. - Warrant|S|N|N|100|N|N +TANH|Tantech Holdings Ltd. - Common Shares|S|N|N|100|N|N +TAOP|Taoping Inc. - Ordinary Shares|S|N|N|100|N|N +TAOX|Tao Synergies Inc. - Common Stock|S|N|N|100|N|N +TARA|Protara Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TARK|Tradr 2X Long Innovation ETF|G|N|N|100|Y|N +TARS|Tarsus Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +TASK|TaskUs, Inc. - Class A Common Stock|Q|N|N|100|N|N +TATT|TAT Technologies Ltd. - Ordinary Shares|G|N|N|100|N|N +TAVI|Tavia Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +TAVIR|Tavia Acquisition Corp. - Right|G|N|N|100|N|N +TAVIU|Tavia Acquisition Corp. - Unit|G|N|N|100|N|N +TAX|Cambria Tax Aware ETF|G|N|N|100|Y|N +TAXE|Intermediate Municipal Income ETF|G|N|N|100|Y|N +TAXI|Northern Trust Intermediate Tax-Exempt Bond ETF|G|N|N|100|Y|N +TAXS|Northern Trust Short-Term Tax-Exempt Bond ETF|G|N|N|100|Y|N +TAXT|Northern Trust Tax-Exempt Bond ETF|G|N|N|100|Y|N +TAYD|Taylor Devices, Inc. - Common Stock|S|N|N|100|N|N +TBBK|The Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +TBCH|Turtle Beach Corporation - Common Stock|G|N|N|100|N|N +TBH|Brag House Holdings, Inc. - Common Stock|S|N|D|100|N|N +TBHC|The Brand House Collective, Inc - Common Stock|Q|N|N|100|N|N +TBIL|US Treasury 3 Month Bill ETF|G|N|N|100|Y|N +TBLA|Taboola.com Ltd. - Ordinary Shares|Q|N|N|100|N|N +TBLAW|Taboola.com Ltd. - Warrant|Q|N|N|100|N|N +TBLD|Thornburg Income Builder Opportunities Trust - Closed End Fund|Q|N|N|100|N|N +TBMC|Trailblazer Merger Corporation I - Class A Common Stock|G|N|D|100|N|N +TBMCR|Trailblazer Merger Corporation I - Rights|G|N|D|100|N|N +TBPH|Theravance Biopharma, Inc. - Ordinary Shares|G|N|N|100|N|N +TBRG|TruBridge, Inc. - Common Stock|Q|N|N|100|N|N +TC|Token Cat Limited - American Depositary Shares|S|N|N|100|N|N +TCBI|Texas Capital Bancshares, Inc. - Common Stock|Q|N|N|100|N|N +TCBIO|Texas Capital Bancshares, Inc. - Depositary Shares 5.75% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series B|Q|N|N|100|N|N +TCBK|TriCo Bancshares - Common Stock|Q|N|N|100|N|N +TCBS|Texas Community Bancshares, Inc. - Common Stock|S|N|N|100|N|N +TCHI|iShares MSCI China Multisector Tech ETF|G|N|N|100|Y|N +TCMD|Tactile Systems Technology, Inc. - Common Stock|G|N|N|100|N|N +TCOM|Trip.com Group Limited - American Depositary Shares|Q|N|N|100|N|N +TCPC|BlackRock TCP Capital Corp. - Closed End Fund|Q|N|N|100|N|N +TCRT|Alaunos Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +TCRX|TScan Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TCX|Tucows Inc. - Common Stock|S|N|N|100|N|N +TDAC|Translational Development Acquisition Corp. - Ordinary Shares|G|N|N|100|N|N +TDACU|Translational Development Acquisition Corp. - Units|G|N|N|100|N|N +TDACW|Translational Development Acquisition Corp. - Warrants|G|N|N|100|N|N +TDI|Touchstone Dynamic International ETF|G|N|N|100|Y|N +TDIC|Dreamland Limited - Class A Ordinary Shares|S|N|D|100|N|N +TDIV|First Trust NASDAQ Technology Dividend Index Fund|G|N|N|100|Y|N +TDOG|21shares Dogecoin ETF|G|N|N|100|Y|N +TDSB|ETC Cabana Target Beta ETF|G|N|N|100|Y|N +TDSC|ETC Cabana Target Drawdown 10 ETF|G|N|N|100|Y|N +TDTH|Trident Digital Tech Holdings Ltd - American Depository Shares|S|N|D|100|N|N +TDUP|ThredUp Inc. - Class A Common Stock|Q|N|N|100|N|N +TDWD|Tailwind 2.0 Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +TDWDR|Tailwind 2.0 Acquisition Corp. - Rights|G|N|N|100|N|N +TDWDU|Tailwind 2.0 Acquisition Corp. - Unit|G|N|N|100|N|N +TEAD|Teads Holding Co. - Common Stock|Q|N|D|100|N|N +TEAM|Atlassian Corporation - Class A Common Stock|Q|N|N|100|N|N +TECH|Bio-Techne Corp - Common Stock|Q|N|N|100|N|N +TECTP|Tectonic Financial, Inc. - 9.00% Fixed-to-Floating Rate Series B Non-Cumulative Perpetual Preferred Stock|S|N|N|100|N|N +TECX|Tectonic Therapeutic, Inc. - Common Stock|G|N|N|100|N|N +TEKX|SPDR Galaxy Transformative Tech Accelerators ETF|G|N|N|100|Y|N +TEKY|Lazard Next Gen Technologies ETF|G|N|N|100|Y|N +TELA|TELA Bio, Inc. - Common stock|G|N|N|100|N|N +TELO|Telomir Pharmaceuticals, Inc. - Common Stock|S|N|D|100|N|N +TEM|Tempus AI, Inc. - Class A Common Stock|Q|N|N|100|N|N +TENB|Tenable Holdings, Inc. - Common Stock|Q|N|N|100|N|N +TENX|Tenax Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +TER|Teradyne, Inc. - Common Stock|Q|N|N|100|N|N +TERG|Leverage Shares 2X Long TER Daily ETF|G|N|N|100|Y|N +TERN|Terns Pharmaceuticals, Inc. - Common Stock|Q|N|N|100|N|N +TEXN|iShares Texas Equity ETF|G|N|N|100|Y|N +TEXX|Horizon Kinetics Texas ETF|G|N|N|100|Y|N +TFNS|T. Rowe Price Financials ETF|G|N|N|100|Y|N +TFSL|TFS Financial Corporation - Common Stock|Q|N|N|100|N|N +TGHL|The GrowHub Limited - Class A Ordinary Shares|S|N|D|100|N|N +TGL|Treasure Global Inc. - Common Stock|S|N|N|100|N|N +TGTX|TG Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +TH|Target Hospitality Corp. - Common Stock|S|N|N|100|N|N +THAR|Tharimmune, Inc. - Common Stock|S|N|D|100|N|N +THCH|TH International Limited - Ordinary shares|S|N|N|100|N|N +THFF|First Financial Corporation - Common Stock|Q|N|N|100|N|N +THH|TryHard Holdings Limited - Ordinary Shares|S|N|N|100|N|N +THMZ|Lazard Equity Megatrends ETF|G|N|N|100|Y|N +THRM|Gentherm Inc - Common Stock|Q|N|N|100|N|N +THRV|Prospera Income ETF|G|N|N|100|Y|N +THRY|Thryv Holdings, Inc. - Common Stock|S|N|N|100|N|N +THYM|T. Rowe Price High Income Municipal ETF|G|N|N|100|Y|N +TIGO|Millicom International Cellular S.A. - Common Stock|Q|N|N|100|N|N +TIGR|UP Fintech Holding Limited - American Depositary Shares representing fifteen Class A Ordinary Shares|Q|N|N|100|N|N +TIL|Instil Bio, Inc. - Common Stock|S|N|N|100|N|N +TILE|Interface, Inc. - Common Stock|Q|N|N|100|N|N +TIPT|Tiptree Inc. - Common Stock|S|N|N|100|N|N +TIRX|TIAN RUIXIANG Holdings Ltd - Class A Ordinary Shares|S|N|D|100|N|N +TITN|Titan Machinery Inc. - Common Stock|Q|N|N|100|N|N +TIVC|Tivic Health Systems, Inc. - Common stock|S|N|N|100|N|N +TJGC|TJGC Group Limited - ordinary shares|S|N|N|100|N|N +TKLF|Tokyo Lifestyle Co., Ltd. - American Depositary Shares|S|N|N|100|N|N +TKNO|Alpha Teknova, Inc. - Common Stock|G|N|N|100|N|N +TLF|Tandy Leather Factory, Inc. - common stock|S|N|N|100|N|N +TLIH|Ten-League International Holdings Limited - Ordinary Shares|S|N|D|100|N|N +TLN|Talen Energy Corporation - Common Stock|Q|N|N|40|N|N +TLNC|Talon Capital Corp. - Class A Ordinary Shares|G|N|N|100|N|N +TLNCU|Talon Capital Corp. - Units|G|N|N|100|N|N +TLNCW|Talon Capital Corp. - Warrants|G|N|N|100|N|N +TLPH|Talphera, Inc. - Common Stock|S|N|N|100|N|N +TLRY|Tilray Brands, Inc. - Common Stock|Q|N|N|100|N|N +TLS|Telos Corporation - Common Stock|G|N|N|100|N|N +TLSA|Tiziana Life Sciences Ltd - Common Shares|S|N|N|100|N|N +TLSI|TriSalus Life Sciences, Inc. - Common Stock|G|N|N|100|N|N +TLSIW|TriSalus Life Sciences, Inc. - Warrant|G|N|N|100|N|N +TLT|iShares 20+ Year Treasury Bond ETF|G|N|N|100|Y|N +TLX|Telix Pharmaceuticals Limited - American Depositary Shares|Q|N|N|100|N|N +TMB|Thornburg Multi Sector Bond ETF|G|N|N|100|Y|N +TMC|TMC the metals company Inc. - Common Stock|Q|N|N|100|N|N +TMCI|Treace Medical Concepts, Inc. - Common Stock|Q|N|N|100|N|N +TMCWW|TMC the metals company Inc. - Warrant|Q|N|N|100|N|N +TMDX|TransMedics Group, Inc. - Common Stock|G|N|N|100|N|N +TMED|T. Rowe Price Health Care ETF|G|N|N|100|Y|N +TMET|iShares Transition-Enabling Metals ETF|G|N|N|100|Y|N +TMNL|T. Rowe Price Long Municipal Income ETF|G|N|N|100|Y|N +TMNS|T. Rowe Price Short Municipal Income ETF|G|N|N|100|Y|N +TMSF|T. Rowe Price Multi-Sector Income ETF|G|N|N|100|Y|N +TMUS|T-Mobile US, Inc. - Common Stock|Q|N|N|100|N|N +TMUSI|T-Mobile US, Inc. - 5.500% Senior Notes due June 2070|G|N|N|100|N|N +TMUSL|T-Mobile US, Inc. - 6.250% Senior Notes due 2069|G|N|N|100|N|N +TMUSZ|T-Mobile US, Inc. - 5.500% Senior Notes due March 2070|G|N|N|100|N|N +TNDM|Tandem Diabetes Care, Inc. - Common Stock|G|N|N|100|N|N +TNGX|Tango Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TNMG|TNL Mediagene - Ordinary Shares|S|N|N|100|N|N +TNON|Tenon Medical, Inc. - Common Stock|S|N|N|100|N|N +TNONW|Tenon Medical, Inc. - Warrant|S|N|N|100|N|N +TNXP|Tonix Pharmaceuticals Holding Corp. - Common Stock|S|N|N|100|N|N +TNYA|Tenaya Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +TOI|The Oncology Institute, Inc. - Common Stock|S|N|N|100|N|N +TOIIW|The Oncology Institute, Inc. - Warrant|S|N|N|100|N|N +TOMZ|TOMI Environmental Solutions, Inc. - Common Stock|S|N|D|100|N|N +TONX|TON Strategy Company - Common Stock|S|N|N|100|N|N +TOP|TOP Financial Group Limited - Class A Ordinary Shares|S|N|N|100|N|N +TORO|Toro Corp. - Common stock|S|N|N|100|N|N +TOUR|Tuniu Corporation - American Depositary Shares|S|N|D|100|N|N +TOWN|Towne Bank - Common Stock|Q|N|N|100|N|N +TOYO|TOYO Co., Ltd - Ordinary Shares|S|N|N|100|N|N +TPCS|TechPrecision Corporation - Common stock|S|N|N|100|N|N +TPG|TPG Inc. - Class A Common Stock|Q|N|N|100|N|N +TPGXL|TPG Inc. - 6.950% Fixed-Rate Junior Subordinated Notes due 2064|G|N|N|100|N|N +TPLS|Thornburg Core Plus Bond ETF|G|N|N|100|Y|N +TPST|Tempest Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +TQQQ|ProShares UltraPro QQQ|G|N|N|100|Y|N +TQQY|GraniteShares YieldBOOST QQQ ETF|G|N|N|100|Y|N +TRAW|Traws Pharma, Inc. - Common Stock|S|N|N|100|N|N +TRBF|Angel Oak Total Return ETF|G|N|N|100|Y|N +TRDA|Entrada Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TREE|LendingTree, Inc. - Common Stock|Q|N|N|100|N|N +TRI|Thomson Reuters Corp - Common Shares|Q|N|N|100|N|N +TRIB|Trinity Biotech plc - American Depositary Shares|Q|N|N|100|N|N +TRIN|Trinity Capital Inc. - Common Stock|Q|N|N|100|N|N +TRINI|Trinity Capital Inc. - 7.875% Notes Due 2029|Q|N|N|100|N|N +TRINZ|Trinity Capital Inc. - 7.875% Notes due 2029|Q|N|N|100|N|N +TRIP|TripAdvisor, Inc. - Common Stock|Q|N|N|100|N|N +TRMB|Trimble Inc. - Common Stock|Q|N|N|100|N|N +TRMD|TORM plc - Class A Common Stock|Q|N|N|100|N|N +TRMK|Trustmark Corporation - Common Stock|Q|N|N|100|N|N +TRNR|Interactive Strength Inc. - Common Stock|S|N|N|100|N|N +TRNS|Transcat, Inc. - Common Stock|G|N|N|100|N|N +TRON|Tron Inc. - Common Stock|S|N|N|100|N|N +TROO|TROOPS, Inc. - Ordinary Shares|S|N|N|100|N|N +TROW|T. Rowe Price Group, Inc. - Common Stock|Q|N|N|100|N|N +TRS|TriMas Corporation - Common Stock|Q|N|N|100|N|N +TRSG|Tungray Technologies Inc - Class A Ordinary Shares|S|N|N|100|N|N +TRST|TrustCo Bank Corp NY - Common Stock|Q|N|N|100|N|N +TRUD|VanEck Consumer Discretionary TruSector ETF|G|N|N|100|Y|N +TRUG|TruGolf Holdings, Inc. - Class A Common Stock|S|N|D|100|N|N +TRUP|Trupanion, Inc. - Common Stock|G|N|N|100|N|N +TRUT|VanEck Technology TruSector ETF|G|N|N|100|Y|N +TRVG|trivago N.V. - American Depositary Shares|Q|N|N|100|N|N +TRVI|Trevi Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TSAT|Telesat Corporation - Class A Common Shares and Class B Variable Voting Shares|Q|N|N|100|N|N +TSBK|Timberland Bancorp, Inc. - Common Stock|G|N|N|100|N|N +TSCM|TimesSquare Quality Mid Cap Growth ETF|G|N|N|100|Y|N +TSCO|Tractor Supply Company - Common Stock|Q|N|N|100|N|N +TSDD|GraniteShares 2x Short TSLA Daily ETF|G|N|N|100|Y|N +TSEL|Touchstone Sands Capital US Select Growth ETF|G|N|N|100|Y|N +TSEM|Tower Semiconductor Ltd. - Ordinary Shares|Q|N|N|100|N|N +TSHA|Taysha Gene Therapies, Inc. - Common Stock|Q|N|N|100|N|N +TSL|GraniteShares 1.25x Long TSLA Daily ETF|G|N|N|100|Y|N +TSLA|Tesla, Inc. - Common Stock|Q|N|N|40|N|N +TSLG|Leverage Shares 2X Long TSLA Daily ETF|G|N|N|100|Y|N +TSLL|Direxion Daily TSLA Bull 2X Shares|G|N|N|100|Y|N +TSLQ|Tradr 2X Short TSLA Daily ETF|G|N|N|100|Y|N +TSLR|GraniteShares 2x Long TSLA Daily ETF|G|N|N|100|Y|N +TSLS|Direxion Daily TSLA Bear 1X Shares|G|N|N|100|Y|N +TSMG|Leverage Shares 2X Long TSM Daily ETF|G|N|N|100|Y|N +TSMU|GraniteShares 2x Long TSM Daily ETF|G|N|N|100|Y|N +TSMX|Direxion Daily TSM Bull 2X Shares|G|N|N|100|Y|N +TSMZ|Direxion Daily TSM Bear 1X Shares|G|N|N|100|Y|N +TSPY|TappAlpha SPY Growth & Daily Income ETF|G|N|N|100|Y|N +TSSI|TSS, Inc. - Common Stock|S|N|N|100|N|N +TSYX|TSPY Lift ETF|G|N|N|100|Y|N +TSYY|GraniteShares YieldBOOST TSLA ETF|G|N|N|100|Y|N +TTAN|ServiceTitan, Inc. - Class A Common Stock|Q|N|N|100|N|N +TTD|The Trade Desk, Inc. - Class A Common Stock|G|N|N|100|N|N +TTEC|TTEC Holdings, Inc. - Common Stock|Q|N|N|100|N|N +TTEK|Tetra Tech, Inc. - Common Stock|Q|N|N|100|N|N +TTEQ|T. Rowe Price Technology ETF|G|N|N|100|Y|N +TTGT|TechTarget, Inc. - Common Stock|Q|N|N|100|N|N +TTMI|TTM Technologies, Inc. - Common Stock|Q|N|N|100|N|N +TTRX|Turn Therapeutics Inc. - Common Stock|G|N|N|100|N|N +TTWO|Take-Two Interactive Software, Inc. - Common Stock|Q|N|N|100|N|N +TUG|STF Tactical Growth ETF|G|N|N|100|Y|N +TUGN|STF Tactical Growth & Income ETF|G|N|N|100|Y|N +TUR|iShares MSCI Turkey ETF|G|N|N|100|Y|N +TURB|Turbo Energy, S.A. - American Depositary Shares|S|N|D|100|N|N +TURF|T. Rowe Price Natural Resources ETF|G|N|N|100|Y|N +TUSK|Mammoth Energy Services, Inc. - Common Stock|Q|N|N|100|N|N +TVA|Texas Ventures Acquisition III Corp - Class A Ordinary Share|G|N|N|100|N|N +TVACU|Texas Ventures Acquisition III Corp - Unit|G|N|N|100|N|N +TVACW|Texas Ventures Acquisition III Corp - Warrants|G|N|N|100|N|N +TVAI|Thayer Ventures Acquisition Corporation II - Class A Ordinary Shares|G|N|N|100|N|N +TVAIR|Thayer Ventures Acquisition Corporation II - Rights|G|N|N|100|N|N +TVAIU|Thayer Ventures Acquisition Corporation II - Unit|G|N|N|100|N|N +TVGN|Tevogen Bio Holdings Inc. - Common Stock|G|N|D|100|N|N +TVGNW|Tevogen Bio Holdings Inc. - Warrant|S|N|N|100|N|N +TVRD|Tvardi Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +TVTX|Travere Therapeutics, Inc. - Common Stock|G|N|N|100|N|N +TW|Tradeweb Markets Inc. - Class A Common Stock|Q|N|N|100|N|N +TWAV|TaoWeave, Inc. - Common Stock|S|N|N|100|N|N +TWFG|TWFG, Inc. - Common Stock|Q|N|N|100|N|N +TWG|Top Wealth Group Holding Limited - Class A Ordinary Shares|S|N|N|100|N|N +TWIN|Twin Disc, Incorporated - Common Stock|Q|N|N|100|N|N +TWLV|Twelve Seas Investment Company III - Class A Ordinary Shares|G|N|N|100|N|N +TWLVR|Twelve Seas Investment Company III - Rights|G|N|N|100|N|N +TWLVU|Twelve Seas Investment Company III - Units|G|N|N|100|N|N +TWNP|Twin Hospitality Group Inc. - Class A Common Stock|G|N|D|100|N|N +TWST|Twist Bioscience Corporation - Common Stock|Q|N|N|100|N|N +TXG|10x Genomics, Inc. - Common Stock|Q|N|N|100|N|N +TXMD|TherapeuticsMD, Inc. - Common Stock|Q|N|N|100|N|N +TXN|Texas Instruments Incorporated - Common Stock|Q|N|N|100|N|N +TXRH|Texas Roadhouse, Inc. - Common Stock|Q|N|N|100|N|N +TXUE|Thornburg International Equity ETF|G|N|N|100|Y|N +TXUG|Thornburg International Growth Fund ETF|G|N|N|100|Y|N +TXXD|21Shares 2x Long Dogecoin ETF|G|N|N|100|Y|N +TXXS|21Shares 2x Long Sui ETF|G|N|N|100|Y|N +TYGO|Tigo Energy, Inc. - Common Stock|S|N|N|100|N|N +TYRA|Tyra Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +TZOO|Travelzoo - Common Stock|Q|N|N|100|N|N +UAE|iShares MSCI UAE ETF|G|N|N|100|Y|N +UAL|United Airlines Holdings, Inc. - Common Stock|Q|N|N|100|N|N +UBCP|United Bancorp, Inc. - Common Stock|S|N|N|100|N|N +UBFO|United Security Bancshares - Common Stock|Q|N|N|100|N|N +UBND|VictoryShares Core Plus Bond ETF|G|N|N|100|Y|N +UBRL|GraniteShares 2x Long UBER Daily ETF|G|N|N|100|Y|N +UBSI|United Bankshares, Inc. - Common Stock|Q|N|N|100|N|N +UBXG|U-BX Technology Ltd. - Class A Ordinary Shares|S|N|N|100|N|N +UCAR|U Power Limited - Class A Ordinary Shares|S|N|N|100|N|N +UCFI|CN Healthy Food Tech Group Corp. - Common Stock|S|N|N|100|N|N +UCFIW|CN Healthy Food Tech Group Corp. - Warrant|S|N|N|100|N|N +UCL|uCloudlink Group Inc. - American Depositary Shares|G|N|N|100|N|N +UCRD|VictoryShares Corporate Bond ETF|G|N|N|100|Y|N +UCTT|Ultra Clean Holdings, Inc. - Common Stock|Q|N|N|100|N|N +UCYB|ProShares Ultra Nasdaq Cybersecurity|G|N|N|100|Y|N +UDMY|Udemy, Inc. - Common Stock|Q|N|N|100|N|N +UEIC|Universal Electronics Inc. - Common Stock|Q|N|N|100|N|N +UEVM|VictoryShares Emerging Markets Value Momentum ETF|G|N|N|100|Y|N +UFCS|United Fire Group, Inc - Common Stock|Q|N|N|100|N|N +UFG|Uni-Fuels Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +UFIV|US Treasury 5 Year Note ETF|G|N|N|100|Y|N +UFO|Procure Space ETF|G|N|N|100|Y|N +UFPI|UFP Industries, Inc. - Common Stock|Q|N|N|100|N|N +UFPT|UFP Technologies, Inc. - Common Stock|S|N|N|100|N|N +UG|United-Guardian, Inc. - Common Stock|G|N|N|100|N|N +UGRO|urban-gro, Inc. - Common Stock|S|N|H|100|N|N +UHG|United Homes Group, Inc - Class A Common Stock|G|N|N|100|N|N +UHGWW|United Homes Group, Inc - Warrant|S|N|N|100|N|N +UITB|VictoryShares Core Intermediate Bond ETF|G|N|N|100|Y|N +UIVM|VictoryShares International Value Momentum ETF|G|N|N|100|Y|N +UK|Ucommune International Ltd - Ordinary Shares|S|N|D|100|N|N +ULBI|Ultralife Corporation - Common Stock|G|N|N|100|N|N +ULCC|Frontier Group Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ULH|Universal Logistics Holdings, Inc. - Common Stock|Q|N|N|100|N|N +ULTA|Ulta Beauty, Inc. - Common Stock|Q|N|N|40|N|N +ULTI|REX IncomeMax Option Strategy ETF|G|N|N|100|Y|N +ULVM|VictoryShares US Value Momentum ETF|G|N|N|100|Y|N +ULY|Urgent.ly Inc. - Common Stock|S|N|D|100|N|N +UMBF|UMB Financial Corporation - Common Stock|Q|N|N|100|N|N +UMBFO|UMB Financial Corporation - Depositary Shares Each Representing a 1/400th Interest in a Share of 7.750% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series B|Q|N|N|100|N|N +UMMA|Wahed Dow Jones Islamic World ETF|G|N|N|100|Y|N +UNB|Union Bankshares, Inc. - Common Stock|G|N|N|100|N|N +UNCY|Unicycive Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +UNHG|Leverage Shares 2X Long UNH Daily ETF|G|N|N|100|Y|N +UNIT|Uniti Group Inc. - Common Stock|Q|N|N|100|N|N +UNIY|WisdomTree Voya Yield Enhanced USD Universal Bond Fund|G|N|N|100|Y|N +UNTY|Unity Bancorp, Inc. - Common Stock|G|N|N|100|N|N +UOKA|MDJM LTD - Class A Ordinary Shares|S|N|N|100|N|N +UONE|Urban One, Inc. - Class A Common Stock|S|N|N|100|N|N +UONEK|Urban One, Inc. - Class D Common Stock|S|N|D|100|N|N +UPB|Upstream Bio, Inc. - Common Stock|Q|N|N|100|N|N +UPBD|Upbound Group, Inc. - Common Stock|Q|N|N|100|N|N +UPC|Universe Pharmaceuticals Inc - Ordinary Shares|S|N|N|100|N|N +UPGR|Xtrackers US Green Infrastructure Select Equity ETF|G|N|N|100|Y|N +UPLD|Upland Software, Inc. - Common Stock|G|N|N|100|N|N +UPSG|Leverage Shares 2X Long UPS Daily ETF|G|N|N|100|Y|N +UPST|Upstart Holdings, Inc. - Common stock|Q|N|N|100|N|N +UPWK|Upwork Inc. - Common Stock|Q|N|N|100|N|N +UPXI|Upexi, Inc. - Common Stock|S|N|N|100|N|N +URBN|Urban Outfitters, Inc. - Common Stock|Q|N|N|100|N|N +URGN|UroGen Pharma Ltd. - Ordinary Shares|G|N|N|100|N|N +URNJ|Sprott Junior Uranium Miners ETF|G|N|N|100|Y|N +UROY|Uranium Royalty Corp. - Common Stock|S|N|N|100|N|N +USAF|Atlas America Fund|G|N|N|100|Y|N +USAR|USA Rare Earth, Inc. - Common Stock|G|N|N|100|N|N +USAU|U.S. Gold Corp. - Common Stock|S|N|N|100|N|N +USCB|USCB Financial Holdings, Inc. - Class A Common Stock|G|N|N|100|N|N +USCL|iShares Climate Conscious & Transition MSCI USA ETF|G|N|N|100|Y|N +USDX|SGI Enhanced Core ETF|G|N|N|100|Y|N +USEA|United Maritime Corporation - Common Stock|S|N|N|100|N|N +USEG|U.S. Energy Corp. - Common Stock|S|N|N|100|N|N +USFI|BrandywineGLOBAL - U.S. Fixed Income ETF|G|N|N|100|Y|N +USGG|Leverage Shares 2X Long USAR Daily ETF|G|N|N|100|Y|N +USGO|U.S. GoldMining Inc. - Common stock|S|N|N|100|N|N +USGOW|U.S. GoldMining Inc. - Warrant|S|N|N|100|N|N +USIG|iShares Broad USD Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +USIN|WisdomTree 7-10 Year Laddered Treasury Fund|G|N|N|100|Y|N +USIO|Usio, Inc. - Common Stock|G|N|N|100|N|N +USLM|United States Lime & Minerals, Inc. - Common Stock|Q|N|N|100|N|N +USMC|Principal U.S. Mega-Cap ETF|G|N|N|100|Y|N +USOI|ETRACS Crude Oil Shares Covered Call ETNs due April 24, 2037|G|N|N|100|Y|N +USOY|Defiance Oil Enhanced Options Income ETF|G|N|N|100|Y|N +USRD|Themes US R&D Champions ETF|G|N|N|100|Y|N +USSH|WisdomTree 1-3 Year Laddered Treasury Fund|G|N|N|100|Y|N +USTB|VictoryShares Short-Term Bond ETF|G|N|N|100|Y|N +USVM|VictoryShares US Small Mid Cap Value Momentum ETF|G|N|N|100|Y|N +USVN|US Treasury 7 Year Note ETF|G|N|N|100|Y|N +USXF|iShares ESG Advanced MSCI USA ETF|G|N|N|100|Y|N +UTEN|US Treasury 10 Year Note ETF|G|N|N|100|Y|N +UTHR|United Therapeutics Corporation - Common Stock|Q|N|N|40|N|N +UTHY|US Treasury 30 Year Bond ETF|G|N|N|100|Y|N +UTMD|Utah Medical Products, Inc. - Common Stock|Q|N|N|100|N|N +UTRE|US Treasury 3 Year Note ETF|G|N|N|100|Y|N +UTSI|UTStarcom Holdings Corp - Ordinary Shares|Q|N|N|100|N|N +UTWO|US Treasury 2 Year Note ETF|G|N|N|100|Y|N +UTWY|US Treasury 20 Year Bond ETF|G|N|N|100|Y|N +UUUG|Leverage Shares 2X Long UUUU Daily ETF|G|N|N|100|Y|N +UVSP|Univest Financial Corporation - Common Stock|Q|N|N|100|N|N +UXIN|Uxin Limited - American Depositary Shares|Q|N|N|100|N|N +UYLD|Angel Oak UltraShort Income ETF|G|N|N|100|Y|N +UYSC|UY Scuti Acquisition Corp. - Ordinary Shares|S|N|N|100|N|N +UYSCR|UY Scuti Acquisition Corp. - Rights|S|N|N|100|N|N +UYSCU|UY Scuti Acquisition Corp. - Units|S|N|N|100|N|N +VABK|Virginia National Bankshares Corporation - Common Stock|S|N|N|100|N|N +VACH|Voyager Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +VACHU|Voyager Acquisition Corp - Unit|G|N|N|100|N|N +VACHW|Voyager Acquisition Corp - Warrants|G|N|N|100|N|N +VALG|Leverage Shares 2X Long VALE Daily ETF|G|N|N|100|Y|N +VALN|Valneva SE - American Depositary Shares|Q|N|N|100|N|N +VALU|Value Line, Inc. - Common Stock|S|N|N|100|N|N +VANI|Vivani Medical, Inc. - Common Stock|S|N|N|100|N|N +VAVX|VanEck Avalanche ETF|G|N|N|100|Y|N +VBIL|Vanguard 0-3 Month Treasury Bill ETF|G|N|N|100|Y|N +VBIX|Viewbix Inc. - Common Stock |S|N|N|100|N|N +VBNK|VersaBank - Common Shares|Q|N|N|100|N|N +VC|Visteon Corporation - Common Stock|Q|N|N|100|N|N +VCEL|Vericel Corporation - Common Stock|G|N|N|100|N|N +VCIC|Vine Hill Capital Investment Corp. - Class A Ordinary Shares|G|N|N|100|N|N +VCICU|Vine Hill Capital Investment Corp. - Unit|G|N|N|100|N|N +VCICW|Vine Hill Capital Investment Corp. - Warrant|G|N|N|100|N|N +VCIG|VCI Global Limited - Ordinary Share|S|N|N|100|N|N +VCIT|Vanguard Intermediate-Term Corporate Bond ETF|G|N|N|100|Y|N +VCLT|Vanguard Long-Term Corporate Bond ETF|G|N|N|100|Y|N +VCRB|Vanguard Core Bond ETF|G|N|N|100|Y|N +VCSH|Vanguard Short-Term Corporate Bond ETF|G|N|N|100|Y|N +VCTR|Victory Capital Holdings, Inc. - Common Stock|Q|N|N|100|N|N +VCYT|Veracyte, Inc. - Common Stock|G|N|N|100|N|N +VECO|Veeco Instruments Inc. - Common Stock|Q|N|N|100|N|N +VEEA|Veea Inc. - Common Stock|G|N|D|100|N|N +VEEAW|Veea Inc. - Warrant|S|N|N|100|N|N +VEEE|Twin Vee PowerCats Co. - Common Stock|S|N|N|100|N|N +VELO|Velo3D, Inc. - Common stock|S|N|N|100|N|N +VEON|VEON Ltd. - American Depositary Shares|Q|N|N|100|N|N +VERA|Vera Therapeutics, Inc. - Class A Common Stock|G|N|N|100|N|N +VERI|Veritone, Inc. - Common Stock|G|N|N|100|N|N +VERO|Venus Concept Inc. - Common Stock|S|N|N|100|N|N +VERU|Veru Inc. - Common Stock|S|N|N|100|N|N +VERX|Vertex, Inc. - Class A Common Stock|G|N|N|100|N|N +VFF|Village Farms International, Inc. - Common Shares|S|N|N|100|N|N +VFLO|VictoryShares Free Cash Flow ETF|G|N|N|100|Y|N +VFS|VinFast Auto Ltd. - Ordinary Shares|Q|N|N|100|N|N +VFSWW|VinFast Auto Ltd. - Warrant|S|N|N|100|N|N +VGAS|Verde Clean Fuels, Inc. - Class A Common Stock|S|N|N|100|N|N +VGASW|Verde Clean Fuels, Inc. - Warrant|S|N|N|100|N|N +VGIT|Vanguard Intermediate-Term Treasury ETF|G|N|N|100|Y|N +VGLT|Vanguard Long-Term Treasury ETF|G|N|N|100|Y|N +VGSH|Vanguard Short-Term Treasury ETF|G|N|N|100|Y|N +VGSR|Vert Global Sustainable Real Estate ETF|G|N|N|100|Y|N +VGUS|Vanguard Ultra-Short Treasury ETF|G|N|N|100|Y|N +VHC|VirnetX Holding Corp - Common Stock|S|N|N|100|N|N +VHCPU|Vine Hill Capital Investment Corp. II - Units|G|N|N|100|N|N +VIASP|Via Renewables, Inc. - 8.75% Series A Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Stock|Q|N|N|100|N|N +VIAV|Viavi Solutions Inc. - Common Stock|Q|N|N|100|N|N +VICR|Vicor Corporation - Common Stock|Q|N|N|100|N|N +VIGI|Vanguard International Dividend Appreciation ETF|G|N|N|100|Y|N +VINP|Vinci Compass Investments Ltd. - Class A Common Shares|Q|N|N|100|N|N +VIOT|Viomi Technology Co., Ltd - American Depositary Shares|Q|N|N|100|N|N +VIR|Vir Biotechnology, Inc. - Common Stock|Q|N|N|100|N|N +VIRC|Virco Manufacturing Corporation - Common Stock|G|N|N|100|N|N +VISN|Vistance Networks, Inc. - Common Stock|Q|N|N|100|N|N +VITL|Vital Farms, Inc. - Common Stock|G|N|N|100|N|N +VIVS|VivoSim Labs, Inc. - Common Stock|S|N|N|100|N|N +VKTX|Viking Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +VLGEA|Village Super Market, Inc. - Class A Common Stock|Q|N|N|100|N|N +VLY|Valley National Bancorp - Common Stock|Q|N|N|100|N|N +VLYPN|Valley National Bancorp - 8.250% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series C|Q|N|N|100|N|N +VLYPO|Valley National Bancorp - 5.5% Fixed to Floating Rate Series B Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +VLYPP|Valley National Bancorp - 6.25% Fixed-to-Floating Rate Series A Non-Cumulative Perpetual Preferred Stock|Q|N|N|100|N|N +VMAR|Vision Marine Technologies Inc. - Common Shares|S|N|N|100|N|N +VMBS|Vanguard Mortgage-Backed Securities ETF|G|N|N|100|Y|N +VMD|Viemed Healthcare, Inc. - Common Shares|S|N|N|100|N|N +VNCE|Vince Holding Corp. - Common Stock|S|N|N|100|N|N +VNDA|Vanda Pharmaceuticals Inc. - Common Stock|G|N|N|100|N|N +VNET|VNET Group, Inc. - American Depositary Shares|Q|N|N|100|N|N +VNME|Vendome Acquisition Corporation I - Class A Ordinary Shares|G|N|N|100|N|N +VNMEU|Vendome Acquisition Corporation I - Unit|G|N|N|100|N|N +VNMEW|Vendome Acquisition Corporation I - Warrant|G|N|N|100|N|N +VNOM|Viper Energy, Inc. - Class A Common Stock|Q|N|N|100|N|N +VNQI|Vanguard Global ex-U.S. Real Estate ETF|G|N|N|100|Y|N +VOD|Vodafone Group Plc - American Depositary Shares each representing ten Ordinary Shares|Q|N|N|100|N|N +VOLT|Tema Electrification ETF|G|N|N|100|Y|N +VONE|Vanguard Russell 1000 ETF|G|N|N|40|Y|N +VONG|Vanguard Russell 1000 Growth ETF|G|N|N|100|Y|N +VONV|Vanguard Russell 1000 Value ETF|G|N|N|100|Y|N +VOR|Vor Biopharma Inc. - Common Stock|Q|N|N|100|N|N +VOTE|TCW Transform 500 ETF|G|N|N|100|Y|N +VOXR|Vox Royalty Corp. - common stock|S|N|N|100|N|N +VPLS|Vanguard Core Plus Bond ETF|G|N|N|100|Y|N +VRA|Vera Bradley, Inc. - Common Stock|Q|N|N|100|N|N +VRAR|The Glimpse Group, Inc. - Common Stock|S|N|N|100|N|N +VRAX|Virax Biolabs Group Limited - Ordinary Shares|S|N|D|100|N|N +VRCA|Verrica Pharmaceuticals Inc. - Common Stock|S|N|N|100|N|N +VRDN|Viridian Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +VREX|Varex Imaging Corporation - Common Stock|Q|N|N|100|N|N +VRIG|Invesco Variable Rate Investment Grade ETF|G|N|N|100|Y|N +VRM|Vroom, Inc. - Common Stock|G|N|N|100|N|N +VRME|VerifyMe, Inc. - Common Stock|S|N|D|100|N|N +VRNS|Varonis Systems, Inc. - Common Stock|Q|N|N|100|N|N +VRRM|Verra Mobility Corporation - Class A Common Stock|S|N|N|100|N|N +VRSK|Verisk Analytics, Inc. - Common Stock|Q|N|N|40|N|N +VRSN|VeriSign, Inc. - Common Stock|Q|N|N|40|N|N +VRTL|GraniteShares 2x Long VRT Daily ETF|G|N|N|100|Y|N +VRTX|Vertex Pharmaceuticals Incorporated - Common Stock|Q|N|N|40|N|N +VS|Versus Systems Inc. - Common Stock|S|N|N|100|N|N +VSA|VisionSys AI Inc. - American Depositary Shares|S|N|N|100|N|N +VSAT|ViaSat, Inc. - Common Stock|Q|N|N|100|N|N +VSDA|VictoryShares Dividend Accelerator ETF|G|N|N|100|Y|N +VSEC|VSE Corporation - Common Stock|Q|N|N|100|N|N +VSEE|VSee Health, Inc. - Common Stock|S|N|D|100|N|N +VSEEW|VSee Health, Inc. - Warrant|S|N|N|100|N|N +VSME|VS Media Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +VSMV|VictoryShares US Multi-Factor Minimum Volatility ETF|G|N|N|100|Y|N +VSNT|Versant Media Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +VSOL|VanEck Solana ETF|G|N|N|100|Y|N +VSTD|Vestand Inc. - Class A Common Stock|S|N|H|100|N|N +VSTL|Defiance Daily Target 2X Long VST ETF|G|N|N|100|Y|N +VSTM|Verastem, Inc. - Common Stock|S|N|N|100|N|N +VTC|Vanguard Total Corporate Bond ETF|G|N|N|100|Y|N +VTGN|Vistagen Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +VTHR|Vanguard Russell 3000 ETF|G|N|N|40|Y|N +VTIP|Vanguard Short-Term Inflation-Protected Securities Index Fund ETF Shares|G|N|N|100|Y|N +VTIX|Virtuix Holdings Inc. - Class A Common Stock|G|N|N|100|N|N +VTRS|Viatris Inc. - Common Stock|Q|N|N|100|N|N +VTSI|VirTra, Inc. - Common Stock|S|N|N|100|N|N +VTVT|vTv Therapeutics Inc. - Class A Common Stock|S|N|N|100|N|N +VTWG|Vanguard Russell 2000 Growth ETF|G|N|N|100|Y|N +VTWO|Vanguard Russell 2000 ETF|G|N|N|100|Y|N +VTWV|Vanguard Russell 2000 Value ETF|G|N|N|100|Y|N +VTYX|Ventyx Biosciences, Inc. - Common Stock|Q|N|N|100|N|N +VUZI|Vuzix Corporation - Common Stock|S|N|N|100|N|N +VVOS|Vivos Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +VVPR|VivoPower International PLC - Ordinary Shares|S|N|N|100|N|N +VWAV|VisionWave Holdings, Inc. - Common Stock|G|N|N|100|N|N +VWAVW|VisionWave Holdings, Inc. - Warrant|S|N|N|100|N|N +VWOB|Vanguard Emerging Markets Government Bond ETF|G|N|N|100|Y|N +VXUS|Vanguard Total International Stock ETF|G|N|N|100|Y|N +VYGR|Voyager Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +VYMI|Vanguard International High Dividend Yield ETF|G|N|N|100|Y|N +VYNE|VYNE Therapeutics Inc. - Common Stock|S|N|D|100|N|N +WABC|Westamerica Bancorporation - Common Stock|Q|N|N|100|N|N +WABF|Western Asset Bond ETF|G|N|N|100|Y|N +WAFD|WaFd, Inc. - Common Stock|Q|N|N|100|N|N +WAFDP|WaFd, Inc. - Depositary Shares|Q|N|N|100|N|N +WAFU|Wah Fu Education Group Limited - Ordinary Shares|S|N|N|100|N|N +WAI|Top KingWin Ltd - Class A Ordinary Shares|S|N|N|100|N|N +WALD|Waldencast plc - Class A Ordinary Share|S|N|N|100|N|N +WALDW|Waldencast plc - Warrant|S|N|N|100|N|N +WASH|Washington Trust Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +WATT|Energous Corporation - Common Stock|S|N|N|100|N|N +WAVE|Eco Wave Power Global AB (publ) - American Depositary Shares|S|N|N|100|N|N +WAY|Waystar Holding Corp. - Common Stock|Q|N|N|100|N|N +WB|Weibo Corporation - American Depositary Shares|Q|N|N|100|N|N +WBD|Warner Bros. Discovery, Inc. - Series A Common Stock|Q|N|N|100|N|N +WBTN|WEBTOON Entertainment Inc. - Common stock|Q|N|N|100|N|N +WBUY|WEBUY GLOBAL LTD. - Class A Ordinary Shares|S|N|D|100|N|N +WCBR|WisdomTree Cybersecurity Fund|G|N|N|100|Y|N +WCLD|WisdomTree Cloud Computing Fund|G|N|N|100|Y|N +WCT|Wellchange Holdings Company Limited - Class A Ordinary shares|S|N|D|100|N|N +WDAF|WisdomTree Asia Defense Fund|G|N|N|100|Y|N +WDAY|Workday, Inc. - Class A Common Stock|Q|N|N|100|N|N +WDC|Western Digital Corporation - Common Stock|Q|N|N|100|N|N +WDFC|WD-40 Company - Common Stock|Q|N|N|100|N|N +WDGF|WisdomTree Global Defense Fund|G|N|N|100|Y|N +WEEI|Westwood Salient Enhanced Energy Income ETF|G|N|N|100|Y|N +WEN|Wendy's Company (The) - Common Stock|Q|N|N|100|N|N +WENN|Wen Acquisition Corp - Class A Ordinary Shares|G|N|N|100|N|N +WENNU|Wen Acquisition Corp - Unit|G|N|N|100|N|N +WENNW|Wen Acquisition Corp - Warrant|G|N|N|100|N|N +WERN|Werner Enterprises, Inc. - Common Stock|Q|N|N|100|N|N +WEST|Westrock Coffee Company - Common Stock|G|N|N|100|N|N +WETH|Wetouch Technology Inc. - Common Stock|S|N|N|100|N|N +WETO|Webus International Limited - Ordinary Shares|S|N|D|100|N|N +WEYS|Weyco Group, Inc. - Common Stock|Q|N|N|100|N|N +WFCF|Where Food Comes From, Inc. - Common Stock|S|N|N|100|N|N +WFF|WF Holding Limited - Ordinary Shares|S|N|D|100|N|N +WFRD|Weatherford International plc - Ordinary shares|Q|N|N|100|N|N +WGMI|CoinShares Bitcoin Mining ETF|G|N|N|100|Y|N +WGRX|Wellgistics Health, Inc. - Common Stock|S|N|D|100|N|N +WGS|GeneDx Holdings Corp. - Class A Common Stock|Q|N|N|100|N|N +WGSWW|GeneDx Holdings Corp. - Warrant|Q|N|N|100|N|N +WHF|WhiteHorse Finance, Inc. - Closed End Fund|Q|N|N|100|N|N +WHFCL|WhiteHorse Finance, Inc. - 7.875% Notes due 2028|Q|N|N|100|N|N +WHLR|Wheeler Real Estate Investment Trust, Inc. - Common Stock|S|N|N|100|N|N +WHLRD|Wheeler Real Estate Investment Trust, Inc. - Series D Cumulative Preferred Stock|S|N|N|100|N|N +WHLRL|Wheeler Real Estate Investment Trust, Inc. - 7.00% Senior Subordinated Convertible Notes Due 2031|S|N|N|100|N|N +WHLRP|Wheeler Real Estate Investment Trust, Inc. - Series B Preferred Stock|S|N|N|100|N|N +WHWK|Whitehawk Therapeutics, Inc. - Common Stock|S|N|N|100|N|N +WILC|G. Willi-Food International, Ltd. - Ordinary Shares|S|N|N|100|N|N +WIMI|WiMi Hologram Cloud Inc. - Class B Ordinary Shares|G|N|N|100|N|N +WINA|Winmark Corporation - Common Stock|G|N|N|40|N|N +WING|Wingstop Inc. - Common Stock|Q|N|N|40|N|N +WISE|Themes Generative Artificial Intelligence ETF|G|N|N|100|Y|N +WIX|Wix.com Ltd. - Ordinary Shares|Q|N|N|100|N|N +WKEY|WISeKey International Holding Ltd - American Depositary Shares|G|N|N|100|N|N +WKHS|Workhorse Group, Inc. - Common Stock|S|N|N|100|N|N +WKSP|Worksport, Ltd. - Common Stock|S|N|N|100|N|N +WLAC|Willow Lane Acquisition Corp. - Class A Ordinary Shares|G|N|N|100|N|N +WLACU|Willow Lane Acquisition Corp. - Unit|G|N|N|100|N|N +WLACW|Willow Lane Acquisition Corp. - Warrants|G|N|N|100|N|N +WLDN|Willdan Group, Inc. - Common Stock|G|N|N|100|N|N +WLDS|Wearable Devices Ltd. - Ordinary Share|S|N|N|100|N|N +WLDSW|Wearable Devices Ltd. - Warrant|S|N|N|100|N|N +WLFC|Willis Lease Finance Corporation - Common Stock|G|N|N|100|N|N +WLTH|Wealthfront Corporation - Common Stock|Q|N|N|100|N|N +WMG|Warner Music Group Corp. - Class A Common Stock|Q|N|N|100|N|N +WMT|Walmart Inc. - Common Stock|Q|N|N|100|N|N +WNEB|Western New England Bancorp, Inc. - Common Stock|Q|N|N|100|N|N +WNW|Meiwu Technology Company Limited - Ordinary Shares|S|N|N|100|N|N +WOK|WORK Medical Technology Group LTD - Class A Ordinary Shares|S|N|N|100|N|N +WOOD|iShares Global Timber & Forestry ETF|G|N|N|100|Y|N +WOOF|Petco Health and Wellness Company, Inc. - Class A Common Stock|Q|N|N|100|N|N +WORX|SCWorx Corp. - Common Stock|S|N|D|100|N|N +WPRT|Westport Fuel Systems Inc - Common Shares|Q|N|N|100|N|N +WRAP|Wrap Technologies, Inc. - Common Stock|S|N|N|100|N|N +WRD|WeRide Inc. - American Depositary Shares|G|N|N|100|N|N +WRLD|World Acceptance Corporation - Common Stock|Q|N|N|100|N|N +WRND|NYLI Global Equity R&D Leaders ETF|G|N|N|100|Y|N +WSBC|WesBanco, Inc. - Common Stock|Q|N|N|100|N|N +WSBCO|WesBanco, Inc. - Depositary Shares each representing 1/40th interest in a share of 7.375% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series B|Q|N|N|100|N|N +WSBF|Waterstone Financial, Inc. - Common Stock|Q|N|N|100|N|N +WSBK|Winchester Bancorp, Inc. - Common Stock|S|N|N|100|N|N +WSC|WillScot Holdings Corporation - Class A Common Stock|S|N|N|100|N|N +WSFS|WSFS Financial Corporation - Common Stock|Q|N|N|100|N|N +WSGE|Warren Street Global Equity ETF|G|N|N|100|Y|N +WSHP|WeShop Holdings Limited - Class A Ordinary Shares|S|N|N|100|N|N +WSML|iShares MSCI World Small-Cap ETF|G|N|N|100|Y|N +WSTN|Westin Acquisition Corp - Class A Ordinary Share|S|N|N|100|N|N +WSTNR|Westin Acquisition Corp - Right|S|N|N|100|N|N +WSTNU|Westin Acquisition Corp - Units|S|N|N|100|N|N +WTBA|West Bancorporation - Common Stock|Q|N|N|100|N|N +WTBN|WisdomTree Bianco Total Return Fund|G|N|N|100|Y|N +WTF|Waton Financial Limited - Ordinary Shares|S|N|N|100|N|N +WTFC|Wintrust Financial Corporation - Common Stock|Q|N|N|100|N|N +WTFCN|Wintrust Financial Corporation - Depositary Shares, Each Representing a 1/1,000th Interest in a Share of 7.875% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock, Series F, no par value, with a liquidation preference of $25,000 per share|Q|N|N|100|N|N +WTG|Wintergreen Acquisition Corp. - Ordinary Shares|S|N|N|100|N|N +WTGUR|Wintergreen Acquisition Corp. - Rights|S|N|N|100|N|N +WTGUU|Wintergreen Acquisition Corp. - Unit|S|N|N|100|N|N +WTIP|WisdomTree Inflation Plus Fund|G|N|N|100|Y|N +WTMU|WisdomTree Core Laddered Municipal Fund|G|N|N|100|Y|N +WTMY|WisdomTree High Income Laddered Municipal Fund|G|N|N|100|Y|N +WTO|UTime Limited - Class A Ordinary Shares|S|N|N|100|N|N +WTW|Willis Towers Watson Public Limited Company - Ordinary Shares|Q|N|N|40|N|N +WULF|TeraWulf Inc. - Common Stock|S|N|N|100|N|N +WVE|Wave Life Sciences Ltd. - Ordinary Shares|G|N|N|100|N|N +WVVI|Willamette Valley Vineyards, Inc. - Common Stock|S|N|N|100|N|N +WVVIP|Willamette Valley Vineyards, Inc. - Series A Redeemable Preferred Stock|S|N|N|100|N|N +WW|WW International, Inc. - Common Stock|G|N|N|100|N|N +WWD|Woodward, Inc. - Common Stock|Q|N|N|100|N|N +WXM|WF International Limited - Ordinary Shares|S|N|D|100|N|N +WYFI|WhiteFiber, Inc. - Ordinary Shares|S|N|N|100|N|N +WYHG|Wing Yip Food Holdings Group Limited - American Depositary Shares|S|N|D|100|N|N +WYNN|Wynn Resorts, Limited - Common Stock|Q|N|N|100|N|N +XAIR|Beyond Air, Inc. - Common Stock|S|N|N|100|N|N +XAIX|Xtrackers Artificial Intelligence and Big Data ETF|G|N|N|100|Y|N +XBIL|US Treasury 6 Month Bill ETF|G|N|N|100|Y|N +XBIO|Xenetic Biosciences, Inc. - Common Stock|S|N|N|100|N|N +XBIT|XBiotech Inc. - Common Stock|Q|N|N|100|N|N +XBP|XBP Global Holdings, Inc. - Common Stock|S|N|N|100|N|N +XBPEW|XBP Global Holdings, Inc. - Warrant|S|N|N|100|N|N +XBTY|GraniteShares YieldBOOST Bitcoin ETF|G|N|N|100|Y|N +XCBEU|X3 Acquisition Corp. Ltd. - Unit|G|N|N|100|N|N +XCH|XCHG Limited - ADS|G|N|N|100|N|N +XCNY|SPDR S&P Emerging Markets ex-China ETF|G|N|N|100|Y|N +XCUR|Exicure, Inc. - Common Stock|S|N|N|100|N|N +XEL|Xcel Energy Inc. - Common Stock|Q|N|N|100|N|N +XELB|Xcel Brands, Inc - Common Stock|S|N|N|100|N|N +XELLL|Xcel Energy Inc. - 6.25% Junior Subordinated Notes, Series due 2085|G|N|N|100|N|N +XENE|Xenon Pharmaceuticals Inc. - Common Shares|G|N|N|100|N|N +XERS|Xeris Biopharma Holdings, Inc. - Common Stock|Q|N|N|100|N|N +XFOR|X4 Pharmaceuticals, Inc. - Common Stock|S|N|N|100|N|N +XGN|Exagen Inc. - Common Stock|G|N|N|100|N|N +XHG|XChange TEC.INC - American Depositary Shares|S|N|N|100|N|N +XHLD|TEN Holdings, Inc. - Common Stock|S|N|N|100|N|N +XLO|Xilio Therapeutics, Inc. - Common Stock|S|N|D|100|N|N +XMAG|Defiance Large Cap ex-Mag 7 ETF|G|N|N|100|Y|N +XMTR|Xometry, Inc. - Class A Common Stock|Q|N|N|100|N|N +XNCR|Xencor, Inc. - Common Stock|G|N|N|100|N|N +XNET|Xunlei Limited - American Depositary Shares|Q|N|N|100|N|N +XOMA|XOMA Royalty Corporation - Common Stock|G|N|N|100|N|N +XOMAO|XOMA Royalty Corporation - Depositary Shares Rep Series B 8.375% Cumulative Preferred Stock|G|N|N|100|N|N +XOMAP|XOMA Royalty Corporation - 8.625% Series A Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +XOMX|Direxion Daily XOM Bull 2X Shares|G|N|N|100|Y|N +XOMZ|Direxion Daily XOM Bear 1X Shares|G|N|N|100|Y|N +XOS|Xos, Inc. - Common Stock|S|N|N|100|N|N +XOSWW|Xos, Inc. - Warrants|S|N|N|100|N|N +XOVR|ERShares Private-Public Crossover ETF|G|N|N|100|Y|N +XP|XP Inc. - Class A Common Stock|Q|N|N|100|N|N +XPEG|Leverage Shares 2X Long XPEV Daily ETF|G|N|N|100|Y|N +XPEL|XPEL, Inc. - Common Stock|S|N|N|100|N|N +XPON|Expion360 Inc. - Common Stock|S|N|N|100|N|N +XRAY|DENTSPLY SIRONA Inc. - Common Stock|Q|N|N|100|N|N +XRPC|Canary XRP ETF|G|N|N|100|Y|N +XRPI|Volatility Shares Trust XRP ETF|G|N|N|100|Y|N +XRPN|Armada Acquisition Corp. II - Class A Ordinary Shares|G|N|N|100|N|N +XRPNU|Armada Acquisition Corp. II - Units|G|N|N|100|N|N +XRPNW|Armada Acquisition Corp. II - Warrant|G|N|N|100|N|N +XRPT|Volatility Shares Trust XRP 2X ETF|G|N|N|100|Y|N +XRTX|XORTX Therapeutics Inc. - Common Stock|S|N|D|100|N|N +XRX|Xerox Holdings Corporation - Common Stock|Q|N|N|100|N|N +XT|iShares Future Exponential Technologies ETF|G|N|N|100|Y|N +XTIA|XTI Aerospace, Inc. Common Stock - Common Stock|S|N|N|100|N|N +XTKG|X3 Holdings Co., Ltd. - Ordinary Shares|S|N|N|100|N|N +XTLB|XTL Biopharmaceuticals Ltd. - American Depositary Shares|S|N|D|100|N|N +XWEL|XWELL, Inc. - Common Stock|S|N|D|100|N|N +XWIN|XMAX, Inc. - Common Stock|S|N|N|100|N|N +XXII|22nd Century Group, Inc - Common Stock|S|N|N|100|N|N +XYZG|Leverage Shares 2X Long XYZ Daily ETF|G|N|N|100|Y|N +YAAS|Youxin Technology Ltd - Class A Ordinary shares|S|N|N|100|N|N +YB|Yuanbao Inc. - American Depositary Shares|G|N|N|100|N|N +YBMN|Defiance BMNR Option Income ETF|G|N|N|100|Y|N +YBST|GraniteShares YieldBoost Single Stock Universe ETF|G|N|N|100|Y|N +YBTY|GraniteShares YieldBoost TopYielders ETF|G|N|N|100|Y|N +YDDL|One and One Green Technologies. INC - Class A Ordinary Shares|S|N|N|100|N|N +YDES|YD Bio Limited - Ordinary Shares|G|N|N|100|N|N +YDESW|YD Bio Limited - Warrants|G|N|N|100|N|N +YDKG|Yueda Digital Holding - Class A Ordinary Share|S|N|N|100|N|N +YHC|LQR House Inc. - Common Stock|S|N|N|100|N|N +YHGJ|Yunhong Green CTI Ltd. - Common Stock|S|N|N|100|N|N +YHNA|YHN Acquisition I Limited - Ordinary Shares|G|N|N|100|N|N +YHNAR|YHN Acquisition I Limited - Right|G|N|N|100|N|N +YHNAU|YHN Acquisition I Limited - Unit|G|N|N|100|N|N +YI|111, Inc. - American Depositary Shares|G|N|N|100|N|N +YIBO|Planet Image International Limited - Class A Ordinary Shares|S|N|N|100|N|N +YJ|Yunji Inc. - American Depository Shares|S|N|N|100|N|N +YLDE|Franklin ClearBridge Enhanced Income ETF|G|N|N|100|Y|N +YMAT|J-Star Holding Co., Ltd. - Class A Ordinary Shares|S|N|D|100|N|N +YMT|Yimutian Inc. - American Depositary Shares; each representing 25 Class A ordinary shares|G|N|D|100|N|N +YNOT|Horizon Digital Frontier ETF|G|N|N|100|Y|N +YOKE|YOKE Core ETF|G|N|N|100|Y|N +YORW|The York Water Company - Common Stock|Q|N|N|100|N|N +YOUL|Youlife Group Inc. - American Depositary Shares|S|N|N|100|N|N +YQ|17 Education & Technology Group Inc. - American Depositary Shares|Q|N|N|100|N|N +YQQQ|YieldMax Short N100 Option Income Strategy ETF|G|N|N|100|Y|N +YSPY|GraniteShares YieldBOOST SPY ETF|G|N|N|100|Y|N +YSXT|YSX Tech. Co., Ltd - Class A Ordinary Shares|S|N|N|100|N|N +YTRA|Yatra Online, Inc. - Ordinary Shares|S|N|N|100|N|N +YXT|YXT.COM GROUP HOLDING LIMITED - American Depository Shares|G|N|N|100|N|N +YYAI|AiRWA Inc. - Common Stock|S|N|N|100|N|N +YYGH|YY Group Holding Limited - Class A Ordinary Shares|S|N|D|100|N|N +Z|Zillow Group, Inc. - Class C Capital Stock|Q|N|N|100|N|N +ZAP|Global X U.S. Electrification ETF|G|N|N|100|Y|N +ZAZZT|Tick Pilot Test Stock Class A Common Stock|G|Y|N|100|N|N +ZBAI|ATIF Holdings Limited - Ordinary Shares|S|N|N|100|N|N +ZBAO|Zhibao Technology Inc. - Class A Ordinary Shares|S|N|N|100|N|N +ZBIO|Zenas BioPharma, Inc. - Common Stock|Q|N|N|100|N|N +ZBRA|Zebra Technologies Corporation - Class A Common Stock|Q|N|N|40|N|N +ZBZZT|Test Pilot Test Stock Class B Common Stock|G|Y|N|100|N|N +ZCMD|Zhongchao Inc. - Class A Ordinary Shares|S|N|D|100|N|N +ZCZZT|Tick Pilot Test Stock Class C |G|Y|N|100|N|N +ZD|Ziff Davis, Inc. - Common Stock|Q|N|N|100|N|N +ZDAI|DirectBooking Technology Co., Ltd. - Class A Ordinary Shares|S|N|D|100|N|N +ZENA|ZenaTech, Inc. - Common Stock|S|N|N|100|N|N +ZENV|Zenvia Inc. - Class A Common Stock|S|N|N|100|N|N +ZEO|Zeo Energy Corporation - Class A Common Stock|S|N|N|100|N|N +ZEOWW|Zeo Energy Corporation - Warrants|S|N|N|100|N|N +ZEUS|Olympic Steel, Inc. - Common Stock|Q|N|N|100|N|N +ZG|Zillow Group, Inc. - Class A Common Stock|Q|N|N|100|N|N +ZGM|Zenta Group Company Limited - Ordinary Shares|S|N|N|100|N|N +ZHOG|F/m Opportunistic Income ETF|G|N|N|100|Y|N +ZION|Zions Bancorporation N.A. - Common Stock|Q|N|N|100|N|N +ZIONP|Zions Bancorporation N.A. - Depositary Shares each representing a 1/40th ownership interest in a share of Series A Floating-Rate Non-Cumulative Perpetual Preferred Stock|G|N|N|100|N|N +ZJK|ZJK Industrial Co., Ltd. - Ordinary Shares|S|N|N|100|N|N +ZJYL|JIN MEDICAL INTERNATIONAL LTD. - Ordinary Shares|S|N|D|100|N|N +ZJZZT|NASDAQ TEST STOCK|Q|Y|N|100|N|N +ZKIN|ZK International Group Co., Ltd - Ordinary Share|S|N|N|100|N|N +ZKPU|Lafayette Digital Acquisition Corp. I - Unit|G|N|N|100|N|N +ZLAB|Zai Lab Limited - American Depositary Shares|G|N|N|100|N|N +ZM|Zoom Communications, Inc. - Class A Common Stock|Q|N|N|100|N|N +ZMUN|F/m Ultrashort Tax-Free Municipal ETF|G|N|N|100|Y|N +ZNB|Zeta Network Group - Class A Ordinary Shares|S|N|N|100|N|N +ZNTL|Zentalis Pharmaceuticals, Inc. - common stock|G|N|N|100|N|N +ZOOZ|ZOOZ Strategy Ltd. - Ordinary Shares|S|N|D|100|N|N +ZOOZW|ZOOZ Strategy Ltd. - Warrant|S|N|N|100|N|N +ZS|Zscaler, Inc. - Common Stock|Q|N|N|40|N|N +ZSPC|zSpace, Inc. - Common stock|S|N|D|100|N|N +ZSTK|ZeroStack Corp. - Common Stock|S|N|N|100|N|N +ZTEK|Zentek Ltd. - common stock|S|N|D|100|N|N +ZTEN|F/m 10-Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +ZTOP|F/m High Yield 100 ETF|G|N|N|100|Y|N +ZTRE|F/m 3-Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +ZTWO|F/m 2-Year Investment Grade Corporate Bond ETF|G|N|N|100|Y|N +ZUMZ|Zumiez Inc. - Common Stock|Q|N|N|100|N|N +ZURA|Zura Bio Limited - Class A Ordinary shares|S|N|N|100|N|N +ZVRA|Zevra Therapeutics, Inc. - Common Stock|Q|N|N|100|N|N +ZVZZT|NASDAQ TEST STOCK|G|Y|N|100|N|N +ZWZZT|NASDAQ TEST STOCK|S|Y|N|100|N|N +ZXYZ.A|Nasdaq Symbology Test Common Stock|Q|Y|N|100|N|N +ZXZZT|NASDAQ TEST STOCK|G|Y|N|100|N|N +ZYBT|Zhengye Biotechnology Holding Limited - Ordinary Shares|S|N|N|100|N|N +ZYME|Zymeworks Inc. - Common Stock|Q|N|N|100|N|N +File Creation Time: 0129202608:16||||||| \ No newline at end of file diff --git a/backend/data/nasdaq_screener_1769693338554.csv b/backend/data/nasdaq_screener_1769693338554.csv new file mode 100644 index 0000000..3d78263 --- /dev/null +++ b/backend/data/nasdaq_screener_1769693338554.csv @@ -0,0 +1,6979 @@ +Symbol,Name,Last Sale,Net Change,% Change,Market Cap,Country,IPO Year,Volume,Sector,Industry +A,Agilent Technologies Inc. Common Stock,$133.87,-2.08,-1.53%,37863742205.00,United States,1999,1682626,Industrials,Biotechnology: Laboratory Analytical Instruments +AA,Alcoa Corporation Common Stock ,$60.01,0.35,0.587%,15540431560.00,United States,2016,5663858,Industrials,Aluminum +AACB,Artius II Acquisition Inc. Class A Ordinary Shares,$10.38,0.00,0.00%,0.00,United States,2025,16,, +AACBR,Artius II Acquisition Inc. Rights,$0.281,0.00,0.00%,0.00,United States,2025,31,, +AACBU,Artius II Acquisition Inc. Units,$10.67,0.00,0.00%,0.00,United States,2025,20,Finance,Blank Checks +AACG,ATA Creativity Global American Depositary Shares,$1.145,-0.005,-0.435%,36538538.00,China,2008,4714,Real Estate,Other Consumer Services +AAL,American Airlines Group Inc. Common Stock,$13.44,-0.11,-0.812%,8871562493.00,United States,,52655482,Consumer Discretionary,Air Freight/Delivery Services +AAM,AA Mission Acquisition Corp. Class A Ordinary Shares,$10.67,0.00,0.00%,0.00,,2024,16650,, +AAME,Atlantic American Corporation Common Stock,$2.78,0.05,1.832%,56704294.00,United States,,10771,Finance,Life Insurance +AAMI,Acadian Asset Management Inc. Common Stock,$55.29,-0.28,-0.504%,1974357245.00,United Kingdom,2014,188828,Finance,Investment Managers +AAOI,Applied Optoelectronics Inc. Common Stock,$45.23,7.84,20.968%,3088232801.00,United States,2013,11717721,Technology,Semiconductors +AAON,AAON Inc. Common Stock,$91.22,-0.64,-0.697%,7446658771.00,United States,,695463,Industrials,Industrial Machinery/Components +AAP,Advance Auto Parts Inc.,$49.59,0.25,0.507%,2976503130.00,United States,,1495497,Consumer Discretionary,Auto & Home Supply Stores +AAPG,Ascentage Pharma Group International American Depository Shares,$25.30,-0.29,-1.133%,2202786119.00,China,2025,2086,Health Care,Biotechnology: Pharmaceutical Preparations +AAPL,Apple Inc. Common Stock,$256.44,-1.83,-0.709%,3769136143440.00,United States,1980,41287971,Technology,Computer Manufacturing +AARD,Aardvark Therapeutics Inc. Common Stock,$13.25,-1.45,-9.864%,288495854.00,United States,2025,208902,Health Care,Biotechnology: Pharmaceutical Preparations +AAT,American Assets Trust Inc. Common Stock,$17.76,-0.29,-1.607%,1086069146.00,United States,2011,564933,Real Estate,Real Estate Investment Trusts +AAUC,Allied Gold Corporation Common Shares,$31.67,-0.03,-0.095%,3927080000.00,,2025,3084081,, +AB,AllianceBernstein Holding L.P. Units,$42.57,0.25,0.591%,3873582695.00,United States,,718272,Finance,Investment Managers +ABAT,American Battery Technology Company Common Stock,$4.58,-0.17,-3.579%,595262408.00,United States,,7442669,Basic Materials,Metal Mining +ABBV,AbbVie Inc. Common Stock,$218.67,-5.26,-2.349%,386473997479.00,United States,2012,5215799,Health Care,Biotechnology: Pharmaceutical Preparations +ABCB,Ameris Bancorp Common Stock,$79.68,-0.53,-0.661%,5443350674.00,United States,1994,435516,Finance,Major Banks +ABCL,AbCellera Biologics Inc. Common Shares,$3.90,-0.09,-2.256%,1149195575.00,Canada,2020,3008438,Health Care,Biotechnology: Pharmaceutical Preparations +ABEO,Abeona Therapeutics Inc. Common Stock,$4.83,-0.28,-5.479%,261744274.00,United States,,2117031,Health Care,Biotechnology: Pharmaceutical Preparations +ABEV,Ambev S.A. American Depositary Shares (Each representing 1 Common Share),$2.83,0.00,0.00%,44308062607.00,Brazil,2013,31324671,Consumer Staples,Beverages (Production/Distribution) +ABG,Asbury Automotive Group Inc Common Stock,$243.89,2.74,1.136%,4741357691.00,United States,2002,175563,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +ABLV,Able View Global Inc. Class B Ordinary Shares,$0.74,0.00,0.00%,36548542.00,China,,19581,Consumer Discretionary,Other Consumer Services +ABLVW,Able View Global Inc. Warrant,$0.0256,-0.0077,-23.123%,1264382.00,China,,4351,Consumer Discretionary,Other Consumer Services +ABM,ABM Industries Incorporated Common Stock,$44.79,-0.60,-1.322%,2695355824.00,United States,,663026,Consumer Discretionary,Diversified Commercial Services +ABNB,Airbnb Inc. Class A Common Stock,$131.55,-0.67,-0.507%,80975570402.00,United States,2020,2264162,Consumer Discretionary,Diversified Commercial Services +ABOS,Acumen Pharmaceuticals Inc. Common Stock,$2.81,0.09,3.309%,170211324.00,United States,2021,2223536,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ABP,Abpro Holdings Inc Common Stock,$2.35,0.326,16.107%,6383253.00,United States,2022,288958,Health Care,Biotechnology: Pharmaceutical Preparations +ABPWW,Abpro Holdings Inc. Warrant,$0.0131,-0.0054,-29.189%,35583.00,United States,2022,20753,Health Care,Biotechnology: Pharmaceutical Preparations +ABR,Arbor Realty Trust Common Stock,$7.74,-0.03,-0.386%,1514800315.00,United States,2004,3153328,Real Estate,Real Estate Investment Trusts +ABR^D,Arbor Realty Trust 6.375% Series D Cumulative Redeemable Preferred Stock Liquidation Preference $25.00 per Share,$17.8298,-0.0702,-0.392%,,United States,,18338,, +ABR^E,Arbor Realty Trust 6.25% Series E Cumulative Redeemable Preferred Stock,$17.78,0.13,0.737%,,United States,,34750,, +ABR^F,Arbor Realty Trust 6.25% Series F Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock Liquidation Preference $25.00 per share,$22.37,0.11,0.494%,,United States,,6201,, +ABSI,Absci Corporation Common Stock,$2.94,-0.04,-1.342%,442092301.00,United States,2021,2762652,Health Care,Biotechnology: Commercial Physical & Biological Resarch +ABT,Abbott Laboratories Common Stock,$106.05,-2.22,-2.05%,184407369979.00,United States,,15120477,Health Care,Biotechnology: Pharmaceutical Preparations +ABTC,American Bitcoin Corp. Class A Common Stock,$1.56,-0.03,-1.887%,1447063791.00,United States,2018,10561539,Technology,EDP Services +ABTS,Abits Group Inc Ordinary Shares,$4.46,-0.26,-5.508%,10570820.00,China,,8498,Technology,Computer Software: Programming Data Processing +ABUS,Arbutus Biopharma Corporation Common Stock,$4.14,-0.02,-0.481%,796221430.00,Canada,,1197144,Health Care,Biotechnology: Pharmaceutical Preparations +ABVC,ABVC BioPharma Inc. Common Stock,$2.0292,-0.0308,-1.495%,52356077.00,United States,,36741,Health Care,Biotechnology: Pharmaceutical Preparations +ABVE,Above Food Ingredients Inc. Common Stock,$2.21,-0.40,-15.326%,113133984.00,Canada,,2512259,Consumer Staples,Packaged Foods +ABVEW,Above Food Ingredients Inc. Warrants,$0.78,-0.18,-18.75%,39929641.00,Canada,,68168,Consumer Staples,Packaged Foods +ABVX,Abivax SA American Depositary Shares,$113.98,-4.91,-4.13%,8871071037.00,France,2023,1031120,Health Care,Biotechnology: Pharmaceutical Preparations +ABX,Abacus Global Management Inc. Class A Common Stock,$7.88,-0.22,-2.716%,770292497.00,United States,,382923,Finance,Investment Managers +ABXL,Abacus Global Management Inc. 9.875% Fixed Rate Senior Notes due 2028,$26.25,0.15,0.575%,0.00,United States,,7951,, +ACA,Arcosa Inc. Common Stock ,$113.05,-1.37,-1.197%,5544540076.00,United States,2018,183842,Industrials,Metal Fabrications +ACAD,ACADIA Pharmaceuticals Inc. Common Stock,$25.62,-0.58,-2.214%,4334438152.00,United States,1985,1500888,Health Care,Biotechnology: Pharmaceutical Preparations +ACB,Aurora Cannabis Inc. Common Shares,$4.32,-0.10,-2.262%,244960347.00,Canada,,1147275,Health Care, Medicinal Chemicals and Botanical Products +ACCL,Acco Group Holdings Limited Class A Ordinary Shares,$1.46,-0.03,-2.013%,20294000.00,Hong Kong,2025,111497,Consumer Discretionary,Professional Services +ACCO,Acco Brands Corporation Common Stock,$3.86,-0.06,-1.531%,347925473.00,United States,,622683,Consumer Discretionary,Publishing +ACCS,ACCESS Newswire Inc. Common Stock,$9.22,-0.18,-1.915%,35670576.00,United States,,9359,Consumer Discretionary,Publishing +ACDC,ProFrac Holding Corp. Class A Common Stock,$4.87,-0.10,-2.012%,880842661.00,United States,2022,821503,Energy,Oilfield Services/Equipment +ACEL,Accel Entertainment Inc. ,$11.13,-0.07,-0.625%,926104439.00,United States,2017,267471,Consumer Discretionary,Services-Misc. Amusement & Recreation +ACET,Adicet Bio Inc. Common Stock,$8.45,-0.09,-1.054%,80938105.00,United States,2018,74427,Health Care,Biotechnology: Pharmaceutical Preparations +ACFN,Acorn Energy Inc. Common Stock,$17.32,-0.20,-1.142%,43380122.00,United States,,69007,Consumer Discretionary,Military/Government/Technical +ACGL,Arch Capital Group Ltd. Common Stock,$94.17,0.71,0.76%,34148484581.00,Bermuda,,1955050,Finance,Property-Casualty Insurers +ACGLN,Arch Capital Group Ltd. Depositary Shares each Representing a 1/1000th Interest in a 4.550% Non-Cumulative Preferred Share Series G,$17.82,-0.09,-0.503%,6461994215.00,Bermuda,,26376,Finance,Property-Casualty Insurers +ACGLO,Arch Capital Group Ltd. Depositary Shares Each Representing 1/1000th Interest in a Share of 5.45% Non-Cumulative Preferred Shares Series F,$21.19,-0.06,-0.282%,7684043626.00,Bermuda,,15225,Finance,Property-Casualty Insurers +ACH,Accendra Health Inc. Common Stock,$2.12,0.02,0.952%,163974779.00,United States,,845497,Health Care,Medical Specialities +ACHC,Acadia Healthcare Company Inc. Common Stock,$13.44,-0.04,-0.297%,1239949751.00,United States,,3349805,Health Care,Medical Specialities +ACHR,Archer Aviation Inc. Class A Common Stock,$7.73,-0.36,-4.45%,5034527503.00,United States,2020,35204899,Industrials,Aerospace +ACHV,Achieve Life Sciences Inc. Common Shares,$4.36,-0.25,-5.423%,232100188.00,United States,,863108,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +ACI,Albertsons Companies Inc. Class A Common Stock,$16.69,0.03,0.18%,8577209989.00,United States,2020,4637017,Consumer Staples,Food Chains +ACIC,American Coastal Insurance Corporation Common Stock,$10.81,-0.04,-0.369%,527152915.00,United States,,192707,Finance,Property-Casualty Insurers +ACIU,AC Immune SA Common Stock,$3.47,-0.07,-1.977%,348424008.00,Switzerland,2016,256070,Health Care,Biotechnology: Pharmaceutical Preparations +ACIW,ACI Worldwide Inc. Common Stock,$43.50,-1.20,-2.685%,4484328261.00,United States,,651516,Technology,Computer Software: Prepackaged Software +ACLS,Axcelis Technologies Inc. Common Stock,$91.23,0.19,0.209%,2800688107.00,United States,2000,550870,Technology,Industrial Machinery/Components +ACLX,Arcellx Inc. Common Stock,$68.14,-0.37,-0.54%,3940050430.00,United States,2022,659806,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ACM,AECOM Common Stock,$97.49,0.65,0.671%,12603407760.00,United States,2007,1577763,Consumer Discretionary,Military/Government/Technical +ACMR,ACM Research Inc. Class A Common Stock,$55.79,1.84,3.411%,3619457201.00,United States,2017,923014,Technology,Industrial Machinery/Components +ACN,Accenture plc Class A Ordinary Shares (Ireland),$270.43,-5.37,-1.947%,178600772333.00,Ireland,2001,3735222,Real Estate,Real Estate +ACNB,ACNB Corporation Common Stock,$48.48,-0.28,-0.574%,503455686.00,United States,,56547,Finance,Major Banks +ACNT,Ascent Industries Co. Common Stock,$15.84,-0.20,-1.247%,148338654.00,United States,,57812,Industrials,Steel/Iron Ore +ACOG,Alpha Cognition Inc. Common Stock,$5.37,-0.525,-8.906%,116755098.00,Canada,,111911,, +ACON,Aclarion Inc. Common Stock,$3.68,0.04,1.099%,3144085.00,United States,2022,112233,Health Care,Medical Specialities +ACONW,Aclarion Inc. Warrant,$0.0388,-0.0006,-1.523%,33150.00,United States,2022,26411,Health Care,Medical Specialities +ACP,abrdn Income Credit Strategies Fund Common Shares,$5.61,0.06,1.081%,0.00,United States,2011,381041,Finance,Investment Managers +ACP^A,abrdn Income Credit Strategies Fund 5.250% Series A Perpetual Preferred Stock,$20.65,0.07,0.34%,,United States,,8573,, +ACR,ACRES Commercial Realty Corp. Common Stock,$19.15,-0.22,-1.136%,139520772.00,United States,,32775,Real Estate,Real Estate Investment Trusts +ACR^C,ACRES Commercial Realty Corp. 8.625% Fixed-to-Floating Series C Cumulative Redeemable Preferred Stock ,$25.0089,0.0076,0.03%,,United States,,3239,, +ACR^D,ACRES Commercial Realty Corp. 7.875% Series D Cumulative Redeemable Preferred Stock,$22.0803,0.0242,0.11%,,United States,,4093,, +ACRE,Ares Commercial Real Estate Corporation Common Stock,$4.96,0.05,1.018%,272931207.00,United States,2012,785587,Real Estate,Real Estate Investment Trusts +ACRS,Aclaris Therapeutics Inc. Common Stock,$3.51,-0.36,-9.302%,380291789.00,United States,2015,1571493,Health Care,Biotechnology: Pharmaceutical Preparations +ACRV,Acrivon Therapeutics Inc. Common Stock,$1.89,-0.09,-4.545%,59639188.00,United States,2022,1031049,Health Care,Biotechnology: Pharmaceutical Preparations +ACT,Enact Holdings Inc. Common Stock,$39.31,0.03,0.076%,5676197601.00,United States,2021,313380,Finance,Specialty Insurers +ACTG,Acacia Research Corporation (Acacia Tech) Common Stock,$3.83,-0.10,-2.545%,369443248.00,United States,,73706,Miscellaneous,Multi-Sector Companies +ACTU,Actuate Therapeutics Inc. Common stock,$4.97,-0.48,-8.807%,115519340.00,United States,2024,117964,Health Care,Biotechnology: Pharmaceutical Preparations +ACU,Acme United Corporation. Common Stock,$41.15,-0.35,-0.843%,156646693.00,United States,1988,9898,Consumer Discretionary,Industrial Machinery/Components +ACV,Virtus Diversified Income & Convertible Fund Common Shares of Beneficial Interest,$28.25,0.24,0.857%,292753451.00,United States,2015,30368,Finance,Finance/Investors Services +ACVA,ACV Auctions Inc. Class A Common Stock,$8.04,-0.31,-3.713%,1384256649.00,United States,2025,1618640,Real Estate,Real Estate +ACXP,Acurx Pharmaceuticals Inc. Common Stock,$2.59,-0.09,-3.358%,5748523.00,United States,2021,36117,Health Care,Biotechnology: Pharmaceutical Preparations +AD,Array Digital Infrastructure Inc. Common Shares,$46.59,-0.34,-0.724%,4025376000.00,United States,1988,231595,Telecommunications,Telecommunications Equipment +ADACU,American Drive Acquisition Company Units,$10.01,0.015,0.15%,0.00,United States,2025,598,Finance,Blank Checks +ADAG,Adagene Inc. American Depositary Shares,$2.77,0.28,11.245%,130553618.00,China,2021,196696,Health Care,Biotechnology: Pharmaceutical Preparations +ADAM,Adamas Trust Inc. Common Stock,$8.44,0.03,0.357%,762246607.00,United States,,1087419,Technology,Computer Software: Prepackaged Software +ADAMG,Adamas Trust Inc. 9.125% Senior Notes Due 2030,$25.1728,0.0628,0.25%,0.00,United States,,26214,Real Estate,Real Estate Investment Trusts +ADAMH,Adamas Trust Inc. 9.875% Senior Notes Due 2030,$25.58,0.00,0.00%,0.00,United States,,11414,Real Estate,Real Estate Investment Trusts +ADAMI,Adamas Trust Inc. 9.125% Senior Notes Due 2029,$25.1807,0.0007,0.003%,2280853931.00,United States,,2204,Real Estate,Real Estate Investment Trusts +ADAML,Adamas Trust Inc. 6.875% Series F Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock $0.01 par value per share,$23.12,-0.08,-0.345%,2088049946.00,United States,,9432,Real Estate,Real Estate Investment Trusts +ADAMM,Adamas Trust Inc. 7.875% Series E Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.30,0.02,0.079%,2284933549.00,United States,,11043,Real Estate,Real Estate Investment Trusts +ADAMN,Adamas Trust Inc. 8.00% Series D Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$22.30,0.21,0.951%,2013992812.00,United States,,17332,Real Estate,Real Estate Investment Trusts +ADAMO,Adamas Trust Inc. 9.250% Senior Notes Due 2031,$25.09,-0.02,-0.08%,0.00,United States,,14984,Real Estate,Real Estate Investment Trusts +ADAMZ,Adamas Trust Inc. 7.000% Series G Cumulative Redeemable Preferred Stock $0.01 par value per share,$19.3125,-0.0375,-0.194%,1744180994.00,United States,,6414,Real Estate,Real Estate Investment Trusts +ADBE,Adobe Inc. Common Stock,$299.58,2.16,0.726%,122977590000.00,United States,1986,3942771,Technology,Computer Software: Prepackaged Software +ADC,Agree Realty Corporation Common Stock,$71.08,-1.70,-2.336%,8169536441.00,United States,,1004388,Real Estate,Real Estate Investment Trusts +ADC^A,Agree Realty Corporation Depositary Shares each representing 1/1000th of a 4.250% Series A Cumulative Redeemable Preferred Stock,$17.225,-0.005,-0.029%,,United States,,15636,, +ADCT,ADC Therapeutics SA Common Shares,$3.54,-0.05,-1.393%,438524973.00,Switzerland,2020,1389567,Health Care,Biotechnology: Pharmaceutical Preparations +ADEA,Adeia Inc. Common Stock,$18.37,-0.05,-0.271%,2011702209.00,United States,2003,990257,Technology,Computer Software: Prepackaged Software +ADGM,Adagio Medical Holdings Inc Common Stock,$1.00,0.00,0.00%,21179637.00,United States,,96820,Health Care,Medical/Dental Instruments +ADI,Analog Devices Inc. Common Stock,$317.625,13.795,4.54%,155200657487.00,United States,,3888272,Technology,Semiconductors +ADIL,Adial Pharmaceuticals Inc Common Stock,$0.22,-0.0078,-3.424%,6111438.00,United States,2018,211345,Health Care,Biotechnology: Pharmaceutical Preparations +ADM,Archer-Daniels-Midland Company Common Stock,$67.40,-0.83,-1.216%,32390400139.00,United States,,3237876,Consumer Staples,Packaged Foods +ADMA,ADMA Biologics Inc Common Stock,$16.33,-0.25,-1.508%,3886503502.00,United States,,1912632,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ADNT,Adient plc Ordinary Shares ,$21.59,-0.64,-2.879%,1691384543.00,United States,2016,876822,Consumer Discretionary,Auto Parts:O.E.M. +ADP,Automatic Data Processing Inc. Common Stock,$250.69,-3.82,-1.501%,101391255633.00,United States,,4089420,Industrials,Diversified Commercial Services +ADPT,Adaptive Biotechnologies Corporation Common Stock,$18.50,-0.73,-3.796%,2824305978.00,United States,2019,1964731,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ADSE,ADS-TEC ENERGY PLC Ordinary Shares,$12.78,0.49,3.987%,768366010.00,Ireland,,14895,Consumer Discretionary,Industrial Specialties +ADSEW,ADS-TEC ENERGY PLC Warrant,$1.10,0.18,19.565%,66134790.00,Ireland,,20682,Consumer Discretionary,Industrial Specialties +ADSK,Autodesk Inc. Common Stock,$268.33,0.24,0.09%,56885960000.00,United States,,1268078,Technology,Computer Software: Prepackaged Software +ADT,ADT Inc. Common Stock,$7.95,-0.02,-0.251%,6517113751.00,United States,2018,5759234,Consumer Discretionary,Diversified Commercial Services +ADTN,ADTRAN Holdings Inc. Common Stock,$9.60,0.02,0.209%,769113552.00,United States,1994,864759,Utilities,Telecommunications Equipment +ADTX,Aditxt Inc. Common Stock,$0.9188,-0.0491,-5.073%,514017.00,United States,2020,213762,Health Care,Biotechnology: Pharmaceutical Preparations +ADUR,Aduro Clean Technologies Inc. Common Stock,$14.58,0.22,1.532%,485207412.00,Canada,,433921,Industrials,Major Chemicals +ADUS,Addus HomeCare Corporation Common Stock,$102.48,-4.53,-4.233%,1894165612.00,United States,2009,455386,Health Care,Medical/Nursing Services +ADV,Advantage Solutions Inc. Class A Common Stock,$1.03,0.0622,6.427%,336060072.00,United States,2019,518736,Real Estate,Real Estate +ADVB,Advanced Biomed Inc. Common Stock,$0.3071,0.006,1.993%,6645644.00,Taiwan,2025,36311,Health Care,Medical Specialities +ADX,Adams Diversified Equity Fund Inc.,$23.35,0.03,0.129%,0.00,United States,,221244,Finance,Investment Managers +ADXN,Addex Therapeutics Ltd American Depositary Shares,$7.78,-0.20,-2.506%,12594785.00,Switzerland,,5006,Health Care,Biotechnology: Pharmaceutical Preparations +AEAQ,Activate Energy Acquisition Corp. Class A Ordinary Share,$9.94,0.0199,0.201%,0.00,Cayman Islands,2026,25222,, +AEAQU,Activate Energy Acquisition Corp. Unit,$10.07,-0.01,-0.099%,0.00,Cayman Islands,2025,670,, +AEAQW,Activate Energy Acquisition Corp. Warrant,$0.26,-0.02,-7.143%,0.00,Cayman Islands,2026,103504,, +AEBI,Aebi Schmidt Holding AG Common Stock ,$13.71,-0.28,-2.001%,1063887555.00,Switzerland,,138987,Industrials,Auto Manufacturing +AEC,Anfield Energy Inc. Common Shares,$9.56,0.35,3.80%,151791414.00,Canada,,357188,Basic Materials,Metal Mining +AEE,Ameren Corporation Common Stock,$103.58,-0.38,-0.366%,28017863399.00,United States,,1087187,Utilities,Power Generation +AEF,abrdn Emerging Markets ex-China Fund Inc. Common Stock,$8.04,0.06,0.752%,863194500.00,United States,,245804,Finance,Finance/Investors Services +AEFC,Aegon Funding Company LLC 5.10% Subordinated Notes due 2049,$20.12,-0.05,-0.248%,0.00,United States,2019,27285,, +AEG,Aegon Ltd. New York Registry Shares,$7.77,0.05,0.648%,15588059253.00,Netherlands,,5751342,Finance,Life Insurance +AEHL,Antelope Enterprise Holdings Limited Class A Ordinary Shares,$0.9107,0.0106,1.178%,4710208.00,China,,138243,Industrials,Building Materials +AEHR,Aehr Test Systems Common Stock,$27.98,0.23,0.829%,856953029.00,United States,1997,1206818,Industrials,Electrical Products +AEI,Alset Inc. Common Stock (TX),$3.54,0.06,1.724%,138337883.00,United States,2020,28011,Finance,Real Estate +AEIS,Advanced Energy Industries Inc. Common Stock,$263.76,4.21,1.622%,9955750179.00,United States,1995,646314,Technology,Industrial Machinery/Components +AEM,Agnico Eagle Mines Limited Common Stock,$222.99,6.83,3.16%,112100288516.00,Canada,,2866799,Basic Materials,Precious Metals +AEMD,Aethlon Medical Inc. Common Stock,$2.65,-0.15,-5.357%,2579014.00,United States,,36622,Health Care,Medical/Dental Instruments +AENT,Alliance Entertainment Holding Corporation Class A Common Stock,$7.33,-0.20,-2.656%,373517522.00,United States,,47661,Consumer Discretionary,Durable Goods +AENTW,Alliance Entertainment Holding Corporation Warrants,$0.65,-0.10,-13.333%,33122291.00,United States,,11028,Consumer Discretionary,Durable Goods +AEO,American Eagle Outfitters Inc. Common Stock,$23.13,-0.31,-1.323%,3920812699.00,United States,,5239824,Consumer Discretionary,Clothing/Shoe/Accessory Stores +AEON,AEON Biopharma Inc. Class A Common Stock,$1.18,-0.02,-1.667%,14284964.00,United States,,86045,Health Care,Biotechnology: Pharmaceutical Preparations +AEP,American Electric Power Company Inc. Common Stock,$119.12,-0.31,-0.26%,63621340414.00,United States,,1888948,Utilities,Electric Utilities: Central +AER,AerCap Holdings N.V. Ordinary Shares,$142.64,-1.22,-0.848%,26642759214.00,Netherlands,2006,1601205,Consumer Discretionary,Diversified Commercial Services +AERO,Grupo Aeromexico S.A.B. de C.V. American Depositary Shares (each representing ten (10) Common Shares),$21.24,0.24,1.143%,3098988407.00,,2025,209078,Consumer Discretionary,Air Freight/Delivery Services +AERT,Aeries Technology Inc. Class A Ordinary Share,$0.54,0.003,0.559%,26111057.00,United States,2021,35067,Consumer Discretionary,Professional Services +AES,The AES Corporation Common Stock,$15.19,0.27,1.81%,10817117139.00,United States,,10909898,Utilities,Electric Utilities: Central +AESI,Atlas Energy Solutions Inc. Common Stock,$11.68,0.07,0.603%,1448111746.00,United States,2023,2785457,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +AEVA,Aeva Technologies Inc. Common Stock,$14.40,0.05,0.348%,865150675.00,United States,,2487930,Consumer Discretionary,Auto Parts:O.E.M. +AEVAW,Aeva Technologies Inc. Warrants,$0.115,-0.0118,-9.306%,6909189.00,United States,,21763,Consumer Discretionary,Auto Parts:O.E.M. +AEXA,American Exceptionalism Acquisition Corp. A Class A Ordinary Shares,$11.77,-0.06,-0.507%,0.00,,2025,271706,, +AEYE,AudioEye Inc. Common Stock,$9.38,-0.10,-1.055%,116486627.00,United States,,104204,Technology,Computer Software: Prepackaged Software +AFB,AllianceBernstein National Municipal Income Fund Inc,$10.92,0.02,0.183%,0.00,United States,2002,471550,Finance,Trusts Except Educational Religious and Charitable +AFBI,Affinity Bancshares Inc. Common Stock (MD),$20.29,-0.30,-1.457%,125140645.00,United States,2017,27631,Finance,Banks +AFCG,Advanced Flower Capital Inc. Common Stock,$2.46,-0.06,-2.381%,55582571.00,United States,2021,117389,Finance,Real Estate +AFG,American Financial Group Inc. Common Stock,$128.45,0.60,0.469%,10713188823.00,United States,,433849,Finance,Property-Casualty Insurers +AFGB,American Financial Group Inc. 5.875% Subordinated Debentures due 2059,$22.05,-0.05,-0.226%,1839048763.00,United States,2019,6405,Finance,Property-Casualty Insurers +AFGC,American Financial Group Inc. 5.125% Subordinated Debentures due 2059,$19.26,-0.09,-0.465%,1606352797.00,United States,2019,6531,Finance,Property-Casualty Insurers +AFGD,American Financial Group Inc. 5.625% Subordinated Debentures due 2060,$21.20,-0.03,-0.141%,1768155726.00,United States,2020,3032,Finance,Property-Casualty Insurers +AFGE,American Financial Group Inc. 4.500% Subordinated Debentures due 2060,$17.45,-0.01,-0.057%,1455392331.00,United States,2020,3011,Finance,Property-Casualty Insurers +AFJK,Aimei Health Technology Co. Ltd Ordinary Share,$53.74,0.48,0.901%,0.00,United States,2024,9027,, +AFJKR,Aimei Health Technology Co. Ltd Right,$0.3736,0.00,0.00%,0.00,United States,2024,18,, +AFJKU,Aimei Health Technology Co. Ltd Unit,$67.24,4.21,6.679%,0.00,United States,2023,260,, +AFL,AFLAC Incorporated Common Stock,$108.92,0.54,0.498%,57086487840.00,United States,,1637632,Finance,Accident &Health Insurance +AFRI,Forafric Global PLC Ordinary Shares,$9.99,-0.065,-0.646%,268746904.00,Gibraltar,,3631,Consumer Staples,Packaged Foods +AFRIW,Forafric Global PLC Warrants,$0.90,0.00,0.00%,24211433.00,Gibraltar,,9900,Consumer Staples,Packaged Foods +AFRM,Affirm Holdings Inc. Class A Common Stock,$65.36,-3.43,-4.986%,21573612980.00,United States,2021,6932963,Finance,Finance: Consumer Services +AFYA,Afya Limited Class A Common Shares,$15.01,0.14,0.941%,1356736143.00,Brazil,2019,169988,Real Estate,Other Consumer Services +AG,First Majestic Silver Corp. Ordinary Shares (Canada),$26.23,0.51,1.983%,12884932421.00,Canada,,28847465,Basic Materials,Precious Metals +AGAE,Allied Gaming & Entertainment Inc. Common Stock,$0.3119,-0.0153,-4.676%,11760791.00,United States,2017,719495,Consumer Discretionary,Services-Misc. Amusement & Recreation +AGCC,Agencia Comercial Spirits Ltd Class A Ordinary Shares,$10.00,0.36,3.734%,341140000.00,Taiwan,2025,60240,Consumer Staples,Beverages (Production/Distribution) +AGCO,AGCO Corporation Common Stock,$112.75,-0.94,-0.827%,8413807067.00,United States,,760179,Industrials,Industrial Machinery/Components +AGD,abrdn Global Dynamic Dividend Fund Common Shares of Beneficial Interest,$12.54,0.14,1.129%,0.00,United States,2006,57271,Finance,Trusts Except Educational Religious and Charitable +AGEN,Agenus Inc. Common Stock,$3.11,-0.08,-2.508%,105765965.00,United States,2000,373306,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AGH,Aureus Greenway Holdings Inc. Common Stock,$3.20,0.48,17.647%,48180150.00,United States,2025,53710,Consumer Discretionary,Hotels/Resorts +AGI,Alamos Gold Inc. Class A Common Shares,$44.43,0.79,1.81%,18690934671.00,Canada,2015,3611719,Basic Materials,Precious Metals +AGIG,Abundia Global Impact Group Inc. Common stock,$3.52,0.14,4.142%,129952349.00,United States,,709840,Energy,Oil & Gas Production +AGIO,Agios Pharmaceuticals Inc. Common Stock,$28.31,-0.36,-1.256%,1650864018.00,United States,2013,1187357,Health Care,Biotechnology: Pharmaceutical Preparations +AGL,agilon health inc. Common Stock,$0.8211,-0.0329,-3.852%,340412955.00,United States,2021,7580994,Health Care,Misc Health and Biotechnology Services +AGM,Federal Agricultural Mortgage Corporation Common Stock,$167.28,-5.61,-3.245%,1824142063.00,United States,,54408,Finance,Finance Companies +AGM^D,Federal Agricultural Mortgage Corporation 5.700% Non-Cumulative Preferred Stock Series D,$21.4399,0.0399,0.186%,,United States,,2356,, +AGM^E,Federal Agricultural Mortgage Corporation 5.750% Non-Cumulative Preferred Stock Series E,$21.61,0.01,0.046%,,United States,,3130,, +AGM^F,Federal Agricultural Mortgage Corporation 5.250% Non-Cumulative Preferred Stock Series F,$19.72,0.09,0.458%,,United States,,5139,, +AGM^G,Federal Agricultural Mortgage Corporation 4.875% Non-Cumulative Preferred Stock Series G,$18.41,0.01,0.054%,,United States,,3842,, +AGM^H,Federal Agricultural Mortgage Corporation 6.500% Non-Cumulative Preferred Stock Series H,$24.87,0.03,0.121%,,United States,,16583,, +AGMH,AGM Group Holdings Inc. Class A Ordinary Shares,$1.84,0.05,2.793%,5938031.00,Hong Kong,2018,79007,Technology,EDP Services +AGNC,AGNC Investment Corp. Common Stock,$12.02,-0.15,-1.233%,12894143321.00,United States,2008,24285028,Real Estate,Real Estate Investment Trusts +AGNCL,AGNC Investment Corp. Depositary Shares Each Representing a 1/1000th Interest in a Share of 7.75% Series G Fixed-Rate Reset Cumulative Redeemable Preferred Stock,$24.97,-0.0699,-0.279%,26785920028.00,United States,,47935,Real Estate,Real Estate Investment Trusts +AGNCM,AGNC Investment Corp. Depositary Shares rep 6.875% Series D Fixed-to-Floating Cumulative Redeemable Preferred Stock,$24.96,0.082,0.33%,26775192787.00,United States,,14704,Real Estate,Real Estate Investment Trusts +AGNCN,AGNC Investment Corp. Depositary Shares Each Representing a 1/1000th Interest in a Share of 7.00% Series C Fixed-To-Floating Rate Cumulative Redeemable Preferred Stock,$25.45,-0.03,-0.118%,27300827582.00,United States,,52132,Real Estate,Real Estate Investment Trusts +AGNCO,AGNC Investment Corp. Depositary Shares each representing a 1/1000th interest in a share of 6.50% Series E Fixed-to-Floating Cumulative Redeemable Preferred Stock,$25.43,0.01,0.039%,27279373100.00,United States,,14819,Real Estate,Real Estate Investment Trusts +AGNCP,AGNC Investment Corp. Depositary Shares Each Representing a 1/1000th Interest in a Share of 6.125% Series F Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.06,-0.01,-0.04%,26882465194.00,United States,,369104,Real Estate,Real Estate Investment Trusts +AGNCZ,AGNC Investment Corp. Depositary Shares Each Representing a 1/1000th Interest in a Share of 8.75% Series H Fixed-Rate Cumulative Redeemable Preferred Stock,$25.89,0.01,0.039%,27772826172.00,United States,,162732,, +AGO,Assured Guaranty Ltd. Common Stock,$83.60,0.58,0.699%,3854720342.00,Bermuda,2004,316261,Finance,Property-Casualty Insurers +AGPU,Axe Compute Inc. Common Stock,$3.37,-1.67,-33.135%,11436149.00,United States,,279035,Health Care,Industrial Specialties +AGRO,Adecoagro S.A. Common Shares,$8.97,-0.17,-1.86%,1268947786.00,Luxembourg,2011,417511,Consumer Staples,Farming/Seeds/Milling +AGRZ,Agroz Inc. Ordinary Shares,$0.4113,0.0004,0.097%,8400179.00,Malaysia,2025,327801,Consumer Staples,Farming/Seeds/Milling +AGX,Argan Inc. Common Stock,$358.87,-3.71,-1.023%,4978750647.00,United States,,284500,Consumer Discretionary,Engineering & Construction +AGYS,Agilysys Inc. Common Stock (DE),$85.67,-5.19,-5.712%,2408033520.00,United States,,601595,Technology,EDP Services +AHCO,AdaptHealth Corp. Common Stock,$9.62,-0.44,-4.374%,1302782093.00,United States,2018,949844,Health Care,Medical/Nursing Services +AHG,Akso Health Group ADS,$1.42,-0.01,-0.699%,783642871.00,China,2017,4311,Real Estate,Real Estate +AHH,Armada Hoffler Properties Inc. Common Stock,$6.80,-0.05,-0.73%,545043066.00,United States,2013,896654,Finance,Real Estate +AHH^A,Armada Hoffler Properties Inc. 6.75% Series A Cumulative Redeemable Perpetual Preferred Stock,$21.55,0.06,0.279%,,United States,,15464,, +AHL,Aspen Insurance Holdings Limited Class A Ordinary Shares,$37.33,-0.02,-0.054%,3428442523.00,Bermuda,2025,50865,Finance,Property-Casualty Insurers +AHL^D,Aspen Insurance Holdings Limited 5.625% Perpetual Non-Cumulative Preference Shares,$19.8785,-0.0065,-0.033%,,Bermuda,,12406,, +AHL^E,Aspen Insurance Holdings Limited Depositary Shares each representing a 1/1000th interest in a share of 5.625% Perpetual Non-Cumulative Preference Shares,$19.85,-0.06,-0.301%,,Bermuda,,12861,, +AHL^F,Aspen Insurance Holdings Limited Depositary Shares each representing a 1/1000th Interest in a 7.00% Perpetual Non-Cumulative Preference Share,$24.70,-0.04,-0.162%,,Bermuda,,5765,, +AHMA,Ambitions Enterprise Management Co. L.L.C Class A Ordinary Shares,$31.57,0.57,1.839%,931315000.00,United Arab Emirates,2025,517104,Consumer Discretionary,Services-Misc. Amusement & Recreation +AHR,American Healthcare REIT Inc. Common Stock,$46.33,0.64,1.401%,8722492670.00,United States,2024,6046802,Real Estate,Real Estate Investment Trusts +AHT,Ashford Hospitality Trust Inc Common Stock,$3.97,-0.01,-0.251%,25453782.00,United States,2003,33245,Real Estate,Real Estate Investment Trusts +AHT^D,Ashford Hospitality Trust Inc 8.45% Series D Cumulative Preferred Stock,$14.00,0.0001,0.001%,,United States,,4002,, +AHT^F,Ashford Hospitality Trust Inc 7.375% Series F Cumulative Preferred Stock,$11.76,-0.04,-0.339%,,United States,,2346,, +AHT^G,Ashford Hospitality Trust Inc 7.375% Series G Cumulative Preferred Stock,$11.63,-0.11,-0.937%,,United States,,119,, +AHT^H,Ashford Hospitality Trust Inc 7.50% Series H Cumulative Preferred Stock,$11.4475,-0.0625,-0.543%,,United States,,523,, +AHT^I,Ashford Hospitality Trust Inc 7.50% Series I Cumulative Preferred Stock,$11.30,-0.15,-1.31%,,United States,,2234,, +AI,C3.ai Inc. Class A Common Stock,$13.13,0.53,4.206%,1848090580.00,United States,2020,19329266,Technology,Computer Software: Prepackaged Software +AIFF,Firefly Neuroscience Inc. Common Stock,$0.9493,-0.0493,-4.937%,12808837.00,United States,,103177,Technology,Computer Software: Prepackaged Software +AIFU,AIFU Inc. Class A Ordinary Share,$2.09,-0.16,-7.111%,258008640.00,China,2007,6306,Finance,Specialty Insurers +AIG,American International Group Inc. New Common Stock,$73.39,-0.48,-0.65%,39599486603.00,United States,,3293813,Finance,Life Insurance +AIHS,Senmiao Technology Limited Common Stock,$1.175,-0.025,-2.083%,3768800.00,China,2018,12044,Finance,Finance: Consumer Services +AII,American Integrity Insurance Group Inc. Common Stock,$18.51,0.00,0.00%,362366642.00,United States,2025,214728,Finance,Property-Casualty Insurers +AIIA,AI Infrastructure Acquisition Corp. Class A Ordinary Shares,$10.03,0.00,0.00%,0.00,,2025,7661,Finance,Blank Checks +AIIO,Robo.ai Inc. Class B Ordinary Shares,$0.257,-0.008,-3.019%,95179549.00,United Arab Emirates,,14209386,Industrials,Auto Manufacturing +AIIOW,Robo.ai Inc. Warrant,$0.0584,0.0114,24.255%,21628349.00,United Arab Emirates,,26499,Industrials,Auto Manufacturing +AIM,AIM ImmunoTech Inc. Common Stock,$1.22,0.01,0.826%,3905775.00,,,141929,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AIMD,Ainos Inc. Common Stock,$2.13,0.41,23.837%,14873098.00,United States,,34376048,Health Care,Biotechnology: Pharmaceutical Preparations +AIMDW,Ainos Inc. Warrants,$0.1599,0.0649,68.316%,1116530.00,United States,,18064,Health Care,Biotechnology: Pharmaceutical Preparations +AIN,Albany International Corporation Common Stock,$55.56,-1.01,-1.785%,1594572000.00,United States,,181078,Consumer Discretionary,Textiles +AIO,Virtus Artificial Intelligence & Technology Opportunities Fund Common Shares of Beneficial Interest,$22.88,0.11,0.483%,785721439.00,,2019,112920,Finance,Finance/Investors Services +AIOT,PowerFleet Inc. Common Stock,$5.26,-0.01,-0.19%,703917506.00,United States,,830890,Telecommunications,Telecommunications Equipment +AIP,Arteris Inc. Common Stock,$16.12,0.11,0.687%,764230678.00,United States,2021,366937,Technology,Semiconductors +AIR,AAR Corp. Common Stock,$104.06,-1.41,-1.337%,4117915182.00,United States,,585079,Industrials,Aerospace +AIRE,reAlpha Tech Corp. Common Stock,$0.4115,-0.0065,-1.555%,53799788.00,United States,,1345586,Finance,Real Estate +AIRG,Airgain Inc. Common Stock,$4.40,-0.14,-3.084%,52616049.00,United States,2016,36038,Technology,Radio And Television Broadcasting And Communications Equipment +AIRI,Air Industries Group Common Stock,$3.41,-0.06,-1.729%,16285400.00,United States,,50484,Industrials,Military/Government/Technical +AIRJ,AirJoule Technologies Corporation Class A Common Stock,$3.30,-0.10,-2.941%,200243030.00,United States,2022,594729,Industrials,Industrial Machinery/Components +AIRJW,AirJoule Technologies Corporation Warrant,$0.79,0.00,0.00%,47936968.00,United States,2022,68,Industrials,Industrial Machinery/Components +AIRO,AIRO Group Holdings Inc. Common Stock,$11.35,-0.35,-2.991%,355298516.00,United States,2025,398614,Industrials,Aerospace +AIRS,AirSculpt Technologies Inc. Common Stock,$2.905,-0.215,-6.891%,181378526.00,United States,2021,1383761,Health Care,Medical/Nursing Services +AIRT,Air T Inc. Common Stock,$22.97,0.14,0.613%,62079618.00,United States,,807,Consumer Discretionary,Air Freight/Delivery Services +AIRTP,Air T Inc. Air T Funding Alpha Income Trust Preferred Securities,$20.00,-0.3018,-1.487%,54052780.00,United States,,1235,Consumer Discretionary,Air Freight/Delivery Services +AISP,Airship AI Holdings Inc. Class A Common Stock,$3.29,-0.11,-3.235%,112437602.00,United States,2021,769901,Technology,Computer Software: Prepackaged Software +AISPW,Airship AI Holdings Inc. Warrants,$1.225,-0.05,-3.922%,41865065.00,United States,2021,20312,Technology,Computer Software: Prepackaged Software +AIT,Applied Industrial Technologies Inc. Common Stock,$256.26,-6.08,-2.318%,9559123274.00,United States,,500024,Consumer Discretionary,Industrial Specialties +AIV,Apartment Investment and Management Company Common Stock,$5.84,-0.01,-0.171%,841401154.00,United States,1994,1840503,Real Estate,Real Estate Investment Trusts +AIXC,AIxCrypto Holdings Inc. Common Stock,$2.075,-0.095,-4.378%,48309897.00,United States,2015,108482,Health Care,Biotechnology: Pharmaceutical Preparations +AIXI,XIAO-I Corporation American Depositary Shares,$0.252,-0.0279,-9.968%,3140005.00,China,2023,425665,Technology,Computer Software: Prepackaged Software +AIZ,Assurant Inc. Common Stock,$237.29,0.24,0.101%,11883746592.00,United States,2004,300251,Finance,Property-Casualty Insurers +AIZN,Assurant Inc. 5.25% Subordinated Notes due 2061,$20.66,-0.10,-0.482%,1042487299.00,United States,2020,11077,Finance,Property-Casualty Insurers +AJG,Arthur J. Gallagher & Co. Common Stock,$242.37,0.04,0.017%,62240616000.00,United States,,1728218,Finance,Specialty Insurers +AKA,a.k.a. Brands Holding Corp. Common Stock,$11.18,-0.8008,-6.684%,120069578.00,,2021,4900,Consumer Discretionary,Catalog/Specialty Distribution +AKAM,Akamai Technologies Inc. Common Stock,$102.10,-1.16,-1.123%,14688640698.00,United States,1999,4461923,Real Estate,Real Estate +AKAN,Akanda Corp. Common Shares,$1.53,-0.01,-0.649%,49597225.00,United Kingdom,2022,421566,Health Care, Medicinal Chemicals and Botanical Products +AKBA,Akebia Therapeutics Inc. Common Stock,$1.45,-0.06,-3.974%,384780690.00,United States,2014,2414699,Health Care,Biotechnology: Pharmaceutical Preparations +AKO/A,Embotelladora Andina S.A.,$25.17,0.49,1.985%,,Chile,,346,, +AKO/B,Embotelladora Andina S.A.,$31.51,-0.20,-0.631%,,Chile,,72798,, +AKR,Acadia Realty Trust Common Stock,$19.41,-0.29,-1.472%,2543382052.00,United States,,1030732,Real Estate,Real Estate Investment Trusts +AKTS,Aktis Oncology Inc. Common stock,$20.50,-0.72,-3.393%,1092587475.00,United States,2026,171625,Health Care,Biotechnology: Pharmaceutical Preparations +AKTX,Akari Therapeutics plc ADS,$0.254,-0.0205,-7.468%,11628463.00,United Kingdom,,429271,Health Care,Biotechnology: Pharmaceutical Preparations +AL,Air Lease Corporation Class A Common Stock,$64.41,-0.05,-0.078%,7198785711.00,United States,2011,1280427,Consumer Discretionary,Diversified Commercial Services +ALAB,Astera Labs Inc. Common Stock,$167.90,-3.03,-1.773%,28358917126.00,United States,2024,3801170,Technology,Semiconductors +ALAR,Alarum Technologies Ltd. American Depositary Share,$7.88,0.19,2.471%,54640700.00,Israel,2018,32110,Technology,Computer Software: Prepackaged Software +ALB,Albemarle Corporation Common Stock,$184.33,-9.85,-5.073%,21695187548.00,United States,,4444769,Industrials,Major Chemicals +ALB^A,Albemarle Corporation Depositary Shares each representing a 1/20th of 7.25% Series A Mandatory Convertible Preferred Stock,$74.60,-3.40,-4.359%,,United States,,1393672,, +ALBT,Avalon GloboCare Corp. Common Stock,$0.8064,-0.0036,-0.444%,3428820.00,United States,,60555,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALC,Alcon Inc. Ordinary Shares,$80.42,-0.45,-0.556%,39777044776.00,Switzerland,2019,1077730,Health Care,Ophthalmic Goods +ALCO,Alico Inc. Common Stock,$40.19,-1.00,-2.428%,307720603.00,United States,,24836,, +ALCY,Alchemy Investments Acquisition Corp 1 Class A Ordinary Shares,$11.73,-0.04,-0.34%,0.00,United States,2023,6636,Finance,Blank Checks +ALCYW,Alchemy Investments Acquisition Corp 1 Warrants,$0.131,-0.02,-13.245%,0.00,United States,2023,13925,Finance,Blank Checks +ALDF,Aldel Financial II Inc. Class A Ordinary Shares,$10.52,0.00,0.00%,0.00,United States,2024,43,, +ALDFW,Aldel Financial II Inc. Warrants,$0.5527,0.0027,0.491%,0.00,United States,2024,249,Finance,Blank Checks +ALDX,Aldeyra Therapeutics Inc. Common Stock,$5.42,-0.12,-2.166%,326082230.00,United States,2014,595851,Health Care,Biotechnology: Pharmaceutical Preparations +ALEC,Alector Inc. Common Stock,$1.91,-0.04,-2.051%,208479312.00,United States,2019,777952,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALEX,Alexander & Baldwin Inc. Common Stock REIT Holding Company,$20.70,-0.03,-0.145%,1506100122.00,United States,,1059081,Real Estate,Real Estate Investment Trusts +ALF,Centurion Acquisition Corp. Class A Ordinary Shares,$10.70,0.01,0.094%,0.00,United States,2024,1005,, +ALFUW,Centurion Acquisition Corp. Warrant,$0.266,-0.0002,-0.075%,0.00,United States,2024,10332,Finance,Blank Checks +ALG,Alamo Group Inc. Common Stock,$190.90,-2.43,-1.257%,2312835205.00,United States,,68386,Industrials,Industrial Machinery/Components +ALGM,Allegro MicroSystems Inc. Common Stock,$34.55,1.89,5.787%,6395863005.00,United States,2020,4803384,Technology,Semiconductors +ALGN,Align Technology Inc. Common Stock,$164.92,-2.12,-1.269%,11833009175.00,United States,2001,624393,Health Care,Industrial Specialties +ALGS,Aligos Therapeutics Inc. Common Stock,$8.06,-0.53,-6.17%,49597871.00,United States,2020,80030,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALGT,Allegiant Travel Company Common Stock,$86.75,1.40,1.64%,1588702545.00,United States,2006,338571,Consumer Discretionary,Air Freight/Delivery Services +ALH,Alliance Laundry Holdings Inc. Common Stock,$21.54,-0.32,-1.464%,4252000330.00,,2025,560432,Industrials,Industrial Machinery/Components +ALHC,Alignment Healthcare Inc. Common Stock,$22.08,1.12,5.344%,4418025663.00,United States,2021,4454719,Health Care,Medical Specialities +ALIS,Calisa Acquisition Corp Ordinary shares,$10.01,-0.01,-0.10%,0.00,United States,2025,62132,, +ALISR,Calisa Acquisition Corp Right,$0.566,-0.004,-0.702%,0.00,United States,2025,12410,Finance,Blank Checks +ALISU,Calisa Acquisition Corp Units,$10.65,0.02,0.188%,0.00,United States,2025,300,, +ALIT,Alight Inc. Class A Common Stock,$1.54,-0.07,-4.348%,821127289.00,United States,2021,9892395,Real Estate,Real Estate +ALK,Alaska Air Group Inc. Common Stock,$52.37,0.57,1.10%,6074323663.00,United States,,4822296,Consumer Discretionary,Air Freight/Delivery Services +ALKS,Alkermes plc Ordinary Shares,$33.90,0.38,1.134%,5597483555.00,Ireland,1991,1727891,Health Care,Biotechnology: Pharmaceutical Preparations +ALKT,Alkami Technology Inc. Common Stock,$22.41,1.31,6.209%,2353139887.00,United States,2021,3213887,Technology,Computer Software: Prepackaged Software +ALL,Allstate Corporation (The) Common Stock,$197.33,2.56,1.314%,51637651440.00,United States,,1151495,Finance,Property-Casualty Insurers +ALL^B,Allstate Corporation (The) 5.100% Fixed-to-Floating Rate Subordinated Debentures due 2053,$26.07,0.06,0.231%,,United States,,32948,, +ALL^H,Allstate Corporation (The) Depositary Shares each representing a 1/1000th interest in a share of Fixed Rate Noncumulative Perpetual Preferred Stock Series H,$21.70,-0.04,-0.184%,,United States,,73845,, +ALL^I,Allstate Corporation (The) Depositary Shares each representing a 1/1000th interest in a share of Fixed Rate Noncumulative Perpetual Preferred Stock Series I,$19.96,-0.04,-0.20%,,United States,,8639,, +ALL^J,Allstate Corporation (The) Depositary Shares each representing a 1/1000th interest in a share of Fixed Rate Noncumulative Perpetual Preferred Stock Series J,$26.64,0.14,0.528%,,United States,,52403,, +ALLE,Allegion plc Ordinary Shares,$164.90,-1.99,-1.192%,14186669050.00,United States,2013,806652,Consumer Discretionary,Diversified Commercial Services +ALLO,Allogene Therapeutics Inc. Common Stock,$1.45,-0.08,-5.229%,325858709.00,United States,2018,6789836,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALLR,Allarity Therapeutics Inc. Common Stock,$1.09,-0.11,-9.167%,17224286.00,United States,,251073,Health Care,Biotechnology: Pharmaceutical Preparations +ALLT,Allot Ltd. Ordinary Shares,$10.73,0.18,1.706%,425903894.00,Israel,2006,298428,Telecommunications,Computer Communications Equipment +ALLY,Ally Financial Inc. Common Stock,$42.30,-0.59,-1.376%,13030650149.00,United States,2014,5496444,Finance,Major Banks +ALM,Almonty Industries Inc. Common Shares,$12.11,1.01,9.099%,2722468573.00,Canada,,7081227,Basic Materials,Other Metals and Minerals +ALMS,Alumis Inc. Common Stock,$27.71,1.71,6.577%,2892741197.00,United States,2024,3106668,Health Care,Biotechnology: Pharmaceutical Preparations +ALMU,Aeluma Inc. Common Stock,$17.15,0.27,1.60%,306262350.00,United States,,396486,Technology,Semiconductors +ALNT,Allient Inc. Common Stock,$59.89,-0.94,-1.545%,1014746035.00,United States,,145732,Industrials,Electrical Products +ALNY,Alnylam Pharmaceuticals Inc. Common Stock,$349.58,-5.17,-1.457%,46184348496.00,United States,2004,1099190,Health Care,Biotechnology: Pharmaceutical Preparations +ALOT,AstroNova Inc. Common Stock,$9.23,-0.19,-2.017%,70502644.00,United States,1983,8679,Technology,Computer peripheral equipment +ALOVU,Aldabra 4 Liquidity Opportunity Vehicle Inc. Units,$9.99,-0.005,-0.05%,0.00,United States,2026,2150,Finance,Blank Checks +ALPS,ALPS Group Inc Ordinary Share,$0.96,-0.022,-2.24%,159744313.00,Malaysia,,36279,, +ALRM,Alarm.com Holdings Inc. Common Stock,$48.72,-0.35,-0.713%,2430138010.00,United States,2015,248678,Technology,Computer Software: Prepackaged Software +ALRS,Alerus Financial Corporation Common Stock,$23.80,-0.17,-0.709%,604455811.00,United States,2019,190391,Finance,Major Banks +ALSN,Allison Transmission Holdings Inc. Common Stock,$110.59,-0.36,-0.324%,9204263702.00,United States,2012,640552,Consumer Discretionary,Auto Parts:O.E.M. +ALT,Altimmune Inc. Common Stock,$5.12,-1.06,-17.152%,533781366.00,United States,,13079967,Health Care,Biotechnology: Pharmaceutical Preparations +ALTG,Alta Equipment Group Inc. Class A Common Stock,$6.64,0.02,0.302%,214042279.00,United States,2019,335242,Industrials,Industrial Machinery/Components +ALTG^A,Alta Equipment Group Inc. Depositary Shares (each representing 1/1000th in a share of 10% Series A Cumulative Perpetual Preferred Stock),$25.15,0.01,0.04%,,United States,,720,, +ALTI,AlTi Global Inc. Class A Common Stock,$4.75,0.13,2.814%,696603522.00,United States,2021,96305,Finance,Investment Managers +ALTO,Alto Ingredients Inc. Common Stock,$2.61,-0.01,-0.382%,201863894.00,United States,,1187555,Industrials,Major Chemicals +ALTS,ALT5 Sigma Corporation Common Stock,$2.12,-0.07,-3.196%,267542238.00,United States,,2366685,Finance,Finance: Consumer Services +ALUB,Alussa Energy Acquisition Corp. II Class A Ordinary Shares,$10.05,0.01,0.10%,0.00,,2026,256423,, +ALUR,Allurion Technologies Inc. Common Stock,$1.48,-0.04,-2.632%,18173188.00,United States,,29344,Health Care,Medical/Dental Instruments +ALV,Autoliv Inc. Common Stock,$126.25,-1.89,-1.475%,9590625185.00,Sweden,,546655,Consumer Discretionary,Auto Parts:O.E.M. +ALVO,Alvotech Ordinary Shares,$5.29,-0.02,-0.377%,1596552031.00,Luxembourg,,291871,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALVOW,Alvotech Warrant,$0.50,-0.1123,-18.341%,150902839.00,Luxembourg,,4517,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ALX,Alexander's Inc. Common Stock,$237.85,-1.70,-0.71%,1214768927.00,United States,,72818,Real Estate,Real Estate Investment Trusts +ALXO,ALX Oncology Holdings Inc. Common Stock,$1.37,-0.13,-8.667%,74278661.00,United States,2020,110733,Health Care,Biotechnology: Pharmaceutical Preparations +ALZN,Alzamend Neuro Inc. Common Stock,$2.16,-0.02,-0.917%,8211465.00,United States,2021,79428,Health Care,Biotechnology: Pharmaceutical Preparations +AM,Antero Midstream Corporation Common Stock,$18.64,-0.12,-0.64%,8877766000.00,United States,2017,3077415,Utilities,Natural Gas Distribution +AMAL,Amalgamated Financial Corp. Common Stock (DE),$37.65,-0.50,-1.311%,1127102448.00,United States,2018,198448,Finance,Major Banks +AMAT,Applied Materials Inc. Common Stock,$336.75,4.04,1.214%,267023678501.00,United States,1972,8470041,Technology,Semiconductors +AMBA,Ambarella Inc. Ordinary Shares,$66.69,0.34,0.512%,2871036911.00,United States,2012,434823,Technology,Semiconductors +AMBO,Ambow Education Holding Ltd. American Depository Shares (each representing twenty (20) Class A Ordinary Shares),$2.80,0.003,0.107%,7997853.00,China,,6311,Real Estate,Other Consumer Services +AMBP,Ardagh Metal Packaging S.A. Ordinary Shares,$4.41,-0.03,-0.676%,2635855174.00,,,471794,Industrials,Containers/Packaging +AMBQ,Ambiq Micro Inc. Common Stock,$32.67,1.30,4.144%,681989942.00,United States,2025,502173,Technology,Semiconductors +AMBR,Amber International Holding Limited American Depositary Shares,$2.58,0.12,4.878%,241701947.00,Hong Kong,2017,46693,Finance,Finance: Consumer Services +AMC,AMC Entertainment Holdings Inc. Class A Common Stock,$1.43,-0.02,-1.379%,733509292.00,United States,2013,33824483,Consumer Discretionary,Movies/Entertainment +AMCI,AMC Robotics Corporation Common Stock,$6.10,-0.06,-0.974%,137831842.00,United States,2023,76542,Consumer Discretionary,Home Furnishings +AMCR,Amcor plc Ordinary Shares,$44.19,-0.53,-1.185%,20401285150.00,United Kingdom,2019,5409453,Consumer Discretionary,Miscellaneous manufacturing industries +AMCX,AMC Networks Inc. Class A Common Stock,$7.72,-0.05,-0.644%,336026657.00,United States,,273876,Telecommunications,Cable & Other Pay Television Services +AMD,Advanced Micro Devices Inc. Common Stock,$252.74,0.71,0.282%,411471218820.00,United States,,27061187,Technology,Semiconductors +AME,AMETEK Inc.,$222.49,1.93,0.875%,51218059704.00,United States,,1261720,Industrials,Industrial Machinery/Components +AMG,Affiliated Managers Group Inc. Common Stock,$313.58,6.02,1.957%,8820662971.00,United States,,281623,Finance,Investment Managers +AMGN,Amgen Inc. Common Stock,$342.22,-9.10,-2.59%,184278855230.00,United States,1983,2347790,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AMH,American Homes 4 Rent Common Shares of Beneficial Interest,$30.79,-0.74,-2.347%,11426350538.00,United States,2013,3257128,Real Estate,Real Estate Investment Trusts +AMH^G,American Homes 4 Rent Series G cumulative redeemable perpetual preferred shares of beneficial interest,$22.78,-0.12,-0.524%,,United States,,3783,, +AMH^H,American Homes 4 Rent Series H cumulative redeemable perpetual Preferred Shares of Beneficial Interest,$23.82,0.02,0.084%,,United States,,1574,, +AMIX,Autonomix Medical Inc. Common Stock,$0.422,-0.0006,-0.142%,2915040.00,United States,2024,193651,Health Care,Medical/Dental Instruments +AMKR,Amkor Technology Inc. Common Stock,$50.96,0.22,0.434%,12596977550.00,United States,1998,2925415,Technology,Semiconductors +AMLX,Amylyx Pharmaceuticals Inc. Common Stock,$14.505,-0.965,-6.238%,1592932848.00,United States,2022,972382,Health Care,Biotechnology: Pharmaceutical Preparations +AMN,AMN Healthcare Services Inc,$20.49,-0.39,-1.868%,787098352.00,United States,,1133135,Consumer Discretionary,Professional Services +AMOD,Alpha Modus Holdings Inc. Class A Common Stock,$1.12,0.1857,19.876%,46995153.00,United States,,3470219,Miscellaneous,Multi-Sector Companies +AMODW,Alpha Modus Holdings Inc. Warrant,$0.08,0.0142,21.581%,3356797.00,United States,,48486,Miscellaneous,Multi-Sector Companies +AMP,Ameriprise Financial Inc. Common Stock,$499.67,1.34,0.269%,46422197615.00,United States,,546999,Finance,Investment Managers +AMPG,Amplitech Group Inc. Common Stock,$3.31,-0.075,-2.216%,83350100.00,United States,,1111386,Telecommunications,Telecommunications Equipment +AMPH,Amphastar Pharmaceuticals Inc. Common Stock,$26.12,-0.13,-0.495%,1200270785.00,United States,2014,209032,Health Care,Biotechnology: Pharmaceutical Preparations +AMPL,Amplitude Inc. Class A Common Stock,$9.90,-0.13,-1.296%,1323493123.00,United States,,1004814,Technology,Computer Software: Prepackaged Software +AMPX,Amprius Technologies Inc. Common Stock,$11.98,0.40,3.454%,1563196379.00,United States,2022,7676651,Miscellaneous,Industrial Machinery/Components +AMPY,Amplify Energy Corp. Common Stock,$4.83,0.05,1.046%,195499066.00,United States,2016,579931,Energy,Oil & Gas Production +AMR,Alpha Metallurgical Resources Inc. Common Stock,$215.74,-5.59,-2.526%,2773990098.00,United States,2018,197314,Energy,Coal Mining +AMRC,Ameresco Inc. Class A Common Stock,$33.31,0.29,0.878%,1758683259.00,United States,2010,407436,Consumer Discretionary,Engineering & Construction +AMRN,Amarin Corporation plc,$15.07,-0.62,-3.952%,313345748.00,Ireland,,65824,Health Care,Biotechnology: Pharmaceutical Preparations +AMRX,Amneal Pharmaceuticals Inc. Class A Common Stock,$13.95,0.12,0.868%,4385362734.00,United States,,9386352,Health Care,Biotechnology: Pharmaceutical Preparations +AMRZ,Amrize Ltd Ordinary Shares,$53.64,-0.56,-1.033%,29667322181.00,Switzerland,2025,2654625,Industrials,Building Materials +AMS,American Shared Hospital Services Common Stock,$2.14,0.04,1.905%,14002020.00,United States,1988,3799,Health Care,Medical Specialities +AMSC,American Superconductor Corporation Common Stock,$31.82,-0.35,-1.088%,1437843626.00,United States,1991,606465,Consumer Discretionary,Metal Fabrications +AMSF,AMERISAFE Inc. Common Stock,$36.37,-0.36,-0.98%,688280392.00,United States,2005,109436,Finance,Property-Casualty Insurers +AMST,Amesite Inc. Common Stock,$1.93,-0.08,-3.98%,8825336.00,United States,2020,15406,Technology,Computer Software: Prepackaged Software +AMT,American Tower Corporation (REIT) Common Stock,$177.51,-2.56,-1.422%,83100707049.00,United States,,3437969,Real Estate,Real Estate Investment Trusts +AMTB,Amerant Bancorp Inc. Class A Common Stock,$20.88,0.03,0.144%,861625791.00,United States,,292707,Finance,Major Banks +AMTD,AMTD IDEA Group American Depositary Shares each representing six (6) Class A Ordinary Shares,$0.9962,-0.0038,-0.38%,92489905.00,,,46996,Finance,Finance: Consumer Services +AMTM,Amentum Holdings Inc. Common Stock,$35.71,0.34,0.961%,8698884294.00,United States,2024,1492298,Real Estate,Real Estate +AMTX,Aemetis Inc. (DE) Common Stock,$1.83,0.23,14.375%,119990432.00,United States,,2829844,Industrials,Major Chemicals +AMWD,American Woodmark Corporation Common Stock,$57.97,-0.65,-1.109%,844574785.00,United States,1986,96693,Basic Materials,Forest Products +AMWL,American Well Corporation Class A Common Stock,$4.78,0.14,3.017%,78254556.00,United States,2020,71141,Real Estate,Real Estate +AMX,America Movil S.A.B. de C.V. American Depositary Shares (each representing the right to receive twenty (20) Series B Shares,$21.59,0.49,2.322%,65568830000.00,Mexico,2023,2634449,Telecommunications,Telecommunications Equipment +AMZE,Amaze Holdings Inc. Common Stock,$0.4763,-0.0462,-8.842%,9498286.00,,2021,2005837,Consumer Staples,Beverages (Production/Distribution) +AMZN,Amazon.com Inc. Common Stock,$243.01,-1.67,-0.683%,2597829392833.00,United States,1997,40882657,Consumer Discretionary,Catalog/Specialty Distribution +AN,AutoNation Inc. Common Stock,$215.93,1.74,0.812%,7875437180.00,United States,,270552,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +ANAB,AnaptysBio Inc. Common Stock,$47.45,-2.28,-4.585%,1313817902.00,United States,2017,299854,Health Care,Biotechnology: Pharmaceutical Preparations +ANDE,Andersons Inc. (The) Common Stock,$61.01,0.38,0.627%,2064524894.00,United States,,346648,Industrials,Farming/Seeds/Milling +ANDG,Andersen Group Inc. Class A Common Stock,$23.24,-0.32,-1.358%,2578536100.00,,2025,305085,Real Estate,Real Estate +ANEB,Anebulo Pharmaceuticals Inc. Common Stock,$0.8549,-0.0552,-6.065%,35123337.00,United States,2021,54157,Health Care,Biotechnology: Pharmaceutical Preparations +ANET,Arista Networks Inc. Common Stock,$150.15,3.46,2.359%,189081653261.00,United States,,8568182,Telecommunications,Computer Communications Equipment +ANF,Abercrombie & Fitch Company Common Stock,$96.51,-1.16,-1.188%,4425712730.00,United States,,1097427,Consumer Discretionary,Clothing/Shoe/Accessory Stores +ANG^D,American National Group Inc. Depositary Shares each representing a 1/1000th interest in a share of 7.375% Fixed-Rate Non-Cumulative Preferred Stock Series D,$25.09,-0.03,-0.119%,,United States,,5689,, +ANGH,Anghami Inc. Ordinary Shares,$2.76,-0.03,-1.075%,25019080.00,United Arab Emirates,,8970,Consumer Discretionary,Telecommunications Equipment +ANGHW,Anghami Inc. Warrants,$0.014,-0.0038,-21.348%,126908.00,United Arab Emirates,,15877,Consumer Discretionary,Telecommunications Equipment +ANGI,Angi Inc. Class A Common Stock,$13.47,0.11,0.823%,581238245.00,United States,,710927,Consumer Discretionary,Advertising +ANGO,AngioDynamics Inc. Common Stock,$10.01,-0.23,-2.246%,412586034.00,United States,2004,494443,Health Care,Medical/Dental Instruments +ANGX,Angel Studios Inc. Class A Common Stock,$4.06,-0.12,-2.871%,919369737.00,,2025,505505,Consumer Discretionary,Movies/Entertainment +ANIK,Anika Therapeutics Inc. Common Stock,$9.13,-0.02,-0.219%,131665729.00,United States,,183031,Health Care,Medical/Dental Instruments +ANIP,ANI Pharmaceuticals Inc.,$79.51,-0.94,-1.168%,1785648938.00,United States,,615464,Health Care,Biotechnology: Pharmaceutical Preparations +ANIX,Anixa Biosciences Inc. Common Stock,$3.03,-0.05,-1.623%,101131371.00,United States,,180766,Health Care,Biotechnology: Pharmaceutical Preparations +ANL,Adlai Nortye Ltd. American Depositary Shares,$3.47,-0.13,-3.611%,128043930.00,Cayman Islands,2023,201011,Health Care,Biotechnology: Pharmaceutical Preparations +ANNA,AleAnna Inc. Class A Common Stock,$2.73,-0.14,-4.878%,181966187.00,United States,,14680,Energy,Oil & Gas Production +ANNAW,AleAnna Inc. Warrant,$0.265,0.00,0.00%,17663384.00,United States,,54599,Energy,Oil & Gas Production +ANNX,Annexon Inc. Common Stock,$6.29,-0.28,-4.262%,752490337.00,United States,2020,3741702,Health Care,Biotechnology: Pharmaceutical Preparations +ANPA,Rich Sparkle Holdings Limited Ordinary Shares,$70.98,-1.14,-1.581%,887250000.00,Hong Kong,2025,180959,Consumer Discretionary,Other Consumer Services +ANRO,Alto Neuroscience Inc. Common Stock,$15.33,-1.48,-8.804%,476246916.00,United States,2024,130611,Health Care,Biotechnology: Pharmaceutical Preparations +ANSC,Agriculture & Natural Solutions Acquisition Corporation Class A Ordinary Shares,$11.23,0.01,0.089%,0.00,United States,2024,120,, +ANSCU,Agriculture & Natural Solutions Acquisition Corporation Unit,$11.10,0.00,0.00%,0.00,United States,2023,1,, +ANSCW,Agriculture & Natural Solutions Acquisition Corporation Warrant,$0.34,-0.02,-5.556%,0.00,United States,2024,1102,, +ANTA,Antalpha Platform Holding Company Class A Ordinary Shares,$9.60,0.78,8.844%,227451600.00,Singapore,2025,27099,Finance,Investment Bankers/Brokers/Service +ANTX,AN2 Therapeutics Inc. Common Stock,$1.19,-0.015,-1.245%,32608409.00,United States,2022,69500,Health Care,Biotechnology: Pharmaceutical Preparations +ANVS,Annovis Bio Inc. Common Stock,$3.04,0.14,4.828%,80568783.00,United States,2020,457349,Health Care,Biotechnology: Pharmaceutical Preparations +ANY,Sphere 3D Corp. Common Shares,$0.28,0.003,1.083%,9444166.00,Canada,,348641,Finance,Finance: Consumer Services +AOD,abrdn Total Dynamic Dividend Fund Common Shares of Beneficial Interest,$9.94,-0.05,-0.501%,0.00,United States,2007,252755,Finance,Investment Managers +AOMD,Angel Oak Mortgage REIT Inc. 9.750% Senior Notes due 2030,$25.62,0.02,0.078%,0.00,United States,2025,495,Finance,Real Estate +AOMN,Angel Oak Mortgage REIT Inc. 9.500% Senior Notes due 2029,$25.07,-0.065,-0.259%,0.00,United States,2024,8430,Finance,Real Estate +AOMR,Angel Oak Mortgage REIT Inc. Common Stock,$9.01,0.01,0.111%,224475455.00,United States,2021,74246,Finance,Real Estate +AON,Aon plc Class A Ordinary Shares (Ireland),$333.00,2.25,0.68%,71573443245.00,United States,,1341240,Finance,Specialty Insurers +AORT,Artivion Inc. Common Stock,$41.29,-0.19,-0.458%,1956111231.00,United States,,306299,Health Care,Medical/Dental Instruments +AOS,A.O. Smith Corporation Common Stock,$69.49,-1.15,-1.628%,9675635973.00,United States,,2822507,Consumer Discretionary,Consumer Electronics/Appliances +AOSL,Alpha and Omega Semiconductor Limited Common Shares,$22.47,0.22,0.989%,675480782.00,Bermuda,2010,477471,Technology,Semiconductors +AOUT,American Outdoor Brands Inc. Common Stock ,$8.58,-0.07,-0.809%,107997412.00,United States,,50073,Consumer Discretionary,Recreational Games/Products/Toys +AP,Ampco-Pittsburgh Corporation Common Stock,$5.95,-0.09,-1.49%,120942015.00,United States,,214882,Industrials,Fluid Controls +APA,APA Corporation Common Stock,$26.01,0.18,0.697%,9224947219.00,United States,,5951287,Energy,Oil & Gas Production +APAC,StoneBridge Acquisition II Corporation Class A Ordinary Shares,$10.05,0.00,0.00%,0.00,United States,2025,83,, +APACR,StoneBridge Acquisition II Corporation Rights,$0.17,0.00,0.00%,0.00,United States,2025,13,, +APACU,StoneBridge Acquisition II Corporation Units,$10.17,0.00,0.00%,0.00,United States,2025,11,Finance,Blank Checks +APAD,A Paradise Acquisition Corp. Class A Ordinary Shares,$10.05,0.00,0.00%,0.00,Singapore,2025,240,, +APADR,A Paradise Acquisition Corp. Rights,$0.264,-0.036,-12.00%,0.00,Singapore,2025,2000,, +APAM,Artisan Partners Asset Management Inc. Class A Common Stock,$44.23,0.42,0.959%,3569236050.00,United States,2013,523775,Finance,Investment Managers +APD,Air Products and Chemicals Inc. Common Stock,$255.89,-3.23,-1.247%,56958616769.00,United States,,2067434,Basic Materials,Major Chemicals +APEI,American Public Education Inc. Common Stock,$41.46,-0.77,-1.823%,749805344.00,United States,2007,225521,Real Estate,Other Consumer Services +APG,APi Group Corporation Common Stock,$41.92,0.06,0.143%,17434775999.00,United States,2020,1800095,Consumer Discretionary,Engineering & Construction +APGE,Apogee Therapeutics Inc. Common Stock,$70.69,-1.69,-2.335%,4829556988.00,United States,2023,943670,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +APH,Amphenol Corporation Common Stock,$145.96,-20.29,-12.205%,178663141948.00,United States,,37790623,Technology,Electrical Products +API,Agora Inc. American Depositary Shares,$4.56,0.03,0.662%,426408979.00,China,2020,549095,Technology,Computer Software: Prepackaged Software +APLD,Applied Digital Corporation Common Stock,$40.22,-1.13,-2.733%,11244941801.00,United States,2022,30478623,Finance,Finance: Consumer Services +APLE,Apple Hospitality REIT Inc. Common Shares,$11.48,-0.40,-3.367%,2715888944.00,United States,2015,6837396,Real Estate,Real Estate Investment Trusts +APLM,Apollomics Inc. Class A Ordinary Shares,$17.853,-2.017,-10.151%,19698072.00,United States,,45378,Health Care,Biotechnology: Pharmaceutical Preparations +APLS,Apellis Pharmaceuticals Inc. Common Stock,$23.07,1.26,5.777%,2918936779.00,United States,2017,5695383,Health Care,Biotechnology: Pharmaceutical Preparations +APLT,Applied Therapeutics Inc. Common Stock,$0.0933,0.0008,0.865%,13463253.00,United States,2019,11115814,Health Care,Biotechnology: Pharmaceutical Preparations +APM,Aptorum Group Limited Class A Ordinary Shares,$0.8501,-0.061,-6.695%,6072908.00,Hong Kong,2018,105815,Health Care,Biotechnology: Pharmaceutical Preparations +APO,Apollo Global Management Inc. (New) Common Stock,$132.89,1.17,0.888%,77132355726.00,United States,,3082363,Finance,Investment Managers +APO^A,Apollo Global Management Inc. 6.75% Series A Mandatory Convertible Preferred Stock,$69.06,0.61,0.891%,,United States,,229283,, +APOG,Apogee Enterprises Inc. Common Stock,$38.06,-0.43,-1.117%,818675015.00,United States,,159299,Consumer Discretionary,Auto Parts:O.E.M. +APOS,Apollo Global Management Inc. 7.625% Fixed-Rate Resettable Junior Subordinated Notes due 2053,$26.38,-0.05,-0.189%,15024314069.00,United States,1987,25846,Finance,Investment Managers +APP,Applovin Corporation Class A Common Stock,$542.36,-1.20,-0.221%,183293273800.00,United States,2021,4767661,Technology,Computer Software: Programming Data Processing +APPF,AppFolio Inc. Class A Common Stock,$218.00,1.94,0.898%,7830858660.00,United States,2015,261027,Technology,Computer Software: Prepackaged Software +APPN,Appian Corporation Class A Common Stock,$30.21,0.32,1.071%,2230197905.00,United States,2017,897732,Technology,Computer Software: Prepackaged Software +APPS,Digital Turbine Inc. Common Stock,$5.47,0.02,0.367%,613454478.00,United States,,2456834,Miscellaneous,Multi-Sector Companies +APRE,Aprea Therapeutics Inc. Common stock,$0.7641,-0.0649,-7.829%,5343992.00,United States,2019,87430,Health Care,Biotechnology: Pharmaceutical Preparations +APT,Alpha Pro Tech Ltd. Common Stock,$4.96,-0.10,-1.976%,51011442.00,Canada,2000,69981,Health Care,Industrial Specialties +APTV,Aptiv PLC Ordinary Shares,$77.81,-0.20,-0.256%,16813138970.00,United Kingdom,,2606062,Consumer Discretionary,Auto Parts:O.E.M. +APUS,Apimeds Pharmaceuticals US Inc. Common Stock,$1.96,0.19,10.734%,24648927.00,,2025,158306,Health Care,Biotechnology: Pharmaceutical Preparations +APVO,Aptevo Therapeutics Inc. Common Stock,$7.835,-0.425,-5.145%,7817998.00,United States,,73292,Health Care,Biotechnology: Pharmaceutical Preparations +APWC,Asia Pacific Wire & Cable Corporation Ltd. Ordinary Shares (Bermuda),$1.71,0.01,0.588%,35253748.00,Taiwan,,5918,Industrials,Telecommunications Equipment +APXT,Apex Treasury Corporation Class A Ordinary Share,$9.94,0.01,0.101%,0.00,United States,2025,1016654,Technology,Computer Software: Prepackaged Software +APXTU,Apex Treasury Corporation Units,$10.11,0.03,0.298%,0.00,United States,2025,946,Finance,Blank Checks +APXTW,Apex Treasury Corporation Warrants,$0.3199,0.02,6.669%,0.00,United States,2025,13842,Finance,Blank Checks +APYX,Apyx Medical Corporation Common Stock,$4.01,-0.18,-4.296%,164528784.00,United States,,82456,Health Care,Medical/Dental Instruments +AQB,AquaBounty Technologies Inc. Common Stock,$0.976,-0.034,-3.366%,3784630.00,United States,,17003,Consumer Staples,Meat/Poultry/Fish +AQMS,Aqua Metals Inc. Common Stock,$5.27,-0.16,-2.947%,50336537.00,United States,2015,112612,Industrials,Metal Fabrications +AQN,Algonquin Power & Utilities Corp. Common Shares,$6.58,-0.05,-0.754%,5055058996.00,United States,2016,4265199,Utilities,Electric Utilities: Central +AQNB,Algonquin Power & Utilities Corp. 6.20% Fixed-to-Floating Subordinated Notes Series 2019-A due July 1 2079,$25.85,-0.0301,-0.116%,19853446276.00,United States,2019,6521,Utilities,Electric Utilities: Central +AQST,Aquestive Therapeutics Inc. Common Stock,$3.24,-0.23,-6.628%,395290086.00,United States,2018,3848360,Health Care,Biotechnology: Pharmaceutical Preparations +AR,Antero Resources Corporation Common Stock,$34.46,0.08,0.233%,10631258218.00,United States,2013,7597366,Energy,Oil & Gas Production +ARAI,Arrive AI Inc. Common Stock,$2.33,0.01,0.431%,79717192.00,United States,,602206,Consumer Discretionary,Diversified Commercial Services +ARAY,Accuray Incorporated Common Stock,$0.7932,-0.0324,-3.924%,89902186.00,United States,2007,734407,Health Care,Medical/Dental Instruments +ARBB,ARB IOT Group Limited Ordinary Shares,$7.0607,1.2707,21.946%,12463943.00,Malaysia,2023,189903,Technology,EDP Services +ARBE,Arbe Robotics Ltd. Ordinary Shares,$1.36,-0.09,-6.207%,163688923.00,Israel,,6901734,Technology,EDP Services +ARBEW,Arbe Robotics Ltd. Warrant,$0.15,0.0027,1.833%,18053925.00,Israel,,281,Technology,EDP Services +ARBK,Argo Blockchain plc American Depositary Shares,$4.01,0.14,3.618%,53572285.00,United Kingdom,2021,34956,Finance,Finance: Consumer Services +ARCB,ArcBest Corporation Common Stock,$85.98,-0.92,-1.059%,1935497586.00,United States,,334789,Industrials,Trucking Freight/Courier Services +ARCC,Ares Capital Corporation Common Stock,$20.19,-0.10,-0.493%,14450520054.00,United States,2004,4830117,Finance,Finance: Consumer Services +ARCIU,Archimedes Tech SPAC Partners III Co. Units,$10.09,-0.01,-0.099%,0.00,United States,2026,102165,Finance,Blank Checks +ARCO,Arcos Dorados Holdings Inc. Class A Shares,$7.80,0.03,0.386%,1643171845.00,Argentina,2011,1583137,Consumer Discretionary,Restaurants +ARCT,Arcturus Therapeutics Holdings Inc. Common Stock,$7.37,-0.09,-1.206%,209413236.00,Israel,2013,314822,Health Care,Biotechnology: Pharmaceutical Preparations +ARDC,Ares Dynamic Credit Allocation Fund Inc. Common Shares,$13.42,0.00,0.00%,307518481.00,United States,2012,68661,Finance,Investment Managers +ARDT,Ardent Health Inc. Common Stock,$8.25,-0.06,-0.722%,1181298368.00,United States,2024,298077,Health Care,Hospital/Nursing Management +ARDX,Ardelyx Inc. Common Stock,$7.86,-0.03,-0.38%,1909778045.00,United States,2014,3071797,Health Care,Biotechnology: Pharmaceutical Preparations +ARE,Alexandria Real Estate Equities Inc. Common Stock,$54.61,-3.53,-6.072%,9463932714.00,United States,,3061029,Real Estate,Real Estate Investment Trusts +AREB,American Rebel Holdings Inc. Common Stock,$0.2921,-0.0105,-3.47%,2326875.00,United States,,2863921,Industrials,Plastic Products +AREBW,American Rebel Holdings Inc. Warrants,$0.0154,-0.0013,-7.784%,122677.00,United States,,10957,Industrials,Plastic Products +AREC,American Resources Corporation Class A Common Stock,$3.99,0.07,1.786%,404559299.00,United States,,5179668,Energy,Coal Mining +AREN,The Arena Group Holdings Inc. Common Stock,$3.84,-0.14,-3.518%,182268476.00,United States,2022,58910,Technology,EDP Services +ARES,Ares Management Corporation Class A Common Stock,$149.80,0.42,0.281%,48964993277.00,United States,2014,1528211,Finance,Investment Managers +ARES^B,Ares Management Corporation 6.75% Series B Mandatory Convertible Preferred Stock,$47.72,0.25,0.527%,,United States,,197567,, +ARGX,argenx SE American Depositary Shares,$846.755,-17.665,-2.044%,51644313119.00,Netherlands,2017,299381,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ARHS,Arhaus Inc. Class A Common Stock,$9.99,-0.45,-4.31%,1409224485.00,United States,2021,687877,Consumer Discretionary,Other Specialty Stores +ARI,Apollo Commercial Real Estate Finance Inc,$10.68,0.56,5.534%,1483920115.00,United States,2009,5338739,Real Estate,Real Estate Investment Trusts +ARKO,ARKO Corp. Common Stock,$5.14,-0.09,-1.721%,572754199.00,United States,,316484,Consumer Staples,Food Chains +ARKR,Ark Restaurants Corp. Common Stock,$6.55,0.01,0.153%,23620328.00,United States,,1578,Consumer Discretionary,Restaurants +ARL,American Realty Investors Inc. Common Stock,$17.10,0.00,0.00%,276199935.00,United States,,1752,Real Estate,Other Consumer Services +ARLO,Arlo Technologies Inc. Common Stock,$12.87,-0.33,-2.50%,1364120489.00,United States,2018,1092812,Consumer Staples,Consumer Electronics/Appliances +ARLP,Alliance Resource Partners L.P. Common Units representing Limited Partners Interests,$24.31,-0.12,-0.491%,3122085263.00,United States,1999,308902,Energy,Coal Mining +ARM,Arm Holdings plc American Depositary Shares,$109.96,-4.92,-4.283%,116476669330.00,United Kingdom,2023,7947394,Technology,Semiconductors +ARMK,Aramark Common Stock,$38.50,-0.26,-0.671%,10122962889.00,United States,2013,2468128,Consumer Discretionary,Restaurants +ARMN,Aris Mining Corporation Common Shares,$21.41,0.47,2.245%,4339807000.00,,2023,1819662,, +ARMP,Armata Pharmaceuticals Inc. Common Stock,$6.46,-0.13,-1.973%,235188606.00,United States,,27322,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AROC,Archrock Inc. Common Stock,$28.37,-0.15,-0.526%,4975236744.00,United States,,1536294,Utilities,Natural Gas Distribution +AROW,Arrow Financial Corporation Common Stock,$32.43,-0.20,-0.613%,533228751.00,United States,,94238,Finance,Major Banks +ARQ,Arq Inc. Common Stock,$3.74,-0.05,-1.319%,159675126.00,United States,,171182,Industrials,Major Chemicals +ARQQ,Arqit Quantum Inc. Ordinary Shares,$23.09,-0.22,-0.944%,361401424.00,United Kingdom,,266308,Technology,Computer Software: Prepackaged Software +ARQQW,Arqit Quantum Inc. Warrants,$0.1829,-0.0068,-3.585%,2862725.00,United Kingdom,,45952,Technology,Computer Software: Prepackaged Software +ARQT,Arcutis Biotherapeutics Inc. Common Stock,$25.45,-0.88,-3.342%,3117426286.00,United States,2020,742791,Health Care,Biotechnology: Pharmaceutical Preparations +ARR,ARMOUR Residential REIT Inc.,$18.47,-0.10,-0.539%,2066760419.00,United States,,2545852,Real Estate,Real Estate Investment Trusts +ARR^C,ARMOUR Residential REIT Inc. 7% Series C Cumulative Redeemable Preferred Stock (liquidation preference $25.00 per share),$21.02,-0.01,-0.048%,,United States,,15076,, +ARRY,Array Technologies Inc. Common Stock,$11.67,0.25,2.189%,1782566441.00,United States,2020,8600633,Consumer Discretionary,Miscellaneous manufacturing industries +ARTCU,Art Technology Acquisition Corp. Units,$10.00,0.00,0.00%,0.00,United States,2026,860052,, +ARTL,Artelo Biosciences Inc. Common Stock,$1.81,-0.01,-0.549%,3653930.00,United States,,13728,Health Care,Biotechnology: Pharmaceutical Preparations +ARTNA,Artesian Resources Corporation Class A Common Stock,$32.95,-0.45,-1.347%,339818128.00,United States,,22297,Utilities,Water Supply +ARTV,Artiva Biotherapeutics Inc. Common Stock,$4.47,-0.38,-7.835%,109715721.00,United States,2024,167747,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ARTW,Art's-Way Manufacturing Co. Inc. Common Stock,$2.47,0.01,0.407%,12613880.00,United States,,27059,Industrials,Industrial Machinery/Components +ARVN,Arvinas Inc. Common Stock,$12.93,-0.69,-5.066%,830420121.00,United States,2018,894080,Health Care,Biotechnology: Pharmaceutical Preparations +ARW,Arrow Electronics Inc. Common Stock,$128.41,7.31,6.036%,6614573224.00,United States,,1254175,Technology,Electronic Components +ARWR,Arrowhead Pharmaceuticals Inc. Common Stock,$65.58,-1.33,-1.988%,9329574291.00,United States,,2060659,Health Care,Biotechnology: Pharmaceutical Preparations +ARX,Accelerant Holdings Class A Common Shares,$13.89,0.02,0.144%,3081080411.00,,2025,1749176,Finance,Specialty Insurers +AS,Amer Sports Inc. Ordinary Shares,$37.20,-0.88,-2.311%,20630057791.00,,2024,4465144,Consumer Discretionary,Apparel +ASA,ASA Gold and Precious Metals Limited,$76.22,2.31,3.125%,1432018006.00,United States,,286445,Industrials,Precious Metals +ASAN,Asana Inc. Class A Common Stock,$11.11,-0.04,-0.359%,2634181011.00,United States,2020,2572211,Technology,Computer Software: Prepackaged Software +ASB,Associated Banc-Corp Common Stock,$26.80,0.05,0.187%,4448671199.00,United States,,2747499,Finance,Major Banks +ASB^E,Associated Banc-Corp Depositary Shares each representing a 1/40th interest in a share of 5.875% Non-Cumulative Perpetual Preferred Stock Series E,$21.48,-0.0699,-0.324%,,United States,,1698,, +ASB^F,Associated Banc-Corp Depositary Shares each representing a 1/40th interest in a share of Associated Banc-Corp 5.625% Non-Cumulative Perpetual Preferred Stock Series F,$20.77,-0.2299,-1.095%,,United States,,6351,, +ASBA,Associated Banc-Corp 6.625% Fixed-Rate Reset Subordinated Notes due 2033,$25.06,0.01,0.04%,3781574424.00,United States,2023,5430,Finance,Major Banks +ASBP,Aspire Biopharma Holdings Inc. Common Stock,$1.59,-0.02,-1.242%,5503233.00,United States,2022,785453,Health Care,Biotechnology: Pharmaceutical Preparations +ASBPW,Aspire Biopharma Holdings Inc. Warrant,$0.0196,0.0024,13.953%,67839.00,United States,2022,217,Health Care,Biotechnology: Pharmaceutical Preparations +ASC,Ardmore Shipping Corporation Common Stock,$12.26,0.30,2.508%,496570961.00,,2013,485765,Consumer Discretionary,Marine Transportation +ASG,Liberty All-Star Growth Fund Inc.,$5.30,-0.03,-0.563%,0.00,United States,,200193,Finance,Investment Managers +ASGI,abrdn Global Infrastructure Income Fund Common Shares of Beneficial Interest,$22.44,0.04,0.179%,0.00,United States,2020,148080,Finance,Investment Managers +ASGN,ASGN Incorporated Common Stock,$49.31,-1.32,-2.607%,2105537000.00,United States,1992,395112,Consumer Discretionary,Professional Services +ASH,Ashland Inc. Common Stock,$62.12,-0.18,-0.289%,2840009180.00,United States,,436604,Consumer Discretionary,Specialty Chemicals +ASIC,Ategrity Specialty Insurance Company Holdings Common Stock,$17.19,-0.17,-0.979%,826266126.00,,2025,64961,Finance,Property-Casualty Insurers +ASIX,AdvanSix Inc. Common Stock ,$16.37,-0.14,-0.848%,439764253.00,United States,2016,279921,Industrials,Major Chemicals +ASLE,AerSale Corporation Common Stock,$7.38,-0.21,-2.767%,348225381.00,United States,2019,291135,Consumer Discretionary,Industrial Specialties +ASM,Avino Silver & Gold Mines Ltd. Common Shares (Canada),$11.24,0.88,8.494%,1762976275.00,Canada,,11725209,Basic Materials,Metal Mining +ASMB,Assembly Biosciences Inc. Common Stock,$26.42,-1.10,-3.997%,417888839.00,United States,2010,76941,Health Care,Biotechnology: Pharmaceutical Preparations +ASML,ASML Holding N.V. New York Registry Shares,$1422.92,-31.67,-2.177%,559611270862.00,Netherlands,1995,5036812,Technology,Industrial Machinery/Components +ASND,Ascendis Pharma A/S American Depositary Shares,$222.45,-16.35,-6.847%,13500376383.00,Denmark,2015,853874,Health Care,Biotechnology: Pharmaceutical Preparations +ASNS,Actelis Networks Inc. Common Stock,$0.4609,-0.0491,-9.627%,3714113.00,United States,2022,259055,Telecommunications,Telecommunications Equipment +ASO,Academy Sports and Outdoors Inc. Common Stock,$55.13,0.96,1.772%,3676140069.00,United States,2020,1200143,Consumer Discretionary,Other Specialty Stores +ASPC,A SPAC III Acquisition Corp. Class A Ordinary Shares,$15.58,-0.13,-0.827%,0.00,China,2025,137112,Finance,Blank Checks +ASPCR,A SPAC III Acquisition Corp. Right,$0.1998,-0.0002,-0.10%,0.00,China,2025,566,Finance,Blank Checks +ASPCU,A SPAC III Acquisition Corp. Unit,$14.81,0.00,0.00%,0.00,China,2024,1159,Finance,Blank Checks +ASPI,ASP Isotopes Inc. Common Stock,$7.94,0.15,1.926%,880070569.00,United States,2022,7353212,Industrials,Major Chemicals +ASPN,Aspen Aerogels Inc. Common Stock,$3.43,-0.11,-3.107%,283479488.00,United States,2014,2487831,Consumer Discretionary,RETAIL: Building Materials +ASPS,Altisource Portfolio Solutions S.A. Common Stock,$5.32,0.09,1.721%,58485681.00,Luxembourg,,18789,Consumer Discretionary,Other Consumer Services +ASPSW,Altisource Portfolio Solutions S.A. Net Settle Stakeholder Warrants,$0.2901,-0.0299,-9.344%,3189229.00,Luxembourg,,8437,Consumer Discretionary,Other Consumer Services +ASPSZ,Altisource Portfolio Solutions S.A. Cash Exercise Stakeholder Warrants,$0.29,0.0399,15.954%,3188129.00,Luxembourg,,2928,Consumer Discretionary,Other Consumer Services +ASR,Grupo Aeroportuario del Sureste S.A. de C.V. Common Stock,$351.30,1.67,0.478%,10539000000.00,Mexico,,55506,Consumer Discretionary,Aerospace +ASRT,Assertio Holdings Inc. Common Stock,$11.81,-0.45,-3.67%,75782479.00,United States,,38788,Health Care,Biotechnology: Pharmaceutical Preparations +ASRV,AmeriServ Financial Inc. Common Stock,$3.30,0.05,1.538%,55952381.00,United States,,37772,Finance,Major Banks +ASST,Strive Inc. Class A Common Stock,$0.8006,-0.0183,-2.235%,998697913.00,United States,2023,61701832,Technology,Computer Software: Prepackaged Software +ASTC,Astrotech Corporation (DE) Common Stock,$3.53,-0.132,-3.605%,6209104.00,United States,,16999,Industrials,Biotechnology: Laboratory Analytical Instruments +ASTE,Astec Industries Inc. Common Stock,$47.65,-0.76,-1.57%,1090033824.00,United States,1986,103741,Industrials,Construction/Ag Equipment/Trucks +ASTH,Astrana Health Inc. Common Stock,$22.00,0.52,2.421%,1238345130.00,United States,,823865,Consumer Discretionary,Professional Services +ASTI,Ascent Solar Technologies Inc. Common Stock,$5.68,-0.53,-8.535%,25771381.00,United States,,1621479,Technology,Semiconductors +ASTL,Algoma Steel Group Inc. Common Shares,$4.58,0.02,0.439%,480596813.00,Canada,,2155932,Industrials,Steel/Iron Ore +ASTLW,Algoma Steel Group Inc. Warrant,$0.14,0.01,7.692%,14690732.00,Canada,,6628,Industrials,Steel/Iron Ore +ASTS,AST SpaceMobile Inc. Class A Common Stock,$121.23,9.89,8.883%,44493753376.00,United States,2019,18458209,Consumer Discretionary,Telecommunications Equipment +ASUR,Asure Software Inc Common Stock,$9.81,0.12,1.238%,272363633.00,United States,,60092,Technology,EDP Services +ASX,ASE Technology Holding Co. Ltd. American Depositary Shares (each representing Two Common Shares) ,$20.26,0.19,0.947%,44738998500.00,Taiwan,2018,9545512,Technology,Semiconductors +ASYS,Amtech Systems Inc. Common Stock,$18.28,0.68,3.864%,263138498.00,United States,,741159,Technology,Industrial Machinery/Components +ATAI,AtaiBeckley Inc. Common Stock,$3.87,-0.03,-0.769%,1405640510.00,Germany,2008,4070999,Health Care,Biotechnology: Pharmaceutical Preparations +ATAT,Atour Lifestyle Holdings Limited American Depositary Shares,$35.70,-1.48,-3.981%,4933238451.00,China,2022,1678610,Consumer Discretionary,Hotels/Resorts +ATCH,AtlasClear Holdings Inc. Common Stock,$0.2639,-0.0052,-1.932%,38154707.00,,2024,1841644,Finance,Finance: Consumer Services +ATCX,Atlas Critical Minerals Corporation Common Stock,$9.68,-0.595,-5.791%,35016877.00,Brazil,,189208,Basic Materials,Precious Metals +ATEC,Alphatec Holdings Inc. Common Stock,$15.26,0.00,0.00%,2266875823.00,United States,2006,2073493,Health Care,Medical/Dental Instruments +ATEN,A10 Networks Inc. Common Stock,$18.44,0.30,1.654%,1322636420.00,United States,2014,989508,Telecommunications,Computer Communications Equipment +ATER,Aterian Inc. Common Stock,$0.7024,-0.0218,-3.01%,7042997.00,United States,2019,98752,Consumer Discretionary,Home Furnishings +ATEX,Anterix Inc. Common Stock,$27.91,1.98,7.636%,522381004.00,United States,2015,955261,Telecommunications,Telecommunications Equipment +ATGE,Adtalem Global Education Inc. Common Stock,$115.92,0.70,0.608%,4211205052.00,United States,,790052,Real Estate,Other Consumer Services +ATGL,Alpha Technology Group Limited Class A Ordinary Shares,$23.20,-0.90,-3.734%,381930000.00,China,2023,8445,Technology,EDP Services +ATH^A,Athene Holding Ltd. Depositary Shares Each Representing a 1/1000th Interest in a 6.35% Fixed-to-Floating Rate Perpetual Non-Cumulative Preference Share Series A,$24.7659,-0.0341,-0.138%,,Bermuda,,16266,, +ATH^B,Athene Holding Ltd. Depositary Shares Each Representing a 1/1000th Interest in a 5.625% Fixed Rate Perpetual Non- Cumulative Preference Share Series B par value $1.00 per share,$20.05,-0.16,-0.792%,,Bermuda,,39024,, +ATH^D,Athene Holding Ltd. Depositary Shares Each Representing a 1/1000th Interest in a 4.875% Fixed-Rate Perpetual Non-Cumulative Preference Share Series D,$17.03,-0.15,-0.873%,,Bermuda,,264368,, +ATH^E,Athene Holding Ltd. Depositary Shares Each Representing a 1/1000th Interest in a 7.750% Fixed-Rate Reset Perpetual Non-Cumulative Preference Share Series E,$25.75,0.01,0.039%,,Bermuda,,12806,, +ATHE,Alterity Therapeutics Limited American Depositary Shares,$3.38,-0.13,-3.704%,51875956.00,Australia,,5883,Health Care,Biotechnology: Pharmaceutical Preparations +ATHM,Autohome Inc. American Depositary Shares each representing four class A ordinary shares.,$22.54,-0.22,-0.967%,2669721787.00,China,2013,527592,Technology,EDP Services +ATHR,Aether Holdings Inc. Common Stock,$5.54,-0.03,-0.539%,67131426.00,United States,2025,2225,Technology,Computer Software: Prepackaged Software +ATHS,Athene Holding Ltd. 7.250% Fixed-Rate Reset Junior Subordinated Debentures due 2064,$25.235,0.035,0.139%,5143019175.00,Bermuda,2024,41102,Finance,Life Insurance +ATI,ATI Inc. Common Stock,$121.72,-2.43,-1.957%,16537324817.00,United States,,1958983,Industrials,Steel/Iron Ore +ATII,Archimedes Tech SPAC Partners II Co. Ordinary Shares,$10.67,-0.03,-0.28%,0.00,United States,2025,10807,, +ATIIW,Archimedes Tech SPAC Partners II Co. Warrant,$0.8468,0.0307,3.762%,0.00,United States,2025,2079,Finance,Blank Checks +ATKR,Atkore Inc. Common Stock,$68.36,-2.41,-3.405%,2307183223.00,United States,2016,659313,Miscellaneous,Industrial Machinery/Components +ATLC,Atlanticus Holdings Corporation Common Stock,$50.62,-2.71,-5.082%,766464249.00,United States,1995,57486,Finance,Finance: Consumer Services +ATLCL,Atlanticus Holdings Corporation 6.125% Senior Notes due 2026,$24.96,0.06,0.241%,377531207.00,United States,,10332,Finance,Finance: Consumer Services +ATLCP,Atlanticus Holdings Corporation 7.625% Series B Cumulative Perpetual Preferred Stock no par value per share,$24.5673,0.0408,0.166%,371986510.00,United States,,3309,Finance,Finance: Consumer Services +ATLCZ,Atlanticus Holdings Corporation 9.25% Senior Notes due 2029,$25.56,-0.185,-0.719%,386606476.00,United States,,36688,Finance,Finance: Consumer Services +ATLN,Atlantic International Corp. Common Stock,$3.48,-0.18,-4.918%,203668698.00,United States,2024,75626,Industrials,Biotechnology: Laboratory Analytical Instruments +ATLO,Ames National Corporation Common Stock,$25.06,-0.14,-0.556%,222837705.00,United States,,67737,Finance,Major Banks +ATLX,Atlas Lithium Corporation Common Stock,$6.07,-0.39,-6.037%,215746587.00,United States,,782622,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +ATMU,Atmus Filtration Technologies Inc. Common Stock,$56.74,0.01,0.018%,4624754785.00,United States,2023,703741,Consumer Discretionary,Auto Parts:O.E.M. +ATNI,ATN International Inc. Common Stock,$22.285,-0.845,-3.653%,340010958.00,United States,,35662,Telecommunications,Telecommunications Equipment +ATNM,Actinium Pharmaceuticals Inc. (Delaware) Common Stock,$1.22,-0.07,-5.426%,38058987.00,United States,,145769,Health Care,Biotechnology: Pharmaceutical Preparations +ATO,Atmos Energy Corporation Common Stock,$166.00,-3.03,-1.793%,26841093776.00,United States,,1966464,Utilities,Oil/Gas Transmission +ATOM,Atomera Incorporated Common Stock,$2.80,-0.51,-15.408%,88706892.00,United States,2016,1314140,Technology,Semiconductors +ATON,AlphaTON Capital Corp. Common Stock,$0.6609,0.0629,10.518%,5343104.00,Canada,,7931301,Energy,Oil & Gas Production +ATOS,Atossa Therapeutics Inc. Common Stock,$0.6164,-0.0684,-9.988%,79621266.00,United States,2012,2121537,Health Care,Biotechnology: Pharmaceutical Preparations +ATPC,Agape ATP Corporation Common Stock,$0.0802,-0.0176,-17.996%,4012165.00,Malaysia,,9749833,Health Care,Medical/Nursing Services +ATR,AptarGroup Inc. Common Stock,$123.70,-1.04,-0.834%,8117089350.00,United States,,347815,Industrials,Plastic Products +ATRA,Atara Biotherapeutics Inc. Common Stock,$5.50,-0.06,-1.079%,39656293.00,United States,2014,192836,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ATRC,AtriCure Inc. Common Stock,$37.77,-0.64,-1.666%,1877810637.00,United States,2005,346790,Health Care,Medical/Dental Instruments +ATRO,Astronics Corporation Common Stock,$76.59,-1.86,-2.371%,2728834377.00,United States,,581090,Industrials,Military/Government/Technical +ATS,ATS Corporation Common Shares,$28.95,-0.35,-1.195%,2838716250.00,Canada,2023,131790,Industrials,Industrial Machinery/Components +ATXG,Addentax Group Corp. Common Stock,$0.3278,-0.0117,-3.446%,3840291.00,China,,128241,Consumer Discretionary,Professional Services +ATYR,aTyr Pharma Inc. Common Stock,$0.6742,-0.0328,-4.639%,66062589.00,United States,2015,886494,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AU,AngloGold Ashanti PLC Ordinary Shares,$115.72,6.28,5.738%,58268150457.00,South Africa,,3035869,Basic Materials,Precious Metals +AUB,Atlantic Union Bankshares Corporation Common Stock,$38.90,-0.42,-1.068%,5543956113.00,United States,,1578738,Finance,Major Banks +AUB^A,Atlantic Union Bankshares Corporation Depositary Shares each representing a 1/400th ownership interest in a share of 6.875% Perpetual Non-Cumulative Preferred Stock Series A,$24.785,-0.015,-0.06%,,United States,,3786,, +AUBN,Auburn National Bancorporation Inc. Common Stock,$26.28,0.03,0.114%,91814410.00,United States,,1260,Finance,Major Banks +AUDC,AudioCodes Ltd. Common Stock,$8.65,-0.15,-1.705%,254942254.00,Israel,1999,77688,Utilities,Telecommunications Equipment +AUGO,Aura Minerals Inc. Common Shares,$72.27,3.02,4.361%,6037038749.00,United States,,1878182,, +AUID,authID Inc. Common Stock,$1.43,-0.09,-5.921%,19224548.00,United States,,606541,Technology,Computer Software: Prepackaged Software +AUNA,Auna SA Class A Ordinary Shares,$5.30,-0.15,-2.752%,392268715.00,Peru,2024,568166,Health Care,Medical/Nursing Services +AUPH,Aurinia Pharmaceuticals Inc Ordinary Shares,$14.57,0.00,0.00%,1920916945.00,Canada,,956466,Health Care,Biotechnology: Pharmaceutical Preparations +AUR,Aurora Innovation Inc. Class A Common Stock,$4.50,0.14,3.211%,8709169455.00,United States,2021,14526192,Technology,EDP Services +AURA,Aura Biosciences Inc. Common Stock,$5.42,-0.24,-4.24%,344187718.00,United States,2021,181337,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AURE,Aurelion Inc. Class A Ordinary Shares,$0.304,-0.001,-0.328%,105180449.00,Hong Kong,2023,1179263,Finance,Finance: Consumer Services +AUROW,Aurora Innovation Inc. Warrant,$0.35,0.03,9.375%,677379847.00,United States,2021,74334,Technology,EDP Services +AUST,Austin Gold Corp. Common Shares,$2.57,0.35,15.766%,35191013.00,,2022,8830163,Basic Materials,Precious Metals +AUTL,Autolus Therapeutics plc American Depositary Share,$1.45,0.03,2.113%,385907765.00,United Kingdom,2018,1709973,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AUUD,Auddia Inc. Common Stock,$1.002,0.002,0.20%,3107626.00,United States,2021,107573,Technology,EDP Services +AUUDW,Auddia Inc. Warrants,$0.0059,-0.0006,-9.231%,18298.00,United States,2021,400,Technology,EDP Services +AVA,Avista Corporation Common Stock,$40.36,-0.60,-1.465%,3284163507.00,United States,,586342,Utilities,Power Generation +AVAH,Aveanna Healthcare Holdings Inc. Common Stock,$8.25,-0.08,-0.96%,1723518910.00,United States,2021,1127963,Health Care,Medical/Nursing Services +AVAL,Grupo Aval Acciones y Valores S.A. ADR (Each representing 20 preferred shares),$5.04,-0.23,-4.364%,5983355892.00,,2014,292779,Finance,Commercial Banks +AVAV,AeroVironment Inc. Common Stock,$306.94,-2.63,-0.85%,15324248993.00,United States,2007,2109175,Industrials,Aerospace +AVB,AvalonBay Communities Inc. Common Stock,$172.97,-3.06,-1.738%,24491677637.00,United States,,1125460,Real Estate,Real Estate Investment Trusts +AVBC,Avidia Bancorp Inc. Common Stock,$17.08,-0.02,-0.117%,342902350.00,,2025,44035,Finance,Banks +AVBH,Avidbank Holdings Inc. Common stock,$27.36,-0.20,-0.726%,299613943.00,United States,,15026,Finance,Commercial Banks +AVBP,ArriVent BioPharma Inc. Common Stock,$22.57,-0.54,-2.337%,931720318.00,United States,2024,360764,Health Care,Biotechnology: Pharmaceutical Preparations +AVD,American Vanguard Corporation Common Stock ($0.10 Par Value),$4.86,0.05,1.04%,138355160.00,United States,1998,155595,Industrials,Agricultural Chemicals +AVDL,Avadel Pharmaceuticals plc Ordinary Share,$21.54,-0.02,-0.093%,2103524543.00,France,,739531,Health Care,Biotechnology: Pharmaceutical Preparations +AVGO,Broadcom Inc. Common Stock,$333.24,0.45,0.135%,1579982080779.00,United States,2009,23001670,Technology,Semiconductors +AVIR,Atea Pharmaceuticals Inc. Common Stock,$3.87,-0.20,-4.914%,302350701.00,United States,2020,521331,Health Care,Biotechnology: Pharmaceutical Preparations +AVK,Advent Convertible and Income Fund,$12.86,0.06,0.469%,0.00,United States,2003,103085,Finance,Trusts Except Educational Religious and Charitable +AVNS,Avanos Medical Inc. Common Stock,$12.85,-0.30,-2.281%,596482955.00,United States,2014,543343,Health Care,Industrial Specialties +AVNT,Avient Corporation Common Stock,$36.16,-0.55,-1.498%,3310940788.00,United States,,934585,Industrials,Major Chemicals +AVNW,Aviat Networks Inc. Common Stock,$21.60,0.19,0.887%,277289309.00,United States,,103351,Technology,Radio And Television Broadcasting And Communications Equipment +AVO,Mission Produce Inc. Common Stock,$13.31,-0.15,-1.114%,939280271.00,United States,2020,588805,Consumer Staples,Farming/Seeds/Milling +AVPT,AvePoint Inc. Class A Common Stock,$12.40,0.02,0.162%,2675787481.00,United States,2019,1179324,Technology,Computer Software: Prepackaged Software +AVR,Anteris Technologies Global Corp. Common Stock,$6.35,0.04,0.634%,549256915.00,United States,2024,715445,Health Care,Industrial Specialties +AVT,Avnet Inc. Common Stock,$59.96,7.28,13.819%,4876514781.00,United States,,4476855,Technology,Electronic Components +AVTR,Avantor Inc. Common Stock,$11.05,-0.60,-5.15%,7534054192.00,United States,2019,18816874,Industrials,Biotechnology: Laboratory Analytical Instruments +AVTX,Avalo Therapeutics Inc. Common Stock,$14.97,-1.09,-6.787%,277135972.00,United States,2015,693169,Health Care,Biotechnology: Pharmaceutical Preparations +AVX,Avax One Technology Ltd. Common Shares,$1.02,-0.02,-1.923%,94525647.00,Canada,2021,2145657,Finance,Finance: Consumer Services +AVXL,Anavex Life Sciences Corp. Common Stock,$4.87,-0.18,-3.564%,435125281.00,United States,,908339,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +AVY,Avery Dennison Corporation Common Stock,$184.87,-2.07,-1.107%,14289599489.00,United States,,462369,Consumer Discretionary,Containers/Packaging +AWF,Alliancebernstein Global High Income Fund,$10.65,0.02,0.188%,0.00,United States,1993,318060,Finance,Trusts Except Educational Religious and Charitable +AWI,Armstrong World Industries Inc Common Stock,$183.61,-1.97,-1.062%,7918739792.00,United States,,1658212,Industrials,Plastic Products +AWK,American Water Works Company Inc. Common Stock,$127.05,-3.48,-2.666%,24797216760.00,United States,2008,1489285,Utilities,Water Supply +AWP,abrdn Global Premier Properties Fund Common Shares of Beneficial Interest,$3.88,-0.01,-0.257%,0.00,United States,2007,197264,Finance,Trusts Except Educational Religious and Charitable +AWR,American States Water Company Common Stock,$72.23,-0.98,-1.339%,2796342990.00,United States,,311729,Utilities,Water Supply +AWRE,Aware Inc. Common Stock,$1.88,-0.02,-1.053%,40182548.00,United States,1996,13924,Technology,Computer Software: Prepackaged Software +AWX,Avalon Holdings Corporation Common Stock,$2.78,0.08,2.963%,10840418.00,United States,1998,2321,Utilities,Environmental Services +AX,Axos Financial Inc. Common Stock,$91.86,-0.61,-0.66%,5203318024.00,United States,2018,332203,Finance,Savings Institutions +AXG,Solowin Holdings Class A Ordinary Share,$4.09,-0.01,-0.244%,769753652.00,Hong Kong,2023,1098800,Finance,Investment Bankers/Brokers/Service +AXGN,Axogen Inc. Common Stock,$34.11,-0.48,-1.388%,1709500523.00,United States,,1124620,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +AXIA,AXIA Energia American Depositary Shares (Each representing one Common Share),$10.69,0.23,2.199%,30278284441.00,Brazil,2016,2230465,Utilities,Electric Utilities: Central +AXIA^,AXIA Energia AXIA Energia American Depositary Shares (Each representing one Preferred Class B1 Share),$11.26,0.34,3.114%,,Brazil,,59162,, +AXIA^C,AXIA Energia American Depositary Shares each representing one Preferred Class C Share,$10.45,0.25,2.451%,,Brazil,,180452,, +AXIL,AXIL Brands Inc. Common Stock,$7.39,-0.41,-5.256%,50272079.00,,2024,31700,Consumer Discretionary,Package Goods/Cosmetics +AXIN,Axiom Intelligence Acquisition Corp 1 Class A Ordinary Shares,$10.1201,0.0101,0.10%,0.00,United Kingdom,2025,20255,Finance,Blank Checks +AXINR,Axiom Intelligence Acquisition Corp 1 Right,$0.19,0.00,0.00%,0.00,United Kingdom,2025,37,Finance,Blank Checks +AXL,American Axle & Manufacturing Holdings Inc. Common Stock,$8.04,0.00,0.00%,954319225.00,United States,,4093411,Consumer Discretionary,Auto Parts:O.E.M. +AXON,Axon Enterprise Inc. Common Stock,$549.86,-60.36,-9.892%,43647043315.00,United States,2001,1337396,Industrials,Ordnance And Accessories +AXP,American Express Company Common Stock,$356.99,-2.46,-0.684%,245913151604.00,United States,,2386490,Finance,Finance: Consumer Services +AXR,AMREP Corporation Common Stock,$21.19,0.38,1.826%,112417167.00,United States,,1735,Real Estate,Homebuilding +AXS,Axis Capital Holdings Limited Common Stock,$103.78,1.27,1.239%,7994976969.00,Bermuda,2003,787321,Finance,Property-Casualty Insurers +AXS^E,Axis Capital Holdings Limited Depositary Shares each representing 1/100th interest in a share of a 5.50% Series E Preferred Shares,$20.35,-0.09,-0.44%,,Bermuda,,37030,, +AXSM,Axsome Therapeutics Inc. Common Stock,$185.17,-2.85,-1.516%,9334908549.00,United States,2015,421546,Health Care,Biotechnology: Pharmaceutical Preparations +AXTA,Axalta Coating Systems Ltd. Common Shares,$34.06,0.46,1.369%,7266366190.00,United States,2014,3509771,Consumer Discretionary,Paints/Coatings +AXTI,AXT Inc Common Stock,$16.83,-0.37,-2.151%,792876346.00,United States,1998,3722246,Technology,Semiconductors +AYI,Acuity Inc. Common Stock,$312.16,-0.64,-0.205%,9571643771.00,United States,,338457,Consumer Discretionary,Building Products +AYTU,Aytu BioPharma Inc. Common Stock,$2.62,0.02,0.769%,26693105.00,United States,,76556,Health Care,Biotechnology: Pharmaceutical Preparations +AZ,A2Z Cust2Mate Solutions Corp. Common Shares,$7.44,-0.31,-4.00%,318637805.00,Canada,,224761,Industrials,Industrial Machinery/Components +AZI,Autozi Internet Technology (Global) Ltd. Class A Ordinary Shares,$2.50,0.19,8.225%,8059553.00,China,2024,28674845,Consumer Discretionary,Automotive Aftermarket +AZN,AstraZeneca PLC American Depositary Shares,$93.22,-2.38,-2.49%,289117331016.00,United Kingdom,,8234272,Health Care,Biotechnology: Pharmaceutical Preparations +AZO,AutoZone Inc. Common Stock,$3782.14,-17.85,-0.47%,62661818517.00,United States,,118593,Consumer Discretionary,Auto & Home Supply Stores +AZTA,Azenta Inc.,$39.03,-1.10,-2.741%,1794961794.00,United States,,452402,Technology,Industrial Machinery/Components +AZTR,Azitra Inc Common Stock,$0.277,-0.007,-2.465%,2975173.00,,2023,1348143,Health Care,Biotechnology: Pharmaceutical Preparations +AZZ,AZZ Inc.,$123.15,0.27,0.22%,3676725268.00,United States,,165184,Industrials,Industrial Specialties +B,Barrick Mining Corporation Common Shares,$52.98,0.81,1.553%,89400249611.00,Canada,,21838089,Basic Materials,Precious Metals +BA,Boeing Company (The) Common Stock,$241.59,-2.97,-1.214%,183631464114.00,United States,,9999181,Industrials,Aerospace +BA^A,Boeing Company (The) Depositary Shares each representing a 1/20th interest in a share of 6.00% Series A Mandatory Convertible Preferred Stock par value $1.00,$77.29,-0.94,-1.202%,,United States,,264135,, +BABA,Alibaba Group Holding Limited American Depositary Shares each representing eight Ordinary share,$175.66,2.94,1.702%,405648030646.00,China,2014,9001486,Real Estate,Real Estate +BAC,Bank of America Corporation Common Stock,$51.81,-0.36,-0.69%,378342294446.00,United States,,35030158,Finance,Major Banks +BAC^B,Bank of America Corporation Depositary Shares each representing a 1/1000th interest in a share of 6.000% Non-Cumulative Preferred Stock Series GG,$25.47,-0.03,-0.118%,,United States,,73425,, +BAC^E,Bank of America Corporation Depositary Sh repstg 1/1000th Perp Pfd Ser E,$20.38,-0.02,-0.098%,,United States,,26485,, +BAC^K,Bank of America Corporation Depositary Shares each representing a 1/1000th interest in a share of 5.875% Non- Cumulative Preferred Stock Series HH,$24.89,-0.09,-0.36%,,United States,,49171,, +BAC^L,Bank of America Corporation Non Cumulative Perpetual Conv Pfd Ser L,$1245.75,-3.25,-0.26%,,United States,,9188,, +BAC^M,Bank of America Corporation Depositary Shares each representing a 1/1000th interest in a share of 5.375% Non-Cumulative Preferred Stock Series KK,$22.70,-0.13,-0.569%,,United States,,68226,, +BAC^N,Bank of America Corporation Depositary shares each representing 1/1000th interest in a share of 5.000% Non-Cumulative Preferred Stock Series LL,$21.29,-0.05,-0.234%,,United States,,53117,, +BAC^O,Bank of America Corporation Depositary shares each representing 1/1000th interest in a share of 4.375% Non-Cumulative Preferred Stock Series NN,$18.20,-0.07,-0.383%,,United States,,61383,, +BAC^P,Bank of America Corporation Depositary Shares each representing a 1/1000th interest in a share of 4.125% Non-Cumulative Preferred Stock Series PP,$17.31,-0.08,-0.46%,,United States,,34970,, +BAC^Q,Bank of America Corporation Depositary shares each representing 1/1000th interest in a share of 4.250% Non-Cumulative Preferred Stock Series QQ,$17.89,-0.10,-0.556%,,United States,,175407,, +BAC^S,Bank of America Corporation Depositary shares each representing 1/1000th interest in a share of 4.750% Non-Cumulative Preferred Stock Series SS,$20.14,-0.04,-0.198%,,United States,,140428,, +BACC,Blue Acquisition Corp. Class A Ordinary Shares,$10.2862,0.0562,0.549%,0.00,United States,2025,26932,Finance,Blank Checks +BACCR,Blue Acquisition Corp. Right ,$0.30,0.00,0.00%,0.00,United States,2025,113947,Finance,Blank Checks +BACQ,Inflection Point Acquisition Corp. IV Class A Ordinary Shares,$10.61,-0.05,-0.469%,0.00,United States,2024,98097,, +BACQR,Inflection Point Acquisition Corp. IV Right,$0.79,-0.01,-1.25%,0.00,United States,2024,39150,Finance,Blank Checks +BAER,Bridger Aerospace Group Holdings Inc. Common Stock,$3.23,-0.04,-1.223%,179404226.00,United States,,1490444,Industrials,Aerospace +BAERW,Bridger Aerospace Group Holdings Inc. Warrant,$0.6367,0.0767,13.696%,35364294.00,United States,,217396,Industrials,Aerospace +BAFN,BayFirst Financial Corp. Common Stock,$6.80,0.06,0.89%,27948020.00,United States,,1855,Finance,Major Banks +BAH,Booz Allen Hamilton Holding Corporation Common Stock,$91.10,1.54,1.72%,10986148838.00,United States,2010,3055899,Consumer Discretionary,Professional Services +BAK,Braskem SA ADR,$3.74,-0.10,-2.604%,1689240758.00,Brazil,,1663353,Industrials,Major Chemicals +BALL,Ball Corporation Common Stock,$56.26,-0.75,-1.316%,15076960547.00,United States,,1584014,Industrials,Containers/Packaging +BALY,Bally's Corporation Common Stock,$15.23,-0.73,-4.574%,748739331.00,United States,2024,57365,Consumer Discretionary,Hotels/Resorts +BAM,Brookfield Asset Management Inc Class A Limited Voting Shares,$51.38,-0.32,-0.619%,82759818014.00,,2022,3716146,Consumer Discretionary,Other Consumer Services +BANC,Banc of California Inc. Common Stock,$20.06,-0.10,-0.496%,3035152001.00,United States,,1793281,Finance,Major Banks +BANC^F,Banc of California Inc. Depositary Shares each representing a 1/40th interest in a share of 7.75% non-cumulative perpetual preferred stock Series F,$25.18,-0.14,-0.553%,,United States,,41217,, +BAND,Bandwidth Inc. Class A Common Stock,$13.98,-0.17,-1.201%,426691702.00,United States,2017,160073,Technology,Computer Software: Prepackaged Software +BANF,BancFirst Corporation Common Stock,$107.94,-1.31,-1.199%,3598090526.00,United States,1993,86952,Finance,Major Banks +BANFP,BancFirst Corporation - BFC Capital Trust II Cumulative Trust Preferred Securities,$26.15,0.00,0.00%,871688598.00,United States,,1,Finance,Major Banks +BANL,CBL International Limited Class B Ordinary Shares,$0.33,-0.0151,-4.376%,9075000.00,Malaysia,2023,22794,Energy,Oil Refining/Marketing +BANR,Banner Corporation Common Stock,$60.88,-0.43,-0.701%,2075151418.00,United States,,252545,Finance,Major Banks +BANX,ArrowMark Financial Corp. Common Stock,$21.20,0.00,0.00%,150575671.00,United States,,50989,Finance,Trusts Except Educational Religious and Charitable +BANXR,ArrowMark Financial Corp. Right,$0.23,0.23,,0.00,United States,,310230,, +BAOS,Baosheng Media Group Holdings Limited Ordinary shares,$3.45,0.42,13.861%,5293980.00,China,2021,54892,Real Estate,Real Estate +BAP,Credicorp Ltd. Common Stock,$358.18,2.03,0.57%,33805858303.00,Peru,,540307,Finance,Commercial Banks +BARK,BARK Inc. Class A Common Stock,$0.8564,-0.0452,-5.013%,146951749.00,United States,2020,999156,Consumer Discretionary,Other Specialty Stores +BATL,Battalion Oil Corporation Common Stock,$4.16,0.82,24.551%,68459302.00,United States,,20038433,Energy,Oil & Gas Production +BATRA,Atlanta Braves Holdings Inc. Series A Common Stock,$43.55,0.34,0.787%,2740310586.00,United States,,68204,Consumer Discretionary,Services-Misc. Amusement & Recreation +BATRK,Atlanta Braves Holdings Inc. Series C Common Stock,$39.48,-0.17,-0.429%,2484212674.00,United States,,214065,Consumer Discretionary,Services-Misc. Amusement & Recreation +BAX,Baxter International Inc. Common Stock,$19.61,0.04,0.204%,10080634336.00,United States,,5981896,Health Care,Medical/Dental Instruments +BAYA,Bayview Acquisition Corp Ordinary Shares,$11.875,0.0753,0.638%,0.00,United States,2023,5992,, +BAYAR,Bayview Acquisition Corp Right,$0.2003,-0.0622,-23.695%,0.00,United States,2023,50571,, +BB,BlackBerry Limited Common Stock,$3.75,-0.05,-1.316%,2212500000.00,Canada,,4869459,Technology,Computer Software: Prepackaged Software +BBAI,BigBear.ai Inc. Common Stock,$6.01,-0.15,-2.435%,2623672880.00,United States,2021,87932007,Technology,Computer Software: Prepackaged Software +BBAR,Banco BBVA Argentina S.A. ADS,$20.26,-0.78,-3.707%,4137835400.00,Argentina,,1123411,Finance,Commercial Banks +BBBY,Bed Bath & Beyond Inc. Common Stock,$6.52,-0.12,-1.807%,448987686.00,United States,,1668841,Consumer Discretionary,Catalog/Specialty Distribution +BBCP,Concrete Pumping Holdings Inc. Common Stock,$5.73,-0.04,-0.693%,291401471.00,United States,2017,114472,Consumer Discretionary,Engineering & Construction +BBCQ,Bleichroeder Acquisition Corp. II Class A Ordinary Shares,$9.95,9.95,,0.00,United States,2026,17464,, +BBCQU,Bleichroeder Acquisition Corp. II Units,$10.10,0.01,0.099%,0.00,United States,2026,64356,, +BBCQW,Bleichroeder Acquisition Corp. II Warrants,$0.50,0.50,,0.00,United States,2026,6831,, +BBD,Banco Bradesco Sa American Depositary Shares,$4.16,0.02,0.483%,44271428148.00,Brazil,,69174413,Finance,Major Banks +BBDC,Barings BDC Inc. Common Stock,$9.05,-0.06,-0.659%,951688389.00,United States,,297525,Finance,Diversified Financial Services +BBDO,Banco Bradesco Sa American Depositary Shares (each representing one Common Share),$3.66,0.02,0.549%,38950343034.00,Brazil,,54985,Finance,Major Banks +BBGI,Beasley Broadcast Group Inc. Class A Common Stock,$5.43,-0.38,-6.54%,9795687.00,United States,2000,1445625,Consumer Discretionary,Broadcasting +BBIO,BridgeBio Pharma Inc. Common Stock,$77.49,-0.38,-0.488%,14933005919.00,United States,2019,1839213,Health Care,Biotechnology: Pharmaceutical Preparations +BBLG,Bone Biologics Corp Common Stock,$1.69,0.02,1.198%,3033989.00,United States,,7559,Health Care,Industrial Specialties +BBLGW,Bone Biologics Corp Warrants,$15.63,0.00,0.00%,28059914.00,United States,,57,Health Care,Industrial Specialties +BBN,BlackRock Taxable Municipal Bond Trust Common Shares of Beneficial Interest,$16.23,-0.01,-0.062%,0.00,United States,2010,195520,Finance,Finance Companies +BBNX,Beta Bionics Inc. Common Stock,$14.78,-0.15,-1.005%,650684046.00,United States,2025,749353,Health Care,Medical/Dental Instruments +BBOT,BridgeBio Oncology Therapeutics Inc. Common Stock ,$12.98,-0.63,-4.629%,1038253157.00,United States,2024,173053,Health Care,Biotechnology: Pharmaceutical Preparations +BBSI,Barrett Business Services Inc. Common Stock,$36.65,-0.71,-1.90%,939142433.00,United States,1993,120639,Consumer Discretionary,Professional Services +BBT,Beacon Financial Corporation Common stock,$28.18,-0.20,-0.705%,2364551703.00,United States,,924604,Finance,Banks +BBU,Brookfield Business Partners L.P. Limited Partnership Units ,$34.57,-0.04,-0.116%,7269116177.00,,2016,23513,Consumer Discretionary,Engineering & Construction +BBUC,Brookfield Business Corporation Class A Exchangeable Subordinate Voting Shares,$34.75,-0.11,-0.316%,3333597142.00,,2022,117529,Consumer Discretionary,Engineering & Construction +BBVA,Banco Bilbao Vizcaya Argentaria S.A. Common Stock,$25.14,-0.97,-3.715%,144888996590.00,Spain,,1704638,Finance,Commercial Banks +BBW,Build-A-Bear Workshop Inc. Common Stock,$61.39,0.48,0.788%,794743828.00,United States,2004,259284,Consumer Discretionary,Recreational Games/Products/Toys +BBWI,Bath & Body Works Inc.,$21.63,0.19,0.886%,4428128316.00,United States,,5176516,Consumer Discretionary,Clothing/Shoe/Accessory Stores +BBY,Best Buy Co. Inc. Common Stock,$65.56,-0.18,-0.274%,13737121353.00,United States,,3823307,Consumer Discretionary,Consumer Electronics/Video Chains +BC,Brunswick Corporation Common Stock,$84.17,-1.60,-1.865%,5474129780.00,United States,,1444332,Industrials,Industrial Machinery/Components +BC^C,Brunswick Corporation 6.375% Notes due 2049,$24.81,-0.15,-0.601%,,United States,,9184,, +BCAB,BioAtla Inc. Common Stock,$0.3105,-0.0147,-4.52%,19705672.00,United States,2020,762841,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BCAL,California BanCorp Common Stock,$18.37,-0.06,-0.326%,593767099.00,United States,,1586478,Finance,Major Banks +BCAR,D. Boral ARC Acquisition I Corp. Class A Ordinary Shares,$10.22,-0.03,-0.293%,0.00,United States,2025,296526,Finance,Blank Checks +BCARU,D. Boral ARC Acquisition I Corp. Units,$11.32,0.54,5.009%,0.00,United States,2025,133,Finance,Blank Checks +BCARW,D. Boral ARC Acquisition I Corp. Warrant,$0.8706,0.0106,1.233%,0.00,United States,2025,326723,Finance,Blank Checks +BCAT,BlackRock Capital Allocation Term Trust Common Shares of Beneficial Interest,$14.66,-0.02,-0.136%,1585259100.00,United States,2020,647887,Finance,Finance/Investors Services +BCAX,Bicara Therapeutics Inc. Common Stock,$16.59,-0.18,-1.073%,906020993.00,United States,2024,274874,Health Care,Biotechnology: Pharmaceutical Preparations +BCBP,BCB Bancorp Inc. (NJ) Common Stock,$7.64,-0.03,-0.391%,131623494.00,United States,2005,78510,Finance,Savings Institutions +BCC,Boise Cascade L.L.C. Common Stock,$80.85,-0.89,-1.089%,2994932452.00,United States,2013,321346,Consumer Discretionary,RETAIL: Building Materials +BCDA,BioCardia Inc. Common Stock,$1.30,-0.02,-1.515%,13796554.00,United States,,28415,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BCE,BCE Inc. Common Stock,$25.27,-0.25,-0.98%,23564927396.00,Canada,,4353542,Telecommunications,Telecommunications Equipment +BCG,Binah Capital Group Inc. Common Stock,$2.38,-0.05,-2.058%,39513855.00,United States,,8640,Finance,Finance: Consumer Services +BCGWW,Binah Capital Group Inc. Warrants,$0.1488,0.00,0.00%,2470446.00,United States,,64,Finance,Finance: Consumer Services +BCH,Banco De Chile ADS,$45.62,0.36,0.795%,23041996222.00,Chile,,407165,Finance,Commercial Banks +BCIC,BCP Investment Corporation Common Stock,$12.46,0.05,0.403%,162992387.00,United States,2006,113073,Finance,Finance: Consumer Services +BCML,BayCom Corp Common Stock,$28.57,-0.88,-2.988%,311349089.00,United States,2018,15936,Finance,Major Banks +BCO,Brinks Company (The) Common Stock,$124.67,-0.81,-0.646%,5179478233.00,United States,,173606,Industrials,Integrated Freight & Logistics +BCPC,Balchem Corporation Common Stock,$168.14,2.04,1.228%,5445425756.00,United States,,153344,Industrials,Major Chemicals +BCRX,BioCryst Pharmaceuticals Inc. Common Stock,$6.66,-0.10,-1.479%,1403522146.00,United States,1994,2710602,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BCS,Barclays PLC Common Stock,$26.55,-0.64,-2.354%,92301686606.00,United Kingdom,,4973072,Finance,Commercial Banks +BCSF,Bain Capital Specialty Finance Inc. Common Stock,$13.17,-0.25,-1.863%,854318237.00,United States,2018,303845,Finance,Finance/Investors Services +BCSS,Bain Capital GSS Investment Corp. Class A Ordinary Shares,$10.16,0.00,0.00%,0.00,,2025,63117,, +BCTX,BriaCell Therapeutics Corp. Common Shares,$4.68,-0.21,-4.294%,8816680.00,Canada,,826745,Health Care,Biotechnology: Pharmaceutical Preparations +BCTXL,BriaCell Therapeutics Corp. Warrant expiring 2031,$1.17,-0.06,-4.878%,2204170.00,Canada,,53484,, +BCTXW,BriaCell Therapeutics Corp. Warrant expiring 2026,$0.0095,-0.0011,-10.377%,17897.00,Canada,,32894,Health Care,Biotechnology: Pharmaceutical Preparations +BCTXZ,BriaCell Therapeutics Corp. Warrant expiring 2030,$0.1401,-0.0389,-21.732%,263935.00,Canada,,39833,Health Care,Biotechnology: Pharmaceutical Preparations +BCV,Bancroft Fund Ltd.,$24.46,0.48,2.002%,0.00,United States,1972,15237,Finance,Finance/Investors Services +BCV^A,Bancroft Fund Limited 5.375% Series A Cumulative Preferred Shares,$21.80,0.04,0.184%,,United States,,4933,, +BCX,BlackRock Resources Common Shares of Beneficial Interest,$12.80,0.23,1.83%,1086182528.00,United States,2011,309046,Finance,Finance/Investors Services +BCYC,Bicycle Therapeutics plc American Depositary Shares,$6.58,-0.49,-6.931%,456440756.00,United Kingdom,2019,317599,Health Care,Biotechnology: Pharmaceutical Preparations +BDC,Belden Inc Common Stock,$118.67,1.10,0.936%,4663755802.00,United States,,221248,Industrials,Telecommunications Equipment +BDCI,BTC Development Corp. Class A Ordinary Shares,$10.09,0.01,0.099%,0.00,United States,2025,497625,Finance,Blank Checks +BDCIW,BTC Development Corp. Warrant,$0.4716,0.00,0.00%,0.00,United States,2025,17,Finance,Blank Checks +BDJ,Blackrock Enhanced Equity Dividend Trust,$9.50,0.00,0.00%,1680980730.00,United States,2005,425887,Finance,Finance Companies +BDL,Flanigan's Enterprises Inc. Common Stock,$33.60,2.25,7.177%,62450539.00,United States,1972,490,Consumer Discretionary,Restaurants +BDMD,Baird Medical Investment Holdings Ltd Ordinary Share,$1.09,0.07,6.863%,40347330.00,China,,147180,Health Care,Medical/Dental Instruments +BDN,Brandywine Realty Trust Common Stock,$2.76,-0.10,-3.497%,479409348.00,United States,,3249721,Real Estate,Real Estate Investment Trusts +BDRX,Biodexa Pharmaceuticals plc American Depositary Shs,$2.08,-0.08,-3.704%,4690905.00,United Kingdom,,148143,Health Care,Biotechnology: Pharmaceutical Preparations +BDSX,Biodesix Inc. Common Stock,$10.33,-0.75,-6.769%,82182226.00,United States,2020,210438,Health Care,Medical Specialities +BDTX,Black Diamond Therapeutics Inc. Common Stock,$2.57,-0.02,-0.772%,146425526.00,United States,2020,482468,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BDX,Becton Dickinson and Company Common Stock,$201.92,-1.48,-0.728%,57631713818.00,United States,,1691226,Health Care,Medical/Dental Instruments +BE,Bloom Energy Corporation Class A Common Stock,$165.39,13.08,8.588%,39116513769.00,United States,2018,12861779,Energy,Industrial Machinery/Components +BEAG,Bold Eagle Acquisition Corp. Class A Ordinary Shares,$10.65,0.00,0.00%,0.00,United States,2024,20734,, +BEAGR,Bold Eagle Acquisition Corp. Right,$0.375,-0.0249,-6.227%,0.00,United States,2024,48066,, +BEAM,Beam Therapeutics Inc. Common Stock,$29.02,-1.68,-5.472%,2944802875.00,United States,2020,2113509,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BEAT,Heartbeam Inc. Common Stock,$1.64,-0.14,-7.865%,56487443.00,United States,2021,749540,Health Care,Medical/Dental Instruments +BEATW,Heartbeam Inc. Warrant,$0.16,-0.012,-6.977%,5510970.00,United States,2021,3255,Health Care,Medical/Dental Instruments +BEEM,Beam Global Common Stock,$1.78,-0.10,-5.319%,33872236.00,United States,,651415,Technology,Semiconductors +BEEP,Mobile Infrastructure Corporation Common Stock,$2.84,0.00,0.00%,120132000.00,United States,,34944,Finance,Blank Checks +BEKE,KE Holdings Inc American Depositary Shares (each representing three Class A Ordinary Shares),$18.70,0.74,4.12%,21761828063.00,China,2020,5096056,Finance,Real Estate +BELFA,Bel Fuse Inc. Class A Common Stock,$190.64,-1.70,-0.884%,2413609730.00,United States,,60223,, +BELFB,Bel Fuse Inc. Class B Common Stock,$207.78,-2.875,-1.365%,2630611780.00,United States,,137896,, +BEN,Franklin Resources Inc. Common Stock,$25.66,0.16,0.627%,13368105083.00,United States,,5033443,Finance,Investment Managers +BENF,Beneficient Class A Common Stock,$4.78,0.33,7.416%,66575993.00,United States,,44369,Finance,Finance: Consumer Services +BENFW,Beneficient Warrant,$0.0119,-0.0004,-3.252%,165744.00,United States,,98535,Finance,Finance: Consumer Services +BEP,Brookfield Renewable Partners L.P. Limited Partnership Units,$29.00,0.19,0.659%,19081911318.00,Canada,,682658,Utilities,Electric Utilities: Central +BEP^A,Brookfield Renewable Partners L.P. 5.25% Class A Preferred Limited Partnership Units Series 17,$18.20,-0.18,-0.979%,,Canada,,3551,, +BEPC,Brookfield Renewable Corporation Brookfield Renewable Corporation Class A Subordinate Voting Shares,$40.63,0.37,0.919%,13791179692.00,United States,,865100,Utilities,Electric Utilities: Central +BEPH,Brookfield BRP Holdings (Canada) Inc. 4.625% Perpetual Subordinated Notes,$15.175,0.035,0.231%,4357718860.00,Canada,,18830,Utilities,Electric Utilities: Central +BEPI,Brookfield BRP Holdings (Canada) Inc. 4.875% Perpetual Subordinated Notes,$16.05,0.03,0.187%,4608987657.00,Canada,2021,5511,Utilities,Electric Utilities: Central +BEPJ,Brookfield BRP Holdings (Canada) Inc. 7.250% Perpetual Subordinated Notes,$24.99,0.03,0.12%,7176236857.00,Canada,2024,1093,Utilities,Electric Utilities: Central +BETA,Beta Technologies Inc. Class A Common Stock,$23.19,-1.05,-4.332%,5311208784.00,,2025,507512,Industrials,Aerospace +BETR,Better Home & Finance Holding Company Class A Common Stock,$31.88,1.24,4.047%,500408819.00,United Kingdom,2021,809009,Finance,Finance: Consumer Services +BETRW,Better Home & Finance Holding Company Warrant,$0.20,0.00,0.00%,3139328.00,United Kingdom,2021,18116,Finance,Finance: Consumer Services +BF/A,Brown Forman Corporation,$26.75,-0.38,-1.401%,,United States,,170314,, +BF/B,Brown Forman Corporation,$26.31,-0.46,-1.718%,,United States,,3994126,, +BFAM,Bright Horizons Family Solutions Inc. Common Stock,$91.91,0.80,0.878%,5197872993.00,United States,2013,542097,Consumer Discretionary,Other Consumer Services +BFC,Bank First Corporation Common Stock,$135.88,-2.51,-1.814%,1336381566.00,United States,,43841,Finance,Major Banks +BFH,Bread Financial Holdings Inc. Common Stock,$68.20,-1.25,-1.80%,3114121188.00,United States,,828142,Real Estate,Real Estate +BFH^A,Bread Financial Holdings Inc. Depositary Shares each representing a 1/40th interest in a share of 8.625% Non-Cumulative Perpetual Preferred Stock Series A,$24.58,-0.01,-0.041%,,United States,,30899,, +BFK,BlackRock Municipal Income Trust,$10.07,-0.01,-0.099%,0.00,United States,,110983,Finance,Finance Companies +BFLY,Butterfly Network Inc. Class A Common Stock,$4.31,-0.13,-2.928%,1088715103.00,United States,2020,3205548,Health Care,Medical Electronics +BFRG,Bullfrog AI Holdings Inc. Common Stock,$0.6831,-0.0219,-3.106%,10417142.00,United States,2023,128914,Health Care,Biotechnology: Pharmaceutical Preparations +BFRGW,Bullfrog AI Holdings Inc. Warrants,$0.1999,-0.0056,-2.725%,3048436.00,United States,2023,7616,Health Care,Biotechnology: Pharmaceutical Preparations +BFRI,Biofrontera Inc. Common Stock,$0.985,0.005,0.51%,11473598.00,United States,2021,87602,Health Care,Biotechnology: Pharmaceutical Preparations +BFS,Saul Centers Inc. Common Stock,$30.83,-0.55,-1.753%,752631641.00,United States,1993,65679,Real Estate,Real Estate Investment Trusts +BFS^D,Saul Centers Inc. Depositary Shares each representing 1/100th of a share of 6.125% Series D Cumulative Redeemable Preferred Stock,$21.09,0.065,0.309%,,United States,,828,, +BFS^E,Saul Centers Inc. Depositary shares each representing a 1/100th fractional interest in a share of 6.000% Series E Cumulative Redeemable Preferred Stock,$22.80,-0.30,-1.299%,,United States,,5495,, +BFST,Business First Bancshares Inc. Common Stock,$26.96,-0.30,-1.101%,884626483.00,United States,,121321,Finance,Major Banks +BFZ,BlackRock California Municipal Income Trust,$11.12,0.14,1.275%,0.00,United States,2001,110004,Finance,Finance Companies +BG,Bunge Limited Common Shares,$115.30,-0.85,-0.732%,22294528719.00,United States,,1426381,Consumer Staples,Packaged Foods +BGB,Blackstone Strategic Credit 2027 Term Fund Common Shares of Beneficial Interest,$11.79,0.01,0.085%,0.00,United States,2012,106035,Finance,Trusts Except Educational Religious and Charitable +BGC,BGC Group Inc. Class A Common Stock,$8.99,0.13,1.467%,4214042767.00,United States,,2113924,Finance,Investment Bankers/Brokers/Service +BGH,Barings Global Short Duration High Yield Fund Common Shares of Beneficial Interests,$15.05,0.04,0.266%,0.00,United States,2012,38479,Finance,Investment Managers +BGI,Birks Group Inc. Common Stock,$0.8601,-0.0399,-4.433%,16853390.00,Canada,,68327,Consumer Discretionary,Consumer Specialties +BGIN,Bgin Blockchain Limited Class A Ordinary Shares,$3.13,-0.15,-4.573%,354115495.00,China,2025,37156,, +BGL,Blue Gold Limited Class A Ordinary Shares,$3.86,0.14,3.763%,133759279.00,United Kingdom,,1707423,Basic Materials,Metal Mining +BGLC,BioNexus Gene Lab Corp Common stock,$2.76,0.04,1.471%,4958359.00,Malaysia,,361337,Health Care,Medical Specialities +BGLWW,Blue Gold Limited Warrant,$0.32,0.0275,9.402%,11088852.00,United Kingdom,,52825,Basic Materials,Metal Mining +BGM,BGM Group Ltd. Class A Ordinary Shares,$3.65,0.21,6.105%,671453748.00,China,2021,5113,Health Care,Biotechnology: Pharmaceutical Preparations +BGMS,Bio Green Med Solution Inc. Common Stock,$1.24,-0.05,-3.876%,0.00,United States,,38004,, +BGMSP,Bio Green Med Solution Inc. 6% Convertible Preferred Stock,$3.29,0.13,4.114%,0.00,United States,,266,, +BGR,BlackRock Energy and Resources Trust,$15.32,0.14,0.922%,2077180492.00,United States,2004,42617,Finance,Trusts Except Educational Religious and Charitable +BGS,B&G Foods Inc. Common Stock,$4.28,-0.19,-4.251%,342301774.00,United States,,1848033,Consumer Staples,Packaged Foods +BGSF,BGSF Inc. Common Stock,$5.63,0.02,0.357%,63054801.00,United States,,16403,Consumer Discretionary,Professional Services +BGSI,Boyd Group Services Inc. Common Shares,$164.32,-2.95,-1.764%,4572700411.00,,,19879,, +BGT,BlackRock Floating Rate Income Trust,$11.48,0.01,0.087%,0.00,United States,2004,63125,Finance,Trusts Except Educational Religious and Charitable +BGX,Blackstone Long Short Credit Income Fund Common Shares,$11.60,0.00,0.00%,0.00,,2011,128700,Finance,Trusts Except Educational Religious and Charitable +BGY,Blackrock Enhanced International Dividend Trust,$6.00,-0.02,-0.332%,0.00,United States,2007,289250,Finance,Trusts Except Educational Religious and Charitable +BH,Biglari Holdings Inc. Class B Common Stock,$382.08,-16.28,-4.087%,869424568.00,United States,2018,61536,Consumer Discretionary,Restaurants +BHAT,Blue Hat Interactive Entertainment Technology Ordinary Shares,$0.8817,-0.0483,-5.194%,6386974.00,China,2019,3079234,Consumer Discretionary,Recreational Games/Products/Toys +BHB,Bar Harbor Bankshares Inc. Common Stock,$32.89,-0.30,-0.904%,548887166.00,United States,1997,49971,Finance,Major Banks +BHC,Bausch Health Companies Inc. Common Stock,$5.66,-0.06,-1.049%,2097125801.00,Canada,,1830379,Health Care,Biotechnology: Pharmaceutical Preparations +BHE,Benchmark Electronics Inc. Common Stock,$49.78,0.78,1.592%,1776097384.00,United States,,369949,Technology,Electrical Products +BHF,Brighthouse Financial Inc. Common Stock,$64.35,0.18,0.281%,3678967814.00,United States,,451827,Finance,Life Insurance +BHFAL,Brighthouse Financial Inc. 6.25% Junior Subordinated Debentures due 2058,$17.91,-0.07,-0.389%,1023936496.00,United States,,15347,Finance,Life Insurance +BHFAM,Brighthouse Financial Inc. Depositary shares each representing a 1/1000th Interest in a Share of 4.625% Non-Cumulative Preferred Stock Series D,$12.22,-0.085,-0.691%,698632272.00,United States,,192518,Finance,Life Insurance +BHFAN,Brighthouse Financial Inc. Depositary shares each representing a 1/1000th interest in a share of 5.375% Non-Cumulative Preferred Stock Series C,$13.90,-0.07,-0.501%,794679916.00,United States,,36054,Finance,Life Insurance +BHFAO,Brighthouse Financial Inc. Depositary Shares 6.75% Non-Cumulative Preferred Stock Series B,$17.30,0.00,0.00%,989062054.00,United States,,21063,Finance,Life Insurance +BHFAP,Brighthouse Financial Inc. Depositary Shares 6.6% Non-Cumulative Preferred Stock Series A,$16.83,-0.13,-0.767%,962191582.00,United States,,36915,Finance,Life Insurance +BHK,Blackrock Core Bond Trust,$9.51,-0.04,-0.419%,0.00,United States,2001,203247,Finance,Finance Companies +BHM,Bluerock Homes Trust Inc. Class A Common Stock,$9.07,0.08,0.89%,36793063.00,,2022,801,Real Estate,Real Estate Investment Trusts +BHP,BHP Group Limited American Depositary Shares (Each representing two Ordinary Shares),$70.96,0.47,0.667%,180199839484.00,Australia,,4572113,Energy,Coal Mining +BHR,Braemar Hotels & Resorts Inc. Common Stock,$2.73,-0.11,-3.873%,186239049.00,United States,2013,453064,Real Estate,Real Estate Investment Trusts +BHR^B,Braemar Hotels & Resorts Inc. 5.50% Series B Cumulative Convertible Preferred Stock par value $0.01 per share,$13.60,0.08,0.592%,,United States,,23538,, +BHR^D,Braemar Hotels & Resorts Inc. 8.25% Series D Cumulative Preferred Stock par value $0.01 per share,$17.11,0.34,2.027%,,United States,,33922,, +BHRB,Burke & Herbert Financial Services Corp. Common Stock,$63.43,-0.63,-0.983%,953259277.00,United States,,73412,Finance,Major Banks +BHST,BioHarvest Sciences Inc. Common Stock,$4.91,-0.11,-2.191%,111232559.00,Canada,,52685,, +BHV,BlackRock Virginia Municipal Bond Trust,$10.5401,0.0146,0.139%,0.00,United States,2002,10512,Finance,Finance/Investors Services +BHVN,Biohaven Ltd. Common Shares ,$12.18,-0.49,-3.867%,1615518526.00,United States,2022,1233026,Health Care,Biotechnology: Pharmaceutical Preparations +BIAF,bioAffinity Technologies Inc. Common Stock,$1.26,-0.06,-4.545%,5668373.00,United States,2022,45078,Health Care,Biotechnology: Commercial Physical & Biological Resarch +BIDU,Baidu Inc. ADS,$157.67,0.03,0.019%,54202357172.00,China,2005,1820300,Technology,Computer Software: Programming Data Processing +BIIB,Biogen Inc. Common Stock,$174.83,0.71,0.408%,25647958214.00,United States,,1304662,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BILI,Bilibili Inc. American Depositary Shares,$35.92,1.24,3.576%,15014075116.00,China,2018,2774475,Technology,EDP Services +BILL,BILL Holdings Inc. Common Stock,$46.55,-0.51,-1.084%,4662293594.00,United States,2019,1507590,Technology,EDP Services +BIO,Bio-Rad Laboratories Inc. Class A Common Stock,$299.79,2.08,0.699%,8086785785.00,United States,1980,290883,Industrials,Biotechnology: Laboratory Analytical Instruments +BIO/B,Bio-Rad Laboratories Inc.,$312.75,0.00,0.00%,,United States,,1,, +BIOA,BioAge Labs Inc. Common Stock,$19.51,-0.09,-0.459%,814493179.00,United States,2024,376088,Health Care,Biotechnology: Pharmaceutical Preparations +BIOX,Bioceres Crop Solutions Corp. Ordinary Shares,$1.13,-0.03,-2.586%,71447910.00,Argentina,,341266,Industrials,Agricultural Chemicals +BIP,Brookfield Infrastructure Partners LP Limited Partnership Units,$35.32,-0.06,-0.17%,16290778664.00,Bermuda,,703859,Consumer Discretionary,Marine Transportation +BIP^A,Brookfield Infrastructure Partners LP 5.125% Class A Preferred Limited Partnership Units Series 13,$17.20,0.20,1.176%,,Bermuda,,4099,, +BIP^B,Brookfield Infrastructure Partners LP 5.000% Class A Preferred Limited Partnership Units Series 14,$16.83,-0.05,-0.296%,,Bermuda,,5166,, +BIPC,Brookfield Infrastructure Corporation Brookfield Infrastructure Corporation,$46.44,0.35,0.759%,6135287039.00,Canada,,646866,Utilities,Oil & Gas Production +BIPH,Brookfield Infrastructure Corporation 5.000% Subordinated Notes due 2081,$16.69,-0.0632,-0.377%,7699830893.00,Canada,2021,40250,Utilities,Oil & Gas Production +BIPI,BIP Bermuda Holdings I Limited 5.125% Perpetual Subordinated Notes,$17.03,-0.11,-0.642%,161391607.00,Bermuda,2022,17082,Consumer Discretionary,Marine Transportation +BIPJ,Brookfield Infrastructure Corporation 7.250% Subordinated Notes due 2084,$24.55,-0.15,-0.607%,11325994513.00,Canada,2024,10828,Utilities,Oil & Gas Production +BIRD,Allbirds Inc. Class A Common Stock,$3.97,0.05,1.276%,32605975.00,United States,2021,57740,Consumer Discretionary,Apparel +BIRK,Birkenstock Holding plc Ordinary Shares,$37.57,-0.82,-2.136%,6909350524.00,,2023,3908226,Consumer Discretionary,Shoe Manufacturing +BIT,BlackRock Multi-Sector Income Trust Common Shares of Beneficial Interest,$13.23,0.02,0.151%,0.00,United States,2013,203631,Finance,Trusts Except Educational Religious and Charitable +BITF,Bitfarms Ltd. Common Stock,$2.60,0.00,0.00%,1554601064.00,Canada,,33161961,Finance,Finance: Consumer Services +BIVI,BioVie Inc. Class A Common Stock,$1.23,0.02,1.653%,9274589.00,United States,,125657,Health Care,Biotechnology: Pharmaceutical Preparations +BIXI,Bitcoin Infrastructure Acquisition Corp Ltd. Class A Ordinary Shares,$9.90,0.00,0.00%,0.00,United States,2025,2047,, +BIXIU,Bitcoin Infrastructure Acquisition Corp Ltd. Unit ,$10.04,0.02,0.20%,0.00,United States,2025,120,Finance,Blank Checks +BIXIW,Bitcoin Infrastructure Acquisition Corp Ltd. Warrant,$0.30,0.00,0.00%,0.00,United States,2025,1016,, +BIYA,Baiya International Group Inc. Ordinary Shares,$3.85,-0.14,-3.509%,4565268.00,China,2025,40703,Consumer Discretionary,Diversified Commercial Services +BJ,BJ's Wholesale Club Holdings Inc. Common Stock,$91.58,-3.88,-4.065%,11983033740.00,United States,2018,3115309,Consumer Discretionary,Department/Specialty Retail Stores +BJDX,Bluejay Diagnostics Inc. Common Stock,$0.8115,0.0518,6.818%,1472169.00,United States,2021,319437,Health Care,Medical/Dental Instruments +BJRI,BJ's Restaurants Inc. Common Stock,$41.34,-0.73,-1.735%,873711847.00,United States,,258254,Consumer Discretionary,Restaurants +BK,The Bank of New York Mellon Corporation Common Stock,$118.90,0.03,0.025%,82914810844.00,United States,,2455482,Finance,Major Banks +BK^K,The Bank Of New York Mellon Corporation Depositary Shares each representing a 1/4000th interest in a share of Series K Noncumulative Perpetual Preferred Stock,$25.777,-0.093,-0.359%,,United States,,28863,, +BKD,Brookdale Senior Living Inc. Common Stock,$13.11,0.19,1.471%,3115662189.00,United States,2005,5416137,Health Care,Hospital/Nursing Management +BKE,Buckle Inc. (The) Common Stock,$47.91,-1.06,-2.165%,2450913952.00,United States,,470367,Consumer Discretionary,Clothing/Shoe/Accessory Stores +BKH,Black Hills Corporation Common Stock,$72.16,-1.46,-1.983%,5446159822.00,United States,,1190568,Utilities,Electric Utilities: Central +BKHA,Black Hawk Acquisition Corporation Class A Ordinary Shares,$11.50,0.00,0.00%,0.00,United States,2024,39,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BKHAR,Black Hawk Acquisition Corporation Rights,$1.38,0.00,0.00%,0.00,United States,2024,126,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BKHAU,Black Hawk Acquisition Corporation Units,$11.65,0.15,1.304%,0.00,United States,2024,829,, +BKKT,Bakkt Inc. Class A Common Stock,$14.50,-0.44,-2.945%,370175706.00,United States,,1269899,Finance,Finance: Consumer Services +BKN,BlackRock Investment Quality Municipal Trust Inc. (The),$11.38,0.08,0.708%,0.00,United States,1993,23506,Finance,Trusts Except Educational Religious and Charitable +BKNG,Booking Holdings Inc. Common Stock,$5085.22,-68.19,-1.323%,163916040714.00,United States,,200685,Consumer Discretionary,Transportation Services +BKR,Baker Hughes Company Class A Common Stock,$56.63,0.13,0.23%,55881004938.00,United States,,10929156,Consumer Discretionary,Oil and Gas Field Machinery +BKSY,BlackSky Technology Inc. Class A Common Stock,$27.73,0.87,3.239%,1149647255.00,United States,2019,1389894,Technology,Radio And Television Broadcasting And Communications Equipment +BKT,BlackRock Income Trust Inc. (The),$11.04,-0.01,-0.09%,1642337680.00,United States,,93794,Finance,Investment Bankers/Brokers/Service +BKTI,BK Technologies Corporation Common Stock,$79.21,0.22,0.279%,295630810.00,United States,,30324,Technology,Radio And Television Broadcasting And Communications Equipment +BKU,BankUnited Inc. Common Stock,$46.94,-0.67,-1.407%,3527192283.00,United States,2011,1042108,Finance,Savings Institutions +BKV,BKV Corporation Common Stock,$28.77,0.43,1.517%,2789894366.00,United States,2024,401823,Energy,Oil & Gas Production +BKYI,BIO-key International Inc. Common Stock,$0.7347,0.1867,34.069%,7961663.00,United States,,175654385,Technology,Computer Software: Prepackaged Software +BL,BlackLine Inc. Common Stock,$51.82,-1.33,-2.502%,3082599136.00,United States,2016,784206,Technology,Computer Software: Prepackaged Software +BLBD,Blue Bird Corporation Common Stock,$49.76,-0.85,-1.68%,1573262020.00,United States,2014,340164,Consumer Discretionary,Construction/Ag Equipment/Trucks +BLBX,Blackboxstocks Inc. Common Stock,$12.94,-0.22,-1.672%,55708421.00,United States,,106263,Technology,EDP Services +BLCO,Bausch + Lomb Corporation Common Shares,$16.76,-0.08,-0.475%,5936220780.00,,2022,294177,Health Care,Ophthalmic Goods +BLD,TopBuild Corp. Common Stock,$482.24,1.69,0.352%,13537272978.00,United States,2015,158261,Consumer Discretionary,Engineering & Construction +BLDP,Ballard Power Systems Inc. Common Shares,$2.58,0.01,0.389%,775905732.00,Canada,,2938572,Energy,Industrial Machinery/Components +BLDR,Builders FirstSource Inc. Common Stock,$117.09,-0.20,-0.171%,12947880229.00,United States,2005,1206887,Consumer Discretionary,RETAIL: Building Materials +BLE,BlackRock Municipal Income Trust II,$10.51,0.03,0.286%,0.00,United States,2002,92665,Finance,Finance/Investors Services +BLFS,BioLife Solutions Inc. Common Stock,$22.94,-2.04,-8.167%,1104516175.00,United States,,383590,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +BLFY,Blue Foundry Bancorp Common Stock,$12.85,-0.23,-1.758%,266781741.00,United States,2021,299759,Finance,Banks +BLIN,Bridgeline Digital Inc. Common Stock,$0.8495,0.0245,2.97%,10384627.00,United States,2007,210996,Technology,Computer Software: Prepackaged Software +BLIV,BeLive Holdings Ordinary Share,$3.30,0.20,6.452%,35853847.00,Singapore,2025,5075,Technology,EDP Services +BLK,BlackRock Inc. Common Stock,$1121.67,14.98,1.354%,174028120098.00,United States,1999,616256,Finance,Investment Bankers/Brokers/Service +BLKB,Blackbaud Inc. Common Stock,$54.87,0.14,0.256%,2624661402.00,United States,2004,246586,Technology,Computer Software: Prepackaged Software +BLLN,BillionToOne Inc. Class A Common Stock,$86.05,0.49,0.573%,3938401798.00,United States,2025,133717,Health Care,Medical Specialities +BLMN,Bloomin' Brands Inc. Common Stock,$6.18,-0.505,-7.554%,526641622.00,United States,2012,3276291,Consumer Discretionary,Restaurants +BLND,Blend Labs Inc. Class A Common Stock,$2.72,-0.05,-1.805%,706511622.00,United States,2021,3963811,Technology,Computer Software: Programming Data Processing +BLNE,Beeline Holdings Inc. Common Stock,$3.32,-0.26,-7.263%,92147115.00,United States,,731861,Finance,Finance: Consumer Services +BLNK,Blink Charging Co. Common Stock,$0.7822,-0.059,-7.014%,110487890.00,United States,,3134486,Consumer Discretionary,Industrial Specialties +BLRKU,Bluerock Acquisition Corp. Unit,$10.02,-0.01,-0.10%,0.00,United States,2025,580,, +BLRX,BioLineRx Ltd. American Depositary Shares,$3.01,-0.04,-1.311%,11200219.00,Israel,,18784,Health Care,Biotechnology: Pharmaceutical Preparations +BLSH,Bullish Ordinary Shares,$34.33,-0.47,-1.351%,5018487760.00,Cayman Islands,2025,3487202,Finance,Finance: Consumer Services +BLTE,Belite Bio Inc American Depositary Shares,$165.64,-1.70,-1.016%,6213923313.00,United States,2022,309416,Health Care,Biotechnology: Pharmaceutical Preparations +BLUW,Blue Water Acquisition Corp. III Class A Ordinary Shares,$10.32,0.00,0.00%,74768400.00,United States,2025,548,, +BLUWW,Blue Water Acquisition Corp. III Warrant.,$0.53,-0.0601,-10.185%,3839850.00,United States,2025,1500,, +BLW,Blackrock Limited Duration Income Trust,$13.78,0.04,0.291%,492101066.00,United States,2003,102341,Consumer Discretionary,Other Consumer Services +BLX,Banco Latinoamericano de Comercio Exterior S.A.,$47.61,-0.04,-0.084%,1751610940.00,Panama,1992,131210,Finance,Commercial Banks +BLZE,Backblaze Inc. Class A Common Stock,$4.80,-0.15,-3.03%,276960000.00,United States,2021,417256,Technology,Computer Software: Prepackaged Software +BLZR,Trailblazer Acquisition Corp. Class A Ordinary Shares,$10.08,0.01,0.099%,0.00,United States,2025,20964,Finance,Blank Checks +BLZRU,Trailblazer Acquisition Corp. Unit,$10.23,-0.02,-0.195%,0.00,United States,2025,1000,, +BMA,Banco Macro S.A. ADR (representing Ten Class B Common Shares),$103.91,-0.79,-0.755%,6644144743.00,Argentina,,261976,Finance,Commercial Banks +BMBL,Bumble Inc. Class A Common Stock,$3.63,-0.05,-1.359%,409242552.00,United States,2021,1737215,Technology,Computer Software: Programming Data Processing +BME,Blackrock Health Sciences Trust,$41.45,-0.41,-0.979%,552653596.00,United States,2005,31229,Finance,Trusts Except Educational Religious and Charitable +BMEA,Biomea Fusion Inc. Common Stock,$1.26,-0.04,-3.077%,89086585.00,United States,2021,697427,Health Care,Biotechnology: Pharmaceutical Preparations +BMEZ,BlackRock Health Sciences Term Trust Common Shares of Beneficial Interest,$15.25,-0.19,-1.231%,203328525.00,United States,2020,297011,Finance,Trusts Except Educational Religious and Charitable +BMGL,Basel Medical Group Ltd Ordinary Shares,$0.7925,-0.0138,-1.712%,14887707.00,Singapore,2025,21186,Health Care,Medical/Nursing Services +BMHL,Bluemount Holdings Limited Class B Ordinary Shares,$3.55,-0.20,-5.333%,85218272.00,Hong Kong,2025,4179,Finance,Finance: Consumer Services +BMI,Badger Meter Inc. Common Stock,$146.32,-18.09,-11.003%,4312018941.00,United States,1971,1482168,Industrials,Industrial Machinery/Components +BML^G,Bank of America Corporation Depositary Shares (Each representing a 1/1200th interest in a share of Floating Rate Non-Cumulative Preferred Stock Series 1),$19.65,0.01,0.051%,,United States,,7770,, +BML^H,Bank of America Corporation Depositary Shares (Each representing a 1/1200th interest in a Share of Floating Rate Non-Cumulative Preferred Stock Series 2),$19.57,0.06,0.308%,,United States,,12262,, +BML^J,Bank of America Corporation Depositary Shares (Each representing a 1/1200th interest in a Share of Floating Rate Non-Cumulative Preferred Stock Series 4),$21.04,0.01,0.048%,,United States,,9508,, +BML^L,Bank of America Corporation Depositary Shares (Each representing a 1/1200th Interest in a Share of Floating Rate Non-Cumulative Preferred Stock Series 5),$20.04,0.0055,0.027%,,United States,,4934,, +BMM,Blue Moon Metals Inc. Common Shares,$4.485,-0.025,-0.554%,362582030.00,Canada,,111787,, +BMN,BlackRock 2037 Municipal Target Term Trust Common Shares of Beneficial Interest,$26.12,-0.02,-0.077%,0.00,,2022,13744,Finance,Trusts Except Educational Religious and Charitable +BMNR,BitMine Immersion Technologies Inc. Common Stock,$29.63,0.30,1.023%,13477574423.00,United States,2025,34159002,Finance,Finance: Consumer Services +BMO,Bank Of Montreal Common Stock,$139.23,1.21,0.877%,98700937687.00,Canada,,797387,Finance,Commercial Banks +BMR,Beamr Imaging Ltd. Ordinary Share,$1.98,0.08,4.211%,30727212.00,Israel,2023,3124370,Technology,Computer Software: Prepackaged Software +BMRA,Biomerica Inc. Common Stock,$2.424,-0.016,-0.656%,7320642.00,United States,,10940,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +BMRC,Bank of Marin Bancorp Common Stock,$26.05,-0.61,-2.288%,419266570.00,United States,,116064,Finance,Major Banks +BMRN,BioMarin Pharmaceutical Inc. Common Stock,$56.68,-0.17,-0.299%,10889041018.00,United States,1999,1695854,Health Care,Biotechnology: Pharmaceutical Preparations +BMY,Bristol-Myers Squibb Company Common Stock,$54.62,-0.94,-1.692%,111192830335.00,United States,,7901692,Health Care,Biotechnology: Pharmaceutical Preparations +BN,Brookfield Corporation Class A Limited Voting Shares,$47.09,-0.33,-0.696%,105732922014.00,Canada,1925,6209835,Real Estate,Building operators +BNAI,Brand Engagement Network Inc. Common Stock,$63.00,11.00,21.154%,282749040.00,United States,2021,14282147,Technology,EDP Services +BNAIW,Brand Engagement Network Inc. Warrant,$0.4999,0.0999,24.975%,2243591.00,United States,2021,1779870,Technology,EDP Services +BNBX,BNB Plus Corp. Common Stock,$1.58,0.07,4.636%,32460008.00,United States,,20485,Consumer Discretionary,Other Consumer Services +BNC,CEA Industries Inc. Common Stock,$5.31,-0.16,-2.925%,233974201.00,United States,,290760,Industrials,Industrial Machinery/Components +BNCWW,CEA Industries Inc. Warrant,$0.045,-0.0085,-15.888%,0.00,United States,,7035,, +BNED,Barnes & Noble Education Inc Common Stock,$8.96,-0.16,-1.754%,305122469.00,United States,2015,213845,Consumer Discretionary,Other Specialty Stores +BNGO,Bionano Genomics Inc. Common Stock,$1.51,-0.03,-1.948%,15365760.00,United States,2018,108185,Industrials,Biotechnology: Laboratory Analytical Instruments +BNH,Brookfield Finance Inc. 4.625% Subordinated Notes due October 16 2080,$15.99,-0.02,-0.125%,24109673454.00,Canada,2020,23548,Real Estate,Building operators +BNJ,Brookfield Finance Inc. 4.50% Perpetual Subordinated Notes,$15.73,-0.05,-0.317%,23717646244.00,Canada,2020,10075,Real Estate,Building operators +BNKK,Bonk Inc. Common Stock,$4.72,0.07,1.505%,25012800.00,United States,2020,146411,Consumer Discretionary,Package Goods/Cosmetics +BNL,Broadstone Net Lease Inc. Common Stock,$17.95,-0.36,-1.966%,3396427864.00,United States,2020,1119671,Real Estate,Real Estate Investment Trusts +BNR,Burning Rock Biotech Limited American Depositary Shares,$35.36,-0.39,-1.091%,380706835.00,China,2020,10126,Health Care,Medical Specialities +BNRG,Brenmiller Energy Ltd Ordinary Shares,$3.00,-0.20,-6.25%,2147556.00,Israel,,120528,Industrials,Building Products +BNS,Bank Nova Scotia Halifax Pfd 3 Ordinary Shares,$75.26,-0.98,-1.285%,93441310800.00,Canada,,1952839,Finance,Major Banks +BNT,Brookfield Wealth Solutions Ltd. Class A Exchangeable Limited Voting Shares,$47.08,-0.37,-0.78%,14492752028.00,,2021,14589,Finance,Property-Casualty Insurers +BNTC,Benitec Biopharma Inc. Common Stock,$12.08,-0.47,-3.745%,409055690.00,United States,2015,151291,Health Care,Biotechnology: Pharmaceutical Preparations +BNTX,BioNTech SE American Depositary Share,$116.16,-3.18,-2.665%,27875008593.00,Germany,2019,909016,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BNY,BlackRock New York Municipal Income Trust,$10.17,0.07,0.693%,0.00,United States,,33270,Finance,Trusts Except Educational Religious and Charitable +BNZI,Banzai International Inc. Class A Common Stock,$1.27,-0.015,-1.167%,15136249.00,United States,2021,2175879,Technology,Computer Software: Prepackaged Software +BNZIW,Banzai International Inc. Warrant,$0.0248,0.0048,24.00%,295574.00,United States,2021,86633,Technology,Computer Software: Prepackaged Software +BOC,Boston Omaha Corporation Class A Common Stock,$11.98,-0.19,-1.561%,376812139.00,United States,2022,193121,Finance,Real Estate +BODI,The Beachbody Company Inc. Class A Common Stock,$11.52,0.41,3.69%,81654186.00,United States,,30909,Consumer Discretionary,Other Consumer Services +BOE,Blackrock Enhanced Global Dividend Trust Common Shares of Beneficial Interest,$11.92,-0.07,-0.584%,0.00,United States,2005,138104,Finance,Trusts Except Educational Religious and Charitable +BOF,BranchOut Food Inc. Common Stock,$2.96,-0.17,-5.431%,39694959.00,United States,2023,435604,Consumer Staples,Packaged Foods +BOH,Bank of Hawaii Corporation Common Stock,$74.14,-0.62,-0.829%,2949666721.00,United States,,470311,Finance,Major Banks +BOH^A,Bank of Hawaii Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of 4.375% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series A,$16.57,-0.13,-0.778%,,United States,,4182,, +BOH^B,Bank of Hawaii Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of 8.000% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series B,$26.21,0.04,0.153%,,United States,,7558,, +BOKF,BOK Financial Corporation Common Stock,$128.77,-1.01,-0.778%,8144403239.00,United States,,280599,Finance,Major Banks +BOLD,Boundless Bio Inc. Common Stock,$1.21,-0.01,-0.82%,27086589.00,United States,2024,46148,Health Care,Biotechnology: Pharmaceutical Preparations +BOLT,Bolt Biotherapeutics Inc. Common Stock,$6.71,-0.38,-5.36%,12879449.00,United States,2021,46950,Health Care,Biotechnology: Pharmaceutical Preparations +BON,Bon Natural Life Limited Class A Ordinary Shares,$1.65,-0.03,-1.786%,13412537.00,China,2021,15703,Health Care, Medicinal Chemicals and Botanical Products +BOOM,DMC Global Inc. Common Stock,$8.73,-0.14,-1.578%,179754908.00,United States,,171870,Industrials,Industrial Specialties +BOOT,Boot Barn Holdings Inc. Common Stock,$172.29,-6.40,-3.582%,5252025302.00,United States,2014,787731,Consumer Discretionary,Clothing/Shoe/Accessory Stores +BORR,Borr Drilling Limited Common Shares,$4.51,0.00,0.00%,1383996319.00,Bermuda,2019,6935383,Energy,Oil & Gas Production +BOSC,B.O.S. Better Online Solutions Common Stock,$5.05,0.13,2.642%,31232998.00,Israel,,47280,Telecommunications,Computer Communications Equipment +BOTJ,Bank of the James Financial Group Inc. Common Stock,$18.70,0.16,0.863%,84960421.00,United States,,2048,Finance,Major Banks +BOW,Bowhead Specialty Holdings Inc. Common Stock,$24.33,-0.16,-0.653%,797609757.00,United States,2024,141997,Finance,Property-Casualty Insurers +BOX,Box Inc. Class A Common Stock,$26.47,-0.09,-0.339%,3791240342.00,United States,2015,2033359,Technology,Computer Software: Prepackaged Software +BOXL,Boxlight Corporation Class A Common Stock,$1.42,-0.11,-7.19%,5916667.00,United States,2017,263562,Real Estate,Other Consumer Services +BP,BP p.l.c. Common Stock,$37.70,0.08,0.213%,98348760777.00,United Kingdom,,6356541,Energy,Integrated oil Companies +BPAC,Blueport Acquisition Ltd Class A Ordinary Shares,$9.96,-0.025,-0.25%,0.00,United States,2026,2722,, +BPOP,Popular Inc. Common Stock,$131.54,0.94,0.72%,8770410427.00,United States,,797053,Finance,Major Banks +BPOPM,Popular Inc. Popular Capital Trust II - 6.125% Cumulative Monthly Income Trust Preferred Securities,$25.56,0.00,0.00%,1704209294.00,United States,,198,Finance,Major Banks +BPRE,Bluerock Private Real Estate Fund Common Shares of Beneficial Interest,$16.04,0.11,0.691%,0.00,,2025,941404,, +BPRN,Princeton Bancorp Inc. Common Stock (PA),$36.27,-0.98,-2.631%,245288896.00,United States,,12079,Finance,Major Banks +BPYPM,Brookfield Property Partners L.P. 6.25% Class A Cumulative Redeemable Preferred Units Series 1,$15.81,-0.0099,-0.063%,16435766915.00,Bermuda,,16144,Finance,Real Estate +BPYPN,Brookfield Property Partners L.P. 5.750% Class A Cumulative Redeemable Perpetual Preferred Units Series 3,$13.775,-0.005,-0.036%,14320220699.00,Bermuda,,18956,Finance,Real Estate +BPYPO,Brookfield Property Partners L.P. 6.375% Class A Cumulative Redeemable Perpetual Preferred Units Series 2,$15.08,0.0186,0.123%,15676873186.00,Bermuda,,14454,Finance,Real Estate +BPYPP,Brookfield Property Partners L.P. 6.50% Class A Cumulative Redeemable Perpetual Preferred Units,$15.51,0.085,0.551%,16123892780.00,Bermuda,,12994,Finance,Real Estate +BQ,Boqii Holding Limited Class A Ordinary Shares,$1.71,0.005,0.293%,4770380.00,,2025,90112,Consumer Discretionary,Other Specialty Stores +BR,Broadridge Financial Solutions Inc. Common Stock,$204.89,-1.53,-0.741%,23916309564.00,United States,,758352,Real Estate,Real Estate +BRAG,Bragg Gaming Group Inc. Common Shares,$2.20,-0.03,-1.345%,55988852.00,Canada,,2622,Technology,Office Equipment/Supplies/Services +BRBI,BRBI BR Partners S.A. ADSs,$15.38,-0.24,-1.536%,771100077.00,Brazil,,4499,Finance,Finance: Consumer Services +BRBR,BellRing Brands Inc. Common Stock ,$24.78,-1.29,-4.948%,2965474142.00,United States,2022,3889239,Consumer Staples,Packaged Foods +BRBS,Blue Ridge Bankshares Inc. Common Stock,$4.28,0.00,0.00%,391571469.00,United States,,168798,Finance,Major Banks +BRC,Brady Corporation Common Stock,$85.16,0.58,0.686%,4017569816.00,United States,,151784,Consumer Discretionary,Miscellaneous manufacturing industries +BRCB,Black Rock Coffee Bar Inc. Class A Common Stock,$15.80,-0.98,-5.84%,790881751.00,United States,2025,399476,Consumer Discretionary,Restaurants +BRCC,BRC Inc. Class A Common Stock,$0.8186,-0.0618,-7.02%,203422002.00,United States,2022,1008836,Consumer Staples,Beverages (Production/Distribution) +BRFH,Barfresh Food Group Inc. Common Stock,$3.21,-0.04,-1.231%,51261392.00,United States,,2723,Consumer Staples,Packaged Foods +BRIA,BrilliA Inc Class A Ordinary Shares,$1.935,0.025,1.309%,59259375.00,,2024,4827,Consumer Discretionary,Apparel +BRID,Bridgford Foods Corporation Common Stock,$8.09,0.31,3.985%,73431571.00,United States,,6345,Consumer Staples,Specialty Foods +BRK/A,Berkshire Hathaway Inc.,$709500.00,-3500.00,-0.491%,1043585103000.00,United States,,392,, +BRK/B,Berkshire Hathaway Inc.,$473.49,-1.18,-0.249%,1044666371055.00,United States,,4563944,, +BRKR,Bruker Corporation Common Stock,$46.55,-1.12,-2.349%,7072860253.00,United States,,2181944,Industrials,Biotechnology: Laboratory Analytical Instruments +BRKRP,Bruker Corporation 6.375% Mandatory Convertible Preferred Stock Series A,$361.49,-9.41,-2.537%,54925204145.00,United States,,426,Industrials,Biotechnology: Laboratory Analytical Instruments +BRLS,Borealis Foods Inc. Class A Common Shares,$1.01,-0.09,-8.182%,21677939.00,Canada,2021,16857,Consumer Staples,Packaged Foods +BRLSW,Borealis Foods Inc. Warrant,$0.0475,0.00,0.00%,1019507.00,Canada,2021,1600,Consumer Staples,Packaged Foods +BRLT,Brilliant Earth Group Inc. Class A Common Stock,$1.62,0.04,2.532%,162182300.00,United States,2021,77047,Consumer Discretionary,Consumer Specialties +BRN,Barnwell Industries Inc. Common Stock,$1.14,-0.03,-2.564%,14293393.00,United States,1965,228140,Energy,Oil & Gas Production +BRNS,Barinthus Biotherapeutics plc American Depositary Shares,$0.7379,-0.0001,-0.014%,30128717.00,United Kingdom,2021,20500,Health Care,Biotechnology: Pharmaceutical Preparations +BRO,Brown & Brown Inc. Common Stock,$72.10,-2.02,-2.725%,24616438959.00,United States,,3600024,Finance,Specialty Insurers +BROS,Dutch Bros Inc. Class A Common Stock,$57.44,-0.38,-0.657%,9450151492.00,United States,2021,7874959,Consumer Discretionary,Restaurants +BRR,ProCap Financial Inc. Common Stock,$3.02,-0.05,-1.629%,257203144.00,United States,2025,184279,Finance,Finance: Consumer Services +BRRWW,ProCap Financial Inc. Warrant,$0.58,-0.03,-4.918%,49396630.00,United States,2025,26663,Finance,Finance: Consumer Services +BRSL,Brightstar Lottery PLC Trading under the Legal Name to begin at the market open on July 21 2025. Ordinary Shares,$13.94,-0.28,-1.969%,2816320992.00,United States,2015,1281663,Consumer Discretionary,Services-Misc. Amusement & Recreation +BRSP,BrightSpire Capital Inc. Class A Common Stock,$6.00,0.04,0.671%,778397574.00,United States,2018,1186923,Real Estate,Real Estate Investment Trusts +BRT,BRT Apartments Corp. (MD) Common Stock,$14.35,-0.40,-2.712%,272942654.00,United States,,53150,Real Estate,Real Estate Investment Trusts +BRTX,BioRestorative Therapies Inc. Common Stock (NV),$1.14,0.04,3.636%,10118916.00,United States,,25146,Health Care,Managed Health Care +BRW,Saba Capital Income & Opportunities Fund SBI,$6.80,-0.06,-0.875%,0.00,United States,,406271,Finance,Trusts Except Educational Religious and Charitable +BRX,Brixmor Property Group Inc. Common Stock,$26.02,-0.32,-1.215%,7964722260.00,United States,2013,2720006,Real Estate,Real Estate Investment Trusts +BRZE,Braze Inc. Class A Common Stock,$23.77,-0.60,-2.462%,2667362387.00,United States,2021,2054593,Technology,Computer Software: Prepackaged Software +BSAA,BEST SPAC I Acquisition Corp. Class A Ordinary Shares,$10.20,0.02,0.196%,,Hong Kong,2025,100,Finance,Blank Checks +BSAAR,BEST SPAC I Acquisition Corp. Rights,$0.167,-0.003,-1.765%,0.00,Hong Kong,2025,100,Finance,Blank Checks +BSAC,Banco Santander - Chile ADS,$36.81,-0.12,-0.325%,17341754819.00,Chile,,289220,Finance,Commercial Banks +BSBK,Bogota Financial Corp. Common Stock,$8.54,-0.08,-0.928%,110752672.00,United States,2020,1400,Finance,Banks +BSBR,Banco Santander Brasil SA American Depositary Shares each representing one unit,$7.20,0.10,1.408%,53709321074.00,Brazil,2009,1945965,Finance,Commercial Banks +BSET,Bassett Furniture Industries Incorporated Common Stock,$15.27,-0.39,-2.49%,132630792.00,United States,,14581,Consumer Discretionary,Home Furnishings +BSL,Blackstone Senior Floating Rate 2027 Term Fund Common Shares of Beneficial Interest,$13.52,-0.01,-0.074%,0.00,United States,2010,34269,Finance,Trusts Except Educational Religious and Charitable +BSM,Black Stone Minerals L.P. Common units representing limited partner interests,$14.99,0.24,1.627%,3396338729.00,United States,2015,602035,Energy,Oil & Gas Production +BSRR,Sierra Bancorp Common Stock,$33.21,-0.50,-1.483%,447752430.00,United States,,79225,Finance,Major Banks +BST,BlackRock Science and Technology Trust Common Shares of Beneficial Interest,$41.20,0.17,0.414%,912902596.00,United States,2014,73412,Finance,Finance Companies +BSTZ,BlackRock Science and Technology Term Trust Common Shares of Beneficial Interest,$22.90,0.18,0.792%,507414307.00,United States,2019,178546,Finance,Trusts Except Educational Religious and Charitable +BSVN,Bank7 Corp. Common stock,$43.84,0.09,0.206%,414436618.00,United States,2018,20145,Finance,Major Banks +BSX,Boston Scientific Corporation Common Stock,$93.79,0.18,0.192%,139038238838.00,United States,,8507214,Health Care,Medical/Dental Instruments +BSY,Bentley Systems Incorporated Class B Common Stock,$37.35,0.19,0.511%,11337856490.00,United States,2020,1747067,Technology,Computer Software: Prepackaged Software +BTA,BlackRock Long-Term Municipal Advantage Trust Common Shares of Beneficial Interest,$9.49,0.02,0.211%,0.00,United States,2006,19561,Finance,Trusts Except Educational Religious and Charitable +BTAI,BioXcel Therapeutics Inc. Common Stock,$1.68,-0.09,-5.085%,36740745.00,United States,2018,363312,Health Care,Biotechnology: Pharmaceutical Preparations +BTBD,BT Brands Inc. Common Stock,$1.40,-0.09,-6.04%,10982600.00,United States,2021,54786,Consumer Discretionary,Restaurants +BTBT,Bit Digital Inc. Ordinary Shares,$2.16,-0.06,-2.703%,699137635.00,United States,2018,28485232,Finance,Finance: Consumer Services +BTCS,BTCS Inc. Common Stock,$2.65,-0.09,-3.285%,126809862.00,United States,,501883,Finance,Finance: Consumer Services +BTCT,BTC Digital Ltd. Ordinary Shares,$1.49,-0.01,-0.667%,9586720.00,China,,51040,Real Estate,Other Consumer Services +BTDR,Bitdeer Technologies Group Class A Ordinary Shares,$13.97,-0.42,-2.919%,2748543702.00,Singapore,,4515770,Finance,Finance: Consumer Services +BTE,Baytex Energy Corp Common Shares,$3.45,0.04,1.173%,2650693650.00,Canada,2023,23740224,Energy,Oil & Gas Production +BTG,B2Gold Corp Common shares (Canada),$5.77,0.24,4.34%,7674871512.00,Canada,,55914372,Basic Materials,Precious Metals +BTGO,BitGo Holdings Inc. Class A Common Stock,$13.06,-0.71,-5.156%,1509709789.00,,2026,1445918,Finance,Finance: Consumer Services +BTI,British American Tobacco Industries p.l.c. Common Stock ADR,$60.16,-0.18,-0.298%,131259799652.00,United Kingdom,1998,4832717,Health Care, Medicinal Chemicals and Botanical Products +BTM,Bitcoin Depot Inc. Class A Common Stock,$1.10,-0.01,-0.901%,80676277.00,United States,2022,651506,Finance,Finance: Consumer Services +BTMD,Biote Corp. Class A Common Stock,$2.07,-0.11,-5.046%,94521644.00,United States,,99441,Health Care, Medicinal Chemicals and Botanical Products +BTMWW,Bitcoin Depot Inc. Warrant,$0.074,0.0044,6.322%,5427313.00,United States,2022,20657,Finance,Finance: Consumer Services +BTO,John Hancock Financial Opportunities Fund Common Stock,$36.86,-0.14,-0.378%,0.00,United States,1994,43640,Finance,Investment Managers +BTOC,Armlogi Holding Corp. Common Stock,$0.5081,-0.0118,-2.27%,23089628.00,United States,2024,14976,Consumer Discretionary,Office Equipment/Supplies/Services +BTOG,Bit Origin Limited Class A Ordinary Shares,$4.00,0.11,2.828%,5907368.00,United States,2019,62080,Finance,Finance: Consumer Services +BTQ,BTQ Technologies Corp. Common Stock,$3.97,-0.09,-2.217%,555902942.00,Canada,,3284439,, +BTSG,BrightSpring Health Services Inc. Common Stock,$39.55,0.50,1.28%,7132933346.00,United States,2024,1241278,Health Care,Medical/Nursing Services +BTSGU,BrightSpring Health Services Inc. Tangible Equity Unit,$130.9569,1.0069,0.775%,23618377723.00,United States,2024,2734,Health Care,Medical/Nursing Services +BTT,BlackRock Municipal 2030 Target Term Trust,$22.74,0.02,0.088%,0.00,United States,2012,69701,Finance,Investment Managers +BTTC,Black Titan Corporation Ordinary Shares,$1.95,-0.16,-7.583%,2593956.00,Malaysia,,198829,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +BTU,Peabody Energy Corporation Common Stock ,$35.18,-0.91,-2.521%,4277888000.00,United States,2017,3062174,Energy,Coal Mining +BTX,BlackRock Technology and Private Equity Term Trust Common Shares of Beneficial Interest,$6.85,0.06,0.884%,1615203792.00,United States,2021,814318,, +BTZ,BlackRock Credit Allocation Income Trust,$10.60,-0.02,-0.188%,1146231000.00,United States,2006,209045,Finance,Finance Companies +BUD,Anheuser-Busch Inbev SA Sponsored ADR (Belgium),$69.82,-0.43,-0.612%,125480400876.00,Belgium,,1850986,Consumer Staples,Beverages (Production/Distribution) +BUDA,Buda Juice Inc. Common Stock,$10.09,0.33,3.381%,127806670.00,,2026,9828,Consumer Staples,Beverages (Production/Distribution) +BUI,BlackRock Utility Infrastructure & Power Opportunities Trust,$27.39,0.20,0.736%,0.00,United States,2011,98799,Finance,Trusts Except Educational Religious and Charitable +BULL,Webull Corporation Class A Ordinary Shares,$7.63,-0.01,-0.131%,3837293265.00,United States,,8160104,Finance,Investment Bankers/Brokers/Service +BULLW,Webull Corporation Warrants,$2.71,0.13,5.039%,1362918054.00,United States,,2106,Finance,Investment Bankers/Brokers/Service +BUR,Burford Capital Limited Ordinary Shares,$9.48,-0.33,-3.364%,2074333883.00,,2020,1379181,Finance,Finance: Consumer Services +BURL,Burlington Stores Inc. Common Stock,$288.66,-1.24,-0.428%,18164509552.00,United States,2013,819787,Consumer Discretionary,Department/Specialty Retail Stores +BURU,Nuburu Inc. Common Stock,$0.184,0.0063,3.545%,80589671.00,United States,,22582501,Miscellaneous,Industrial Machinery/Components +BUSE,First Busey Corporation Class A Common Stock,$24.39,-0.66,-2.635%,2156296559.00,United States,,1307543,Finance,Major Banks +BUSEP,First Busey Corporation Depositary Shares Each Representing a 1/40thInterest in a Share of 8.25% Fixed-Rate Series B Non-Cumulative Perpetual Preferred Stock $0.001 par value,$26.3005,-0.2395,-0.902%,2325202035.00,United States,,22982,Finance,Major Banks +BUUU,BUUU Group Limited Class A Ordinary Share,$8.60,-0.09,-1.036%,143405000.00,Hong Kong,2025,57974,Consumer Discretionary,Services-Misc. Amusement & Recreation +BV,BrightView Holdings Inc. Common Stock,$13.12,-0.06,-0.455%,1239724715.00,United States,2018,417841,Real Estate,Real Estate +BVC,BitVentures Limited Ordinary Shares,$9.17,0.18,2.002%,1540560000.00,China,2021,3380,, +BVFL,BV Financial Inc. Common Stock,$18.60,-0.16,-0.853%,165613042.00,United States,2023,9687,Finance,Savings Institutions +BVN,Buenaventura Mining Company Inc.,$39.01,0.84,2.201%,9908027682.00,Peru,1996,1868877,Basic Materials,Metal Mining +BVS,Bioventus Inc. Class A Common Stock,$7.76,-0.16,-2.02%,642242541.00,United States,2021,173894,Health Care,Medical/Dental Instruments +BW,Babcock & Wilcox Enterprises Inc. Common Stock,$10.48,-0.08,-0.758%,1164329048.00,United States,2015,3108389,Industrials,Building Products +BW^A,Babcock & Wilcox Enterprises Inc. 7.75% Series A Cumulative Perpetual Preferred Stock,$20.34,-0.01,-0.049%,,United States,,19500,, +BWA,BorgWarner Inc. Common Stock,$48.28,-0.15,-0.31%,10328449199.00,United States,,1403633,Consumer Discretionary,Auto Parts:O.E.M. +BWAY,BrainsWay Ltd. American Depositary Shares,$24.71,-0.90,-3.514%,466258624.00,Israel,2019,133441,Health Care,Medical/Dental Instruments +BWB,Bridgewater Bancshares Inc. Common Stock,$18.77,0.31,1.679%,517765420.00,United States,2018,150321,Finance,Major Banks +BWBBP,Bridgewater Bancshares Inc. Depositary Shares Each Representing a 1/100th Interest in a Share of 5.875% Non-Cumulative Perpetual Preferred Stock Series A,$19.45,0.025,0.129%,536523037.00,United States,,2854,Finance,Major Banks +BWEN,Broadwind Inc. Common Stock,$3.19,-0.05,-1.543%,74011152.00,United States,,116564,Telecommunications,Metal Fabrications +BWFG,Bankwell Financial Group Inc. Common Stock,$46.99,-0.76,-1.592%,370161047.00,United States,2014,23390,Finance,Major Banks +BWG,BrandywineGLOBAL Global Income Opportunities Fund Inc.,$8.56,0.06,0.706%,0.00,United States,2012,115511,Finance,Finance/Investors Services +BWIN,The Baldwin Insurance Group Inc. Class A Common Stock,$22.82,-1.22,-5.075%,3253746023.00,United States,2019,1561805,Finance,Specialty Insurers +BWLP,BW LPG Limited Common Shares,$15.33,0.59,4.003%,2323084331.00,,2024,339436,Consumer Discretionary,Transportation Services +BWMN,Bowman Consulting Group Ltd. Common Stock,$33.67,-1.17,-3.358%,584953253.00,United States,2021,111397,Consumer Discretionary,Professional Services +BWMX,Betterware de Mexico S.A.P.I. de C.V. Ordinary Shares,$18.49,0.04,0.217%,689982936.00,Mexico,,150384,Consumer Discretionary,Catalog/Specialty Distribution +BWNB,Babcock & Wilcox Enterprises Inc. 6.50% Senior Notes due 2026,$24.80,-0.0775,-0.312%,2507219042.00,United States,2021,11842,Industrials,Building Products +BWXT,BWX Technologies Inc. Common Stock,$216.30,3.90,1.836%,19775604727.00,United States,,1324639,Industrials,Industrial Machinery/Components +BX,Blackstone Inc. Common Stock,$146.79,-1.62,-1.092%,108397203354.00,United States,2007,4658665,Finance,Investment Managers +BXC,Bluelinx Holdings Inc. Common Stock,$68.65,-0.69,-0.995%,539936232.00,United States,2004,66106,Consumer Discretionary,Wholesale Distributors +BXMT,Blackstone Mortgage Trust Inc. Common Stock,$19.27,-0.07,-0.362%,3232036316.00,United States,,1190834,Real Estate,Real Estate Investment Trusts +BXMX,Nuveen S&P 500 Buy-Write Income Fund Common Shares of Beneficial Interest,$14.76,0.01,0.068%,0.00,United States,,129073,Finance,Investment Managers +BXP,BXP Inc. Common Stock,$64.15,-1.07,-1.641%,10165766143.00,United States,1997,4016846,Real Estate,Real Estate Investment Trusts +BXSL,Blackstone Secured Lending Fund Common Shares of Beneficial Interest,$26.04,-0.22,-0.838%,0.00,,2021,1261068,Finance,Trusts Except Educational Religious and Charitable +BY,Byline Bancorp Inc. Common Stock,$30.99,-0.89,-2.792%,1423010193.00,United States,2017,203156,Finance,Major Banks +BYAH,Park Ha Biological Technology Co. Ltd. Ordinary Shares,$0.125,0.014,12.613%,4234300.00,China,2024,88658429,Consumer Discretionary,Package Goods/Cosmetics +BYD,Boyd Gaming Corporation Common Stock,$83.50,1.27,1.544%,6523223991.00,United States,1993,1253661,Consumer Discretionary,Hotels/Resorts +BYFC,Broadway Financial Corporation Class A Common Stock,$8.2401,-0.2024,-2.397%,75650380.00,United States,,628,Finance,Savings Institutions +BYM,Blackrock Municipal Income Quality Trust Common Shares of Beneficial Interest,$11.07,0.04,0.363%,0.00,United States,2002,55470,Finance,Investment Managers +BYND,Beyond Meat Inc. Common Stock,$0.83,-0.0201,-2.364%,376557087.00,United States,2019,51553055,Consumer Staples,Packaged Foods +BYRN,Byrna Technologies Inc. Common Stock,$14.60,-0.66,-4.325%,331792519.00,United States,,507215,Miscellaneous,Industrial Machinery/Components +BYSI,BeyondSpring Inc. Ordinary Shares,$1.55,-0.06,-3.727%,62515096.00,United States,2017,34201,Health Care,Biotechnology: Pharmaceutical Preparations +BZ,KANZHUN LIMITED American Depository Shares,$18.83,-0.45,-2.334%,8186073287.00,China,2021,2567609,Technology,Computer Software: Programming Data Processing +BZAI,Blaize Holdings Inc. Common Stock,$1.75,-0.27,-13.366%,213575373.00,United States,2025,5965913,Finance,Blank Checks +BZAIW,Blaize Holdings Inc. Warrants,$0.4318,-0.006,-1.37%,52698198.00,United States,2025,39287,Finance,Blank Checks +BZFD,BuzzFeed Inc. Class A Common Stock,$0.9032,-0.0257,-2.767%,33606152.00,United States,2021,166907,Consumer Discretionary,Telecommunications Equipment +BZFDW,BuzzFeed Inc. Warrant,$0.0179,-0.0007,-3.763%,666021.00,United States,2021,2113,Consumer Discretionary,Telecommunications Equipment +BZH,Beazer Homes USA Inc. Common Stock,$23.58,0.28,1.202%,701739621.00,United States,1994,534675,Consumer Discretionary,Homebuilding +BZUN,Baozun Inc. American Depositary Shares,$2.88,0.05,1.767%,166313229.00,China,2015,271345,Consumer Discretionary,Catalog/Specialty Distribution +C,Citigroup Inc. Common Stock,$114.20,-0.59,-0.514%,204334195358.00,United States,,11378325,Finance,Major Banks +C^N,Citigroup Capital XIII 7.875% Fixed rate Floating Rate trust Preferred Securities (TruPS),$30.68,0.12,0.393%,,United States,,102601,, +CAAP,Corporacion America Airports SA Common Shares,$29.12,0.05,0.172%,4690951924.00,,2018,333232,Consumer Discretionary,Aerospace +CAAS,China Automotive Systems Inc. Ordinary Share,$4.45,-0.13,-2.838%,134259624.00,China,,9486,Consumer Discretionary,Auto Parts:O.E.M. +CABA,Cabaletta Bio Inc. Common Stock,$2.85,-0.17,-5.629%,274355831.00,United States,2019,3129420,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CABO,Cable One Inc. Common Stock,$72.84,-2.46,-3.267%,410466293.00,United States,2015,257452,Telecommunications,Cable & Other Pay Television Services +CABR,Caring Brands Inc. Common Stock,$0.8003,-0.0297,-3.578%,10993661.00,United States,,75003,Consumer Discretionary,Package Goods/Cosmetics +CAC,Camden National Corporation Common Stock,$45.67,-1.71,-3.609%,772838016.00,United States,,183948,Finance,Major Banks +CACC,Credit Acceptance Corporation Common Stock,$433.43,-4.29,-0.98%,4781402116.00,United States,1992,142424,Finance,Finance: Consumer Services +CACI,CACI International Inc. Class A Common Stock,$638.24,-4.97,-0.773%,14096024398.00,United States,,219326,Technology,EDP Services +CADE,Cadence Bank Common Stock,$42.21,-0.94,-2.178%,7708432199.00,United States,,3405550,Finance,Major Banks +CADE^A,Cadence Bank 5.50% Series A ,$21.35,-0.1501,-0.698%,,United States,,16341,, +CADL,Candel Therapeutics Inc. Common Stock,$5.74,-0.36,-5.902%,315116259.00,United States,2021,600616,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CAE,CAE Inc. Ordinary Shares,$33.44,-0.48,-1.415%,10752569367.00,Canada,,592993,Miscellaneous,Industrial Machinery/Components +CAEP,Cantor Equity Partners III Inc. Class A Ordinary Shares,$10.24,0.005,0.049%,0.00,United States,2025,4847,, +CAF,Morgan Stanley China A Share Fund Inc. Common Stock,$18.58,0.14,0.759%,0.00,United States,2006,41893,Finance,Investment Managers +CAG,ConAgra Brands Inc. Common Stock,$17.68,-0.27,-1.504%,8457572318.00,United States,,11013803,Consumer Staples,Packaged Foods +CAH,Cardinal Health Inc. Common Stock,$210.39,-3.65,-1.705%,49987620886.00,United States,,1507957,Health Care,Other Pharmaceuticals +CAI,Caris Life Sciences Inc. Common Stock,$26.50,0.49,1.884%,7476893460.00,United States,2025,3114918,Health Care,Medical Specialities +CAKE,Cheesecake Factory Incorporated (The) Common Stock,$57.88,0.80,1.402%,2884837017.00,United States,1992,964528,Consumer Discretionary,Restaurants +CAL,Caleres Inc. Common Stock,$12.30,-0.38,-2.997%,416915413.00,United States,,623106,Consumer Discretionary,Shoe Manufacturing +CALC,CalciMedica Inc. Common Stock,$1.25,-3.87,-75.586%,18011789.00,United States,2023,45558466,Health Care,Biotechnology: Pharmaceutical Preparations +CALM,Cal-Maine Foods Inc. Common Stock,$81.40,-1.371,-1.656%,3879039344.00,United States,1996,1643957,Consumer Staples,Farming/Seeds/Milling +CALX,Calix Inc Common Stock,$52.96,-3.02,-5.395%,3510002010.00,United States,2010,1394618,Consumer Discretionary,Telecommunications Equipment +CALY,Callaway Golf Company Common Stock,$14.79,-0.21,-1.40%,2719638991.00,United States,,2707921,Consumer Discretionary,Recreational Games/Products/Toys +CAMP,CAMP4 Therapeutics Corporation Common Stock,$4.00,0.17,4.439%,292783896.00,United States,2024,39541,, +CAMT,Camtek Ltd. Ordinary Shares,$150.17,2.39,1.617%,6846922161.00,Israel,2000,328168,Technology,Electronic Components +CAN,Canaan Inc. American Depositary Shares,$0.7151,-0.0014,-0.195%,300530471.00,China,2019,8653252,Technology,Semiconductors +CANF,Can-Fite Biopharma Ltd American Depositary Shares each representing two (2) Ordinary Shares,$4.43,-0.04,-0.895%,8853077226.00,Israel,,15873,Health Care,Biotechnology: Pharmaceutical Preparations +CANG,Cango Inc. Class A Ordinary Shares,$1.33,-0.04,-2.92%,138038192.00,China,2025,585646,Technology,Computer Software: Prepackaged Software +CAPL,CrossAmerica Partners LP Common Units representing limited partner interests,$22.56,-0.05,-0.221%,859998051.00,United States,2012,34400,Energy,Oil Refining/Marketing +CAPN,Cayson Acquisition Corp Ordinary shares,$10.75,0.03,0.28%,0.00,United States,2024,7627,, +CAPNR,Cayson Acquisition Corp Right,$0.22,0.00,0.00%,0.00,United States,2024,35,Finance,Blank Checks +CAPR,Capricor Therapeutics Inc. Common Stock,$21.57,-1.95,-8.291%,1115535151.00,United States,,1748216,Health Care,Biotechnology: Pharmaceutical Preparations +CAPS,Capstone Holding Corp. Common Stock,$0.6687,-0.0248,-3.576%,5554359.00,United States,,186594,Consumer Discretionary,RETAIL: Building Materials +CAPT,Captivision Inc. Ordinary Shares,$0.5823,0.0123,2.158%,18848767.00,United Kingdom,,2610234,Miscellaneous,Industrial Machinery/Components +CAPTW,Captivision Inc. Warrant,$0.0474,-0.0024,-4.819%,1534315.00,United Kingdom,,143328,Miscellaneous,Industrial Machinery/Components +CAR,Avis Budget Group Inc. Common Stock,$115.10,-2.42,-2.059%,4051173779.00,United States,,292583,Consumer Discretionary,Rental/Leasing Companies +CARE,Carter Bankshares Inc. Common Stock,$19.92,-0.22,-1.092%,439973916.00,United States,,92366,Finance,Major Banks +CARG,CarGurus Inc. Class A Common Stock ,$33.42,-0.51,-1.503%,3190046078.00,United States,2017,575358,Technology,EDP Services +CARL,Carlsmed Inc. Common Stock,$12.84,-0.62,-4.606%,341452939.00,United States,2025,62928,Health Care,Medical/Dental Instruments +CARR,Carrier Global Corporation Common Stock ,$57.91,0.84,1.472%,48772368418.00,United States,2020,16514326,Industrials,Industrial Machinery/Components +CARS,Cars.com Inc. Common Stock ,$11.66,0.00,0.00%,697422705.00,United States,2017,552988,Technology,EDP Services +CART,Maplebear Inc. Common Stock,$37.82,-0.14,-0.369%,9928996698.00,United States,2023,3826410,Real Estate,Real Estate +CASH,Pathward Financial Inc. Common Stock,$85.71,-0.59,-0.684%,1900150845.00,United States,1993,239979,Finance,Major Banks +CASI,CASI Pharmaceuticals Inc. Ordinary Shares,$1.00,-0.035,-3.382%,15492681.00,China,,3916,Health Care,Biotechnology: Pharmaceutical Preparations +CASS,Cass Information Systems Inc Common Stock,$43.06,-1.42,-3.192%,563409054.00,United States,,76200,Real Estate,Real Estate +CASY,Casey's General Stores Inc. Common Stock,$615.29,-1.75,-0.284%,22806913206.00,United States,1983,195339,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CAT,Caterpillar Inc. Common Stock,$643.28,4.37,0.684%,301041914515.00,United States,,2720670,Industrials,Construction/Ag Equipment/Trucks +CATO,Cato Corporation (The) Class A Common Stock,$3.22,-0.12,-3.593%,63590511.00,United States,,25074,Consumer Discretionary,Clothing/Shoe/Accessory Stores +CATX,Perspective Therapeutics Inc. Common Stock,$2.56,-0.14,-5.185%,190305254.00,United States,,499151,Health Care,Medical/Dental Instruments +CATY,Cathay General Bancorp Common Stock,$49.98,-0.49,-0.971%,3400469968.00,United States,,388712,Finance,Major Banks +CAVA,CAVA Group Inc. Common Stock,$62.70,0.37,0.594%,7272329724.00,United States,2023,2746805,Consumer Discretionary,Restaurants +CB,Chubb Limited Common Stock,$303.65,2.18,0.723%,119501718335.00,Switzerland,,1188687,Finance,Property-Casualty Insurers +CBAN,Colony Bankcorp Inc. Common Stock,$18.56,0.05,0.27%,323586770.00,United States,,77966,Finance,Major Banks +CBAT,CBAK Energy Technology Inc. Common Stock,$0.814,-0.0168,-2.022%,72157711.00,China,,120144,Miscellaneous,Industrial Machinery/Components +CBC,Central Bancompany Inc. Class A Common Stock,$24.06,-0.44,-1.796%,5736936174.00,United States,,86206,, +CBFV,CB Financial Services Inc. Common Stock,$34.67,-0.78,-2.20%,173727314.00,United States,,4773,Finance,Major Banks +CBIO,Crescent Biopharma Inc. Common Stock,$10.73,-0.54,-4.791%,295684110.00,United States,2014,227667,Health Care,Biotechnology: Pharmaceutical Preparations +CBK,Commercial Bancgroup Inc. Common Stock,$25.41,0.08,0.316%,311009354.00,United States,2025,54668,Finance,Major Banks +CBL,CBL & Associates Properties Inc. Common Stock,$34.16,-1.01,-2.872%,1048118231.00,United States,2021,150130,Real Estate,Real Estate Investment Trusts +CBLL,CeriBell Inc. Common Stock,$20.55,-1.34,-6.122%,762316430.00,United States,2024,380982,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +CBNA,Chain Bridge Bancorp Inc. Class A Common Stock,$33.15,-0.56,-1.661%,217524234.00,,2024,2674,Finance,Major Banks +CBNK,Capital Bancorp Inc. Common Stock,$30.00,0.00,0.00%,495625890.00,United States,2018,66004,Finance,Major Banks +CBOE,Cboe Global Markets Inc. Common Stock,$264.60,-3.44,-1.283%,29587241250.00,,2010,565032,Finance,Investment Bankers/Brokers/Service +CBRE,CBRE Group Inc Common Stock Class A,$169.50,0.11,0.065%,50442012992.00,United States,,868813,Finance,Real Estate +CBRL,Cracker Barrel Old Country Store Inc Common Stock,$29.43,-0.78,-2.582%,657115836.00,United States,1981,1525868,Consumer Discretionary,Restaurants +CBSH,Commerce Bancshares Inc. Common Stock,$52.66,0.57,1.094%,7321604901.00,United States,,1761514,Finance,Major Banks +CBT,Cabot Corporation Common Stock,$71.49,-0.07,-0.098%,3733322470.00,United States,,555007,Industrials,Major Chemicals +CBU,Community Financial System Inc. Common Stock,$61.08,-0.38,-0.618%,3216563748.00,United States,,230603,Finance,Major Banks +CBUS,Cibus Inc. Class A Common Stock,$1.76,-0.04,-2.222%,95538275.00,United States,2017,280647,Industrials,Agricultural Chemicals +CBZ,CBIZ Inc. Common Stock,$38.55,-1.17,-2.946%,2097174895.00,United States,,1204183,Real Estate,Real Estate +CC,Chemours Company (The) Common Stock,$15.11,-0.52,-3.327%,2264867395.00,United States,2015,3063303,Industrials,Major Chemicals +CCAP,Crescent Capital BDC Inc. Common stock,$14.18,-0.36,-2.476%,524553976.00,United States,,139737,Finance,Finance: Consumer Services +CCB,Coastal Financial Corporation Common Stock,$100.95,-3.63,-3.471%,1526491500.00,United States,2018,153715,Finance,Major Banks +CCBG,Capital City Bank Group Common Stock,$40.17,-2.19,-5.17%,685654700.00,United States,,164686,Finance,Major Banks +CCC,CCC Intelligent Solutions Holdings Inc. Common Stock,$7.91,0.12,1.54%,5078375479.00,United States,,10251908,Technology,Computer Software: Prepackaged Software +CCCC,C4 Therapeutics Inc. Common Stock,$2.03,-0.11,-5.14%,301638762.00,United States,2020,1010214,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CCCX,Churchill Capital Corp X Class A Ordinary Shares,$16.36,-0.57,-3.367%,0.00,United States,2025,1297281,Finance,Blank Checks +CCCXU,Churchill Capital Corp X Unit,$18.60,0.00,0.00%,0.00,United States,2025,117,Finance,Blank Checks +CCCXW,Churchill Capital Corp X Warrants,$8.03,-0.09,-1.108%,0.00,United States,2025,49506,Finance,Blank Checks +CCD,Calamos Dynamic Convertible & Income Fund Common Stock,$22.85,0.11,0.484%,0.00,United States,,121871,Finance,Trusts Except Educational Religious and Charitable +CCEC,Capital Clean Energy Carriers Corp. Common Share,$21.58,0.08,0.372%,1267119615.00,Greece,2007,3024,Consumer Discretionary,Marine Transportation +CCEL,Cryo-Cell International Inc. Common Stock,$3.43,-0.03,-0.867%,27629165.00,United States,2022,10343,Health Care,Misc Health and Biotechnology Services +CCEP,Coca-Cola Europacific Partners plc Ordinary Shares,$91.03,0.26,0.286%,41326020876.00,United Kingdom,,1211826,Consumer Staples,Beverages (Production/Distribution) +CCG,Cheche Group Inc. Class A Ordinary Shares,$0.835,0.00,0.00%,67446911.00,China,,109611,Finance,Specialty Insurers +CCHH,CCH Holdings Ltd Ordinary Shares,$0.4908,-0.0007,-0.142%,9447900.00,Malaysia,2025,259945,Consumer Discretionary,Restaurants +CCI,Crown Castle Inc. Common Stock,$84.89,-1.86,-2.144%,36967813159.00,United States,,2277061,Real Estate,Real Estate Investment Trusts +CCID,Carlyle Credit Income Fund 7.375% Series D Term Preferred Shares due 2028,$25.1798,0.0498,0.198%,0.00,,,8315,, +CCIF,Carlyle Credit Income Fund Shares of Beneficial Interest,$4.67,-0.01,-0.214%,0.00,,2019,88020,Finance,Finance/Investors Services +CCII,Cohen Circle Acquisition Corp. II Class A Ordinary Shares,$10.33,0.03,0.291%,0.00,United States,2025,423505,, +CCIIU,Cohen Circle Acquisition Corp. II Unit,$10.50,0.01,0.095%,0.00,United States,2025,10017,, +CCIIW,Cohen Circle Acquisition Corp. II Warrant,$0.75,0.00,0.00%,0.00,United States,2025,48721,, +CCIX,Churchill Capital Corp IX Ordinary Shares,$10.68,0.00,0.00%,0.00,United States,2024,5572,Technology,EDP Services +CCIXW,Churchill Capital Corp IX Warrant,$0.76,-0.01,-1.299%,0.00,United States,2024,4251,Technology,EDP Services +CCJ,Cameco Corporation Common Stock,$134.09,8.12,6.446%,58383745816.00,Canada,1996,6208112,Basic Materials,Other Metals and Minerals +CCK,Crown Holdings Inc.,$104.23,0.44,0.424%,12022710992.00,United States,,975076,Industrials,Containers/Packaging +CCL,Carnival Corporation Common Stock,$28.72,0.03,0.105%,40931551461.00,United States,1987,19948873,Consumer Discretionary,Marine Transportation +CCLD,CareCloud Inc. Common Stock,$2.87,-0.03,-1.034%,121679502.00,United States,2014,138941,Technology,Computer Software: Prepackaged Software +CCLDO,CareCloud Inc. 8.75% Series B Cumulative Redeemable Perpetual Preferred Stock,$26.20,-0.20,-0.758%,1110802422.00,United States,,7612,Technology,Computer Software: Prepackaged Software +CCM,Concord Medical Services Holdings Limited American Depositary Shares (Each represents thirty (30) Class A ordinary shares),$4.24,0.00,0.00%,18408906.00,China,2024,723,Health Care,Medical/Nursing Services +CCNE,CNB Financial Corporation Common Stock,$26.85,-0.21,-0.776%,791437044.00,United States,,186577,Finance,Major Banks +CCNEP,CNB Financial Corporation Depositary Shares each representing a 1/40th ownership interest in a share of 7.125% Series A Fixed-Rate Non-Cumulative Perpetual Preferred Stock,$25.44,0.245,0.972%,749875546.00,United States,,407,Finance,Major Banks +CCO,Clear Channel Outdoor Holdings Inc. Common Stock,$2.24,0.21,10.345%,1113963614.00,United States,2005,4829523,Consumer Discretionary,Advertising +CCOI,Cogent Communications Holdings Inc.,$23.39,-0.48,-2.011%,1148943909.00,United States,,513840,Consumer Discretionary,Telecommunications Equipment +CCRN,Cross Country Healthcare Inc. Common Stock $0.0001 Par Value,$9.07,-0.15,-1.627%,297132765.00,United States,2001,649667,Consumer Discretionary,Professional Services +CCS,Century Communities Inc. Common Stock,$63.99,0.54,0.851%,1880300653.00,United States,2014,327826,Consumer Discretionary,Homebuilding +CCSI,Consensus Cloud Solutions Inc. Common Stock,$21.60,-0.08,-0.369%,410524740.00,United States,,99216,Technology,Computer Software: Prepackaged Software +CCTG,CCSC Technology International Holdings Limited Class A Ordinary Shares,$0.9804,0.0848,9.469%,3836790.00,Hong Kong,2024,1050852,Consumer Discretionary,Building Products +CCU,Compania Cervecerias Unidas S.A. Common Stock,$14.95,-0.30,-1.967%,1104813581.00,Chile,,168652,Consumer Staples,Beverages (Production/Distribution) +CCXIU,Churchill Capital Corp XI Units,$10.34,0.01,0.097%,0.00,United States,2025,68860,Finance,Blank Checks +CCZ,Comcast Holdings ZONES,$65.00,0.00,0.00%,236853142825.00,United States,,3,Telecommunications,Cable & Other Pay Television Services +CD,Chaince Digital Holdings Inc. Ordinary Shares,$6.20,-0.32,-4.908%,394856691.00,China,2015,83922,Finance,Finance: Consumer Services +CDE,Coeur Mining Inc. Common Stock,$25.62,-0.09,-0.35%,16450770785.00,United States,,33172086,Basic Materials,Precious Metals +CDIO,Cardio Diagnostics Holdings Inc. Common stock,$1.78,-0.06,-3.261%,3250371.00,United States,2022,764331,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +CDIOW,Cardio Diagnostics Holdings Inc. Warrant,$0.0169,0.001,6.289%,30860.00,United States,2022,45148,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +CDLR,Cadeler A/S American Depositary Share (each representing four (4) Ordinary Shares),$25.11,0.67,2.741%,2203136234.00,,2023,221998,Consumer Discretionary,Marine Transportation +CDLX,Cardlytics Inc. Common Stock,$1.03,-0.08,-7.207%,55678244.00,United States,2018,2371288,Technology,Computer Software: Programming Data Processing +CDNA,CareDx Inc. Common Stock,$20.46,-0.12,-0.583%,1052311794.00,United States,2014,436990,Health Care,Medical Specialities +CDNL,Cardinal Infrastructure Group Inc. Class A Common Stock,$25.91,-1.81,-6.53%,948476047.00,United States,2025,211997,Industrials,Military/Government/Technical +CDNS,Cadence Design Systems Inc. Common Stock,$320.49,2.12,0.666%,87237698490.00,United States,,1409699,Technology,Computer Software: Prepackaged Software +CDP,COPT Defense Properties Common Shares of Beneficial Interest,$29.55,-0.79,-2.604%,3345373053.00,United States,,2054706,Real Estate,Real Estate Investment Trusts +CDR^B,Cedar Realty Trust Inc. 7.25% Series B Cumulative Redeemable Preferred Stock,$18.2805,0.0505,0.277%,,United States,,2291,, +CDR^C,Cedar Realty Trust Inc. 6.50% Series C Cumulative Redeemable Preferred Stock,$17.85,-0.18,-0.998%,,United States,,2878,, +CDRE,Cadre Holdings Inc. Common Stock,$40.34,-1.54,-3.677%,1640379467.00,United States,2021,373899,Health Care,Industrial Specialties +CDRO,Codere Online Luxembourg S.A. Ordinary Shares,$8.04,-0.10,-1.229%,366952145.00,Luxembourg,,10404,Consumer Discretionary,Services-Misc. Amusement & Recreation +CDT,CDT Equity Inc. Common Stock,$1.14,0.037,3.354%,1857518.00,United States,2022,87209,Health Care,Biotechnology: Pharmaceutical Preparations +CDTG,CDT Environmental Technology Investment Holdings Limited ordinary shares,$0.34,-0.0173,-4.842%,4190500.00,China,2024,8754,Industrials,Miscellaneous +CDTTW,CDT Equity Inc. Warrant,$0.007,0.00,0.00%,11406.00,United States,2022,10921,Health Care,Biotechnology: Pharmaceutical Preparations +CDW,CDW Corporation Common Stock,$124.72,-0.68,-0.542%,16237753275.00,United States,2013,1326681,Technology,Retail: Computer Software & Peripheral Equipment +CDXS,Codexis Inc. Common Stock,$1.29,-0.14,-9.79%,116518454.00,United States,2010,1708328,Industrials,Major Chemicals +CDZI,CADIZ Inc. Common Stock,$6.09,-0.36,-5.581%,506140381.00,United States,,1204848,Utilities,Water Supply +CDZIP,Cadiz Inc. Depositary Shares,$19.5301,-0.0449,-0.229%,1623148154.00,United States,,4679,Utilities,Water Supply +CE,Celanese Corporation Common Stock,$46.17,-0.69,-1.472%,5055840956.00,United States,2005,1313791,Industrials,Major Chemicals +CECO,CECO Environmental Corp. Common Stock,$69.58,-1.44,-2.028%,2479902937.00,United States,1998,439525,Industrials,Pollution Control Equipment +CEE,The Central and Eastern Europe Fund Inc. (The) Common Stock,$19.04,0.32,1.709%,0.00,United States,,23891,Finance,Finance Companies +CEG,Constellation Energy Corporation Common Stock ,$287.95,-0.81,-0.281%,104340259314.00,United States,,3279684,Utilities,Electric Utilities: Central +CELC,Celcuity Inc. Common Stock,$114.53,-2.72,-2.32%,5299447293.00,United States,2017,1953933,Health Care,Medical Specialities +CELH,Celsius Holdings Inc. Common Stock,$53.91,-1.60,-2.882%,13897205361.00,United States,,2889636,Consumer Staples,Beverages (Production/Distribution) +CELU,Celularity Inc. Class A Common Stock,$1.27,-0.02,-1.55%,36623989.00,United States,2019,21337,Health Care,Biotechnology: Pharmaceutical Preparations +CELUW,Celularity Inc. Warrant,$0.0185,0.0015,8.824%,533499.00,United States,2019,712,Health Care,Biotechnology: Pharmaceutical Preparations +CELZ,Creative Medical Technology Holdings Inc. Common Stock,$2.09,-0.07,-3.241%,7303856.00,United States,,39443,Finance,Finance: Consumer Services +CENN,Cenntro Inc. Common Stock,$0.1478,-0.0067,-4.337%,12993516.00,New Zealand,,3734463,Industrials,Auto Manufacturing +CENT,Central Garden & Pet Company Common Stock,$32.09,0.01,0.031%,2000256536.00,United States,1993,91831,Consumer Discretionary,Consumer Specialties +CENTA,Central Garden & Pet Company Class A Common Stock Nonvoting,$29.08,-0.08,-0.274%,1812635090.00,United States,,246336,Consumer Discretionary,Consumer Specialties +CENX,Century Aluminum Company Common Stock,$49.00,1.18,2.468%,4573756481.00,United States,1996,1677437,Industrials,Aluminum +CEPF,Cantor Equity Partners IV Inc. Class A Ordinary Shares,$10.45,0.00,0.00%,0.00,United States,2025,344416,Finance,Blank Checks +CEPO,Cantor Equity Partners I Inc. Class A Ordinary Shares,$10.455,0.005,0.048%,0.00,United States,2025,9558,Finance,Blank Checks +CEPT,Cantor Equity Partners II Inc. Class A Ordinary Share,$12.44,0.41,3.408%,0.00,United States,2025,756354,Finance,Blank Checks +CEPU,Central Puerto S.A. American Depositary Shares (each represents ten Common Shares),$17.29,-0.21,-1.20%,2617744488.00,,2018,263572,Utilities,Electric Utilities: Central +CEPV,Cantor Equity Partners V Inc. Class A Ordinary Shares,$10.25,-0.01,-0.097%,0.00,United States,2025,32813,, +CERS,Cerus Corporation Common Stock,$2.36,-0.13,-5.221%,453326502.00,United States,1997,1449683,Technology,EDP Services +CERT,Certara Inc. Common Stock,$9.40,-0.28,-2.893%,1497169650.00,United States,2020,2140210,Technology,Computer Software: Prepackaged Software +CET,Central Securities Corporation Common Stock,$52.41,0.46,0.885%,12684540732.00,United States,1951,48584,Finance,Finance/Investors Services +CETX,Cemtrex Inc. Common Stock,$1.78,-0.12,-6.316%,15308983.00,United States,,667522,Technology,Electrical Products +CETY,Clean Energy Technologies Inc. Common Stock,$0.7375,-0.0465,-5.931%,11881776.00,United States,,215426,Consumer Discretionary,Metal Fabrications +CEV,Eaton Vance California Municipal Income Trust Shares of Beneficial Interest,$10.1881,0.0331,0.326%,71658765.00,United States,1999,44712,Finance,Finance/Investors Services +CEVA,CEVA Inc. Common Stock,$22.51,0.04,0.178%,618300291.00,United States,,311724,Technology,Computer Software: Programming Data Processing +CF,CF Industries Holdings Inc. Common Stock,$93.17,1.43,1.559%,14532157581.00,United States,2005,1753602,Industrials,Agricultural Chemicals +CFBK,CF Bankshares Inc. Common Stock,$28.62,-0.29,-1.003%,182225687.00,United States,,23731,Finance,Major Banks +CFFI,C&F Financial Corporation Common Stock,$71.67,-0.29,-0.403%,232084087.00,United States,,4098,Finance,Major Banks +CFFN,Capitol Federal Financial Inc. Common Stock,$7.10,0.16,2.305%,935874466.00,United States,,1901039,Finance,Savings Institutions +CFG,Citizens Financial Group Inc. Common Stock,$62.92,-0.50,-0.788%,27023271138.00,United States,2014,3993671,Finance,Major Banks +CFG^E,Citizens Financial Group Inc. Depositary Shares Each Representing 1/40th Interest in a Share of 5.000% Fixed-Rate Non-Cumulative Perpetual Preferred Stock Series E,$19.9232,-0.0218,-0.109%,,United States,,19468,, +CFG^H,Citizens Financial Group Inc. Depositary Shares Each Representing a 1/40th Interest in a Share of 7.375% Fixed-Rate Non-Cumulative Perpetual Preferred Stock Series H,$26.36,-0.0275,-0.104%,,United States,,16070,, +CFG^I,Citizens Financial Group Inc. Depositary Shares Each Representing a 1/40th Interest in a Share of 6.500% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series I,$25.455,0.015,0.059%,,United States,,24175,, +CFLT,Confluent Inc. Class A Common Stock,$30.53,-0.01,-0.033%,10680083459.00,United States,2021,5850745,Technology,Computer Software: Prepackaged Software +CFND,C1 Fund Inc. Common Stock,$4.93,0.01,0.203%,0.00,,2025,44909,, +CFR,Cullen/Frost Bankers Inc. Common Stock,$135.19,-0.37,-0.273%,8644197444.00,United States,,587281,Finance,Major Banks +CFR^B,Cullen/Frost Bankers Inc. Depositary Shares each representing a 1/40th ownership interest in a share of 4.450% non-cumulative perpetual preferred stock Series B,$17.66,-0.10,-0.563%,,United States,,6553,, +CG,The Carlyle Group Inc. Common Stock,$60.54,0.22,0.365%,21819250822.00,United States,2012,3836046,Finance,Investment Managers +CGABL,The Carlyle Group Inc. 4.625% Subordinated Notes due 2061,$17.63,-0.01,-0.057%,6376857510.00,United States,,24771,Finance,Investment Managers +CGAU,Centerra Gold Inc. Common Shares,$20.05,0.53,2.715%,4044708194.00,Canada,2021,4072786,Basic Materials,Precious Metals +CGBD,Carlyle Secured Lending Inc. Common Stock,$12.38,-0.08,-0.642%,902538905.00,United States,2017,351182,Finance,Finance: Consumer Services +CGC,Canopy Growth Corporation Common Shares,$1.14,-0.03,-2.564%,420041470.00,Canada,,14055014,Health Care, Medicinal Chemicals and Botanical Products +CGCT,Cartesian Growth Corporation III Class A Ordinary Shares,$10.29,0.02,0.195%,0.00,United States,2025,670339,Finance,Blank Checks +CGCTU,Cartesian Growth Corporation III Unit,$10.77,0.00,0.00%,0.00,United States,2025,27,Finance,Blank Checks +CGCTW,Cartesian Growth Corporation III Warrant,$0.852,0.0019,0.224%,0.00,United States,2025,27018,Finance,Blank Checks +CGEM,Cullinan Therapeutics Inc. Common Stock,$11.85,-0.49,-3.971%,700053669.00,United States,2021,513899,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CGEN,Compugen Ltd. Ordinary Shares,$1.95,-0.07,-3.465%,182350315.00,Israel,2000,291810,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CGNT,Cognyte Software Ltd. Ordinary Shares,$9.23,-0.06,-0.646%,664155643.00,Israel,,162228,Technology,Computer Software: Prepackaged Software +CGNX,Cognex Corporation Common Stock,$39.05,-0.41,-1.039%,6544703813.00,United States,1989,1244223,Industrials,Industrial Machinery/Components +CGO,Calamos Global Total Return Fund Common Stock,$12.39,0.065,0.527%,0.00,United States,2005,32837,Finance,Investment Managers +CGON,CG Oncology Inc. Common stock,$53.84,-1.26,-2.287%,4343067077.00,United States,2024,658711,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CGTL,Creative Global Technology Holdings Limited Class A Ordinary Shares,$3.00,-0.26,-7.975%,77175000.00,China,2024,110756,Technology,Retail: Computer Software & Peripheral Equipment +CGTX,Cognition Therapeutics Inc. Common Stock,$1.24,-0.08,-6.061%,109452417.00,United States,2021,1235446,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CHA,Chagee Holdings Limited American Depositary Shares,$11.98,-0.20,-1.642%,2225314830.00,China,2025,401247,Consumer Discretionary,Restaurants +CHAC,Crane Harbor Acquisition Corp. Class A Ordinary Shares,$10.74,-0.13,-1.196%,0.00,United States,2025,241824,, +CHACR,Crane Harbor Acquistion Corp. Rights,$0.875,-0.01,-1.13%,0.00,United States,2025,63671,Finance,Blank Checks +CHACU,Crane Harbor Acquisition Corp. Units,$11.91,0.00,0.00%,0.00,United States,2025,106,, +CHAI,Core AI Holdings Inc. Common Shares,$1.81,-0.32,-15.023%,36059586.00,Canada,2020,202227,Telecommunications,Telecommunications Equipment +CHAR,Charlton Aria Acquisition Corporation Class A Ordinary Shares,$10.52,0.00,0.00%,0.00,United States,2024,10,, +CHARR,Charlton Aria Acquisition Corporation Rights,$0.165,-0.0001,-0.061%,0.00,United States,2024,7,, +CHCI,Comstock Holding Companies Inc. Class A Common Stock,$11.48,-0.08,-0.692%,115806233.00,United States,2004,5027,Finance,Real Estate +CHCO,City Holding Company Common Stock,$120.40,-0.25,-0.207%,1734801580.00,United States,,83624,Finance,Major Banks +CHCT,Community Healthcare Trust Incorporated Common Stock,$16.66,-0.41,-2.402%,474333924.00,United States,2015,199497,Real Estate,Real Estate Investment Trusts +CHD,Church & Dwight Company Inc. Common Stock,$91.48,-0.85,-0.921%,21967098895.00,United States,,2689624,Consumer Discretionary,Package Goods/Cosmetics +CHDN,Churchill Downs Incorporated Common Stock,$98.90,-1.33,-1.327%,6896172584.00,United States,,758107,Consumer Discretionary,Services-Misc. Amusement & Recreation +CHE,Chemed Corp,$432.56,-4.16,-0.953%,6126864189.00,United States,,140266,Health Care,Medical/Nursing Services +CHEF,The Chefs' Warehouse Inc. Common Stock,$63.58,-0.70,-1.089%,2586787205.00,United States,2011,346983,Consumer Discretionary,Food Distributors +CHGG,Chegg Inc. Common Stock,$0.7996,-0.005,-0.621%,87374777.00,United States,2013,1036333,Real Estate,Other Consumer Services +CHH,Choice Hotels International Inc. Common Stock,$99.96,-4.33,-4.152%,4625410895.00,United States,,703636,Consumer Discretionary,Hotels/Resorts +CHI,Calamos Convertible Opportunities and Income Fund Common Stock,$11.40,0.13,1.154%,0.00,United States,2002,164577,Finance,Investment Managers +CHKP,Check Point Software Technologies Ltd. Ordinary Shares,$180.24,-2.70,-1.476%,19532342586.00,Israel,1996,1061365,Technology,Computer Software: Prepackaged Software +CHMG,Chemung Financial Corp Common Stock,$58.43,-0.68,-1.15%,280133812.00,United States,,10764,Finance,Major Banks +CHMI,Cherry Hill Mortgage Investment Corporation Common Stock,$2.74,0.04,1.481%,100666334.00,,2013,143257,Real Estate,Real Estate Investment Trusts +CHMI^A,Cherry Hill Mortgage Investment Corporation 8.20% Series A Cumulative Redeemable Preferred Stock,$21.0874,-0.2626,-1.23%,,,,8196,, +CHMI^B,Cherry Hill Mortgage Investment Corporation 8.250% Series B Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$23.48,-0.2486,-1.048%,,,,11240,, +CHNR,China Natural Resources Inc. Common Stock,$4.274,0.314,7.929%,5270787.00,Hong Kong,,235676,Basic Materials,Precious Metals +CHOW,ChowChow Cloud International Holdings Limited Ordinary Shares,$0.66,0.0031,0.472%,23166000.00,,2025,256893,Technology,Computer Software: Prepackaged Software +CHPG,ChampionsGate Acquisition Corporation Class A Ordinary Share,$10.32,0.00,0.00%,0.00,United States,2025,44,, +CHPT,ChargePoint Holdings Inc. Common Stock,$6.48,-0.01,-0.154%,153272017.00,United States,2019,370172,Consumer Discretionary,Industrial Specialties +CHR,Cheer Holding Inc. Class A Ordinary Share,$1.46,0.01,0.69%,7571851.00,China,2018,72330,Technology,EDP Services +CHRD,Chord Energy Corporation Common Stock,$98.16,0.12,0.122%,5581897848.00,United States,,612099,Energy,Oil & Gas Production +CHRS,Coherus Oncology Inc. Common Stock,$2.215,-0.295,-11.753%,267729294.00,United States,2014,3440148,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CHRW,C.H. Robinson Worldwide Inc. Common Stock,$184.28,3.855,2.137%,21770319162.00,United States,1997,3111261,Industrials,Integrated Freight & Logistics +CHSCL,CHS Inc Class B Cumulative Redeemable Preferred Stock Series 4,$25.83,0.12,0.467%,316985837.00,United States,,24702,Industrials,Farming/Seeds/Milling +CHSCM,CHS Inc Class B Reset Rate Cumulative Redeemable Preferred Stock Series 3,$25.00,-0.02,-0.08%,306800075.00,United States,,19841,Industrials,Farming/Seeds/Milling +CHSCN,CHS Inc Preferred Class B Series 2 Reset Rate,$25.41,0.024,0.095%,311831596.00,United States,,49337,Industrials,Farming/Seeds/Milling +CHSCO,CHS Inc. Class B Cumulative Redeemable Preferred Stock,$26.24,-0.04,-0.152%,322017359.00,United States,,7725,Industrials,Farming/Seeds/Milling +CHSCP,CHS Inc. 8% Cumulative Redeemable Preferred Stock,$27.71,-0.1247,-0.448%,340057203.00,United States,,33239,Industrials,Farming/Seeds/Milling +CHSN,Chanson International Holding Class A Ordinary Shares,$2.0701,0.0001,0.005%,80689972.00,China,2023,19368,Consumer Staples,Packaged Foods +CHT,Chunghwa Telecom Co. Ltd.,$42.70,0.35,0.826%,33124296769.00,Taiwan,,184097,Telecommunications,Telecommunications Equipment +CHTR,Charter Communications Inc. Class A Common Stock New,$182.81,-0.18,-0.098%,23657326381.00,United States,,2474196,Telecommunications,Cable & Other Pay Television Services +CHW,Calamos Global Dynamic Income Fund Common Stock,$8.03,0.05,0.627%,0.00,United States,2007,253622,Finance,Investment Managers +CHWY,Chewy Inc. Class A Common Stock,$31.02,-0.28,-0.895%,12873255114.00,United States,2019,6327134,Consumer Discretionary,Catalog/Specialty Distribution +CHY,Calamos Convertible and High Income Fund Common Stock,$11.92,0.12,1.017%,0.00,United States,2003,268264,Finance,Investment Managers +CHYM,Chime Financial Inc. Class A Common Stock,$26.22,-0.40,-1.503%,9821434793.00,United States,2025,2671839,Finance,Finance: Consumer Services +CI,The Cigna Group Common Stock,$272.38,2.29,0.848%,72759729762.00,United States,,1583530,Health Care,Medical Specialities +CIA,Citizens Inc. Class A Common Stock ($1.00 Par),$5.46,-0.06,-1.087%,274620790.00,United States,1994,61180,Finance,Life Insurance +CIB,Grupo Cibest S.A. American Depositary Shares each representing four Preferred Shares,$83.06,0.17,0.205%,10584015687.00,Colombia,2025,504911,Finance,Commercial Banks +CICB,CION Investment Corporation 7.50% Notes due 2029,$25.27,0.01,0.04%,0.00,United States,2024,2446,Finance,Finance/Investors Services +CIEN,Ciena Corporation Common Stock,$257.30,9.78,3.951%,36241923316.00,United States,1997,2072972,Utilities,Telecommunications Equipment +CIF,MFS Intermediate High Income Fund Common Stock,$1.71,0.00,0.00%,0.00,United States,,181668,Finance,Trusts Except Educational Religious and Charitable +CIFR,Cipher Mining Inc. Common Stock,$18.97,0.22,1.173%,7494896264.00,United States,2020,33139395,Finance,Finance: Consumer Services +CIG,Comp En De Mn Cemig ADS American Depositary Shares,$2.18,-0.03,-1.357%,6238684531.00,Brazil,,4794345,Utilities,Electric Utilities: Central +CIGI,Colliers International Group Inc. Subordinate Voting Shares,$138.00,0.75,0.546%,6995788698.00,Canada,,464794,Finance,Real Estate +CIGL,Concorde International Group Ltd Class A Ordinary Shares,$2.02,0.03,1.508%,54510645.00,Singapore,2025,1250,Consumer Discretionary,Diversified Commercial Services +CII,BlackRock Enhanced Large Cap Core Fund Inc. Common Stock,$23.16,-0.03,-0.129%,3445338828.00,United States,2004,91396,Finance,Investment Bankers/Brokers/Service +CIIT,Tianci International Inc. Common Stock,$0.6544,0.0391,6.355%,16053612.00,Hong Kong,,174560,Energy,Oil & Gas Production +CIK,Credit Suisse Asset Management Income Fund Inc. Common Stock,$2.85,0.00,0.00%,0.00,United States,,125304,Finance,Finance/Investors Services +CIM,Chimera Investment Corporation Common Stock,$12.89,-0.09,-0.693%,1071821636.00,United States,2007,605128,Real Estate,Real Estate Investment Trusts +CIM^A,Chimera Investment Corporation 8.00% Series A Cumulative Redeemable Preferred Stock,$22.09,0.04,0.181%,,United States,,11744,, +CIM^B,Chimera Investment Corporation 8.00% Series B Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$23.712,0.062,0.262%,,United States,,24675,, +CIM^C,Chimera Investment Corporation 7.75% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$22.29,0.13,0.587%,,United States,,4711,, +CIM^D,Chimera Investment Corporation 8.00% Series D Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$23.4084,0.0584,0.25%,,United States,,13567,, +CIMN,Chimera Investment Corporation 9.000% Senior Notes due 2029,$25.53,0.015,0.059%,2055948669.00,United States,2024,6179,Real Estate,Real Estate Investment Trusts +CIMO,Chimera Investment Corporation 9.250% Senior Notes due 2029,$25.80,0.00,0.00%,0.00,United States,2024,5872,Real Estate,Real Estate Investment Trusts +CIMP,Chimera Investment Corporation 8.875% Senior Notes due 2030,$25.38,-0.04,-0.157%,0.00,United States,2025,48678,Real Estate,Real Estate Investment Trusts +CINF,Cincinnati Financial Corporation Common Stock,$158.40,0.54,0.342%,24713332459.00,United States,,527631,Finance,Property-Casualty Insurers +CING,Cingulate Inc. Common Stock,$5.91,0.02,0.34%,44007550.00,United States,2021,496833,Health Care,Biotechnology: Pharmaceutical Preparations +CINGW,Cingulate Inc. Warrants,$0.0888,-0.0212,-19.273%,661230.00,United States,2021,49251,Health Care,Biotechnology: Pharmaceutical Preparations +CINT,CI&T Inc Class A Common Shares,$5.21,0.02,0.385%,701694554.00,,2021,200515,Technology,EDP Services +CION,CION Investment Corporation Common Stock,$9.22,-0.12,-1.285%,476406131.00,United States,2021,302236,Finance,Finance/Investors Services +CISO,CISO Global Inc. Common Stock,$0.5068,-0.0137,-2.632%,22322687.00,United States,,639693,Consumer Discretionary,Professional Services +CISS,C3is Inc. Common Stock,$1.75,-0.11,-5.914%,1785000.00,Greece,,2230629,Consumer Discretionary,Marine Transportation +CITR,General Enterprise Ventures Inc. Common Stock,$7.40,0.11,1.509%,129891549.00,,,21567,Industrials,Environmental Services +CIVB,Civista Bancshares Inc. Common Stock,$23.29,0.29,1.261%,449796952.00,United States,,153760,Finance,Major Banks +CIVI,Civitas Resources Inc. Common Stock,$27.76,-0.20,-0.715%,2368016249.00,United States,2017,1506309,Energy,Oil & Gas Production +CIX,CompX International Inc. Common Stock,$23.59,0.17,0.726%,290700915.00,United States,1998,4532,Consumer Discretionary,Industrial Machinery/Components +CJMB,Callan JMB Inc. Common Stock,$1.85,-0.25,-11.905%,8552600.00,United States,2025,270334,Real Estate,Real Estate +CKX,CKX Lands Inc. Common Stock,$11.28,0.0689,0.615%,23159295.00,United States,2003,1660,Energy,Oil & Gas Production +CL,Colgate-Palmolive Company Common Stock,$85.00,-0.76,-0.886%,68515520070.00,United States,,5052362,Consumer Discretionary,Package Goods/Cosmetics +CLAR,Clarus Corporation Common Stock,$3.58,0.01,0.28%,137478530.00,United States,,184185,Consumer Discretionary,Recreational Games/Products/Toys +CLB,Core Laboratories Inc. Common Stock,$18.82,-0.85,-4.321%,876322943.00,Netherlands,2023,346731,Energy,Oilfield Services/Equipment +CLBK,Columbia Financial Inc. Common Stock,$16.03,0.07,0.439%,1672143033.00,United States,2018,198876,Finance,Savings Institutions +CLBT,Cellebrite DI Ltd. Ordinary Shares,$16.01,-0.58,-3.496%,3833915693.00,Israel,,2180539,Technology,Computer Software: Prepackaged Software +CLDI,Calidi Biotherapeutics Inc. Common Stock,$1.03,0.03,3.00%,7382753.00,,2021,83436,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CLDT,Chatham Lodging Trust (REIT) Common Shares of Beneficial Interest,$6.89,-0.08,-1.148%,334275240.00,United States,2010,207153,Real Estate,Real Estate Investment Trusts +CLDT^A,Chatham Lodging Trust (REIT) 6.625% Series A Cumulative Redeemable Preferred Shares of Beneficial Interest,$20.65,-0.17,-0.817%,,United States,,13007,, +CLDX,Celldex Therapeutics Inc.,$24.77,-1.46,-5.566%,1645953397.00,United States,,359603,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +CLF,Cleveland-Cliffs Inc. Common Stock,$14.05,-0.22,-1.542%,6950639925.00,United States,,10133455,Basic Materials,Metal Mining +CLFD,Clearfield Inc. Common Stock,$29.93,-1.51,-4.803%,414432270.00,United States,,138726,Utilities,Telecommunications Equipment +CLGN,CollPlant Biotechnologies Ltd Ordinary Shares,$1.93,-0.016,-0.822%,24658423.00,Israel,,8353,Health Care,Industrial Specialties +CLH,Clean Harbors Inc. Common Stock,$258.65,-1.90,-0.729%,13820144123.00,United States,,555688,Industrials,Environmental Services +CLIK,Click Holdings Limited Class A Ordinary Share,$4.87,-0.0562,-1.141%,15890971.00,Hong Kong,2024,4139,Consumer Discretionary,Diversified Commercial Services +CLIR,ClearSign Technologies Corporation Common Stock (DE),$0.6151,-0.0559,-8.331%,32979196.00,United States,2012,135568,Industrials,Industrial Machinery/Components +CLLS,Cellectis S.A. American Depositary Shares,$4.06,-0.17,-4.019%,292701124.00,France,2015,32954,Health Care,Biotechnology: Pharmaceutical Preparations +CLM,Cornerstone Strategic Investment Fund Inc. Common Shares,$8.28,-0.05,-0.60%,0.00,United States,2003,1805208,Finance,Finance/Investors Services +CLMB,Climb Global Solutions Inc. Common Stock,$120.33,1.15,0.965%,555135957.00,United States,,35721,Technology,Retail: Computer Software & Peripheral Equipment +CLMT,Calumet Inc. Common Stock,$21.59,-0.54,-2.44%,1873025790.00,United States,2006,1441179,Energy,Integrated oil Companies +CLNE,Clean Energy Fuels Corp. Common Stock,$2.23,-0.06,-2.62%,489041228.00,United States,2007,596498,Utilities,Natural Gas Distribution +CLNN,Clene Inc. Common Stock,$4.91,-0.28,-5.395%,53273372.00,United States,,92541,Health Care,Biotechnology: Pharmaceutical Preparations +CLOV,Clover Health Investments Corp. Class A Common Stock,$2.31,-0.05,-2.119%,1193526307.00,United States,,6559449,Health Care,Medical Specialities +CLPR,Clipper Realty Inc. Common Stock,$3.58,-0.08,-2.186%,57804635.00,United States,2017,61417,Real Estate,Real Estate Investment Trusts +CLPS,CLPS Incorporation Common Stock,$1.075,0.115,11.979%,31974211.00,China,2018,101004,Technology,Computer Software: Prepackaged Software +CLPT,ClearPoint Neuro Inc. Common Stock,$13.43,-0.96,-6.671%,381725026.00,United States,,801386,Health Care,Medical/Dental Instruments +CLRB,Cellectar Biosciences Inc. Common Stock,$3.31,-0.23,-6.497%,14034844.00,United States,,75183,Health Care,Biotechnology: Pharmaceutical Preparations +CLRO,ClearOne Inc. (DE) Common Stock,$6.84,-0.18,-2.564%,15307318.00,United States,,5153,Utilities,Telecommunications Equipment +CLS,Celestica Inc. Common Stock,$345.23,12.06,3.62%,39714092668.00,Canada,1998,5297922,Technology,Electrical Products +CLSK,CleanSpark Inc. Common Stock,$13.45,0.18,1.356%,3439842355.00,United States,,30607694,Finance,Finance: Consumer Services +CLSKW,CleanSpark Inc. Warrant,$0.403,-0.001,-0.248%,103067395.00,United States,,48265,Finance,Finance: Consumer Services +CLST,Catalyst Bancorp Inc. Common Stock,$15.70,0.10,0.641%,64584462.00,United States,2021,1835,Finance,Savings Institutions +CLVT,Clarivate Plc Ordinary Shares,$2.74,-0.12,-4.196%,1812332089.00,United Kingdom,2019,5101352,Technology,EDP Services +CLW,Clearwater Paper Corporation Common Stock,$17.34,0.00,0.00%,278104764.00,United States,,249321,Basic Materials,Paper +CLWT,Euro Tech Holdings Company Limited Common Stock,$1.29,-0.03,-2.273%,9734233.00,Hong Kong,1997,6949,Consumer Discretionary,Professional and commerical equipment +CLX,Clorox Company (The) Common Stock,$108.80,-4.39,-3.878%,13271465235.00,United States,,2225048,Consumer Discretionary,Specialty Chemicals +CLYM,Climb Bio Inc. Common Stock,$5.16,0.04,0.781%,246361285.00,United States,2021,631603,Health Care,Biotechnology: Pharmaceutical Preparations +CM,Canadian Imperial Bank of Commerce Common Stock,$93.13,-0.29,-0.31%,86191073313.00,Canada,,1554000,Finance,Commercial Banks +CMA,Comerica Incorporated Common Stock,$92.69,-2.04,-2.153%,11840465580.00,United States,,2926468,Finance,Major Banks +CMA^B,Comerica Incorporated Depositary Shares each representing a 1/40th interest in a share of 6.875% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series B,$26.05,0.10,0.385%,,United States,,23282,, +CMBM,Cambium Networks Corporation Ordinary Shares,$1.66,0.01,0.606%,46884721.00,Cayman Islands,2019,183407,Technology,Radio And Television Broadcasting And Communications Equipment +CMBT,CMB.TECH NV Ordinary Shares,$12.73,0.55,4.516%,2800914596.00,,2015,3529298,Consumer Discretionary,Marine Transportation +CMC,Commercial Metals Company Common Stock,$75.05,-1.45,-1.895%,8323601721.00,United States,,1328193,Industrials,Steel/Iron Ore +CMCL,Caledonia Mining Corporation Plc Common Shares,$32.33,1.35,4.358%,623800367.00,Canada,,642937,Basic Materials,Precious Metals +CMCM,Cheetah Mobile Inc. American Depositary Shares each representing fifty (50) Class A Ordinary Shares,$6.71,0.10,1.513%,5148362362.00,China,2022,9210,Technology,Computer Software: Prepackaged Software +CMCO,Columbus McKinnon Corporation Common Stock,$20.75,0.00,0.00%,596111416.00,United States,1996,422463,Industrials,Construction/Ag Equipment/Trucks +CMCSA,Comcast Corporation Class A Common Stock,$28.41,-0.29,-1.01%,103523042887.00,United States,,46428770,Telecommunications,Cable & Other Pay Television Services +CMCT,Creative Media & Community Trust Corporation Common stock,$3.19,-0.17,-5.06%,3021026.00,United States,,89713,Real Estate,Real Estate Investment Trusts +CMDB,Costamare Bulkers Holdings Limited Common Stock,$16.25,0.33,2.073%,393310856.00,,2025,84042,Consumer Discretionary,Marine Transportation +CME,CME Group Inc. Class A Common Stock,$286.05,1.57,0.552%,103148670874.00,United States,2002,1487097,Finance,Investment Bankers/Brokers/Service +CMG,Chipotle Mexican Grill Inc. Common Stock,$39.16,-0.49,-1.236%,51780406480.00,United States,2006,13387133,Consumer Discretionary,Restaurants +CMI,Cummins Inc. Common Stock,$577.86,1.63,0.283%,79765629159.00,United States,,533279,Industrials,Industrial Machinery/Components +CMMB,Chemomab Therapeutics Ltd. American Depositary Share,$1.62,-0.12,-6.897%,8409543.00,Israel,2019,40538,Health Care,Biotechnology: Pharmaceutical Preparations +CMND,Clearmind Medicine Inc. Common Shares,$2.52,-0.16,-5.97%,3779486.00,Canada,,56642,Health Care,Biotechnology: Pharmaceutical Preparations +CMP,Compass Minerals Intl Inc Common Stock,$25.90,0.28,1.093%,1083703941.00,United States,2003,305694,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +CMPR,Cimpress plc Ordinary Shares (Ireland),$77.91,-0.62,-0.79%,1922178691.00,Netherlands,2005,132983,Consumer Discretionary,Publishing +CMPS,COMPASS Pathways Plc American Depository Shares,$6.71,-0.28,-4.006%,644274365.00,United Kingdom,2020,1174949,Health Care,Biotechnology: Pharmaceutical Preparations +CMPX,Compass Therapeutics Inc. Common Stock,$6.16,-0.25,-3.90%,1095630548.00,United States,,1569392,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CMRC,Commerce.com Inc. Series 1 Common Stock,$3.10,-0.08,-2.516%,251916373.00,United States,2020,735450,Technology,Computer Software: Prepackaged Software +CMRE,Costamare Inc. Common Stock $0.0001 par value,$16.53,0.20,1.225%,1982963413.00,Greece,2010,361318,Consumer Discretionary,Marine Transportation +CMRE^B,Costamare Inc. Perpetual Preferred Stock Series B (Marshall Islands),$25.695,0.00,0.00%,,Greece,,97,, +CMRE^C,Costamare Inc. Perpetual Preferred Series C (Marshall Islands),$26.6408,-0.286,-1.062%,,Greece,,1084,, +CMRE^D,Costamare Inc. 8.75% Series D Cumulative Redeemable Perpetual Preferred Stock,$27.5401,-0.0199,-0.072%,,Greece,,1305,, +CMS,CMS Energy Corporation Common Stock,$71.80,-0.24,-0.333%,21850159127.00,United States,,2599274,Utilities,Power Generation +CMS^B,CMS Energy Corporation Preferred Stock,$76.78,-1.22,-1.564%,,United States,,964,, +CMS^C,CMS Energy Corporation Depositary Shares each representing a 1/1000th interest in a share of 4.200% Cumulative Redeemable Perpetual Preferred Stock Series C,$17.91,0.02,0.112%,,United States,,6244,, +CMSA,CMS Energy Corporation 5.625% Junior Subordinated Notes due 2078,$22.92,-0.0695,-0.302%,6860768766.00,United States,2018,9993,Utilities,Power Generation +CMSC,CMS Energy Corporation 5.875% Junior Subordinated Notes due 2078,$23.70,-0.10,-0.42%,7094250426.00,United States,2018,14090,Utilities,Power Generation +CMSD,CMS Energy Corporation 5.875% Junior Subordinated Notes due 2079,$24.0508,-0.0457,-0.19%,7199257305.00,United States,2019,27123,Utilities,Power Generation +CMT,Core Molding Technologies Inc Common Stock,$18.80,0.03,0.16%,166528652.00,United States,1996,17286,Industrials,Plastic Products +CMTG,Claros Mortgage Trust Inc. Common Stock,$2.80,-0.13,-4.437%,392612539.00,United States,2021,815823,Finance,Real Estate +CMTL,Comtech Telecommunications Corp. Common Stock,$5.88,-0.07,-1.176%,174220725.00,United States,,345520,Technology,Radio And Television Broadcasting And Communications Equipment +CMU,MFS Municipal Income Trust Common Stock,$3.54,0.0101,0.286%,100271612.00,United States,1987,14989,Finance,Investment Managers +CNA,CNA Financial Corporation Common Stock,$47.23,0.49,1.048%,12783582762.00,United States,,405735,Finance,Property-Casualty Insurers +CNC,Centene Corporation Common Stock,$41.90,0.37,0.891%,20594604200.00,United States,,7858057,Health Care,Medical Specialities +CNCK,Coincheck Group N.V. Ordinary Shares,$2.40,-0.22,-8.397%,326225093.00,Netherlands,,188749,Finance,Finance: Consumer Services +CNCKW,Coincheck Group N.V. Warrants,$0.3263,-0.0137,-4.029%,44353020.00,Netherlands,,300,Finance,Finance: Consumer Services +CNDT,Conduent Incorporated Common Stock ,$1.52,-0.09,-5.59%,232392026.00,United States,,1629795,Real Estate,Real Estate +CNET,ZW Data Action Technologies Inc. Common Stock,$1.23,-0.005,-0.405%,4020217.00,China,,6481,Technology,Computer Software: Programming Data Processing +CNEY,CN Energy Group Inc. Class A Ordinary Shares,$0.8183,-0.0317,-3.729%,4601920.00,China,2021,379434,Industrials,Major Chemicals +CNF,CNFinance Holdings Limited American Depositary Shares each representing two hundred (200) Ordinary Shares,$5.76,0.75,14.97%,39503324.00,,,9687,Finance,Finance: Consumer Services +CNH,CNH Industrial N.V. Common Shares,$10.76,-0.04,-0.37%,13411314228.00,United Kingdom,2013,8502500,Industrials,Construction/Ag Equipment/Trucks +CNI,Canadian National Railway Company Common Stock,$98.54,-1.94,-1.931%,60651370000.00,Canada,,1679104,Industrials,Railroads +CNK,Cinemark Holdings Inc Cinemark Holdings Inc. Common Stock,$23.52,0.40,1.73%,2763033215.00,United States,2007,1211728,Consumer Discretionary,Movies/Entertainment +CNL,Collective Mining Ltd. Common Shares,$19.81,0.95,5.037%,1827764678.00,,2024,118346,, +CNM,Core & Main Inc. Class A Common Stock,$55.20,0.10,0.181%,10792279457.00,United States,2021,2544971,Consumer Discretionary,Durable Goods +CNMD,CONMED Corporation Common Stock,$38.69,-0.89,-2.249%,1198150140.00,United States,1987,668212,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +CNNE,Cannae Holdings Inc. Common Stock,$14.32,-0.43,-2.915%,705767014.00,United States,2017,446901,Consumer Discretionary,Restaurants +CNO,CNO Financial Group Inc. Common Stock,$41.01,-0.01,-0.024%,3910447527.00,United States,,555133,Finance,Accident &Health Insurance +CNO^A,CNO Financial Group Inc. 5.125% Subordinated Debentures due 2060,$19.31,-0.13,-0.669%,,United States,,110,, +CNOB,ConnectOne Bancorp Inc. Common Stock,$27.85,-0.17,-0.607%,1400105529.00,United States,,258989,Finance,Major Banks +CNOBP,ConnectOne Bancorp Inc. Depositary Shares each representing a 1/40th interest in a share of 5.25% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series A,$24.5601,0.0101,0.041%,1234712093.00,United States,,7180,Finance,Major Banks +CNP,CenterPoint Energy Inc (Holding Co) Common Stock,$39.79,-0.04,-0.10%,25977628583.00,United States,,4853092,Utilities,Electric Utilities: Central +CNQ,Canadian Natural Resources Limited Common Stock,$37.10,0.43,1.173%,77283269700.00,Canada,,9200873,Energy,Oil & Gas Production +CNR,Core Natural Resources Inc. Common Stock,$93.91,-3.00,-3.096%,4811898628.00,United States,2017,695716,Energy,Coal Mining +CNS,Cohen & Steers Inc Common Stock,$63.95,-1.14,-1.751%,3261932247.00,United States,2004,343261,Finance,Investment Managers +CNSP,CNS Pharmaceuticals Inc. Common Stock,$5.83,-0.30,-4.894%,3616291.00,United States,2019,22438,Health Care,Biotechnology: Pharmaceutical Preparations +CNTA,Centessa Pharmaceuticals plc American Depositary Shares,$25.24,-0.75,-2.886%,3618308040.00,United Kingdom,2021,906914,Health Care,Biotechnology: Pharmaceutical Preparations +CNTB,Connect Biopharma Holdings Limited Ordinary Shares,$2.48,-0.17,-6.415%,138640712.00,China,2021,25611,Health Care,Biotechnology: Pharmaceutical Preparations +CNTX,Context Therapeutics Inc. Common Stock,$2.40,0.21,9.589%,220510025.00,United States,2021,4015675,Health Care,Biotechnology: Pharmaceutical Preparations +CNTY,Century Casinos Inc. Common Stock,$1.55,-0.02,-1.274%,45639837.00,United States,,86351,Consumer Discretionary,Hotels/Resorts +CNVS,Cineverse Corp. Class A Common Stock,$2.11,-0.11,-4.955%,40407350.00,United States,,100255,Consumer Discretionary,Consumer Electronics/Video Chains +CNX,CNX Resources Corporation Common Stock,$36.73,-0.01,-0.027%,4952403528.00,United States,1999,2336381,Energy,Oil & Gas Production +CNXC,Concentrix Corporation Common Stock,$36.32,-5.29,-12.713%,2261190184.00,United States,,1332987,Technology,Computer Software: Prepackaged Software +CNXN,PC Connection Inc. Common Stock,$57.88,0.44,0.766%,1461193565.00,United States,,67701,Consumer Discretionary,Catalog/Specialty Distribution +COCH,Envoy Medical Inc. Class A Common Stock,$0.6841,0.0149,2.227%,19794406.00,United States,2021,175937,Health Care,Industrial Specialties +COCHW,Envoy Medical Inc Warrant,$0.045,-0.005,-10.00%,1302073.00,United States,2021,17007,Health Care,Industrial Specialties +COCO,The Vita Coco Company Inc. Common Stock,$54.17,-0.81,-1.473%,3084887136.00,United States,2021,769577,Consumer Staples,Beverages (Production/Distribution) +COCP,Cocrystal Pharma Inc. Common Stock,$1.02,0.00,0.00%,14059746.00,United States,,36684,Health Care,Biotechnology: Pharmaceutical Preparations +CODA,Coda Octopus Group Inc. Common stock,$9.91,-0.22,-2.172%,111476272.00,United States,,111589,Industrials,Industrial Machinery/Components +CODI,D/B/A Compass Diversified Holdings Shares of Beneficial Interest,$6.40,-0.47,-6.841%,481510182.00,United States,2006,1459992,Consumer Discretionary,Home Furnishings +CODI^A,Compass Diversified Holdings 7.250% Series A Preferred Shares representing beneficial interest in Compass Diversified Holdings,$18.20,-0.09,-0.492%,,United States,,6656,, +CODI^B,Compass Diversified Holdings 7.875% Series B Fixed-to-Floating Rate Cumulative Preferred Shares representing beneficial interests in Compass Diversified Holdings,$19.72,0.0817,0.416%,,United States,,6416,, +CODI^C,Compass Diversified Holdings 7.875% Series C Cumulative Preferred Shares,$19.75,0.01,0.051%,,United States,,10795,, +COE,51Talk Online Education Group American depositary shares each representing 60 Class A ordinary shares,$26.13,0.10,0.384%,153108082.00,China,2016,1776,Real Estate,Other Consumer Services +COEP,Coeptis Therapeutics Holdings Inc. Common Stock,$13.56,0.26,1.955%,77022305.00,United States,2020,30651,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +COEPW,Coeptis Therapeutics Holdings Inc. Warrants,$0.0125,-0.0003,-2.344%,71001.00,United States,2020,10101,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +COF,Capital One Financial Corporation Common Stock,$218.41,1.30,0.599%,138850576668.00,United States,1994,5925749,Finance,Major Banks +COF^I,Capital One Financial Corporation Depositary shares each representing a 1/40th interest in a share of Fixed Rate Non-Cumulative Perpetual Preferred Stock Series I of the Issuer,$19.73,0.01,0.051%,,United States,,127967,, +COF^J,Capital One Financial Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of Fixed Rate Non- Cumulative Perpetual Preferred Stock Series J,$18.63,-0.05,-0.268%,,United States,,66359,, +COF^K,Capital One Financial Corporation Depositary Shares Each Representing a 1/40th Ownership Interest in a Share of Fixed Rate Non-Cumulative Perpetual Preferred Stock Series K,$18.00,-0.05,-0.277%,,United States,,8491,, +COF^L,Capital One Financial Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of Fixed Rate Non-Cumulative Perpetual Preferred Stock Series L,$17.12,-0.07,-0.407%,,United States,,24221,, +COF^N,Capital One Financial Corporation Depositary Shares Each Representing a 1/40th Ownership Interest in a Share of Fixed Rate Non-Cumulative Perpetual Preferred Stock Series N,$16.91,-0.0199,-0.118%,,United States,,61768,, +COFS,ChoiceOne Financial Services Inc. Common Stock,$28.50,-0.68,-2.33%,428176362.00,United States,,77058,Finance,Major Banks +COGT,Cogent Biosciences Inc. Common Stock,$38.36,-0.15,-0.39%,5461563652.00,United States,2018,1310962,Health Care,Biotechnology: Pharmaceutical Preparations +COHN,Cohen & Company Inc.,$18.01,0.49,2.797%,36665893.00,United States,,31568,Finance,Investment Bankers/Brokers/Service +COHR,Coherent Corp. Common Stock,$221.14,7.14,3.336%,41446007053.00,United States,,4303482,Technology,Electronic Components +COHU,Cohu Inc. Common Stock,$28.99,0.00,0.00%,1353618967.00,United States,,522415,Industrials,Electrical Products +COIN,Coinbase Global Inc. Class A Common Stock,$209.43,-1.40,-0.664%,56471503966.00,United States,,9046574,Finance,Finance: Consumer Services +COKE,Coca-Cola Consolidated Inc. Common Stock,$149.50,-1.00,-0.664%,12774690682.00,United States,1972,275709,Consumer Staples,Beverages (Production/Distribution) +COLA,Columbus Acquisition Corp Ordinary Shares,$10.57,-0.02,-0.189%,0.00,Singapore,2025,24625,, +COLAR,Columbus Acquisition Corp Rights,$0.36,-0.0485,-11.873%,0.00,Singapore,2025,56174,Finance,Blank Checks +COLAU,Columbus Acquisition Corp Unit,$11.09,0.41,3.839%,0.00,Singapore,2025,1374,, +COLB,Columbia Banking System Inc. Common Stock,$28.96,0.00,0.00%,8662543465.00,United States,1992,2595320,Finance,Major Banks +COLD,Americold Realty Trust Inc. Common Stock,$12.29,-0.49,-3.834%,3500861547.00,United States,2018,6054965,Real Estate,Real Estate Investment Trusts +COLL,Collegium Pharmaceutical Inc. Common Stock,$44.82,-0.50,-1.103%,1416803944.00,United States,2015,305362,Health Care,Biotechnology: Pharmaceutical Preparations +COLM,Columbia Sportswear Company Common Stock,$53.88,-0.28,-0.517%,2903533501.00,United States,1998,604808,Consumer Discretionary,Apparel +COMP,Compass Inc. Class A Common Stock,$13.05,-0.08,-0.609%,7337178795.00,United States,2021,17931017,Technology,EDP Services +CON,Concentra Group Holdings Parent Inc. Common Stock,$21.48,-0.18,-0.831%,2753095939.00,United States,2024,1069956,Health Care,Medical Specialities +COO,The Cooper Companies Inc. Common Stock,$80.48,-0.22,-0.273%,15772311532.00,United States,,1123713,Health Care,Ophthalmic Goods +COOK,Traeger Inc. Common Stock,$1.06,-0.01,-0.935%,145410074.00,United States,2021,168021,Consumer Discretionary,Consumer Electronics/Appliances +COOT,Australian Oilseeds Holdings Limited Ordinary Shares,$0.70,0.00,0.00%,19528977.00,Australia,,32612,Consumer Staples,Packaged Foods +COOTW,Australian Oilseeds Holdings Limited Warrant,$0.0198,-0.0001,-0.503%,552391.00,Australia,,11006,Consumer Staples,Packaged Foods +COP,ConocoPhillips Common Stock,$101.39,1.52,1.522%,125289473368.00,United States,,6817438,Energy,Integrated oil Companies +COPL,Copley Acquisition Corp Ordinary Shares,$10.26,0.00,0.00%,0.00,,2025,76,, +COR,Cencora Inc. Common Stock,$350.54,-5.60,-1.572%,68179940963.00,United States,,852334,Health Care,Other Pharmaceuticals +CORT,Corcept Therapeutics Incorporated Common Stock,$45.85,-0.37,-0.801%,4822879749.00,United States,2004,1668724,Health Care,Biotechnology: Pharmaceutical Preparations +CORZ,Core Scientific Inc. Common Stock,$19.49,-0.45,-2.257%,6043094737.00,United States,,10238776,Finance,Finance: Consumer Services +CORZW,Core Scientific Inc. Tranche 1 Warrants,$13.05,-0.42,-3.118%,4046299965.00,United States,,240195,Finance,Finance: Consumer Services +CORZZ,Core Scientific Inc. Tranche 2 Warrants,$19.47,-0.29,-1.468%,6036893511.00,United States,,3236,Finance,Finance: Consumer Services +COSM,Cosmos Health Inc. Common Stock,$0.4919,-0.0135,-2.671%,18413058.00,United States,,519966,Health Care,Other Pharmaceuticals +COSO,CoastalSouth Bancshares Inc. Common Stock,$23.62,-0.12,-0.505%,282942114.00,United States,2025,63614,Finance,Major Banks +COST,Costco Wholesale Corporation Common Stock,$960.78,-9.50,-0.979%,426460852701.00,United States,,2474811,Consumer Discretionary,Department/Specialty Retail Stores +COTY,Coty Inc. Class A Common Stock,$3.13,-0.03,-0.949%,2737553326.00,United States,2013,7149829,Consumer Discretionary,Package Goods/Cosmetics +COUR,Coursera Inc. Common Stock,$6.18,0.00,0.00%,1028352000.00,United States,2021,5156701,Technology,Computer Software: Prepackaged Software +COYA,Coya Therapeutics Inc. Common Stock,$4.60,-0.24,-4.959%,96252498.00,United States,2022,315599,Health Care,Biotechnology: Pharmaceutical Preparations +CP,Canadian Pacific Kansas City Limited Common Shares,$71.78,-0.97,-1.333%,64661666981.00,Canada,,2457663,Industrials,Railroads +CPA,Copa Holdings S.A. Class A Common Stock,$135.90,-1.32,-0.962%,5595404720.00,Panama,2005,286210,Consumer Discretionary,Air Freight/Delivery Services +CPAC,Cementos Pacasmayo S.A.A. American Depositary Shares (Each representing five Common Shares),$11.05,0.04,0.363%,936749275.00,Peru,,9090,Industrials,Building Materials +CPAY,Corpay Inc. Common Stock,$317.64,-0.32,-0.101%,22221476908.00,United States,,308442,Real Estate,Real Estate +CPB,The Campbell's Company Common Stock,$26.98,-0.39,-1.425%,8043661930.00,United States,,6288954,Consumer Staples,Packaged Foods +CPBI,Central Plains Bancshares Inc. Common Stock,$17.67,0.18,1.029%,74440865.00,United States,2023,1378,Finance,Savings Institutions +CPF,Central Pacific Financial Corp New,$31.86,0.17,0.536%,854724532.00,United States,,249301,Finance,Major Banks +CPHC,Canterbury Park Holding Corporation 'New' Common Stock,$15.63,0.30,1.957%,79701621.00,United States,,1641,Consumer Discretionary,Services-Misc. Amusement & Recreation +CPHI,China Pharma Holdings Inc. Common Stock,$1.27,-0.03,-2.308%,6377943.00,China,,3488,Health Care,Biotechnology: Pharmaceutical Preparations +CPIX,Cumberland Pharmaceuticals Inc. Common Stock,$3.83,0.09,2.406%,57283881.00,United States,2009,258580,Health Care,Biotechnology: Pharmaceutical Preparations +CPK,Chesapeake Utilities Corporation Common Stock,$125.85,-1.80,-1.41%,2976438581.00,United States,,122023,Utilities,Oil & Gas Production +CPNG,Coupang Inc. Class A Common Stock,$20.33,0.24,1.195%,37135744448.00,United States,2021,33299442,Consumer Discretionary,Catalog/Specialty Distribution +CPOP,Pop Culture Group Co. Ltd Class A Ordinary Shares,$0.395,-0.0618,-13.529%,32365921.00,China,2021,273900,Consumer Discretionary,Services-Misc. Amusement & Recreation +CPRI,Capri Holdings Limited Ordinary Shares,$23.04,-0.85,-3.558%,2745061125.00,Hong Kong,2011,2680057,Consumer Discretionary,Apparel +CPRT,Copart Inc. (DE) Common Stock,$40.62,0.25,0.619%,39320878324.00,United States,1994,5895858,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CPRX,Catalyst Pharmaceuticals Inc. Common Stock,$24.20,0.13,0.54%,2974479765.00,United States,2006,913209,Health Care,Biotechnology: Pharmaceutical Preparations +CPS,Cooper-Standard Holdings Inc. Common Stock,$31.37,-0.01,-0.032%,553272972.00,United States,,116562,Consumer Discretionary,Auto Parts:O.E.M. +CPSH,CPS Technologies Corp. Common Stock,$6.38,0.78,13.929%,114707787.00,United States,,1774248,Consumer Discretionary,Building Materials +CPSS,Consumer Portfolio Services Inc. Common Stock,$8.32,-0.14,-1.655%,183631103.00,United States,1992,17394,Finance,Finance: Consumer Services +CPT,Camden Property Trust Common Stock,$107.22,-1.70,-1.561%,11407707283.00,United States,1993,1014880,Real Estate,Real Estate Investment Trusts +CPZ,Calamos Long/Short Equity & Dynamic Income Trust Common Stock,$14.85,-0.05,-0.336%,291538081.00,United States,2019,59198,Finance,Trusts Except Educational Religious and Charitable +CQP,Cheniere Energy Partners LP Common Units,$57.20,0.63,1.114%,27687810036.00,United States,2007,73866,Utilities,Oil/Gas Transmission +CR,Crane Company Common Stock,$182.27,-3.37,-1.815%,10498184593.00,United States,2023,986912,Industrials,Metal Fabrications +CRAC,Crown Reserve Acquisition Corp. I Class A Ordinary Shares,$9.97,0.00,0.00%,0.00,Cayman Islands,2025,128,, +CRACR,Crown Reserve Acquisition Corp. I Rights,$0.22,0.0103,4.912%,0.00,Cayman Islands,2025,91842,, +CRACU,Crown Reserve Acquisition Corp. I Unit,$10.22,0.00,0.00%,0.00,Cayman Islands,2025,403,Finance,Blank Checks +CRACW,Crown Reserve Acquisition Corp. I Warrant,$0.1279,0.0179,16.273%,0.00,Cayman Islands,2025,171536,, +CRAI,CRA International Inc. Common Stock,$186.74,-6.25,-3.239%,1225436806.00,United States,1998,96517,Consumer Discretionary,Other Consumer Services +CRAN,Crane Harbor Acquisition Corp. II Class A Ordinary Shares,$9.98,-0.005,-0.05%,0.00,United States,2026,1186,Finance,Blank Checks +CRANR,Crane Harbor Acquisition Corp. II Rights,$0.2407,0.0057,2.426%,0.00,United States,2026,47821,Finance,Blank Checks +CRANU,Crane Harbor Acquisition Corp. II Units,$10.21,0.00,0.00%,0.00,United States,2025,13074,, +CRAQ,Cal Redwood Acquisition Corp. Class A Ordinary Shares,$10.17,0.00,0.00%,0.00,United States,2025,11,Finance,Blank Checks +CRBD,Corebridge Financial Inc. 6.375% Junior Subordinated Notes due 2064,$24.18,0.16,0.666%,0.00,United States,2024,41030,Finance,Life Insurance +CRBG,Corebridge Financial Inc. Common Stock,$30.38,0.16,0.529%,15812602221.00,United States,2022,2919297,Finance,Life Insurance +CRBP,Corbus Pharmaceuticals Holdings Inc. Common Stock,$8.70,-0.80,-8.421%,152711422.00,United States,,149003,Health Care,Biotechnology: Pharmaceutical Preparations +CRBU,Caribou Biosciences Inc. Common Stock,$1.52,-0.03,-1.935%,142071418.00,United States,2021,633600,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CRC,California Resources Corporation Common Stock,$50.88,0.20,0.395%,4259263049.00,United States,2020,1032721,Energy,Oil & Gas Production +CRCL,Circle Internet Group Inc. Class A Common Stock,$72.84,2.88,4.117%,17152042048.00,United States,2025,16300635,Finance,Finance: Consumer Services +CRCT,Cricut Inc. Class A Common Stock,$4.44,0.04,0.909%,940148306.00,United States,2021,321553,Technology,Industrial Machinery/Components +CRD/A,Crawford & Company,$10.53,-0.01,-0.095%,,United States,,94738,, +CRD/B,Crawford & Company,$10.37,0.41,4.116%,,United States,,7808,, +CRDF,Cardiff Oncology Inc. Common Stock,$1.62,-0.38,-19.00%,109124114.00,United States,,7204540,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CRDL,Cardiol Therapeutics Inc. Class A Common Shares,$0.9857,-0.0143,-1.43%,98567682.00,Canada,,180140,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CRDO,Credo Technology Group Holding Ltd Ordinary Shares,$129.66,0.09,0.069%,23420708686.00,United States,2022,5146957,Technology,Semiconductors +CRE,Cre8 Enterprise Limited Class A Ordinary Shares,$0.3352,0.0002,0.06%,8053180.00,Hong Kong,2025,125586,Consumer Discretionary,Publishing +CREG,Smart Powerr Corp. Common Stock,$1.18,-0.04,-3.279%,24554765.00,China,,313694,Real Estate,Real Estate +CRESW,Cresud S.A.C.I.F. y A. Warrant,$1.38,-0.15,-9.804%,847422497.00,Argentina,,31777,Finance,Real Estate +CRESY,Cresud S.A.C.I.F. y A. American Depositary Shares,$13.67,-0.44,-3.118%,839439527.00,Argentina,1997,245327,Finance,Real Estate +CREV,Carbon Revolution Public Limited Ordinary Shares,$1.64,-0.02,-1.205%,3091702.00,Ireland,,9054,Consumer Discretionary,Auto Parts:O.E.M. +CREVW,Carbon Revolution Public Limited Company Warrant,$0.0087,0.0016,22.535%,16401.00,Ireland,,2623,Consumer Discretionary,Auto Parts:O.E.M. +CREX,Creative Realities Inc. Common Stock,$3.31,-0.01,-0.301%,34817665.00,United States,,26657,Technology,EDP Services +CRF,Cornerstone Total Return Fund Inc. (The) Common Stock,$7.91,-0.05,-0.628%,0.00,United States,2003,1135072,Finance,Finance/Investors Services +CRGO,Freightos Limited Ordinary shares,$2.30,-0.01,-0.433%,115098300.00,Israel,,28840,Industrials,Integrated Freight & Logistics +CRGOW,Freightos Limited Warrants,$0.2745,0.0445,19.348%,13736732.00,Israel,,3168,Industrials,Integrated Freight & Logistics +CRGY,Crescent Energy Company Class A Common Stock,$9.25,0.03,0.325%,3037531900.00,United States,2021,5047208,Energy,Oil & Gas Production +CRH,CRH PLC Ordinary Shares,$122.46,-1.22,-0.986%,81967306843.00,Ireland,,3422715,Industrials,Building Materials +CRI,Carter's Inc. Common Stock,$33.03,-1.83,-5.25%,1203873080.00,United States,2003,1077855,Consumer Discretionary,Apparel +CRIS,Curis Inc. Common Stock,$0.916,-0.034,-3.579%,11842829.00,United States,,334614,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CRK,Comstock Resources Inc. Common Stock,$22.41,-0.06,-0.267%,6567358202.00,United States,,2810222,Energy,Oil & Gas Production +CRL,Charles River Laboratories International Inc. Common Stock,$216.88,-2.65,-1.207%,10673851350.00,United States,2000,444601,Health Care,Biotechnology: Commercial Physical & Biological Resarch +CRM,Salesforce Inc. Common Stock,$227.96,-0.57,-0.249%,213598520000.00,United States,2004,8465904,Technology,Computer Software: Prepackaged Software +CRMD,CorMedix Inc. Common Stock,$7.75,0.00,0.00%,610615099.00,United States,,1909091,Health Care,Biotechnology: Pharmaceutical Preparations +CRML,Critical Metals Corp. Ordinary Shares,$17.06,-1.21,-6.623%,2008036962.00,British Virgin Islands,,17423094,Basic Materials,Metal Mining +CRMLW,Critical Metals Corp. Warrants,$8.62,-0.84,-8.879%,1014611876.00,British Virgin Islands,,47905,Basic Materials,Metal Mining +CRMT,America's Car-Mart Inc Common Stock,$26.29,-0.52,-1.94%,218070476.00,United States,,75826,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CRNC,Cerence Inc. Common Stock,$12.38,0.37,3.081%,557298501.00,United States,,800366,Technology,Computer Software: Prepackaged Software +CRNT,Ceragon Networks Ltd. Ordinary Shares,$2.29,-0.02,-0.866%,203441491.00,Israel,,425802,Technology,Radio And Television Broadcasting And Communications Equipment +CRNX,Crinetics Pharmaceuticals Inc. Common Stock,$51.32,-1.645,-3.106%,5243278336.00,United States,2018,786878,Health Care,Biotechnology: Pharmaceutical Preparations +CRON,Cronos Group Inc. Common Share,$2.66,-0.05,-1.845%,1018496090.00,Canada,,2568174,Health Care, Medicinal Chemicals and Botanical Products +CROX,Crocs Inc. Common Stock,$82.87,-1.28,-1.521%,4302250496.00,United States,2006,933796,Consumer Discretionary,Shoe Manufacturing +CRS,Carpenter Technology Corporation Common Stock,$331.61,-17.38,-4.98%,16520419563.00,United States,,1275673,Industrials,Steel/Iron Ore +CRSP,CRISPR Therapeutics AG Common Shares,$53.69,-0.57,-1.05%,5116669510.00,Switzerland,2016,1218538,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CRSR,Corsair Gaming Inc. Common Stock,$5.15,-0.13,-2.462%,548862332.00,United States,2020,843514,Technology,Computer peripheral equipment +CRT,Cross Timbers Royalty Trust Common Stock,$8.70,-0.03,-0.344%,52200000.00,United States,1992,12310,Energy,Oil & Gas Production +CRTO,Criteo S.A. American Depositary Shares,$19.71,-0.38,-1.891%,1097056530.00,France,2013,334680,Consumer Discretionary,Advertising +CRUS,Cirrus Logic Inc. Common Stock,$130.66,1.06,0.818%,6667630627.00,United States,1989,441356,Technology,Semiconductors +CRVL,CorVel Corp. Common Stock,$67.09,-1.36,-1.987%,3438157808.00,United States,,224950,Finance,Specialty Insurers +CRVO,CervoMed Inc. Common Stock,$5.40,-0.60,-10.00%,49964683.00,United States,,105578,Health Care,Biotechnology: Pharmaceutical Preparations +CRVS,Corvus Pharmaceuticals Inc. Common Stock,$20.54,-1.54,-6.975%,1696245556.00,United States,2016,3135711,Health Care,Biotechnology: Pharmaceutical Preparations +CRWD,CrowdStrike Holdings Inc. Class A Common Stock,$469.19,-7.47,-1.567%,118282067064.00,United States,2019,2382480,Technology,Computer Software: Prepackaged Software +CRWS,Crown Crafts Inc Common Stock,$2.95,-0.03,-1.007%,31573222.00,United States,,26699,Consumer Discretionary,Textiles +CRWV,CoreWeave Inc. Class A Common Stock,$106.02,-2.84,-2.609%,52831622622.00,United States,2025,36455558,Technology,Computer Software: Prepackaged Software +CSAI,Cloudastructure Inc. Class A Common Stock,$0.8299,-0.0351,-4.058%,16249867.00,United States,,239312,Technology,Computer Software: Programming Data Processing +CSAN,Cosan S.A. ADS,$4.68,0.13,2.857%,2174614641.00,Brazil,2021,2277989,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CSBR,Champions Oncology Inc. Common Stock,$7.62,-0.07,-0.91%,105813804.00,United States,,10575,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CSCO,Cisco Systems Inc. Common Stock (DE),$78.96,0.28,0.356%,311978426694.00,United States,1990,14022934,Telecommunications,Computer Communications Equipment +CSGP,CoStar Group Inc. Common Stock,$65.20,-1.02,-1.54%,27633245973.00,United States,1998,4374831,Real Estate,Real Estate +CSGS,CSG Systems International Inc. Common Stock,$79.79,-0.12,-0.15%,2275624923.00,United States,1996,352134,Technology,EDP Services +CSIQ,Canadian Solar Inc. Common Shares (ON),$21.74,-0.41,-1.851%,1455749423.00,Canada,2006,2120219,Technology,Semiconductors +CSL,Carlisle Companies Incorporated Common Stock,$341.01,-5.09,-1.471%,14249366792.00,United States,,467731,Industrials,Specialty Chemicals +CSPI,CSP Inc. Common Stock,$11.32,-0.27,-2.33%,112122144.00,United States,1982,18869,Technology,EDP Services +CSQ,Calamos Strategic Total Return Common Stock,$19.44,0.03,0.155%,3088775372.00,United States,2004,320023,Finance,Finance Companies +CSR,D/B/A Centerspace Common Stock,$63.97,-0.39,-0.606%,1068520848.00,United States,,178197,Real Estate,Real Estate Investment Trusts +CSTE,Caesarstone Ltd. Ordinary Shares,$2.33,-0.11,-4.508%,80515077.00,Israel,2012,91251,Industrials,Building Materials +CSTL,Castle Biosciences Inc. Common Stock,$39.51,-3.33,-7.773%,1153243917.00,United States,2019,560711,Health Care,Medical Specialities +CSTM,Constellium SE Ordinary Shares (France),$23.07,0.38,1.675%,3179087042.00,Netherlands,2013,955440,Industrials,Metal Fabrications +CSV,Carriage Services Inc. Common Stock,$41.70,-0.41,-0.974%,656574548.00,United States,,70679,Consumer Discretionary,Other Consumer Services +CSW,CSW Industrials Inc. Common Stock,$299.96,-15.13,-4.802%,5005344932.00,United States,,226636,Industrials,Home Furnishings +CSWC,Capital Southwest Corporation Common Stock,$23.24,-0.14,-0.599%,1335533034.00,United States,,357320,Consumer Discretionary,Textiles +CSX,CSX Corporation Common Stock,$37.38,-0.29,-0.77%,69606679415.00,United States,,13056794,Industrials,Railroads +CTA^A,EIDP Inc. Preferred Stock $3.50 Series,$54.42,0.00,0.00%,,United States,,6,, +CTA^B,EIDP Inc. Preferred Stock $4.50 Series,$68.40,0.48,0.707%,,United States,,2485,, +CTAS,Cintas Corporation Common Stock,$189.16,-2.05,-1.072%,75643125437.00,United States,1983,1379122,Industrials,Garments and Clothing +CTBB,Qwest Corporation 6.5% Notes due 2056,$18.98,0.12,0.636%,19.00,United States,2016,19376,Telecommunications,Telecommunications Equipment +CTBI,Community Trust Bancorp Inc. Common Stock,$60.14,-1.22,-1.988%,1089487039.00,United States,,62662,Finance,Major Banks +CTDD,Qwest Corporation 6.75% Notes due 2057,$19.1495,-0.0005,-0.003%,19.00,United States,2017,19324,Telecommunications,Telecommunications Equipment +CTEV,Claritev Corporation Class A Common Stock,$26.98,-0.06,-0.222%,445861875.00,United States,2020,94228,Real Estate,Real Estate +CTGO,Contango ORE Inc. Common Stock,$33.00,0.44,1.351%,493813584.00,United States,2021,281329,Basic Materials,Precious Metals +CTKB,Cytek Biosciences Inc. Common Stock,$5.12,-0.06,-1.158%,654667930.00,United States,2021,705556,Industrials,Biotechnology: Laboratory Analytical Instruments +CTLP,Cantaloupe Inc. Common Stock,$10.75,-0.02,-0.186%,792245212.00,United States,,881939,Miscellaneous,Office Equipment/Supplies/Services +CTM,Castellum Inc. Common Stock,$0.9649,-0.0151,-1.541%,91291842.00,,2022,1376658,Consumer Discretionary,Professional Services +CTMX,CytomX Therapeutics Inc. Common Stock,$5.90,-0.03,-0.506%,999668831.00,United States,2015,3938006,Health Care,Biotechnology: Pharmaceutical Preparations +CTNM,Contineum Therapeutics Inc. Class A Common Stock,$14.43,0.34,2.413%,527119949.00,United States,2024,258808,Health Care,Biotechnology: Pharmaceutical Preparations +CTNT,Cheetah Net Supply Chain Service Inc. Class A Common Stock,$1.12,0.00,0.00%,3667537.00,United States,2023,10289,Consumer Discretionary,Motor Vehicles +CTO,CTO Realty Growth Inc. Common Stock,$17.39,-0.33,-1.862%,562954140.00,United States,1992,219280,Real Estate,Real Estate Investment Trusts +CTO^A,CTO Realty Growth Inc. 6.375% Series A Cumulative Redeemable Preferred Stock,$20.96,-0.14,-0.664%,,United States,,6766,, +CTOR,Citius Oncology Inc. Common Stock,$1.09,-0.01,-0.909%,96219972.00,United States,2022,217308,Health Care,Biotechnology: Pharmaceutical Preparations +CTOS,Custom Truck One Source Inc. Common Stock,$6.29,-0.11,-1.719%,1425059796.00,Cayman Islands,2017,595418,Consumer Discretionary,Diversified Commercial Services +CTRA,Coterra Energy Inc. Common Stock,$27.79,0.27,0.981%,21158682170.00,United States,,5234469,Energy,Oil & Gas Production +CTRE,CareTrust REIT Inc. Common Stock,$36.52,0.38,1.051%,8154927759.00,United States,2022,1503755,Real Estate,Real Estate Investment Trusts +CTRI,Centuri Holdings Inc. Common Stock,$27.93,-0.55,-1.931%,2475970871.00,United States,2024,695746,Utilities,Oil & Gas Production +CTRM,Castor Maritime Inc. Common Shares,$2.36,0.22,10.28%,22803155.00,Cyprus,,217730,Consumer Discretionary,Marine Transportation +CTRN,Citi Trends Inc. Common Stock,$41.75,-0.63,-1.487%,348414605.00,United States,2005,95046,Consumer Discretionary,Clothing/Shoe/Accessory Stores +CTS,CTS Corporation Common Stock,$50.44,-0.63,-1.234%,1465404216.00,United States,,271244,Technology,Electrical Products +CTSH,Cognizant Technology Solutions Corporation Class A Common Stock,$83.30,-1.35,-1.595%,40204451201.00,United States,1998,4031009,Technology,EDP Services +CTSO,Cytosorbents Corporation Common Stock,$0.6831,0.0061,0.901%,42901621.00,United States,,62644,Health Care,Medical/Dental Instruments +CTVA,Corteva Inc. Common Stock ,$73.05,0.05,0.068%,49362222600.00,United States,2019,2742954,Consumer Staples,Farming/Seeds/Milling +CTW,CTW Cayman Class A Ordinary Shares,$1.50,-0.08,-5.063%,93600000.00,Japan,2025,25079,Technology,EDP Services +CTXR,Citius Pharmaceuticals Inc. Common Stock,$0.7801,-0.0475,-5.739%,16197152.00,United States,,252509,Health Care,Biotechnology: Pharmaceutical Preparations +CUB,Lionheart Holdings Class A Ordinary Shares,$10.6601,0.00,0.00%,338656197.00,United States,2024,21,Industrials,Industrial Machinery/Components +CUBB,Customers Bancorp Inc 5.375% Subordinated Notes Due 2034,$22.4023,0.00,0.00%,708438910.00,United States,2019,3,Finance,Major Banks +CUBE,CubeSmart Common Shares,$37.07,-0.29,-0.776%,8453291962.00,United States,,1906036,Real Estate,Real Estate Investment Trusts +CUBI,Customers Bancorp Inc Common Stock,$76.51,0.60,0.79%,2614199571.00,United States,,237027,Finance,Major Banks +CUBWU,Lionheart Holdings Unit,$10.90,0.00,0.00%,0.00,United States,2024,83,Finance,Blank Checks +CUBWW,Lionheart Holdings Warrant,$0.19,0.00,0.00%,0.00,United States,2024,1550,, +CUE,Cue Biopharma Inc. Common Stock,$0.371,-0.0196,-5.018%,33494527.00,United States,2018,1078219,Health Care,Biotechnology: Pharmaceutical Preparations +CUK,Carnival Plc ADS ADS,$28.49,0.00,0.00%,40603757003.00,United States,,2778870,Consumer Discretionary,Marine Transportation +CULP,Culp Inc. Common Stock,$3.72,-0.07,-1.847%,47105556.00,United States,,19937,Consumer Discretionary,Textiles +CUPR,Cuprina Holdings (Cayman) Limited Class A Ordinary Shares,$0.5003,0.0313,6.674%,10506300.00,Singapore,2025,267117,Health Care,Biotechnology: Pharmaceutical Preparations +CURB,Curbline Properties Corp. Common Stock,$23.56,-0.24,-1.008%,2482472907.00,United States,2024,400427,Finance,Real Estate +CURI,CuriosityStream Inc. Class A Common Stock,$3.80,0.01,0.264%,221534327.00,United States,2020,502749,Consumer Discretionary,Movies/Entertainment +CURR,Currenc Group Inc. Ordinary Shares,$1.61,0.01,0.625%,123344425.00,Singapore,,71223,Real Estate,Real Estate +CURV,Torrid Holdings Inc. Common Stock,$1.22,-0.03,-2.40%,121020269.00,United States,2021,497077,Consumer Discretionary,Clothing/Shoe/Accessory Stores +CURX,Curanex Pharmaceuticals Inc Common Stock,$0.344,-0.0076,-2.162%,9749239.00,United States,2025,161640,Health Care,Biotechnology: Pharmaceutical Preparations +CUZ,Cousins Properties Incorporated Common Stock,$24.82,-0.73,-2.857%,4168903685.00,United States,,1943766,Real Estate,Real Estate Investment Trusts +CV,CapsoVision Inc. Common Stock,$5.26,-0.03,-0.567%,246395364.00,United States,2025,124511,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +CVBF,CVB Financial Corporation Common Stock,$19.36,-0.24,-1.224%,2648623556.00,United States,,1322164,Finance,Major Banks +CVCO,Cavco Industries Inc. Common Stock When Issued,$616.11,-16.78,-2.651%,4808761346.00,United States,,171128,Consumer Discretionary,Homebuilding +CVE,Cenovus Energy Inc Common Stock,$19.81,0.33,1.694%,35486227490.00,Canada,,13338302,Energy,Oil & Gas Production +CVEO,Civeo Corporation (Canada) Common Shares,$24.89,-0.16,-0.639%,286613900.00,,2014,30700,Consumer Discretionary,Hotels/Resorts +CVGI,Commercial Vehicle Group Inc. Common Stock,$1.59,-0.01,-0.625%,58402896.00,United States,2004,146441,Consumer Discretionary,Auto Parts:O.E.M. +CVGW,Calavo Growers Inc. Common Stock,$24.87,-0.08,-0.321%,444528345.00,United States,,385061,Consumer Discretionary,Specialty Foods +CVI,CVR Energy Inc. Common Stock,$21.99,-0.08,-0.362%,2210667872.00,United States,2007,1042279,Energy,Integrated oil Companies +CVKD,Cadrenal Therapeutics Inc. Common Stock,$7.66,0.04,0.525%,17910053.00,United States,2023,66032,Health Care,Biotechnology: Pharmaceutical Preparations +CVLG,Covenant Logistics Group Inc. Class A Common Stock,$25.40,-0.11,-0.431%,636198321.00,United States,,86292,Industrials,Trucking Freight/Courier Services +CVLT,Commvault Systems Inc. Common Stock,$89.85,0.72,0.808%,3961878426.00,United States,2006,2982931,Technology,Computer Software: Prepackaged Software +CVM,Cel-Sci Corporation Common Stock,$6.30,-0.21,-3.226%,52975100.00,United States,1997,87204,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +CVNA,Carvana Co. Class A Common Stock,$410.04,-67.68,-14.167%,89201193947.00,United States,2017,19804842,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CVR,Chicago Rivet & Machine Co. Common Stock,$14.02,0.43,3.164%,13545171.00,United States,1930,7221,Industrials,Industrial Machinery/Components +CVRX,CVRx Inc. Common Stock,$7.16,-0.38,-5.04%,187664380.00,United States,2021,233992,Health Care,Medical/Dental Instruments +CVS,CVS Health Corporation Common Stock,$74.03,2.03,2.819%,93976086865.00,United States,,13569718,Consumer Staples,Retail-Drug Stores and Proprietary Stores +CVU,CPI Aerostructures Inc. Common Stock,$4.03,-0.15,-3.589%,53136553.00,United States,2022,87845,Industrials,Military/Government/Technical +CVV,CVD Equipment Corporation Common Stock,$5.27,-0.395,-6.973%,36559771.00,United States,,68564,Technology,Industrial Machinery/Components +CVX,Chevron Corporation Common Stock,$169.93,0.88,0.521%,342157724978.00,United States,,9200244,Energy,Integrated oil Companies +CW,Curtiss-Wright Corporation Common Stock,$664.46,4.28,0.648%,24501721965.00,United States,,182525,Technology,Industrial Machinery/Components +CWAN,Clearwater Analytics Holdings Inc. Class A Common Stock,$24.13,0.00,0.00%,7061896755.00,United States,2021,8682271,Technology,Computer Software: Prepackaged Software +CWBC,Community West Bancshares Common Stock,$23.33,-0.14,-0.597%,446966125.00,United States,,125995,Finance,Major Banks +CWCO,Consolidated Water Co. Ltd. Ordinary Shares,$37.20,-0.97,-2.541%,592645699.00,Cayman Islands,,68450,Utilities,Water Supply +CWD,CaliberCos Inc. Class A Common Stock,$1.32,-0.04,-2.941%,8625301.00,United States,2023,48307,Finance,Real Estate +CWEN,Clearway Energy Inc. Class C Common Stock,$36.95,0.13,0.353%,7529437254.00,United States,2015,900857,Utilities,Electric Utilities: Central +CWH,Camping World Holdings Inc. Class A Common Stock,$13.86,-0.38,-2.669%,1417691167.00,United States,2016,2818779,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +CWK,Cushman & Wakefield Ltd. Common Shares,$16.53,0.25,1.536%,3828423178.00,,2018,1545731,Finance,Real Estate +CWST,Casella Waste Systems Inc. Class A Common Stock,$104.39,-1.43,-1.351%,6628088135.00,United States,1997,587257,Utilities,Environmental Services +CWT,California Water Service Group Common Stock,$43.62,-0.92,-2.066%,2599374294.00,United States,,456328,Utilities,Water Supply +CX,Cemex S.A.B. de C.V. Sponsored ADR,$13.17,0.29,2.252%,19106284309.00,Mexico,,6289341,Industrials,Building Materials +CXAI,CXApp Inc. Class A Common Stock,$0.338,0.013,4.00%,10780824.00,United States,2021,28347229,Technology,EDP Services +CXAIW,CXApp Inc. Warrant,$0.0346,0.0021,6.462%,1103599.00,United States,2021,54735,Technology,EDP Services +CXDO,Crexendo Inc. Common Stock,$6.88,-0.23,-3.235%,211429610.00,United States,,164716,Telecommunications,Telecommunications Equipment +CXE,MFS High Income Municipal Trust Common Stock,$3.77,0.025,0.668%,118852164.00,United States,1989,36209,Finance,Investment Managers +CXH,MFS Investment Grade Municipal Trust Common Stock,$8.07,0.05,0.623%,73519677.00,United States,1989,18998,Finance,Investment Managers +CXM,Sprinklr Inc. Class A Common Stock,$6.57,0.01,0.152%,1620727914.00,United States,2021,1822904,Technology,Computer Software: Prepackaged Software +CXT,Crane NXT Co. Common Stock,$50.14,0.46,0.926%,2879141035.00,United States,,481120,Industrials,Metal Fabrications +CXW,CoreCivic Inc. Common Stock,$18.47,-0.19,-1.018%,1931678578.00,United States,,987585,Real Estate,Real Estate Investment Trusts +CYBR,CyberArk Software Ltd. Ordinary Shares,$445.66,0.12,0.027%,22041770036.00,Israel,2014,386805,Technology,Computer Software: Prepackaged Software +CYCN,Cyclerion Therapeutics Inc. Common Stock,$1.45,-0.05,-3.333%,5691705.00,United States,,53645,Health Care,Biotechnology: Pharmaceutical Preparations +CYCU,Cycurion Inc. Common Stock,$2.32,-0.08,-3.333%,9716594.00,United States,2025,79447,Technology,EDP Services +CYCUW,Cycurion Inc. Warrant,$0.0301,0.00,0.00%,126064.00,United States,2025,7847,Technology,EDP Services +CYD,China Yuchai International Limited Common Stock,$46.00,-1.60,-3.361%,1725842812.00,Singapore,1994,191033,Industrials,Industrial Machinery/Components +CYH,Community Health Systems Inc. Common Stock,$3.09,-0.04,-1.278%,428025610.00,United States,2000,2413287,Health Care,Hospital/Nursing Management +CYN,Cyngn Inc. Common Stock,$1.96,-0.06,-2.97%,15629785.00,United States,2021,2351514,Technology,EDP Services +CYPH,Cypherpunk Technologies Inc. Common Stock,$0.7956,-0.075,-8.615%,45072204.00,United States,,1921113,Health Care,Biotechnology: Pharmaceutical Preparations +CYRX,CryoPort Inc. Common Stock,$9.78,-0.45,-4.399%,489673881.00,United States,,274003,Health Care,Biotechnology: Pharmaceutical Preparations +CYTK,Cytokinetics Incorporated Common Stock,$65.14,1.13,1.765%,7964337475.00,United States,2004,1244664,Health Care,Biotechnology: Pharmaceutical Preparations +CZFS,Citizens Financial Services Inc. Common Stock,$61.15,-0.66,-1.068%,293909954.00,United States,,17372,Finance,Major Banks +CZNC,Citizens & Northern Corp Common Stock,$21.39,-0.27,-1.247%,380782063.00,United States,,42940,Finance,Major Banks +CZR,Caesars Entertainment Inc. Common Stock,$21.28,-0.30,-1.39%,4343417027.00,United States,,5075762,Consumer Discretionary,Hotels/Resorts +CZWI,Citizens Community Bancorp Inc. Common Stock,$17.74,-0.31,-1.717%,171363876.00,United States,2006,29510,Finance,Savings Institutions +D,Dominion Energy Inc. Common Stock,$60.71,-0.42,-0.687%,51841075047.00,United States,,3386194,Utilities,Electric Utilities: Central +DAAQ,Digital Asset Acquisition Corp. Class A Ordinary shares,$10.21,0.00,0.00%,0.00,United States,2025,16527,Finance,Blank Checks +DAAQU,Digital Asset Acquisition Corp. Units,$10.42,0.02,0.192%,0.00,United States,2025,19409,Finance,Blank Checks +DAAQW,Digital Asset Acquisition Corp. Warrant,$0.4692,0.0116,2.535%,0.00,United States,2025,5987,Finance,Blank Checks +DAC,Danaos Corporation Common Stock,$103.00,0.60,0.586%,1922938930.00,Greece,2006,80665,Consumer Discretionary,Marine Transportation +DAIC,CID HoldCo Inc. Common Stock,$0.437,0.017,4.048%,12136942.00,United States,,86667,Technology,EDP Services +DAICW,CID HoldCo Inc. Warrants,$0.0537,0.0162,43.20%,1491427.00,United States,,4220,Technology,EDP Services +DAIO,Data I/O Corporation Common Stock,$3.06,0.02,0.658%,28739281.00,United States,1981,4733,Industrials,Electrical Products +DAKT,Daktronics Inc. Common Stock,$21.93,-0.05,-0.227%,1069039627.00,United States,1994,313173,Consumer Discretionary,Miscellaneous manufacturing industries +DAL,Delta Air Lines Inc. Common Stock,$65.83,-0.31,-0.469%,42984539017.00,United States,,6165790,Consumer Discretionary,Air Freight/Delivery Services +DAN,Dana Incorporated Common Stock ,$29.15,-0.76,-2.541%,3405809219.00,United States,,1458445,Consumer Discretionary,Auto Parts:O.E.M. +DAO,Youdao Inc. American Depositary Shares each representing one Class A Ordinary Share,$10.79,-0.53,-4.682%,1290152197.00,China,2019,179114,Real Estate,Other Consumer Services +DAR,Darling Ingredients Inc. Common Stock,$44.02,0.02,0.045%,6963351330.00,United States,1997,2200682,Consumer Staples,Packaged Foods +DARE,Dare Bioscience Inc. Common Stock,$1.92,-0.05,-2.538%,27435320.00,United States,2014,59762,Health Care,Biotechnology: Pharmaceutical Preparations +DASH,DoorDash Inc. Class A Common Stock,$206.66,-0.70,-0.338%,89070153937.00,United States,,3270215,Technology,EDP Services +DAVA,Endava plc American Depositary Shares (each representing one Class A Ordinary Share),$6.60,-0.15,-2.222%,358562180.00,United Kingdom,2018,231703,Technology,EDP Services +DAVE,Dave Inc. Class A Common Stock,$174.89,-2.62,-1.476%,2361728901.00,United States,,341590,Finance,Finance: Consumer Services +DAVEW,Dave Inc. Warrants,$0.44,-0.0494,-10.094%,5941796.00,United States,,6500,Finance,Finance: Consumer Services +DAWN,Day One Biopharmaceuticals Inc. Common Stock,$11.78,-0.55,-4.461%,1209517414.00,United States,2021,1357848,Health Care,Biotechnology: Pharmaceutical Preparations +DAY,Dayforce Inc. Common Stock,$69.36,0.03,0.043%,11100025034.00,United States,2018,2461845,Technology,Computer Software: Prepackaged Software +DB,Deutsche Bank AG Common Stock,$39.54,-0.79,-1.959%,77033919073.00,Germany,,4924378,Finance,Major Banks +DBD,Diebold Nixdorf Incorporated Common stock,$69.45,1.45,2.132%,2490973984.00,United States,2023,263748,Miscellaneous,Office Equipment/Supplies/Services +DBGI,Digital Brands Group Inc. Common Stock,$8.35,0.91,12.231%,68372606.00,United States,2025,405635,Consumer Discretionary,Clothing/Shoe/Accessory Stores +DBI,Designer Brands Inc. Class A Common Stock,$6.51,-0.40,-5.789%,323130959.00,United States,,723386,Consumer Discretionary,Clothing/Shoe/Accessory Stores +DBL,DoubleLine Opportunistic Credit Fund Common Shares of Beneficial Interest,$15.02,-0.04,-0.266%,0.00,United States,2012,35152,, +DBRG,DigitalBridge Group Inc.,$15.38,0.00,0.00%,2809532657.00,United States,2014,3485021,Real Estate,Real Estate Investment Trusts +DBRG^H,DigitalBridge Group Inc. 7.125% Series H ,$19.355,0.1076,0.559%,,United States,,21184,, +DBRG^I,DigitalBridge Group Inc. 7.15% Series I ,$19.43,-0.02,-0.103%,,United States,,11249,, +DBRG^J,DigitalBridge Group Inc. 7.125% Series J ,$19.40,0.08,0.414%,,United States,,6072,, +DBVT,DBV Technologies S.A. American Depositary Shares,$23.77,-0.67,-2.741%,803966149.00,France,2014,295732,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +DBX,Dropbox Inc. Class A Common Stock,$26.23,-0.30,-1.131%,6786732390.00,United States,2018,3403323,Technology,Computer Software: Prepackaged Software +DC,Dakota Gold Corp. Common Stock,$7.00,0.38,5.74%,792834658.00,United States,2022,1417492,Basic Materials,Metal Mining +DCBO,Docebo Inc. Common Shares,$18.52,-0.19,-1.015%,532169681.00,Canada,,104969,Technology,Computer Software: Prepackaged Software +DCGO,DocGo Inc. Common Stock,$0.8244,-0.0471,-5.404%,80637344.00,United States,2020,662849,Health Care,Medical/Nursing Services +DCI,Donaldson Company Inc. Common Stock,$101.75,0.70,0.693%,11735507902.00,United States,,915587,Industrials,Pollution Control Equipment +DCO,Ducommun Incorporated Common Stock,$111.12,-0.17,-0.153%,1660805298.00,United States,,125244,Industrials,Military/Government/Technical +DCOM,Dime Community Bancshares Inc. Common Stock,$33.22,0.18,0.545%,1458170141.00,United States,,261903,Finance,Major Banks +DCOMG,Dime Community Bancshares Inc. 9.000% Fixed-to-Floating Rate Subordinated Notes due 2034,$26.73,0.16,0.602%,1046443067.00,United States,,422,Finance,Major Banks +DCOMP,Dime Community Bancshares Inc. Fixed-Rate Non-Cumulative Perpetual Preferred Stock Series A,$19.40,0.3101,1.624%,851550293.00,United States,,5890,Finance,Major Banks +DCOY,Decoy Therapeutics Inc. Common Stock,$0.8638,0.0363,4.387%,5514652.00,United States,2015,265590,Health Care,Biotechnology: Pharmaceutical Preparations +DCTH,Delcath Systems Inc. Common Stock,$9.92,-0.29,-2.84%,344224000.00,United States,,514745,Health Care,Medical/Dental Instruments +DCX,Digital Currency X Technology Inc. Class A Ordinary Shares,$3.06,-0.14,-4.375%,1117950.00,Cayman Islands,,28511,Industrials,Auto Manufacturing +DD,DuPont de Nemours Inc. Common Stock,$44.63,0.02,0.045%,18698868710.00,United States,2017,3382954,Industrials,Major Chemicals +DDC,DDC Enterprise Limited Class A Ordinary Shares,$2.87,-0.02,-0.692%,70058221.00,,2023,83727,Consumer Staples,Packaged Foods +DDD,3D Systems Corporation Common Stock,$2.33,-0.07,-2.917%,299959573.00,United States,,2828418,Technology,Computer Software: Prepackaged Software +DDI,DoubleDown Interactive Co. Ltd. American Depository Shares,$8.86,0.08,0.911%,439043478.00,South Korea,2021,41764,Technology,EDP Services +DDL,Dingdong (Cayman) Limited American Depositary Shares (each two representing three Ordinary Shares),$2.82,-0.04,-1.399%,666162072.00,Cayman Islands,2021,1032606,Consumer Discretionary,Catalog/Specialty Distribution +DDOG,Datadog Inc. Class A Common Stock,$140.56,2.35,1.70%,49290280479.00,United States,2019,6364099,Technology,Computer Software: Prepackaged Software +DDS,Dillard's Inc. Common Stock,$603.73,-7.83,-1.28%,9426015963.00,United States,,128476,Consumer Discretionary,Department/Specialty Retail Stores +DDT,Dillard's Capital Trust I,$26.15,-0.04,-0.153%,408279061.00,United States,,12519,Consumer Discretionary,Department/Specialty Retail Stores +DE,Deere & Company Common Stock,$525.01,5.82,1.121%,141986558879.00,United States,,1106772,Industrials,Industrial Machinery/Components +DEA,Easterly Government Properties Inc. Common Stock,$22.54,-0.66,-2.845%,1039282863.00,United States,2015,546807,Real Estate,Real Estate Investment Trusts +DEC,Diversified Energy Company Common Stock,$12.99,-0.16,-1.217%,997064220.00,,2025,489886,, +DECK,Deckers Outdoor Corporation Common Stock,$97.62,-2.54,-2.536%,14227610597.00,United States,1993,3005710,Consumer Discretionary,Shoe Manufacturing +DEFT,Defi Technologies Inc. Common Stock,$0.8165,-0.0524,-6.031%,315069367.00,Canada,,4360124,Finance,Finance: Consumer Services +DEI,Douglas Emmett Inc. Common Stock,$10.35,-0.17,-1.616%,1733232311.00,United States,2006,2864692,Real Estate,Real Estate Investment Trusts +DELL,Dell Technologies Inc. Class C Common Stock ,$117.32,2.66,2.32%,77746744459.00,United States,2018,5300447,Technology,Computer Manufacturing +DEO,Diageo plc Common Stock,$88.75,-0.02,-0.023%,49398529119.00,United Kingdom,,1335786,Consumer Staples,Beverages (Production/Distribution) +DERM,Journey Medical Corporation Common Stock,$8.33,-0.39,-4.472%,277027378.00,United States,2021,103376,Health Care,Biotechnology: Pharmaceutical Preparations +DEVS,DevvStream Corp. Common Stock,$1.19,-0.13,-9.848%,5212214.00,Canada,2024,599310,Finance,Finance/Investors Services +DFDV,DeFi Development Corp. Common Stock,$5.86,-0.20,-3.30%,172683412.00,United States,2023,620020,Finance,Finance: Consumer Services +DFDVW,DeFi Development Corp. Warrant,$1.50,0.07,4.895%,44202239.00,United States,,2591,, +DFH,Dream Finders Homes Inc. Class A Common Stock,$18.43,0.02,0.109%,1709469453.00,United States,2022,504601,Consumer Discretionary,Homebuilding +DFIN,Donnelley Financial Solutions Inc. Common Stock ,$51.96,-0.10,-0.192%,1378866833.00,United States,2016,145224,Consumer Discretionary,Other Consumer Services +DFLI,Dragonfly Energy Holdings Corp. Common Stock (NV),$3.62,-0.11,-2.949%,43724912.00,United States,2021,609982,Miscellaneous,Industrial Machinery/Components +DFLIW,Dragonfly Energy Holdings Corp. Warrant,$0.071,0.0014,2.011%,857588.00,United States,2021,28073,Miscellaneous,Industrial Machinery/Components +DFP,Flaherty & Crumrine Dynamic Preferred and Income Fund Inc. Common Stock,$21.25,-0.05,-0.235%,0.00,,2013,32599,Finance,Investment Managers +DFSC,DEFSEC Technologies Inc. Common Stock,$2.08,0.13,6.667%,4146742.00,Canada,,86380,Technology,Computer Software: Prepackaged Software +DFSCW,DEFSEC Technologies Inc. Warrant,$0.0305,0.00,0.00%,60806.00,Canada,,401,Technology,Computer Software: Prepackaged Software +DFTX,Definium Therapeutics Inc. Common Shares,$16.84,-0.64,-3.661%,1658896258.00,United States,,1919987,Health Care, Medicinal Chemicals and Botanical Products +DG,Dollar General Corporation Common Stock,$145.04,-2.62,-1.774%,31926041050.00,United States,2009,2117822,Consumer Discretionary,Department/Specialty Retail Stores +DGICA,Donegal Group Inc. Class A Common Stock,$18.16,-0.01,-0.055%,665410748.00,United States,,80890,Finance,Property-Casualty Insurers +DGICB,Donegal Group Inc. Class B Common Stock,$16.16,0.58,3.723%,592127626.00,United States,1986,1060,Finance,Property-Casualty Insurers +DGII,Digi International Inc. Common Stock,$44.90,1.31,3.005%,1671743426.00,United States,1989,422629,Telecommunications,Computer Communications Equipment +DGNX,Diginex Limited Ordinary Shares,$1.20,-0.26,-17.808%,242340125.00,Hong Kong,2025,4832373,Technology,EDP Services +DGX,Quest Diagnostics Incorporated Common Stock,$182.74,-1.50,-0.814%,20328429232.00,United States,,838875,Health Care,Medical Specialities +DGXX,Digi Power X Inc. Subordinate Voting Shares,$2.91,-0.02,-0.683%,181640957.00,Canada,,2615321,Finance,Finance: Consumer Services +DH,Definitive Healthcare Corp. Class A Common Stock,$2.36,-0.03,-1.255%,243795993.00,United States,2021,384417,Technology,Computer Software: Prepackaged Software +DHC,Diversified Healthcare Trust Common Shares of Beneficial Interest,$5.56,-0.07,-1.243%,1346337109.00,United States,,725469,Real Estate,Real Estate Investment Trusts +DHCNI,Diversified Healthcare Trust 5.625% Senior Notes due 2042,$17.12,-0.21,-1.212%,4133013792.00,United States,,1550,Real Estate,Real Estate Investment Trusts +DHCNL,Diversified Healthcare Trust 6.25% Senior Notes Due 2046,$19.00,0.40,2.151%,4586872783.00,United States,,11236,Real Estate,Real Estate Investment Trusts +DHF,BNY Mellon High Yield Strategies Fund Common Stock,$2.53,0.00,0.00%,0.00,United States,1998,458440,Finance,Finance Companies +DHI,D.R. Horton Inc. Common Stock,$150.17,1.58,1.063%,43504758827.00,United States,,2959849,Consumer Discretionary,Homebuilding +DHIL,Diamond Hill Investment Group Inc. Class A Common Stock,$170.66,0.10,0.059%,461685815.00,United States,,13317,Finance,Investment Managers +DHR,Danaher Corporation Common Stock,$224.54,-11.21,-4.755%,158603730876.00,United States,,7764383,Industrials,Industrial Machinery/Components +DHT,DHT Holdings Inc.,$13.82,0.21,1.543%,2218911256.00,Jersey,2005,2820373,Consumer Discretionary,Marine Transportation +DHX,DHI Group Inc. Common Stock,$1.81,0.00,0.00%,85354219.00,United States,2007,69756,Real Estate,Real Estate +DHY,Credit Suisse High Yield Credit Fund Common Stock,$2.02,0.01,0.498%,0.00,United States,1998,531014,Finance,Finance/Investors Services +DIAX,Nuveen Dow 30SM Dynamic Overwrite Fund Common Shares of Beneficial Interest,$15.46,0.06,0.39%,0.00,,2014,124525,Finance,Finance Companies +DIBS,1stdibs.com Inc. Common Stock,$5.78,-0.06,-1.027%,211630931.00,United States,2021,111202,Consumer Discretionary,Catalog/Specialty Distribution +DIN,Dine Brands Global Inc. Common Stock,$34.05,0.01,0.029%,491126951.00,United States,,302294,Consumer Discretionary,Restaurants +DINO,HF Sinclair Corporation Common Stock,$50.77,0.82,1.642%,9339051789.00,United States,1960,2318366,Energy,Natural Gas Distribution +DIOD,Diodes Incorporated Common Stock,$59.98,1.82,3.129%,2782192153.00,United States,,501123,Technology,Semiconductors +DIS,Walt Disney Company (The) Common Stock,$109.56,-1.05,-0.949%,194292273913.00,United States,,9016629,Consumer Discretionary,Services-Misc. Amusement & Recreation +DIT,AMCON Distributing Company Common Stock,$112.00,4.81,4.487%,72879408.00,United States,1999,1318,Consumer Discretionary,Food Distributors +DJCO,Daily Journal Corp. (S.C.) Common Stock,$568.97,-17.64,-3.007%,783882486.00,United States,,45811,Consumer Discretionary,Newspapers/Magazines +DJT,Trump Media & Technology Group Corp. Common Stock,$13.61,-0.47,-3.338%,3810767826.00,United States,2024,3371334,Technology,Computer Software: Programming Data Processing +DJTWW,Trump Media & Technology Group Corp. Warrants,$6.70,-0.17,-2.475%,1875984161.00,United States,2021,23921,Technology,Computer Software: Programming Data Processing +DK,Delek US Holdings Inc. Common Stock,$28.67,0.46,1.631%,1721678025.00,United States,2017,1170055,Energy,Integrated oil Companies +DKI,DarkIris Inc. Class A Ordinary Shares,$0.38,-0.0004,-0.105%,6650000.00,Hong Kong,2025,30024,Technology,Computer Software: Prepackaged Software +DKL,Delek Logistics Partners L.P. Common Units representing Limited Partner Interests,$50.21,0.23,0.46%,2685250934.00,United States,2012,46590,Energy,Natural Gas Distribution +DKNG,DraftKings Inc. Class A Common Stock,$30.12,0.01,0.033%,14992907941.00,United States,2019,11391800,Consumer Discretionary,Services-Misc. Amusement & Recreation +DKS,Dick's Sporting Goods Inc Common Stock,$205.68,-0.13,-0.063%,18504804586.00,United States,2002,702323,Consumer Discretionary,Other Specialty Stores +DLB,Dolby Laboratories Common Stock,$61.19,-0.17,-0.277%,5844005470.00,United States,2005,744590,Miscellaneous,Multi-Sector Companies +DLHC,DLH Holdings Corp.,$6.04,-0.02,-0.33%,87537931.00,United States,,9557,Consumer Discretionary,Professional Services +DLNG,Dynagas LNG Partners LP Common Units,$3.88,-0.13,-3.242%,142309794.00,Greece,,167149,Consumer Discretionary,Marine Transportation +DLNG^A,Dynagas LNG Partners LP 9.00% Series A Cumulative Redeemable Preferred Units,$26.93,0.21,0.786%,,Greece,,2693,, +DLO,DLocal Limited Class A Common Shares,$14.46,-0.08,-0.55%,4246952841.00,Uruguay,2021,712477,Real Estate,Real Estate +DLPN,Dolphin Entertainment Inc. Common Stock,$1.69,0.03,1.807%,20486893.00,United States,,24424,Consumer Discretionary,Other Consumer Services +DLR,Digital Realty Trust Inc. Common Stock,$163.21,0.05,0.031%,56062888302.00,United States,2004,1383882,Real Estate,Real Estate Investment Trusts +DLR^J,Digital Realty Trust Inc. 5.250% Series J Cumulative Redeemable Preferred Stock,$20.85,-0.17,-0.809%,,United States,,13542,, +DLR^K,Digital Realty Trust Inc. 5.850% Series K Cumulative Redeemable Preferred Stock par value $0.01 per share,$23.673,-0.247,-1.033%,,United States,,20473,, +DLR^L,Digital Realty Trust Inc. 5.200% Series L Cumulative Redeemable Preferred Stock,$20.95,-0.0701,-0.333%,,United States,,20586,, +DLTH,Duluth Holdings Inc. Class B Common Stock,$2.54,0.07,2.834%,93284528.00,United States,2015,65567,Consumer Discretionary,Clothing/Shoe/Accessory Stores +DLTR,Dollar Tree Inc. Common Stock,$119.10,-2.74,-2.249%,23683414572.00,United States,1995,3332371,Consumer Discretionary,Department/Specialty Retail Stores +DLX,Deluxe Corporation Common Stock,$23.90,-0.50,-2.049%,1075683170.00,United States,,907005,Consumer Discretionary,Publishing +DLXY,Delixy Holdings Limited Ordinary Shares,$0.885,0.00,0.00%,14469750.00,Singapore,2025,34905,Energy,Oil Refining/Marketing +DLY,DoubleLine Yield Opportunities Fund Common Shares of Beneficial Interest,$14.75,0.02,0.136%,707200240.00,United States,2020,205496,Finance,Investment Managers +DMA,Destra Multi-Alternative Fund Common Stock,$8.97,0.01,0.112%,0.00,,2022,8621,Finance,Trusts Except Educational Religious and Charitable +DMAA,Drugs Made In America Acquisition Corp. Ordinary Shares,$10.41,0.00,0.00%,0.00,United States,2025,11012,, +DMAAR,Drugs Made In America Acquisition Corp. Rights,$0.14,0.0001,0.071%,0.00,United States,2025,272,Finance,Blank Checks +DMAAU,Drugs Made In America Acquisition Corp. Units,$10.5501,0.00,0.00%,0.00,United States,2025,13,, +DMAC,DiaMedica Therapeutics Inc. Common Stock,$8.44,-0.32,-3.653%,439533585.00,United States,2018,240641,Health Care,Biotechnology: Pharmaceutical Preparations +DMB,BNY Mellon Municipal Bond Infrastructure Fund Inc. Common Stock,$11.13,0.09,0.815%,0.00,,2013,68408,Finance,Trusts Except Educational Religious and Charitable +DMII,Drugs Made In America Acquisition II Corp. Ordinary Shares,$9.96,0.00,0.00%,0.00,United States,2025,951,Finance,Blank Checks +DMIIR,Drugs Made In America Acquisition II Corp. Right,$0.13,0.001,0.775%,0.00,United States,2025,9576,Finance,Blank Checks +DMIIU,Drugs Made In America Acquisition II Corp. Unit,$10.05,0.00,0.00%,0.00,United States,2025,151,, +DMLP,Dorchester Minerals L.P. Common Units Representing Limited Partnership Interests,$25.34,0.11,0.436%,1222793103.00,United States,,161036,Energy,Oil & Gas Production +DMO,Western Asset Mortgage Opportunity Fund Inc. Common Stock,$10.95,0.03,0.275%,0.00,United States,2010,49060,Finance,Trusts Except Educational Religious and Charitable +DMRC,Digimarc Corporation Common Stock,$6.33,0.19,3.094%,137721728.00,United States,,193490,Technology,EDP Services +DNA,Ginkgo Bioworks Holdings Inc. Class A Common Stock,$9.43,-0.28,-2.884%,571365765.00,United States,2021,537735,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +DNLI,Denali Therapeutics Inc. Common Stock,$20.84,-0.41,-1.929%,3246217186.00,United States,2017,2632988,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +DNMX,Dynamix Corporation III Class A Ordinary Shares,$9.93,0.00,0.00%,0.00,United States,2025,685,Finance,Blank Checks +DNMXU,Dynamix Corporation III Unit,$10.10,0.00,0.00%,0.00,United States,2025,1414,Finance,Blank Checks +DNN,Denison Mines Corp Ordinary Shares (Canada),$4.31,0.37,9.391%,3867322232.00,Canada,,73991618,Basic Materials,Other Metals and Minerals +DNOW,DNOW Inc. Common Stock,$14.88,0.05,0.337%,1562578054.00,United States,2014,2427397,Consumer Discretionary,Oil and Gas Field Machinery +DNP,DNP Select Income Fund Inc. Common Stock,$10.14,0.00,0.00%,0.00,United States,1987,472523,Finance,Investment Managers +DNTH,Dianthus Therapeutics Inc. Common Stock,$50.50,0.19,0.378%,2165238758.00,United States,2018,467251,Health Care,Biotechnology: Pharmaceutical Preparations +DNUT,Krispy Kreme Inc. Common Stock,$3.16,-0.20,-5.952%,541308000.00,United States,2021,3066990,Consumer Staples,Food Chains +DOC,Healthpeak Properties Inc. Common Stock,$17.15,-0.56,-3.162%,11918389464.00,United States,,9947768,Real Estate,Real Estate Investment Trusts +DOCN,DigitalOcean Holdings Inc. Common Stock,$60.24,-0.01,-0.017%,5511486634.00,United States,2021,5746742,Technology,Computer Software: Programming Data Processing +DOCS,Doximity Inc. Class A Common Stock,$38.73,-0.23,-0.59%,7291746248.00,United States,2021,1874699,Technology,EDP Services +DOCU,DocuSign Inc. Common Stock,$56.215,0.795,1.435%,11258332079.00,United States,1989,3047984,Technology,Computer Software: Prepackaged Software +DOGZ,Dogness (International) Corporation Class A Common Stock,$1.32,-0.30,-18.519%,19154069.00,China,2017,2630360,Consumer Discretionary,Miscellaneous manufacturing industries +DOLE,Dole plc Ordinary Shares,$15.52,-0.16,-1.02%,1476542288.00,Ireland,2021,576615,Consumer Staples,Farming/Seeds/Milling +DOMH,Dominari Holdings Inc. Common Stock,$4.10,-0.09,-2.148%,66511984.00,United States,,144638,Health Care,Biotechnology: Pharmaceutical Preparations +DOMO,Domo Inc. Class B Common Stock,$6.29,0.21,3.454%,262912515.00,United States,2018,1156275,Technology,Computer Software: Prepackaged Software +DOO,BRP Inc. Common Subordinate Voting Shares,$78.55,-1.06,-1.331%,5761983957.00,Canada,,225069,Consumer Discretionary,Industrial Specialties +DORM,Dorman Products Inc. Common Stock,$122.46,-1.83,-1.472%,3742701384.00,United States,,194491,Consumer Discretionary,Auto Parts:O.E.M. +DOUG,Douglas Elliman Inc. Common Stock,$2.70,0.00,0.00%,239811219.00,United States,2021,462104,Finance,Real Estate +DOV,Dover Corporation Common Stock,$206.00,-1.26,-0.608%,28253563938.00,United States,,1392957,Industrials,Industrial Machinery/Components +DOW,Dow Inc. Common Stock ,$27.78,-0.03,-0.108%,19745118150.00,United States,2019,17825474,Industrials,Major Chemicals +DOX,Amdocs Limited Ordinary Shares,$81.82,-0.56,-0.68%,8832431281.00,Guernsey,,719366,Technology,EDP Services +DOYU,DouYu International Holdings Limited ADS,$6.56,-0.05,-0.756%,197973315.00,China,2019,36577,Technology,Computer Software: Programming Data Processing +DPG,Duff & Phelps Utility and Infrastructure Fund Inc.,$13.47,0.04,0.298%,0.00,United States,2011,86484,Finance,Trusts Except Educational Religious and Charitable +DPRO,Draganfly Inc. Common Shares,$8.39,-0.13,-1.526%,195159891.00,Canada,,1260567,Industrials,Aerospace +DPZ,Domino's Pizza Inc Common Stock,$405.37,-8.50,-2.054%,13695919191.00,United States,2004,654780,Consumer Discretionary,Food Distributors +DQ,DAQO New Energy Corp. American Depositary Shares each representing five ordinary shares,$26.54,-0.68,-2.498%,1779685216.00,China,2010,654397,Technology,Semiconductors +DRCT,Direct Digital Holdings Inc. Class A Common Stock,$3.09,0.12,4.04%,2318257.00,United States,2022,706992,Consumer Discretionary,Advertising +DRD,DRDGOLD Limited American Depositary Shares,$39.18,0.90,2.351%,3387458566.00,South Africa,,321746,Basic Materials,Precious Metals +DRDB,Roman DBDR Acquisition Corp. II Ordinary shares,$10.51,0.00,0.00%,0.00,United States,2025,24290,, +DRDBW,Roman DBDR Acquisition Corp. II Warrants,$0.70,0.00,0.00%,0.00,United States,2025,2,, +DRH,Diamondrock Hospitality Company Common Stock,$9.04,-0.21,-2.27%,1841476765.00,United States,2005,2268773,Real Estate,Real Estate Investment Trusts +DRI,Darden Restaurants Inc. Common Stock,$196.50,-0.40,-0.203%,22624862429.00,United States,,886632,Consumer Discretionary,Restaurants +DRIO,DarioHealth Corp. Common Stock,$10.96,-0.11,-0.994%,74179297.00,Israel,,17523,Health Care,Medical/Dental Instruments +DRMA,Dermata Therapeutics Inc. Common Stock,$2.52,-0.06,-2.326%,7145064.00,United States,2021,270069,Health Care,Biotechnology: Pharmaceutical Preparations +DRMAW,Dermata Therapeutics Inc. Warrant,$0.0196,-0.0001,-0.508%,55573.00,United States,2021,3200,Health Care,Biotechnology: Pharmaceutical Preparations +DRS,Leonardo DRS Inc. Common Stock,$42.47,0.31,0.735%,11298155011.00,Israel,,1174871,Industrials,Industrial Machinery/Components +DRTS,Alpha Tau Medical Ltd. Ordinary Shares,$7.60,0.28,3.825%,644631970.00,Israel,,381491,Health Care,Medical/Dental Instruments +DRTSW,Alpha Tau Medical Ltd. Warrant,$1.05,0.095,9.948%,89060996.00,Israel,,69501,Health Care,Medical/Dental Instruments +DRUG,Bright Minds Biosciences Inc. Common Stock,$80.24,-4.76,-5.60%,624841799.00,Canada,,72855,Health Care,Biotechnology: Pharmaceutical Preparations +DRVN,Driven Brands Holdings Inc. Common Stock,$15.30,-0.47,-2.98%,2516149535.00,United States,2021,890503,Consumer Discretionary,Automotive Aftermarket +DSACU,Daedalus Special Acquisition Corp. Unit,$10.09,0.03,0.298%,0.00,Cayman Islands,2025,283218,Finance,Blank Checks +DSGN,Design Therapeutics Inc. Common Stock,$10.13,-0.46,-4.344%,577042858.00,United States,2021,147934,Health Care,Biotechnology: Pharmaceutical Preparations +DSGR,Distribution Solutions Group Inc. Common Stock,$28.02,-0.48,-1.684%,1295302508.00,United States,,63225,Consumer Discretionary,Industrial Specialties +DSGX,Descartes Systems Group Inc. (The) Common Stock,$79.78,-1.77,-2.17%,6860028739.00,Canada,,793537,Technology,Computer Software: Prepackaged Software +DSL,DoubleLine Income Solutions Fund Common Shares of Beneficial Interests,$11.42,0.02,0.175%,1164803776.00,United States,2013,391536,Finance,Trusts Except Educational Religious and Charitable +DSM,BNY Mellon Strategic Municipal Bond Fund Inc. Common Stock,$6.18,0.08,1.311%,0.00,United States,1989,109445,Finance,Investment Managers +DSP,Viant Technology Inc. Class A Common Stock,$12.66,-0.07,-0.55%,790409452.00,United States,2021,170105,Technology,Computer Software: Programming Data Processing +DSS,DSS Inc. Common Stock,$1.21,-0.02,-1.626%,11001947.00,United States,,9583,Consumer Discretionary,Containers/Packaging +DSU,Blackrock Debt Strategies Fund Inc. Common Stock,$10.18,0.02,0.197%,0.00,United States,1998,231221,Finance,Finance Companies +DSWL,Deswell Industries Inc. Common Shares,$3.35,0.06,1.824%,53383051.00,Macau,1995,10875,Industrials,Plastic Products +DSX,Diana Shipping inc. common stock,$2.31,0.05,2.212%,267423759.00,Greece,2005,1177556,Consumer Discretionary,Marine Transportation +DSX^B,Diana Shipping Inc. Perpetual Preferred Shares Series B (Marshall Islands),$26.45,0.09,0.341%,,Greece,,3979,, +DSY,Big Tree Cloud Holdings Limited Ordinary Shares,$0.2742,-0.0058,-2.071%,26059267.00,China,,154957,Consumer Discretionary,Containers/Packaging +DSYWW,Big Tree Cloud Holdings Limited Warrants,$0.0286,0.0016,5.926%,2718071.00,China,,6422,Consumer Discretionary,Containers/Packaging +DT,Dynatrace Inc. Common Stock,$40.65,-0.02,-0.049%,12255498216.00,United States,2019,3337112,Technology,Computer Software: Prepackaged Software +DTB,DTE Energy Company 2020 Series G 4.375% Junior Subordinated Debentures due 2080,$17.70,-0.09,-0.506%,3675989312.00,United States,2020,12546,Utilities,Electric Utilities: Central +DTCK,Davis Commodities Limited Class A Ordinary Shares,$0.262,0.0008,0.306%,7171117.00,Singapore,2023,91675,Industrials,Farming/Seeds/Milling +DTCX,Datacentrex Inc. Common Stock,$2.30,-0.23,-9.091%,38045087.00,United States,,410628,Technology,EDP Services +DTE,DTE Energy Company Common Stock,$136.56,-0.12,-0.088%,28361192119.00,United States,,991174,Utilities,Electric Utilities: Central +DTF,DTF Tax-Free Income 2028 Term Fund Inc. Common Stock,$11.4675,0.0355,0.311%,80611560.00,United States,1991,1433,Finance,Investment Managers +DTG,DTE Energy Company 2021 Series E 4.375% Junior Subordinated Debentures,$17.74,-0.09,-0.505%,3684296633.00,United States,2021,7769,Utilities,Electric Utilities: Central +DTI,Drilling Tools International Corporation Common Stock,$3.75,-0.15,-3.846%,131995418.00,United States,2021,315674,Consumer Discretionary,Oil and Gas Field Machinery +DTIL,Precision BioSciences Inc. Common Stock,$3.96,-0.17,-4.116%,90674753.00,United States,2019,104456,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +DTK,DTE Energy Company 2025 Series H 6.25% Junior Subordinated Debentures due 2085,$24.86,0.01,0.04%,0.00,United States,2025,45284,Utilities,Electric Utilities: Central +DTM,DT Midstream Inc. Common Stock ,$124.31,1.49,1.213%,12639085617.00,United States,2021,834640,Utilities,Natural Gas Distribution +DTSQ,DT Cloud Star Acquisition Corporation Ordinary Shares,$10.90,0.09,0.833%,0.00,United States,2024,2866,, +DTSQR,DT Cloud Star Acquisition Corporation Right,$0.1433,-0.0167,-10.438%,0.00,United States,2024,300,, +DTSS,Datasea Inc. Common Stock,$1.38,0.21,17.949%,11827584.00,China,,390966,Technology,Computer Software: Prepackaged Software +DTST,Data Storage Corporation Common Stock,$4.22,-0.10,-2.315%,31643071.00,United States,,16977,Technology,EDP Services +DTSTW,Data Storage Corporation Warrant,$0.185,0.00,0.00%,1387196.00,United States,,51364,Technology,EDP Services +DTW,DTE Energy Company 2017 Series E 5.25% Junior Subordinated Debentures due 2077,$22.21,-0.05,-0.225%,4612639697.00,United States,2017,17436,Utilities,Electric Utilities: Central +DUK,Duke Energy Corporation (Holding Company) Common Stock,$120.24,-0.05,-0.042%,93505985574.00,United States,,4463690,Utilities,Power Generation +DUK^A,Duke Energy Corporation Depositary Shares each representing a 1/1000th interest in a share of 5.75% Series A Cumulative Redeemable Perpetual Preferred Stock,$25.14,0.05,0.199%,,United States,,63656,, +DUKB,Duke Energy Corporation 5.625% Junior Subordinated Debentures due 2078,$24.61,-0.08,-0.324%,19138242723.00,United States,2018,21740,Utilities,Power Generation +DUO,Fangdd Network Group Ltd. Class A Ordinary Shares,$1.38,-0.06,-4.167%,5378976.00,China,2019,42639,Finance,Real Estate +DUOL,Duolingo Inc. Class A Common Stock,$142.80,-3.28,-2.245%,6601266580.00,United States,2021,1570546,Technology,Computer Software: Prepackaged Software +DUOT,Duos Technologies Group Inc. Common Stock,$10.83,-0.25,-2.256%,221097569.00,United States,,110747,Technology,Computer Software: Prepackaged Software +DV,DoubleVerify Holdings Inc. Common Stock,$10.97,0.05,0.458%,1767346138.00,United States,2021,1754349,Technology,Computer Software: Programming Data Processing +DVA,DaVita Inc. Common Stock,$105.88,0.27,0.256%,7475128000.00,United States,,710344,Health Care,Misc Health and Biotechnology Services +DVAX,Dynavax Technologies Corporation Common Stock,$15.48,0.00,0.00%,1817738505.00,United States,2004,2245727,Health Care,Biotechnology: Pharmaceutical Preparations +DVLT,Datavault AI Inc. Common Stock,$0.7119,-0.0133,-1.834%,413881698.00,United States,2018,43825055,Technology,Semiconductors +DVN,Devon Energy Corporation Common Stock,$39.83,0.38,0.963%,24985359000.00,United States,1985,8880584,Energy,Oil & Gas Production +DVS,Dolly Varden Silver Corporation Common Shares,$5.63,0.01,0.178%,517209971.00,,2025,1646553,, +DWSN,Dawson Geophysical Company Common Stock,$2.25,-0.07,-3.017%,69857552.00,United States,,72612,Energy,Oil & Gas Production +DWTX,Dogwood Therapeutics Inc. Common Stock,$3.07,-0.21,-6.402%,98493164.00,United States,2020,54742,Health Care,Biotechnology: Pharmaceutical Preparations +DX,Dynex Capital Inc. Common Stock,$14.64,-0.10,-0.678%,3545355609.00,United States,,8419389,Real Estate,Real Estate Investment Trusts +DX^C,Dynex Capital Inc. 6.900% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.77,-0.0701,-0.271%,,United States,,14166,, +DXC,DXC Technology Company Common Stock ,$14.43,-0.24,-1.636%,2512752855.00,United States,,1788462,Technology,EDP Services +DXCM,DexCom Inc. Common Stock,$73.36,-0.31,-0.421%,28611593714.00,United States,2005,4525412,Health Care,Medical/Dental Instruments +DXF,Eason Technology Limited American Depositary Shares (each representing sixty-thousand (60000) Ordinary Shares),$1.30,0.00,0.00%,1804329.00,,,126387,Finance,Finance: Consumer Services +DXLG,Destination XL Group Inc. Common Stock,$0.7087,-0.002,-0.281%,38735001.00,United States,,61254,Consumer Discretionary,Clothing/Shoe/Accessory Stores +DXPE,DXP Enterprises Inc. Common Stock,$128.39,1.14,0.896%,2013064043.00,United States,,79716,Industrials,Industrial Machinery/Components +DXR,Daxor Corporation Common Stock,$12.21,-0.51,-4.009%,61521794.00,United States,,12482,Health Care,Medical/Dental Instruments +DXST,Decent Holding Inc Class A Ordinary Shares,$1.67,0.07,4.375%,49404166.00,China,2025,1347978,Industrials,Miscellaneous +DXYZ,Destiny Tech100 Inc. Common Stock,$35.42,5.78,19.501%,0.00,,2024,3430882,, +DY,Dycom Industries Inc. Common Stock,$369.99,-4.88,-1.302%,10713449309.00,United States,,386079,Industrials,Water Sewer Pipeline Comm & Power Line Construction +DYAI,Dyadic International Inc. Common Stock,$0.879,-0.0052,-0.588%,31809074.00,United States,,48242,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +DYN,Dyne Therapeutics Inc. Common Stock,$17.70,-0.34,-1.885%,2860208950.00,United States,2020,1860737,Health Care,Biotechnology: Pharmaceutical Preparations +DYOR,Insight Digital Partners II Class A Ordinary Shares,$9.96,0.0061,0.061%,0.00,United States,2025,591,Finance,Blank Checks +DYORU,Insight Digital Partners II Units,$10.16,0.00,0.00%,0.00,United States,2025,22,Finance,Blank Checks +DYORW,Insight Digital Partners II Warrants,$0.33,0.00,0.00%,0.00,United States,2025,3200,Finance,Blank Checks +E,ENI S.p.A. Common Stock,$40.87,-0.12,-0.293%,67118563899.00,Italy,,237054,Energy,Oil & Gas Production +EA,Electronic Arts Inc. Common Stock,$203.94,-0.43,-0.21%,50863566374.00,United States,,1754255,Consumer Discretionary,Services-Misc. Amusement & Recreation +EAD,Allspring Income Opportunities Fund Common Shares,$6.85,-0.01,-0.146%,0.00,United States,2003,95930,Finance,Finance/Investors Services +EAF,GrafTech International Ltd. Common Stock,$17.17,0.56,3.371%,443331289.00,United States,2018,148829,Energy,Industrial Machinery/Components +EAI,Entergy Arkansas LLC First Mortgage Bonds 4.875% Series Due September 1 2066,$21.24,-0.10,-0.469%,9485718241.00,United States,2016,14516,Utilities,Electric Utilities: Central +EARN,Ellington Credit Company Common Shares of Beneficial Interest,$5.65,-0.03,-0.528%,212209452.00,United States,2013,440856,Real Estate,Real Estate Investment Trusts +EAT,Brinker International Inc. Common Stock,$156.64,-0.65,-0.413%,6959705518.00,United States,,3355770,Consumer Discretionary,Restaurants +EB,Eventbrite Inc. Class A Common Stock,$4.45,-0.01,-0.224%,434654444.00,United States,2018,579424,Technology,Computer Software: Programming Data Processing +EBAY,eBay Inc. Common Stock,$95.17,-0.03,-0.032%,43016840000.00,United States,1998,2628399,Real Estate,Real Estate +EBC,Eastern Bankshares Inc. Common Stock,$19.93,-0.34,-1.677%,4201202745.00,United States,2020,1767761,Finance,Savings Institutions +EBF,Ennis Inc. Common Stock,$18.98,-0.33,-1.709%,480058597.00,United States,,169577,Consumer Discretionary,Office Equipment/Supplies/Services +EBMT,Eagle Bancorp Montana Inc. Common Stock,$21.30,-0.39,-1.798%,169381370.00,United States,2010,88651,Finance,Major Banks +EBON,Ebang International Holdings Inc. Class A Ordinary Shares,$3.27,0.025,0.77%,21398677.00,China,2020,1843,Technology,Semiconductors +EBS,Emergent BioSolutions Inc. Common Stock,$11.71,-0.51,-4.173%,615008778.00,United States,2006,459023,Health Care,Biotechnology: Pharmaceutical Preparations +EC,Ecopetrol S.A. American Depositary Shares,$12.76,-0.32,-2.446%,26232451219.00,Colombia,,4821230,Energy,Oil & Gas Production +ECAT,BlackRock ESG Capital Allocation Term Trust Common Shares of Beneficial Interest,$15.50,-0.03,-0.193%,1676092500.00,United States,2021,395589,Finance,Trusts Except Educational Religious and Charitable +ECBK,ECB Bancorp Inc. Common Stock,$17.38,-0.12,-0.686%,152889948.00,United States,2022,6854,Finance,Banks +ECC ,Eagle Point Credit Company Inc. Common Stock,$5.74,0.01,0.175%,348202888.00,United States,2014,666896,Finance,Trusts Except Educational Religious and Charitable +ECC^D,Eagle Point Credit Company Inc. 6.75% Series D Preferred Stock,$19.9447,0.0647,0.325%,,United States,,5916,, +ECCC,Eagle Point Credit Company Inc. 6.50% Series C Term Preferred Stock due 2031,$24.525,-0.07,-0.285%,1487748401.00,United States,,5143,Finance,Trusts Except Educational Religious and Charitable +ECCF,Eagle Point Credit Company Inc. 8.00% Series F Term Preferred Stock due 2029,$25.00,0.01,0.04%,27216820700.00,United States,,4728,, +ECCU,Eagle Point Credit Company Inc. 7.75% Notes due 2030,$25.39,0.07,0.276%,0.00,United States,2024,2216,, +ECCV,Eagle Point Credit Company Inc. 5.375% Notes due 2029,$23.80,0.0525,0.221%,1443768071.00,United States,2022,1681,Finance,Trusts Except Educational Religious and Charitable +ECCW,Eagle Point Credit Company Inc. 6.75% Notes due 2031,$24.9501,0.0001,0.00%,1513536040.00,United States,2021,2219,Finance,Trusts Except Educational Religious and Charitable +ECCX,Eagle Point Credit Company Inc. 6.6875% Notes due 2028,$25.13,-0.01,-0.04%,1524449228.00,United States,2022,2382,Finance,Trusts Except Educational Religious and Charitable +ECF,Ellsworth Growth and Income Fund Ltd.,$12.62,0.13,1.041%,0.00,United States,1986,53323,Finance,Finance/Investors Services +ECF^A,Ellsworth Growth and Income Fund Ltd. 5.25% Series A Cumulative Preferred Shares (Liquidation Preference $25.00 per share),$21.52,-0.14,-0.646%,,United States,,3084,, +ECG,Everus Construction Group Inc. Common Stock,$93.75,-0.10,-0.107%,4781866406.00,United States,2024,465115,Consumer Discretionary,Homebuilding +ECL,Ecolab Inc. Common Stock,$281.46,-2.63,-0.926%,79719506893.00,United States,,1165581,Consumer Discretionary,Package Goods/Cosmetics +ECO,Okeanis Eco Tankers Corp. Common Stock,$40.32,0.87,2.205%,1574280490.00,,,464336,Consumer Discretionary,Marine Transportation +ECOR,electroCore Inc. Common Stock,$7.25,-0.63,-7.995%,57970297.00,United States,2018,127669,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +ECPG,Encore Capital Group Inc Common Stock,$53.91,-1.42,-2.566%,1202391173.00,United States,,228079,Finance,Finance Companies +ECVT,Ecovyst Inc. Common Stock,$10.73,-0.14,-1.288%,1223428312.00,United States,2017,979969,Industrials,Major Chemicals +ECX,ECARX Holdings Inc. Class A Ordinary shares,$1.86,-0.02,-1.064%,643057848.00,China,,3000673,Technology,EDP Services +ECXWW,ECARX Holdings Inc. Warrants,$0.0503,0.0002,0.399%,17390220.00,China,,8700,Technology,EDP Services +ED,Consolidated Edison Inc. Common Stock,$105.18,-0.17,-0.161%,37963207249.00,United States,,1399663,Utilities,Power Generation +EDAP,EDAP TMS S.A. American Depositary Shares,$4.08,-0.06,-1.449%,152559711.00,France,1997,61452,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +EDBL,Edible Garden AG Incorporated Common Stock,$0.515,0.0023,0.449%,2640227.00,United States,2022,140657,Consumer Staples,Farming/Seeds/Milling +EDBLW,Edible Garden AG Incorporated Warrant,$0.2263,0.0006,0.266%,1160162.00,United States,2022,7934,Consumer Staples,Farming/Seeds/Milling +EDD,Morgan Stanley Emerging Markets Domestic Debt Fund Inc. Common Stock,$5.93,0.06,1.022%,0.00,United States,2007,1202369,Finance,Finance Companies +EDF,Virtus Stone Harbor Emerging Markets Income Fund Common Shares of Beneficial Interest,$5.00,0.05,1.01%,0.00,United States,2010,177826,Finance,Investment Managers +EDHL,Everbright Digital Holding Limited Ordinary Shares,$0.2343,-0.0357,-13.222%,6246438.00,Hong Kong,2025,288973,Consumer Discretionary,Advertising +EDIT,Editas Medicine Inc. Common Stock,$2.06,-0.05,-2.37%,201094440.00,United States,2016,1369128,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +EDN,Empresa Distribuidora Y Comercializadora Norte S.A. (Edenor) American Depositary Shares,$31.55,-1.11,-3.399%,1429932920.00,Argentina,2007,129411,Utilities,Electric Utilities: Central +EDRY,EuroDry Ltd. Common Shares ,$13.75,0.25,1.852%,38867084.00,Greece,,9142,Consumer Discretionary,Marine Transportation +EDSA,Edesa Biotech Inc. Common Shares,$1.34,-0.04,-2.899%,11167323.00,United States,,108322,Health Care,Biotechnology: Pharmaceutical Preparations +EDTK,Skillful Craftsman Education Technology Limited Ordinary Share,$1.04,0.01,0.971%,16566629.00,China,2020,1266,Real Estate,Other Consumer Services +EDU,New Oriental Education & Technology Group Inc. Sponsored ADR representing 10 Ordinary Share (Cayman Islands),$58.95,2.98,5.324%,23454104494.00,China,2006,3698252,Real Estate,Other Consumer Services +EDUC,Educational Development Corporation Common Stock,$1.41,-0.01,-0.704%,12001023.00,United States,,26102,Consumer Discretionary,Consumer Specialties +EE,Excelerate Energy Inc. Class A Common Stock,$36.27,0.65,1.825%,4135903282.00,United States,2022,435543,Utilities,Oil/Gas Transmission +EEA,The European Equity Fund Inc. Common Stock,$10.88,-0.12,-1.091%,0.00,United States,,21169,Finance,Trusts Except Educational Religious and Charitable +EEFT,Euronet Worldwide Inc. Common Stock,$72.32,-0.55,-0.755%,3040671330.00,United States,1997,359072,Finance,Investment Bankers/Brokers/Service +EEIQ,EpicQuest Education Group International Limited Common Stock,$0.2502,-0.0048,-1.882%,5853846.00,United States,2021,1039203,Real Estate,Other Consumer Services +EEX,Emerald Holding Inc. Common Stock,$4.62,-0.10,-2.119%,913869980.00,United States,2017,50040,Real Estate,Real Estate +EFC,Ellington Financial Inc. Common Stock ,$13.36,-0.01,-0.075%,1665310947.00,United States,2010,3742210,Finance,Real Estate +EFC^A,Ellington Financial Inc. 6.750% Series A Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.10,-0.06,-0.238%,,United States,,18928,, +EFC^B,Ellington Financial Inc. 6.250% Series B Fixed-Rate Reset Cumulative Redeemable Preferred Stock,$24.15,0.07,0.291%,,United States,,5555,, +EFC^C,Ellington Financial Inc. 8.625% Series C Fixed-Rate Reset Cumulative Redeemable Preferred Stock,$25.54,0.15,0.591%,,United States,,1243,, +EFC^D,Ellington Financial Inc. 7.00% Series D Cumulative Perpetual Redeemable Preferred Stock,$24.49,0.39,1.618%,,United States,,318,, +EFOI,Energy Focus Inc. Common Stock,$2.25,0.00,0.00%,12913684.00,United States,,6794,Consumer Discretionary,Building Products +EFR,Eaton Vance Senior Floating-Rate Fund Common Shares of Beneficial Interest,$11.22,0.00,0.00%,0.00,United States,2003,53748,Finance,Trusts Except Educational Religious and Charitable +EFSC,Enterprise Financial Services Corporation Common Stock,$56.105,-0.955,-1.674%,2076497049.00,United States,,286405,Finance,Major Banks +EFSCP,Enterprise Financial Services Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of 5% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series A,$20.68,0.00,0.00%,765385598.00,United States,,64,Finance,Major Banks +EFSI,Eagle Financial Services Inc Common Stock,$38.80,-0.85,-2.144%,208602225.00,United States,,21811,Finance,Major Banks +EFT,Eaton Vance Floating Rate Income Trust Common Shares of Beneficial Interest,$11.46,0.00,0.00%,333376156.00,United States,2004,107861,Finance,Finance Companies +EFX,Equifax Inc. Common Stock,$205.33,-2.70,-1.298%,25131167617.00,United States,,1555778,Finance,Finance: Consumer Services +EFXT,Enerflex Ltd Common Shares,$17.64,0.17,0.973%,2148583382.00,Canada,2022,506525,Industrials,Industrial Machinery/Components +EG,Everest Group Ltd. Common Stock,$324.91,0.97,0.299%,13639090825.00,Bermuda,,303417,Finance,Property-Casualty Insurers +EGAN,eGain Corporation Common Stock,$10.47,-0.08,-0.758%,283225614.00,United States,1999,203437,Technology,Computer Software: Prepackaged Software +EGBN,Eagle Bancorp Inc. Common Stock,$25.84,-0.28,-1.072%,784792738.00,United States,,416630,Finance,Major Banks +EGP,EastGroup Properties Inc. Common Stock,$177.56,-1.00,-0.56%,9472612928.00,United States,,378568,Real Estate,Real Estate Investment Trusts +EGY,VAALCO Energy Inc. Common Stock,$4.89,0.13,2.731%,509822857.00,United States,,1226602,Energy,Oil & Gas Production +EH,EHang Holdings Limited ADS,$13.21,-0.06,-0.452%,950919974.00,China,2019,437290,Industrials,Aerospace +EHAB,Enhabit Inc. Common Stock,$10.32,-0.06,-0.578%,522265014.00,United States,2022,325153,Health Care,Medical/Nursing Services +EHC,Encompass Health Corporation Common Stock,$95.70,0.98,1.035%,9628948999.00,United States,,1230665,Health Care,Hospital/Nursing Management +EHGO,Eshallgo Inc. Class A Ordinary Shares,$0.2398,0.0098,4.261%,7120660.00,China,2024,94216,Consumer Discretionary,Diversified Commercial Services +EHI,Western Asset Global High Income Fund Inc Common Stock,$6.39,0.01,0.157%,0.00,United States,2003,91151,Finance,Investment Managers +EHLD,Euroholdings Ltd. Common Stock ,$6.47,-0.01,-0.154%,18223499.00,Greece,,3190,Consumer Discretionary,Marine Transportation +EHTH,eHealth Inc. Common Stock,$2.89,-0.15,-4.934%,88910229.00,United States,2006,635309,Finance,Specialty Insurers +EIC,Eagle Point Income Company Inc. Common Stock,$11.26,0.11,0.987%,100305296.00,United States,2019,171090,Finance,Finance/Investors Services +EICA,Eagle Point Income Company Inc. 5.00% Series A Term Preferred Stock due 2026,$24.754,0.00,0.00%,220511305.00,United States,2021,71,Finance,Finance/Investors Services +EICC,Eagle Point Income Company Inc. 8.00% Series C Term Preferred Stock due 2029,$25.18,0.02,0.079%,0.00,United States,,24485,, +EIG,Employers Holdings Inc Common Stock,$43.65,0.16,0.368%,981212977.00,United States,2007,183331,Finance,Property-Casualty Insurers +EIIA,Eagle Point Institutional Income Fund 8.125% Series A Term Preferred Shares Due 2029,$25.22,-0.0264,-0.105%,0.00,,2024,2781,, +EIM,Eaton Vance Municipal Bond Fund Common Shares of Beneficial Interest $.01 par value,$9.85,0.05,0.51%,0.00,United States,2002,172356,Finance,Finance/Investors Services +EIX,Edison International Common Stock,$62.25,-0.38,-0.607%,23952994236.00,United States,,1986314,Utilities,Electric Utilities: Central +EJH,E-Home Household Service Holdings Limited Ordinary Shares,$0.9761,-0.0109,-1.104%,78091767.00,China,2021,239928,Consumer Discretionary,Other Consumer Services +EKSO,Ekso Bionics Holdings Inc. Common Stock,$8.50,0.24,2.906%,22297481.00,United States,,177279,Industrials,Industrial Machinery/Components +EL,Estee Lauder Companies Inc. (The) Common Stock,$114.62,-1.82,-1.563%,41304490709.00,United States,1995,3406980,Consumer Discretionary,Package Goods/Cosmetics +ELA,Envela Corporation Common Stock,$14.19,0.56,4.109%,368421724.00,United States,,56511,Consumer Discretionary,Consumer Specialties +ELAB,PMGC Holdings Inc. Common Stock,$3.40,-0.02,-0.585%,4031703.00,United States,2023,96263,Health Care,Biotechnology: Pharmaceutical Preparations +ELAN,Elanco Animal Health Incorporated Common Stock,$24.12,-0.50,-2.031%,11984346969.00,United States,2018,2375276,Health Care,Biotechnology: Pharmaceutical Preparations +ELBM,Electra Battery Materials Corporation Common Stock,$1.06,0.03,2.913%,99271372.00,Canada,,984352,Miscellaneous,Industrial Machinery/Components +ELC,Entergy Louisiana Inc. Collateral Trust Mortgage Bonds 4.875 % Series due September 1 2066,$20.96,-0.03,-0.143%,4469459090.00,United States,2016,10000,Utilities,Electric Utilities: Central +ELDN,Eledon Pharmaceuticals Inc. Common Stock,$2.13,-0.07,-3.182%,127655612.00,United States,2014,439791,Health Care,Biotechnology: Pharmaceutical Preparations +ELE,Elemental Royalty Corporation Common Stock,$20.81,0.12,0.58%,1327055635.00,Canada,,196824,Basic Materials,Precious Metals +ELF,e.l.f. Beauty Inc. Common Stock,$84.98,-1.75,-2.018%,5067932545.00,United States,2016,1842061,Consumer Discretionary,Package Goods/Cosmetics +ELLO,Ellomay Capital Ltd Ordinary Shares (Israel),$27.09,-0.21,-0.769%,348176528.00,Israel,,2134,Utilities,Electric Utilities: Central +ELMD,Electromed Inc. Common Stock,$29.09,0.69,2.43%,242626250.00,United States,2011,52735,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +ELME,Elme Communities Common Stock,$2.16,-0.07,-3.139%,190428108.00,United States,2000,10068426,Real Estate,Real Estate Investment Trusts +ELOG,Eastern International Ltd. Ordinary Shares,$1.27,-0.09,-6.618%,15261590.00,China,2025,41648,Industrials,Integrated Freight & Logistics +ELPC,Companhia Paranaense de Energia (COPEL) American Depositary Shares (each representing four (4) Common Shares),$10.37,-0.25,-2.354%,3364348174.00,Brazil,2023,267023,Utilities,Electric Utilities: Central +ELPW,Elong Power Holding Limited Class A Ordinary Shares,$0.4115,-0.0185,-4.302%,1730751.00,China,,773161,Miscellaneous,Industrial Machinery/Components +ELS,Equity Lifestyle Properties Inc. Common Stock,$61.92,-0.98,-1.558%,12001859482.00,United States,,1594533,Real Estate,Real Estate Investment Trusts +ELSE,Electro-Sensors Inc. Common Stock,$4.45,0.1299,3.007%,15488318.00,United States,,3290,Industrials,Industrial Machinery/Components +ELTK,Eltek Ltd. Ordinary Shares,$9.0159,0.3159,3.631%,60533113.00,Israel,1997,3411,Technology,Electrical Products +ELTX,Elicio Therapeutics Inc. Common Stock,$8.19,-0.26,-3.077%,143239136.00,United States,2021,82860,Health Care,Biotechnology: Pharmaceutical Preparations +ELUT,Elutia Inc. Class A Common Stock,$1.05,0.05,5.00%,44836244.00,United States,2020,528675,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ELV,Elevance Health Inc. Common Stock,$341.85,18.93,5.862%,75972321132.00,United States,,4362648,Health Care,Medical Specialities +ELVA,Electrovaya Inc. Common Shares,$10.66,-0.25,-2.291%,448881087.00,Canada,,374533,, +ELVN,Enliven Therapeutics Inc. Common Stock,$25.38,-0.78,-2.982%,1506234905.00,United States,2020,489452,Health Care,Biotechnology: Pharmaceutical Preparations +ELVR,Elevra Lithium Limited American Depository Shares,$51.79,-11.59,-18.287%,59782730036.00,Australia,,241456,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +ELWT,Elauwit Connection Inc. Common Stock,$5.25,-0.53,-9.17%,34753929.00,United States,2025,29834,Consumer Discretionary,Telecommunications Equipment +EM,Smart Share Global Limited American Depositary Shares,$1.17,0.00,0.00%,296676030.00,China,2021,35165,Consumer Discretionary,Other Consumer Services +EMA,Emera Incorporated Common Shares,$50.27,-0.04,-0.08%,15116189000.00,,2025,297647,Utilities,Electric Utilities: Central +EMAT,Evolution Metals & Technologies Corp. Common Stock,$7.10,-0.01,-0.141%,0.00,United States,,132606,, +EMBC,Embecta Corp. Common Stock,$10.20,-0.20,-1.923%,596830978.00,United States,,551446,Health Care,Medical/Dental Instruments +EMBJ,Embraer S.A. Common Stock,$76.48,-3.41,-4.268%,14025784597.00,Brazil,,1764354,Industrials,Aerospace +EMD,Western Asset Emerging Markets Debt Fund Inc Common Stock,$10.95,0.06,0.551%,0.00,United States,,216612,Finance,Finance/Investors Services +EME,EMCOR Group Inc. Common Stock,$727.35,11.07,1.545%,32560451180.00,United States,,287058,Industrials,Engineering & Construction +EMF,Templeton Emerging Markets Fund Common Stock,$19.94,0.07,0.352%,0.00,United States,1987,71624,Finance,Finance/Investors Services +EMIS,Emmis Acquisition Corp. Class A Ordinary Shares,$10.06,0.00,0.00%,0.00,United States,2025,11097,Health Care,Biotechnology: Pharmaceutical Preparations +EML,Eastern Company (The) Common Stock,$17.79,-0.21,-1.167%,107961284.00,United States,,22883,Consumer Discretionary,Industrial Machinery/Components +EMN,Eastman Chemical Company Common Stock,$69.03,0.11,0.16%,7874238294.00,United States,,2323534,Industrials,Major Chemicals +EMO,ClearBridge Energy Midstream Opportunity Fund Inc. Common Stock,$47.22,0.37,0.79%,0.00,United States,2011,28351,Finance,Investment Managers +EMP,Entergy Mississippi LLC First Mortgage Bonds 4.90% Series Due October 1 2066,$20.91,-0.06,-0.286%,9338341263.00,United States,2016,4821,Utilities,Electric Utilities: Central +EMPD,Empery Digital Inc. Common stock,$5.09,0.12,2.414%,0.00,United States,2021,1262600,, +EMR,Emerson Electric Company Common Stock,$148.42,0.75,0.508%,83382356000.00,United States,,3351619,Technology,Consumer Electronics/Appliances +ENB,Enbridge Inc Common Stock,$48.56,0.54,1.125%,105922743767.00,Canada,,9139568,Energy,Natural Gas Distribution +ENGN,enGene Holdings Inc. Common Stock,$10.20,-0.91,-8.191%,683243542.00,Canada,,334351,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ENGNW,enGene Holdings Inc. Warrants,$3.05,-0.65,-17.568%,204303216.00,Canada,,146038,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ENGS,Energys Group Limited Ordinary Shares,$0.9885,-0.0019,-0.192%,14123550.00,United Kingdom,2025,30694,Industrials,Engineering & Construction +ENIC,Enel Chile S.A. American Depositary Shares (Each representing 50 shares of Common Stock),$4.42,-0.08,-1.778%,6114323656.00,Chile,2016,473226,Utilities,Electric Utilities: Central +ENLT,Enlight Renewable Energy Ltd. Ordinary Shares,$58.28,-0.24,-0.41%,7686955820.00,Israel,2023,93892,Utilities,Electric Utilities: Central +ENLV,Enlivex Therapeutics Ltd. Ordinary Shares,$1.15,-0.05,-4.167%,272988723.00,Israel,2014,265877,Health Care,Biotechnology: Pharmaceutical Preparations +ENO,Entergy New Orleans LLC First Mortgage Bonds 5.50% Series due April 1 2066,$22.53,-0.038,-0.168%,4817608960.00,United States,2016,3388,Utilities,Power Generation +ENOV,Enovis Corporation Common Stock,$21.46,-0.52,-2.366%,1227284116.00,United States,,1337484,Health Care,Industrial Specialties +ENPH,Enphase Energy Inc. Common Stock,$40.47,0.54,1.352%,5295892423.00,United States,2012,5027712,Technology,Semiconductors +ENR,Energizer Holdings Inc. Common Stock,$21.05,-0.68,-3.129%,1440445332.00,United States,2015,1207152,Miscellaneous,Industrial Machinery/Components +ENS,EnerSys Common Stock,$181.02,1.13,0.628%,6681291618.00,United States,2004,710962,Technology,Industrial Machinery/Components +ENSC,Ensysce Biosciences Inc. Common Stock,$0.7883,-0.0586,-6.919%,2863348.00,United States,,103811,Health Care,Biotechnology: Pharmaceutical Preparations +ENSG,The Ensign Group Inc. Common Stock,$171.80,-0.19,-0.11%,9951477719.00,United States,2007,350051,Health Care,Hospital/Nursing Management +ENTA,Enanta Pharmaceuticals Inc. Common Stock,$12.65,-0.33,-2.542%,367084303.00,United States,2013,163477,Health Care,Biotechnology: Pharmaceutical Preparations +ENTG,Entegris Inc. Common Stock,$120.65,0.34,0.283%,18290540000.00,United States,2000,3873248,Industrials,Plastic Products +ENTX,Entera Bio Ltd. Ordinary Shares,$1.47,-0.08,-5.161%,67410146.00,Israel,2018,148430,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ENVA,Enova International Inc. Common Stock,$159.26,1.56,0.989%,3937671170.00,United States,2014,636498,Finance,Finance: Consumer Services +ENVB,Enveric Biosciences Inc. Common Stock,$3.49,-0.945,-21.308%,3571554.00,United States,,255018,Health Care,Biotechnology: Pharmaceutical Preparations +ENVX,Enovix Corporation Common Stock,$7.20,-0.02,-0.277%,1553875229.00,United States,2021,4136712,Miscellaneous,Industrial Machinery/Components +EOD,Allspring Global Dividend Opportunity Fund Common Shares of Beneficial Interest,$6.05,-0.01,-0.165%,0.00,United States,2007,103346,Finance,Investment Managers +EOG,EOG Resources Inc. Common Stock,$111.02,2.43,2.238%,62173697395.00,United States,,4990769,Energy,Oil & Gas Production +EOI,Eaton Vance Enhance Equity Income Fund Eaton Vance Enhanced Equity Income Fund Shares of Beneficial Interest,$20.88,0.01,0.048%,0.00,United States,2004,69990,Finance,Finance/Investors Services +EOLS,Evolus Inc. Common Stock,$4.80,-0.15,-3.03%,311134963.00,United States,2018,1427710,Health Care,Biotechnology: Pharmaceutical Preparations +EONR,EON Resources Inc. Class A Common Stock,$0.449,0.0038,0.854%,22435786.00,,2022,2307132,Energy,Oil & Gas Production +EOS,Eaton Vance Enhance Equity Income Fund II Common Stock,$22.55,-0.10,-0.442%,0.00,,2005,171087,Finance,Trusts Except Educational Religious and Charitable +EOSE,Eos Energy Enterprises Inc. Class A Common Stock,$16.68,1.67,11.126%,4807885434.00,United States,,25678461,Miscellaneous,Industrial Machinery/Components +EOT,Eaton Vance Municipal Income Trust EATON VANCE NATIONAL MUNICIPAL OPPORTUNITIES TRUST,$17.66,0.17,0.972%,275936105.00,United States,2009,36182,Finance,Investment Bankers/Brokers/Service +EP,Empire Petroleum Corporation Common Stock,$2.88,-0.06,-2.041%,100384707.00,United States,2022,34417,Energy,Oil & Gas Production +EP^C,El Paso Corporation Preferred Stock,$50.00,0.1186,0.238%,,United States,,6260,, +EPAC,Enerpac Tool Group Corp. Common Stock,$39.40,-0.49,-1.228%,2079386417.00,United States,,292216,Technology,Industrial Machinery/Components +EPAM,EPAM Systems Inc. Common Stock,$218.35,0.31,0.142%,12062225640.00,United States,2012,795931,Technology,EDP Services +EPC,Edgewell Personal Care Company Common Stock,$18.79,-0.44,-2.288%,873063145.00,United States,,484706,Consumer Discretionary,Package Goods/Cosmetics +EPD,Enterprise Products Partners L.P. Common Stock,$33.46,0.29,0.874%,72384722333.00,United States,,5001318,Utilities,Natural Gas Distribution +EPM,Evolution Petroleum Corporation Inc. Common Stock,$3.83,0.04,1.055%,134053233.00,United States,,228042,Energy,Oil & Gas Production +EPOW,Sunrise New Energy Co. Ltd Class A Ordinary Shares,$0.8461,-0.0046,-0.541%,22833658.00,China,2021,56104,Real Estate,Real Estate +EPR,EPR Properties Common Stock,$51.70,0.08,0.155%,3936455630.00,United States,1997,912726,Real Estate,Real Estate Investment Trusts +EPR^C,EPR Properties 5.75% Series C Cumulative Convertible Preferred Shares,$23.26,0.1599,0.692%,,United States,,479,, +EPR^E,EPR Properties Series E Cumulative Conv Pfd Shs Ser E,$31.0744,-0.0001,0.00%,,United States,,302,, +EPR^G,EPR Properties 5.750% Series G Cumulative Redeemable Preferred Shares,$20.73,-0.11,-0.528%,,United States,,14719,, +EPRT,Essential Properties Realty Trust Inc. Common Stock,$29.49,-0.69,-2.286%,5843282838.00,United States,2018,1546391,Real Estate,Real Estate Investment Trusts +EPRX,Eupraxia Pharmaceuticals Inc. Common Stock,$8.66,-0.33,-3.671%,438614546.00,Canada,,58866,Health Care,Pharmaceuticals and Biotechnology +EPSM,Epsium Enterprise Limited Class A Ordinary Shares,$2.15,-0.13,-5.702%,28891773.00,Macau,2025,15366,Consumer Staples,Beverages (Production/Distribution) +EPSN,Epsilon Energy Ltd. Common Share,$4.76,0.02,0.422%,142292736.00,United States,,130226,Energy,Oil & Gas Production +EQ,Equillium Inc. Common Stock,$1.40,0.10,7.692%,85250596.00,United States,2018,453028,Health Care,Biotechnology: Pharmaceutical Preparations +EQBK,Equity Bancshares Inc. Class A Common Stock,$45.19,-0.41,-0.899%,862063058.00,United States,,78766,Finance,Major Banks +EQH,Equitable Holdings Inc. Common Stock,$46.11,0.18,0.392%,13211992318.00,United States,2018,1746827,Finance,Specialty Insurers +EQH^A,Equitable Holdings Inc. Depositary Shares,$21.02,-0.02,-0.095%,,United States,,43236,, +EQH^C,Equitable Holdings Inc. Depositary Shares each representing a 1/1000th interest in a share of Fixed Rate Noncumulative Perpetual Preferred Stock Series C,$16.79,0.01,0.06%,,United States,,24431,, +EQIX,Equinix Inc. Common Stock REIT,$816.15,6.60,0.815%,80134567560.00,United States,2000,589691,Real Estate,Real Estate Investment Trusts +EQNR,Equinor ASA,$26.24,-0.06,-0.228%,77269797699.00,Norway,,4755128,Energy,Integrated oil Companies +EQPT,EquipmentShare.com Inc Class A Common Stock,$34.63,2.32,7.18%,8701926619.00,United States,2026,3070665,Consumer Discretionary,Diversified Commercial Services +EQR,Equity Residential Common Shares of Beneficial Interest,$60.76,-1.39,-2.237%,23117644048.00,United States,,2405541,Real Estate,Real Estate Investment Trusts +EQS,Equus Total Return Inc. Common Stock,$1.352,-0.028,-2.029%,18882973.00,United States,,3083,Finance,Finance/Investors Services +EQT,EQT Corporation Common Stock,$55.96,1.55,2.849%,34922789320.00,United States,,8530339,Energy,Oil & Gas Production +EQX,Equinox Gold Corp. Common Shares,$17.12,0.29,1.723%,13435371574.00,Canada,,9817153,Basic Materials,Precious Metals +ERAS,Erasca Inc. Common Stock,$10.13,-0.37,-3.524%,3101925585.00,United States,2021,3004384,Health Care,Biotechnology: Pharmaceutical Preparations +ERC,Allspring Multi-Sector Income Fund Common Stock,$9.46,0.06,0.638%,0.00,United States,2003,75275,Finance,Finance/Investors Services +ERH,Allspring Utilities and High Income Fund Common Shares,$11.85,0.00,0.00%,0.00,,2004,27954,Finance,Finance/Investors Services +ERIC,Ericsson American Depositary Shares,$10.88,-0.23,-2.07%,36428978877.00,Sweden,,10749943,Technology,Radio And Television Broadcasting And Communications Equipment +ERIE,Erie Indemnity Company Class A Common Stock,$273.53,1.03,0.378%,12634791083.00,United States,,175066,Finance,Specialty Insurers +ERII,Energy Recovery Inc. Common Stock,$14.65,0.17,1.174%,776041206.00,United States,2008,455817,Technology,Industrial Machinery/Components +ERNA,Ernexa Therapeutics Inc. Common Stock,$1.24,0.08,6.897%,9732622.00,United States,,57096,Health Care,Biotechnology: Pharmaceutical Preparations +ERO,Ero Copper Corp. Common Shares,$36.10,0.72,2.035%,3750438169.00,Canada,2021,3709545,Basic Materials,Metal Mining +ES,Eversource Energy (D/B/A) Common Stock,$69.90,-0.73,-1.034%,26225721236.00,United States,,3141820,Utilities,Electric Utilities: Central +ESAB,ESAB Corporation Common Stock,$117.60,0.00,0.00%,7139609602.00,United States,2022,278800,Industrials,Industrial Machinery/Components +ESCA,Escalade Incorporated Common Stock,$14.10,-0.14,-0.983%,194632805.00,United States,,16546,Consumer Discretionary,Recreational Games/Products/Toys +ESE,ESCO Technologies Inc. Common Stock,$223.06,-0.64,-0.286%,5765236643.00,United States,,153862,Telecommunications,Telecommunications Equipment +ESEA,Euroseas Ltd. Common Stock (Marshall Islands),$56.87,1.22,2.192%,398466024.00,Greece,,30739,Consumer Discretionary,Marine Transportation +ESGL,ESGL Holdings Limited Ordinary Shares,$3.50,-0.06,-1.685%,146356840.00,Singapore,,4978,Utilities,Environmental Services +ESHA,ESH Acquisition Corp. Class A Common Stock,$12.28,-0.37,-2.925%,0.00,United States,2023,22300,Finance,Blank Checks +ESHAR,ESH Acquisition Corp. Right,$0.2307,0.00,0.00%,0.00,United States,2023,110,Finance,Blank Checks +ESI,Element Solutions Inc. Common Stock,$29.89,0.60,2.048%,7233377429.00,United States,2014,2624205,Industrials,Major Chemicals +ESLA,Estrella Immunopharma Inc. Common Stock,$1.06,-0.01,-0.935%,40249194.00,United States,2021,22543,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ESLAW,Estrella Immunopharma Inc. Warrant,$0.0599,0.0095,18.849%,2274459.00,United States,2021,14300,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ESLT,Elbit Systems Ltd. Ordinary Shares,$730.83,0.95,0.13%,33655465485.00,Israel,,113786,Industrials,Military/Government/Technical +ESNT,Essent Group Ltd. Common Shares,$62.11,-0.14,-0.225%,6003869423.00,Bermuda,2013,553974,Finance,Property-Casualty Insurers +ESOA,Energy Services of America Corporation Common Stock,$9.13,0.01,0.11%,152925802.00,United States,,123587,Industrials,Water Sewer Pipeline Comm & Power Line Construction +ESP,Espey Mfg. & Electronics Corp. Common Stock,$54.00,1.06,2.002%,158495022.00,United States,1960,12257,Technology,Industrial Machinery/Components +ESPR,Esperion Therapeutics Inc. Common Stock,$3.46,0.04,1.17%,827159492.00,United States,2013,3904676,Health Care,Biotechnology: Pharmaceutical Preparations +ESQ,Esquire Financial Holdings Inc. Common Stock,$105.08,-4.27,-3.905%,900061794.00,United States,2017,247455,Finance,Commercial Banks +ESRT,Empire State Realty Trust Inc. Class A Common Stock,$6.52,-0.14,-2.102%,1109659834.00,United States,2013,1255705,Real Estate,Real Estate Investment Trusts +ESS,Essex Property Trust Inc. Common Stock,$245.48,-6.25,-2.483%,15809899321.00,United States,1994,542609,Real Estate,Real Estate Investment Trusts +ESTA,Establishment Labs Holdings Inc. Common Shares,$67.18,2.23,3.433%,1952107572.00,Costa Rica,2018,586252,Health Care,Industrial Specialties +ESTC,Elastic N.V. Ordinary Shares,$73.38,-0.84,-1.132%,7732256064.00,United States,2018,790504,Technology,Computer Software: Prepackaged Software +ET,Energy Transfer LP Common Units ,$18.24,0.29,1.616%,62624976217.00,United States,,14071368,Utilities,Natural Gas Distribution +ET^I,Energy Transfer L.P. Series I Fixed Rate Perpetual Preferred Units,$11.66,0.02,0.172%,,United States,,76093,, +ETB,Eaton Vance Tax-Managed Buy-Write Income Fund Eaton Vance Tax-Managed Buy-Write Income Fund Common Shares of Beneficial Interest,$15.52,0.03,0.194%,455844097.00,United States,2005,55054,Finance,Investment Bankers/Brokers/Service +ETD,Ethan Allen Interiors Inc. Common Stock,$24.15,-0.15,-0.617%,614529087.00,United States,,500252,Consumer Discretionary,Home Furnishings +ETG,Eaton Vance Tax-Advantaged Global Dividend Income Fund Common Shares of Beneficial Interest,$23.45,0.01,0.043%,0.00,United States,2004,105663,Finance,Investment Managers +ETHM,Dynamix Corporation Class A Ordinary Shares,$10.35,-0.01,-0.097%,0.00,United States,2024,52255,, +ETHMW,Dynamix Corporation Warrant,$1.30,-0.08,-5.797%,0.00,United States,2024,21021,, +ETHZ,ETHZilla Corporation Common Stock,$4.83,-0.17,-3.40%,91829076.00,United States,2017,308822,Health Care,Biotechnology: Pharmaceutical Preparations +ETI^,Entergy Texas Inc 5.375% Series A Preferred Stock Cumulative No Par Value,$23.7075,0.00,0.00%,,United States,,125,, +ETJ,Eaton Vance Risk-Managed Diversified Equity Income Fund Common Shares of Beneficial Interest,$8.87,-0.03,-0.337%,0.00,United States,2007,123046,Finance,Finance Companies +ETN,Eaton Corporation PLC Ordinary Shares,$347.32,6.13,1.797%,134899088000.00,Ireland,,3072496,Technology,Industrial Machinery/Components +ETO,Eaton Vance Tax-Advantage Global Dividend Opp Common Stock,$30.30,0.05,0.165%,496560581.00,United States,2004,53529,Finance,Investment Managers +ETON,Eton Pharmaceuticals Inc. Common Stock,$14.76,-0.28,-1.862%,395826817.00,United States,2018,193828,Health Care,Biotechnology: Pharmaceutical Preparations +ETOR,eToro Group Ltd. Class A Common Shares,$31.40,-0.07,-0.222%,2628305223.00,Israel,2025,1045412,Finance,Investment Bankers/Brokers/Service +ETR,Entergy Corporation Common Stock,$96.48,-0.10,-0.104%,43087669298.00,United States,,1857890,Utilities,Electric Utilities: Central +ETS,Elite Express Holding Inc. Class A Common Stock,$0.5383,0.0108,2.047%,8998585.00,United States,2025,74245,Industrials,Trucking Freight/Courier Services +ETSY,Etsy Inc. Common Stock,$57.19,-1.44,-2.456%,5644996598.00,United States,2025,2357300,Real Estate,Real Estate +ETV,Eaton Vance Corporation Eaton Vance Tax-Managed Buy-Write Opportunities Fund Common Shares of Beneficial Interest,$14.64,0.07,0.48%,1599688629.00,United States,2005,298762,Finance,Investment Bankers/Brokers/Service +ETW,Eaton Vance Corporation Eaton Vance Tax-Managed Global Buy-Write Opportunites Fund Common Shares of Beneficial Interest,$9.36,-0.01,-0.107%,1025835277.00,United States,2005,315148,Finance,Investment Managers +ETX ,Eaton Vance Municipal Income 2028 Term Trust Common Shares of Beneficial Interest,$19.00,0.06,0.317%,206814164.00,,2013,4105,Finance,Investment Managers +ETY,Eaton Vance Tax-Managed Diversified Equity Income Fund Common Shares of Beneficial Interest,$15.29,-0.02,-0.131%,0.00,United States,2006,164137,Finance,Finance Companies +EU,enCore Energy Corp. Common Shares,$3.64,0.31,9.309%,681588304.00,United States,,5239519,Basic Materials,Other Metals and Minerals +EUDA,EUDA Health Holdings Limited Ordinary Shares,$1.30,-0.10,-7.143%,49149738.00,Singapore,2021,341091,Health Care,Medical/Nursing Services +EUDAW,EUDA Health Holdings Limited Warrant,$0.0896,0.0147,19.626%,3387551.00,Singapore,2021,958,Health Care,Medical/Nursing Services +EURK,Eureka Acquisition Corp Class A Ordinary Share,$11.17,0.02,0.179%,0.00,United States,2024,762,, +EVAC,EQV Ventures Acquisition Corp. II Class A Ordinary Shares,$10.11,0.00,0.00%,0.00,,2025,37379,Industrials,Fluid Controls +EVAX,Evaxion A/S American Depositary Share,$3.55,-0.46,-11.471%,29474638.00,Denmark,2021,163706,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +EVC,Entravision Communications Corporation Common Stock,$3.09,-0.05,-1.592%,281116730.00,United States,2000,175141,Industrials,Broadcasting +EVCM,EverCommerce Inc. Common Stock,$11.86,-0.33,-2.707%,2127297115.00,United States,2021,94023,Technology,Computer Software: Prepackaged Software +EVER,EverQuote Inc. Class A Common Stock,$22.79,-0.39,-1.682%,819435440.00,United States,2018,655545,Technology,Computer Software: Programming Data Processing +EVEX,Eve Holding Inc. Common Stock,$4.09,-0.08,-1.918%,1424565749.00,,2022,790881,Industrials,Aerospace +EVF,Eaton Vance Senior Income Trust Common Stock,$5.34,0.03,0.565%,93657502.00,United States,1998,108313,Finance,Investment Bankers/Brokers/Service +EVG,Eaton Vance Short Diversified Income Fund Eaton Vance Short Duration Diversified Income Fund Common Shares of Beneficial Interest,$10.933,-0.037,-0.337%,0.00,United States,2005,41488,Finance,Investment Managers +EVGN,Evogene Ltd Ordinary Shares,$1.06,-0.018,-1.67%,6905464.00,Israel,,31891,Industrials,Agricultural Chemicals +EVGO,EVgo Inc. Class A Common Stock,$3.33,0.28,9.18%,1025582501.00,United States,,5535916,Technology,EDP Services +EVGOW,EVgo Inc. Warrants,$0.0645,0.0014,2.219%,19864886.00,United States,,31782,Technology,EDP Services +EVH,Evolent Health Inc Class A Common Stock,$3.23,-0.17,-5.00%,360470765.00,United States,2015,2687142,Consumer Discretionary,Other Consumer Services +EVI,EVI Industries Inc. Common Stock,$26.00,0.50,1.961%,333954894.00,United States,1999,13656,Consumer Discretionary,Other Consumer Services +EVLV,Evolv Technologies Holdings Inc. Class A Common Stock,$6.48,-0.04,-0.613%,1131521977.00,United States,2020,1298574,Technology,Computer peripheral equipment +EVLVW,Evolv Technologies Holdings Inc. Warrant,$0.171,-0.0139,-7.518%,29859608.00,United States,2020,26983,Technology,Computer peripheral equipment +EVMN,Evommune Inc. Common Stock,$20.49,0.89,4.541%,645928666.00,,2025,527055,Health Care,Biotechnology: Pharmaceutical Preparations +EVN,Eaton Vance Municipal Income Trust Common Stock,$10.73,0.05,0.468%,425628659.00,United States,1999,101682,Finance,Investment Managers +EVO,Evotec SE American Depositary Shares,$3.79,0.13,3.552%,336146550.00,Germany,2021,60355,Health Care,Biotechnology: Pharmaceutical Preparations +EVOX,Evolution Global Acquisition Corp Class A Ordinary Shares,$9.97,0.01,0.10%,0.00,United States,2025,1693,Finance,Blank Checks +EVOXU,Evolution Global Acquisition Corp Units,$10.1001,0.00,0.00%,0.00,United States,2025,35,Finance,Blank Checks +EVR,Evercore Inc. Class A Common Stock,$363.18,-0.33,-0.091%,14047135238.00,United States,2006,307382,Finance,Investment Managers +EVRG,Evergy Inc. Common Stock,$76.65,-0.44,-0.571%,17645914138.00,United States,,1385750,Utilities,Power Generation +EVT,Eaton Vance Tax Advantaged Dividend Income Fund Common Shares of Beneficial Interest,$25.57,-0.14,-0.545%,0.00,United States,2003,95278,Finance,Finance Companies +EVTC,Evertec Inc. Common Stock,$28.73,-0.43,-1.475%,1838255752.00,Puerto Rico,2013,290818,Technology,EDP Services +EVTL,Vertical Aerospace Ltd. Ordinary Shares,$5.09,-0.26,-4.86%,507917321.00,,2021,1968351,Industrials,Aerospace +EVTV,Envirotech Vehicles Inc. Common Stock,$2.33,-0.05,-2.101%,11252770.00,United States,,1744595,Consumer Discretionary,Auto Parts:O.E.M. +EVV,Eaton Vance Limited Duration Income Fund Common Shares of Beneficial Interest,$9.91,0.00,0.00%,0.00,United States,2003,201671,Finance,Finance/Investors Services +EW,Edwards Lifesciences Corporation Common Stock,$81.86,-1.74,-2.081%,47503358000.00,United States,,2742778,Health Care,Industrial Specialties +EWBC,East West Bancorp Inc. Common Stock,$114.07,0.67,0.591%,15694389848.00,United States,,1010089,Finance,Major Banks +EWCZ,European Wax Center Inc. Class A Common Stock,$3.85,-0.14,-3.509%,209287236.00,United States,2021,674233,Consumer Discretionary,Other Consumer Services +EWTX,Edgewise Therapeutics Inc. Common Stock,$28.68,-0.68,-2.316%,3036306687.00,United States,2021,623952,Health Care,Biotechnology: Pharmaceutical Preparations +EXAS,Exact Sciences Corporation Common Stock,$102.25,-0.09,-0.088%,19373440221.00,United States,2001,2480093,Health Care,Medical Specialities +EXC,Exelon Corporation Common Stock,$44.76,-0.07,-0.156%,45220594544.00,United States,,6165275,Utilities,Power Generation +EXE,Expand Energy Corporation Common Stock,$109.66,0.84,0.772%,26117688973.00,United States,,2377262,Energy,Oil & Gas Production +EXEEL,Expand Energy Corporation Class C Warrants,$98.18,-1.77,-1.771%,23383500851.00,United States,,3129,Energy,Oil & Gas Production +EXEL,Exelixis Inc. Common Stock,$42.66,-1.08,-2.469%,11437664618.00,United States,2000,2330455,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +EXFY,Expensify Inc. Class A Common Stock,$1.46,-0.04,-2.667%,135836817.00,United States,2021,351513,Technology,Computer Software: Prepackaged Software +EXG,Eaton Vance Tax-Managed Global Diversified Equity Income Fund Common Shares of Beneficial Interest,$9.67,-0.01,-0.103%,0.00,United States,2007,404882,Finance,Finance Companies +EXK,Endeavour Silver Corporation Ordinary Shares (Canada),$13.85,0.04,0.29%,4074358361.00,Canada,,18350650,Basic Materials,Precious Metals +EXLS,ExlService Holdings Inc. Common Stock,$39.78,-0.71,-1.754%,6313121205.00,United States,2006,1564527,Real Estate,Real Estate +EXOD,Exodus Movement Inc. Class A Common Stock,$14.33,-1.15,-7.429%,420221303.00,United States,,128893,Finance,Finance: Consumer Services +EXOZ,eXoZymes Inc. Common Stock,$10.37,-0.60,-5.469%,87110675.00,United States,2024,2179,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +EXP,Eagle Materials Inc Common Stock,$217.92,-1.59,-0.724%,6987360076.00,United States,,616395,Industrials,Building Materials +EXPD,Expeditors International of Washington Inc. Common Stock,$160.07,1.69,1.067%,21452730425.00,United States,,1648223,Industrials,Integrated Freight & Logistics +EXPE,Expedia Group Inc. Common Stock,$265.76,-0.98,-0.367%,32564241186.00,United States,,1500573,Consumer Discretionary,Transportation Services +EXPI,eXp World Holdings Inc. Common Stock,$9.20,0.14,1.545%,1461297861.00,United States,,841972,Finance,Real Estate +EXPO,Exponent Inc. Common Stock,$73.49,-1.18,-1.58%,3666212239.00,United States,,191564,Consumer Discretionary,Professional Services +EXR,Extra Space Storage Inc Common Stock,$137.16,-2.63,-1.881%,29111878073.00,United States,2004,958841,Real Estate,Real Estate Investment Trusts +EXTR,Extreme Networks Inc. Common Stock,$15.02,0.32,2.177%,2008451555.00,United States,1999,4503928,Telecommunications,Computer Communications Equipment +EYE,National Vision Holdings Inc. Common Stock,$25.73,-0.67,-2.538%,2040634927.00,United States,2017,1105391,Health Care,Ophthalmic Goods +EYPT,EyePoint Inc. Common Stock,$15.04,-0.77,-4.87%,1245119789.00,United States,,683641,Industrials,Biotechnology: Laboratory Analytical Instruments +EZGO,EZGO Technologies Ltd. Ordinary Shares,$1.74,-0.03,-1.695%,1539456.00,China,2021,19678,Consumer Discretionary,Motor Vehicles +EZPW,EZCORP Inc. Class A Non Voting Common Stock,$20.98,-0.35,-1.641%,1277506230.00,United States,1991,622623,Consumer Discretionary,Other Specialty Stores +EZRA,Reliance Global Group Inc. Common Stock,$0.1971,-0.078,-28.353%,3653064.00,United States,,14630353,Finance,Specialty Insurers +EZRAW,Reliance Global Group Inc. Series A Warrants,$0.0054,0.0019,54.286%,100084.00,United States,,17652,Finance,Specialty Insurers +F,Ford Motor Company Common Stock,$13.82,-0.11,-0.79%,55065770182.00,United States,,48751764,Industrials,Auto Manufacturing +F^B,Ford Motor Company 6.20% Notes due June 1 2059,$22.01,-0.05,-0.227%,,United States,,55810,, +F^C,Ford Motor Company 6% Notes due December 1 2059,$21.674,-0.046,-0.212%,,United States,,57236,, +F^D,Ford Motor Company 6.500% Notes due August 15 2062,$23.30,0.055,0.237%,,United States,,44940,, +FA,First Advantage Corporation Common Stock,$12.91,-0.52,-3.872%,2247824108.00,United States,2021,836369,Technology,EDP Services +FACT,FACT II Acquisition Corp. Class A Ordinary Shares,$10.475,0.005,0.048%,0.00,United States,2024,43181,, +FACTU,FACT II Acquisition Corp. Unit,$10.71,0.00,0.00%,0.00,United States,2024,130,Finance,Blank Checks +FACTW,FACT II Acquisition Corp. Warrant,$0.58,0.03,5.455%,0.00,United States,2024,45746,Finance,Blank Checks +FAF,First American Corporation (New) Common Stock,$63.81,-0.92,-1.421%,6502239000.00,United States,,751772,Finance,Specialty Insurers +FAMI,Farmmi Inc. Ordinary Shares,$1.50,-0.13,-7.975%,8222811.00,China,2018,643771,Consumer Staples,Packaged Foods +FANG,Diamondback Energy Inc. Common Stock,$160.27,1.15,0.723%,45921460156.00,United States,2012,1748825,Energy,Oil & Gas Production +FARM,Farmer Brothers Company Common Stock,$1.70,0.01,0.592%,36723420.00,United States,,69442,Consumer Staples,Packaged Foods +FAST,Fastenal Company Common Stock,$43.62,-0.33,-0.751%,50077318150.00,United States,1987,4645652,Consumer Discretionary,RETAIL: Building Materials +FAT,FAT Brands Inc. Class A Common Stock,$0.254,-0.006,-2.308%,4556589.00,United States,2017,2999494,Consumer Discretionary,Restaurants +FATBB,FAT Brands Inc. Class B Common Stock,$0.6166,-0.3934,-38.95%,11061388.00,United States,,52706,Consumer Discretionary,Restaurants +FATBP,FAT Brands Inc. 8.25% Series B Cumulative Preferred Stock,$0.5001,-0.2101,-29.583%,8971456.00,United States,,98255,Consumer Discretionary,Restaurants +FATE,Fate Therapeutics Inc. Common Stock,$1.21,-0.10,-7.634%,139576270.00,United States,2013,2335856,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +FATN,FatPipe Inc. Common Stock,$1.92,-0.03,-1.538%,26734979.00,United States,2025,35646,Technology,Computer Software: Prepackaged Software +FAX,abrdn Asia-Pacific Income Fund Inc. Common Stock,$15.63,0.08,0.514%,0.00,United States,1986,229096,Finance,Investment Managers +FBGL,FBS Global Limited Ordinary Shares,$0.8501,0.025,3.03%,11476350.00,Singapore,2025,2764840,Consumer Discretionary,Miscellaneous manufacturing industries +FBIN,Fortune Brands Innovations Inc. Common Stock,$54.88,-0.52,-0.939%,6593193087.00,United States,,1173007,Basic Materials,Forest Products +FBIO,Fortress Biotech Inc. Common Stock,$3.38,-0.08,-2.312%,106936227.00,United States,,508607,Health Care,Biotechnology: Pharmaceutical Preparations +FBIOP,Fortress Biotech Inc. 9.375% Series A Cumulative Redeemable Perpetual Preferred Stock,$12.47,-0.06,-0.479%,394525074.00,United States,,20584,Health Care,Biotechnology: Pharmaceutical Preparations +FBIZ,First Business Financial Services Inc. Common Stock,$55.44,-1.15,-2.032%,461496864.00,United States,,30782,Finance,Major Banks +FBK,FB Financial Corporation Common Stock,$57.08,-0.09,-0.157%,3051638473.00,United States,2016,309872,Finance,Major Banks +FBLA,FB Bancorp Inc. Common Stock,$12.61,-0.15,-1.176%,250150875.00,United States,2024,72856,Finance,Banks +FBLG,FibroBiologics Inc. Common Stock,$0.358,-0.0121,-3.269%,23814060.00,United States,,468756,Health Care,Biotechnology: Pharmaceutical Preparations +FBNC,First Bancorp Common Stock,$56.80,0.12,0.212%,2355230687.00,United States,1987,262211,Finance,Major Banks +FBP,First BanCorp. New Common Stock,$21.88,-0.10,-0.455%,3455659875.00,Puerto Rico,,2655856,Finance,Major Banks +FBRT,Franklin BSP Realty Trust Inc. Common Stock,$10.25,-0.03,-0.292%,836467732.00,United States,2021,533633,Real Estate,Real Estate Investment Trusts +FBRT^E,Franklin BSP Realty Trust Inc. 7.50% Series E Cumulative Redeemable Preferred Stock,$21.90,0.02,0.091%,,United States,,12789,, +FBRX,Forte Biosciences Inc. Common Stock,$29.85,-5.68,-15.986%,373929010.00,United States,2017,362590,Health Care,Biotechnology: Pharmaceutical Preparations +FBYD,Falcon's Beyond Global Inc. Class A Common Stock,$5.41,-1.29,-19.254%,715332944.00,United States,,256931,Consumer Discretionary,Services-Misc. Amusement & Recreation +FBYDW,Falcon's Beyond Global Inc. Warrants,$1.28,0.04,3.226%,169246981.00,United States,,410,Consumer Discretionary,Services-Misc. Amusement & Recreation +FC,Franklin Covey Company Common Stock,$20.05,0.07,0.35%,231628668.00,United States,,118776,Consumer Discretionary,Other Consumer Services +FCAP,First Capital Inc. Common Stock,$49.99,-2.73,-5.178%,167347874.00,United States,,5309,Finance,Savings Institutions +FCBC,First Community Bankshares Inc. (VA) Common Stock,$33.58,-0.27,-0.798%,615014510.00,United States,,54723,Finance,Major Banks +FCCO,First Community Corporation Common Stock,$28.85,0.27,0.945%,221847672.00,United States,,79017,Finance,Major Banks +FCEL,FuelCell Energy Inc. Common Stock,$9.63,0.04,0.417%,459120294.00,United States,,2857251,Energy,Industrial Machinery/Components +FCF,First Commonwealth Financial Corporation Common Stock,$17.60,-0.10,-0.565%,1826281371.00,United States,,914590,Finance,Major Banks +FCFS,FirstCash Holdings Inc. Common Stock,$166.07,-2.29,-1.36%,7329358291.00,United States,1991,181767,Consumer Discretionary,Other Specialty Stores +FCHL,Fitness Champs Holdings Limited Common Stock,$0.2305,-0.0059,-2.496%,3457500.00,Singapore,2025,111342,Consumer Discretionary,Services-Misc. Amusement & Recreation +FCN,FTI Consulting Inc. Common Stock,$179.24,-3.75,-2.049%,5534226787.00,United States,1999,257297,Consumer Discretionary,Professional Services +FCNCA,First Citizens BancShares Inc. Class A Common Stock,$1980.05,-20.77,-1.038%,24623014738.00,United States,,85598,Finance,Major Banks +FCNCO,First Citizens BancShares Inc. 5.625% Non-Cumulative Perpetual Preferred Stock Series C,$22.2601,-0.0199,-0.089%,276816631.00,United States,,4441,Finance,Major Banks +FCNCP,First Citizens BancShares Inc. Depositary Shares,$21.09,-0.21,-0.986%,262265792.00,United States,,6876,Finance,Major Banks +FCO,abrdn Global Income Fund Inc. Common Stock,$3.14,-0.05,-1.567%,0.00,United States,1992,134934,Finance,Investment Managers +FCPT,Four Corners Property Trust Inc. Common Stock,$23.94,-0.38,-1.563%,2539603391.00,United States,2015,865361,Real Estate,Real Estate Investment Trusts +FCRS,FutureCrest Acquisition Corp. Class A Ordinary Shares,$10.29,0.06,0.587%,0.00,,2025,318576,Finance,Blank Checks +FCRX,Crescent Capital BDC Inc. 5.00% Notes due 2026,$25.00,0.00,0.00%,926538675.00,United States,2023,322,Finance,Finance: Consumer Services +FCT,First Trust Senior Floating Rate Income Fund II Common Shares of Beneficial Interest,$10.09,-0.02,-0.198%,0.00,United States,2004,105220,Finance,Finance Companies +FCUV,Focus Universal Inc. Common Stock,$0.78,0.00,0.00%,6405130.00,United States,,30072,Industrials,Industrial Machinery/Components +FCX,Freeport-McMoRan Inc. Common Stock,$63.63,0.76,1.209%,91368267896.00,United States,,22636450,Basic Materials,Metal Mining +FDBC,Fidelity D & D Bancorp Inc. Common Stock,$42.73,-0.95,-2.175%,246436131.00,United States,,10848,Finance,Major Banks +FDMT,4D Molecular Therapeutics Inc. Common Stock,$8.60,0.11,1.296%,491361645.00,United States,2020,898757,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +FDP,Fresh Del Monte Produce Inc. Common Stock,$39.01,-0.32,-0.814%,1863694051.00,Cayman Islands,1997,165452,Consumer Staples,Farming/Seeds/Milling +FDS,FactSet Research Systems Inc. Common Stock,$269.86,1.20,0.447%,10011606034.00,United States,2000,788124,Technology,Computer Software: Programming Data Processing +FDSB,Fifth District Bancorp Inc. Common Stock,$15.10,0.04,0.266%,83393525.00,United States,2024,7782,Finance,Savings Institutions +FDUS,Fidus Investment Corporation Common Stock,$19.19,-0.27,-1.387%,699043552.00,United States,2011,164501,Finance,Finance/Investors Services +FDX,FedEx Corporation Common Stock,$314.65,2.23,0.714%,73981394054.00,United States,,1393556,Consumer Discretionary,Air Freight/Delivery Services +FE,FirstEnergy Corp. Common Stock,$47.41,-0.11,-0.231%,27387123963.00,United States,,3726228,Utilities,Electric Utilities: Central +FEAM,5E Advanced Materials Inc. Common Stock,$2.26,-0.92,-28.931%,53136856.00,United States,,1080560,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +FEBO,Fenbo Holdings Limited Class A Ordinary Shares,$1.17,-0.02,-1.681%,12943125.00,Hong Kong,2023,3150,Consumer Discretionary,Home Furnishings +FEDU,Four Seasons Education (Cayman) Inc. American Depositary Shares each ADS representing 10 ordinary shares,$9.80,-0.248,-2.468%,22148568.00,,2017,502,Real Estate,Other Consumer Services +FEED,ENvue Medical Inc. Common Stock,$2.30,1.25,119.048%,2502805.00,United States,,273465872,Health Care,Industrial Specialties +FEIM,Frequency Electronics Inc. Common Stock,$54.63,-1.38,-2.464%,534152856.00,United States,,155208,Industrials,Electrical Products +FELE,Franklin Electric Co. Inc. Common Stock,$98.16,-1.73,-1.732%,4369138999.00,United States,,444630,Consumer Discretionary,Metal Fabrications +FEMY,Femasys Inc. Common Stock,$0.5872,-0.0077,-1.294%,34939489.00,United States,2021,466155,Health Care,Medical/Dental Instruments +FENC,Fennec Pharmaceuticals Inc. Common Stock,$7.46,-0.39,-4.968%,209342520.00,United States,,188884,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +FENG,Phoenix New Media Limited American Depositary Shares each representing 48 Class A ordinary shares.,$1.84,-0.01,-0.541%,22099828.00,China,2011,5828,Industrials,Broadcasting +FER,Ferrovial SE Ordinary Shares,$68.29,-1.43,-2.051%,49181508223.00,Netherlands,,1434987,Industrials,Military/Government/Technical +FERA,Fifth Era Acquisition Corp I Class A Ordinary Shares,$10.30,0.00,0.00%,0.00,Cayman Islands,2025,43,, +FERG,Ferguson Enterprises Inc. Common Stock,$251.73,0.16,0.064%,50698184619.00,United Kingdom,2021,982702,Miscellaneous,Miscellaneous +FET,Forum Energy Technologies Inc. Common Stock,$43.60,-1.61,-3.561%,496078969.00,United States,2012,199482,Consumer Discretionary,Oil and Gas Field Machinery +FF,FutureFuel Corp. Common shares,$3.27,-0.01,-0.305%,143236605.00,United States,,158716,Industrials,Major Chemicals +FFA,First Trust Enhanced Equity Income Fund Common Shares of Beneficial Interest,$22.00,-0.04,-0.181%,0.00,United States,2004,45179,Finance,Investment Managers +FFAI,Faraday Future Intelligent Electric Inc. Class A Common Stock,$1.04,0.02,1.961%,206231226.00,United States,2020,5681333,Industrials,Auto Manufacturing +FFAIW,Faraday Future Intelligent Electric Inc. Warrant,$0.0374,0.0044,13.333%,7416392.00,United States,2020,88038,Industrials,Auto Manufacturing +FFBC,First Financial Bancorp. Common Stock,$27.20,-0.09,-0.33%,2680007677.00,United States,,1872876,Finance,Major Banks +FFC,Flaherty & Crumrine Preferred and Income Securities Fund Incorporated,$16.54,-0.05,-0.301%,0.00,United States,2003,113083,Finance,Trusts Except Educational Religious and Charitable +FFIC,Flushing Financial Corporation Common Stock,$15.37,-0.19,-1.221%,519174592.00,United States,,430845,Finance,Major Banks +FFIN,First Financial Bankshares Inc. Common Stock,$31.32,-0.52,-1.633%,4485215115.00,United States,,792598,Finance,Major Banks +FFIV,F5 Inc. Common Stock,$292.30,21.87,8.087%,16979594172.00,United States,1999,2875237,Telecommunications,Computer Communications Equipment +FFWM,First Foundation Inc. Common Stock,$6.01,-0.19,-3.065%,498135250.00,United States,,1531393,Finance,Major Banks +FG,F&G Annuities & Life Inc. Common Stock,$28.52,-0.17,-0.593%,3839349195.00,United States,2022,948973,Finance,Life Insurance +FGBI,First Guaranty Bancshares Inc. Common Stock,$8.44,0.05,0.596%,129578873.00,United States,,4766,Finance,Savings Institutions +FGBIP,First Guaranty Bancshares Inc. 6.75% Series A Fixed-Rate Non-Cumulative Perpetual Preferred Stock,$16.85,0.164,0.983%,258697157.00,United States,,5712,Finance,Savings Institutions +FGI,FGI Industries Ltd. Ordinary Shares,$6.61,-0.22,-3.221%,12692125.00,United States,2022,9441,Industrials,Industrial Specialties +FGIIU,FG Imperii Acquisition Corp. Units,$10.00,0.01,0.10%,0.00,United States,2026,1259,Finance,Blank Checks +FGIWW,FGI Industries Ltd. Warrant,$0.0425,0.0026,6.516%,81606.00,United States,2022,2082,Industrials,Industrial Specialties +FGL,Founder Group Limited Class A Ordinary Shares,$0.15,-0.0042,-2.724%,2912293.00,Malaysia,2024,579029,Consumer Discretionary,Engineering & Construction +FGMC,FG Merger II Corp. Common stock,$10.08,-0.01,-0.099%,103223212.00,United States,2025,91271,, +FGMCR,FG Merger II Corp. Rights,$0.6265,-0.0134,-2.094%,0.00,United States,2025,34799,, +FGN,F&G Annuities & Life Inc. 7.950% Senior Notes due 2053,$25.88,-0.034,-0.131%,3263430422.00,United States,2023,24695,Finance,Life Insurance +FGNX,FG Nexus Inc. Common Stock ,$2.98,-0.03,-0.997%,117931563.00,United States,2014,329880,Finance,Property-Casualty Insurers +FGNXP,FG Nexus Inc. 8.00% Cumulative Preferred Stock,$24.78,0.78,3.25%,980652393.00,United States,,5844,Finance,Property-Casualty Insurers +FGSN,F&G Annuities & Life Inc. 7.300% Junior Subordinated Notes due 2065,$22.55,0.05,0.222%,0.00,United States,2025,51006,Finance,Life Insurance +FHB,First Hawaiian Inc. Common Stock,$27.01,-0.06,-0.222%,3341665991.00,United States,2016,1520564,Finance,Major Banks +FHI,Federated Hermes Inc. Common Stock,$52.91,0.40,0.762%,4103004733.00,United States,,661803,Finance,Investment Managers +FHN,First Horizon Corporation Common Stock,$24.20,-0.08,-0.329%,11915937365.00,United States,,5424338,Finance,Major Banks +FHN^C,First Horizon Corporation Depositary Shares each representing a 1/400th interest in a share of Non-Cumulative Perpetual Preferred Stock Series C,$25.12,-0.01,-0.04%,,United States,,621,, +FHN^E,First Horizon Corporation Depositary Shares each representing a 1/4000th interest in a share of Non-Cumulative Perpetual Preferred Stock Series E,$24.9999,-0.0501,-0.20%,,United States,,2655,, +FHN^F,First Horizon Corporation Depositary Shares each representing 1/4000th Interest in a Share of Non-Cumulative Perpetual Preferred Stock Series F,$18.0967,0.0016,0.009%,,United States,,4576,, +FHTX,Foghorn Therapeutics Inc. Common Stock,$5.87,-0.03,-0.508%,331956066.00,United States,2020,171415,Health Care,Biotechnology: Pharmaceutical Preparations +FIBK,First Interstate BancSystem Inc. Common Stock (DE),$36.66,-0.20,-0.543%,3771969909.00,United States,2010,759647,Finance,Major Banks +FICO,Fair Isaac Corporation Common Stock,$1525.67,-19.33,-1.251%,36144130768.00,United States,,368351,Real Estate,Real Estate +FIEE,FiEE Inc Common Stock,$7.26,1.19,19.605%,45708677.00,United States,,253039,Utilities,Telecommunications Equipment +FIG,Figma Inc. Class A Common Stock,$30.06,1.60,5.622%,14897487043.00,United States,2025,7587034,Technology,Computer Software: Prepackaged Software +FIGR,Figure Technology Solutions Inc. Class A Common Stock,$67.915,5.135,8.179%,14533372559.00,U.S. Virgin Islands,2025,5084836,Finance,Finance: Consumer Services +FIGS,FIGS Inc. Class A Common Stock,$11.29,-0.15,-1.311%,1857190312.00,United States,2021,1830746,Consumer Discretionary,Apparel +FIGX,FIGX Capital Acquisition Corp. Class A Ordinary Share,$10.11,-0.01,-0.099%,0.00,United States,2025,2138,, +FIHL,Fidelis Insurance Holdings Limited Common Shares,$18.70,0.03,0.161%,2090161439.00,Bermuda,2023,346144,Finance,Property-Casualty Insurers +FINS,Angel Oak Financial Strategies Income Term Trust Common Shares of Beneficial Interest,$13.12,-0.04,-0.304%,328821811.00,,2019,35201,Finance,Finance/Investors Services +FINV,FinVolution Group American Depositary Shares,$5.20,0.03,0.58%,1317752077.00,United States,2017,802445,Finance,Finance: Consumer Services +FINW,FinWise Bancorp Common Stock,$18.24,0.08,0.441%,247825439.00,United States,2021,28446,Finance,Major Banks +FIP,FTAI Infrastructure Inc. Common Stock ,$5.99,0.09,1.525%,696603821.00,United States,,646416,Energy,Oil Refining/Marketing +FIS,Fidelity National Information Services Inc. Common Stock,$56.19,-1.87,-3.221%,29098034429.00,United States,,4833333,Real Estate,Real Estate +FISI,Financial Institutions Inc. Common Stock,$31.97,-0.25,-0.776%,643573556.00,United States,1999,97359,Finance,Major Banks +FISV,Fiserv Inc. Common Stock,$64.95,-1.34,-2.021%,34933480061.00,United States,1986,7358710,Real Estate,Real Estate +FITB,Fifth Third Bancorp Common Stock,$49.69,-1.15,-2.262%,32845674802.00,United States,,13180232,Finance,Major Banks +FITBI,Fifth Third Bancorp Depositary Shares,$25.79,-0.0192,-0.074%,17047493523.00,United States,,26814,Finance,Major Banks +FITBO,Fifth Third Bancorp Depositary Shares each representing a 1/1000th ownership interest in a share of Non-Cumulative Perpetual Preferred Stock Series K,$19.95,-0.12,-0.598%,13187184792.00,United States,,12395,Finance,Major Banks +FITBP,Fifth Third Bancorp Depositary Shares each representing 1/40th share of Fifth Third 6.00% Non-Cumulative Perpetual Class B Preferred Stock Series A,$24.81,-0.03,-0.121%,16399701989.00,United States,,5681,Finance,Major Banks +FIVE,Five Below Inc. Common Stock,$185.42,-1.82,-0.972%,10227226701.00,United States,2012,719372,Consumer Discretionary,Department/Specialty Retail Stores +FIVN,Five9 Inc. Common Stock,$18.27,-0.10,-0.544%,1429007270.00,United States,2014,1607243,Technology,EDP Services +FIX,Comfort Systems USA Inc. Common Stock,$1169.05,8.67,0.747%,41234673148.00,United States,1997,299186,Industrials,Engineering & Construction +FIZZ,National Beverage Corp. Common Stock,$33.16,-0.24,-0.719%,3104840502.00,United States,,226747,Consumer Staples,Beverages (Production/Distribution) +FJET,Starfighters Space Inc. Common Stock,$8.75,-0.73,-7.70%,384522880.00,,2025,1046936,Consumer Discretionary,Air Freight/Delivery Services +FKWL,Franklin Wireless Corp. Common Stock,$4.18,0.00,0.00%,49258290.00,United States,,1546,Utilities,Telecommunications Equipment +FLC,Flaherty & Crumrine Total Return Fund Inc Common Stock,$17.65,-0.01,-0.057%,0.00,United States,2003,24397,Finance,Trusts Except Educational Religious and Charitable +FLD,Fold Holdings Inc. Class A Common Stock,$2.07,0.05,2.475%,101763384.00,United States,2025,132805,Finance,Finance: Consumer Services +FLDDW,Fold Holdings Inc. Warrant,$0.1308,0.0006,0.461%,6430266.00,United States,2025,2053,Finance,Finance: Consumer Services +FLEX,Flex Ltd. Ordinary Shares,$66.27,1.17,1.797%,24506005037.00,Singapore,1994,2663852,Technology,Electrical Products +FLG,Flagstar Bank N.A. Common Stock,$12.94,-0.14,-1.07%,5379881048.00,United States,,2917854,Finance,Banks +FLG^A,Flagstar Bank N.A. Depositary shares each representing a 1/40th interest in a share of Fixed-to-Floating Rate Series A Noncumulative Perpetual Preferred Stock,$22.77,0.02,0.088%,,United States,,15764,, +FLG^U,Flagstar Bank N.A. Bifurcated Option Note Unit SecuritiES,$40.56,0.13,0.322%,,United States,,1270,, +FLGT,Fulgent Genetics Inc. Common Stock,$26.40,-0.87,-3.19%,816087149.00,United States,2016,119708,Health Care,Medical Specialities +FLL,Full House Resorts Inc. Common Stock,$2.42,-0.02,-0.82%,87414025.00,United States,,335097,Consumer Discretionary,Hotels/Resorts +FLNC,Fluence Energy Inc. Class A Common Stock,$30.99,2.55,8.966%,5695216164.00,United States,2021,6062616,Miscellaneous,Industrial Machinery/Components +FLNG,FLEX LNG Ltd. Ordinary Shares,$26.52,0.43,1.648%,1434407607.00,,2019,332613,Consumer Discretionary,Marine Transportation +FLNT,Fluent Inc. Common Stock,$3.77,-0.16,-4.071%,111727219.00,United States,,73088,Consumer Discretionary,Advertising +FLO,Flowers Foods Inc. Common Stock,$11.08,-0.05,-0.449%,2339854733.00,United States,,3876014,Consumer Staples,Packaged Foods +FLOC,Flowco Holdings Inc. Class A Common Stock,$19.82,-0.67,-3.27%,1776960970.00,United States,2025,222372,Consumer Discretionary,Oil and Gas Field Machinery +FLR,Fluor Corporation Common Stock,$46.78,0.79,1.718%,7540117677.00,United States,,2282149,Industrials,Military/Government/Technical +FLS,Flowserve Corporation Common Stock,$76.90,-0.70,-0.902%,9775182642.00,United States,,1018685,Industrials,Fluid Controls +FLUT,Flutter Entertainment plc Ordinary Shares,$166.73,-1.39,-0.827%,29207947137.00,Ireland,2024,3416062,Technology,Computer Software: Programming Data Processing +FLUX,Flux Power Holdings Inc. Common Stock,$1.48,0.03,2.069%,31583400.00,United States,,104253,Miscellaneous,Industrial Machinery/Components +FLWS,1-800-FLOWERS.COM Inc. Common Stock,$4.04,-0.01,-0.247%,257214337.00,United States,1999,415312,Consumer Discretionary,Other Specialty Stores +FLX,BingEx Limited American Depositary Shares,$3.19,0.03,0.949%,226904413.00,China,2024,324709,Industrials,Trucking Freight/Courier Services +FLXS,Flexsteel Industries Inc. Common Stock,$38.50,-0.94,-2.383%,205607171.00,United States,,14241,Consumer Discretionary,Home Furnishings +FLY,Firefly Aerospace Inc. Common Stock,$28.86,-0.49,-1.67%,4595987381.00,United States,2025,3526354,Industrials,Military/Government/Technical +FLYE,Fly-E Group Inc. Common Stock,$6.01,0.065,1.093%,9810640.00,United States,2024,6504,Industrials,Aerospace +FLYW,Flywire Corporation Voting Common Stock,$13.20,-0.15,-1.124%,1587347678.00,United States,2021,756194,Real Estate,Real Estate +FLYX,flyExclusive Inc. Class A Common Stock,$3.25,0.22,7.261%,296122899.00,,2023,264399,Consumer Discretionary,Transportation Services +FMAO,Farmers & Merchants Bancorp Inc. Common Stock,$25.49,-0.78,-2.969%,350486073.00,United States,,22632,Finance,Savings Institutions +FMBH,First Mid Bancshares Inc. Common Stock,$42.06,-0.52,-1.221%,1009157104.00,United States,,87539,Finance,Major Banks +FMC,FMC Corporation Common Stock,$16.02,-0.06,-0.373%,2001219473.00,United States,,3848402,Industrials,Major Chemicals +FMFC,Kandal M Venture Limited Class A Ordinary Shares,$0.355,0.0064,1.836%,6787600.00,Cambodia,2025,74302,Consumer Discretionary,Apparel +FMN,Federated Hermes Premier Municipal Income Fund,$11.24,0.11,0.988%,969504514.00,United States,2002,18749,Finance,Investment Managers +FMNB,Farmers National Banc Corp. Common Stock,$12.76,-0.83,-6.107%,480454615.00,United States,,528048,Finance,Major Banks +FMS,Fresenius Medical Care AG American Depositary Shares (Each representing 1/2 of an Ordinary Share),$22.19,-0.23,-1.026%,13021688867.00,Germany,,421976,Health Care,Misc Health and Biotechnology Services +FMST,Foremost Clean Energy Ltd. Common Shares,$2.28,-0.10,-4.202%,32912666.00,Canada,,209529,Basic Materials,Other Metals and Minerals +FMSTW,Foremost Clean Energy Ltd. Warrant,$0.859,0.099,13.026%,12399991.00,Canada,,700,Basic Materials,Other Metals and Minerals +FMX,Fomento Economico Mexicano S.A.B. de C.V. Common Stock,$108.09,0.49,0.455%,37572353685.00,Mexico,,377205,Consumer Staples,Beverages (Production/Distribution) +FMY,First Trust Mortgage Income Fund Common Shares of Beneficial Interest,$12.15,-0.06,-0.491%,0.00,United States,2005,4573,Finance,Finance/Investors Services +FN,Fabrinet Ordinary Shares,$501.00,2.41,0.483%,17949432210.00,Cayman Islands,2010,521846,Utilities,Telecommunications Equipment +FNB,F.N.B. Corporation Common Stock,$17.23,-0.20,-1.147%,6170693325.00,United States,,6008343,Finance,Major Banks +FND,Floor & Decor Holdings Inc. Common Stock,$69.32,-2.52,-3.508%,7469654724.00,United States,2017,2260276,Consumer Discretionary,RETAIL: Building Materials +FNF,Fidelity National Financial Inc. Common Stock,$54.32,-0.21,-0.385%,14727377242.00,United States,2014,1572660,Finance,Specialty Insurers +FNGR,FingerMotion Inc. Common Stock,$1.22,-0.01,-0.813%,74763196.00,United States,,110435,Technology,Computer Software: Prepackaged Software +FNKO,Funko Inc. Class A Common Stock,$4.21,-0.03,-0.708%,233195386.00,United States,2017,668001,Consumer Discretionary,Recreational Games/Products/Toys +FNLC,First Bancorp Inc (ME) Common Stock,$26.49,-0.53,-1.962%,297199787.00,United States,,19092,Finance,Major Banks +FNV,Franco-Nevada Corporation,$267.64,5.71,2.18%,51594862241.00,Canada,,1006358,Basic Materials,Precious Metals +FNWB,First Northwest Bancorp Common Stock,$10.72,0.00,0.00%,101434248.00,United States,2015,12852,Finance,Banks +FNWD,Finward Bancorp Common Stock,$34.95,-1.69,-4.612%,151228650.00,United States,,18852,Finance,Major Banks +FOA,Finance of America Companies Inc. Class A Common Stock,$23.37,-0.41,-1.724%,184421083.00,United States,2021,46532,Finance,Finance: Consumer Services +FOF,Cohen & Steers Closed-End Opportunity Fund Inc. Common Stock,$14.48,0.30,2.116%,711527333.00,United States,2006,249537,Finance,Investment Managers +FOFO,Hang Feng Technology Innovation Co. Ltd. Ordinary Shares,$5.74,0.15,2.683%,38257100.00,Hong Kong,2025,17095,Consumer Discretionary,Professional Services +FOLD,Amicus Therapeutics Inc. Common Stock,$14.28,-0.01,-0.07%,4405859065.00,United States,2007,5901626,Health Care,Biotechnology: Pharmaceutical Preparations +FONR,Fonar Corporation Common Stock,$18.66,0.01,0.054%,128745827.00,United States,1981,24855,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +FOR,Forestar Group Inc Common Stock ,$25.18,0.14,0.559%,1281462574.00,United States,2017,207382,Finance,Real Estate +FORA,Forian Inc. Common Stock,$2.13,0.01,0.472%,66183897.00,United States,,3183,Technology,EDP Services +FORM,FormFactor Inc. FormFactor Inc. Common Stock,$72.55,-1.21,-1.64%,5623865387.00,United States,2003,1840737,Technology,Semiconductors +FORR,Forrester Research Inc. Common Stock,$7.84,-0.04,-0.508%,148983520.00,United States,1996,88625,Industrials,Diversified Commercial Services +FORTY,Formula Systems (1985) Ltd. American Depositary Shares,$165.675,0.00,0.00%,2537754480.00,Israel,,206,Technology,EDP Services +FOSL,Fossil Group Inc. Common Stock,$3.81,-0.17,-4.271%,208180644.00,United States,1993,563615,Consumer Discretionary,Consumer Specialties +FOUR,Shift4 Payments Inc. Class A Common Stock,$59.98,-1.48,-2.408%,5315381535.00,United States,2020,2854338,Real Estate,Real Estate +FOUR^A,Shift4 Payments Inc. 6.00% Series A Mandatory Convertible Preferred Stock,$75.80,-1.17,-1.52%,,United States,,98326,, +FOX,Fox Corporation Class B Common Stock,$64.29,-0.61,-0.94%,28541077533.00,United States,,1518114,Industrials,Broadcasting +FOXA,Fox Corporation Class A Common Stock,$71.14,-0.83,-1.153%,31582085172.00,United States,,3901047,Industrials,Broadcasting +FOXF,Fox Factory Holding Corp. Common Stock,$18.83,-0.36,-1.876%,787119552.00,United States,2013,527455,Consumer Discretionary,Motor Vehicles +FOXX,Foxx Development Holdings Inc. Common Stock,$4.67,0.30,6.865%,32113316.00,United States,,12466,Telecommunications,Computer Communications Equipment +FOXXW,Foxx Development Holdings Inc. Warrant,$0.1352,0.0001,0.074%,929705.00,United States,,9748,Telecommunications,Computer Communications Equipment +FPF,First Trust Intermediate Duration Preferred & Income Fund Common Shares of Beneficial Interest,$18.89,0.02,0.106%,0.00,United States,2013,94970,Finance,Trusts Except Educational Religious and Charitable +FPH,Five Point Holdings LLC Class A Common Shares,$5.49,-0.09,-1.613%,807402540.00,United States,2017,138742,Finance,Real Estate +FPI,Farmland Partners Inc. Common Stock,$10.95,-0.02,-0.182%,471918227.00,United States,2014,431774,Real Estate,Real Estate Investment Trusts +FR,First Industrial Realty Trust Inc. Common Stock,$56.87,-0.56,-0.975%,7530853926.00,United States,1994,1416826,Real Estate,Real Estate Investment Trusts +FRA,Blackrock Floating Rate Income Strategies Fund Inc Common Stock,$11.87,-0.02,-0.168%,1765810531.00,United States,2003,74538,Finance,Investment Bankers/Brokers/Service +FRAF,Franklin Financial Services Corporation Common Stock,$49.36,1.00,2.068%,221085266.00,United States,,63125,Finance,Major Banks +FRBA,First Bank Common Stock,$16.33,-0.32,-1.922%,410444801.00,United States,2013,90777,Finance,Commercial Banks +FRD,Friedman Industries Inc. Common Stock,$18.62,-0.06,-0.321%,132428829.00,United States,,20595,Industrials,Steel/Iron Ore +FRGE,Forge Global Holdings Inc. Common Stock,$44.66,0.06,0.135%,614370694.00,United States,2021,63859,Finance,Investment Bankers/Brokers/Service +FRGT,Freight Technologies Inc. Ordinary Shares,$1.37,-0.07,-4.861%,2143017.00,United States,2017,125381,Consumer Discretionary,Professional Services +FRHC,Freedom Holding Corp. Common Stock,$127.77,0.58,0.456%,7814404384.00,Kazakhstan,,61140,Finance,Investment Bankers/Brokers/Service +FRME,First Merchants Corporation Common Stock,$37.86,-0.33,-0.864%,2189255257.00,United States,,479309,Finance,Major Banks +FRMEP,First Merchants Corporation Depository Shares,$25.86,-0.27,-1.033%,1495355017.00,United States,,1033,Finance,Major Banks +FRMI,Fermi Inc. Common Stock,$9.96,0.37,3.858%,6115692765.00,United States,2025,5108323,Real Estate,Real Estate Investment Trusts +FRO,Frontline Plc Ordinary Shares,$28.06,1.02,3.772%,6246798265.00,Bermuda,,3159867,Consumer Discretionary,Marine Transportation +FROG,JFrog Ltd. Ordinary Shares,$60.075,0.905,1.529%,7107643503.00,United States,2020,1227302,Technology,Computer Software: Prepackaged Software +FRPH,FRP Holdings Inc. Common Stock,$23.07,-0.49,-2.08%,440995093.00,United States,,50648,Finance,Real Estate +FRPT,Freshpet Inc. Common Stock,$71.50,-0.50,-0.694%,3489796096.00,United States,2014,1894725,Consumer Staples,Packaged Foods +FRSH,Freshworks Inc. Class A Common Stock,$11.40,-0.19,-1.639%,3214477984.00,United States,2021,3050478,Technology,Computer Software: Prepackaged Software +FRST,Primis Financial Corp. Common Stock,$13.26,-0.24,-1.778%,326784545.00,United States,2006,49249,Finance,Major Banks +FRSX,Foresight Autonomous Holdings Ltd. American Depositary Shares,$1.04,0.05,5.051%,4548061.00,Israel,,982476,Technology,Computer Software: Prepackaged Software +FRT,Federal Realty Investment Trust Common Stock,$99.82,-1.66,-1.636%,8611474494.00,United States,,523321,Real Estate,Real Estate Investment Trusts +FRT^C,Federal Realty Investment Trust Depositary Shares each representing a 1/1000th interest in a 5.000% Series C Cumulative Redeemable Preferred Share,$20.09,-0.085,-0.421%,,United States,,5297,, +FSBC,Five Star Bancorp Common Stock,$38.43,-0.15,-0.389%,821148682.00,United States,2021,71919,Finance,Major Banks +FSBW,FS Bancorp Inc. Common Stock,$39.62,-0.86,-2.125%,297881464.00,United States,2012,12215,Finance,Banks +FSCO,FS Credit Opportunities Corp. Common Stock,$6.03,-0.07,-1.148%,1196086077.00,United States,2022,2047647,Finance,Trusts Except Educational Religious and Charitable +FSEA,First Seacoast Bancorp Inc. Common Stock,$13.00,0.00,0.00%,61057971.00,United States,2019,3869,Finance,Savings Institutions +FSFG,First Savings Financial Group Inc. Common Stock,$32.19,-0.30,-0.923%,225815425.00,United States,2008,8972,Finance,Savings Institutions +FSHP,Flag Ship Acquisition Corp. Ordinary Shares,$10.89,0.10,0.927%,0.00,United States,2024,985,, +FSHPR,Flag Ship Acquisition Corp. Right,$0.15,0.00,0.00%,0.00,United States,2024,20,, +FSHPU,Flag Ship Acquisition Corp. Unit,$10.80,-0.11,-1.008%,0.00,United States,2024,100,, +FSI,Flexible Solutions International Inc. Common Stock (CDA),$5.87,-0.11,-1.839%,74504963.00,Canada,2002,94200,Industrials,Major Chemicals +FSK,FS KKR Capital Corp. Common Stock,$13.89,-0.33,-2.321%,3890122754.00,United States,2014,2484073,Finance,Investment Managers +FSLR,First Solar Inc. Common Stock,$249.41,14.36,6.109%,26763723447.00,United States,2006,2206870,Technology,Semiconductors +FSLY,Fastly Inc. Class A Common Stock,$9.92,-0.36,-3.502%,1482048000.00,United States,,3681604,Technology,Computer Software: Prepackaged Software +FSM,Fortuna Mining Corp. Common Shares,$11.87,0.30,2.593%,3643615034.00,Canada,,10954770,Basic Materials,Precious Metals +FSP,Franklin Street Properties Corp. Common Stock,$0.8716,-0.0291,-3.231%,90376500.00,United States,,377970,Real Estate,Real Estate Investment Trusts +FSS,Federal Signal Corporation Common Stock,$108.97,-4.44,-3.915%,6626310636.00,United States,,333490,Industrials,Auto Manufacturing +FSSL,FS Specialty Lending Fund Common Shares of Beneficial Interest,$13.45,-0.02,-0.148%,0.00,,2025,592585,Finance,Finance/Investors Services +FSTR,L.B. Foster Company Common Stock,$28.82,0.10,0.348%,299526519.00,United States,,15085,Industrials,Metal Fabrications +FSUN,FirstSun Capital Bancorp Common Stock,$37.65,-1.245,-3.201%,1049958238.00,United States,,317588,Finance,Major Banks +FSV,FirstService Corporation Common Shares,$158.23,0.74,0.47%,7233047102.00,Canada,,175840,Finance,Real Estate +FT,Franklin Universal Trust Common Stock,$8.06,0.00,0.00%,202563066.00,United States,,62936,Finance,Trusts Except Educational Religious and Charitable +FTAI,FTAI Aviation Ltd. Common Stock,$275.66,-6.34,-2.248%,28275252506.00,United States,,2492196,Industrials,Misc Corporate Leasing Services +FTAIM,FTAI Aviation Ltd. 9.500% Fixed-Rate Reset Series D Cumulative Perpetual Redeemable Preferred Shares,$26.99,-0.11,-0.406%,2768443246.00,United States,,6129,Industrials,Misc Corporate Leasing Services +FTAIN,FTAI Aviation Ltd. 8.25% Fixed - Rate Reset Series C Cumulative Perpetual Redeemable Preferred Shares,$25.5399,0.03,0.118%,2619702247.00,United States,,2395,Industrials,Misc Corporate Leasing Services +FTCI,FTC Solar Inc. Common Stock,$10.94,-0.525,-4.579%,163448053.00,United States,2021,96807,Technology,Semiconductors +FTDR,Frontdoor Inc. Common Stock,$59.81,0.49,0.826%,4313090432.00,United States,,532178,Consumer Discretionary,Diversified Commercial Services +FTEK,Fuel Tech Inc. Common Stock,$1.35,-0.10,-6.897%,41950491.00,United States,,320860,Industrials,Pollution Control Equipment +FTEL,Fitell Corporation Class A Ordinary Shares,$2.84,-0.115,-3.892%,4003261.00,Australia,2023,233423,Consumer Discretionary,Recreational Games/Products/Toys +FTF,Franklin Limited Duration Income Trust Common Shares of Beneficial Interest,$6.16,0.00,0.00%,248897104.00,United States,2003,204406,Finance,Finance/Investors Services +FTFT,Future FinTech Group Inc. Common Stock,$2.22,0.01,0.452%,11207288.00,China,,27676,Real Estate,Real Estate +FTHM,Fathom Holdings Inc. Common Stock,$1.16,-0.10,-7.937%,37573512.00,United States,2020,253156,Finance,Real Estate +FTHY,First Trust High Yield Opportunities 2027 Term Fund Common Stock,$14.18,0.00,0.00%,521440984.00,United States,2020,116722,Finance,Investment Managers +FTI,TechnipFMC plc Ordinary Share,$55.25,-0.39,-0.701%,22349734752.00,,,2821879,Consumer Discretionary,Oil and Gas Field Machinery +FTK,Flotek Industries Inc. Common Stock,$17.06,-0.48,-2.737%,512786460.00,United States,,222353,Industrials,Major Chemicals +FTLF,FitLife Brands Inc. Common Stock,$15.53,-0.41,-2.572%,145843348.00,United States,,9195,Health Care, Medicinal Chemicals and Botanical Products +FTNT,Fortinet Inc. Common Stock,$82.08,0.37,0.453%,61038636212.00,United States,2009,3918001,Technology,Computer peripheral equipment +FTRE,Fortrea Holdings Inc. Common Stock,$16.73,-0.39,-2.278%,1545852000.00,United States,,1015741,Health Care,Medical Specialities +FTRK,FAST TRACK GROUP Ordinary shares,$0.8129,0.0179,2.252%,17731381.00,Singapore,2025,70949,Consumer Discretionary,Package Goods/Cosmetics +FTS,Fortis Inc. Common Shares,$53.37,-0.33,-0.615%,26973198000.00,United States,2016,623264,Utilities,Electric Utilities: Central +FTV,Fortive Corporation Common Stock ,$52.80,-0.35,-0.659%,16769894381.00,United States,2016,2910293,Industrials,Industrial Machinery/Components +FTW,EQV Ventures Acquisition Corp. Class A Ordinary Shares,$10.58,0.03,0.284%,471577050.00,,2024,7837,Energy,Oil & Gas Production +FUBO,FuboTV Inc. Class A Common Stock,$2.33,-0.04,-1.688%,3030457266.00,United States,2020,17620110,Consumer Discretionary,Movies/Entertainment +FUFU,BitFuFu Inc. Class A Ordinary Shares,$2.97,-0.09,-2.941%,494452437.00,Singapore,,69001,Finance,Finance: Consumer Services +FUFUW,BitFuFu Inc. Warrant,$0.26,0.00,0.00%,43285399.00,Singapore,,1,Finance,Finance: Consumer Services +FUL,H. B. Fuller Company Common Stock,$59.63,0.25,0.421%,3225320451.00,United States,,367995,Industrials,Home Furnishings +FULC,Fulcrum Therapeutics Inc. Common Stock,$10.48,-0.46,-4.205%,691263850.00,United States,2019,443515,Health Care,Biotechnology: Pharmaceutical Preparations +FULT,Fulton Financial Corporation Common Stock,$20.20,-0.18,-0.883%,3633881565.00,United States,,1831018,Finance,Major Banks +FULTP,Fulton Financial Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of Fixed Rate Non-Cumulative Perpetual Preferred Stock Series A,$18.82,0.07,0.373%,3385626290.00,United States,,5802,Finance,Major Banks +FUN,Six Flags Entertainment Corporation Common Stock New,$17.45,-0.02,-0.114%,1770727390.00,United States,,2505123,Consumer Discretionary,Services-Misc. Amusement & Recreation +FUNC,First United Corporation Common Stock,$37.13,0.31,0.842%,241230194.00,United States,,13735,Finance,Major Banks +FUND,Sprott Focus Trust Inc. Common Stock,$9.53,0.05,0.527%,282407798.00,United States,,10568,Finance,Investment Managers +FURY,Fury Gold Mines Limited Common Shares,$0.945,0.0946,11.124%,178740418.00,,2020,4482030,Basic Materials,Precious Metals +FUSB,First US Bancshares Inc. Common Stock,$14.49,0.00,0.00%,83562207.00,United States,,508,Finance,Major Banks +FUSE,Fusemachines Inc. Common stock,$1.5628,-0.0672,-4.123%,45224722.00,United States,,37694,Technology,EDP Services +FUSEW,Fusemachines Inc. Warrants,$0.086,0.0027,3.241%,2488691.00,United States,,19532,Technology,EDP Services +FUTU,Futu Holdings Limited American Depositary Shares,$168.32,5.28,3.238%,23434773305.00,Hong Kong,2019,1523809,Finance,Investment Bankers/Brokers/Service +FVCB,FVCBankcorp Inc. Common Stock,$14.84,-0.08,-0.536%,268230240.00,United States,,25233,Finance,Major Banks +FVN,Future Vision II Acquisition Corporation Ordinary shares,$10.61,0.00,0.00%,0.00,China,2024,7,, +FVNNR,Future Vision II Acquisition Corporation Right,$0.1501,0.0016,1.077%,0.00,China,2024,2290,Finance,Blank Checks +FVR,FrontView REIT Inc. Common Stock,$15.89,-0.30,-1.853%,344076800.00,United States,2024,119463,Real Estate,Real Estate Investment Trusts +FVRR,Fiverr International Ltd. Ordinary Shares no par value,$16.99,0.30,1.797%,610097750.00,,2019,1202050,Real Estate,Real Estate +FWDI,Forward Industries Inc. Common Stock,$6.98,-0.09,-1.273%,583821453.00,United States,,552842,Industrials,Plastic Products +FWONA,Liberty Media Corporation Series A Liberty Formula One Common Stock,$80.38,-0.99,-1.217%,20099359570.00,United States,,83308,Industrials,Broadcasting +FWONK,Liberty Media Corporation Series C Liberty Formula One Common Stock,$88.03,-1.06,-1.19%,22012274483.00,United States,,1796524,Industrials,Broadcasting +FWRD,Forward Air Corporation Common Stock,$27.42,-0.47,-1.685%,856826576.00,United States,,310511,Industrials,Integrated Freight & Logistics +FWRG,First Watch Restaurant Group Inc. Common Stock,$16.19,0.16,0.998%,988109780.00,United States,2021,1022586,Consumer Discretionary,Restaurants +FXNC,First National Corporation Common Stock,$25.53,-0.21,-0.816%,230046158.00,United States,,13924,Finance,Major Banks +G,Genpact Limited Common Stock,$44.78,-0.49,-1.082%,7720717862.00,Bermuda,2007,1194390,Consumer Discretionary,Professional Services +GAB,Gabelli Equity Trust Inc. (The) Common Stock,$6.08,-0.05,-0.816%,1786408655.00,United States,1986,636605,Finance,Investment Managers +GAB^G,Gabelli Equity Trust Inc. (The) Series G Cumulative Preferred Stock,$21.0779,0.0779,0.371%,,United States,,1412,, +GAB^H,Gabelli Equity Trust Inc. (The) Pfd Ser H,$21.10,0.05,0.238%,,United States,,8556,, +GAB^K,Gabelli Equity Trust Inc. (The) 5.00% Series K Cumulative Preferred Stock,$21.15,-0.10,-0.471%,,United States,,3454,, +GABC,German American Bancorp Inc. Common Stock,$40.68,-1.38,-3.281%,1525166302.00,United States,,131031,Finance,Major Banks +GAIA,Gaia Inc. Class A Common Stock,$3.47,-0.12,-3.343%,86898089.00,United States,1999,119771,Consumer Discretionary,Movies/Entertainment +GAIN,Gladstone Investment Corporation Business Development Company,$13.83,-0.09,-0.647%,548310417.00,United States,2005,118496,Finance,Finance: Consumer Services +GAINI,Gladstone Investment Corporation 7.875% Notes due 2030,$25.62,0.01,0.039%,0.00,United States,,4781,Finance,Finance: Consumer Services +GAINN,Gladstone Investment Corporation 5.00% Notes Due 2026,$24.9679,-0.0071,-0.028%,954253913.00,United States,,2201,Finance,Finance: Consumer Services +GAINZ,Gladstone Investment Corporation 4.875% Notes due 2028,$23.9732,-0.052,-0.216%,916237245.00,United States,,3085,Finance,Finance: Consumer Services +GALT,Galectin Therapeutics Inc. Common Stock,$3.08,-0.07,-2.222%,198576199.00,United States,,127937,Health Care,Biotechnology: Pharmaceutical Preparations +GAM,General American Investors Inc. Common Stock,$60.84,-0.11,-0.18%,1458676112.00,United States,,45775,Finance,Investment Managers +GAM^B,General American Investors Company Inc. Cumulative Preferred Stock,$25.0794,0.0094,0.037%,,United States,,6102,, +GAMB,Gambling.com Group Limited Ordinary Shares,$4.76,-0.08,-1.653%,169992219.00,Jersey,2021,342631,Consumer Discretionary,Services-Misc. Amusement & Recreation +GAME,GameSquare Holdings Inc. Common Stock,$0.423,-0.021,-4.73%,41615064.00,United States,,527163,Consumer Discretionary,Services-Misc. Amusement & Recreation +GANX,Gain Therapeutics Inc. Common Stock,$1.96,-0.10,-4.854%,97564259.00,United States,2021,519638,Health Care,Biotechnology: Pharmaceutical Preparations +GAP,Gap Inc. (The) Common Stock,$26.98,0.18,0.672%,10034448545.00,United States,,4239031,Consumer Discretionary,Clothing/Shoe/Accessory Stores +GASS,StealthGas Inc. Common Stock,$7.90,0.11,1.412%,292131564.00,Greece,2005,55421,Consumer Discretionary,Marine Transportation +GATX,GATX Corporation Common Stock,$180.07,-3.65,-1.987%,6428499000.00,United States,,147681,Consumer Discretionary,Transportation Services +GAU,Galiano Gold Inc.,$3.16,0.07,2.265%,820937781.00,Canada,,3708800,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +GAUZ,Gauzy Ltd. Ordinary Shares,$1.00,0.00,0.00%,18742093.00,Israel,2024,324047,Miscellaneous,Industrial Machinery/Components +GBAB,Guggenheim Taxable Municipal Bond & Investment Grade Debt Trust Common Shares of Beneficial Interest,$15.09,0.07,0.466%,337969296.00,United States,2010,110917,Finance,Investment Managers +GBCI,Glacier Bancorp Inc. Common Stock,$48.96,0.21,0.431%,6361929181.00,United States,,1237454,Finance,Major Banks +GBDC,Golub Capital BDC Inc. Common Stock,$13.54,-0.17,-1.24%,3567350505.00,United States,2010,1483957,Finance,Finance: Consumer Services +GBFH,GBank Financial Holdings Inc. Common Stock,$33.55,0.22,0.66%,482318591.00,United States,,39548,Finance,Commercial Banks +GBIO,Generation Bio Co. Common Stock,$5.58,-0.09,-1.587%,37597476.00,United States,2020,69226,Health Care,Biotechnology: Pharmaceutical Preparations +GBLI,Global Indemnity Group LLC Class A Common Stock ,$29.00,0.2613,0.909%,415394666.00,United States,,387,Finance,Property-Casualty Insurers +GBR,New Concept Energy Inc Common Stock,$0.8001,-0.0246,-2.983%,4106060.00,United States,1993,9840,Energy,Oil & Gas Production +GBTG,Global Business Travel Group Inc. Class A Common Stock,$6.85,-0.10,-1.439%,3586154011.00,United States,2020,2069553,Consumer Discretionary,Transportation Services +GBX,Greenbrier Companies Inc. (The) Common Stock,$49.38,-0.28,-0.564%,1525158729.00,United States,1994,489359,Industrials,Railroads +GCBC,Greene County Bancorp Inc. Common Stock,$21.90,-0.17,-0.77%,372887533.00,United States,,10360,Finance,Banks +GCDT,Green Circle Decarbonize Technology Limited Ordinary Shares,$4.40,-0.53,-10.751%,55000000.00,,2026,215345,Industrials,Industrial Machinery/Components +GCL,GCL Global Holdings Ltd Ordinary Shares,$1.14,-0.08,-6.557%,144002777.00,Singapore,,247207,Technology,Computer Software: Prepackaged Software +GCLWW,GCL Global Holdings Ltd Warrants,$0.0407,-0.0028,-6.437%,5141152.00,Singapore,,1525,Technology,Computer Software: Prepackaged Software +GCMG,GCM Grosvenor Inc. Class A Common Stock,$11.22,-0.15,-1.319%,2178883945.00,United States,,500649,Finance,Investment Managers +GCO,Genesco Inc. Common Stock,$30.72,-1.38,-4.299%,331552850.00,United States,,186786,Consumer Discretionary,Clothing/Shoe/Accessory Stores +GCT,GigaCloud Technology Inc Class A Ordinary Shares,$40.73,2.48,6.484%,1509321183.00,United States,2022,749711,Consumer Discretionary,Catalog/Specialty Distribution +GCTK,GlucoTrack Inc. Common Stock,$3.41,0.00,0.00%,3105446.00,United States,,52899,Health Care,Medical/Dental Instruments +GCTS,GCT Semiconductor Holding Inc. Common Stock,$0.9911,0.0009,0.091%,56591372.00,United States,2021,379702,Technology,Semiconductors +GCV,Gabelli Convertible and Income Securities Fund Inc. (The) Common Stock,$4.50,0.10,2.273%,85680131.00,United States,,263806,Finance,Finance/Investors Services +GD,General Dynamics Corporation Common Stock,$356.68,-9.94,-2.711%,96346559253.00,United States,,2327222,Industrials,Marine Transportation +GDC,GD Culture Group Limited Common Stock,$4.01,-0.41,-9.276%,229845625.00,United States,2015,24924,Industrials,Steel/Iron Ore +GDDY,GoDaddy Inc. Class A Common Stock,$103.35,-0.50,-0.481%,13966883740.00,United States,2015,1350077,Technology,EDP Services +GDEN,Golden Entertainment Inc. Common Stock,$27.03,-0.44,-1.602%,707482815.00,United States,,173680,Consumer Discretionary,Services-Misc. Amusement & Recreation +GDEV,GDEV Inc. Ordinary Shares,$18.99,-2.395,-11.199%,344290409.00,Cyprus,,9597,Technology,EDP Services +GDHG,Golden Heaven Group Holdings Ltd. Class A Ordinary Shares,$2.19,0.00,0.00%,43870288.00,China,2023,1219,Consumer Discretionary,Services-Misc. Amusement & Recreation +GDL,GDL Fund The Common Shares of Beneficial Interest,$8.57,0.06,0.705%,0.00,United States,2007,34385,Finance,Investment Managers +GDO,Western Asset Global Corporate Opportunity Fund Inc. Common Stock,$11.64,0.02,0.172%,0.00,United States,2009,23259,Finance,Finance Companies +GDOT,Green Dot Corporation Class A Common Stock $0.001 par value,$12.23,-0.02,-0.163%,677816111.00,United States,2010,627549,Finance,Finance: Consumer Services +GDRX,GoodRx Holdings Inc. Class A Common Stock,$2.34,0.01,0.429%,794273264.00,United States,2020,1566005,Technology,EDP Services +GDS,GDS Holdings Limited ADS,$47.14,-0.38,-0.80%,9445779464.00,China,2016,2529049,Technology,Computer Software: Programming Data Processing +GDTC,CytoMed Therapeutics Limited Ordinary Shares,$0.8249,-0.0108,-1.292%,9519346.00,Singapore,2023,48212,Health Care,Biotechnology: Pharmaceutical Preparations +GDV,Gabelli Dividend & Income Trust Common Shares of Beneficial Interest,$28.65,-0.08,-0.278%,2583900267.00,United States,2003,122564,Finance,Investment Managers +GDV^H,The Gabelli Dividend & Income Trust 5.375% Series H Cumulative Preferred Shares,$22.84,-0.06,-0.262%,,United States,,4606,, +GDV^K,The Gabelli Dividend & Income Trust 4.250% Series K Cumulative Preferred Shares,$18.363,0.033,0.18%,,United States,,3810,, +GDYN,Grid Dynamics Holdings Inc. Class A Common Stock,$8.28,-0.06,-0.719%,701887800.00,United States,2018,1158089,Technology,Computer Software: Prepackaged Software +GE,GE Aerospace Common Stock,$292.48,-4.99,-1.677%,308511972689.00,United States,,7541250,Technology,Consumer Electronics/Appliances +GECC,Great Elm Capital Corp. Common Stock,$7.25,0.15,2.113%,55114210.00,United States,,49589,Finance,Finance: Consumer Services +GECCG,Great Elm Capital Corp. 7.75% Notes Due 2030,$24.87,0.00,0.00%,0.00,United States,,1315,Finance,Finance: Consumer Services +GECCH,Great Elm Capital Corp. 8.125% Notes Due 2029,$25.32,-0.0049,-0.019%,0.00,United States,,179,, +GECCI,Great Elm Capital Corp. 8.50% NOTES DUE 2029,$25.2599,0.0499,0.198%,0.00,United States,,2040,Finance,Finance Companies +GECCO,Great Elm Capital Corp. 5.875% Notes due 2026,$25.1365,0.00,0.00%,0.00,United States,,50,Finance,Finance Companies +GEF,Greif Inc. Class A Common Stock,$72.46,-0.64,-0.876%,3435992406.00,United States,,294745,, +GEG,Great Elm Group Inc. Common Stock,$2.24,-0.03,-1.322%,73985784.00,United States,,4560,Technology,Computer Software: Prepackaged Software +GEGGL,Great Elm Group Inc. 7.25% Notes due 2027,$24.58,-0.19,-0.767%,712741024.00,United States,,2260,Technology,Computer Software: Prepackaged Software +GEHC,GE HealthCare Technologies Inc. Common Stock ,$79.26,-1.06,-1.32%,36104641382.00,United States,,1986004,Health Care,Medical Electronics +GEL,Genesis Energy L.P. Common Units,$17.27,-0.05,-0.289%,2114958772.00,United States,2001,117640,Energy,Oil Refining/Marketing +GELS,Gelteq Limited Ordinary Shares,$1.03,0.00,0.00%,11032391.00,Australia,2024,155626,Health Care,Biotechnology: Pharmaceutical Preparations +GEMI,Gemini Space Station Inc. Class A Common Stock,$9.12,-0.03,-0.328%,1073001908.00,United States,2025,854970,Finance,Investment Bankers/Brokers/Service +GEN,Gen Digital Inc. Common Stock,$24.79,-0.42,-1.666%,15288392293.00,United States,,7767164,Technology,Computer Software: Prepackaged Software +GENC,Gencor Industries Inc. Common Stock,$13.53,0.08,0.595%,198318708.00,United States,,31493,Industrials,Construction/Ag Equipment/Trucks +GENI,Genius Sports Limited Ordinary Shares,$9.30,-0.21,-2.208%,2230302815.00,Guernsey,2021,3364501,Consumer Discretionary,Services-Misc. Amusement & Recreation +GENK,GEN Restaurant Group Inc. Class A Common Stock,$2.07,-0.04,-1.896%,68190530.00,United States,2023,73062,Consumer Discretionary,Restaurants +GENVR,Gen Digital Inc. Contingent Value Rights,$2.50,-0.027,-1.068%,1541790268.00,United States,,11029,Technology,Computer Software: Prepackaged Software +GEO,Geo Group Inc (The) REIT,$16.05,-0.32,-1.955%,2234115846.00,United States,,1964589,Consumer Discretionary,Homebuilding +GEOS,Geospace Technologies Corporation Common Stock (Texas),$17.19,-0.23,-1.32%,220387867.00,United States,,162903,Industrials,Industrial Machinery/Components +GERN,Geron Corporation Common Stock,$1.33,-0.05,-3.623%,849012516.00,United States,1996,9267890,Health Care,Biotechnology: Pharmaceutical Preparations +GETY,Getty Images Holdings Inc. Class A Common Stock,$1.30,0.00,0.00%,540618235.00,United States,2022,1103606,Real Estate,Real Estate +GEV,GE Vernova Inc. Common Stock,$711.59,18.89,2.727%,193068925420.00,United States,2024,5776324,, +GEVO,Gevo Inc. Common Stock,$2.02,-0.06,-2.885%,489463788.00,United States,2011,2889188,Industrials,Major Chemicals +GF,New Germany Fund Inc. (The) Common Stock,$12.03,-0.12,-0.988%,0.00,United States,1990,3935,Finance,Investment Managers +GFAI,Guardforce AI Co. Limited Ordinary Shares,$0.6049,-0.0106,-1.722%,12717132.00,Singapore,,559454,Consumer Discretionary,Diversified Commercial Services +GFAIW,Guardforce AI Co. Limited Warrant,$0.1115,0.00,0.00%,2344123.00,Singapore,,3038,Consumer Discretionary,Diversified Commercial Services +GFF,Griffon Corporation Common Stock,$81.39,-0.99,-1.202%,3790610898.00,United States,,360556,Industrials,Building Products +GFI,Gold Fields Limited American Depositary Shares,$61.51,5.06,8.964%,55052941433.00,South Africa,,6222228,Basic Materials,Precious Metals +GFL,GFL Environmental Inc. Subordinate voting shares no par value,$43.60,-0.20,-0.457%,15657804002.00,Canada,2020,1336592,Utilities,Environmental Services +GFR,Greenfire Resources Ltd. Common Shares,$5.50,-0.04,-0.722%,386413500.00,Canada,,97556,Energy,Oil & Gas Production +GFS,GlobalFoundries Inc. Ordinary Shares,$45.79,-1.62,-3.417%,25317878165.00,United States,2021,3739571,Technology,Semiconductors +GGAL,Grupo Financiero Galicia S.A. American Depositary Shares,$55.88,0.12,0.215%,8975745843.00,Argentina,,1206865,Finance,Commercial Banks +GGB,Gerdau S.A. Common Stock,$4.57,0.04,0.883%,9500141409.00,Brazil,,22250404,Industrials,Steel/Iron Ore +GGG,Graco Inc. Common Stock,$86.83,-0.82,-0.936%,14395903266.00,United States,,1118672,Industrials,Fluid Controls +GGN,GAMCO Global Gold Natural Resources & Income Trust,$5.69,0.11,1.971%,0.00,United States,2005,1194904,Finance,Finance/Investors Services +GGN^B,GAMCO Global Gold Natural Reources & Income Trust 5.00% Series B Cumulative 25.00 Liquidation Preference,$20.90,-0.09,-0.429%,,United States,,2109,, +GGR,Gogoro Inc. Ordinary Shares,$3.16,0.02,0.637%,46621907.00,Taiwan,,7170,Industrials,Auto Manufacturing +GGROW,Gogoro Inc. Warrant,$0.0083,-0.0016,-16.162%,122456.00,Taiwan,,21400,Industrials,Auto Manufacturing +GGT,Gabelli Multi-Media Trust Inc. (The) Common Stock,$4.22,0.04,0.957%,116200869.00,United States,,189311,Finance,Trusts Except Educational Religious and Charitable +GGT^E,Gabelli Multi-Media Trust Inc. (The) 5.125% Series E Cumulative Preferred Stock,$21.34,0.06,0.282%,,United States,,270,, +GGT^G,Gabelli Multi-Media Trust Inc. (The) 5.125% Series G Cumulative Preferred Shares,$21.44,0.00,0.00%,,United States,,341,, +GGZ,Gabelli Global Small and Mid Cap Value Trust (The) Common Shares of Beneficial Interest,$15.77,-0.07,-0.442%,139910920.00,,2014,4323,Finance,Investment Managers +GH,Guardant Health Inc. Common Stock,$109.73,-4.86,-4.241%,13830488696.00,United States,2018,1706182,Health Care,Medical Specialities +GHC,Graham Holdings Company Common Stock,$1143.07,-11.24,-0.974%,4986554859.00,United States,,10523,Real Estate,Other Consumer Services +GHG,GreenTree Hospitality Group Ltd. American depositary shares each representing one Class A ordinary share,$1.555,-0.025,-1.582%,157870584.00,,2018,11869,Consumer Discretionary,Hotels/Resorts +GHI,Greystone Housing Impact Investors LP Beneficial Unit Certificates representing assignments of limited partnership interests,$7.71,-0.25,-3.141%,181820713.00,United States,2022,64407,Finance,Finance: Consumer Services +GHM,Graham Corporation Common Stock,$69.22,-1.32,-1.871%,760586176.00,United States,1978,138860,Industrials,Industrial Machinery/Components +GHRS,GH Research PLC Ordinary Shares,$16.06,-0.15,-0.925%,996172009.00,Ireland,2021,294961,Health Care,Biotechnology: Pharmaceutical Preparations +GHY,PGIM Global High Yield Fund Inc.,$12.89,0.01,0.078%,0.00,United States,2012,123471,Finance,Trusts Except Educational Religious and Charitable +GIB,CGI Inc. Common Stock,$86.35,-1.88,-2.131%,18751973758.00,Canada,,923752,Consumer Discretionary,Professional Services +GIBO,GIBO Holdings Limited Class A Ordinary Shares,$1.47,0.04,2.797%,5520344.00,Hong Kong,,70722,Technology,Computer Software: Prepackaged Software +GIBOW,GIBO Holdings Limited Warrants,$0.0334,0.0054,19.286%,125428.00,Hong Kong,,2499,Technology,Computer Software: Prepackaged Software +GIC,Global Industrial Company Common Stock,$30.03,-0.23,-0.76%,1155974159.00,United States,,74346,Industrials,Industrial Machinery/Components +GIFT,Giftify Inc. Common Stock,$1.09,0.01,0.926%,33750665.00,United States,,9431,Consumer Discretionary,Catalog/Specialty Distribution +GIG,GigCapital7 Corp. Class A Ordinary Share,$10.56,0.01,0.095%,0.00,United States,2024,22324,Finance,Blank Checks +GIGGW,GigCapital7 Corp. Warrant,$0.5689,0.0489,9.404%,0.00,United States,2024,22341,Finance,Blank Checks +GIGM,GigaMedia Limited Ordinary Shares,$1.49,0.00,0.00%,16467830.00,Taiwan,,1304,Technology,Computer Software: Programming Data Processing +GIII,G-III Apparel Group LTD. Common Stock,$28.13,-0.07,-0.248%,1186784643.00,United States,1989,436027,Consumer Discretionary,Apparel +GIL,Gildan Activewear Inc. Class A Sub. Vot. Common Stock,$65.73,-1.44,-2.144%,9797122230.00,Canada,2000,1940922,Consumer Discretionary,Apparel +GILD,Gilead Sciences Inc. Common Stock,$139.72,-1.25,-0.887%,173347756926.00,United States,1992,7317700,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +GILT,Gilat Satellite Networks Ltd. Ordinary Shares,$19.97,0.75,3.902%,1283172709.00,Israel,,1122842,Technology,Radio And Television Broadcasting And Communications Equipment +GIPR,Generation Income Properties Inc. Common Stock,$0.71,-0.04,-5.333%,3867918.00,United States,,59547,Real Estate,Real Estate Investment Trusts +GIS,General Mills Inc. Common Stock,$44.35,-0.36,-0.805%,23664365292.00,United States,,6378138,Consumer Staples,Packaged Foods +GITS,Global Interactive Technologies Inc. Common Stock,$3.175,-0.995,-23.861%,23877149.00,South Korea,2023,1797141,Technology,Computer Software: Programming Data Processing +GIW,GigCapital8 Corp. Class A Ordinary Shares,$9.97,0.01,0.10%,0.00,United States,2025,762,, +GIXXU,GigCapital9 Corp. Units,$10.05,0.02,0.199%,0.00,United States,2026,924431,Finance,Blank Checks +GJH,Synthetic Fixed-Income Securities Inc 6.375% (STRATS) Cl A-1,$9.85,0.03,0.305%,0.00,United States,,163,Finance,Finance: Consumer Services +GJP,Synthetic Fixed-Income Securities Inc. on behalf of STRATS (SM) Trust for Dominion Resources Inc. Securities Series 2005-6 Floating Rate Structured Repackaged Asset-Backed Trust Securities (STRATS) Certificates,$24.46,0.01,0.041%,0.00,United States,,2815,Finance,Finance: Consumer Services +GJR,Synthetic Fixed-Income Securities Inc. STRATS Trust for Procter&Gamble Securities Series 2006-1,$24.75,-0.2801,-1.119%,0.00,United States,,4902,Finance,Finance: Consumer Services +GJS,Goldman Sachs Group Securities STRATS Trust for Goldman Sachs Group Securities Series 2006-2,$23.2201,-0.2699,-1.149%,7245577550.00,United States,,4921,Finance,Finance: Consumer Services +GJT,Synthetic Fixed-Income Securities Inc. Floating Rate Structured Repackaged Asset-Backed Trust Securities Certificates Series 2006-3,$23.35,-0.14,-0.596%,0.00,United States,,2300,Finance,Finance: Consumer Services +GKOS,Glaukos Corporation Common Stock,$123.94,5.24,4.414%,7118461676.00,United States,2015,1063232,Health Care,Medical/Dental Instruments +GL,Globe Life Inc. Common Stock,$138.55,1.16,0.844%,11029383590.00,United States,,515139,Finance,Life Insurance +GL^D,Globe Life Inc. 4.25% Junior Subordinated Debentures due 2061,$17.07,-0.0479,-0.28%,,United States,,4736,, +GLAD,Gladstone Capital Corporation Common Stock,$20.41,-0.18,-0.874%,461124538.00,United States,2001,167698,Consumer Discretionary,Textiles +GLBE,Global-E Online Ltd. Ordinary Shares,$37.89,-0.25,-0.655%,6408383745.00,Israel,2021,630851,Technology,Computer Software: Prepackaged Software +GLBS,Globus Maritime Limited Common Stock,$1.59,-0.115,-6.745%,32725859.00,Greece,,54827,Consumer Discretionary,Marine Transportation +GLDD,Great Lakes Dredge & Dock Corporation Common Stock,$15.32,0.12,0.789%,1041749353.00,United States,,1043604,Industrials,Military/Government/Technical +GLDG,GoldMining Inc. Common Shares,$2.02,-0.05,-2.415%,404455571.00,,,8007601,Basic Materials,Precious Metals +GLE,Global Engine Group Holding Limited Class A Ordinary Shares,$0.3272,-0.0167,-4.856%,5987760.00,Hong Kong,2024,65742,Technology,EDP Services +GLIBA,GCI Liberty Inc. Series A GCI Group Common Stock,$36.50,-0.35,-0.95%,1047471124.00,United States,,24437,Telecommunications,Cable & Other Pay Television Services +GLIBK,GCI Liberty Inc. Series C GCI Group Common Stock,$36.25,-0.20,-0.549%,1040296664.00,United States,,199726,Telecommunications,Cable & Other Pay Television Services +GLMD,Galmed Pharmaceuticals Ltd. Ordinary Shares,$0.8116,-0.0334,-3.953%,4446944.00,Israel,2014,65650,Health Care,Biotechnology: Pharmaceutical Preparations +GLNG,Golar Lng Ltd,$40.89,0.67,1.666%,4278013044.00,Bermuda,,1356848,Consumer Discretionary,Marine Transportation +GLO,Clough Global Opportunities Fund Common Stock,$5.93,-0.01,-0.168%,0.00,United States,2006,225734,Finance,Finance/Investors Services +GLOB,Globant S.A. Common Shares,$69.75,0.60,0.868%,3072177671.00,United States,2014,1485580,Technology,EDP Services +GLOO,Gloo Holdings Inc. Class A Common Stock,$6.00,0.01,0.167%,485148288.00,United States,2025,52336,Technology,EDP Services +GLOP^A,GasLog Partners LP 8.625% Series A Cumulative Redeemable Perpetual Fixed to Floating Rate Preference Units,$25.97,0.06,0.232%,,Greece,,3974,, +GLOP^B,GasLog Partners LP 8.200% Series B Cumulative Redeemable Perpetual Fixed to Floating Rate Preference Units,$25.95,0.1184,0.458%,,Greece,,3639,, +GLOP^C,GasLog Partners LP 8.500% Series C Cumulative Redeemable Perpetual Fixed to Floating Rate Preference Units,$25.82,0.17,0.663%,,Greece,,1161,, +GLP,Global Partners LP Common Units representing Limited Partner Interests,$46.75,0.91,1.985%,1589292570.00,United States,2005,41692,Energy,Oil Refining/Marketing +GLP^B,Global Partners LP 9.50% Series B Fixed Rate Cumulative Redeemable Perpetual Preferred Units representing limited partner interests,$25.8925,0.0225,0.087%,,United States,,3145,, +GLPG,Galapagos NV American Depositary Shares,$34.10,-0.54,-1.559%,2247090121.00,Belgium,2015,55304,Health Care,Biotechnology: Pharmaceutical Preparations +GLPI,Gaming and Leisure Properties Inc. Common Stock,$44.78,-0.82,-1.798%,12673113555.00,United States,,1814017,Real Estate,Real Estate Investment Trusts +GLQ,Clough Global Equity Fund Clough Global Equity Fund Common Shares of Beneficial Interest,$8.14,0.00,0.00%,0.00,United States,2005,61082,Finance,Finance/Investors Services +GLRE,Greenlight Capital Re Ltd. Class A Ordinary Shares,$13.65,0.11,0.812%,465454435.00,Cayman Islands,2007,105476,Finance,Property-Casualty Insurers +GLSI,Greenwich LifeSciences Inc. Common Stock,$28.59,-4.975,-14.822%,396101270.00,United States,2020,395335,Health Care,Biotechnology: Pharmaceutical Preparations +GLTO,Galecto Inc. Common Stock,$24.45,-1.11,-4.343%,39001686.00,Denmark,2020,18296,Health Care,Biotechnology: Pharmaceutical Preparations +GLU,Gabelli Global Utility Common Shares of Beneficial Ownership,$19.99,-0.026,-0.13%,119318531.00,United States,2004,4692,Finance,Finance/Investors Services +GLU^A,The Gabelli Global Utility and Income Trust Series A Cumulative Puttable and Callable Preferred Shares,$51.25,0.00,0.00%,,United States,,347,, +GLU^B,The Gabelli Global Utility and Income Trust Series B Cumulative Puttable and Callable Preferred Shares,$50.30,0.02,0.04%,,United States,,3766,, +GLUE,Monte Rosa Therapeutics Inc. Common Stock,$21.13,-1.97,-8.528%,1375938290.00,United States,2021,1012685,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +GLV,Clough Global Dividend and Income Fund Common Shares of beneficial interest,$6.23,-0.03,-0.479%,79180702.00,United States,2004,23460,Finance,Finance/Investors Services +GLW,Corning Incorporated Common Stock,$104.28,-5.46,-4.975%,89405542095.00,United States,,18534418,Industrials,Telecommunications Equipment +GLXG,Galaxy Payroll Group Limited Class A Ordinary Shares,$1.86,-0.18,-8.824%,4019953.00,Hong Kong,2024,118254,Industrials,Diversified Commercial Services +GLXY,Galaxy Digital Inc. Class A Common Stock,$31.90,-1.28,-3.858%,12460469527.00,United States,,6397708,Finance,Investment Bankers/Brokers/Service +GM,General Motors Company Common Stock,$84.90,-1.48,-1.713%,76746870720.00,United States,2010,10072746,Industrials,Auto Manufacturing +GMAB,Genmab A/S ADS,$32.93,-1.47,-4.273%,21795440350.00,Denmark,2019,1596897,Health Care,Biotechnology: Pharmaceutical Preparations +GME,GameStop Corporation Common Stock,$23.64,-0.57,-2.354%,10590944107.00,United States,2002,8514542,Consumer Discretionary,Electronics Distribution +GMED,Globus Medical Inc. Class A Common Stock,$91.83,-0.13,-0.141%,12290450614.00,United States,2012,958981,Health Care,Medical/Dental Instruments +GMGI,Golden Matrix Group Inc. Common Stock,$0.7011,-0.0167,-2.327%,99021872.00,United States,,162636,Technology,Computer Software: Prepackaged Software +GMHS,Gamehaus Holdings Inc. Class A Ordinary Shares,$0.9706,-0.0394,-3.901%,51994419.00,China,,14599,Technology,EDP Services +GMM,Global Mofy AI Limited Class A Ordinary Shares,$1.20,-0.01,-0.826%,59481665.00,China,2023,6421,Technology,Computer Software: Programming Data Processing +GMRE,Global Medical REIT Inc. Common Stock,$33.93,-1.03,-2.946%,454911657.00,United States,2016,91951,Real Estate,Real Estate Investment Trusts +GMRE^A,Global Medical REIT Inc. Series A Cumulative Redeemable Preferred Stock,$24.56,0.06,0.245%,,United States,,2565,, +GMRE^B,Global Medical REIT Inc. 8.00% Series B Cumulative Redeemable Preferred Stock $0.001 par value per share,$25.18,0.1755,0.702%,,United States,,1158,, +GNE,Genie Energy Ltd. Class B Common Stock Stock,$13.69,-0.56,-3.93%,362715920.00,United States,2011,69384,Utilities,Power Generation +GNK,Genco Shipping & Trading Limited Ordinary Shares New (Marshall Islands),$20.42,0.08,0.393%,883025429.00,United States,,325145,Consumer Discretionary,Marine Transportation +GNL,Global Net Lease Inc. Common Stock,$9.39,-0.06,-0.635%,2058587964.00,United States,2015,2726273,Real Estate,Real Estate Investment Trusts +GNL^A,Global Net Lease Inc. 7.25% Series A Cumulative Redeemable Preferred Stock $0.01 par value per share,$23.43,-0.17,-0.72%,,United States,,5697,, +GNL^B,Global Net Lease Inc. 6.875% Series B Cumulative Redeemable Perpetual Preferred Stock,$22.90,-0.45,-1.927%,,United States,,7350,, +GNL^D,Global Net Lease Inc. 7.50% Series D Cumulative Redeemable Perpetual Preferred Stock,$24.63,-0.11,-0.445%,,United States,,14812,, +GNL^E,Global Net Lease Inc. 7.375% Series E Cumulative Redeemable Perpetual Preferred Stock,$23.6699,0.2399,1.024%,,United States,,6052,, +GNLN,Greenlane Holdings Inc. Class A Common Stock,$1.49,-0.03,-1.974%,7196049.00,United States,2019,75057,Consumer Discretionary,Durable Goods +GNLX,Genelux Corporation Common Stock,$2.76,-0.20,-6.757%,105009107.00,United States,2023,216159,Health Care,Biotechnology: Pharmaceutical Preparations +GNPX,Genprex Inc. Common Stock,$2.22,-0.14,-5.932%,5147945.00,United States,2018,436243,Health Care,Biotechnology: Pharmaceutical Preparations +GNRC,Generac Holdlings Inc. Common Stock,$174.17,3.72,2.182%,10221003775.00,United States,2010,873897,Consumer Discretionary,Metal Fabrications +GNS,Genius Group Limited Ordinary Shares,$0.5311,-0.0393,-6.89%,46635266.00,Singapore,2022,395067,Consumer Discretionary,Services-Misc. Amusement & Recreation +GNSS,Genasys Inc. Common Stock,$1.95,-0.09,-4.412%,88127444.00,United States,,278085,Consumer Staples,Consumer Electronics/Appliances +GNT,GAMCO Natural Resources Gold & Income Trust,$8.46,0.05,0.595%,156302214.00,United States,2011,107314,Finance,Finance/Investors Services +GNT^A,GAMCO Natural Resources Gold & Income Tust 5.20% Series A Cumulative Preferred Shares (Liquidation Preference $25.00 per share),$21.2545,0.00,0.00%,,United States,,59,, +GNTA,Genenta Science S.p.A. American Depositary Shares,$1.35,-0.19,-12.338%,31633447.00,Italy,2021,976656,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +GNTX,Gentex Corporation Common Stock,$23.57,-0.28,-1.174%,5160484601.00,United States,,2721319,Consumer Discretionary,Auto Parts:O.E.M. +GNW,Genworth Financial Inc Common Stock,$8.17,-0.07,-0.85%,3262939232.00,United States,2004,3050040,Finance,Life Insurance +GO,Grocery Outlet Holding Corp. Common Stock,$9.45,-0.55,-5.50%,927396824.00,United States,2019,2017431,Consumer Staples,Food Chains +GOAI,Eva Live Inc. Common Stock,$7.62,1.62,27.00%,238819830.00,United States,,4117308,Technology,Computer Software: Programming Data Processing +GOCO,GoHealth Inc. Class A Common Stock,$2.14,-0.06,-2.727%,61447960.00,United States,2020,28370,Finance,Specialty Insurers +GOF,Guggenheim Strategic Opportunities Fund Common Shares of Beneficial Interest,$12.79,-0.04,-0.312%,0.00,United States,,1078420,Finance,Finance/Investors Services +GOGO,Gogo Inc. Common Stock,$4.54,-0.14,-2.991%,607698713.00,United States,2013,1880612,Consumer Discretionary,Telecommunications Equipment +GOLD,Gold.com Inc. Common Stock,$53.99,2.84,5.552%,1330550400.00,United States,,1617089,Industrials,Other Specialty Stores +GOLF,Acushnet Holdings Corp. Common Stock,$94.68,-0.17,-0.179%,5554054630.00,United States,2016,199030,Consumer Discretionary,Recreational Games/Products/Toys +GOOD,Gladstone Commercial Corporation Real Estate Investment Trust,$11.26,-0.14,-1.228%,544997005.00,United States,2003,449299,Real Estate,Real Estate +GOODN,Gladstone Commercial Corporation 6.625% Series E Cumulative Redeemable Preferred Stock,$22.60,-0.10,-0.441%,1093866103.00,United States,,2951,Real Estate,Real Estate +GOODO,Gladstone Commercial Corporation 6.00% Series G Cumulative Redeemable Preferred Stock par value $0.001 per share,$20.36,-0.07,-0.343%,985447516.00,United States,,5751,Real Estate,Real Estate +GOOG,Alphabet Inc. Class C Capital Stock,$336.28,1.28,0.382%,4057890760000.00,United States,2004,17538476,Technology,Computer Software: Programming Data Processing +GOOGL,Alphabet Inc. Class A Common Stock,$336.01,1.46,0.436%,4054632670000.00,United States,2004,27434434,Technology,Computer Software: Programming Data Processing +GOOS,Canada Goose Holdings Inc. Subordinate Voting Shares,$12.26,-0.25,-1.998%,1190088253.00,,2017,619750,Consumer Discretionary,Apparel +GORO,Gold Resource Corporation Common Stock,$1.57,-0.15,-8.721%,253972125.00,United States,,10846797,Basic Materials,Precious Metals +GOSS,Gossamer Bio Inc. Common Stock,$2.55,-0.09,-3.409%,590213430.00,United States,2019,5838269,Health Care,Biotechnology: Pharmaceutical Preparations +GOTU,Gaotu Techedu Inc. American Depositary Shares,$2.23,-0.01,-0.446%,539775891.00,China,2019,358075,Real Estate,Other Consumer Services +GOVX,GeoVax Labs Inc. Common Stock,$2.84,0.00,0.00%,4919297.00,United States,,100859,Health Care,Biotechnology: Pharmaceutical Preparations +GP,GreenPower Motor Company Inc. Common Shares,$0.9001,0.0094,1.055%,2770042.00,Canada,,58266,Consumer Discretionary,Construction/Ag Equipment/Trucks +GPAC,General Purpose Acquisition Corp. Class A Ordinary Shares,$9.94,0.04,0.404%,0.00,United States,2026,825499,, +GPACU,General Purpose Acquisition Corp. Units,$10.04,0.02,0.20%,0.00,United States,2025,20742,, +GPACW,General Purpose Acquisition Corp. Warrant,$0.23,-0.02,-8.00%,2258096.00,United States,2026,172949,Industrials,Major Chemicals +GPAT,GP-Act III Acquisition Corp. Class A Ordinary Share,$10.75,0.00,0.00%,0.00,United States,2024,5,, +GPATW,GP-Act III Acquisition Corp. Warrants,$0.275,-0.0042,-1.504%,0.00,United States,2024,251607,, +GPC,Genuine Parts Company Common Stock,$140.02,0.64,0.459%,19478252210.00,United States,,1278409,Consumer Discretionary,Automotive Aftermarket +GPCR,Structure Therapeutics Inc. American Depositary Shares,$89.05,-0.46,-0.514%,6156844959.00,United States,2023,554298,Health Care,Biotechnology: Pharmaceutical Preparations +GPGI,GPGI Inc. Class A Common Stock,$24.03,-0.47,-1.918%,6954652278.00,United States,,1930437,Finance,Finance: Consumer Services +GPI,Group 1 Automotive Inc. Common Stock,$396.41,-0.55,-0.139%,5006902885.00,United States,1997,154908,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +GPJA,Georgia Power Company Series 2017A 5.00% Junior Subordinated Notes due October 1 2077,$23.08,-0.11,-0.474%,213755420.00,United States,2017,11773,Utilities,Electric Utilities: Central +GPK,Graphic Packaging Holding Company,$14.84,-0.21,-1.395%,4379626982.00,United States,,3603816,Consumer Discretionary,Containers/Packaging +GPMT,Granite Point Mortgage Trust Inc. Common Stock,$2.17,-0.05,-2.252%,102870443.00,United States,2017,264758,Real Estate,Real Estate Investment Trusts +GPMT^A,Granite Point Mortgage Trust Inc. 7.00% Series A Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$20.68,0.02,0.097%,,United States,,28710,, +GPN,Global Payments Inc. Common Stock,$72.01,-1.75,-2.373%,20163646622.00,United States,,1815085,Real Estate,Real Estate +GPOR,Gulfport Energy Corporation Common Shares,$198.78,5.44,2.814%,3839797281.00,United States,2021,158019,Energy,Oil & Gas Production +GPRE,Green Plains Inc. Common Stock,$11.93,0.16,1.359%,833132051.00,United States,,881536,Industrials,Major Chemicals +GPRK,Geopark Ltd Common Shares,$8.43,0.05,0.597%,432014629.00,Bermuda,2014,667958,Energy,Oil & Gas Production +GPRO,GoPro Inc. Class A Common Stock,$1.22,-0.07,-5.426%,194868496.00,United States,2014,2267123,Consumer Discretionary,Industrial Machinery/Components +GPUS,Hyperscale Data Inc. Common Stock,$0.2171,-0.0147,-6.342%,70207908.00,United States,1997,29043396,Technology,Industrial Machinery/Components +GPUS^D,Hyperscale Data Inc. 13.00% Series D Cumulative Redeemable Perpetual Preferred Stock,$23.653,-0.137,-0.576%,,United States,,250,, +GRAB,Grab Holdings Limited Class A Ordinary Shares,$4.53,-0.16,-3.412%,18455845453.00,Singapore,,51929848,Real Estate,Real Estate +GRABW,Grab Holdings Limited Warrant,$0.2811,-0.0189,-6.30%,1145240211.00,Singapore,,17257,Real Estate,Real Estate +GRAF,Graf Global Corp. Class A ordinary shares,$10.7499,-0.0001,-0.001%,0.00,,2024,42040,, +GRAL,GRAIL Inc. Common Stock ,$101.00,-7.98,-7.322%,3937204523.00,United States,,1038538,Health Care,Medical Specialities +GRAN,Grande Group Limited Class A Ordinary Shares,$2.94,-0.07,-2.326%,66885000.00,Hong Kong,2025,11819,Finance,Finance: Consumer Services +GRBK,Green Brick Partners Inc. Common Stock,$69.39,0.59,0.858%,3022982150.00,United States,2021,183388,Consumer Discretionary,Homebuilding +GRBK^A,Green Brick Partners Inc. Depositary Shares (each representing a 1/1000th fractional interest in a share of 5.75% Series A Cumulative Perpetual Preferred Stock),$22.50,-0.01,-0.044%,,United States,,6859,, +GRC,Gorman-Rupp Company (The) Common Stock,$52.74,-0.22,-0.415%,1387739287.00,United States,1971,111852,Industrials,Fluid Controls +GRCE,Grace Therapeutics Inc. Common Stock,$3.51,-0.25,-6.649%,48538253.00,Canada,,87502,Health Care,Biotechnology: Pharmaceutical Preparations +GRDN,Guardian Pharmacy Services Inc. Class A Common Stock,$30.26,0.55,1.851%,1916082385.00,United States,2024,260454,Consumer Staples,Retail-Drug Stores and Proprietary Stores +GRDX,GridAI Technologies Corp. Common Stock,$3.00,-0.36,-10.714%,10085709.00,United States,2016,90144,Health Care,Biotechnology: Pharmaceutical Preparations +GREE,Greenidge Generation Holdings Inc. Class A Common Stock,$1.35,0.00,0.00%,21328646.00,United States,,85350,Finance,Finance: Consumer Services +GREEL,Greenidge Generation Holdings Inc. 8.50% Senior Notes due 2026,$22.00,0.25,1.149%,344815174.00,United States,,5125,Finance,Finance: Consumer Services +GRF,Eagle Capital Growth Fund Inc. Common Stock,$10.80,0.00,0.00%,0.00,United States,,76,Finance,Finance/Investors Services +GRFS,Grifols S.A. American Depositary Shares,$9.19,-0.10,-1.076%,6318629605.00,Spain,,363587,Health Care,Biotechnology: Pharmaceutical Preparations +GRI,GRI Bio Inc. Common Stock,$4.11,-1.21,-22.744%,2204197.00,United States,2021,12667567,Health Care,Biotechnology: Pharmaceutical Preparations +GRMN,Garmin Ltd. Common Stock (Switzerland),$204.48,-0.32,-0.156%,39328621131.00,Switzerland,2000,495547,Industrials,Industrial Machinery/Components +GRND,Grindr Inc. Common Stock,$11.62,-0.11,-0.938%,2146610486.00,Singapore,2021,1004632,Technology,Computer Software: Programming Data Processing +GRNQ,Greenpro Capital Corp. Common Stock,$1.88,-0.05,-2.591%,15746528.00,China,,34276,Technology,EDP Services +GRNT,Granite Ridge Resources Inc. Common Stock,$4.78,-0.01,-0.209%,627381109.00,United States,2022,512166,Energy,Oil & Gas Production +GRO,Brazil Potash Corp. Common Shares,$2.82,0.05,1.805%,150495191.00,,2024,382934,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +GROV,Grove Collaborative Holdings Inc. Class A Common Stock,$1.50,-0.01,-0.662%,62081483.00,,2021,55964,Consumer Discretionary,Catalog/Specialty Distribution +GROW,U.S. Global Investors Inc. Class A Common Stock,$3.54,0.26,7.927%,45270986.00,United States,,361618,Finance,Investment Managers +GROY,Gold Royalty Corp. Common Shares,$4.85,0.01,0.207%,843564036.00,Canada,2021,5351260,Basic Materials,Precious Metals +GRPN,Groupon Inc. Common Stock,$15.49,-0.29,-1.838%,631291898.00,United States,2011,1176910,Consumer Discretionary,Advertising +GRRR,Gorilla Technology Group Inc. Ordinary shares,$14.54,-0.21,-1.424%,294031399.00,Taiwan,,708989,Technology,Computer Software: Prepackaged Software +GRRRW,Gorilla Technology Group Inc. Warrant,$0.3914,-0.0086,-2.15%,7914986.00,Taiwan,,10411,Technology,Computer Software: Prepackaged Software +GRVY,GRAVITY Co. Ltd. American Depository Shares,$67.80,1.80,2.727%,471135420.00,South Korea,2005,31963,Real Estate,Real Estate +GRWG,GrowGeneration Corp. Common Stock,$1.36,-0.05,-3.546%,81387082.00,United States,,401560,Consumer Discretionary,RETAIL: Building Materials +GRX,The Gabelli Healthcare & Wellness Trust Common Shares of Beneficial Interest,$9.67,0.04,0.415%,165289049.00,United States,,23075,Finance,Finance/Investors Services +GS,Goldman Sachs Group Inc. (The) Common Stock,$936.81,7.09,0.763%,280976028390.00,United States,1999,1674080,Finance,Investment Bankers/Brokers/Service +GS^A,Goldman Sachs Group Inc. (The) Depositary Shares each representing 1/1000th Interest in a Share of Floating Rate Non-Cumulative Preferred Stock Series A,$20.19,-0.20,-0.981%,,United States,,45677,, +GS^C,Goldman Sachs Group Inc. (The) Depositary Share repstg 1/1000th Preferred Series C,$20.28,-0.2505,-1.22%,,United States,,12848,, +GS^D,Goldman Sachs Group Inc. (The) Dep Shs repstg 1/1000 Pfd Ser D Fltg,$20.04,-0.08,-0.398%,,United States,,180149,, +GSAT,Globalstar Inc. Common Stock,$67.55,4.11,6.479%,8567934866.00,United States,2025,823636,Consumer Discretionary,Telecommunications Equipment +GSBC,Great Southern Bancorp Inc. Common Stock,$59.49,-1.22,-2.01%,665649196.00,United States,1989,76296,Finance,Major Banks +GSBD,Goldman Sachs BDC Inc. Common Stock,$9.34,-0.05,-0.532%,1065816317.00,United States,2015,1036938,Finance,Investment Managers +GSHD,Goosehead Insurance Inc. Class A Common Stock,$62.61,-0.97,-1.526%,2306819745.00,United States,2018,212620,Finance,Specialty Insurers +GSHR,Gesher Acquisition Corp. II Class A Ordinary Shares,$10.32,0.00,0.00%,0.00,United States,2025,2,, +GSHRW,Gesher Acquisition Corp. II Warrants,$0.43,0.01,2.381%,0.00,United States,2025,150,Finance,Blank Checks +GSIT,GSI Technology Common Stock,$7.85,0.32,4.25%,276647369.00,United States,2007,1011392,Technology,Semiconductors +GSIW,Garden Stage Limited Ordinary Shares,$0.1521,0.0001,0.066%,11260168.00,Hong Kong,2023,702106,Finance,Investment Bankers/Brokers/Service +GSK,GSK plc American Depositary Shares (Each representing two Ordinary Shares),$50.10,-0.70,-1.378%,102174568955.00,United Kingdom,2022,5883597,Health Care,Biotechnology: Pharmaceutical Preparations +GSL,Global Ship Lease Inc New Class A Common Shares,$37.51,0.31,0.833%,1340461974.00,United Kingdom,,398198,Consumer Discretionary,Marine Transportation +GSL^B,Global Ship Lease Inc. Depository Shares Representing 1/100th Perpetual Preferred Series B% (Marshall Island),$26.68,0.08,0.301%,,United Kingdom,,6031,, +GSM,Ferroglobe PLC Ordinary Shares,$4.89,-0.01,-0.204%,912600509.00,United Kingdom,,695377,Basic Materials,Metal Mining +GSRF,GSR IV Acquisition Corp. Class A ordinary share,$10.03,-0.01,-0.10%,0.00,United States,2025,25028,, +GSRFR,GSR IV Acquisition Corp. Rights,$2.73,-0.15,-5.208%,0.00,United States,2025,16500,, +GSUN,Golden Sun Health Technology Group Limited Class A Ordinary Shares,$1.12,-0.11,-8.943%,2218657.00,China,2022,111955,Real Estate,Other Consumer Services +GT,The Goodyear Tire & Rubber Company Common Stock,$9.45,-0.10,-1.047%,2704220590.00,United States,,4216615,Consumer Discretionary,Automotive Aftermarket +GTBP,GT Biopharma Inc. Common Stock,$0.722,-0.0174,-2.353%,19242884.00,United States,,524037,Health Care,Biotechnology: Pharmaceutical Preparations +GTE,Gran Tierra Energy Inc. Common Stock,$5.71,0.04,0.705%,201500104.00,Canada,,764548,Energy,Oil & Gas Production +GTEC,Greenland Technologies Holding Corporation Ordinary Shares,$0.9781,-0.2219,-18.492%,17013292.00,China,2018,1876907,Industrials,Industrial Machinery/Components +GTEN,Gores Holdings X Inc. Class A ordinary shares,$10.35,0.05,0.485%,0.00,United States,2025,732073,, +GTENW,Gores Holdings X Inc. Warrants,$0.90,0.10,12.50%,0.00,United States,2025,63856,, +GTERA,Globa Terra Acquisition Corporation Class A Ordinary Shares,$10.18,0.03,0.296%,0.00,Mexico,2025,119,Finance,Blank Checks +GTERR,Globa Terra Acquisition Corporation Rights,$0.1436,0.0004,0.279%,0.00,Mexico,2025,590,Finance,Blank Checks +GTERU,Globa Terra Acquisition Corporation Units,$10.37,0.00,0.00%,0.00,Mexico,2025,20,Finance,Blank Checks +GTES,Gates Industrial Corporation plc Ordinary Shares,$22.96,0.24,1.056%,5930117777.00,United Kingdom,2018,4444640,Industrials,Industrial Machinery/Components +GTIM,Good Times Restaurants Inc. Common Stock,$1.16,-0.04,-3.333%,12247159.00,United States,,19708,Consumer Discretionary,Restaurants +GTLB,GitLab Inc. Class A Common Stock,$37.225,-0.095,-0.255%,6268690000.00,United States,2021,3025923,Technology,Computer Software: Prepackaged Software +GTLS,Chart Industries Inc. Common Stock,$207.27,0.02,0.01%,9317398568.00,United States,2006,711794,Industrials,Metal Fabrications +GTM,ZoomInfo Technologies Inc Common Stock,$8.715,-0.005,-0.057%,2715528934.00,United States,2020,6224755,Technology,Computer Software: Prepackaged Software +GTN,Gray Media Inc. Common Stock,$4.21,-0.13,-2.995%,429784809.00,United States,,1491355,Industrials,Broadcasting +GTX,Garrett Motion Inc. Common Stock,$18.14,-0.20,-1.091%,3527912877.00,Switzerland,,2750926,Consumer Discretionary,Auto Parts:O.E.M. +GTY,Getty Realty Corporation Common Stock,$28.80,-0.65,-2.207%,1663008106.00,United States,,391407,Finance,Real Estate +GUG,Guggenheim Active Allocation Fund Common Shares of Beneficial Interest,$15.77,0.12,0.767%,0.00,United States,2021,96076,Finance,Trusts Except Educational Religious and Charitable +GURE,Gulf Resources Inc. (NV) Common Stock,$4.49,-0.10,-2.179%,6912494.00,China,,12001,Industrials,Major Chemicals +GUT,Gabelli Utility Trust (The) Common Stock,$6.07,-0.05,-0.817%,445532106.00,United States,,219545,Finance,Trusts Except Educational Religious and Charitable +GUT^C,Gabelli Utility Trust (The) 5.375% Series C Cumulative Preferred Shares,$22.49,-0.01,-0.044%,,United States,,1518,, +GUTS,Fractyl Health Inc. Common Stock,$1.83,-0.29,-13.679%,250791325.00,United States,2024,6817242,Health Care,Medical/Dental Instruments +GV,Visionary Holdings Inc. Common Shares,$1.26,-0.10,-7.353%,4755570.00,Canada,2022,163746,Real Estate,Other Consumer Services +GVA,Granite Construction Incorporated Common Stock,$119.63,0.25,0.209%,5221826292.00,United States,,266699,Industrials,Military/Government/Technical +GVH,Globavend Holdings Limited Ordinary Shares,$1.29,0.05,4.032%,1968686.00,Australia,2023,58282,Industrials,Integrated Freight & Logistics +GWAV,Greenwave Technology Solutions Inc. Common Stock,$4.62,-0.28,-5.714%,3832895.00,United States,,30305,Industrials,Metal Fabrications +GWH,ESS Tech Inc. Common Stock,$1.68,-0.01,-0.592%,35158701.00,United States,,217013,Miscellaneous,Industrial Machinery/Components +GWRE,Guidewire Software Inc. Common Stock,$162.69,2.40,1.497%,13831769743.00,United States,2012,1320381,Technology,Computer Software: Prepackaged Software +GWRS,Global Water Resources Inc. Common Stock,$8.57,-0.12,-1.381%,246389771.00,United States,2016,139057,Utilities,Water Supply +GWW,W.W. Grainger Inc. Common Stock,$1070.01,12.45,1.177%,50878266083.00,United States,,315193,Industrials,Office Equipment/Supplies/Services +GXAI,Gaxos.ai Inc. Common Stock,$1.41,0.08,6.015%,10044069.00,United States,2023,1950832,Technology,Computer Software: Prepackaged Software +GXO,GXO Logistics Inc. Common Stock ,$57.56,-0.36,-0.622%,6590011994.00,United States,2021,1693628,Consumer Discretionary,Transportation Services +GYRE,Gyre Therapeutics Inc. Common Stock,$8.03,-0.06,-0.742%,773555251.00,United States,2006,78862,Health Care,Biotechnology: Pharmaceutical Preparations +GYRO,Gyrodyne LLC Common Stock,$8.79,-0.23,-2.55%,19331917.00,United States,,1206,Real Estate,Building operators +H,Hyatt Hotels Corporation Class A Common Stock,$158.16,1.30,0.829%,15019302846.00,United States,2009,543950,Consumer Discretionary,Hotels/Resorts +HAE,Haemonetics Corporation Common Stock,$66.06,-1.81,-2.667%,3092246932.00,United States,1991,705245,Health Care,Medical/Dental Instruments +HAFC,Hanmi Financial Corporation Common Stock,$24.77,-3.69,-12.966%,741992954.00,United States,,707181,Finance,Major Banks +HAFN,Hafnia Limited Common Shares,$6.03,0.16,2.726%,3002877541.00,,2024,1375940,Consumer Discretionary,Transportation Services +HAIN,Hain Celestial Group Inc. (The) Common Stock,$1.28,0.00,0.00%,115926039.00,United States,,1512610,Consumer Staples,Packaged Foods +HAL,Halliburton Company Common Stock,$33.36,-0.90,-2.627%,28076663710.00,United States,,16317746,Energy,Oilfield Services/Equipment +HALO,Halozyme Therapeutics Inc. Common Stock,$72.83,2.61,3.717%,8564589510.00,United States,,2542306,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +HAO,Haoxi Health Technology Limited Class A Ordinary Shares,$1.41,-0.0579,-3.944%,83815797.00,China,2024,24771,Consumer Discretionary,Advertising +HAS,Hasbro Inc. Common Stock,$89.875,0.185,0.206%,12612789942.00,United States,,1197705,Consumer Discretionary,Recreational Games/Products/Toys +HASI,HA Sustainable Infrastructure Capital Inc. Common Stock,$34.62,0.24,0.698%,4129428386.00,United States,2013,540832,Finance,Finance/Investors Services +HAVA,Harvard Ave Acquisition Corporation Class A Ordinary Share,$10.00,0.00,0.00%,0.00,South Korea,2025,649,, +HAVAR,Harvard Ave Acquisition Corporation Rights that convert on a 1/10th of 1 basis to Class A ordinary Shares,$0.13,0.00,0.00%,0.00,South Korea,2025,10,, +HAVAU,Harvard Ave Acquisition Corporation Unit,$10.08,0.00,0.00%,0.00,South Korea,2025,348,Finance,Blank Checks +HAYW,Hayward Holdings Inc. Common Stock,$16.30,-0.10,-0.61%,3534870796.00,United States,2021,1399514,Industrials,Industrial Machinery/Components +HBAN,Huntington Bancshares Incorporated Common Stock,$17.06,-0.37,-2.123%,26866141773.00,United States,,42270469,Finance,Major Banks +HBANL,Huntington Bancshares Incorporated Depositary Shares Each Representing a 1/40th Interest in a Share of 6.875% Series J Non-Cumulative Perpetual Preferred Stock,$25.7587,-0.1113,-0.43%,40564881951.00,United States,,10350,Finance,Major Banks +HBANM,Huntington Bancshares Incorporated Depositary Shares each representing a 1/1000th interest in a share of Huntington Series I Preferred Stock,$22.65,-0.05,-0.22%,35669291393.00,United States,,16940,Finance,Major Banks +HBANP,Huntington Bancshares Incorporated Depositary Shares 4.500% Series H Non-Cumulative Perpetual Preferred Stock,$17.88,-0.04,-0.223%,28157480358.00,United States,,23176,Finance,Major Banks +HBB,Hamilton Beach Brands Holding Company Class A Common Stock ,$19.08,0.06,0.315%,256495340.00,United States,2017,68272,Consumer Discretionary,Home Furnishings +HBCP,Home Bancorp Inc. Common Stock,$58.41,-0.09,-0.154%,457241891.00,United States,2008,29396,Finance,Banks +HBIO,Harvard Bioscience Inc. Common Stock,$0.5726,-0.0187,-3.163%,25606611.00,United States,2000,181738,Industrials,Biotechnology: Laboratory Analytical Instruments +HBM,Hudbay Minerals Inc. Ordinary Shares (Canada),$27.08,0.84,3.201%,10727705144.00,Canada,,8909238,Basic Materials,Metal Mining +HBNB,Hotel101 Global Holdings Corp. Class A Ordinary Shares,$8.21,-0.08,-0.965%,1922391188.00,Singapore,,5029,Consumer Discretionary,Hotels/Resorts +HBNC,Horizon Bancorp Inc. Common Stock,$17.25,-0.31,-1.765%,883500719.00,United States,,345517,Finance,Major Banks +HBT,HBT Financial Inc. Common Stock,$26.49,-0.44,-1.634%,145863476.00,United States,2019,33073,Finance,Major Banks +HCA,HCA Healthcare Inc. Common Stock,$491.23,-14.61,-2.888%,112095689497.00,United States,2011,1957869,Health Care,Hospital/Nursing Management +HCAC,Hall Chadwick Acquisition Corp Class A Ordinary Shares,$9.955,0.015,0.151%,0.00,Cayman Islands,2026,131796,Consumer Discretionary,Auto Parts:O.E.M. +HCACR,Hall Chadwick Acquisition Corp Rights,$0.23,0.02,9.524%,0.00,Cayman Islands,2026,576800,, +HCACU,Hall Chadwick Acquisition Corp. Unit,$10.20,0.07,0.691%,0.00,Cayman Islands,2025,355682,Consumer Discretionary,Auto Parts:O.E.M. +HCAI,Huachen AI Parking Management Technology Holding Co. Ltd. Class A Ordinary Shares,$0.354,0.007,2.017%,12353715.00,China,2025,205123,Consumer Discretionary,Miscellaneous manufacturing industries +HCAT,Health Catalyst Inc Common Stock,$2.19,-0.03,-1.351%,154900636.00,United States,2019,564908,Technology,Computer Software: Programming Data Processing +HCC,Warrior Met Coal Inc. Common Stock,$90.09,-2.29,-2.479%,4736045354.00,United States,2017,754615,Energy,Coal Mining +HCHL,Happy City Holdings Limited Class A Ordinary shares,$1.44,-0.17,-10.559%,27665280.00,Hong Kong,2025,2186282,Consumer Discretionary,Restaurants +HCI,HCI Group Inc. Common Stock,$155.50,3.35,2.202%,2015285754.00,United States,,214987,Finance,Property-Casualty Insurers +HCKT,Hackett Group Inc (The). Common Stock,$18.63,-0.61,-3.17%,505447083.00,United States,,151385,Consumer Discretionary,Professional Services +HCM,HUTCHMED (China) Limited American Depositary Shares,$15.22,-0.02,-0.131%,2654884475.00,Hong Kong,2016,11306,Health Care,Biotechnology: Pharmaceutical Preparations +HCMA,HCM III Acquisition Corp. Class A Ordinary Share,$10.19,0.0093,0.091%,808125450.00,United States,2025,409587,Consumer Discretionary,Hotels/Resorts +HCMAU,HCM III Acquisition Corp. Units,$10.35,0.02,0.194%,0.00,United States,2025,2027,, +HCMAW,HCM III Acquisition Corp. Warrants,$0.639,-0.001,-0.156%,50676365.00,United States,2025,24304,Consumer Discretionary,Hotels/Resorts +HCSG,Healthcare Services Group Inc. Common Stock,$18.55,-0.09,-0.483%,1306949692.00,United States,1983,393642,Health Care,Hospital/Nursing Management +HCTI,Healthcare Triangle Inc. Common Stock,$0.3014,0.028,10.241%,3242680.00,United States,2021,15041315,Technology,EDP Services +HCWB,HCW Biologics Inc. Common Stock,$1.22,-0.055,-4.314%,4001371.00,United States,2021,40505,Health Care,Biotechnology: Pharmaceutical Preparations +HCWC,Healthy Choice Wellness Corp. Class A Common Stock,$0.329,-0.0107,-3.15%,5976532.00,,2024,17143,Consumer Staples,Food Chains +HCXY,Hercules Capital Inc. 6.25% Notes due 2033,$25.40,0.11,0.435%,4614562348.00,United States,2018,1500,Finance,Investment Managers +HD,Home Depot Inc. (The) Common Stock,$375.30,-5.06,-1.33%,373615460321.00,United States,,3371493,Consumer Discretionary,RETAIL: Building Materials +HDB,HDFC Bank Limited Common Stock,$32.31,-0.13,-0.401%,165363436441.00,India,2001,9603158,Finance,Commercial Banks +HDL,SUPER HI INTERNATIONAL HOLDING LTD. American Depositary Shares,$16.92,0.5764,3.527%,1100305908.00,Singapore,2024,190,Consumer Discretionary,Restaurants +HDSN,Hudson Technologies Inc. Common Stock,$7.14,-0.09,-1.245%,307042741.00,United States,,171757,Consumer Discretionary,Industrial Specialties +HE,Hawaiian Electric Industries Inc. Common Stock,$15.80,0.40,2.597%,2727403521.00,United States,,3018709,Utilities,Electric Utilities: Central +HEI,Heico Corporation Common Stock,$331.11,-7.45,-2.20%,46142351575.00,United States,2000,391165,Industrials,Aerospace +HEI/A,Heico Corporation,$255.10,-6.25,-2.391%,,United States,,331864,, +HELE,Helen of Troy Limited Common Stock,$17.31,-0.33,-1.871%,399378103.00,Bermuda,,1134343,Consumer Discretionary,Home Furnishings +HELP,Cybin Inc. Common Stock,$7.13,-0.12,-1.655%,355745154.00,Canada,,166047,Health Care,Biotechnology: Pharmaceutical Preparations +HEPS,D-Market Electronic Services & Trading American Depositary Shares,$2.85,-0.06,-2.062%,915941282.00,Turkey,2021,91835,Consumer Discretionary,Catalog/Specialty Distribution +HEQ,John Hancock Diversified Income Fund Common Shares of Beneficial Interest,$11.06,-0.03,-0.271%,0.00,United States,2011,49914,Finance,Investment Managers +HERE,Here Group Limited American Depositary Shares,$4.74,-0.04,-0.837%,257783075.00,China,2023,167775,Real Estate,Other Consumer Services +HERZ,Herzfeld Credit Income Fund Inc. Common Stock,$1.9262,-0.0238,-1.221%,0.00,United States,,145698,Finance,Investment Managers +HESM,Hess Midstream LP Class A Representing Limited Partner Interests,$35.99,0.37,1.039%,4656831684.00,United States,2017,2380375,Energy,Oil & Gas Production +HFBL,Home Federal Bancorp Inc. of Louisiana Common Stock,$18.82,-0.67,-3.438%,58121072.00,United States,2010,4052,Finance,Savings Institutions +HFFG,HF Foods Group Inc. Common Stock,$2.02,-0.13,-6.047%,107148541.00,United States,2017,241402,Consumer Discretionary,Food Distributors +HFRO,Highland Opportunities and Income Fund Common Shares of Beneficial Interest,$6.20,-0.05,-0.80%,0.00,United States,2017,132651,Finance,Finance/Investors Services +HFRO^A,Highland Opportunities and Income Fund 5.375% Series A Cumulative Preferred Shares,$16.13,0.02,0.124%,,United States,,12524,, +HFRO^B,Highland Opportunities and Income Fund 5.375% Series B Cumulative Preferred Shares,$16.05,-0.02,-0.124%,,United States,,8404,, +HFWA,Heritage Financial Corporation Common Stock,$25.20,-0.55,-2.136%,855709798.00,United States,,292715,Finance,Banks +HG,Hamilton Insurance Group Ltd. Class B Common Shares,$27.28,0.08,0.294%,1760590420.00,Bermuda,2023,226624,, +HGBL,Heritage Global Inc. Common Stock,$1.40,0.02,1.449%,48638174.00,United States,,260403,Real Estate,Real Estate +HGLB,Highland Global Allocation Fund Common Stock,$8.70,-0.15,-1.695%,0.00,,2019,196685,Finance,Trusts Except Educational Religious and Charitable +HGTY,Hagerty Inc. Class A Common Stock,$12.49,0.35,2.883%,4272379972.00,United States,2021,527018,Finance,Specialty Insurers +HGV,Hilton Grand Vacations Inc. Common Stock ,$44.12,-0.44,-0.987%,3774161263.00,United States,2016,761409,Consumer Discretionary,Hotels/Resorts +HHH,Howard Hughes Holdings Inc. Common Stock,$80.30,-0.44,-0.545%,4769094088.00,United States,,350830,Real Estate,Real Estate Investment Trusts +HHS,Harte Hanks Inc. Common Stock,$3.06,0.00,0.00%,22689270.00,United States,,3957,Consumer Discretionary,Advertising +HI,Hillenbrand Inc Common Stock,$31.86,-0.04,-0.125%,2246347253.00,United States,,983931,Consumer Discretionary,Miscellaneous manufacturing industries +HIFS,Hingham Institution for Savings Common Stock,$300.85,2.96,0.994%,646045290.00,United States,,46227,Finance,Banks +HIG,The Hartford Insurance Group Inc. Common Stock,$130.67,0.36,0.276%,36411233656.00,United States,,1158472,Finance,Property-Casualty Insurers +HIG^G,The Hartford Insurance Group Inc. Depositary Shares each representing a 1/1000th interest in a share of 6.000% Non-Cumulative Preferred Stock Series G,$25.2497,0.0047,0.019%,,United States,,20219,, +HIHO,Highway Holdings Limited Common Stock,$0.9203,-0.1197,-11.51%,4235060.00,Hong Kong,,166386,Industrials,Metal Fabrications +HII,Huntington Ingalls Industries Inc. Common Stock,$425.39,2.60,0.615%,16692913609.00,United States,,441564,Industrials,Marine Transportation +HIMS,Hims & Hers Health Inc. Class A Common Stock,$28.67,-1.01,-3.403%,6526682896.00,United States,2019,15053601,Health Care,Medical/Nursing Services +HIMX,Himax Technologies Inc. American Depositary Shares,$8.52,0.09,1.068%,1490262287.00,Taiwan,2006,1297422,Technology,Semiconductors +HIND,Vyome Holdings Inc. Common Stock,$2.54,-0.72,-22.086%,14337015.00,United States,2016,1142492,Health Care,Medical/Dental Instruments +HIO,Western Asset High Income Opportunity Fund Inc. Common Stock,$3.74,0.01,0.268%,0.00,United States,,323427,Finance,Finance/Investors Services +HIPO,Hippo Holdings Inc. Common Stock,$30.65,-0.24,-0.777%,776523236.00,United States,2021,101265,Finance,Property-Casualty Insurers +HIT,Health In Tech Inc. Class A Common Stock,$1.21,-0.04,-3.20%,68859658.00,United States,2024,223271,Finance,Specialty Insurers +HITI,High Tide Inc. Common Shares,$2.48,0.01,0.405%,215948182.00,Canada,,493342,Consumer Discretionary,Other Specialty Stores +HIVE,HIVE Digital Technologies Ltd. Common Shares,$2.95,-0.09,-2.961%,701250394.00,Canada,,13547458,Finance,Finance: Consumer Services +HIW,Highwoods Properties Inc. Common Stock,$25.47,-0.81,-3.082%,2798998703.00,United States,1994,1062776,Real Estate,Real Estate Investment Trusts +HIX,Western Asset High Income Fund II Inc. Common Stock,$4.20,-0.02,-0.474%,0.00,United States,1998,282719,Finance,Finance/Investors Services +HKD,AMTD Digital Inc. American Depositary Shares (every five of which represent two Class A Ordinary Shares),$1.39,0.00,0.00%,175367920.00,,2022,198402,Finance,Finance: Consumer Services +HKIT,Hitek Global Inc. Class A Ordinary Share,$1.94,0.09,4.865%,56840766.00,China,2023,6291,Technology,Computer Software: Prepackaged Software +HKPD,Cellyan Biotechnology Co. Ltd Class A Ordinary Shares,$0.8437,-0.0053,-0.624%,9280700.00,Hong Kong,2025,12030,Health Care,Other Pharmaceuticals +HL,Hecla Mining Company Common Stock,$27.19,-1.12,-3.956%,18219982837.00,United States,,37652368,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +HL^B,Hecla Mining Company Preferred Stock,$88.735,-5.1769,-5.513%,,United States,,2091,, +HLF,Herbalife Ltd. Common Shares,$16.49,-0.45,-2.656%,1703593773.00,Cayman Islands,2004,1159162,Health Care,Other Pharmaceuticals +HLI,Houlihan Lokey Inc. Class A Common Stock,$180.53,0.88,0.49%,12649504216.00,United States,2015,648908,Finance,Investment Managers +HLIO,Helios Technologies Inc. Common Stock,$64.05,-1.77,-2.689%,2121880041.00,United States,2021,323498,Industrials,Metal Fabrications +HLIT,Harmonic Inc. Common Stock,$10.04,-0.21,-2.049%,1126820143.00,United States,1995,704575,Technology,Radio And Television Broadcasting And Communications Equipment +HLLY,Holley Inc. Common Stock,$3.89,-0.18,-4.423%,473038187.00,United States,2020,489916,Consumer Discretionary,Auto Parts:O.E.M. +HLMN,Hillman Solutions Corp. Common Stock,$9.35,-0.16,-1.682%,1844658115.00,United States,2020,544716,Consumer Discretionary,Industrial Machinery/Components +HLN,Haleon plc American Depositary Shares (Each representing two Ordinary Shares),$10.31,-0.11,-1.056%,45912860531.00,United Kingdom,2022,6709662,Consumer Discretionary,Package Goods/Cosmetics +HLNE,Hamilton Lane Incorporated Class A Common Stock,$148.64,1.28,0.869%,8294667616.00,United States,2017,266551,Finance,Investment Managers +HLP,Hongli Group Inc. Ordinary Shares,$0.885,0.014,1.607%,64993294.00,China,2023,1063,Industrials,Industrial Machinery/Components +HLT,Hilton Worldwide Holdings Inc. Common Stock ,$296.31,0.14,0.047%,68872864037.00,United States,2016,1274901,Consumer Discretionary,Hotels/Resorts +HLX,Helix Energy Solutions Group Inc. Common Stock,$7.56,-0.09,-1.176%,1111931733.00,United States,,1738189,Energy,Oilfield Services/Equipment +HLXC,Helix Acquisition Corp. III Class A Ordinary Shares,$10.26,0.01,0.098%,0.00,United States,2026,85444,, +HMC,Honda Motor Company Ltd. Common Stock,$29.42,-0.51,-1.704%,42624770536.00,Japan,,1301784,Industrials,Auto Manufacturing +HMN,Horace Mann Educators Corporation Common Stock,$43.17,0.27,0.629%,1756370069.00,United States,1991,211700,Finance,Property-Casualty Insurers +HMR,Heidmar Maritime Holdings Corp. Common Stock,$1.05,0.0125,1.205%,61071508.00,Greece,,18814,Consumer Discretionary,Marine Transportation +HMY,Harmony Gold Mining Company Limited,$26.04,1.88,7.781%,16529351533.00,South Africa,,8369101,Basic Materials,Precious Metals +HNGE,Hinge Health Inc. Class A Common Stock,$37.65,-2.75,-6.807%,2963785937.00,United States,2025,913185,Technology,EDP Services +HNI,HNI Corporation Common Stock,$47.33,-0.09,-0.19%,2169193583.00,United States,,621623,Consumer Discretionary,Office Equipment/Supplies/Services +HNNA,Hennessy Advisors Inc. Common Stock,$10.38,-0.18,-1.705%,81918098.00,United States,,28454,Finance,Investment Managers +HNNAZ,Hennessy Advisors Inc. 4.875% Notes due 2026,$25.0001,-0.0199,-0.08%,194689779.00,United States,,2030,Finance,Investment Managers +HNRG,Hallador Energy Company Common Stock,$18.21,-0.46,-2.464%,798053359.00,United States,,343651,Energy,Coal Mining +HNST,The Honest Company Inc. Common Stock,$2.43,-0.07,-2.80%,271651338.00,United States,2021,1227580,Consumer Discretionary,Catalog/Specialty Distribution +HNVR,Hanover Bancorp Inc. Common Stock,$23.73,-0.14,-0.587%,170675415.00,United States,2022,6057,Finance,Major Banks +HOFT,Hooker Furnishings Corporation Common Stock,$13.29,0.08,0.606%,143235899.00,United States,,47351,Consumer Discretionary,Home Furnishings +HOG,Harley-Davidson Inc. Common Stock,$19.88,-0.09,-0.451%,2348660236.00,United States,,2928127,Consumer Discretionary,Motor Vehicles +HOLO,MicroCloud Hologram Inc. Ordinary Shares,$2.63,-0.12,-4.364%,38312041.00,United States,2021,451408,Technology,Computer Software: Programming Data Processing +HOLOW,MicroCloud Hologram Inc. Warrant,$0.095,-0.025,-20.833%,1383895.00,United States,2021,23849,Technology,Computer Software: Programming Data Processing +HOLX,Hologic Inc. Common Stock,$75.10,-0.10,-0.133%,16740182623.00,United States,1990,1960704,Health Care,Medical Electronics +HOMB,Home BancShares Inc. Common Stock,$28.31,-0.31,-1.083%,5564114778.00,United States,2006,1141388,Finance,Major Banks +HON,Honeywell International Inc. Common Stock,$216.64,-4.27,-1.933%,137541964741.00,United States,,5107460,Industrials,Aerospace +HOOD,Robinhood Markets Inc. Class A Common Stock,$103.40,-1.84,-1.748%,92976129055.00,United States,2021,22380160,Finance,Investment Bankers/Brokers/Service +HOPE,Hope Bancorp Inc. Common Stock,$11.76,-0.40,-3.289%,1507470112.00,United States,,1327302,Finance,Major Banks +HOTH,Hoth Therapeutics Inc. Common Stock,$0.9619,-0.0481,-4.762%,14923217.00,United States,2019,374820,Health Care,Biotechnology: Pharmaceutical Preparations +HOUR,Hour Loop Inc. Common Stock,$1.76,-0.02,-1.124%,61910323.00,United States,2022,11981,Consumer Discretionary,Catalog/Specialty Distribution +HOV,Hovnanian Enterprises Inc. Class A Common Stock,$112.72,-0.58,-0.512%,670985751.00,United States,1983,65898,Consumer Discretionary,Homebuilding +HOVNP,Hovnanian Enterprises Inc Dep Shr Srs A Pfd,$20.75,0.00,0.00%,123518048.00,United States,,2511,Consumer Discretionary,Homebuilding +HOVR,New Horizon Aircraft Ltd. Class A Ordinary Share,$2.22,-0.06,-2.632%,98241103.00,United States,2023,636267,Industrials,Aerospace +HOVRW,New Horizon Aircraft Ltd. Warrant,$0.4105,0.003,0.736%,18165753.00,United States,2023,135630,Industrials,Aerospace +HOWL,Werewolf Therapeutics Inc. Common Stock,$0.7135,0.0425,6.334%,34633433.00,United States,2021,1045816,Health Care,Biotechnology: Pharmaceutical Preparations +HP,Helmerich & Payne Inc. Common Stock,$33.10,-0.22,-0.66%,3365149863.00,United States,,1908099,Energy,Oil & Gas Production +HPAI,Helport AI Limited Ordinary Shares,$2.905,-0.395,-11.97%,108736962.00,Singapore,,30072,Technology,Computer Software: Prepackaged Software +HPAIW,Helport AI Limited Warrants,$0.1494,-0.0474,-24.085%,5592187.00,Singapore,,6679,Technology,Computer Software: Prepackaged Software +HPE,Hewlett Packard Enterprise Company Common Stock,$21.71,0.11,0.509%,28972715142.00,United States,2015,16652974,Technology,Retail: Computer Software & Peripheral Equipment +HPE^C,Hewlett Packard Enterprise Company 7.625% Series C Mandatory Convertible Preferred Stock,$60.87,0.12,0.198%,,United States,,5259,, +HPF,John Hancock Pfd Income Fund II Pfd Income Fund II,$16.13,0.00,0.00%,0.00,United States,2002,19694,Finance,Finance Companies +HPI,John Hancock Preferred Income Fund Common Shares of Beneficial Interest,$16.22,-0.03,-0.185%,0.00,United States,2002,38680,Finance,Trusts Except Educational Religious and Charitable +HPK,HighPeak Energy Inc. Common Stock,$4.43,0.10,2.309%,556350822.00,United States,,588632,Energy,Oil & Gas Production +HPP,Hudson Pacific Properties Inc. Common Stock,$8.69,-0.29,-3.229%,471149267.00,United States,2010,913296,Finance,Real Estate +HPP^C,Hudson Pacific Properties Inc. 4.750% Series C Cumulative Redeemable Preferred Stock,$15.64,0.13,0.838%,,United States,,9098,, +HPQ,HP Inc. Common Stock,$19.05,-0.32,-1.652%,17487605163.00,United States,,16930357,Technology,Computer Manufacturing +HPS,John Hancock Preferred Income Fund III Preferred Income Fund III,$14.58,0.03,0.206%,0.00,United States,2003,63751,Finance,Investment Managers +HQH,abrdn Healthcare Investors Shares of Beneficial Interest,$19.07,-0.33,-1.701%,902844855.00,United States,1987,172289,Finance,Finance Companies +HQI,HireQuest Inc. Common Stock (DE),$10.96,-0.17,-1.527%,154536000.00,United States,,20799,Consumer Discretionary,Professional Services +HQL,abrdn Life Sciences Investors Shares of Beneficial Interest,$17.04,-0.25,-1.446%,437580997.00,United States,1992,126970,Finance,Investment Managers +HQY,HealthEquity Inc. Common Stock,$82.85,-0.17,-0.205%,7078396295.00,United States,2014,729216,Real Estate,Real Estate +HR,Healthcare Realty Trust Incorporated Common Stock,$16.34,-0.40,-2.389%,5745612778.00,United States,,3418416,Real Estate,Real Estate Investment Trusts +HRB,H&R Block Inc. Common Stock,$39.05,-0.24,-0.611%,4936908160.00,United States,,3170873,Consumer Discretionary,Other Consumer Services +HRI,Herc Holdings Inc. Common Stock ,$156.94,0.19,0.121%,5221348915.00,United States,2016,390621,Industrials,Misc Corporate Leasing Services +HRL,Hormel Foods Corporation Common Stock,$24.60,-0.60,-2.381%,13532639457.00,United States,,3486952,Consumer Staples,Meat/Poultry/Fish +HRMY,Harmony Biosciences Holdings Inc. Common Stock,$36.84,-0.84,-2.229%,2121849829.00,United States,2020,503122,Health Care,Biotechnology: Pharmaceutical Preparations +HROW,Harrow Inc. Common Stock,$42.59,-0.39,-0.907%,1577425123.00,United States,,471892,Health Care,Biotechnology: Pharmaceutical Preparations +HRTG,Heritage Insurance Holdings Inc. Common Stock,$25.72,0.32,1.26%,795042108.00,United States,2014,189225,Finance,Property-Casualty Insurers +HRTX,Heron Therapeutics Inc. Common Stock,$1.33,-0.07,-5.00%,243872154.00,United States,,1190384,Health Care,Biotechnology: Pharmaceutical Preparations +HRZN,Horizon Technology Finance Corporation Common Stock,$6.67,-0.02,-0.299%,306589425.00,United States,2010,572991,Finance,Finance: Consumer Services +HSAI,Hesai Group American Depositary Share each ADS represents one Class B ordinary share,$25.10,-0.77,-2.976%,3324938366.00,China,2023,1668207,Industrials,Industrial Machinery/Components +HSBC,HSBC Holdings plc. Common Stock,$87.00,-1.49,-1.684%,298849173564.00,United Kingdom,,1844228,Finance,Savings Institutions +HSCS,HeartSciences Inc. Common Stock,$3.27,-0.07,-2.096%,10392737.00,United States,2022,13677,Health Care,Industrial Specialties +HSCSW,HeartSciences Inc. Warrant,$0.1065,0.0245,29.878%,338479.00,United States,2022,526,Health Care,Industrial Specialties +HSDT,Solana Company Class A Common Stock (DE),$2.96,-0.08,-2.632%,122252144.00,United States,,486090,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +HSHP,Himalaya Shipping Ltd. Common Shares,$10.20,0.18,1.796%,474810000.00,,2023,1393084,Consumer Discretionary,Marine Transportation +HSIC,Henry Schein Inc. Common Stock,$75.08,-1.79,-2.329%,8838778510.00,United States,1995,1258867,Health Care,Medical Specialities +HSPT,Horizon Space Acquisition II Corp. Ordinary share,$10.53,-0.02,-0.19%,0.00,United States,2025,49240,Finance,Blank Checks +HSPTR,Horizon Space Acquisition II Corp. Right,$0.1813,-0.0087,-4.579%,0.00,United States,2025,904,Finance,Blank Checks +HSPTU,Horizon Space Acquisition II Corp. Units,$10.55,-0.17,-1.586%,0.00,United States,2024,261,, +HST,Host Hotels & Resorts Inc. Common Stock,$18.44,-0.14,-0.753%,12680994030.00,United States,,14095916,Real Estate,Real Estate Investment Trusts +HSTM,HealthStream Inc. Common Stock,$21.74,0.05,0.231%,644985298.00,United States,2000,272147,Technology,Computer Software: Programming Data Processing +HSY,The Hershey Company Common Stock,$192.00,0.37,0.193%,38934743424.00,United States,,1301669,Consumer Staples,Specialty Foods +HTB,HomeTrust Bancshares Inc. Common Stock,$41.98,-0.33,-0.78%,732300463.00,United States,,75450,Finance,Savings Institutions +HTBK,Heritage Commerce Corp Common Stock,$12.55,-0.09,-0.712%,769108440.00,United States,,510368,Finance,Major Banks +HTCO,High-Trend International Group Class A Ordinary Shares,$10.89,-1.05,-8.794%,80426178.00,Singapore,,51524,Consumer Discretionary,Marine Transportation +HTCR,Heartcore Enterprises Inc. Common Stock,$0.288,-0.0003,-0.104%,7320904.00,Japan,2022,52044,Technology,EDP Services +HTD,John Hancock Tax Advantaged Dividend Income Fund Common Shares of Beneficial Interest,$24.23,0.01,0.041%,0.00,United States,2004,59894,Finance,Finance Companies +HTFB,Horizon Technology Finance Corporation 4.875% Notes due 2026,$25.0087,0.00,0.00%,1064013123.00,United States,,2,Finance,Finance: Consumer Services +HTFC,Horizon Technology Finance Corporation 6.25% Notes due 2027,$24.95,0.00,0.00%,1061515689.00,United States,2022,1466,Finance,Finance: Consumer Services +HTFL,Heartflow Inc. Common Stock,$31.10,-0.11,-0.352%,2648436161.00,United States,2025,1153779,Health Care,Medical/Dental Instruments +HTGC,Hercules Capital Inc. Common Stock,$18.53,-0.17,-0.909%,3367235930.00,United States,2012,1103577,Finance,Investment Managers +HTH,Hilltop Holdings Inc.,$36.42,0.14,0.386%,2233585318.00,United States,,498687,Finance,Major Banks +HTHT,H World Group Limited American Depositary Shares,$48.85,-1.68,-3.325%,14993973716.00,China,2010,1116658,Consumer Discretionary,Hotels/Resorts +HTLD,Heartland Express Inc. Common Stock,$10.05,-0.28,-2.711%,778347747.00,United States,1986,406703,Industrials,Trucking Freight/Courier Services +HTLM,HomesToLife Ltd Ordinary Shares,$2.40,0.00,0.00%,215250000.00,Singapore,2024,12,Consumer Discretionary,Other Specialty Stores +HTO,H2O America Common Stock,$51.26,-1.13,-2.157%,1835368862.00,United States,,454198,Utilities,Water Supply +HTOO,Fusion Fuel Green PLC Class A Ordinary Shares,$3.69,-0.08,-2.122%,6680992.00,Ireland,,13033,Energy,Industrial Machinery/Components +HTT,High Templar Tech Limited American depositary shares each representing one Class A ordinary share,$3.08,0.00,0.00%,508589595.00,China,2017,172378,Finance,Finance: Consumer Services +HTZ,Hertz Global Holdings Inc Common Stock,$5.19,-0.11,-2.075%,1617167177.00,United States,,3539134,Consumer Discretionary,Rental/Leasing Companies +HTZWW,Hertz Global Holdings Inc Warrant,$2.61,-0.06,-2.247%,813257482.00,United States,,46633,Consumer Discretionary,Rental/Leasing Companies +HUBB,Hubbell Inc Common Stock,$485.73,1.59,0.328%,25814000389.00,United States,2015,629734,Technology,Electrical Products +HUBC,Hub Cyber Security Ltd. Ordinary Shares,$3.11,-0.05,-1.582%,6791413.00,Israel,,114156,Telecommunications,Computer Communications Equipment +HUBCW,Hub Cyber Security Ltd. Warrant 2/27/28,$0.02,-0.004,-16.667%,43675.00,Israel,,93306,Telecommunications,Computer Communications Equipment +HUBG,Hub Group Inc. Class A Common Stock,$47.53,0.00,0.00%,2906626330.00,United States,1996,410799,Industrials,Integrated Freight & Logistics +HUBS,HubSpot Inc. Common Stock,$317.11,-2.55,-0.798%,16611982078.00,United States,2014,938116,Technology,Computer Software: Prepackaged Software +HUDI,Huadi International Group Co. Ltd. Ordinary Shares,$1.17,-0.10,-7.874%,16706643.00,China,2021,6061,Industrials,Steel/Iron Ore +HUHU,HUHUTECH International Group Inc. Ordinary Shares,$7.55,0.14,1.889%,159859268.00,China,2024,580,Telecommunications,Metal Fabrications +HUIZ,Huize Holding Limited American Depositary Shares,$2.23,0.13,6.19%,22497524.00,China,2020,2154,Finance,Specialty Insurers +HUM,Humana Inc. Common Stock,$194.01,-13.92,-6.695%,23334177923.00,United States,,8300150,Health Care,Medical Specialities +HUMA,Humacyte Inc. Common Stock,$1.00,-0.03,-2.913%,209682760.00,United States,2020,3173774,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +HUMAW,Humacyte Inc. Warrant,$0.12,-0.0008,-0.662%,25161931.00,United States,2020,1806,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +HUN,Huntsman Corporation Common Stock,$11.41,0.04,0.352%,1982499207.00,United States,2005,6097865,Industrials,Major Chemicals +HURA,TuHURA Biosciences Inc. Common Stock,$0.5684,-0.0632,-10.006%,34513537.00,United States,,569935,Health Care,Biotechnology: Pharmaceutical Preparations +HURC,Hurco Companies Inc. Common Stock,$16.74,-0.24,-1.413%,107380672.00,United States,,19788,Industrials,Industrial Machinery/Components +HURN,Huron Consulting Group Inc. Common Stock,$169.22,-0.73,-0.43%,2917601215.00,United States,2004,135810,Consumer Discretionary,Professional Services +HUT,Hut 8 Corp. Common Stock,$64.60,2.76,4.463%,6979166427.00,United States,,6000604,Finance,Finance: Consumer Services +HUYA,HUYA Inc. American depositary shares each representing one Class A ordinary share,$4.31,0.05,1.174%,963326846.00,United States,2018,7609291,Technology,Computer Software: Programming Data Processing +HVII,Hennessy Capital Investment Corp. VII Ordinary Shares,$10.29,0.00,0.00%,,United States,2025,14013,, +HVIIR,Hennessy Capital Investment Corp. VII Rights,$0.2823,-0.0021,-0.738%,0.00,United States,2025,41832,Finance,Blank Checks +HVIIU,Hennessy Capital Investment Corp. VII Unit,$10.58,-0.1074,-1.005%,0.00,United States,2025,5499,Finance,Blank Checks +HVMC,Highview Merger Corp. Class A Ordinary Share,$10.05,-0.07,-0.692%,0.00,United States,2025,129,, +HVT,Haverty Furniture Companies Inc. Common Stock,$25.22,-0.58,-2.248%,410249377.00,United States,,86554,Consumer Discretionary,Other Specialty Stores +HVT/A,Haverty Furniture Companies Inc.,$25.68,0.68,2.72%,,United States,,272,, +HWBK,Hawthorn Bancshares Inc. Common Stock,$32.56,-0.02,-0.061%,224587354.00,United States,,5052,Finance,Major Banks +HWC,Hancock Whitney Corporation Common Stock,$67.29,-0.15,-0.222%,5626326979.00,United States,,827796,Finance,Major Banks +HWCPZ,Hancock Whitney Corporation 6.25% Subordinated Notes due 2060,$24.19,0.0558,0.231%,2050222918.00,United States,,2170,Finance,Major Banks +HWH,HWH International Inc. Common Stock,$1.72,0.01,0.585%,11139408.00,United States,2022,13091,Health Care,Other Pharmaceuticals +HWKN,Hawkins Inc. Common Stock,$153.75,0.11,0.072%,3211874246.00,United States,,95907,Consumer Discretionary,Specialty Chemicals +HWM,Howmet Aerospace Inc. Common Stock,$210.84,-4.69,-2.176%,84770807320.00,United States,,3925780,Industrials,Metal Fabrications +HXHX,Haoxin Holdings Limited Class A Ordinary Shares,$0.4831,0.0026,0.541%,6642625.00,China,2025,86420,Industrials,Trucking Freight/Courier Services +HXL,Hexcel Corporation Common Stock,$80.23,-1.34,-1.643%,6386779351.00,United States,,2660282,Industrials,Major Chemicals +HY,Hyster-Yale Inc. Class A common stock,$31.43,-0.50,-1.566%,557373145.00,United States,,65791,Industrials,Construction/Ag Equipment/Trucks +HYAC,Haymaker Acquisition Corp. 4 Class A Ordinary Shares,$11.385,0.025,0.22%,0.00,,2023,62601,, +HYFM,Hydrofarm Holdings Group Inc. Common Stock,$1.56,-0.06,-3.704%,7280526.00,United States,2020,12270,Consumer Discretionary,Consumer Specialties +HYFT,MindWalk Holdings Corp. Common Stock,$2.01,-0.18,-8.219%,93849475.00,Canada,,403552,Health Care,Biotechnology: Pharmaceutical Preparations +HYI,Western Asset High Yield Opportunity Fund Inc. Common Stock,$11.17,0.015,0.134%,0.00,,2010,12974,Finance,Investment Managers +HYLN,Hyliion Holdings Corp. Class A Common Stock,$2.10,-0.07,-3.226%,369545879.00,United States,2019,757730,Consumer Discretionary,Construction/Ag Equipment/Trucks +HYMC,Hycroft Mining Holding Corporation Class A Common Stock,$51.69,-3.16,-5.761%,4291582099.00,United States,2018,5335490,Basic Materials,Precious Metals +HYNE,Hoyne Bancorp Inc. Common Stock,$14.24,-0.33,-2.265%,115300397.00,United States,2025,37405,Finance,Banks +HYPD,Hyperion DeFi Inc. Common Stock,$3.93,0.28,7.671%,32118550.00,United States,2018,1460521,Health Care,Biotechnology: Pharmaceutical Preparations +HYPR,Hyperfine Inc. Class A Common Stock,$1.23,-0.08,-6.107%,119517448.00,United States,2021,522132,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +HYT,Blackrock Corporate High Yield Fund Inc. Common Stock,$8.91,-0.02,-0.224%,0.00,United States,2003,1262403,Finance,Finance Companies +HZO,MarineMax Inc. (FL) Common Stock,$26.86,-0.70,-2.54%,591656340.00,United States,1998,275918,Consumer Discretionary,Auto & Home Supply Stores +IAC,IAC Inc. Common Stock,$38.42,-0.85,-2.165%,2974977550.00,United States,,886607,Technology,Computer Software: Programming Data Processing +IAE,Voya Asia Pacific High Dividend Equity Income Fund ING Asia Pacific High Dividend Equity Income Fund Common Shares of Beneficial Interest,$8.25,0.03,0.365%,0.00,United States,2007,44485,Finance,Trusts Except Educational Religious and Charitable +IAF,abrdn Australia Equity Fund Inc. Common Stock,$14.19,0.07,0.496%,0.00,United States,1985,24181,Finance,Finance/Investors Services +IAG,Iamgold Corporation Ordinary Shares,$22.03,0.70,3.282%,12673859000.00,Canada,,10141397,Basic Materials,Precious Metals +IART,Integra LifeSciences Holdings Corporation Common Stock,$10.88,-0.25,-2.246%,847466168.00,United States,,1217616,Health Care,Medical/Dental Instruments +IAUX,i-80 Gold Corp. Common Shares,$1.90,0.07,3.825%,1569935747.00,Canada,2022,14679745,Basic Materials,Precious Metals +IBAC,IB Acquisition Corp. Common Stock,$10.55,0.015,0.142%,0.00,United States,2024,1357,Finance,Blank Checks +IBCP,Independent Bank Corporation Common Stock,$34.12,-0.82,-2.347%,706009402.00,United States,,98234,Finance,Major Banks +IBEX,IBEX Limited Common Shares,$36.48,-1.56,-4.101%,491282544.00,Bermuda,2020,100489,Technology,EDP Services +IBG,Innovation Beverage Group Limited Ordinary Shares,$0.7599,-0.1377,-15.341%,2637105.00,Australia,2024,372741,Consumer Staples,Beverages (Production/Distribution) +IBIO,iBio Inc. Common Stock,$2.23,-0.05,-2.193%,50146697.00,United States,,521234,Health Care,Biotechnology: Pharmaceutical Preparations +IBKR,Interactive Brokers Group Inc. Class A Common Stock,$75.45,-0.03,-0.04%,33602722628.00,United States,2019,4695702,Finance,Investment Bankers/Brokers/Service +IBM,International Business Machines Corporation Common Stock,$294.16,0.30,0.102%,274961708197.00,United States,,5790347,Technology,Computer Manufacturing +IBN,ICICI Bank Limited Common Stock,$29.58,-0.17,-0.571%,105534629382.00,India,,10445327,Finance,Commercial Banks +IBO,Impact BioMedical Inc. Common Stock,$0.4609,-0.0029,-0.625%,48219925.00,,2024,22205,Health Care,Biotechnology: Pharmaceutical Preparations +IBOC,International Bancshares Corporation Common Stock,$68.52,-0.28,-0.407%,4259469537.00,United States,,244642,Finance,Major Banks +IBP,Installed Building Products Inc. Common Stock,$293.96,1.35,0.461%,7973769944.00,United States,2014,192710,Consumer Discretionary,Homebuilding +IBRX,ImmunityBio Inc. Common Stock,$6.15,0.20,3.361%,6057535851.00,United States,2015,35336363,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IBTA,Ibotta Inc. Class A Common Stock,$20.57,-1.26,-5.772%,546808319.00,United States,2024,336254,Consumer Discretionary,Advertising +ICCC,ImmuCell Corporation Common Stock,$6.365,0.10,1.596%,57576842.00,United States,1987,25058,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +ICCM,IceCure Medical Ltd. Ordinary Shares,$0.63,0.00,0.00%,43280631.00,Israel,,149960,Health Care,Medical/Dental Instruments +ICE,Intercontinental Exchange Inc. Common Stock,$172.44,-0.84,-0.485%,98321595197.00,United States,2005,3209527,Finance,Investment Bankers/Brokers/Service +ICFI,ICF International Inc. Common Stock,$92.41,-1.11,-1.187%,1703664476.00,United States,2006,107701,Consumer Discretionary,Professional Services +ICG,Intchains Group Limited American Depositary Shares,$2.00,0.00,0.00%,239896994.00,China,2023,7882,Technology,Semiconductors +ICHR,Ichor Holdings Ordinary Shares,$30.88,-0.12,-0.387%,1061785053.00,United States,2016,892272,Technology,Semiconductors +ICL,ICL Group Ltd. Ordinary Shares,$5.47,-0.02,-0.364%,7058719004.00,Israel,2014,879356,Industrials,Agricultural Chemicals +ICLR,ICON plc Ordinary Shares,$186.32,-1.65,-0.878%,15046618155.00,Ireland,1998,408165,Health Care,Biotechnology: Commercial Physical & Biological Resarch +ICMB,Investcorp Credit Management BDC Inc. Common Stock,$2.825,0.015,0.534%,40735828.00,United States,2014,12401,Finance,Finance: Consumer Services +ICON,Icon Energy Corp. Common stock,$2.06,-0.10,-4.63%,5167448.00,Greece,2024,169148,Consumer Discretionary,Marine Transportation +ICR^A,InPoint Commercial Real Estate Income Inc. 6.75% Series A Cumulative Redeemable Preferred Stock,$21.23,0.13,0.616%,,,,2601,, +ICU,SeaStar Medical Holding Corporation Common Stock,$2.39,-0.08,-3.239%,8615264.00,United States,2021,82362,Health Care,Medical/Dental Instruments +ICUCW,SeaStar Medical Holding Corporation Warrant,$0.0238,-0.002,-7.752%,85792.00,United States,2021,6387,Health Care,Medical/Dental Instruments +ICUI,ICU Medical Inc. Common Stock,$149.28,0.01,0.007%,3685224605.00,United States,1992,139488,Health Care,Medical/Dental Instruments +IDA,IDACORP Inc. Common Stock,$132.35,-1.81,-1.349%,7152885396.00,United States,,419797,Utilities,Electric Utilities: Central +IDAI,T Stamp Inc. Class A Common Stock,$3.85,-0.10,-2.532%,20195679.00,United States,,41669,Technology,Computer Software: Prepackaged Software +IDCC,InterDigital Inc. Common Stock,$331.92,-1.55,-0.465%,8545131700.00,United States,,136162,Miscellaneous,Multi-Sector Companies +IDE,Voya Infrastructure Industrials and Materials Fund Common Shares of Beneficial Interest,$13.36,-0.02,-0.149%,0.00,United States,2010,39892,Finance,Finance/Investors Services +IDN,Intellicheck Inc. Common Stock,$6.025,-0.115,-1.873%,121734565.00,United States,1999,115773,Technology,Computer Software: Prepackaged Software +IDR,Idaho Strategic Resources Inc. Common Stock,$38.75,-1.72,-4.25%,604204493.00,United States,2022,544196,Basic Materials,Precious Metals +IDT,IDT Corporation Class B Common Stock,$47.68,-0.68,-1.406%,1195497185.00,United States,,109067,Telecommunications,Telecommunications Equipment +IDXX,IDEXX Laboratories Inc. Common Stock,$687.74,-7.01,-1.009%,54916953694.00,United States,1991,426388,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +IDYA,IDEAYA Biosciences Inc. Common Stock,$33.65,-1.09,-3.138%,2949974629.00,United States,2019,1018799,Health Care,Biotechnology: Pharmaceutical Preparations +IE,Ivanhoe Electric Inc. Common Stock,$19.44,0.12,0.621%,2813255265.00,Canada,2022,1434979,Basic Materials,Metal Mining +IEAGU,Infinite Eagle Acquisition Corp. Unit,$10.22,0.015,0.147%,0.00,United States,2026,118145,, +IEP,Icahn Enterprises L.P. Common Stock,$7.74,-0.20,-2.519%,4645613922.00,United States,,1640441,Consumer Discretionary,Auto Parts:O.E.M. +IESC,IES Holdings Inc. Common Stock,$475.04,-1.93,-0.405%,9431722058.00,United States,,125098,Industrials,Engineering & Construction +IEX,IDEX Corporation Common Stock,$196.40,1.55,0.795%,14700429230.00,United States,1989,1153333,Industrials,Fluid Controls +IFBD,Infobird Co. Ltd Ordinary Shares,$0.811,-0.021,-2.524%,6640934.00,China,2021,14161,Technology,Computer Software: Prepackaged Software +IFF,International Flavors & Fragrances Inc. Common Stock,$72.16,-1.05,-1.434%,18479914709.00,United States,,1444199,Industrials,Major Chemicals +IFN,India Fund Inc. (The) Common Stock,$13.76,0.01,0.073%,0.00,United States,,181222,Finance,Finance/Investors Services +IFRX,InflaRx N.V. Common Stock,$0.9109,-0.0558,-5.772%,54063473.00,Germany,2017,987460,Health Care,Biotechnology: Pharmaceutical Preparations +IFS,Intercorp Financial Services Inc. Common Shares,$49.04,-0.21,-0.426%,5661555453.00,,2019,269264,Finance,Commercial Banks +IGA,Voya Global Advantage and Premium Opportunity Fund Common Shares of Beneficial Interest,$9.83,-0.05,-0.506%,0.00,United States,2005,61396,Finance,Investment Managers +IGAC,Invest Green Acquisition Corporation Class A Ordinary Shares,$9.92,0.00,0.00%,0.00,United States,2025,1402,Finance,Blank Checks +IGACR,Invest Green Acquisition Corporation Rights,$0.185,0.005,2.778%,0.00,United States,2025,1200,, +IGACU,Invest Green Acquisition Corporation Units,$10.1187,-0.0313,-0.308%,0.00,United States,2025,2700,Finance,Blank Checks +IGC,IGC Pharma Inc. Common Stock,$0.287,-0.0042,-1.442%,27499773.00,United States,,208251,Health Care,Biotechnology: Pharmaceutical Preparations +IGD,Voya Global Equity Dividend and Premium Opportunity Fund,$5.73,-0.06,-1.036%,0.00,United States,2005,270011,Finance,Trusts Except Educational Religious and Charitable +IGI,Western Asset Investment Grade Opportunity Trust Inc. Common Stock,$16.50,0.04,0.243%,0.00,United States,2009,9309,Finance,Investment Managers +IGIC,International General Insurance Holdings Ltd. Ordinary Share,$24.80,0.27,1.101%,1118701613.00,Jordan,2018,41148,Finance,Property-Casualty Insurers +IGR,CBRE Global Real Estate Income Fund Common Shares of Beneficial Interest,$4.66,-0.05,-1.062%,0.00,United States,2004,529906,Finance,Finance Companies +IH,iHuman Inc. American depositary shares each representing five Class A ordinary shares,$1.83,0.00,0.00%,94284488.00,United States,2020,4239,Real Estate,Other Consumer Services +IHD,Voya Emerging Markets High Income Dividend Equity Fund Common Shares,$7.01,0.01,0.143%,0.00,United States,2011,112372,Finance,Investment Managers +IHG,Intercontinental Hotels Group American Depositary Shares (Each representing one Ordinary Share),$135.34,-1.07,-0.784%,20489339550.00,United Kingdom,,222972,Consumer Discretionary,Hotels/Resorts +IHRT,iHeartMedia Inc. Class A Common Stock,$3.19,-0.20,-5.90%,479005679.00,United States,,749143,Consumer Discretionary,Broadcasting +IHS,IHS Holding Limited Ordinary Shares,$7.95,0.03,0.379%,2650855449.00,Cayman Islands,2021,1164820,Telecommunications,Telecommunications Equipment +IHT,InnSuites Hospitality Trust Shares of Beneficial Interest,$1.19,0.01,0.847%,10953752.00,United States,1999,6880,Finance,Investment Bankers/Brokers/Service +IIF,Morgan Stanley India Investment Fund Inc. Common Stock,$23.38,-0.05,-0.213%,0.00,United States,1994,17020,Finance,Trusts Except Educational Religious and Charitable +III,Information Services Group Inc. Common Stock,$5.75,0.00,0.00%,275333598.00,United States,,243043,Consumer Discretionary,Professional Services +IIIN,Insteel Industries Inc. Common Stock,$32.08,-0.25,-0.773%,622235870.00,United States,,120796,Industrials,Steel/Iron Ore +IIIV,i3 Verticals Inc. Class A Common Stock,$22.59,-0.73,-3.13%,700091615.00,United States,2018,335571,Real Estate,Real Estate +IIM,Invesco Value Municipal Income Trust Common Stock,$12.34,0.05,0.407%,580824537.00,United States,,260048,Finance,Investment Managers +IINN,Inspira Technologies Oxy B.H.N. Ltd. Ordinary Shares,$0.7807,-0.0098,-1.24%,27883640.00,Israel,2021,62023,Health Care,Medical/Dental Instruments +IINNW,Inspira Technologies Oxy B.H.N. Ltd. Warrant,$0.2743,0.00,0.00%,9796955.00,Israel,2021,20,Health Care,Medical/Dental Instruments +IIPR,Innovative Industrial Properties Inc. Common Stock,$47.86,-0.90,-1.846%,1341179584.00,United States,2016,275097,Finance,Real Estate +IIPR^A,Innovative Industrial Properties Inc. 9.00% Series A Cumulative Redeemable Preferred Stock,$23.24,-0.01,-0.043%,,United States,,17207,, +IKT,Inhibikase Therapeutics Inc. Common Stock,$1.59,-0.10,-5.917%,303944578.00,United States,2020,581500,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ILAG,Intelligent Living Application Group Inc. Ordinary Shares,$3.86,0.02,0.521%,8018949.00,Hong Kong,2022,1967,Consumer Discretionary,Office Equipment/Supplies/Services +ILMN,Illumina Inc. Common Stock,$149.86,-2.23,-1.466%,22898608000.00,United States,2000,1848253,Health Care,Medical Specialities +ILPT,Industrial Logistics Properties Trust Common Shares of Beneficial Interest,$5.22,-0.12,-2.247%,347961207.00,United States,2018,257809,Real Estate,Real Estate Investment Trusts +IMA,ImageneBio Inc. Common Stock,$7.39,0.04,0.544%,82632556.00,United States,2021,30752,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IMAX,Imax Corporation Common Stock,$34.51,-0.24,-0.691%,1856601212.00,Canada,,624401,Consumer Discretionary,Industrial Machinery/Components +IMCC,IM Cannabis Corp. Common Shares,$1.45,0.09,6.618%,4473905.00,Canada,,152950,Health Care, Medicinal Chemicals and Botanical Products +IMCR,Immunocore Holdings plc American Depositary Shares,$33.13,-1.92,-5.478%,1593166903.00,United Kingdom,2021,838407,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IMDX,Insight Molecular Diagnostics Inc. Common Stock,$6.88,-0.01,-0.145%,197211327.00,United States,,11182,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +IMG,CIMG Inc. Common Stock,$0.9218,-0.0239,-2.527%,14272734.00,United States,,59807,Consumer Discretionary,Other Specialty Stores +IMKTA,Ingles Markets Incorporated Class A Common Stock,$71.38,-0.87,-1.204%,1355818559.00,United States,1987,135400,Consumer Staples,Food Chains +IMMP,Immutep Limited American Depositary Shares,$3.06,-0.02,-0.649%,450407624.00,Australia,,183824,Health Care,Biotechnology: Pharmaceutical Preparations +IMMR,Immersion Corporation Common Stock,$6.59,-0.16,-2.37%,213492487.00,United States,1999,259264,Technology,Computer peripheral equipment +IMMX,Immix Biopharma Inc. Common Stock,$6.14,0.20,3.367%,325144498.00,United States,2021,1647770,Health Care,Biotechnology: Pharmaceutical Preparations +IMNM,Immunome Inc. Common Stock,$24.75,-0.95,-3.696%,2730715713.00,United States,2020,1235649,Health Care,Biotechnology: Pharmaceutical Preparations +IMNN,Imunon Inc. Common Stock,$3.40,-0.24,-6.593%,10970858.00,United States,,32235,Health Care,Biotechnology: Pharmaceutical Preparations +IMO,Imperial Oil Limited Common Stock,$103.47,0.28,0.271%,51477256230.00,Canada,1929,411715,Energy,Integrated oil Companies +IMOS,ChipMOS TECHNOLOGIES INC. American Depositary Shares,$41.70,-1.22,-2.842%,1468930705.00,Taiwan,,26227,Technology,Semiconductors +IMPP,Imperial Petroleum Inc. Common Shares,$3.51,0.04,1.153%,160578067.00,Greece,,637450,Consumer Discretionary,Marine Transportation +IMPPP,Imperial Petroleum Inc. 8.75% Series A Cumulative Redeemable Perpetual Preferred Shares,$25.70,-0.045,-0.175%,1175742541.00,Greece,,2034,Consumer Discretionary,Marine Transportation +IMRN,Immuron Limited American Depositary Shares,$0.9697,0.0175,1.838%,6502322.00,Australia,2017,27369,Health Care,Biotechnology: Pharmaceutical Preparations +IMRX,Immuneering Corporation Class A Common Stock,$5.00,-0.23,-4.398%,322849835.00,United States,2021,1252344,Health Care,Biotechnology: Pharmaceutical Preparations +IMSR,Terrestrial Energy Inc. Common Stock ,$10.41,-0.025,-0.24%,1101195325.00,United States,2024,3222680,, +IMSRW,Terrestrial Energy Inc. Warrant,$5.06,0.06,1.20%,0.00,United States,2024,35685,, +IMTE,Integrated Media Technology Limited Ordinary Shares,$0.9148,-0.0352,-3.705%,3139076.00,Australia,,103965,Consumer Staples,Consumer Electronics/Appliances +IMTX,Immatics N.V. Ordinary Shares,$9.70,-0.29,-2.903%,1300419141.00,Germany,,249442,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IMUX,Immunic Inc. Common Stock,$0.6094,-0.0128,-2.057%,73301511.00,United States,2014,1026452,Health Care,Biotechnology: Pharmaceutical Preparations +IMVT,Immunovant Inc. Common Stock,$26.06,-0.77,-2.87%,5281795899.00,United States,2019,606387,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IMXI,International Money Express Inc. Common Stock,$15.47,-0.01,-0.065%,459748769.00,United States,2017,276575,Real Estate,Real Estate +INAB,IN8bio Inc. Common Stock,$1.96,-0.11,-5.314%,19141619.00,United States,2021,66458,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +INAC,Indigo Acquisition Corp. Ordinary Shares,$10.13,0.00,0.00%,0.00,United States,2025,14,, +INACU,Indigo Acquisition Corp. Unit,$10.24,0.00,0.00%,0.00,United States,2025,15,, +INBK,First Internet Bancorp Common Stock,$21.22,-1.08,-4.843%,184743315.00,United States,,53604,Finance,Major Banks +INBKZ,First Internet Bancorp 6.0% Fixed-to-Floating Rate Subordinated Notes Due 2029,$24.471,0.00,0.00%,213218123.00,United States,,5,Finance,Major Banks +INBS,Intelligent Bio Solutions Inc. Common Stock,$9.12,0.26,2.935%,11091215.00,United States,2020,79563,Health Care,Medical/Dental Instruments +INBX,Inhibrx Biosciences Inc. Common Stock,$73.98,0.49,0.667%,1075945737.00,United States,,475281,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +INCR,Intercure Ltd. Ordinary Shares,$0.93,-0.0239,-2.506%,50853642.00,Israel,,19287,Health Care,Biotechnology: Pharmaceutical Preparations +INCY,Incyte Corp. Common Stock,$101.18,-2.29,-2.213%,19863931090.00,United States,,1576840,Health Care,Biotechnology: Commercial Physical & Biological Resarch +INDB,Independent Bank Corp. Common Stock,$79.55,0.00,0.00%,3943871431.00,United States,,427869,Finance,Major Banks +INDI,indie Semiconductor Inc. Class A Common Stock,$4.32,-0.25,-5.47%,948812400.00,United States,,2444295,Technology,Semiconductors +INDO,Indonesia Energy Corporation Limited Ordinary Shares,$4.64,-0.06,-1.277%,64542576.00,,2019,1113698,Energy,Oil & Gas Production +INDP,Indaptus Therapeutics Inc. Common Stock,$2.29,-0.19,-7.661%,5134922.00,United States,,44470,Health Care,Biotechnology: Pharmaceutical Preparations +INDV,Indivior Pharmaceuticals Inc. Common Stock,$34.93,0.19,0.547%,4358209813.00,United Kingdom,,1776244,Health Care,Biotechnology: Pharmaceutical Preparations +INEO,INNEOVA Holdings Limited Class A Ordinary Shares,$0.5749,0.0479,9.089%,9296492.00,Singapore,2024,5227,Consumer Discretionary,Motor Vehicles +INFU,InfuSystems Holdings Inc. Common Stock,$8.11,-0.37,-4.363%,164926444.00,United States,,104975,Health Care,Medical/Dental Instruments +INFY,Infosys Limited American Depositary Shares,$17.93,-0.32,-1.753%,74485044720.00,India,,8729262,Technology,EDP Services +ING,ING Group N.V. Common Stock,$29.68,-0.35,-1.166%,93414570015.00,Netherlands,1997,3444814,Finance,Commercial Banks +INGM,Ingram Micro Holding Corporation Common Stock,$21.10,0.07,0.333%,4960033021.00,United States,2024,384768,Technology,Retail: Computer Software & Peripheral Equipment +INGN,Inogen Inc Common Stock,$5.86,-0.03,-0.509%,159090105.00,United States,2014,216642,Health Care,Industrial Specialties +INGR,Ingredion Incorporated Common Stock,$116.45,-0.54,-0.462%,7398084454.00,United States,,628284,Consumer Staples,Packaged Foods +INHD,Inno Holdings Inc. Common Stock,$1.35,-0.03,-2.174%,11357852.00,United States,2023,111141,Industrials,Steel/Iron Ore +INKT,MiNK Therapeutics Inc. Common Stock,$12.54,-0.29,-2.26%,105959225.00,United States,2021,12059,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +INLF,INLIF LIMITED Class A Ordinary Shares,$0.3958,-0.0045,-1.124%,7480620.00,China,2025,63699,Industrials,Industrial Machinery/Components +INLX,Intellinetics Inc. Common Stock,$8.22,0.22,2.75%,36818391.00,,2022,683,Technology,Computer Software: Prepackaged Software +INM,InMed Pharmaceuticals Inc. Common Shares,$1.07,0.00,0.00%,3000479.00,Canada,,53116,Health Care,Biotechnology: Pharmaceutical Preparations +INMB,INmune Bio Inc. Common stock,$1.61,-0.19,-10.556%,98172635.00,United States,2019,450484,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +INMD,InMode Ltd. Ordinary Shares,$15.12,-0.13,-0.852%,1051727090.00,Israel,2019,735858,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +INN,Summit Hotel Properties Inc. Common Stock,$4.46,-0.13,-2.832%,485261492.00,United States,2011,625127,Real Estate,Real Estate Investment Trusts +INN^E,Summit Hotel Properties Inc. 6.250% Series E Cumulative Redeemable Preferred Stock,$19.09,0.1177,0.62%,,United States,,983,, +INN^F,Summit Hotel Properties Inc. 5.875% Series F Cumulative Redeemable Preferred Stock $0.01 par value per share,$18.245,0.015,0.082%,,United States,,12036,, +INNV,InnovAge Holding Corp. Common Stock,$5.50,-0.26,-4.514%,746247871.00,United States,2021,101490,Health Care,Medical/Nursing Services +INO,Inovio Pharmaceuticals Inc. Common Stock,$1.53,0.00,0.00%,103821807.00,United States,,644228,Health Care,Medical/Dental Instruments +INOD,Innodata Inc. Common Stock,$55.84,-2.81,-4.791%,1779115504.00,United States,1993,1141058,Technology,EDP Services +INR,Infinity Natural Resources Inc. Class A Common Stock,$15.34,0.06,0.393%,933862798.00,United States,2025,140271,Energy,Oil & Gas Production +INSE,Inspired Entertainment Inc. Common Stock,$8.69,-0.17,-1.919%,233994483.00,United States,2014,77882,Technology,Computer Software: Prepackaged Software +INSG,Inseego Corp. Common Stock,$11.20,0.29,2.658%,171667720.00,United States,,139061,Telecommunications,Telecommunications Equipment +INSM,Insmed Incorporated Common Stock,$155.89,-6.75,-4.15%,33247201082.00,United States,,1732873,Health Care,Biotechnology: Pharmaceutical Preparations +INSP,Inspire Medical Systems Inc. Common Stock,$82.01,0.22,0.269%,2382918152.00,United States,2018,756580,Health Care,Medical/Dental Instruments +INSW,International Seaways Inc. Common Stock ,$59.66,2.21,3.847%,2947447293.00,United States,2016,532707,Consumer Discretionary,Marine Transportation +INTA,Intapp Inc. Common Stock,$36.50,-0.30,-0.815%,2990316557.00,United States,2021,757864,Technology,Computer Software: Prepackaged Software +INTC,Intel Corporation Common Stock,$48.78,4.85,11.04%,243656100000.00,United States,,201995055,Technology,Semiconductors +INTG,Intergroup Corporation (The) Common Stock,$32.08,1.94,6.437%,68933889.00,United States,,22691,Real Estate,Building operators +INTJ,Intelligent Group Limited Class A Ordinary Shares ,$0.3708,0.0458,14.092%,11402100.00,Hong Kong,2024,248217,Consumer Discretionary,Professional Services +INTR,Inter & Co. Inc. Class A Common Shares,$10.21,0.23,2.305%,4489379586.00,Brazil,,3805644,Finance,Commercial Banks +INTS,Intensity Therapeutics Inc. Common stock,$0.3819,-0.0057,-1.471%,22938810.00,United States,2023,825733,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +INTT,inTest Corporation Common Stock,$9.35,0.12,1.30%,116720099.00,United States,1997,83798,Industrials,Electrical Products +INTU,Intuit Inc. Common Stock,$538.70,-6.70,-1.228%,149974080000.00,United States,1993,2261359,Technology,Computer Software: Prepackaged Software +INTZ,Intrusion Inc. Common Stock,$1.14,-0.04,-3.39%,22917350.00,United States,,139670,Telecommunications,Computer Communications Equipment +INUV,Inuvo Inc.,$3.34,0.00,0.00%,48782621.00,United States,,718468,Consumer Discretionary,Advertising +INV,Innventure Inc. Common Stock,$3.53,-0.05,-1.397%,239144605.00,United States,,928150,Finance,Blank Checks +INVA,Innoviva Inc. Common Stock,$19.55,-0.17,-0.862%,1461735162.00,United States,2004,589734,Health Care,Biotechnology: Pharmaceutical Preparations +INVE,Identiv Inc. Common Stock,$3.45,0.15,4.545%,81952642.00,United States,,25369,Technology,Computer peripheral equipment +INVH,Invitation Homes Inc. Common Stock,$26.21,-0.56,-2.092%,16067269638.00,United States,2017,4113642,Finance,Real Estate +INVX,Innovex International Inc. Common Stock,$25.16,-0.93,-3.565%,1734223222.00,United States,,486977,Consumer Discretionary,Oil and Gas Field Machinery +INVZ,Innoviz Technologies Ltd. Ordinary shares,$1.04,-0.01,-0.952%,209372991.00,Israel,,2058623,Consumer Discretionary,Auto Parts:O.E.M. +INVZW,Innoviz Technologies Ltd. Warrant,$0.0061,-0.0031,-33.696%,1228053.00,Israel,,67449,Consumer Discretionary,Auto Parts:O.E.M. +IOBT,IO Biotech Inc. Common Stock,$0.31,-0.0193,-5.861%,22304141.00,Denmark,2021,1245582,Health Care,Biotechnology: Pharmaceutical Preparations +IONQ,IonQ Inc. Common Stock,$45.80,0.31,0.681%,16226005268.00,United States,2021,18945019,Technology,EDP Services +IONR,ioneer Ltd American Depositary Shares,$5.71,-0.39,-6.393%,380829826.00,Australia,,33928,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +IONS,Ionis Pharmaceuticals Inc. Common Stock,$81.92,-0.22,-0.268%,13268942275.00,United States,,1732406,Health Care,Biotechnology: Pharmaceutical Preparations +IOR,Income Opportunity Realty Investors Inc. Common Stock,$18.00,0.00,0.00%,73191204.00,United States,1987,7,Real Estate,Real Estate Investment Trusts +IOSP,Innospec Inc. Common Stock,$79.26,-0.27,-0.339%,1963871149.00,United States,,101494,Industrials,Major Chemicals +IOT,Samsara Inc. Class A Common Stock,$30.12,-0.46,-1.504%,17379362197.00,United States,2021,9314438,Technology,EDP Services +IOTR,iOThree Limited Ordinary Shares,$4.35,0.13,3.081%,11157754.00,Singapore,2025,518274,Consumer Discretionary,Telecommunications Equipment +IOVA,Iovance Biotherapeutics Inc. Common Stock,$2.75,-0.23,-7.718%,1091661918.00,United States,,11354146,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IP,International Paper Company Common Stock,$41.49,-0.71,-1.682%,21908309772.00,United States,,14320347,Basic Materials,Paper +IPAR,Interparfums Inc. Common Stock,$95.24,-1.49,-1.54%,3053844695.00,United States,,125082,Consumer Discretionary,Package Goods/Cosmetics +IPCX,Inflection Point Acquisition Corp. III Class A Ordinary Shares,$10.16,0.00,0.00%,0.00,United States,2025,102715,Finance,Blank Checks +IPCXR,Inflection Point Acquisition Corp. III Rights,$0.3683,-0.0317,-7.925%,0.00,United States,2025,10106,Finance,Blank Checks +IPDN,Professional Diversity Network Inc. Common Stock,$1.06,0.01,0.952%,5174881.00,United States,2013,741512,Technology,Computer Software: Programming Data Processing +IPEX,Inflection Point Acquisition Corp. V Class A Ordinary Shares,$10.31,0.02,0.194%,,United States,2025,9793,Health Care,Biotechnology: Pharmaceutical Preparations +IPEXR,Inflection Point Acquisition Corp. V Rights,$0.65,0.00,0.00%,0.00,United States,2025,4252,Finance,Blank Checks +IPEXU,Inflection Point Acquisition Corp. V Units,$10.735,0.00,0.00%,0.00,United States,2025,60,Finance,Blank Checks +IPGP,IPG Photonics Corporation Common Stock,$92.44,1.81,1.997%,3893987024.00,United States,2006,435933,Technology,Semiconductors +IPHA,Innate Pharma S.A. ADS,$1.78,0.00,0.00%,164039723.00,France,2019,8708,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IPI,Intrepid Potash Inc Common Stock,$33.39,-0.59,-1.736%,448325259.00,United States,2008,102206,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +IPM,Intelligent Protection Management Corp. Common Stock ,$1.77,-0.01,-0.562%,16081740.00,United States,,20003,Real Estate,Real Estate +IPSC,Century Therapeutics Inc. Common Stock,$2.36,-0.29,-10.943%,206044735.00,United States,2021,938109,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IPST,Heritage Distilling Holding Company Inc. Common Stock,$1.33,-0.21,-13.636%,12713897.00,United States,2024,68375,Consumer Staples,Beverages (Production/Distribution) +IPW,iPower Inc. Common Stock,$4.43,-0.37,-7.708%,4650756.00,United States,2021,86789,Consumer Discretionary,RETAIL: Building Materials +IPWR,Ideal Power Inc. Common Stock,$4.57,0.10,2.237%,38971690.00,United States,2013,116756,Technology,Semiconductors +IPX,IperionX Limited American Depositary Share,$56.83,0.55,0.977%,1818149972.00,United States,,113068,Basic Materials,Other Metals and Minerals +IQ,iQIYI Inc. American Depositary Shares,$2.13,0.01,0.472%,2051102346.00,China,2018,7737272,Consumer Discretionary,Consumer Electronics/Video Chains +IQI,Invesco Quality Municipal Income Trust Common Stock,$9.99,0.05,0.503%,528309132.00,United States,,156167,Finance,Finance Companies +IQST,iQSTEL Inc. Common Stock,$2.91,-0.03,-1.02%,13353364.00,United States,,150387,Telecommunications,Telecommunications Equipment +IQV,IQVIA Holdings Inc. Common Stock,$239.76,-1.28,-0.531%,40831128000.00,United States,2013,1590856,Health Care,Biotechnology: Commercial Physical & Biological Resarch +IR,Ingersoll Rand Inc. Common Stock,$85.25,-1.02,-1.182%,33683161174.00,United States,2017,2932085,Industrials,Industrial Machinery/Components +IRD,Opus Genetics Inc. Common Stock,$2.70,-0.13,-4.594%,186203362.00,United States,,1751167,Health Care,Biotechnology: Pharmaceutical Preparations +IRDM,Iridium Communications Inc Common Stock,$21.19,-0.01,-0.047%,2219561044.00,United States,,2388333,Telecommunications,Telecommunications Equipment +IREN,IREN Limited Ordinary Shares,$62.94,2.95,4.917%,20665826220.00,Australia,2021,44007284,Technology,EDP Services +IRHOU,Iron Horse Acquisitions II Corp. Units,$9.98,0.005,0.05%,0.00,United States,2025,4700,Finance,Blank Checks +IRIX,IRIDEX Corporation Common Stock,$1.48,-0.05,-3.268%,25441172.00,United States,1996,154128,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +IRM,Iron Mountain Incorporated (Delaware)Common Stock REIT,$92.24,0.52,0.567%,27265174650.00,United States,,1405227,Real Estate,Real Estate Investment Trusts +IRMD,iRadimed Corporation Common Stock,$97.92,-1.92,-1.923%,1245655596.00,United States,2014,62673,Health Care,Medical/Dental Instruments +IRON,Disc Medicine Inc. Common Stock,$80.01,-2.13,-2.593%,3020390462.00,United States,,413096,Health Care,Biotechnology: Pharmaceutical Preparations +IROQ,IF Bancorp Inc. Common Stock,$27.14,-0.12,-0.44%,90960416.00,United States,2011,5650,Finance,Savings Institutions +IRS,IRSA Inversiones Y Representaciones S.A. Global Depositary Shares (Each representing ten shares of Common Stock),$18.41,0.15,0.821%,1403800774.00,Argentina,,196367,Real Estate,Homebuilding +IRT,Independence Realty Trust Inc. Common Stock,$16.44,-0.39,-2.317%,3931017424.00,United States,2013,1787485,Real Estate,Real Estate Investment Trusts +IRTC,iRhythm Holdings Inc. Common Stock,$151.845,-4.715,-3.012%,4892315769.00,United States,2016,843672,Health Care,Medical/Dental Instruments +IRWD,Ironwood Pharmaceuticals Inc. Class A Common Stock,$4.79,-0.35,-6.809%,779230719.00,United States,2010,2136436,Health Care,Biotechnology: Pharmaceutical Preparations +ISBA,Isabella Bank Corporation Common stock,$49.89,0.05,0.10%,365947939.00,United States,,14745,Finance,Major Banks +ISD,PGIM High Yield Bond Fund Inc.,$14.69,0.06,0.41%,0.00,United States,2012,48700,Finance,Trusts Except Educational Religious and Charitable +ISOU,IsoEnergy Ltd. Common Shares,$13.21,1.24,10.359%,723827895.00,,2025,376334,, +ISPC,iSpecimen Inc. Common Stock,$0.358,0.0209,6.20%,39656034.00,United States,2021,87752,Health Care,Biotechnology: Commercial Physical & Biological Resarch +ISPO,Inspirato Incorporated Class A Common Stock,$4.25,0.01,0.236%,53675375.00,United States,2021,9833,Finance,Blank Checks +ISPOW,Inspirato Incorporated Warrant,$0.0078,0.00,0.00%,98510.00,United States,2021,701,Finance,Blank Checks +ISPR,Ispire Technology Inc. Common Stock,$3.17,0.04,1.278%,181608869.00,United States,2023,27028,Health Care, Medicinal Chemicals and Botanical Products +ISRG,Intuitive Surgical Inc. Common Stock,$522.04,-3.00,-0.571%,185061129949.00,United States,2000,1851332,Health Care,Industrial Specialties +ISSC,Innovative Solutions and Support Inc. Common Stock,$19.53,-1.75,-8.224%,346703474.00,United States,2000,396457,Technology,EDP Services +ISTR,Investar Holding Corporation Common Stock,$27.77,-0.13,-0.466%,382275405.00,United States,2014,109037,Finance,Major Banks +IT,Gartner Inc. Common Stock,$225.98,-6.02,-2.595%,16287993227.00,United States,1993,994521,Consumer Discretionary,Other Consumer Services +ITGR,Integer Holdings Corporation Common Stock,$85.90,0.11,0.128%,3009800793.00,United States,,468439,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +ITHA,ITHAX Acquisition Corp III Class A Ordinary Shares,$9.91,0.02,0.202%,0.00,United States,2026,806062,, +ITHAU,ITHAX Acquisition Corp III Units,$10.02,0.016,0.16%,0.00,United States,2025,326505,, +ITHAW,ITHAX Acquisition Corp III Warrants,$0.2368,-0.0132,-5.28%,0.00,United States,2026,110999,, +ITIC,Investors Title Company Common Stock,$251.35,-2.06,-0.813%,474441725.00,United States,,16761,Finance,Specialty Insurers +ITOC,iTonic Holdings Ltd Class A Ordinary Shares,$0.52,0.02,4.00%,9490000.00,China,2024,70174,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +ITP,IT Tech Packaging Inc. Common Stock,$0.2203,-0.0027,-1.211%,3737482.00,China,,308506,Consumer Discretionary,Containers/Packaging +ITRG,Integra Resources Corp. Common Shares,$4.51,0.07,1.577%,763566479.00,,,3404270,Basic Materials,Precious Metals +ITRI,Itron Inc. Common Stock,$99.21,0.21,0.212%,4543954017.00,United States,1993,600688,Industrials,Electrical Products +ITRM,Iterum Therapeutics plc Ordinary Share,$0.322,-0.0205,-5.985%,17012935.00,Ireland,2018,301339,Health Care,Biotechnology: Pharmaceutical Preparations +ITRN,Ituran Location and Control Ltd. Ordinary Shares,$45.06,-0.16,-0.354%,896404715.00,Israel,2005,128753,Technology,Electronic Components +ITT,ITT Inc. Common Stock ,$180.75,-2.21,-1.208%,15361945031.00,United States,2011,1145298,Industrials,Fluid Controls +ITUB,Itau Unibanco Banco Holding SA American Depositary Shares (Each repstg 500 Preferred shares),$8.88,0.10,1.139%,100856134189.00,Brazil,,67236437,Finance,Major Banks +ITW,Illinois Tool Works Inc. Common Stock,$258.25,-0.44,-0.17%,74918325000.00,United States,,1062446,Industrials,Industrial Machinery/Components +IVA,Inventiva S.A. American Depository Shares,$6.83,-0.04,-0.582%,653374131.00,France,2020,455113,Health Care,Biotechnology: Pharmaceutical Preparations +IVDA,Iveda Solutions Inc. Common Stock,$0.92,0.1495,19.403%,5404762.00,United States,,339712,Technology,Computer Software: Prepackaged Software +IVDAW,Iveda Solutions Inc. Warrant,$0.1099,-0.0089,-7.492%,645634.00,United States,,2009,Technology,Computer Software: Prepackaged Software +IVF,INVO Fertility Inc. Common Stock,$1.62,-0.095,-5.539%,3866658.00,United States,,2868430,Health Care,Medical/Dental Instruments +IVR,INVESCO MORTGAGE CAPITAL INC Common Stock,$8.95,-0.07,-0.776%,634962860.00,United States,2009,2462289,Real Estate,Real Estate Investment Trusts +IVR^C,INVESCO MORTGAGE CAPITAL INC 7.5% Fixed-to-Floating Series C Cumulative Redeemable Preferred Stock Liquation Preference $25.00 per Share,$24.92,-0.02,-0.08%,,United States,,5089,, +IVT,InvenTrust Properties Corp. Common Stock,$28.56,-0.21,-0.73%,2216809493.00,United States,2021,830867,Real Estate,Real Estate Investment Trusts +IVVD,Invivyd Inc. Common Stock,$1.92,-0.11,-5.419%,447595841.00,United States,2021,2811591,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +IVZ,Invesco Ltd Common Stock,$27.56,0.40,1.473%,12266760324.00,United States,,8674631,Finance,Investment Managers +IX,ORIX Corporation American Depositary Shares,$30.33,-0.23,-0.753%,35272644861.00,Japan,,151624,Finance,Diversified Financial Services +IXHL,Incannex Healthcare Inc. Common Stock,$0.3133,-0.0006,-0.191%,108472451.00,Australia,,7791392,Health Care,Biotechnology: Pharmaceutical Preparations +IZEA,IZEA Worldwide Inc. Common Stock,$3.76,-0.09,-2.338%,64392828.00,United States,,104796,Consumer Discretionary,Advertising +IZM,ICZOOM Group Inc. Class A Ordinary Shares,$1.36,0.00,0.00%,16344630.00,China,2023,218328,Consumer Discretionary,Consumer Electronics/Video Chains +J,Jacobs Solutions Inc. Common Stock,$136.70,-0.07,-0.051%,16233010445.00,United States,2022,452670,Industrials,Military/Government/Technical +JACK,Jack In The Box Inc. Common Stock,$20.81,-0.98,-4.497%,393242907.00,United States,,328403,Consumer Discretionary,Restaurants +JACS,Jackson Acquisition Company II Class A Ordinary Shares,$10.50,0.03,0.287%,0.00,,2025,102,, +JAGX,Jaguar Health Inc. Common Stock,$0.6755,-0.0296,-4.198%,2523564.00,United States,2015,821040,Health Care,Biotechnology: Pharmaceutical Preparations +JAKK,JAKKS Pacific Inc. Common Stock,$18.69,-0.28,-1.476%,210627497.00,United States,1996,120709,Consumer Discretionary,Recreational Games/Products/Toys +JAMF,Jamf Holding Corp. Common Stock,$12.99,-0.02,-0.154%,1730559664.00,United States,2020,1012151,Technology,Computer Software: Prepackaged Software +JANX,Janux Therapeutics Inc. Common Stock,$13.95,-0.78,-5.295%,839061908.00,United States,2021,1129359,Health Care,Biotechnology: Pharmaceutical Preparations +JAZZ,Jazz Pharmaceuticals plc Common Stock (Ireland),$165.41,-2.44,-1.454%,10051157838.00,Ireland,2007,893293,Health Care,Biotechnology: Pharmaceutical Preparations +JBDI,JBDI Holdings Limited Ordinary Shares,$0.5949,-0.0256,-4.126%,11320390.00,Singapore,2024,21613,, +JBGS,JBG SMITH Properties Common Shares ,$16.43,-0.42,-2.493%,972348726.00,United States,2017,675312,Real Estate,Real Estate Investment Trusts +JBHT,J.B. Hunt Transport Services Inc. Common Stock,$205.06,2.18,1.075%,19525474031.00,United States,,987487,Industrials,Trucking Freight/Courier Services +JBI,Janus International Group Inc. Common Stock,$6.85,-0.04,-0.581%,950953935.00,United States,2021,839563,Industrials,Building Products +JBIO,Jade Biosciences Inc. Common Stock,$15.64,-0.41,-2.555%,771276231.00,United States,2021,130751,Health Care,Biotechnology: Pharmaceutical Preparations +JBL,Jabil Inc. Common Stock,$243.62,1.34,0.553%,25725118947.00,United States,1993,1016756,Technology,Electrical Products +JBLU,JetBlue Airways Corporation Common Stock,$5.04,0.31,6.554%,1833102029.00,United States,2002,27103082,Consumer Discretionary,Air Freight/Delivery Services +JBS,JBS N.V. Class A Common Shares,$15.46,-0.14,-0.897%,12587779375.00,,2025,5170479,Consumer Staples,Meat/Poultry/Fish +JBSS,John B. Sanfilippo & Son Inc. Common Stock,$74.14,-0.27,-0.363%,863305362.00,United States,1991,40985,Consumer Staples,Specialty Foods +JBTM,JBT Marel Corporation Common Stock,$157.45,2.36,1.522%,8182892521.00,United States,,484811,Industrials,Industrial Machinery/Components +JCAP,Jefferson Capital Inc. Common Stock,$21.54,-0.97,-4.309%,1392889593.00,United States,2025,302731,Finance,Finance Companies +JCE,Nuveen Core Equity Alpha Fund Common Shares of Beneficial Interest,$16.14,-0.05,-0.309%,0.00,United States,2007,34530,Finance,Trusts Except Educational Religious and Charitable +JCI,Johnson Controls International plc Ordinary Share,$116.74,-0.22,-0.188%,71452608888.00,Switzerland,,3656634,Industrials,Industrial Machinery/Components +JCSE,JE Cleantech Holdings Limited Ordinary Shares,$1.65,0.07,4.43%,8679429.00,Singapore,2022,75560,Consumer Discretionary,Miscellaneous manufacturing industries +JCTC,Jewett-Cameron Trading Company Common Shares,$2.03,-0.04,-1.932%,7145829.00,United States,,4472,Consumer Discretionary,RETAIL: Building Materials +JD,JD.com Inc. American Depositary Shares,$29.23,-0.27,-0.915%,42479797446.00,China,2014,8432289,Consumer Discretionary,Other Specialty Stores +JDZG,JIADE LIMITED Class A Ordinary Shares,$1.52,0.04,2.703%,5121163.00,China,2024,82209,Real Estate,Other Consumer Services +JEF,Jefferies Financial Group Inc. Common Stock,$61.85,-0.38,-0.611%,12758436308.00,United States,,1655217,Finance,Investment Bankers/Brokers/Service +JELD,JELD-WEN Holding Inc. Common Stock,$2.71,-0.07,-2.518%,231514514.00,United States,2017,1301557,Basic Materials,Forest Products +JEM,707 Cayman Holdings Limited Ordinary Shares,$0.1815,-0.0092,-4.824%,3500111.00,China,2025,978204,Consumer Discretionary,Clothing/Shoe/Accessory Stores +JF,J and Friends Holdings Limited American Depositary Shares,$0.9507,-0.0145,-1.502%,15161726.00,China,2018,38190,Technology,Computer Software: Programming Data Processing +JFB,JFB Construction Holdings Class A Common Stock,$25.42,-1.485,-5.519%,787202442.00,United States,2025,36965,Consumer Discretionary,General Bldg Contractors - Nonresidential Bldgs +JFBR,Jeffs' Brands Ltd Ordinary Shares,$0.60,-0.0191,-3.085%,2972092.00,Israel,2022,4136130,Consumer Discretionary,Other Specialty Stores +JFBRW,Jeffs' Brands Ltd Warrant,$0.0199,-0.0007,-3.398%,98574.00,Israel,2022,23006,Consumer Discretionary,Other Specialty Stores +JFIN,Jiayin Group Inc. American Depositary Shares,$6.97,-0.17,-2.381%,371985736.00,China,2019,65345,Finance,Finance: Consumer Services +JFR,Nuveen Floating Rate Income Fund Common Stock,$7.90,-0.02,-0.253%,0.00,United States,2004,552390,Finance,Trusts Except Educational Religious and Charitable +JFU,9F Inc. American Depositary Shares,$5.6762,-0.2938,-4.921%,66827793.00,China,2019,3861,Finance,Finance: Consumer Services +JG,Aurora Mobile Limited American Depositary Shares,$7.01,-0.65,-8.486%,42593819.00,China,2018,9502,Technology,Computer Software: Programming Data Processing +JGH,Nuveen Global High Income Fund Common Shares of Beneficial Interest,$12.86,0.02,0.156%,0.00,United States,2014,84469,Finance,Investment Managers +JHG,Janus Henderson Group plc Ordinary Shares,$48.05,-0.03,-0.062%,7422591404.00,United Kingdom,2017,925059,Finance,Investment Managers +JHI,John Hancock Investors Trust Common Stock,$13.73,0.00,0.00%,120062630.00,United States,,14236,Finance,Trusts Except Educational Religious and Charitable +JHS,John Hancock Income Securities Trust Common Stock,$11.74,-0.02,-0.17%,136730908.00,United States,,9508,Finance,Finance Companies +JHX,James Hardie Industries plc. Ordinary Shares,$23.97,0.05,0.209%,13980262800.00,Ireland,2025,4968418,Industrials,Building Materials +JILL,J. Jill Inc. Common Stock,$15.52,-0.24,-1.523%,234590279.00,United States,2017,69258,Consumer Discretionary,Apparel +JJSF,J & J Snack Foods Corp. Common Stock,$93.63,-0.58,-0.616%,1781624504.00,United States,1986,237238,Consumer Staples,Specialty Foods +JKHY,Jack Henry & Associates Inc. Common Stock,$179.81,0.85,0.475%,13014132105.00,United States,1985,1191930,Technology,EDP Services +JKS,JinkoSolar Holding Company Limited American Depositary Shares (each representing 4 Common Shares),$27.27,-0.59,-2.118%,1439060398.00,China,2010,436536,Technology,Semiconductors +JL,J-Long Group Limited Class A Ordinary Shares,$3.57,0.01,0.281%,13429273.00,Hong Kong,2024,3532,Consumer Discretionary,Clothing/Shoe/Accessory Stores +JLHL,Julong Holding Limited Class A Ordinary Shares,$4.20,0.04,0.962%,89296754.00,China,2025,5353,Consumer Discretionary,Military/Government/Technical +JLL,Jones Lang LaSalle Incorporated Common Stock,$356.37,0.34,0.095%,16818750293.00,United States,,294554,Finance,Real Estate +JLS,Nuveen Mortgage and Income Fund,$18.495,-0.045,-0.243%,0.00,United States,2009,15153,Finance,Investment Managers +JMIA,Jumia Technologies AG American Depositary Shares each representing two Ordinary Shares,$12.89,0.20,1.576%,1578545814.00,,2019,1961659,Consumer Discretionary,Catalog/Specialty Distribution +JMM,Nuveen Multi-Market Income Fund (MA),$6.13,-0.04,-0.648%,0.00,United States,,1465,Finance,Trusts Except Educational Religious and Charitable +JMSB,John Marshall Bancorp Inc. Common Stock,$20.00,0.02,0.10%,283510800.00,United States,,30541,Finance,Major Banks +JNJ,Johnson & Johnson Common Stock,$227.72,3.28,1.461%,548644680627.00,United States,,9026495,Health Care,Biotechnology: Pharmaceutical Preparations +JOB,GEE Group Inc. Common Stock,$0.243,-0.0097,-3.839%,26731390.00,United States,1968,320617,Consumer Discretionary,Diversified Commercial Services +JOBY,Joby Aviation Inc. Common Stock,$13.37,-0.10,-0.742%,12190541023.00,United States,2020,15649125,Industrials,Aerospace +JOE,St. Joe Company (The) Common Stock,$64.65,-0.05,-0.077%,3733183865.00,United States,,128628,Real Estate,Homebuilding +JOF,Japan Smaller Capitalization Fund Inc Common Stock,$11.55,-0.12,-1.028%,0.00,United States,1990,48816,Finance,Trusts Except Educational Religious and Charitable +JOUT,Johnson Outdoors Inc. Class A Common Stock,$44.43,-1.16,-2.544%,464429189.00,United States,,39330,Consumer Discretionary,Recreational Games/Products/Toys +JOYY,JOYY Inc. American Depositary Shares,$67.19,-1.375,-2.005%,3475200642.00,Singapore,2012,297919,Technology,EDP Services +JPC,Nuveen Preferred & Income Opportunities Fund,$8.14,-0.01,-0.123%,0.00,United States,2003,605070,Finance,Investment Managers +JPM,JP Morgan Chase & Co. Common Stock,$300.77,0.46,0.153%,818774830467.00,United States,,9556743,Finance,Major Banks +JPM^C,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of 6.00% Non-Cumulative Preferred Stock Series EE,$25.50,0.01,0.039%,,United States,,79348,, +JPM^D,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of 5.75% Non-Cumulative Preferred Stock Series DD,$25.29,-0.04,-0.158%,,United States,,65051,, +JPM^J,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of JPMorgan Chase & Co. 4.75% Non-Cumulative Preferred Stock Series GG,$20.6901,-0.0899,-0.433%,,United States,,36491,, +JPM^K,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of 4.55% Non-Cumulative Preferred Stock Series JJ,$19.86,-0.09,-0.451%,,United States,,59185,, +JPM^L,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of 4.625% Non-Cumulative Preferred Stock Series LL,$20.18,-0.07,-0.346%,,United States,,118949,, +JPM^M,J P Morgan Chase & Co Depositary Shares each representing a 1/400th interest in a share of 4.20% Non-Cumulative Preferred Stock Series MM,$18.80,-0.10,-0.529%,,United States,,142337,, +JQC,Nuveen Credit Strategies Income Fund Shares of Beneficial Interest,$5.13,0.01,0.195%,0.00,United States,2003,550415,Finance,Finance Companies +JRI,Nuveen Real Asset Income and Growth Fund Common Shares of Beneficial Interest,$12.99,-0.69,-5.044%,0.00,United States,2012,1653235,Finance,Finance Companies +JRS,Nuveen Real Estate Income Fund Common Shares of Beneficial Interest,$7.6092,-0.0708,-0.922%,0.00,United States,2001,50132,Finance,Finance/Investors Services +JRSH,Jerash Holdings (US) Inc. Common Stock,$3.09,0.00,0.00%,39242815.00,United States,2018,52544,Consumer Discretionary,Apparel +JRVR,James River Group Holdings Inc. Common Stock,$6.62,0.04,0.608%,304293854.00,Bermuda,2014,287080,Finance,Property-Casualty Insurers +JSM,Navient Corporation 6% Senior Notes due December 15 2043,$19.5714,-0.2586,-1.304%,1946004617.00,United States,,24582,Finance,Investment Bankers/Brokers/Service +JSPR,Jasper Therapeutics Inc. Common Stock,$1.59,-0.05,-3.049%,44494622.00,United States,2020,800118,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +JSPRW,Japer Therapeutics Inc. Warrants,$0.0278,0.0075,36.946%,777956.00,United States,2020,21042,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +JTAI,Jet.AI Inc. Common Stock,$0.255,0.0138,5.721%,9730408.00,United States,2021,23945564,Consumer Discretionary,Transportation Services +JUNS,Jupiter Neurosciences Inc. Common Stock,$0.6308,-0.1941,-23.53%,21716145.00,United States,2024,11580412,Health Care,Biotechnology: Pharmaceutical Preparations +JVA,Coffee Holding Co. Inc. Common Stock,$3.76,-0.06,-1.571%,21464332.00,United States,2005,64976,Consumer Staples,Packaged Foods +JWEL,Jowell Global Ltd. Ordinary Shares,$2.15,0.02,0.939%,4666521.00,China,2021,4179,Consumer Discretionary,Other Consumer Services +JXG,JX Luxventure Group Inc. Common Stock,$4.09,-0.11,-2.619%,7634484.00,China,2013,7926,Consumer Staples,Apparel +JXN,Jackson Financial Inc. Class A Common Stock ,$115.98,0.66,0.572%,7883144595.00,United States,2021,397037,Finance,Life Insurance +JXN^A,Jackson Financial Inc. Depositary Shares each representing a 1/1000th interest in a share of Fixed-Rate Reset Noncumulative Perpetual Preferred Stock Series A,$26.15,0.02,0.077%,,United States,,26302,, +JYD,Jayud Global Logistics Limited Class A Ordinary Shares,$3.50,-0.11,-3.047%,9568542.00,China,2023,26795,Industrials,Integrated Freight & Logistics +JYNT,The Joint Corp. Common Stock,$9.58,-0.15,-1.542%,142418119.00,United States,2014,42623,Miscellaneous,Multi-Sector Companies +JZ,Jianzhi Education Technology Group Company Limited American Depositary Shs,$0.7425,-0.0574,-7.176%,2092736.00,China,2022,23093,Real Estate,Other Consumer Services +JZXN,Jiuzi Holdings Inc. Ordinary Shares,$1.58,-0.12,-7.059%,2099569.00,China,2021,307009,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +KAI,Kadant Inc Common Stock,$316.26,-3.68,-1.15%,3724952975.00,United States,1992,60959,Industrials,Industrial Machinery/Components +KALA,KALA BIO Inc. Common Stock,$0.5795,-0.0145,-2.441%,16138916.00,United States,2017,425598,Health Care,Biotechnology: Pharmaceutical Preparations +KALU,Kaiser Aluminum Corporation Common Stock,$123.31,0.30,0.244%,1998393304.00,United States,,153414,Industrials,Metal Fabrications +KALV,KalVista Pharmaceuticals Inc. Common Stock,$15.14,0.20,1.339%,765270876.00,United Kingdom,2015,870690,Health Care,Biotechnology: Pharmaceutical Preparations +KAPA,Kairos Pharma Ltd. Common Stock,$0.675,-0.0361,-5.077%,14054413.00,,2024,403294,Health Care,Biotechnology: Pharmaceutical Preparations +KARO,Karooooo Ltd. Ordinary Shares,$50.35,0.05,0.099%,1555477655.00,Singapore,2021,20695,Technology,Computer Software: Prepackaged Software +KB,KB Financial Group Inc,$96.81,-3.07,-3.074%,36168285606.00,South Korea,,255633,Finance,Commercial Banks +KBDC,Kayne Anderson BDC Inc. Common Stock,$14.09,-0.29,-2.017%,963696132.00,,2024,266298,, +KBH,KB Home Common Stock,$57.95,0.39,0.678%,3660910757.00,United States,1986,1264255,Consumer Discretionary,Homebuilding +KBON,Karbon Capital Partners Corp. Class A Ordinary Shares,$10.02,-0.01,-0.10%,0.00,United States,2026,37192,Finance,Blank Checks +KBONU,Karbon Capital Partners Corp. Units,$10.19,0.00,0.00%,0.00,United States,2025,28206,Finance,Blank Checks +KBONW,Karbon Capital Partners Corp. Warrant,$0.75,0.00,0.00%,0.00,United States,2026,3070,Finance,Blank Checks +KBR,KBR Inc. Common Stock,$43.16,0.01,0.023%,5480872344.00,United States,2006,767629,Industrials,Military/Government/Technical +KBSX,FST Corp. Ordinary Shares,$1.19,-0.05,-4.032%,53271544.00,Taiwan,,26074,Consumer Discretionary,Recreational Games/Products/Toys +KC,Kingsoft Cloud Holdings Limited American Depositary Shares,$14.80,0.29,1.999%,4028347664.00,China,2020,1165904,Technology,Computer Software: Prepackaged Software +KCHV,Kochav Defense Acquisition Corp. Class A Ordinary Shares,$10.20,0.00,0.00%,0.00,United States,2025,37,, +KD,Kyndryl Holdings Inc. Common Stock,$23.70,-0.13,-0.546%,5416975024.00,United States,2021,2059814,Technology,EDP Services +KDK,Kodiak AI Inc. Common Stock ,$9.49,-0.01,-0.105%,1719658150.00,United States,,312880,Technology,EDP Services +KDKRW,Kodiak AI Inc. Warrants,$1.55,0.02,1.307%,280871458.00,United States,,235558,Technology,EDP Services +KDP,Keurig Dr Pepper Inc. Common Stock,$26.71,-0.88,-3.19%,36287755269.00,United States,,12373147,Consumer Staples,Beverages (Production/Distribution) +KE,Kimball Electronics Inc. Common Stock,$29.05,-0.63,-2.123%,707029445.00,United States,,121781,Technology,Electrical Products +KELYA,Kelly Services Inc. Class A Common Stock,$9.94,-0.16,-1.584%,351269720.00,United States,,358541,Consumer Discretionary,Professional Services +KELYB,Kelly Services Inc. Class B Common Stock,$13.76,0.00,0.00%,486264723.00,United States,,343,Consumer Discretionary,Professional Services +KEN,Kenon Holdings Ltd. Ordinary Shares,$72.00,-3.65,-4.825%,3754817424.00,Singapore,2015,21779,Utilities,Electric Utilities: Central +KEP,Korea Electric Power Corporation Common Stock,$21.67,0.20,0.932%,27822723097.00,South Korea,1994,1356272,Utilities,Electric Utilities: Central +KEQU,Kewaunee Scientific Corporation Common Stock,$39.46,0.64,1.649%,113107513.00,United States,,9504,Industrials,Medical Specialities +KEX,Kirby Corporation Common Stock,$128.13,-0.36,-0.28%,6944646000.00,United States,,1122650,Consumer Discretionary,Marine Transportation +KEY,KeyCorp Common Stock,$21.31,-0.15,-0.699%,23290116442.00,United States,,19721506,Finance,Major Banks +KEY^I,KeyCorp Depositary Shares Each Representing a 1/40th Ownership Interest in a Share of Fixed-to-Floating Rate Perpetual Non-Cumulative Preferred Stock Series E,$25.0808,0.0208,0.083%,,United States,,16019,, +KEY^J,KeyCorp Depositary Shares each representing a 1/40th ownership interest in a share of Fixed Rate Perpetual Non-Cumulative Preferred Stock Series F,$22.00,-0.08,-0.362%,,United States,,19809,, +KEY^K,KeyCorp Depositary Shares each representing a 1/40th ownership interest in a share of Fixed Rate Perpetual Non-Cumulative Preferred Stock Series G,$21.9801,-0.2099,-0.946%,,United States,,22029,, +KEY^L,KeyCorp Depositary Shares each representing a 1/40th ownership interest in a share of Fixed Rate Perpetual Non-Cumulative Preferred Stock Series H,$25.25,0.08,0.318%,,United States,,24940,, +KEYS,Keysight Technologies Inc. Common Stock,$221.50,3.68,1.689%,37991183840.00,United States,2014,1458300,Industrials,Industrial Machinery/Components +KF,Korea Fund Inc. (The) New Common Stock,$46.75,0.61,1.322%,0.00,United States,,14659,Finance,Investment Managers +KFFB,Kentucky First Federal Bancorp Common Stock,$4.69,0.19,4.222%,37926693.00,United States,2005,1364,Finance,Savings Institutions +KFII,K&F Growth Acquisition Corp. II Class A Ordinary shares,$10.36,-0.0001,-0.001%,0.00,United States,2025,25000,, +KFIIR,K&F Growth Acquisition Corp. II Rights,$0.175,0.00,0.00%,0.00,United States,2025,12,, +KFRC,Kforce Inc. Common Stock,$32.53,-1.58,-4.632%,590126730.00,United States,1995,146710,Consumer Discretionary,Professional Services +KFS,Kingsway Financial Services Inc. Common Stock (DE),$13.26,-0.09,-0.674%,383958576.00,Canada,,67604,Finance,Property-Casualty Insurers +KFY,Korn Ferry Common Stock,$66.35,-1.42,-2.095%,3463134534.00,United States,1999,334859,Consumer Discretionary,Diversified Commercial Services +KG,Kestrel Group Ltd.,$10.12,-0.38,-3.619%,78348463.00,Bermuda,2008,4783,Finance,Property-Casualty Insurers +KGC,Kinross Gold Corporation Common Stock,$38.07,0.20,0.528%,45954297000.00,Canada,2001,13973350,Basic Materials,Precious Metals +KGEI,Kolibri Global Energy Inc. Common stock,$3.84,-0.13,-3.275%,135847039.00,United States,,133033,Energy,Oil & Gas Production +KGS,Kodiak Gas Services Inc. Common Stock,$40.50,-0.76,-1.842%,3510696330.00,United States,2023,1451338,Utilities,Natural Gas Distribution +KHC,The Kraft Heinz Company Common Stock,$23.19,-0.51,-2.152%,27450925776.00,United States,,14190485,Consumer Staples,Packaged Foods +KIDS,OrthoPediatrics Corp. Common Stock,$17.32,-0.42,-2.368%,434339356.00,United States,2017,139497,Health Care,Medical/Dental Instruments +KIDZ,Classover Holdings Inc. Class B Common Stock,$0.1875,-0.0138,-6.855%,5255350.00,United States,,671191,Real Estate,Other Consumer Services +KIDZW,Classover Holdings Inc. Warrants,$0.0131,-0.0011,-7.746%,367174.00,United States,,37223,Real Estate,Other Consumer Services +KIM,Kimco Realty Corporation (HC) Common Stock,$20.48,-0.46,-2.197%,13868956099.00,United States,,5565422,Real Estate,Real Estate Investment Trusts +KIM^L,Kimco Realty Corporation Class L Depositary Shares each of which represents a one-one thousandth fractional interest in a share of 5.125% Class L Cumulative Redeemable Preferred Stock liquidation preference $25000.00 per share,$20.30,-0.06,-0.295%,,United States,,11266,, +KIM^M,Kimco Realty Corporation Class M Depositary Shares each of which represents a one-one thousandth fractional interest in a share of 5.25% Class M Cumulative Redeemable Preferred Stock liquidation preference $25000.00 per share,$20.75,-0.15,-0.718%,,United States,,20095,, +KIM^N,Kimco Realty Corporation Depositary Shares each representing 1/1000th interest in a share of 7.25% Class N Cumulative Convertible Perpetual Preferred Stock,$57.50,0.00,0.00%,,United States,,9,, +KINS,Kingstone Companies Inc. Common Stock,$14.96,-0.17,-1.124%,211645523.00,United States,,126536,Finance,Property-Casualty Insurers +KIO,KKR Income Opportunities Fund Common Shares,$11.56,0.03,0.26%,0.00,United States,2013,244028,Finance,Investment Managers +KITT,Nauticus Robotics Inc. Common stock,$1.18,-0.18,-13.235%,33105516.00,United States,2021,5613062,Industrials,Industrial Machinery/Components +KITTW,Nauticus Robotics Inc. Warrant,$0.1152,-0.0048,-4.00%,3231996.00,United States,2021,204356,Industrials,Industrial Machinery/Components +KKR,KKR & Co. Inc. Common Stock,$116.77,0.77,0.664%,104083337686.00,United States,,4604478,Finance,Investment Managers +KKR^D,KKR & Co. Inc. 6.25% Series D Mandatory Convertible Preferred Stock,$49.45,0.21,0.426%,,United States,,116576,, +KKRS,KKR Group Finance Co. IX LLC 4.625% Subordinated Notes due 2061,$17.48,-0.07,-0.399%,15580857607.00,United States,2021,91698,Finance,Investment Managers +KKRT,KKR & Co. Inc. 6.875% Subordinated Notes due 2065,$25.63,0.00,0.00%,0.00,United States,2025,26098,Finance,Investment Managers +KLAC,KLA Corporation Common Stock,$1627.20,10.87,0.673%,213801612394.00,United States,1980,1091527,Technology,Electronic Components +KLAR,Klarna Group plc Ordinary Shares,$25.50,-0.37,-1.43%,18333201974.00,,2025,2791701,Finance,Finance: Consumer Services +KLC,KinderCare Learning Companies Inc. Common Stock,$4.40,0.00,0.00%,520601638.00,United States,2024,1952430,Consumer Discretionary,Other Consumer Services +KLIC,Kulicke and Soffa Industries Inc. Common Stock,$58.34,0.20,0.344%,3053084817.00,Singapore,,554708,Technology,Semiconductors +KLRS,Kalaris Therapeutics Inc. Common Stock,$9.45,-0.16,-1.665%,176737850.00,United States,2020,76266,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KLTO,Klotho Neurosciences Inc. Common Stock,$0.293,-0.017,-5.484%,21546260.00,United States,2022,922606,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KLTOW,Klotho Neurosciences Inc. Warrant,$0.0951,0.00,0.00%,6993342.00,United States,2022,16782,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KLTR,Kaltura Inc. Common Stock,$1.59,0.03,1.923%,248571310.00,United States,2021,489984,Technology,Computer Software: Prepackaged Software +KLXE,KLX Energy Services Holdings Inc. Common Stock,$3.27,0.32,10.847%,58330669.00,United States,,953689,Energy,Oilfield Services/Equipment +KMB,Kimberly-Clark Corporation Common Stock,$99.54,-1.10,-1.093%,33036640767.00,United States,,6779214,Consumer Discretionary,Containers/Packaging +KMDA,Kamada Ltd. Ordinary Shares,$8.64,-0.23,-2.593%,496843468.00,Israel,2013,76747,Health Care,Biotechnology: Pharmaceutical Preparations +KMI,Kinder Morgan Inc. Common Stock,$30.07,0.48,1.622%,66898544927.00,United States,2011,17467304,Utilities,Natural Gas Distribution +KMPB,Kemper Corporation 5.875% Fixed-Rate Reset Junior Subordinated Debentures due 2062,$23.7416,0.0016,0.007%,1389996131.00,United States,2022,16848,Finance,Property-Casualty Insurers +KMPR,Kemper Corporation,$38.38,-0.04,-0.104%,2247028487.00,United States,,915489,Finance,Property-Casualty Insurers +KMRK,K-Tech Solutions Company Limited Class A Ordinary Shares,$1.74,0.17,10.828%,36714000.00,Hong Kong,2025,149843,Consumer Discretionary,Recreational Games/Products/Toys +KMT,Kennametal Inc. Common Stock,$34.29,-0.25,-0.724%,2609233633.00,United States,,841395,Industrials,Industrial Machinery/Components +KMTS,Kestra Medical Technologies Ltd. Common Stock,$25.21,-0.65,-2.514%,1470979626.00,United States,2025,226048,Health Care,Medical/Dental Instruments +KMX,CarMax Inc,$46.96,0.62,1.338%,6658770261.00,United States,,3259889,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +KN,Knowles Corporation Common Stock,$24.32,0.09,0.371%,2070893819.00,United States,2014,649800,Consumer Staples,Consumer Electronics/Appliances +KNDI,Kandi Technologies Group Inc. Ordinary Shares,$1.02,-0.03,-2.857%,89105399.00,China,,69071,Industrials,Auto Manufacturing +KNF,Knife Riv Holding Co. Common Stock,$68.94,0.35,0.51%,3906427535.00,United States,2023,505087,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +KNOP,KNOT Offshore Partners LP Common Units representing Limited Partner Interests,$10.65,-0.31,-2.828%,362580113.00,United Kingdom,2013,74369,Consumer Discretionary,Marine Transportation +KNRX,KNOREX LTD. Class A Ordinary Shares,$1.35,0.14,11.57%,41071203.00,,2025,174410,Technology,Computer Software: Programming Data Processing +KNSA,Kiniksa Pharmaceuticals International plc Class A Ordinary Shares,$43.28,-1.36,-3.047%,3280440450.00,United States,2018,713968,Health Care,Biotechnology: Pharmaceutical Preparations +KNSL,Kinsale Capital Group Inc. Common Stock,$389.74,3.07,0.794%,9066687649.00,United States,,118933,Finance,Property-Casualty Insurers +KNTK,Kinetik Holdings Inc. Class A Common Stock,$40.65,1.19,3.016%,6568432120.00,United States,2022,1384908,Utilities,Natural Gas Distribution +KNX,Knight-Swift Transportation Holdings Inc.,$55.57,0.67,1.22%,9021178230.00,United States,2017,2461618,Industrials,Trucking Freight/Courier Services +KO,Coca-Cola Company (The) Common Stock,$73.06,-0.49,-0.666%,314275542216.00,United States,,14633680,Consumer Staples,Beverages (Production/Distribution) +KOD,Kodiak Sciences Inc Common Stock,$26.07,1.54,6.278%,1563029014.00,United States,2018,814334,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KODK,Eastman Kodak Company Common New,$7.39,-0.13,-1.729%,712396000.00,United States,,510891,Consumer Discretionary,Industrial Machinery/Components +KOF,Coca Cola Femsa S.A.B. de C.V. American Depositary Shares each representing 10 Units (each Unit consists of 3 Series B Shares and 5 Series L Shares),$107.02,-1.56,-1.437%,22483106847.00,Mexico,1993,312723,Consumer Staples,Beverages (Production/Distribution) +KOP,Koppers Holdings Inc. Common Stock,$29.24,0.12,0.412%,573511196.00,United States,2006,91703,Basic Materials,Forest Products +KOPN,Kopin Corporation Common Stock,$2.66,-0.09,-3.273%,491449973.00,United States,1992,2886999,Technology,Semiconductors +KORE,KORE Group Holdings Inc. Common Stock,$4.88,-0.01,-0.204%,85594893.00,United States,,44235,Telecommunications,Telecommunications Equipment +KOS,Kosmos Energy Ltd. Common Shares (DE),$1.52,0.14,10.145%,727056970.00,Bermuda,2011,17509037,Energy,Oil & Gas Production +KOSS,Koss Corporation Common Stock,$4.35,-0.04,-0.911%,41135505.00,United States,,15975,Consumer Staples,Consumer Electronics/Appliances +KOYN,CSLM Digital Asset Acquisition Corp III Class A Ordinary Shares,$10.02,0.00,0.00%,0.00,United States,2025,7794,, +KOYNU,CSLM Digital Asset Acquisition Corp III Units,$10.17,0.01,0.098%,0.00,United States,2025,100,, +KOYNW,CSLM Digital Asset Acquisition Corp III Warrants,$0.31,0.01,3.333%,0.00,United States,2025,172,, +KPLT,Katapult Holdings Inc. Common Stock,$6.56,-0.04,-0.606%,30460271.00,United States,2019,27269,Consumer Discretionary,Diversified Commercial Services +KPLTW,Katapult Holdings Inc. Warrant,$0.0039,0.0005,14.706%,18109.00,United States,2019,22595,Consumer Discretionary,Diversified Commercial Services +KPRX,Kiora Pharmaceuticals Inc. Common Stock,$2.14,0.05,2.392%,7870781.00,United States,,35425,Health Care,Biotechnology: Pharmaceutical Preparations +KPTI,Karyopharm Therapeutics Inc. Common Stock,$6.92,-0.13,-1.844%,126707158.00,United States,2013,304312,Health Care,Biotechnology: Pharmaceutical Preparations +KR,Kroger Company (The) Common Stock,$61.82,-0.29,-0.467%,39122735071.00,United States,,5658199,Consumer Staples,Food Chains +KRAQU,KRAKacquisition Corp Unit,$10.10,0.10,1.00%,0.00,United States,2026,10036352,, +KRC,Kilroy Realty Corporation Common Stock,$34.33,-0.67,-1.914%,4061434750.00,United States,1997,1814023,Real Estate,Real Estate Investment Trusts +KREF,KKR Real Estate Finance Trust Inc. Common Stock,$8.40,0.20,2.439%,550104912.00,United States,2017,1193885,Real Estate,Real Estate Investment Trusts +KREF^A,KKR Real Estate Finance Trust Inc. 6.50% Series A Cumulative Redeemable Preferred Stock,$18.28,-0.08,-0.436%,,United States,,15458,, +KRG,Kite Realty Group Trust Common Stock,$22.68,-0.41,-1.776%,4910355468.00,United States,2004,1555869,Real Estate,Real Estate Investment Trusts +KRKR,36Kr Holdings Inc. American Depositary Shares,$4.36,-0.41,-8.595%,171851331.00,China,2019,16133,Real Estate,Real Estate +KRMD,KORU Medical Systems Inc. Common Stock (DE),$5.52,-0.16,-2.817%,255701056.00,United States,,100798,Health Care,Medical/Dental Instruments +KRMN,Karman Holdings Inc. Common Stock,$115.29,1.95,1.72%,15255453531.00,United States,2025,1951136,Industrials,Military/Government/Technical +KRNT,Kornit Digital Ltd. Ordinary Shares,$12.96,0.03,0.232%,587444439.00,Israel,2015,531269,Industrials,Industrial Machinery/Components +KRNY,Kearny Financial Corp Common Stock,$7.60,-0.06,-0.783%,492017548.00,United States,2005,381028,Finance,Savings Institutions +KRO,Kronos Worldwide Inc Common Stock,$5.42,-0.04,-0.733%,623587889.00,United States,,207771,Basic Materials,Major Chemicals +KROS,Keros Therapeutics Inc. Common Stock,$17.83,-0.47,-2.568%,543210010.00,United States,2020,246094,Health Care,Biotechnology: Pharmaceutical Preparations +KRP,Kimbell Royalty Partners Common Units Representing Limited Partner Interests,$13.30,0.09,0.681%,1434910772.00,United States,2017,424314,Energy,Oil & Gas Production +KRRO,Korro Bio Inc. Common Stock,$11.69,0.95,8.845%,110088179.00,United States,2019,502655,Health Care,Biotechnology: Pharmaceutical Preparations +KRSP,Rice Acquisition Corporation 3 Class A Ordinary Shares,$10.39,-0.01,-0.096%,0.00,,2025,503448,, +KRT,Karat Packaging Inc. Common Stock,$23.87,-0.31,-1.282%,479775184.00,United States,2021,44333,Industrials,Plastic Products +KRUS,Kura Sushi USA Inc. Class A Common Stock,$68.05,-0.65,-0.946%,824186010.00,United States,2019,228695,Consumer Discretionary,Restaurants +KRYS,Krystal Biotech Inc. Common Stock,$272.91,-4.45,-1.604%,7913712910.00,United States,2017,260023,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KSCP,Knightscope Inc. Class A Common Stock,$3.70,-0.14,-3.646%,42582789.00,United States,2022,518948,Telecommunications,Telecommunications Equipment +KSPI,Joint Stock Company Kaspi.kz American Depository Shares,$80.46,2.16,2.759%,15233770594.00,Kazakhstan,2024,411350,, +KSS,Kohl's Corporation Common Stock,$17.22,-0.57,-3.204%,1931897869.00,United States,1992,3249402,Consumer Discretionary,Department/Specialty Retail Stores +KT,KT Corporation Common Stock,$20.72,0.06,0.29%,10187317282.00,South Korea,,1468870,Telecommunications,Telecommunications Equipment +KTB,Kontoor Brands Inc. Common Stock ,$57.48,-1.40,-2.378%,3195520818.00,United States,2019,561657,Industrials,Garments and Clothing +KTCC,Key Tronic Corporation Common Stock,$2.88,0.12,4.348%,31274695.00,United States,1983,14207,Technology,Electrical Products +KTF,DWS Municipal Income Trust,$9.08,0.04,0.442%,358668517.00,United States,1988,42509,Finance,Finance Companies +KTH,Structures Products Cp 8% CorTS Issued by Peco Energy Cap Tr II Preferred Stock,$28.809,-0.0273,-0.095%,0.00,United States,,839,Finance,Finance: Consumer Services +KTN,Structured Products Corp 8.205% CorTS 8.205% Corporate Backed Trust Securities (CorTS),$25.68,0.00,0.00%,0.00,United States,,1089,Finance,Finance: Consumer Services +KTOS,Kratos Defense & Security Solutions Inc. Common Stock,$112.67,-5.39,-4.565%,19023282570.00,United States,,3758876,Industrials,Military/Government/Technical +KTTA,Pasithea Therapeutics Corp. Common Stock,$0.8529,0.0062,0.732%,19694367.00,United States,2021,130700,Health Care,Biotechnology: Pharmaceutical Preparations +KTTAW,Pasithea Therapeutics Corp. Warrant,$0.0126,-0.0019,-13.103%,290947.00,United States,2021,1395,Health Care,Biotechnology: Pharmaceutical Preparations +KULR,KULR Technology Group Inc. Common Stock,$3.89,-0.13,-3.234%,177703085.00,United States,,1428412,Technology,Electrical Products +KURA,Kura Oncology Inc. Common Stock,$8.04,-0.43,-5.077%,699620845.00,United States,,1194435,Health Care,Biotechnology: Pharmaceutical Preparations +KUST,Kustom Entertainment Inc. Common Stock,$2.10,-0.01,-0.474%,1682113.00,United States,,11534200,Technology,Radio And Television Broadcasting And Communications Equipment +KVAC,Keen Vision Acquisition Corporation Ordinary Shares,$11.96,0.14,1.184%,0.00,United States,2023,8714,, +KVACW,Keen Vision Acquisition Corporation Warrant,$0.0799,0.0199,33.167%,0.00,United States,2023,117485,, +KVHI,KVH Industries Inc. Common Stock,$6.89,0.10,1.473%,134859699.00,United States,1996,70101,Technology,Radio And Television Broadcasting And Communications Equipment +KVUE,Kenvue Inc. Common Stock,$17.34,-0.16,-0.914%,33220009628.00,United States,2023,56730798,Consumer Discretionary,Specialty Chemicals +KVYO,Klaviyo Inc. Series A Common Stock,$25.73,0.31,1.22%,7769052054.00,United States,2023,1654143,Technology,Computer Software: Prepackaged Software +KW,Kennedy-Wilson Holdings Inc. Common Stock,$9.79,-0.04,-0.407%,1350084017.00,United States,,1237630,Finance,Real Estate +KWM,K Wave Media Ltd. Ordinary Shares,$0.8055,0.0205,2.611%,60814665.00,Cayman Islands,,108517,Consumer Discretionary,Movies/Entertainment +KWMWW,K Wave Media Ltd. Warrant,$0.0748,0.0088,13.333%,5647346.00,Cayman Islands,,2925,Consumer Discretionary,Movies/Entertainment +KWR,Quaker Houghton Common Stock,$151.26,1.00,0.666%,2622853694.00,United States,,75905,Industrials,Major Chemicals +KXIN,Kaixin Holdings Ordinary Shares,$13.70,0.43,3.24%,12950254.00,China,2017,9815185,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +KYIV,Kyivstar Group Ltd. Common Shares,$12.01,-0.58,-4.607%,2864747126.00,United Arab Emirates,,1918309,Telecommunications,Telecommunications Equipment +KYIVW,Kyivstar Group Ltd. Warrant,$3.36,-0.05,-1.466%,801461311.00,United Arab Emirates,,83814,Telecommunications,Telecommunications Equipment +KYMR,Kymera Therapeutics Inc. Common Stock,$71.16,-0.99,-1.372%,5603221942.00,United States,2020,963002,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KYN,Kayne Anderson Energy Infrastructure Fund Inc.,$13.01,0.25,1.959%,1771071205.00,United States,2004,304133,Finance,Finance/Investors Services +KYNB,Kyntra Bio Inc. Common Stock,$8.765,0.335,3.974%,35458325.00,United States,2014,20730,Health Care,Biotechnology: Pharmaceutical Preparations +KYTX,Kyverna Therapeutics Inc. Common Stock,$8.38,-0.90,-9.698%,478727780.00,United States,2024,1308183,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +KZIA,Kazia Therapeutics Limited American Depositary Shares,$6.56,-0.59,-8.252%,74364101.00,Australia,,233215,Health Care,Biotechnology: Pharmaceutical Preparations +KZR,Kezar Life Sciences Inc. Common Stock,$6.15,-0.08,-1.284%,45037409.00,United States,2018,45066,Health Care,Biotechnology: Pharmaceutical Preparations +L,Loews Corporation Common Stock,$102.81,0.51,0.499%,21246670083.00,United States,,523480,Finance,Property-Casualty Insurers +LAB,Standard BioTools Inc. Common Stock,$1.43,-0.05,-3.378%,549928542.00,United States,2011,1067520,Industrials,Biotechnology: Laboratory Analytical Instruments +LAC,Lithium Americas Corp. Common Shares,$6.01,-0.27,-4.299%,1823964611.00,Canada,2023,20175773,Basic Materials,Metal Mining +LAD,Lithia Motors Inc. Common Stock,$329.37,2.20,0.672%,7987232381.00,United States,,270364,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +LADR,Ladder Capital Corp Class A Common Stock,$11.08,-0.06,-0.539%,1410721001.00,United States,2014,522129,Real Estate,Real Estate Investment Trusts +LAES,SEALSQ Corp Ordinary Shares,$4.59,-0.17,-3.571%,814270576.00,Switzerland,,6630029,Technology,Semiconductors +LAFA,LaFayette Acquisition Corp. Ordinary Share,$10.00,0.01,0.10%,0.00,France,2025,16942,, +LAFAR,LaFayette Acquisition Corp. Rights,$0.15,0.01,7.143%,0.00,France,2025,600,, +LAFAU,LaFayette Acquisition Corp. Unit,$10.13,0.03,0.297%,0.00,France,2025,5950,, +LAKE,Lakeland Industries Inc. Common Stock,$9.03,-0.08,-0.878%,88549336.00,United States,1986,93930,Health Care,Industrial Specialties +LAMR,Lamar Advertising Company Class A Common Stock,$127.12,-1.05,-0.819%,12875181656.00,United States,1996,324444,Real Estate,Real Estate Investment Trusts +LAND,Gladstone Land Corporation Common Stock,$9.75,-0.03,-0.307%,363351622.00,United States,2013,719618,Real Estate,Real Estate Investment Trusts +LANDM,Gladstone Land Corporation 5.00% Series D Cumulative Term Preferred Stock,$25.07,0.01,0.04%,934279503.00,United States,,8711,Real Estate,Real Estate Investment Trusts +LANDO,Gladstone Land Corporation 6.00% Series B Cumulative Redeemable Preferred Stock,$19.8514,0.1714,0.871%,739798809.00,United States,,9827,Real Estate,Real Estate Investment Trusts +LANDP,Gladstone Land Corporation 6.00% Series C Cumulative Redeemable Preferred Stock,$19.5899,0.0899,0.461%,730053532.00,United States,,10512,Real Estate,Real Estate Investment Trusts +LANV,Lanvin Group Holdings Limited Ordinary Shares,$1.55,0.11,7.639%,216652496.00,Cayman Islands,2022,27047,Consumer Discretionary,Apparel +LAR,Lithium Argentina AG Common Shares,$8.01,-0.44,-5.207%,1300023000.00,Canada,2023,4794221,Basic Materials,Metal Mining +LARK,Landmark Bancorp Inc. Common Stock,$26.40,-0.58,-2.15%,160359698.00,United States,,4354,Finance,Major Banks +LASE,Laser Photonics Corporation Common Stock,$2.14,0.02,0.943%,48738937.00,United States,2022,468763,Miscellaneous,Industrial Machinery/Components +LASR,nLIGHT Inc. Common Stock,$45.98,1.055,2.348%,2335140602.00,United States,2018,878576,Technology,Semiconductors +LATA,Galata Acquisition Corp. II Class A Ordinary Shares,$10.08,0.00,0.00%,0.00,United States,2025,11,Finance,Blank Checks +LAUR,Laureate Education Inc. Common Stock,$34.17,-0.06,-0.175%,5035604266.00,United States,2017,1543137,Real Estate,Other Consumer Services +LAW,CS Disco Inc. Common Stock,$6.40,-0.07,-1.082%,399946202.00,United States,2021,140422,Technology,Computer Software: Prepackaged Software +LAZ,Lazard Inc. Common Stock,$52.61,-0.16,-0.303%,5931598942.00,Bermuda,2005,1545417,Finance,Investment Managers +LB,LandBridge Company LLC Class A Shares Representing Limited Liability Company Interests,$58.56,2.14,3.793%,4514338574.00,,2024,1047828,Energy,Oil & Gas Production +LBGJ,Li Bang International Corporation Inc. Class A Ordinary Shares,$0.8183,0.1066,14.978%,15341488.00,China,2024,79658,Industrials,Industrial Machinery/Components +LBRDA,Liberty Broadband Corporation Class A Common Stock,$42.51,0.11,0.259%,6099742173.00,United States,,218836,Telecommunications,Cable & Other Pay Television Services +LBRDK,Liberty Broadband Corporation Class C Common Stock,$42.57,0.01,0.023%,6108351548.00,United States,,1426509,Telecommunications,Cable & Other Pay Television Services +LBRDP,Liberty Broadband Corporation Series A Cumulative Redeemable Preferred Stock,$24.06,0.06,0.25%,3452359367.00,United States,,5076,Telecommunications,Cable & Other Pay Television Services +LBRT,Liberty Energy Inc. Class A common stock,$21.80,-0.38,-1.713%,3530879554.00,United States,2018,4641457,Energy,Oilfield Services/Equipment +LBRX,LB Pharmaceuticals Inc Common Stock,$21.24,-1.29,-5.726%,537352926.00,United States,2025,120232,Health Care,Biotechnology: Pharmaceutical Preparations +LBTYA,Liberty Global Ltd. Class A Common Shares,$10.72,-0.05,-0.464%,3610271309.00,United Kingdom,,1496516,Telecommunications,Cable & Other Pay Television Services +LBTYB,Liberty Global Ltd. Class B Common Shares,$10.78,0.00,0.00%,3630478051.00,United Kingdom,,438,Telecommunications,Cable & Other Pay Television Services +LBTYK,Liberty Global Ltd. Class C Common Shares,$10.74,-0.09,-0.831%,3617006890.00,United Kingdom,,651605,Telecommunications,Cable & Other Pay Television Services +LC,LendingClub Corporation Common Stock,$19.57,-1.24,-5.959%,2256449181.00,United States,2014,5117380,Finance,Finance: Consumer Services +LCCC,Lakeshore Acquisition III Corp. Ordinary Shares,$10.23,-0.02,-0.195%,0.00,United States,2025,132,Finance,Blank Checks +LCCCR,Lakeshore Acquisition III Corp. Rights,$0.2279,0.00,0.00%,0.00,United States,2025,56,Finance,Blank Checks +LCFY,Locafy Limited Ordinary Share,$3.14,-0.12,-3.681%,5649033.00,Australia,2022,28231,Technology,Computer Software: Programming Data Processing +LCFYW,Locafy Limited Warrant,$2.80,0.00,0.00%,5037354.00,Australia,2022,11,Technology,Computer Software: Programming Data Processing +LCID,Lucid Group Inc. Common Stock,$10.91,-0.09,-0.818%,3536677866.00,United States,,10419489,Industrials,Auto Manufacturing +LCII,LCI Industries,$147.82,-0.23,-0.155%,3576949838.00,United States,1995,323926,Consumer Discretionary,Auto Parts:O.E.M. +LCNB,LCNB Corporation Common Stock,$16.84,-0.17,-0.999%,238903102.00,United States,,19759,Finance,Major Banks +LCTX,Lineage Cell Therapeutics Inc. Common Stock,$1.58,-0.05,-3.067%,363917508.00,United States,,1132217,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +LCUT,Lifetime Brands Inc. Common Stock,$3.61,-0.14,-3.733%,81788124.00,United States,1991,19332,Consumer Discretionary,Industrial Machinery/Components +LDI,loanDepot Inc. Class A Common Stock,$2.37,-0.07,-2.869%,789769140.00,United States,2021,2474666,Finance,Finance: Consumer Services +LDOS,Leidos Holdings Inc. Common Stock,$187.77,0.62,0.331%,24007365646.00,United States,,599002,Technology,EDP Services +LDP,Cohen & Steers Limited Duration Preferred and Income Fund Inc.,$21.17,-0.05,-0.236%,0.00,United States,2012,90616,Finance,Finance Companies +LDWY,Lendway Inc. Common Stock (DE),$4.76,0.44,10.185%,8440046.00,United States,,95046,Consumer Staples,Farming/Seeds/Milling +LE,Lands' End Inc. Common Stock,$17.56,-1.59,-8.303%,536476754.00,United States,,484468,Consumer Discretionary,Clothing/Shoe/Accessory Stores +LEA,Lear Corporation Common Stock,$119.33,-1.21,-1.004%,6189667505.00,United States,,466827,Consumer Discretionary,Auto Parts:O.E.M. +LECO,Lincoln Electric Holdings Inc. Common Shares,$256.87,0.10,0.039%,14134573829.00,United States,,221276,Industrials,Industrial Machinery/Components +LEDS,SemiLEDS Corporation Common Stock,$1.86,0.00,0.00%,15300645.00,Taiwan,2010,10445,Technology,Semiconductors +LEE,Lee Enterprises Incorporated Common Stock,$5.41,-0.19,-3.393%,33778201.00,United States,,86774,Consumer Discretionary,Newspapers/Magazines +LEG,Leggett & Platt Incorporated Common Stock,$11.71,-0.19,-1.597%,1585958862.00,United States,,993271,Consumer Discretionary,Home Furnishings +LEGH,Legacy Housing Corporation Common Stock (TX),$20.75,-0.34,-1.612%,495276085.00,United States,2018,93644,Consumer Discretionary,Homebuilding +LEGN,Legend Biotech Corporation American Depositary Shares,$17.85,-0.42,-2.299%,3278137470.00,United States,2020,3145644,Health Care,Biotechnology: Pharmaceutical Preparations +LEGT,Legato Merger Corp. III Ordinary Shares,$10.88,-0.01,-0.092%,0.00,,2024,17542,, +LEN,Lennar Corporation Class A Common Stock,$110.79,0.72,0.654%,28253725959.00,United States,,2328918,Consumer Discretionary,Homebuilding +LENZ,LENZ Therapeutics Inc. Common Stock,$18.65,-0.74,-3.816%,583557922.00,United States,2021,624699,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +LEO,BNY Mellon Strategic Municipals Inc. Common Stock,$6.47,0.09,1.411%,403021825.00,United States,1987,231727,Finance,Trusts Except Educational Religious and Charitable +LESL,Leslie's Inc. Common Stock,$1.55,-0.18,-10.405%,14439754.00,United States,2020,154923,Consumer Discretionary,Other Specialty Stores +LEU,Centrus Energy Corp. Class A Common Stock,$337.76,28.37,9.17%,6151295928.00,United States,2014,1844278,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +LEVI,Levi Strauss & Co Class A Common Stock,$20.47,-0.78,-3.671%,8000281011.00,United States,2019,4019172,Consumer Discretionary,Apparel +LEXX,Lexaria Bioscience Corp. Common Stock,$0.764,-0.0139,-1.787%,19014009.00,Canada,,108859,Health Care,Biotechnology: Pharmaceutical Preparations +LFAC,Leapfrog Acquisition Corporation Class A Ordinary Shares,$9.89,0.01,0.101%,0.00,United States,2026,32900,Finance,Blank Checks +LFACU,Leapfrog Acquisition Corporation Units,$10.12,0.10,0.998%,0.00,United States,2025,25607,, +LFACW,Leapfrog Acquisition Corporation Warrants,$0.48,0.18,60.00%,0.00,United States,2026,153375,Finance,Blank Checks +LFCR,Lifecore Biomedical Inc. Common Stock,$8.56,-0.11,-1.269%,320711973.00,United States,,144966,Health Care,Biotechnology: Pharmaceutical Preparations +LFMD,LifeMD Inc. Common Stock,$3.40,-0.10,-2.857%,163662009.00,United States,,737632,Health Care,Medical/Nursing Services +LFMDP,LifeMD Inc. 8.875% Series A Cumulative Perpetual Preferred Stock,$22.85,0.10,0.44%,1099904972.00,United States,,657,Health Care,Medical/Nursing Services +LFS,LEIFRAS Co. Ltd. American Depositary Shares ,$2.81,-0.16,-5.387%,73511339.00,Japan,2025,43904,Consumer Discretionary,Other Consumer Services +LFST,LifeStance Health Group Inc. Common Stock,$7.10,0.00,0.00%,2761901995.00,United States,2021,1718065,Health Care,Medical/Nursing Services +LFT,Lument Finance Trust Inc. Common Stock,$1.34,-0.02,-1.471%,70169006.00,United States,2013,155828,Real Estate,Real Estate Investment Trusts +LFT^A,Lument Finance Trust Inc. 7.875% Series A Cumulative Redeemable Preferred Stock,$20.576,0.00,0.00%,,United States,,15,, +LFUS,Littelfuse Inc. Common Stock,$314.25,18.08,6.105%,7825355140.00,United States,,488347,Energy,Electrical Products +LFVN,Lifevantage Corporation Common Stock (Delaware),$5.79,-0.16,-2.689%,73539873.00,United States,,104120,Health Care,Biotechnology: Pharmaceutical Preparations +LFWD,Lifeward Ltd. Ordinary Shares,$0.6558,-0.0042,-0.636%,11997058.00,Israel,2014,132197,Health Care,Industrial Specialties +LGCB,Linkage Global Inc. Class A Ordinary Shares,$1.50,0.07,4.895%,16748283.00,Japan,2023,24382,Consumer Discretionary,Catalog/Specialty Distribution +LGCL,Lucas GC Limited Ordinary Shares,$2.2354,0.0754,3.491%,6237718.00,China,2024,17255,Technology,Computer Software: Programming Data Processing +LGCY,Legacy Education Inc. Common Stock,$10.06,0.23,2.34%,126423899.00,,2024,36562,Real Estate,Other Consumer Services +LGHL,Lion Group Holding Ltd. American Depositary Share,$1.625,0.125,8.333%,1549758.00,China,,145792,Finance,Investment Bankers/Brokers/Service +LGI,Lazard Global Total Return and Income Fund Common Stock,$18.25,-0.07,-0.382%,0.00,United States,2004,32345,, +LGIH,LGI Homes Inc. Common Stock,$49.88,-0.26,-0.519%,1151185508.00,United States,2013,242685,Consumer Discretionary,Homebuilding +LGL,LGL Group Inc. (The) Common Stock,$7.20,0.02,0.279%,39827066.00,United States,1946,14432,Technology,Industrial Machinery/Components +LGN,Legence Corp. Class A Common stock,$51.22,1.28,2.563%,5395357503.00,United States,2025,828671,Consumer Discretionary,Engineering & Construction +LGND,Ligand Pharmaceuticals Incorporated Common Stock,$190.22,-5.27,-2.696%,3743856778.00,United States,,175451,Health Care,Biotechnology: Pharmaceutical Preparations +LGO,Largo Inc. Common Shares,$1.34,0.01,0.752%,111639420.00,Canada,,1174831,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +LGPS,LogProstyle Inc. Common Shares,$0.9136,0.00,0.00%,21608568.00,,2025,16772,Consumer Discretionary,Homebuilding +LGVN,Longeveron Inc. Class A Common Stock,$0.5941,0.0146,2.519%,12673865.00,United States,2021,112411,Health Care,Biotechnology: Pharmaceutical Preparations +LH,Labcorp Holdings Inc. Common Stock,$268.04,-3.08,-1.136%,22220516000.00,United States,,900132,Health Care,Medical Specialities +LHAI,Linkhome Holdings Inc. Common stock,$1.44,-0.18,-11.111%,23371200.00,United States,2025,327365,Finance,Real Estate +LHSW,Lianhe Sowell International Group Ltd Class A Ordinary Shares,$0.7115,-0.1185,-14.277%,36998000.00,China,2025,195023,Technology,Computer Software: Prepackaged Software +LHX,L3Harris Technologies Inc. Common Stock,$360.30,-0.24,-0.067%,67395140774.00,United States,,1482625,Industrials,Industrial Machinery/Components +LI,Li Auto Inc. American Depositary Shares,$17.15,0.40,2.388%,18149179511.00,China,2020,3971886,Industrials,Auto Manufacturing +LICN,Lichen International Limited Class A Ordinary Shares,$2.95,-0.15,-4.839%,48164134.00,China,2023,25619,Consumer Discretionary,Professional Services +LIDR,AEye Inc. Class A Common Stock,$1.83,-0.06,-3.175%,82450645.00,United States,2021,537466,Consumer Discretionary,Auto Parts:O.E.M. +LIDRW,AEye Inc. Warrant,$0.0799,-0.0057,-6.659%,3599894.00,United States,2021,77082,Consumer Discretionary,Auto Parts:O.E.M. +LIEN,Chicago Atlantic BDC Inc. Common Stock,$10.71,0.14,1.325%,244408519.00,United States,2022,85811,Finance,Finance: Consumer Services +LIF,Life360 Inc. Common Stock,$62.28,0.59,0.956%,4882784261.00,United States,2024,1039048,Technology,EDP Services +LII,Lennox International Inc. Common Stock,$487.49,-11.31,-2.267%,17097630497.00,United States,1999,1184450,Industrials,Industrial Machinery/Components +LILA,Liberty Latin America Ltd. Class A Common Stock,$7.32,-0.18,-2.40%,1465464000.00,United States,,365936,Telecommunications,Cable & Other Pay Television Services +LILAK,Liberty Latin America Ltd. Class C Common Stock,$7.36,-0.22,-2.902%,1473472000.00,United States,,733011,Telecommunications,Cable & Other Pay Television Services +LIMN,Liminatus Pharma Inc. Class A Common Stock,$0.61,-0.0446,-6.813%,16509426.00,United States,,109415,, +LIMNW,Liminatus Pharma Inc. Warrants,$0.03,-0.0076,-20.213%,0.00,United States,,2293,, +LIN,Linde plc Ordinary Shares,$451.50,-1.53,-0.338%,210827441895.00,United States,,2281310,Basic Materials,Major Chemicals +LINC,Lincoln Educational Services Corporation Common Stock,$26.27,0.25,0.961%,830757095.00,United States,2005,207815,Real Estate,Other Consumer Services +LIND,Lindblad Expeditions Holdings Inc. Common Stock,$16.24,0.10,0.62%,899708066.00,United States,2013,894897,Consumer Discretionary,Transportation Services +LINE,Lineage Inc. Common Stock,$36.00,-0.19,-0.525%,8218426500.00,United States,2024,1735631,Real Estate,Real Estate Investment Trusts +LINK,Interlink Electronics Inc. Common Stock,$3.77,0.10,2.725%,59377526.00,United States,,29897,Technology,Computer peripheral equipment +LION,Lionsgate Studios Corp Common Shares,$9.59,0.02,0.209%,2778504121.00,,2025,1142551,Consumer Discretionary,Movies/Entertainment +LIQT,LiqTech International Inc. Common Stock,$1.93,0.163,9.225%,18580234.00,Denmark,,3833,Technology,Industrial Machinery/Components +LITB,LightInTheBox Holding Co. Ltd. American Depositary Shares each representing twelve ordinary shares,$2.612,0.012,0.462%,288193406.00,China,,10446,Consumer Discretionary,Catalog/Specialty Distribution +LITE,Lumentum Holdings Inc. Common Stock,$385.00,14.34,3.869%,27296500000.00,United States,,4356802,Telecommunications,Telecommunications Equipment +LITM,Snow Lake Resources Ltd. Common Shares,$3.78,0.39,11.504%,68139297.00,Canada,2021,1264647,Basic Materials,Other Metals and Minerals +LITS,Lite Strategy Inc. Common Stock,$1.31,-0.01,-0.758%,48168277.00,United States,2003,341027,Health Care,Biotechnology: Pharmaceutical Preparations +LIVE,Live Ventures Incorporated Common Stock,$20.35,-0.74,-3.509%,62508200.00,United States,,5069,Consumer Discretionary,Other Specialty Stores +LIVN,LivaNova PLC Ordinary Shares,$63.91,-0.18,-0.281%,3489839231.00,United Kingdom,,506921,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +LIXT,Lixte Biotechnology Holdings Inc. Common Stock,$3.71,0.29,8.48%,31639166.00,United States,,185148,Health Care,Biotechnology: Pharmaceutical Preparations +LKFN,Lakeland Financial Corporation Common Stock,$58.13,-1.89,-3.149%,1483985191.00,United States,,163151,Finance,Major Banks +LKQ,LKQ Corporation Common Stock,$32.57,-0.73,-2.192%,8336812815.00,United States,2003,2916434,Consumer Discretionary,Motor Vehicles +LKSP,Lake Superior Acquisition Corp. Class A Ordinary Shares,$10.00,0.00,0.00%,0.00,United States,2025,1236,, +LKSPU,Lake Superior Acquisition Corp. Units,$10.21,0.00,0.00%,0.00,United States,2025,683,, +LLY,Eli Lilly and Company Common Stock,$1023.80,-15.71,-1.511%,967883890417.00,United States,,3300244,Health Care,Biotechnology: Pharmaceutical Preparations +LLYVA,Liberty Live Holdings Inc. Series A Liberty Live Group Common Stock,$82.41,-0.59,-0.711%,7573479000.00,United States,,228462,Consumer Discretionary,Services-Misc. Amusement & Recreation +LLYVK,Liberty Live Holdings Inc. Series C Liberty Live Group Common Stock,$84.79,-0.36,-0.423%,7792201000.00,United States,,417683,Consumer Discretionary,Services-Misc. Amusement & Recreation +LMAT,LeMaitre Vascular Inc. Common Stock,$85.06,-0.27,-0.316%,1929670650.00,United States,2006,117656,Health Care,Medical/Dental Instruments +LMB,Limbach Holdings Inc. Common Stock,$81.72,-2.29,-2.726%,950143240.00,United States,,102191,Consumer Discretionary,Engineering & Construction +LMFA,LM Funding America Inc. Common Stock,$0.419,-0.0032,-0.758%,5917745.00,United States,2015,220146,Finance,Finance: Consumer Services +LMND,Lemonade Inc. Common Stock,$92.06,4.31,4.912%,6879738346.00,United States,2020,1884891,Finance,Property-Casualty Insurers +LMNR,Limoneira Co Common Stock,$14.15,0.07,0.497%,256385506.00,United States,,52868,Consumer Staples,Farming/Seeds/Milling +LMRI,Lumexa Imaging Holdings Inc. Common Stock,$13.45,-0.38,-2.748%,1271908019.00,United States,2025,632284,Health Care,Medical Specialities +LMT,Lockheed Martin Corporation Common Stock,$597.27,2.32,0.39%,138206961617.00,United States,,1323994,Industrials,Military/Government/Technical +LNAI,Lunai Bioworks Inc. Common Stock,$0.7991,-0.0399,-4.756%,25862159.00,United States,,290698,Health Care,Biotechnology: Pharmaceutical Preparations +LNC,Lincoln National Corporation Common Stock,$40.91,0.04,0.098%,7770406536.00,United States,,1322644,Finance,Life Insurance +LNC^D,Lincoln National Corporation Depositary Shares Each Representing a 1/1000th Interest in a Share of 9.000% Non-Cumulative Preferred Stock Series D,$26.89,-0.03,-0.111%,,United States,,20671,, +LND,Brasilagro Brazilian Agric Real Estate Co Sponsored ADR (Brazil),$4.13,-0.07,-1.667%,424082624.00,Brazil,,64182,Consumer Staples,Farming/Seeds/Milling +LNG,Cheniere Energy Inc. Common Stock,$208.04,2.31,1.123%,44777442799.00,United States,2001,2020818,Utilities,Oil/Gas Transmission +LNKB,LINKBANCORP Inc. Common Stock,$8.46,-0.07,-0.821%,316874782.00,United States,,74671,Finance,Major Banks +LNKS,Linkers Industries Limited Class A Ordinary Shares,$0.7697,0.2897,60.354%,10340920.00,Malaysia,2024,22928100,Technology,Electrical Products +LNN,Lindsay Corporation Common Stock,$123.59,-1.03,-0.827%,1292092542.00,United States,,66510,Industrials,Industrial Machinery/Components +LNSR,LENSAR Inc. Common Stock,$12.48,0.00,0.00%,149067934.00,United States,,17692,Health Care,Medical/Dental Instruments +LNT,Alliant Energy Corporation Common Stock,$66.26,-0.93,-1.384%,17032377433.00,United States,,3204556,Utilities,Power Generation +LNTH,Lantheus Holdings Inc. Common Stock,$66.31,-1.575,-2.32%,4397134065.00,United States,2015,707329,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +LNZA,LanzaTech Global Inc. Common Stock,$11.915,0.05,0.421%,27645374.00,United States,2021,6428,Industrials,Major Chemicals +LNZAW,LanzaTech Global Inc. Warrant,$0.0136,0.0015,12.397%,31555.00,United States,2021,18149,Industrials,Major Chemicals +LOAN,Manhattan Bridge Capital Inc,$4.54,-0.01,-0.22%,51931476.00,United States,,18446,Real Estate,Real Estate Investment Trusts +LOAR,Loar Holdings Inc. Common Stock,$68.97,-1.79,-2.53%,6457141825.00,United States,2024,601573,Industrials,Military/Government/Technical +LOB,Live Oak Bancshares Inc. Common Stock,$38.31,-0.44,-1.135%,1756805307.00,United States,2022,328268,Finance,Major Banks +LOB^A,Live Oak Bancshares Inc. Depositary Shares Each Representing a 1/40th Interest in a Share of 8.375% Fixed Rate Series A Non-Cumulative Perpetual Preferred Stock,$25.85,-0.10,-0.385%,,United States,,12100,, +LOBO,LOBO TECHNOLOGIES LTD. Class A Ordinary Shares,$0.6595,0.0495,8.115%,8337890.00,China,2024,73810,Consumer Discretionary,Motor Vehicles +LOCL,Local Bounti Corporation Common Stock,$2.2699,0.0099,0.438%,63619929.00,,2021,3595,Consumer Staples,Farming/Seeds/Milling +LOCO,El Pollo Loco Holdings Inc. Common Stock,$10.22,-0.34,-3.22%,306139436.00,United States,2014,331398,Consumer Discretionary,Restaurants +LODE,Comstock Inc. Common Stock,$3.53,-0.07,-1.944%,180962792.00,United States,,2297991,Industrials,Major Chemicals +LOGI,Logitech International S.A. Ordinary Shares,$86.64,-7.10,-7.574%,12723747922.00,United States,1997,5404033,Technology,Computer peripheral equipment +LOKV,Live Oak Acquisition Corp. V Class A Ordinary Shares,$10.31,0.00,0.00%,0.00,United States,2025,37457,, +LOKVW,Live Oak Acquisition Corp. V Warrants,$1.75,-0.10,-5.405%,0.00,United States,2025,114318,, +LOMA,Loma Negra Compania Industrial Argentina Sociedad Anonima ADS,$12.05,-0.31,-2.508%,1406194392.00,Argentina,2017,361364,Industrials,Building Materials +LONA,LeonaBio Inc. Common Stock,$4.85,-0.51,-9.515%,45279178.00,United States,2020,49627,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +LOOP,Loop Industries Inc. Common Stock,$1.13,0.01,0.893%,54621437.00,Canada,,19413,Industrials,Major Chemicals +LOPE,Grand Canyon Education Inc. Common Stock,$174.93,0.84,0.483%,4892525507.00,United States,2008,232715,Real Estate,Other Consumer Services +LOT,Lotus Technology Inc. American Depositary Shares,$1.28,-0.01,-0.775%,868152753.00,China,,148424,Industrials,Auto Manufacturing +LOTWW,Lotus Technology Inc. Warrants,$0.075,-0.0023,-2.975%,50868325.00,China,,1104,Industrials,Auto Manufacturing +LOVE,The Lovesac Company Common Stock,$13.53,-0.55,-3.906%,197769444.00,United States,2018,317028,Consumer Discretionary,Other Specialty Stores +LOW,Lowe's Companies Inc. Common Stock,$269.42,-4.52,-1.65%,151131541545.00,United States,,2952407,Consumer Discretionary,RETAIL: Building Materials +LPA,Logistic Properties of the Americas Ordinary Shares,$2.87,-0.12,-4.013%,104936461.00,,2024,7850,Finance,Real Estate +LPAA,Launch One Acquisition Corp. Class A Ordinary shares,$10.65,0.0132,0.124%,0.00,United States,2024,254,, +LPAAW,Launch One Acquisition Corp. Warrant,$0.25,0.00,0.00%,0.00,United States,2024,1,Finance,Blank Checks +LPBB,Launch Two Acquisition Corp. Class A Ordinary Shares,$10.53,-0.01,-0.095%,0.00,United States,2024,5798,, +LPBBW,Launch Two Acquisition Corp. Warrant,$0.3449,0.0924,36.594%,0.00,United States,2024,1900,, +LPCN,Lipocine Inc. Common Stock,$9.46,-0.92,-8.863%,52521267.00,United States,,251601,Health Care,Biotechnology: Pharmaceutical Preparations +LPCVU,Launchpad Cadenza Acquisition Corp I Unit,$10.02,0.0053,0.053%,0.00,United States,2025,658,Finance,Blank Checks +LPG,Dorian LPG Ltd. Common Stock,$28.93,1.00,3.58%,1239306638.00,United States,2014,569179,Consumer Discretionary,Marine Transportation +LPL,LG Display Co Ltd AMERICAN DEPOSITORY SHARES,$3.97,-0.39,-8.945%,3970000000.00,South Korea,2004,1741934,Technology,Industrial Machinery/Components +LPLA,LPL Financial Holdings Inc. Common Stock,$366.90,1.85,0.507%,29365803512.00,United States,2010,747294,Finance,Investment Bankers/Brokers/Service +LPRO,Open Lending Corporation Common Stock,$1.85,-0.05,-2.632%,218650470.00,United States,,375912,Finance,Finance: Consumer Services +LPSN,LivePerson Inc. Common Stock,$3.19,0.03,0.949%,37823887.00,United States,2000,186854,Technology,Computer Software: Prepackaged Software +LPTH,LightPath Technologies Inc. Class A Common Stock,$11.28,0.03,0.267%,601000397.00,United States,1996,2543285,Technology,Semiconductors +LPX,Louisiana-Pacific Corporation Common Stock,$88.43,0.42,0.477%,6158571256.00,United States,,855090,Basic Materials,Forest Products +LQDA,Liquidia Corporation Common Stock,$41.91,-0.565,-1.33%,3645980693.00,United States,2018,1385205,Health Care,Biotechnology: Pharmaceutical Preparations +LQDT,Liquidity Services Inc. Common Stock,$31.71,-0.29,-0.906%,976844434.00,United States,2006,120045,Real Estate,Real Estate +LRCX,Lam Research Corporation Common Stock,$239.58,1.12,0.47%,300919667400.00,United States,1984,15630573,Technology,Industrial Machinery/Components +LRE,Lead Real Estate Co. Ltd American Depositary Shares,$1.45,-0.03,-2.027%,19780755.00,Japan,2023,7569,Consumer Discretionary,Homebuilding +LRHC,La Rosa Holdings Corp. Common Stock,$3.16,-0.23,-6.785%,513604.00,United States,2023,105639,Finance,Real Estate +LRMR,Larimar Therapeutics Inc. Common Stock,$3.68,0.01,0.272%,314972643.00,United States,2014,1307423,Health Care,Biotechnology: Pharmaceutical Preparations +LRN,Stride Inc. Common Stock,$82.75,10.32,14.248%,3629301384.00,United States,,6859279,Real Estate,Other Consumer Services +LSAK,Lesaka Technologies Inc. Common Stock,$4.69,0.03,0.644%,394365211.00,South Africa,,121911,Finance,Investment Bankers/Brokers/Service +LSBK,Lake Shore Bancorp Inc. Common Stock,$15.34,-0.16,-1.032%,120043185.00,United States,2006,2823,Finance,Savings Institutions +LSCC,Lattice Semiconductor Corporation Common Stock,$84.84,-0.12,-0.141%,11604957667.00,United States,,2227227,Technology,Semiconductors +LSE,Leishen Energy Holding Co. Ltd. Ordinary Shares,$4.58,-0.52,-10.196%,77974500.00,China,2024,9315,Consumer Discretionary,Oil and Gas Field Machinery +LSF,Laird Superfood Inc. Common Stock,$3.30,0.04,1.227%,35265542.00,,2020,75224,Consumer Staples,Packaged Foods +LSH,Lakeside Holding Limited Common Stock,$1.0435,-0.1565,-13.042%,35925158.00,United States,2024,40867,, +LSPD,Lightspeed Commerce Inc. Subordinate Voting Shares,$11.45,-0.19,-1.632%,1556958210.00,Canada,,492350,Technology,Computer Software: Prepackaged Software +LSTA,Lisata Therapeutics Inc. Common Stock,$4.58,0.01,0.219%,40398957.00,United States,,181441,Health Care,Misc Health and Biotechnology Services +LSTR,Landstar System Inc. Common Stock,$153.51,1.83,1.206%,5272255204.00,United States,1993,893746,Industrials,Trucking Freight/Courier Services +LTBR,Lightbridge Corporation Common Stock,$17.78,0.71,4.159%,579792749.00,United States,,848189,Consumer Discretionary,Professional Services +LTC,LTC Properties Inc. Common Stock,$35.25,-0.75,-2.083%,1678400268.00,United States,,374909,Real Estate,Real Estate Investment Trusts +LTH,Life Time Group Holdings Inc. Common Stock,$28.96,-0.33,-1.127%,6386034412.00,United States,2021,1763280,Consumer Discretionary,Hotels/Resorts +LTM,LATAM Airlines Group S.A. American Depositary Shares (each representing two thousand (2000) shares of Common Stock),$66.13,-0.33,-0.497%,19985738436.00,Chile,2024,868240,Consumer Discretionary,Air Freight/Delivery Services +LTRN,Lantern Pharma Inc. Common Stock,$3.17,-0.14,-4.23%,35454621.00,United States,2020,37774,Health Care,Biotechnology: Pharmaceutical Preparations +LTRX,Lantronix Inc. Common Stock,$7.16,0.27,3.919%,281807648.00,United States,2000,8071891,Telecommunications,Computer Communications Equipment +LTRYW,Lottery.com Inc. Warrants,$0.0114,0.0033,40.741%,132933.00,United States,2023,146079,Technology,Computer Software: Prepackaged Software +LU,Lufax Holding Ltd American Depositary Shares each representing two (2) Ordinary Shares,$2.67,-0.02,-0.743%,2313928800.00,China,,1382520,Finance,Finance: Consumer Services +LUCD,Lucid Diagnostics Inc. Common Stock,$1.16,-0.06,-4.918%,159712282.00,United States,2021,967167,Health Care,Medical/Dental Instruments +LUCK,Lucky Strike Entertainment Corporation Class A Common Stock,$8.17,-0.48,-5.549%,1140830965.00,United States,2021,137024,Consumer Discretionary,Services-Misc. Amusement & Recreation +LUCY,Innovative Eyewear Inc. Common Stock,$1.19,-0.11,-8.462%,6366718.00,United States,2022,270829,Health Care,Ophthalmic Goods +LUCYW,Innovative Eyewear Inc. Series A Warrants 8/16/27,$0.071,-0.004,-5.333%,379863.00,United States,2022,9795,Health Care,Ophthalmic Goods +LUD,Luda Technology Group Limited Ordinary Shares,$8.7484,0.2784,3.287%,198501196.00,,2025,11741,Industrials,Steel/Iron Ore +LULU,lululemon athletica inc. Common Stock,$180.35,-6.04,-3.241%,20233473894.00,Canada,2007,2872061,Consumer Discretionary,Apparel +LUMN,Lumen Technologies Inc. Common Stock,$9.16,-0.13,-1.399%,9394896658.00,United States,,12671668,Telecommunications,Telecommunications Equipment +LUNG,Pulmonx Corporation Common Stock,$1.76,0.01,0.571%,72594780.00,United States,2020,248093,Health Care,Medical/Dental Instruments +LUNR,Intuitive Machines Inc. Class A Common Stock,$22.81,2.52,12.42%,4635221834.00,United States,2021,16888765,Industrials,Industrial Machinery/Components +LUV,Southwest Airlines Company Common Stock,$40.86,-0.48,-1.161%,21130956569.00,United States,,10626332,Consumer Discretionary,Air Freight/Delivery Services +LUXE,LuxExperience B.V. American Depositary Shares each representing one Ordinary Share,$8.07,-0.30,-3.584%,1100540246.00,,2021,113663,Consumer Discretionary,Catalog/Specialty Distribution +LVLU,Lulu's Fashion Lounge Holdings Inc. Common Stock,$16.94,-2.13,-11.169%,46955071.00,United States,2021,53757,Consumer Discretionary,Catalog/Specialty Distribution +LVO,LiveOne Inc. Common Stock,$4.63,0.16,3.579%,53842844.00,United States,,39766,Consumer Discretionary,Restaurants +LVRO,Lavoro Limited Class A Ordinary Shares,$1.12,-0.05,-4.274%,128346889.00,Brazil,,29438,Consumer Discretionary,Other Specialty Stores +LVS,Las Vegas Sands Corp. Common Stock,$61.26,0.91,1.508%,41419998674.00,United States,2004,11044735,Consumer Discretionary,Hotels/Resorts +LVWR,LiveWire Group Inc. Common Stock,$2.28,-0.25,-9.881%,465094318.00,United States,2022,58676,Consumer Discretionary,Motor Vehicles +LW,Lamb Weston Holdings Inc. Common Stock ,$45.47,0.42,0.932%,6314868325.00,United States,2016,2973710,Consumer Staples,Packaged Foods +LWACU,LightWave Acquisition Corp. Units,$10.20,0.00,0.00%,0.00,United States,2025,8,Finance,Blank Checks +LWACW,LightWave Acquisition Corp. Warrants,$0.3299,0.0299,9.967%,0.00,United States,2025,43765,Finance,Blank Checks +LWAY,Lifeway Foods Inc. Common Stock,$21.65,-0.37,-1.68%,329702719.00,United States,,45813,Consumer Staples,Packaged Foods +LWLG,Lightwave Logic Inc. Common Stock,$3.60,0.01,0.279%,481550249.00,United States,,2552393,Industrials,Containers/Packaging +LX,LexinFintech Holdings Ltd. American Depositary Shares,$2.90,-0.05,-1.695%,487964153.00,China,2017,1426654,Finance,Finance: Consumer Services +LXEH,Lixiang Education Holding Co. Ltd. American Depositary Shares,$0.2255,-0.0113,-4.772%,4322084.00,China,2020,177792,Real Estate,Other Consumer Services +LXEO,Lexeo Therapeutics Inc. Common Stock,$7.44,-0.10,-1.326%,543025713.00,United States,2023,631681,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +LXFR,Luxfer Holdings PLC Ordinary Shares,$14.75,-0.39,-2.576%,394142273.00,United Kingdom,2012,148970,Basic Materials,Major Chemicals +LXP,LXP Industrial Trust Common Stock (Maryland REIT),$48.22,-1.25,-2.527%,2852639506.00,United States,,445684,Real Estate,Real Estate Investment Trusts +LXP^C,LXP Industrial Trust 6.5% Series C Cumulative Convertible Preferred Stock,$47.4001,0.0402,0.085%,,United States,,2955,, +LXRX,Lexicon Pharmaceuticals Inc. Common Stock,$1.50,-0.21,-12.281%,545098020.00,United States,,2459349,Health Care,Biotechnology: Pharmaceutical Preparations +LXU,LSB Industries Inc. Common Stock,$9.45,-0.07,-0.735%,679875516.00,United States,2003,331767,Basic Materials,Major Chemicals +LYB,LyondellBasell Industries NV Ordinary Shares Class A (Netherlands),$50.47,0.04,0.079%,16244928493.00,Netherlands,,5207665,Industrials,Major Chemicals +LYEL,Lyell Immunopharma Inc. Common Stock,$24.03,-1.25,-4.945%,509873755.00,United States,2021,57182,Health Care,Biotechnology: Pharmaceutical Preparations +LYFT,Lyft Inc. Class A Common Stock,$17.20,-0.34,-1.938%,6868878446.00,United States,2019,12358863,Real Estate,Real Estate +LYG,Lloyds Banking Group Plc American Depositary Shares,$5.81,-0.05,-0.853%,86110090840.00,United Kingdom,,10577486,Finance,Commercial Banks +LYRA,Lyra Therapeutics Inc. Common Stock,$2.05,0.355,20.944%,3638508.00,United States,2020,186354,Health Care,Medical/Dental Instruments +LYTS,LSI Industries Inc. Common Stock,$21.53,-0.61,-2.755%,669427683.00,United States,1985,131580,Consumer Discretionary,Building Products +LYV,Live Nation Entertainment Inc. Common Stock,$147.53,0.73,0.497%,34631375875.00,United States,,1449972,Consumer Discretionary,Services-Misc. Amusement & Recreation +LZ,LegalZoom.com Inc. Common Stock,$9.32,0.44,4.955%,1652158805.00,United States,2021,5883047,Technology,EDP Services +LZB,La-Z-Boy Incorporated Common Stock,$37.13,-0.17,-0.456%,1531574256.00,United States,,252633,Consumer Discretionary,Home Furnishings +LZM,Lifezone Metals Limited Ordinary Shares,$5.79,0.03,0.521%,468090072.00,Isle of Man,,258158,Basic Materials,Metal Mining +LZMH,LZ Technology Holdings Limited Class B Ordinary Shares,$1.29,-0.03,-2.273%,196170300.00,China,2025,182814,Technology,EDP Services +M,Macy's Inc Common Stock,$20.02,-0.36,-1.766%,5322979842.00,United States,,6335344,Consumer Discretionary,Department/Specialty Retail Stores +MA,Mastercard Incorporated Common Stock,$521.37,0.96,0.184%,468188095272.00,United States,2006,5483042,Real Estate,Real Estate +MAA,Mid-America Apartment Communities Inc. Common Stock,$132.46,-2.27,-1.685%,15508647545.00,United States,1994,602965,Real Estate,Real Estate Investment Trusts +MAA^I,Mid-America Apartment Communities Inc. 8.50% Series I Cumulative Redeemable Preferred Stock,$53.15,-1.847,-3.358%,,United States,,367,, +MAAS,Maase Inc. Class A Ordinary Shares,$6.04,0.08,1.342%,1931676705.00,China,2019,5073,Finance,Investment Managers +MAC,Macerich Company (The) Common Stock,$17.90,0.18,1.016%,4584513704.00,United States,1994,2166915,Real Estate,Real Estate Investment Trusts +MACI,Melar Acquisition Corp. I Class A Ordinary Shares,$10.70,0.02,0.187%,0.00,United States,2024,3309,, +MACIW,Melar Acquisition Corp. I Warrant,$0.1361,-0.0338,-19.894%,0.00,United States,2024,270,Finance,Blank Checks +MAGN,Magnera Corporation Common Stock,$13.21,-0.49,-3.577%,473580442.00,United States,2000,283717,Basic Materials,Paper +MAIA,MAIA Biotechnology Inc. Common Stock,$2.78,-0.17,-5.763%,102949813.00,,2022,1689021,Health Care,Biotechnology: Pharmaceutical Preparations +MAIN,Main Street Capital Corporation Common Stock,$64.27,-0.33,-0.511%,5757791389.00,United States,2007,401996,Finance,Finance/Investors Services +MAMA,Mama's Creations Inc. Common Stock,$14.76,-0.08,-0.539%,600043195.00,United States,,286755,Consumer Staples,Specialty Foods +MAMO,Massimo Group Common Stock,$3.31,0.02,0.608%,137831545.00,United States,2024,17442,Consumer Discretionary,Industrial Specialties +MAN,ManpowerGroup Common Stock,$28.96,-1.14,-3.787%,1340766333.00,United States,,1494640,Consumer Discretionary,Professional Services +MANH,Manhattan Associates Inc. Common Stock,$161.14,-8.59,-5.061%,9710013922.00,United States,1998,1356031,Technology,Computer Software: Prepackaged Software +MANU,Manchester United Ltd. Class A Ordinary Shares,$17.82,0.16,0.906%,3072682267.00,United Kingdom,2012,319631,Consumer Discretionary,Services-Misc. Amusement & Recreation +MAPS,WM Technology Inc. Class A Common Stock ,$0.8103,0.007,0.871%,127392672.00,United States,2019,744668,Technology,Computer Software: Prepackaged Software +MAPSW,WM Technology Inc. Warrants ,$0.0077,-0.0001,-1.282%,1210568.00,United States,2019,500,Technology,Computer Software: Prepackaged Software +MAR,Marriott International Class A Common Stock,$312.07,-1.88,-0.599%,83744544666.00,United States,,1264167,Consumer Discretionary,Hotels/Resorts +MARA,MARA Holdings Inc. Common Stock,$10.37,-0.15,-1.426%,3921771741.00,United States,,36791311,Technology,EDP Services +MARPS,Marine Petroleum Trust Units of Beneficial Interest,$4.651,-0.139,-2.902%,9302000.00,United States,,67482,Energy,Oil & Gas Production +MAS,Masco Corporation Common Stock,$66.48,-0.69,-1.027%,13807604884.00,United States,,2931835,Industrials,Industrial Specialties +MASI,Masimo Corporation Common Stock,$137.67,-0.25,-0.181%,7394799359.00,United States,2007,1136259,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +MASK,3 E Network Technology Group Ltd Class A Ordinary Shares,$0.23,-0.001,-0.433%,4008465.00,China,2025,1123502,Technology,EDP Services +MASS,908 Devices Inc. Common Stock,$6.56,-0.27,-3.953%,237425936.00,United States,2020,351353,Industrials,Industrial Machinery/Components +MAT,Mattel Inc. Common Stock,$20.345,0.115,0.568%,6323226000.00,United States,,1865379,Consumer Discretionary,Recreational Games/Products/Toys +MATH,Metalpha Technology Holding Limited Ordinary Shares,$2.00,0.005,0.251%,86814142.00,China,2017,105297,Finance,Finance/Investors Services +MATV,Mativ Holdings Inc. Common Stock,$12.30,-0.21,-1.679%,672577702.00,United States,,345858,Basic Materials,Paper +MATW,Matthews International Corporation Class A Common Stock,$25.89,-0.10,-0.385%,805854237.00,United States,1994,343367,Telecommunications,Metal Fabrications +MATX,Matson Inc. Common Stock,$158.96,0.04,0.025%,4956378364.00,United States,,247362,Consumer Discretionary,Marine Transportation +MAX,MediaAlpha Inc. Class A Common Stock,$10.46,-0.26,-2.425%,681697446.00,United States,2020,628694,Real Estate,Real Estate +MAXN,Maxeon Solar Technologies Ltd. Ordinary Shares,$2.67,-0.11,-3.957%,45114266.00,Singapore,,187206,Technology,Semiconductors +MAYS,J. W. Mays Inc. Common Stock,$40.00,0.00,0.00%,80631200.00,United States,,35,Real Estate,Building operators +MAZE,Maze Therapeutics Inc. Common Stock,$43.36,-1.98,-4.367%,2086459092.00,United States,2025,462562,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MB,MasterBeef Group Ordinary Shares,$5.21,-0.85,-14.026%,88570000.00,Hong Kong,2025,5828,Consumer Discretionary,Restaurants +MBAI,Check-Cap Ltd. Ordinary Share,$2.08,-0.22,-9.565%,12169884.00,Israel,2015,2518931,Health Care,Medical Electronics +MBAV,M3-Brigade Acquisition V Corp. Class A Ordinary shares,$10.67,0.00,0.00%,0.00,United States,2024,131130,, +MBAVW,M3-Brigade Acquisition V Corp. Warrant,$0.89,-0.0299,-3.25%,0.00,United States,2024,6900,Finance,Blank Checks +MBBC,Marathon Bancorp Inc. Common Stock,$12.50,-0.12,-0.951%,36732750.00,United States,,750,Finance,Banks +MBC,MasterBrand Inc. Common Stock,$11.91,-0.11,-0.915%,1509942309.00,United States,2022,1418319,Consumer Discretionary,Home Furnishings +MBCN,Middlefield Banc Corp. Common Stock,$32.94,-2.32,-6.58%,266382025.00,United States,,29482,Finance,Major Banks +MBI,MBIA Inc. Common Stock,$6.42,-0.03,-0.465%,324169079.00,United States,1987,206003,Finance,Property-Casualty Insurers +MBIN,Merchants Bancorp Common Stock,$34.95,-0.375,-1.062%,1603828868.00,United States,2017,280769,Finance,Major Banks +MBINL,Merchants Bancorp Depositary Shares Each Representing a 1/40thInterest in a Share of 7.25% Fixed Rate Series E Non-CumulativePerpetual Preferred Stock without par value,$24.359,0.089,0.367%,1117815948.00,United States,,17145,Finance,Major Banks +MBINM,Merchants Bancorp Depositary Shares Each Representing a 1/40th Interest in a Share of 8.25% Fixed-Rate Reset Series D Non-Cumulative Perpetual Preferred Stock,$25.52,-0.1677,-0.653%,1171093354.00,United States,,3550,Finance,Major Banks +MBINN,Merchants Bancorp Depositary Shares Preferred Series C,$20.00,-0.16,-0.794%,917784760.00,United States,,7787,Finance,Major Banks +MBIO,Mustang Bio Inc. Common Stock,$1.01,-0.01,-0.98%,7372077.00,United States,,43256,Health Care,Biotechnology: Pharmaceutical Preparations +MBLY,Mobileye Global Inc. Class A Common Stock,$9.51,-0.57,-5.655%,2054216470.00,Israel,2022,10401848,Technology,Computer Software: Prepackaged Software +MBNKO,Medallion Bank Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series G par value $1.00 per share,$25.05,-0.15,-0.595%,25050000.00,United States,,21346,Finance,Commercial Banks +MBOT,Microbot Medical Inc. Common Stock,$1.90,-0.07,-3.553%,127600284.00,Israel,,1115183,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MBRX,Moleculin Biotech Inc. Common Stock,$4.59,0.07,1.549%,12363307.00,United States,2016,82830,Health Care,Biotechnology: Pharmaceutical Preparations +MBUU,Malibu Boats Inc. Class A Common Stock,$31.88,-0.53,-1.635%,612943880.00,United States,2014,168937,Industrials,Marine Transportation +MBVI,M3-Brigade Acquisition VI Corp. Class A Ordinary Shares,$10.16,0.00,0.00%,0.00,United States,2025,589,, +MBVIU,M3-Brigade Acquisition VI Corp. Units,$10.28,0.00,0.00%,0.00,United States,2025,10,Finance,Blank Checks +MBVIW,M3-Brigade Acquisition VI Corp. Warrant,$0.4862,0.0112,2.358%,0.00,United States,2025,50763,, +MBWM,Mercantile Bank Corporation Common Stock,$49.97,-0.89,-1.75%,812192392.00,United States,1998,87059,Finance,Major Banks +MBX,MBX Biosciences Inc. Common Stock,$35.83,-0.24,-0.665%,1608849481.00,United States,2024,360193,Health Care,Biotechnology: Pharmaceutical Preparations +MC,Moelis & Company Class A Common Stock,$72.90,-0.49,-0.668%,5709583185.00,United States,2014,665091,Finance,Investment Managers +MCB,Metropolitan Bank Holding Corp. Common Stock,$89.19,-0.35,-0.391%,918478798.00,United States,2017,280773,Finance,Major Banks +MCBS,MetroCity Bankshares Inc. Common Stock,$26.66,-0.65,-2.38%,768295398.00,United States,2019,51598,Finance,Major Banks +MCD,McDonald's Corporation Common Stock,$312.80,-1.33,-0.423%,222761880680.00,United States,,2184937,Consumer Discretionary,Restaurants +MCFT,MasterCraft Boat Holdings Inc. Common Stock,$20.91,-0.43,-2.015%,340598766.00,United States,2015,73994,Industrials,Marine Transportation +MCGA,Yorkville Acquisition Corp. Class A Ordinary Share,$10.16,0.00,0.00%,0.00,United States,2025,27102,Utilities,Electric Utilities: Central +MCGAU,Yorkville Acquisition Corp. Unit,$10.30,-0.02,-0.194%,0.00,United States,2025,1596,Finance,Blank Checks +MCGAW,Yorkville Acquisition Corp. Warrant,$0.5486,0.0236,4.495%,0.00,United States,2025,977,, +MCHB,Mechanics Bancorp Class A Common Stock,$14.92,0.07,0.471%,3300507658.00,United States,2012,274235,Finance,Major Banks +MCHP,Microchip Technology Incorporated Common Stock,$80.28,5.12,6.812%,43387071834.00,United States,1993,14809645,Technology,Semiconductors +MCHPP,Microchip Technology Incorporated Depositary Shares Each Representing a 1/20th Interest in a Share of 7.50% Series A Mandatory Convertible Preferred Stock,$70.044,3.994,6.047%,37855058041.00,United States,,3328273,Technology,Semiconductors +MCHX,Marchex Inc. Class B Common Stock,$1.66,-0.08,-4.598%,72884393.00,United States,2004,38725,Technology,Computer Software: Prepackaged Software +MCI,Barings Corporate Investors Common Stock,$20.77,-0.23,-1.095%,420835904.00,United States,,24351,Finance,Trusts Except Educational Religious and Charitable +MCK,McKesson Corporation Common Stock,$826.62,-7.56,-0.906%,102026937423.00,United States,,541050,Health Care,Other Pharmaceuticals +MCN,XAI Madison Equity Premium Income Fund Common Shares,$6.01,-0.02,-0.332%,0.00,United States,2004,105939,, +MCO,Moody's Corporation Common Stock,$516.62,-2.25,-0.434%,92165008000.00,United States,,726583,Finance,Finance: Consumer Services +MCR,MFS Charter Income Trust Common Stock,$6.27,0.00,0.00%,275932543.00,United States,1989,105171,Finance,Trusts Except Educational Religious and Charitable +MCRB,Seres Therapeutics Inc. Common Stock,$15.14,-0.30,-1.943%,136964298.00,United States,2015,19118,Health Care,Biotechnology: Pharmaceutical Preparations +MCRI,Monarch Casino & Resort Inc. Common Stock,$90.29,0.70,0.781%,1647818774.00,United States,1993,86132,Consumer Discretionary,Hotels/Resorts +MCRP,Micropolis AI Robotics Ordinary Shares,$3.27,0.00,0.00%,114085222.00,,2025,660598,Consumer Discretionary,Auto Parts:O.E.M. +MCS,Marcus Corporation (The) Common Stock,$14.88,-0.35,-2.298%,457020674.00,United States,,164373,Consumer Discretionary,Movies/Entertainment +MCW,Mister Car Wash Inc. Common Stock,$5.40,0.00,0.00%,1768869203.00,United States,,1129178,Consumer Discretionary,Automotive Aftermarket +MCY,Mercury General Corporation Common Stock,$85.30,0.09,0.106%,4724649883.00,United States,,339960,Finance,Property-Casualty Insurers +MD,Pediatrix Medical Group Inc. Common Stock,$20.67,0.14,0.682%,1775085569.00,United States,,686072,Health Care,Hospital/Nursing Management +MDAI,Spectral AI Inc. Class A Common Stock,$1.89,-0.01,-0.526%,58002012.00,United States,2021,426918,Health Care,Medical/Dental Instruments +MDAIW,Spectral AI Inc. Warrants,$0.58,0.00,0.00%,17799559.00,United States,2021,25247,Health Care,Medical/Dental Instruments +MDB,MongoDB Inc. Class A Common Stock,$411.04,-0.85,-0.206%,33455269030.00,United States,2017,863770,Technology,Computer Software: Prepackaged Software +MDBH,MDB Capital Holdings LLC Class A common,$3.2685,-0.0715,-2.141%,33236174.00,United States,2023,22995,Finance,Finance: Consumer Services +MDCX,Medicus Pharma Ltd. Common Stock ,$1.18,-0.03,-2.479%,24745924.00,Canada,,133792,, +MDCXW,Medicus Pharma Ltd. Warrant,$0.7502,-0.0001,-0.013%,15732536.00,Canada,,6000,, +MDGL,Madrigal Pharmaceuticals Inc. Common Stock,$496.54,-3.85,-0.769%,11277128487.00,United States,2007,180944,Health Care,Biotechnology: Pharmaceutical Preparations +MDIA,Mediaco Holding Inc. Class A Common Stock ,$0.6779,0.0179,2.712%,55485087.00,United States,,47139,Consumer Discretionary,Broadcasting +MDLN,Medline Inc. Class A Common Stock,$44.32,-1.99,-4.297%,58738873659.00,United States,2025,2944872,Health Care,Medical/Dental Instruments +MDLZ,Mondelez International Inc. Class A Common Stock,$57.73,-1.29,-2.186%,74492395743.00,United States,,9809369,Consumer Staples,Packaged Foods +MDRR,Medalist Diversified REIT Inc. Common Stock,$12.12,0.00,0.00%,13482349.00,United States,2018,347,Real Estate,Real Estate Investment Trusts +MDT,Medtronic plc. Ordinary Shares,$100.79,0.10,0.099%,129214212024.00,United States,,6643248,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +MDU,MDU Resources Group Inc. Common Stock (Holding Company),$20.44,-0.08,-0.39%,4177584861.00,United States,,1321432,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +MDV,Modiv Industrial Inc. Class C Common Stock,$14.96,-0.33,-2.158%,153713955.00,,2022,38896,Real Estate,Real Estate Investment Trusts +MDV^A,Modiv Industrial Inc. 7.375% Series A Cumulative Redeemable Perpetual Preferred Stock,$24.90,-0.073,-0.292%,,,,678,, +MDWD,MediWound Ltd. Ordinary Shares,$18.42,0.39,2.163%,207257530.00,Israel,2014,205701,Health Care, Medicinal Chemicals and Botanical Products +MDXG,MiMedx Group Inc Common Stock,$5.15,-0.15,-2.83%,762726119.00,United States,,1008606,Health Care,Biotechnology: Pharmaceutical Preparations +MDXH,MDxHealth SA Ordinary Shares,$3.65,-0.05,-1.351%,187480498.00,Belgium,2021,96049,Health Care,Medical Specialities +MEC,Mayville Engineering Company Inc. Common Stock,$18.93,0.53,2.88%,384626744.00,United States,2019,143291,Industrials,Industrial Specialties +MED,MEDIFAST INC Common Stock,$11.19,-0.27,-2.356%,122992345.00,United States,,217879,Consumer Staples,Packaged Foods +MEDP,Medpace Holdings Inc. Common Stock,$597.91,-4.34,-0.721%,16842062214.00,United States,2016,169173,Health Care,Biotechnology: Commercial Physical & Biological Resarch +MEG,Montrose Environmental Group Inc. Common Stock,$22.45,-0.77,-3.316%,793330624.00,United States,2020,370393,Consumer Discretionary,Professional Services +MEGI,NYLI CBRE Global Infrastructure Megatrends Term Fund Common Shares,$14.03,-0.01,-0.071%,0.00,United States,2021,183926,Finance,Investment Managers +MEGL,Magic Empire Global Limited Class A Ordinary Shares,$1.21,-0.07,-5.469%,6127501.00,Hong Kong,2022,32346,Finance,Finance: Consumer Services +MEHA,Functional Brands Inc. Common Stock,$0.2108,-0.0123,-5.513%,3440999.00,United States,,528765,Health Care, Medicinal Chemicals and Botanical Products +MEI,Methode Electronics Inc. Common Stock,$7.95,-0.15,-1.852%,281495580.00,United States,,500968,Technology,Electrical Products +MELI,MercadoLibre Inc. Common Stock,$2268.60,-26.40,-1.15%,115011627085.00,Argentina,2007,486219,Real Estate,Real Estate +MENS,Jyong Biotech Ltd. Ordinary Shares,$2.53,-0.48,-15.947%,192349998.00,Taiwan,2025,742425,Health Care,Biotechnology: Pharmaceutical Preparations +MEOH,Methanex Corporation Common Stock,$47.78,0.91,1.942%,3695282266.00,Canada,,492841,Industrials,Major Chemicals +MER^K,Bank of America Corporation Income Capital Obligation Notes initially due December 15 2066,$25.63,-0.05,-0.195%,,United States,,12510,, +MERC,Mercer International Inc. Common Stock,$2.13,-0.06,-2.74%,142672738.00,Canada,,395471,Basic Materials,Paper +MESHU,Meshflow Acquisition Corp. Units,$10.03,0.02,0.20%,0.00,United States,2025,455134,, +MESO,Mesoblast Limited American Depositary Shares,$18.70,-0.47,-2.452%,2413800095.00,Australia,2015,119489,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MET,MetLife Inc. Common Stock,$76.26,-0.43,-0.561%,50247077687.00,United States,2000,2911290,Finance,Life Insurance +MET^A,MetLife Inc. Preferred Series A Floating Rate,$21.72,0.00,0.00%,,United States,,102094,, +MET^E,MetLife Inc. Depositary Shares ,$24.31,-0.05,-0.205%,,United States,,39718,, +MET^F,MetLife Inc. Depositary Shares each representing a 1/1000th interest in a share of 4.75% Non-Cumulative Preferred Stock Series F,$20.14,-0.13,-0.641%,,United States,,69004,, +META,Meta Platforms Inc. Class A Common Stock,$668.73,-4.24,-0.63%,1685552419942.00,United States,2012,25709600,Technology,Computer Software: Programming Data Processing +METC,Ramaco Resources Inc. Class A Common Stock,$22.58,-0.38,-1.655%,1511784108.00,United States,2017,3214761,Energy,Coal Mining +METCB,Ramaco Resources Inc. Class B Common Stock,$13.505,-0.24,-1.746%,904191514.00,United States,,33099,Energy,Coal Mining +METCI,Ramaco Resources Inc. 8.250% Senior Notes due 2030,$25.20,0.08,0.318%,0.00,United States,,1211,, +METCZ,Ramaco Resources Inc. 8.375% Senior Notes due 2029,$25.475,0.01,0.039%,0.00,United States,,3494,Energy,Coal Mining +MFA,MFA Financial Inc.,$9.99,-0.02,-0.20%,1020935073.00,United States,,1162367,Real Estate,Real Estate Investment Trusts +MFA^B,MFA Financial Inc. Preferred Series B,$20.3899,0.0499,0.245%,,United States,,10014,, +MFA^C,MFA Financial Inc. 6.50% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$23.33,0.16,0.691%,,United States,,17889,, +MFAN,MFA Financial Inc. 8.875% Senior Notes due 2029,$25.51,0.00,0.00%,2619078588.00,United States,2024,16581,Real Estate,Real Estate Investment Trusts +MFAO,MFA Financial Inc. 9.000% Senior Notes due 2029,$25.70,0.01,0.039%,2638585641.00,United States,2024,7213,Real Estate,Real Estate Investment Trusts +MFC,Manulife Financial Corporation Common Stock,$37.72,0.35,0.937%,63557700587.00,Canada,,1575828,Finance,Life Insurance +MFG,Mizuho Financial Group Inc. Sponosred ADR (Japan),$8.63,-0.05,-0.576%,108429332085.00,Japan,,4108715,Finance,Major Banks +MFI,mF International Limited Class A Ordinary Shares,$15.59,0.55,3.657%,782250996.00,Hong Kong,2024,6200,Technology,EDP Services +MFIC,MidCap Financial Investment Corporation Common Stock,$11.14,-0.12,-1.066%,1039402349.00,United States,2004,474865,Finance,Finance/Investors Services +MFICL,MidCap Financial Investment Corporation 8.00% Notes due 2028,$25.346,-0.024,-0.095%,2364873603.00,United States,,3203,Finance,Finance/Investors Services +MFIN,Medallion Financial Corp. Common Stock,$9.87,-0.21,-2.083%,229768023.00,United States,,67616,Finance,Finance: Consumer Services +MFM,MFS Municipal Income Trust Common Stock,$5.50,0.02,0.365%,226531971.00,United States,1986,123714,Finance,Finance Companies +MG,Mistras Group Inc Common Stock,$13.89,-0.16,-1.139%,438203845.00,United States,2009,145522,Consumer Discretionary,Military/Government/Technical +MGA,Magna International Inc. Common Stock,$52.31,-1.24,-2.316%,14741703784.00,Canada,,1236307,Consumer Discretionary,Auto Parts:O.E.M. +MGEE,MGE Energy Inc,$78.17,-0.95,-1.201%,2856476336.00,United States,,101399,Energy,Electric Utilities: Central +MGF,MFS Government Markets Income Trust Common Stock,$3.01,-0.005,-0.166%,98118153.00,United States,1987,40702,Finance,Trusts Except Educational Religious and Charitable +MGIC,Magic Software Enterprises Ltd. Ordinary Shares,$26.61,-0.34,-1.262%,1306532506.00,Israel,1991,12853,Technology,Computer Software: Prepackaged Software +MGIH,Millennium Group International Holdings Limited Ordinary Shares,$1.51,0.07,4.861%,16987500.00,Hong Kong,2023,184307,Consumer Discretionary,Publishing +MGLD,The Marygold Companies Inc. Common Stock,$0.94,-0.03,-3.093%,40248626.00,,2022,16121,Finance,Finance: Consumer Services +MGM,MGM Resorts International Common Stock,$32.75,-0.73,-2.18%,8957335910.00,United States,,4424582,Consumer Discretionary,Hotels/Resorts +MGN,Megan Holdings Limited Ordinary Shares,$1.71,-0.15,-8.065%,27787500.00,Malaysia,2025,6203,Consumer Staples,Farming/Seeds/Milling +MGNI,Magnite Inc. Common Stock,$14.86,-0.19,-1.262%,2134607333.00,United States,,1545404,Technology,Computer Software: Programming Data Processing +MGNX,MacroGenics Inc. Common Stock,$1.80,-0.04,-2.174%,113865358.00,United States,2013,543441,Health Care,Biotechnology: Pharmaceutical Preparations +MGPI,MGP Ingredients Inc.,$24.44,-0.46,-1.847%,520433059.00,United States,,197609,Consumer Staples,Beverages (Production/Distribution) +MGR,Affiliated Managers Group Inc. 5.875% Junior Subordinated Notes due 2059,$21.61,-0.10,-0.461%,613984681.00,United States,2019,10945,Finance,Investment Managers +MGRB,Affiliated Managers Group Inc. 4.750% Junior Subordinated Notes due 2060,$17.50,-0.15,-0.85%,497211103.00,United States,2020,12448,Finance,Investment Managers +MGRC,McGrath RentCorp Common Stock,$117.40,3.06,2.676%,2889408532.00,United States,1984,200185,Consumer Discretionary,Diversified Commercial Services +MGRD,Affiliated Managers Group Inc. 4.200% Junior Subordinated Notes due 2061,$15.69,-0.03,-0.191%,445785268.00,United States,2021,4512,Finance,Investment Managers +MGRE,Affiliated Managers Group Inc. 6.750% Junior Subordinated Notes due 2064,$24.54,-0.04,-0.163%,697232026.00,United States,2024,13128,Finance,Investment Managers +MGRT,Mega Fortune Company Limited Ordinary Shares,$6.30,0.11,1.777%,86625000.00,Hong Kong,2025,2288,Technology,EDP Services +MGRX,Mangoceuticals Inc. Common Stock,$0.4303,-0.0239,-5.262%,7009069.00,United States,2023,163181,Health Care,Misc Health and Biotechnology Services +MGTX,MeiraGTx Holdings plc Ordinary Shares,$7.76,-0.25,-3.121%,624609299.00,United States,2018,308707,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MGX,Metagenomi Therapeutics Inc. Common Stock,$1.60,-0.06,-3.614%,60074802.00,United States,2024,235080,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MGY,Magnolia Oil & Gas Corporation Class A Common Stock,$25.22,0.52,2.105%,4758409199.00,United States,2017,2863394,Energy,Oil & Gas Production +MGYR,Magyar Bancorp Inc. Common Stock,$17.88,0.08,0.449%,116866380.00,United States,2006,2269,Finance,Savings Institutions +MH,McGraw Hill Inc. Common Stock,$14.59,-0.22,-1.485%,2786712162.00,,2025,332954,Consumer Discretionary,Publishing +MHD,Blackrock MuniHoldings Fund Inc. Common Stock,$11.92,0.07,0.591%,1773248654.00,United States,1997,112989,Finance,Investment Bankers/Brokers/Service +MHF,Western Asset Municipal High Income Fund Inc. Common Stock,$6.88,0.00,0.00%,0.00,United States,1988,48858,Finance,Finance/Investors Services +MHH,Mastech Digital Inc Common Stock,$6.81,-0.17,-2.436%,79658824.00,United States,,7910,Consumer Discretionary,Professional Services +MHK,Mohawk Industries Inc. Common Stock,$119.74,-0.33,-0.275%,7402489886.00,United States,,611024,Consumer Discretionary,Home Furnishings +MHLA,Maiden Holdings Ltd. 6.625% Notes due 2046,$13.01,0.054,0.417%,100722678.00,Bermuda,2016,5964,Finance,Property-Casualty Insurers +MHN,Blackrock MuniHoldings New York Quality Fund Inc. Common Stock,$10.25,0.03,0.294%,1524815328.00,United States,1997,67996,Finance,Investment Bankers/Brokers/Service +MHNC,Maiden Holdings North America Ltd. 7.75% Notes due 2043,$15.47,0.08,0.52%,119767858.00,Bermuda,2013,6194,Finance,Property-Casualty Insurers +MHO,M/I Homes Inc. Common Stock,$132.36,3.76,2.924%,3461016651.00,United States,1993,582919,Consumer Discretionary,Homebuilding +MI,NFT Limited Class A Ordinary Share,$4.00,0.0098,0.246%,57273640.00,,2023,3021,Consumer Discretionary,Other Specialty Stores +MIAX,Miami International Holdings Inc. Common Stock,$41.23,-0.19,-0.459%,3522772670.00,,2025,527101,Finance,Investment Bankers/Brokers/Service +MICC,The Magnum Ice Cream Company N.V. Ordinary Shares,$17.81,0.22,1.251%,10904345952.00,,2025,699664,Consumer Staples,Specialty Foods +MIDD,Middleby Corporation (The) Common Stock,$149.20,1.57,1.063%,7515390500.00,United States,,708682,Industrials,Industrial Machinery/Components +MIGI,Mawson Infrastructure Group Inc. Common Stock,$4.46,-0.23,-4.904%,5098935.00,Australia,,191522,Finance,Finance: Consumer Services +MIMI,Mint Incorporation Limited Class A Ordinary Shares,$0.3379,0.003,0.896%,8451724.00,Hong Kong,2025,136051,Real Estate,Real Estate +MIN,MFS Intermediate Income Trust Common Stock,$2.58,-0.01,-0.386%,296436249.00,United States,1988,226235,Finance,Trusts Except Educational Religious and Charitable +MIND,MIND Technology Inc. Common Stock (DE),$9.05,-0.04,-0.44%,81794642.00,United States,1994,155996,Industrials,Industrial Machinery/Components +MINE,Mayfair Gold Corp. Common Shares,$4.64,0.13,2.882%,309940841.00,,2026,678801,Energy,Oil & Gas Production +MIR,Mirion Technologies Inc. Class A Common Stock,$25.38,0.01,0.039%,6441474202.00,United States,2020,2186045,Industrials,Industrial Machinery/Components +MIRA,MIRA Pharmaceuticals Inc. Common Stock,$1.33,-0.01,-0.746%,55695196.00,United States,2023,116944,Health Care,Biotechnology: Pharmaceutical Preparations +MIRM,Mirum Pharmaceuticals Inc. Common Stock,$100.85,1.58,1.592%,5183041938.00,United States,2019,1025925,Health Care,Biotechnology: Pharmaceutical Preparations +MIST,Milestone Pharmaceuticals Inc. Common Shares,$1.94,-0.07,-3.483%,165228527.00,Canada,2019,1708081,Health Care,Biotechnology: Pharmaceutical Preparations +MITK,Mitek Systems Inc. Common Stock,$10.47,-0.22,-2.058%,474287461.00,United States,,526430,Technology,Computer peripheral equipment +MITN,TPG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029,$25.62,0.05,0.196%,755610250.00,United States,2024,7007,Real Estate,Real Estate Investment Trusts +MITP,TPG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029,$25.64,0.01,0.039%,756200110.00,United States,2024,5476,Real Estate,Real Estate Investment Trusts +MITQ,Moving iMage Technologies Inc. Common Stock,$0.75,-0.02,-2.597%,7454799.00,United States,2021,7687,Consumer Discretionary,Industrial Machinery/Components +MITT,TPG Mortgage Investment Trust Inc. Common Stock,$8.81,-0.12,-1.344%,279668596.00,United States,2011,119315,Real Estate,Real Estate Investment Trusts +MITT^A,TPG Mortgage Investment Trust Inc. 8.25% Series A Cumulative Redeemable Preferred Stock,$22.75,-0.29,-1.259%,,United States,,2621,, +MITT^B,TPG Mortgage Investment Trust Inc. 8.00% Series B Cumulative Redeemable Preferred Stock,$22.55,-0.03,-0.133%,,United States,,4061,, +MITT^C,TPG Mortgage Investment Trust Inc. 8.00% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock $0.01 par value per share,$25.50,0.06,0.236%,,United States,,4257,, +MIY,Blackrock MuniYield Michigan Quality Fund Inc. Common Stock,$12.08,-0.07,-0.576%,1797050650.00,United States,1992,48901,Finance,Investment Bankers/Brokers/Service +MKC,McCormick & Company Incorporated Common Stock,$61.86,-1.55,-2.444%,16605589465.00,United States,,4101028,Consumer Staples,Packaged Foods +MKDW,MKDWELL Tech Inc. Ordinary Share,$3.07,-0.30,-8.902%,14433089.00,Taiwan,,139674,Technology,Consumer Electronics/Appliances +MKDWW,MKDWELL Tech Inc. Warrants,$0.0124,0.0001,0.813%,58297.00,Taiwan,,1000,Technology,Consumer Electronics/Appliances +MKL,Markel Group Inc. Common Stock,$2010.58,-1.78,-0.088%,25353916445.00,United States,1986,45154,Finance,Property-Casualty Insurers +MKLY,McKinley Acquisition Corporation Class A Ordinary Shares,$10.03,0.00,0.00%,0.00,United States,2025,202789,, +MKLYU,McKinley Acquisition Corporation Units,$10.13,0.00,0.00%,0.00,United States,2025,72,Finance,Blank Checks +MKSI,MKS Inc. Common Stock,$236.05,6.45,2.809%,15855354338.00,United States,1999,2885329,Industrials,Industrial Machinery/Components +MKTW,MarketWise Inc. Class A Common Stock,$16.44,-0.09,-0.544%,263521380.00,United States,,8945,Technology,Computer Software: Prepackaged Software +MKTX,MarketAxess Holdings Inc. Common Stock,$168.56,0.18,0.107%,6265629388.00,United States,2004,441696,Finance,Investment Bankers/Brokers/Service +MKZR,MacKenzie Realty Capital Inc. Common Stock,$4.655,-0.045,-0.957%,8623299.00,United States,,11994,Real Estate,Real Estate Investment Trusts +MLAAU,Mountain Lake Acquisition Corp. II Units,$9.995,-0.005,-0.05%,0.00,United States,2026,1429723,Finance,Blank Checks +MLAB,Mesa Laboratories Inc. Common Stock,$78.94,-2.64,-3.236%,435930283.00,United States,,110811,Industrials,Industrial Machinery/Components +MLAC,Mountain Lake Acquisition Corp. Class A Ordinary Shares,$10.45,0.00,0.00%,0.00,United States,2025,54504,Industrials,Auto Manufacturing +MLACR,Mountain Lake Acquisition Corp. Right,$0.256,-0.0034,-1.311%,0.00,United States,2025,300,, +MLCI,Mount Logan Capital Inc. Common Stock,$8.09,0.01,0.124%,103445147.00,United States,,114583,Finance,Investment Managers +MLCO,Melco Resorts & Entertainment Limited American Depositary Shares,$6.28,0.00,0.00%,2672224535.00,Hong Kong,2006,2362546,Consumer Discretionary,Hotels/Resorts +MLEC,Moolec Science SA Ordinary Shares,$6.62,-0.07,-1.046%,4806901.00,Luxembourg,,38754,Finance,Blank Checks +MLECW,Moolec Science SA Warrant,$0.0087,0.0014,19.178%,6317.00,Luxembourg,,36566,Finance,Blank Checks +MLGO,MicroAlgo Inc. Class A Ordinary Shares,$5.20,-0.14,-2.622%,64675036.00,United States,2021,112798,Technology,EDP Services +MLI,Mueller Industries Inc. Common Stock,$134.51,0.08,0.06%,14932443506.00,United States,,656390,Industrials,Metal Fabrications +MLKN,MillerKnoll Inc. Common Stock,$19.16,-0.39,-1.995%,1312743070.00,United States,,478681,Consumer Discretionary,Office Equipment/Supplies/Services +MLM,Martin Marietta Materials Inc. Common Stock,$650.23,0.98,0.151%,39213513593.00,United States,1994,338817,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +MLP,Maui Land & Pineapple Company Inc. Common Stock,$16.83,-0.22,-1.29%,332252962.00,United States,1998,12183,Finance,Real Estate +MLR,Miller Industries Inc. Common Stock,$40.09,-0.41,-1.012%,458285467.00,United States,,43867,Consumer Discretionary,Construction/Ag Equipment/Trucks +MLSS,Milestone Scientific Inc. Common Stock,$0.2914,-0.008,-2.672%,22912465.00,United States,2015,40877,Health Care,Industrial Specialties +MLTX,MoonLake Immunotherapeutics Class A Ordinary Shares,$16.25,0.00,0.00%,1043749233.00,United States,2020,1038046,Health Care,Biotechnology: Pharmaceutical Preparations +MLYS,Mineralys Therapeutics Inc. Common Stock,$32.34,-0.50,-1.523%,2559386177.00,United States,2023,689828,Health Care,Biotechnology: Pharmaceutical Preparations +MMA,Mixed Martial Arts Group Limited Ordinary Shares,$0.8769,-0.028,-3.094%,39926274.00,,2024,80252,Consumer Discretionary,Other Consumer Services +MMD,NYLI MacKay DefinedTerm Muni Opportunities Fund Common Shares,$15.51,0.27,1.772%,0.00,United States,2012,128146,Finance,Investment Managers +MMI,Marcus & Millichap Inc. Common Stock,$26.45,0.05,0.189%,1029502876.00,United States,2013,252033,Finance,Real Estate +MMLP,Martin Midstream Partners L.P. Limited Partnership,$2.78,-0.02,-0.714%,108573139.00,United States,2002,16358,Energy,Oil Refining/Marketing +MMM,3M Company Common Stock,$155.94,-2.11,-1.335%,82839233985.00,United States,,4323412,Health Care,Medical/Dental Instruments +MMS,Maximus Inc. Common Stock,$94.79,-2.09,-2.157%,5170659519.00,United States,1997,484975,Real Estate,Real Estate +MMSI,Merit Medical Systems Inc. Common Stock,$80.50,-1.90,-2.306%,4772864964.00,United States,,928839,Health Care,Medical/Dental Instruments +MMT,MFS Multimarket Income Trust Common Stock,$4.69,0.00,0.00%,279281550.00,United States,1987,31219,Finance,Trusts Except Educational Religious and Charitable +MMTX,Miluna Acquisition Corp Class A Ordinary Share,$9.992,0.023,0.231%,0.00,Taiwan,2025,4565,Finance,Blank Checks +MMTXU,Miluna Acquisition Corp Units,$10.11,0.04,0.397%,0.00,Taiwan,2025,802,, +MMTXW,Miluna Acquisition Corp Warrant,$0.1301,0.0001,0.077%,0.00,Taiwan,2025,1000,, +MMU,Western Asset Managed Municipals Fund Inc. Common Stock,$10.52,0.09,0.863%,0.00,United States,1992,79517,Finance,Investment Managers +MMYT,MakeMyTrip Limited Ordinary Shares,$60.27,-2.50,-3.983%,6705786234.00,India,2010,1458227,Consumer Discretionary,Transportation Services +MNDO,MIND C.T.I. Ltd. Ordinary Shares,$1.23,0.01,0.82%,25050581.00,Israel,,15627,Technology,EDP Services +MNDR,Mobile-health Network Solutions Class A Ordinary Shares,$1.16,-0.02,-1.695%,1657396.00,Singapore,2024,96649,Technology,Computer Software: Prepackaged Software +MNDY,monday.com Ltd. Ordinary Shares,$126.15,0.87,0.694%,6405056463.00,Israel,2021,1097406,Technology,Computer Software: Prepackaged Software +MNKD,MannKind Corporation Common Stock,$5.64,0.05,0.894%,1731876385.00,United States,2004,4863946,Health Care,Biotechnology: Pharmaceutical Preparations +MNOV,Medicinova Inc Common Stock,$1.79,-0.045,-2.452%,87971780.00,United States,,60529,Health Care,Biotechnology: Pharmaceutical Preparations +MNPR,Monopar Therapeutics Inc. Common Stock,$67.435,-2.855,-4.062%,450640052.00,United States,2019,310168,Health Care,Biotechnology: Pharmaceutical Preparations +MNR,Mach Natural Resources LP Common Units representing Limited Partner Interests,$11.40,-0.12,-1.042%,1920020045.00,United States,2023,176254,Energy,Oil & Gas Production +MNRO,Monro Inc. Common Stock,$20.05,0.02,0.10%,601894183.00,United States,1991,1689742,Consumer Discretionary,Automotive Aftermarket +MNSB,MainStreet Bancshares Inc. Common Stock,$20.75,0.14,0.679%,159890598.00,United States,,62150,Finance,Major Banks +MNSBP,MainStreet Bancshares Inc. Depositary Shares,$25.0001,0.2001,0.807%,192640046.00,United States,,253,Finance,Major Banks +MNSO,MINISO Group Holding Limited American Depositary Shares each representing four Ordinary Shares,$18.88,0.11,0.586%,5899395047.00,China,2020,382485,Consumer Discretionary,Department/Specialty Retail Stores +MNST,Monster Beverage Corporation,$80.92,-0.49,-0.602%,79060556799.00,United States,,4329249,Consumer Staples,Beverages (Production/Distribution) +MNTK,Montauk Renewables Inc. Common Stock,$1.65,0.22,15.385%,234723418.00,United States,2021,8962713,Utilities,Natural Gas Distribution +MNTN,MNTN Inc. Class A Common Stock,$9.77,-0.13,-1.313%,715391416.00,United States,2025,477718,Consumer Discretionary,Advertising +MNTS,Momentus Inc. Class A Common Stock,$8.11,0.26,3.312%,11331122.00,United States,2019,468763,Industrials,Military/Government/Technical +MNTSW,Momentus Inc. Warrant,$0.0184,0.001,5.747%,25708.00,United States,2019,221999,Industrials,Military/Government/Technical +MNY,MoneyHero Limited Class A Ordinary Shares,$1.23,-0.01,-0.806%,53140958.00,Singapore,,18421,Real Estate,Real Estate +MNYWW,MoneyHero Limited Warrants,$0.0505,-0.0195,-27.857%,2181804.00,Singapore,,110,Real Estate,Real Estate +MO,Altria Group Inc.,$63.13,-0.49,-0.77%,105974535078.00,United States,,11620056,Health Care, Medicinal Chemicals and Botanical Products +MOB,Mobilicom Limited Ordinary Shares,$8.70,-0.56,-6.048%,86475120.00,Israel,2022,596159,Industrials,Aerospace +MOBBW,Mobilicom Limited Warrants,$4.25,-0.47,-9.958%,42243593.00,Israel,2022,2284,Industrials,Aerospace +MOBX,Mobix Labs Inc. Class A Common Stock,$0.2301,0.0071,3.184%,15258606.00,United States,2021,2918268,Technology,Semiconductors +MOBXW,Mobix Labs Inc Warrants,$0.07,-0.0002,-0.285%,4641905.00,United States,2021,2000,Technology,Semiconductors +MOD,Modine Manufacturing Company Common Stock,$146.90,0.00,0.00%,7734074639.00,United States,,1286910,Consumer Discretionary,Auto Parts:O.E.M. +MODD,Modular Medical Inc. Common Stock,$0.4378,-0.0308,-6.573%,34006701.00,United States,,150858,Health Care,Medical/Dental Instruments +MOFG,MidWestOne Financial Gp Common Stock,$44.88,-0.57,-1.254%,925998269.00,United States,,103178,Finance,Major Banks +MOGU,MOGU Inc. American Depositary Shares (each representing 25 Class A Ordinary Shares),$1.95,-0.0001,-0.005%,15938600.00,,2018,1146,Real Estate,Real Estate +MOH,Molina Healthcare Inc Common Stock,$187.00,2.88,1.564%,9611800000.00,United States,2003,1746911,Health Care,Medical Specialities +MOLN,Molecular Partners AG American Depositary Shares,$4.155,0.155,3.875%,167708660.00,Switzerland,2021,6966,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MOMO,Hello Group Inc. American Depositary Shares,$6.96,-0.03,-0.429%,1118259497.00,China,2014,793192,Technology,Computer Software: Prepackaged Software +MORN,Morningstar Inc. Common Stock,$204.60,1.38,0.679%,8415033911.00,United States,2005,328103,Finance,Investment Managers +MOS,Mosaic Company (The) Common Stock,$28.14,-0.30,-1.055%,8931857659.00,United States,,5322825,Industrials,Agricultural Chemicals +MOV,Movado Group Inc. Common Stock,$22.28,-0.35,-1.547%,493233615.00,United States,,135785,Consumer Discretionary,Consumer Specialties +MOVE,Movano Inc. Common Stock,$18.26,-2.26,-11.014%,16607214.00,United States,2021,547919,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +MP,MP Materials Corp. Common Stock,$67.01,0.28,0.42%,11876214666.00,United States,2020,9246012,Basic Materials,Metal Mining +MPA,Blackrock MuniYield Pennsylvania Quality Fund Common Stock,$11.40,0.05,0.441%,0.00,United States,1992,19244,Finance,Finance Companies +MPAA,Motorcar Parts of America Inc. Common Stock,$12.78,-0.11,-0.853%,249951432.00,United States,,87478,Consumer Discretionary,Auto Parts:O.E.M. +MPB,Mid Penn Bancorp Common Stock,$31.52,-0.01,-0.032%,726488594.00,United States,,99821,Finance,Major Banks +MPC,Marathon Petroleum Corporation Common Stock,$172.01,0.22,0.128%,51706632413.00,United States,,1691272,Energy,Integrated oil Companies +MPLT,MapLight Therapeutics Inc. Common Stock,$18.86,-0.29,-1.514%,855735402.00,United States,2025,172783,Health Care,Biotechnology: Pharmaceutical Preparations +MPLX,MPLX LP Common Units Representing Limited Partner Interests,$55.75,0.02,0.036%,56701382224.00,United States,2012,1416911,Energy,Natural Gas Distribution +MPTI,M-tron Industries Inc. Common Stock,$61.97,-0.28,-0.45%,181559582.00,United States,2022,33792,Technology,Industrial Machinery/Components +MPU,Mega Matrix Inc. Class A Ordinary Shares,$0.70,-0.1317,-15.835%,47470593.00,United States,1998,167387,Consumer Discretionary,Diversified Commercial Services +MPV,Barings Participation Investors Common Stock,$19.405,-0.095,-0.487%,205725989.00,United States,1988,11531,Finance,Finance Companies +MPW,Medical Properties Trust Inc. common stock,$5.00,-0.11,-2.153%,3007500000.00,United States,2005,6541140,Real Estate,Real Estate Investment Trusts +MPWR,Monolithic Power Systems Inc. Common Stock,$1161.78,66.29,6.051%,55657394460.00,United States,2004,668070,Technology,Semiconductors +MPX,Marine Products Corporation Common Stock,$9.44,-0.26,-2.68%,330390881.00,United States,2001,17688,Industrials,Marine Transportation +MQ,Marqeta Inc. Class A Common Stock,$4.31,-0.02,-0.462%,1896827755.00,United States,2021,3300769,Technology,Computer Software: Prepackaged Software +MQT,Blackrock MuniYield Quality Fund II Inc. Common Stock,$10.17,0.10,0.993%,1512914330.00,United States,1992,85238,Finance,Investment Bankers/Brokers/Service +MQY,Blackrock MuniYield Quality Fund Inc. Common Stock,$11.67,0.08,0.69%,1736058037.00,United States,1992,269167,Finance,Investment Bankers/Brokers/Service +MRAM,Everspin Technologies Inc. Common Stock,$13.11,-0.92,-6.557%,299648899.00,United States,2016,939143,Technology,Semiconductors +MRBK,Meridian Corporation Common Stock,$18.26,-0.06,-0.328%,210308747.00,United States,2017,36784,Finance,Major Banks +MRCC,Monroe Capital Corporation Common Stock,$6.59,-0.03,-0.453%,142781181.00,United States,2012,50217,Finance,Investment Managers +MRCY,Mercury Systems Inc Common Stock,$100.02,-1.02,-1.01%,6011215603.00,United States,1998,443087,Technology,Electrical Products +MREO,Mereo BioPharma Group plc American Depositary Shares,$0.449,-0.0229,-4.853%,69660378.00,United Kingdom,,6424586,Health Care,Biotechnology: Pharmaceutical Preparations +MRK,Merck & Company Inc. Common Stock (new),$106.90,-1.02,-0.945%,265328209098.00,United States,,7491691,Health Care,Biotechnology: Pharmaceutical Preparations +MRKR,Marker Therapeutics Inc. Common Stock,$1.63,-0.17,-9.444%,27177197.00,United States,,418341,Health Care,Biotechnology: Pharmaceutical Preparations +MRM,MEDIROM Healthcare Technologies Inc. American Depositary Share,$1.67,0.00,0.00%,13196257.00,Japan,2020,26040,Consumer Discretionary,Other Consumer Services +MRNA,Moderna Inc. Common Stock,$45.30,-0.15,-0.33%,17697781894.00,United States,2018,10617253,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +MRNO,Murano Global Investments PLC Ordinary Shares,$1.80,0.44,32.353%,142750325.00,Mexico,,67645891,Consumer Discretionary,Hotels/Resorts +MRNOW,Murano Global Investments PLC Warrants,$0.132,0.0596,82.32%,10468357.00,Mexico,,472025,Consumer Discretionary,Hotels/Resorts +MRP,Millrose Properties Inc. Class A Common Stock,$29.56,-0.25,-0.839%,4907063371.00,United States,2025,948016,Finance,Real Estate +MRSH,Marsh Common Stock,$178.18,-1.00,-0.558%,87292107317.00,United States,,4118265,Finance,Specialty Insurers +MRT,Marti Technologies Inc. Class A Ordinary Shares,$2.04,0.03,1.493%,160565289.00,,2021,41904,Consumer Discretionary,Rental/Leasing Companies +MRTN,Marten Transport Ltd. Common Stock,$12.46,0.00,0.00%,1015744483.00,United States,1986,1502939,Industrials,Trucking Freight/Courier Services +MRVI,Maravai LifeSciences Holdings Inc. Class A Common Stock,$3.42,-0.38,-10.00%,874517362.00,United States,2020,1060859,Health Care,Biotechnology: Pharmaceutical Preparations +MRVL,Marvell Technology Inc. Common Stock,$83.62,0.69,0.832%,70918122000.00,United States,2000,10310998,Technology,Semiconductors +MRX,Marex Group plc Ordinary Shares,$38.94,-0.14,-0.358%,2791994963.00,United Kingdom,2024,591793,Finance,Investment Bankers/Brokers/Service +MS,Morgan Stanley Common Stock,$182.34,-0.32,-0.175%,289794659768.00,United States,,5538764,Finance,Investment Bankers/Brokers/Service +MS^A,Morgan Stanley Dep Shs repstg 1/1000 Pfd Ser A,$20.34,-0.02,-0.098%,,United States,,82275,, +MS^E,Morgan Stanley DEPOSITARY SHARES REP 1/1000TH SHARES FIXED/FLTG PREFERRED STOCK SERIES E,$25.53,0.00,0.00%,,United States,,43747,, +MS^F,Morgan Stanley Dep Shs Rpstg 1/1000th Int Prd Ser F Fxd to Flag,$25.25,0.01,0.04%,,United States,,36340,, +MS^I,Morgan Stanley Depository Shares Representing 1/1000th Preferred Series 1 Fixed to Floating Non (Cum),$25.22,-0.08,-0.316%,,United States,,73156,, +MS^K,Morgan Stanley Depositary Shares each representing 1/1000th of a share of Fixed-to-Floating Rate Non-Cumulative Preferred Stock Series K,$24.77,-0.08,-0.322%,,United States,,87528,, +MS^L,Morgan Stanley Depositary Shares each representing 1/1000th of a share of 4.875% Non-Cumulative Preferred Stock Series L,$21.08,-0.08,-0.378%,,United States,,14370,, +MS^O,Morgan Stanley Depositary Shares each representing 1/1000th of a share of 4.250% Non-Cumulative Preferred Stock Series O,$18.01,-0.05,-0.277%,,United States,,104508,, +MS^P,Morgan Stanley Depositary Shares each representing 1/1000th of a share of 6.500% Non-Cumulative Preferred Stock Series P,$25.55,-0.01,-0.039%,,United States,,39303,, +MS^Q,Morgan Stanley Depositary Shares each representing 1/1000th of a share of 6.625% Non-Cumulative Preferred Stock Series Q,$26.27,-0.04,-0.152%,,United States,,22299,, +MSA,MSA Safety Incorporated Common Stock,$175.78,-4.42,-2.453%,6882149283.00,United States,2000,288670,Health Care,Industrial Specialties +MSAI,MultiSensor AI Holdings Inc. Common Stock,$0.32,0.0033,1.042%,25642682.00,United States,2021,2449135,Technology,Electronic Components +MSAIW,MultiSensor AI Holdings Inc. Warrant,$0.0498,0.0006,1.22%,3990642.00,United States,2021,44130,Technology,Electronic Components +MSB,Mesabi Trust Common Stock,$33.91,-0.23,-0.674%,444899539.00,United States,,36831,Industrials,Precious Metals +MSBI,Midland States Bancorp Inc. Common Stock,$22.86,-0.17,-0.738%,492672342.00,United States,2016,292891,Finance,Major Banks +MSBIP,Midland States Bancorp Inc. Depositary Shares Each Representing a 1/40th Interest in a Share of 7.750% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series A,$25.31,0.08,0.317%,545474059.00,United States,,3058,Finance,Major Banks +MSC,Studio City International Holdings Limited American depositary shares each representing four Class A ordinary shares,$3.18,-0.0591,-1.825%,670077246.00,,2018,1538,Consumer Discretionary,Hotels/Resorts +MSCI,MSCI Inc. Common Stock,$614.87,33.12,5.693%,46201048345.00,United States,,995586,Real Estate,Real Estate +MSD,Morgan Stanley Emerging Markets Debt Fund Inc. Common Stock,$7.64,0.01,0.131%,0.00,United States,1993,95695,Finance,Trusts Except Educational Religious and Charitable +MSDL,Morgan Stanley Direct Lending Fund Common Stock,$16.23,-0.14,-0.855%,0.00,United States,2024,825462,, +MSEX,Middlesex Water Company Common Stock,$51.62,-1.00,-1.90%,946598217.00,United States,,106787,Utilities,Water Supply +MSFT,Microsoft Corporation Common Stock,$481.63,1.05,0.218%,3579656049978.00,United States,1986,36875403,Technology,Computer Software: Prepackaged Software +MSGE,Madison Square Garden Entertainment Corp. Class A Common Stock,$60.16,-0.57,-0.939%,2841459493.00,United States,2023,268655,Consumer Discretionary,Services-Misc. Amusement & Recreation +MSGM,Motorsport Games Inc. Class A Common Stock,$4.42,0.20,4.739%,25540749.00,United States,2021,102439,Technology,Computer Software: Prepackaged Software +MSGS,Madison Square Garden Sports Corp. Class A Common Stock (New),$286.05,2.22,0.782%,6882193372.00,United States,2015,158815,Consumer Discretionary,Services-Misc. Amusement & Recreation +MSGY,Masonglory Limited Ordinary Shares,$2.05,-4.21,-67.252%,28700000.00,Hong Kong,2025,12506621,, +MSI,Motorola Solutions Inc. Common Stock,$405.08,-1.00,-0.246%,67468098590.00,United States,,1249615,Technology,Radio And Television Broadcasting And Communications Equipment +MSIF,MSC Income Fund Inc. Common Stock,$13.44,0.04,0.299%,630480117.00,,2025,235955,Finance,Finance/Investors Services +MSM,MSC Industrial Direct Company Inc. Common Stock,$83.48,-0.11,-0.132%,4658460068.00,United States,1995,405097,Industrials,Industrial Machinery/Components +MSN,Emerson Radio Corporation Common Stock,$0.397,0.0077,1.978%,8353933.00,United States,1994,15668,Consumer Staples,Consumer Electronics/Appliances +MSS,Maison Solutions Inc. Class A Common Stock,$0.286,0.011,4.00%,7215680.00,United States,2023,114810,Consumer Staples,Food Chains +MSTR,Strategy Inc Common Stock Class A,$158.45,-3.13,-1.937%,45531199311.00,United States,1998,14082562,Technology,Computer Software: Prepackaged Software +MSW,Ming Shing Group Holdings Limited Ordinary Shares,$1.13,-0.18,-13.74%,14661750.00,Hong Kong,2024,54370,Consumer Discretionary,Engineering & Construction +MT,Arcelor Mittal NY Registry Shares NEW,$56.04,0.57,1.028%,43069352697.00,Luxembourg,,1489905,Industrials,Steel/Iron Ore +MTA,Metalla Royalty & Streaming Ltd. Common Shares,$8.65,0.10,1.17%,800655989.00,,,798089,Basic Materials,Precious Metals +MTB,M&T Bank Corporation Common Stock,$216.89,-0.60,-0.276%,33333993491.00,United States,,1262683,Finance,Major Banks +MTB^H,M&T Bank Corporation Perpetual Fixed-to-Floating Rate Non-Cumulative Preferred Stock Series H,$25.07,0.07,0.28%,,United States,,16570,, +MTB^J,M&T Bank Corporation Depositary Shares each representing a 1/400th ownership interest in a share of Perpetual 7.500% Non-Cumulative Preferred Stock Series J,$26.76,0.00,0.00%,,United States,,43230,, +MTB^K,M&T Bank Corporation Depositary Shares each representing a 1/400th interest in a share of Perpetual 6.350% Non-Cumulative Preferred Stock Series K,$25.18,-0.05,-0.198%,,United States,,58757,, +MTC,MMTec Inc. Common Shares,$2.86,0.03,1.06%,72034431.00,China,2019,13779,Technology,Computer Software: Prepackaged Software +MTCH,Match Group Inc. Common Stock,$31.365,-0.355,-1.119%,7404341478.00,United States,,2952139,Technology,Computer Software: Programming Data Processing +MTD,Mettler-Toledo International Inc. Common Stock,$1401.64,-23.54,-1.652%,28633325650.00,Switzerland,1997,109022,Industrials,Biotechnology: Laboratory Analytical Instruments +MTDR,Matador Resources Company Common Stock,$43.96,0.62,1.431%,5462938741.00,United States,2012,1526395,Energy,Oil & Gas Production +MTEK,Maris-Tech Ltd. Ordinary Shares,$1.69,-0.03,-1.744%,13492225.00,Israel,2022,94920,Telecommunications,Telecommunications Equipment +MTEKW,Maris-Tech Ltd. Warrants,$0.2101,-0.0019,-0.896%,1677347.00,Israel,2022,24766,Telecommunications,Telecommunications Equipment +MTEN,Mingteng International Corporation Inc. Class A Ordinary Shares,$2.67,-0.31,-10.403%,3263087.00,China,2024,469201,Industrials,Building Products +MTEX,Mannatech Incorporated Common Stock,$7.69,0.05,0.654%,14618152.00,United States,,16857,Health Care, Medicinal Chemicals and Botanical Products +MTG,MGIC Investment Corporation Common Stock,$26.43,-0.06,-0.227%,5913474128.00,United States,1991,2511257,Finance,Property-Casualty Insurers +MTH,Meritage Homes Corporation Common Stock,$69.18,-0.39,-0.561%,4870735990.00,United States,,1512262,Consumer Discretionary,Homebuilding +MTLS,Materialise NV American Depositary Shares,$5.61,-0.115,-2.009%,331366913.00,Belgium,2014,91831,Technology,Computer Software: Prepackaged Software +MTN,Vail Resorts Inc. Common Stock,$132.97,-0.53,-0.397%,4757078208.00,United States,1997,814864,Consumer Discretionary,Services-Misc. Amusement & Recreation +MTNB,Matinas Biopharma Holdings Inc. Common Stock,$0.68,-0.04,-5.556%,4356210.00,United States,2017,12257,Health Care,Biotechnology: Pharmaceutical Preparations +MTR,Mesa Royalty Trust Common Stock,$5.02,0.05,1.006%,9355222.00,United States,,9867,Energy,Oil & Gas Production +MTRN,Materion Corporation,$135.22,0.58,0.431%,2295747987.00,United States,,244101,Industrials,Industrial Specialties +MTRX,Matrix Service Company Common Stock,$13.87,-0.04,-0.288%,390087189.00,United States,1990,183449,Consumer Discretionary,Engineering & Construction +MTSI,MACOM Technology Solutions Holdings Inc. Common Stock,$226.25,7.05,3.216%,16971214089.00,United States,2012,1021091,Technology,Semiconductors +MTUS,Metallus Inc. Common Shares,$19.26,-0.38,-1.935%,802155772.00,United States,2014,253757,Industrials,Steel/Iron Ore +MTVA,MetaVia Inc. Common Stock,$2.34,-0.26,-10.00%,18789154.00,United States,2016,316372,Health Care,Biotechnology: Pharmaceutical Preparations +MTW,Manitowoc Company Inc. (The) Common Stock,$12.70,-0.40,-3.053%,450480963.00,United States,,222147,Industrials,Construction/Ag Equipment/Trucks +MTX,Minerals Technologies Inc. Common Stock,$66.27,-0.87,-1.296%,2063270591.00,United States,1992,277957,Basic Materials,Major Chemicals +MTZ,MasTec Inc. Common Stock,$244.75,-3.84,-1.545%,19311002618.00,United States,,670642,Industrials,Water Sewer Pipeline Comm & Power Line Construction +MU,Micron Technology Inc. Common Stock,$435.28,25.04,6.104%,489911671128.00,United States,,42725675,Technology,Semiconductors +MUA,Blackrock MuniAssets Fund Inc Common Stock,$11.07,0.05,0.454%,1646800554.00,United States,1993,81419,Finance,Investment Bankers/Brokers/Service +MUC,Blackrock MuniHoldings California Quality Fund Inc. Common Stock,$10.99,0.12,1.104%,1634899556.00,United States,1998,259633,Finance,Investment Bankers/Brokers/Service +MUE,Blackrock MuniHoldings Quality Fund II Inc. Common Stock,$10.14,0.09,0.896%,1508451456.00,United States,,32188,Finance,Investment Bankers/Brokers/Service +MUFG,Mitsubishi UFJ Financial Group Inc. Common Stock,$17.95,-0.20,-1.102%,213025411014.00,Japan,,3085574,Finance,Commercial Banks +MUJ,Blackrock MuniHoldings New Jersey Quality Fund Inc. Common Stock,$12.17,0.05,0.413%,1810439272.00,United States,1998,108902,Finance,Investment Bankers/Brokers/Service +MUR,Murphy Oil Corporation Common Stock,$31.42,-0.39,-1.226%,4484853379.00,United States,,4300554,Energy,Oil & Gas Production +MUSA,Murphy USA Inc. Common Stock,$421.74,-4.84,-1.135%,7901065678.00,United States,2013,231000,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +MUX,McEwen Inc. Common Stock,$29.05,1.08,3.861%,1588903026.00,Canada,,2856509,Basic Materials,Precious Metals +MVBF,MVB Financial Corp. Common Stock,$27.33,-1.05,-3.70%,343929848.00,United States,,41865,Finance,Major Banks +MVF,Blackrock MuniVest Fund Inc. Common Stock,$6.96,0.03,0.433%,1035386798.00,United States,1988,126645,Finance,Investment Bankers/Brokers/Service +MVIS,MicroVision Inc. Common Stock,$0.9186,0.0062,0.68%,280537931.00,United States,1996,3685839,Technology,Industrial Machinery/Components +MVO,MV Oil Trust Units of Beneficial Interests,$1.39,-0.21,-13.125%,15985000.00,United States,2007,261871,Energy,Oil & Gas Production +MVST,Microvast Holdings Inc. Common Stock,$2.79,-0.06,-2.105%,915630107.00,United States,2019,2947931,Miscellaneous,Industrial Machinery/Components +MVSTW,Microvast Holdings Inc. Warrants,$0.0987,-0.0043,-4.175%,32391646.00,United States,2019,44390,Miscellaneous,Industrial Machinery/Components +MVT,Blackrock MuniVest Fund II Inc. Common Stock,$10.81,0.07,0.652%,1608122312.00,United States,1993,24253,Finance,Investment Bankers/Brokers/Service +MWA,MUELLER WATER PRODUCTS Common Stock,$26.71,-0.23,-0.854%,4176086064.00,United States,2006,987233,Industrials,Metal Fabrications +MWG,Multi Ways Holdings Limited Class A Ordinary Shares,$0.2343,0.0071,3.125%,12026619.00,,2023,66256,Consumer Discretionary,Miscellaneous manufacturing industries +MWYN,Marwynn Holdings Inc. Common stock,$0.894,-0.0023,-0.257%,18054155.00,United States,2025,8718,Consumer Discretionary,Food Distributors +MX,Magnachip Semiconductor Corporation Common Stock,$3.00,-0.03,-0.99%,107945469.00,Luxembourg,2011,185448,Technology,Semiconductors +MXC,Mexco Energy Corporation Common Stock,$11.47,0.37,3.333%,23467620.00,United States,2003,8157,Energy,Oil & Gas Production +MXCT,MaxCyte Inc. Common Stock,$1.01,-0.06,-5.607%,107740751.00,United States,2021,1805565,Health Care,Biotechnology: Commercial Physical & Biological Resarch +MXE,Mexico Equity and Income Fund Inc. (The) Common Stock,$13.70,0.29,2.163%,0.00,United States,,18286,Finance,Finance Companies +MXF,Mexico Fund Inc. (The) Common Stock,$21.97,0.24,1.104%,0.00,United States,,71173,Finance,Trusts Except Educational Religious and Charitable +MXL,MaxLinear Inc. Common Stock,$19.14,0.30,1.592%,1672316043.00,United States,2010,1302289,Technology,Semiconductors +MYD,Blackrock MuniYield Fund Inc. Common Stock,$10.67,0.14,1.33%,1587295566.00,United States,1991,205954,Finance,Investment Bankers/Brokers/Service +MYE,Myers Industries Inc. Common Stock,$20.10,-0.53,-2.569%,751899092.00,United States,1983,401753,Industrials,Plastic Products +MYFW,First Western Financial Inc. Common Stock,$24.60,-0.48,-1.914%,238981891.00,United States,2018,26834,Finance,Major Banks +MYGN,Myriad Genetics Inc. Common Stock,$5.72,-0.20,-3.378%,533182490.00,United States,1995,668879,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +MYI,Blackrock MuniYield Quality Fund III Inc Common Stock,$11.11,0.06,0.543%,1652751053.00,United States,,155980,Finance,Investment Bankers/Brokers/Service +MYN,Blackrock MuniYield New York Quality Fund Inc.Common Stock,$9.96,0.00,0.00%,0.00,United States,1992,47724,Finance,Finance Companies +MYND,Mynd.ai Inc. American Depositary Shares,$0.485,-0.005,-1.02%,22139174.00,,2017,13800,Real Estate,Other Consumer Services +MYNZ,Mainz Biomed N.V. Ordinary Shares,$1.19,-0.03,-2.459%,10781569.00,Germany,2021,170415,Health Care,Biotechnology: Pharmaceutical Preparations +MYO,Myomo Inc. Common Stock,$0.8628,-0.0772,-8.213%,33162170.00,United States,2017,979326,Health Care,Industrial Specialties +MYPS,PLAYSTUDIOS Inc. Class A Common Stock,$0.5787,-0.0713,-10.969%,72976365.00,United States,2020,286386,Technology,Computer Software: Prepackaged Software +MYPSW,PLAYSTUDIOS Inc. Warrant,$0.0078,0.00,0.00%,983611.00,United States,2020,80,Technology,Computer Software: Prepackaged Software +MYRG,MYR Group Inc. Common Stock,$251.55,-1.53,-0.605%,3904768893.00,United States,2008,157678,Industrials,Water Sewer Pipeline Comm & Power Line Construction +MYSE,Myseum Inc. Common Stock,$1.95,-0.01,-0.51%,8315442.00,United States,2021,61514,Telecommunications,Telecommunications Equipment +MYSEW,Myseum Inc. Series A Warrant,$0.08,-0.02,-20.00%,341146.00,United States,2021,250,Telecommunications,Telecommunications Equipment +MYSZ,My Size Inc. Common Stock,$0.829,-0.0309,-3.593%,3190804.00,Israel,,180314,Technology,Computer Software: Prepackaged Software +MZTI,The Marzetti Company Common Stock,$166.28,-1.36,-0.811%,4570372080.00,United States,,123447,Consumer Staples,Packaged Foods +NA,Nano Labs Ltd Class A Ordinary Shares,$3.67,-0.06,-1.609%,86508627.00,China,2022,24491,Technology,Semiconductors +NAAS,NaaS Technology Inc. American Depositary Shares,$3.07,0.00,0.00%,7170099.00,China,2017,1126,Consumer Discretionary,Other Specialty Stores +NABL,N-able Inc. Common Stock,$6.40,-0.18,-2.736%,1192509459.00,United States,2021,728035,Technology,Computer Software: Prepackaged Software +NAC,Nuveen California Quality Municipal Income Fund,$11.85,0.01,0.084%,0.00,United States,1999,441546,Finance,Investment Managers +NAD,Nuveen Quality Municipal Income Fund Common Stock,$12.05,-0.01,-0.083%,0.00,United States,1999,817931,Finance,Investment Managers +NAGE,Niagen Bioscience Inc. Common Stock,$6.03,-0.21,-3.365%,481231018.00,United States,,575086,Health Care, Medicinal Chemicals and Botanical Products +NAII,Natural Alternatives International Inc. Common Stock,$4.04,0.09,2.278%,13445637.00,United States,,9500,Health Care, Medicinal Chemicals and Botanical Products +NAK,Northern Dynasty Minerals Ltd. Common Stock,$2.46,-0.05,-1.992%,1359232809.00,Canada,,17248918,Basic Materials,Precious Metals +NAKA,Nakamoto Inc. Common Stock,$0.3873,-0.0035,-0.896%,170354249.00,United States,2024,2994444,Health Care,Medical/Nursing Services +NAMI,Jinxin Technology Holding Company American Depositary Shares,$0.60,0.00,0.00%,47442847.00,China,2024,10307,Real Estate,Other Consumer Services +NAMM,Namib Minerals Ordinary Shares,$6.40,1.69,35.881%,343535546.00,Cayman Islands,,34179243,Basic Materials,Precious Metals +NAMMW,Namib Minerals Warrants,$0.43,0.0805,23.033%,23081294.00,Cayman Islands,,932310,Basic Materials,Precious Metals +NAMS,NewAmsterdam Pharma Company N.V. Ordinary Shares,$31.88,-0.75,-2.298%,3614898832.00,Netherlands,,512822,Health Care,Biotechnology: Pharmaceutical Preparations +NAMSW,NewAmsterdam Pharma Company N.V. Warrant,$20.03,-2.85,-12.456%,2271217804.00,Netherlands,,267,Health Care,Biotechnology: Pharmaceutical Preparations +NAN,Nuveen New York Quality Municipal Income Fund Common Stock,$11.40,0.07,0.618%,3446400120.00,United States,1999,119208,Finance,Investment Managers +NAT,Nordic American Tankers Limited Common Stock,$4.19,0.09,2.195%,887235278.00,Bermuda,1995,2802673,Consumer Discretionary,Marine Transportation +NATH,Nathan's Famous Inc. Common Stock,$101.21,-0.01,-0.01%,413899307.00,United States,1993,49291,Consumer Discretionary,Restaurants +NATL,NCR Atleos Corporation Common Stock,$36.25,-0.04,-0.11%,2679024930.00,United States,2023,270715,Miscellaneous,Office Equipment/Supplies/Services +NATR,Nature's Sunshine Products Inc. Common Stock,$24.10,0.05,0.208%,421643068.00,United States,,121316,Health Care,Biotechnology: Pharmaceutical Preparations +NAUT,Nautilus Biotechnology Inc. Common Stock,$2.06,-0.17,-7.623%,260188551.00,United States,2020,217114,Industrials,Biotechnology: Laboratory Analytical Instruments +NAVI,Navient Corporation Common Stock,$9.81,-2.23,-18.522%,956540776.00,United States,,2647147,Finance,Investment Bankers/Brokers/Service +NAVN,Navan Inc. Class A Common Stock,$13.57,-0.76,-5.304%,3374099962.00,United States,2025,1706687,Technology,Computer Software: Prepackaged Software +NAZ,Nuveen Arizona Quality Municipal Income Fund Common Stock,$12.005,-0.03,-0.249%,0.00,United States,1992,18046,Finance,Finance/Investors Services +NB,NioCorp Developments Ltd. Common Stock,$7.30,-0.09,-1.218%,897689556.00,United States,,5955283,Basic Materials,Metal Mining +NBB,Nuveen Taxable Municipal Income Fund Common Shares of Beneficial Interest,$15.74,-0.07,-0.443%,0.00,United States,2010,97296,Finance,Finance Companies +NBBK,NB Bancorp Inc. Common Stock,$21.11,0.10,0.476%,840736275.00,United States,2023,1104901,Finance,Banks +NBH,Neuberger Municipal Fund Inc. Common Stock,$10.40,0.11,1.069%,0.00,United States,2002,81493,Finance,Finance/Investors Services +NBHC,National Bank Holdings Corporation Common Stock,$39.86,-0.20,-0.499%,1519943832.00,United States,2012,1156004,Finance,Major Banks +NBIS,Nebius Group N.V. Class A Ordinary Shares,$100.43,2.56,2.616%,23913269897.00,Netherlands,2011,11834114,Technology,Computer Software: Programming Data Processing +NBIX,Neurocrine Biosciences Inc. Common Stock,$134.66,0.77,0.575%,13426369293.00,United States,1996,934771,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +NBN,Northeast Bank Common Stock,$114.29,4.25,3.862%,929177700.00,United States,,117597,Finance,Major Banks +NBP,NovaBridge Biosciences American Depositary Shares,$3.87,-0.11,-2.764%,445025526.00,China,2020,391459,Health Care,Biotechnology: Pharmaceutical Preparations +NBR,Nabors Industries Ltd.,$66.07,-1.19,-1.769%,962056568.00,Bermuda,1951,241278,Energy,Oil & Gas Production +NBTB,NBT Bancorp Inc. Common Stock,$42.62,-0.80,-1.842%,2229673526.00,United States,,555096,Finance,Major Banks +NBTX,Nanobiotix S.A. American Depositary Shares,$22.42,-0.105,-0.466%,1063309999.00,France,2020,14026,Health Care,Biotechnology: Pharmaceutical Preparations +NBXG,Neuberger Next Generation Connectivity Fund Inc. Common Stock,$14.45,0.03,0.208%,0.00,United States,2021,181432,Finance,Trusts Except Educational Religious and Charitable +NBY,NovaBay Pharmaceuticals Inc. Common Stock,$2.00,-0.37,-15.612%,252347300.00,United States,2007,2866205,Health Care,Biotechnology: Pharmaceutical Preparations +NC,NACCO Industries Inc. Common Stock,$47.75,-0.81,-1.668%,356212851.00,United States,,12425,Energy,Coal Mining +NCA,Nuveen California Municipal Value Fund,$9.48,0.00,0.00%,0.00,United States,,42510,Finance,Investment Managers +NCDL,Nuveen Churchill Direct Lending Corp. Common Stock,$13.38,-0.04,-0.298%,660798930.00,United States,2024,226296,, +NCEL,NewcelX Ltd. Ordinary Shares,$2.64,-0.14,-5.036%,12034118.00,Switzerland,2021,40124,Health Care,Biotechnology: Pharmaceutical Preparations +NCEW,New Century Logistics (BVI) Limited Ordinary Shares,$7.31,-0.29,-3.816%,19645625.00,Hong Kong,2024,31310,Industrials,Integrated Freight & Logistics +NCI,Neo-Concept International Group Holdings Limited Class A Ordinary Shares,$1.1321,0.0421,3.862%,4600854.00,Hong Kong,2024,14644,Consumer Discretionary,Apparel +NCL,Northann Corp. Common Stock,$0.201,0.001,0.50%,4571364.00,,2023,310492,Industrials,Plastic Products +NCLH,Norwegian Cruise Line Holdings Ltd. Ordinary Shares,$20.79,-0.07,-0.336%,9464803196.00,United States,,21764491,Consumer Discretionary,Marine Transportation +NCMI,National CineMedia Inc. Common Stock,$3.61,-0.12,-3.217%,338730513.00,United States,2007,403005,Consumer Discretionary,Advertising +NCNA,NuCana plc American Depositary Share,$2.95,0.00,0.00%,5629125.00,United Kingdom,2017,51082,Health Care,Biotechnology: Pharmaceutical Preparations +NCNO,nCino Inc. Common Stock,$23.23,-0.50,-2.107%,2664131807.00,United States,2020,1671003,Technology,Computer Software: Prepackaged Software +NCPL,Netcapital Inc. Common Stock,$0.7779,0.0079,1.026%,5342539.00,United States,,425214,Finance,Finance: Consumer Services +NCPLW,Netcapital Inc. Warrants,$0.0374,-0.0015,-3.856%,256859.00,United States,,501,Finance,Finance: Consumer Services +NCRA,Nocera Inc. Common Stock,$0.587,-0.0116,-1.938%,8437313.00,Taiwan,,31662,Consumer Staples,Farming/Seeds/Milling +NCSM,NCS Multistage Holdings Inc. Common Stock,$40.26,0.00,0.00%,102297439.00,United States,2017,2304,Energy,Oilfield Services/Equipment +NCT,Intercont (Cayman) Limited Class A Ordinary shares,$0.2103,-0.0097,-4.409%,6165044.00,China,2025,59702,Consumer Discretionary,Restaurants +NCTY,The9 Limited American Depository Shares,$6.84,-0.03,-0.437%,96186693.00,China,2004,81284,Finance,Finance: Consumer Services +NCV,Virtus Convertible & Income Fund Common Shares of Beneficial Interest,$16.18,0.16,0.999%,1462244346.00,United States,2003,144465,Finance,Finance Companies +NCV^A,Virtus Convertible & Income Fund 5.625% Series A Cumulative Preferred Shares,$21.31,0.01,0.047%,,United States,,3552,, +NCZ,Virtus Convertible & Income Fund II Common Shares of Beneficial Interest,$14.60,0.10,0.69%,1111289935.00,United States,2003,109054,Finance,Finance Companies +NCZ^A,Virtus Convertible & Income Fund II 5.50% Series A Cumulative Preferred Shares,$20.89,0.14,0.675%,,United States,,9352,, +NDAQ,Nasdaq Inc. Common Stock,$98.71,0.21,0.213%,56362959191.00,United States,,3929304,Finance,Investment Bankers/Brokers/Service +NDLS,Noodles & Company Class A Common Stock,$0.705,-0.0553,-7.273%,32976165.00,United States,2013,234939,Consumer Discretionary,Restaurants +NDMO,Nuveen Dynamic Municipal Opportunities Fund Common Shares of Beneficial Interest,$10.40,0.08,0.775%,618438434.00,,2020,237764,Finance,Trusts Except Educational Religious and Charitable +NDRA,ENDRA Life Sciences Inc. Common Stock,$4.56,0.31,7.294%,5318971.00,United States,2017,11097,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +NDSN,Nordson Corporation Common Stock,$271.94,-1.34,-0.49%,15147992386.00,United States,,342803,Industrials,Industrial Machinery/Components +NE,Noble Corporation plc A Ordinary Shares,$34.62,-0.62,-1.759%,5499273412.00,United States,2022,2460284,Energy,Oil & Gas Production +NEA,Nuveen AMT-Free Quality Municipal Income Fund Common Shares of Beneficial Interest Par Value $.01,$11.65,0.08,0.691%,0.00,United States,2002,1088756,Finance,Finance/Investors Services +NECB,NorthEast Community Bancorp Inc. Common Stock,$22.82,-0.33,-1.425%,320101617.00,United States,2021,52046,Finance,Banks +NEE,NextEra Energy Inc. Common Stock,$87.57,0.42,0.482%,182374130028.00,United States,,8200027,Technology,EDP Services +NEE^N,NextEra Energy Inc. Series N Junior Subordinated Debentures due March 1 2079,$24.15,-0.11,-0.453%,,United States,,38807,, +NEE^S,NextEra Energy Inc. 7.299% Corporate Units,$55.08,0.25,0.456%,,United States,,238368,, +NEE^T,NextEra Energy Inc. 7.234% Corporate Units,$51.89,0.32,0.621%,,United States,,8472,, +NEE^U,NextEra Energy Inc. Series U Junior Subordinated Debentures due June 1 2085,$25.71,-0.01,-0.039%,,United States,,40852,, +NEGG,Newegg Commerce Inc. Common Shares,$54.54,0.85,1.583%,1062909008.00,China,2010,66679,Consumer Discretionary,Other Specialty Stores +NEM,Newmont Corporation,$131.95,4.95,3.898%,143992150343.00,United States,,10481480,Basic Materials,Precious Metals +NEN,New England Realty Associates Limited Partnership Class A Depositary Receipts Evidencing Units of Limited Partnership,$65.0601,0.00,0.00%,183230386.00,United States,,9,Real Estate,Building operators +NEO,NeoGenomics Inc. Common Stock,$12.38,-0.09,-0.722%,1601820976.00,United States,,1140383,Health Care,Precision Instruments +NEOG,Neogen Corporation Common Stock,$10.35,0.10,0.976%,2251393903.00,United States,1989,2383462,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +NEON,Neonode Inc. Common Stock,$1.90,-0.03,-1.554%,31887552.00,Sweden,,132833,Technology,Industrial Machinery/Components +NEOV,NeoVolta Inc. Common Stock,$4.87,0.09,1.883%,186504077.00,United States,,653054,Miscellaneous,Industrial Machinery/Components +NEOVW,NeoVolta Inc. Warrant,$2.07,0.07,3.50%,79273807.00,United States,,2278,Miscellaneous,Industrial Machinery/Components +NEPH,Nephros Inc. Common Stock,$4.51,0.08,1.806%,47926340.00,United States,,21177,Health Care,Medical/Dental Instruments +NERV,Minerva Neurosciences Inc Common Stock,$4.17,-0.18,-4.138%,180454240.00,United States,2014,55083,Health Care,Biotechnology: Pharmaceutical Preparations +NESR,National Energy Services Reunited Corp Ordinary Shares,$19.30,-0.65,-3.258%,1945010749.00,United States,,1330473,Energy,Oilfield Services/Equipment +NET,Cloudflare Inc. Class A Common Stock,$184.88,-21.07,-10.231%,64759981785.00,United States,2019,8947067,Technology,Computer Software: Prepackaged Software +NEU,NewMarket Corp Common Stock,$651.55,0.42,0.065%,6122694839.00,United States,,115629,Industrials,Major Chemicals +NEUP,Neuphoria Therapeutics Inc. Common Stock,$4.01,-0.04,-0.988%,21563089.00,United States,2021,45646,Health Care,Biotechnology: Pharmaceutical Preparations +NEWP,New Pacific Metals Corp. Common Shares,$4.14,0.10,2.475%,761853953.00,Canada,2021,1395277,Basic Materials,Precious Metals +NEWT,NewtekOne Inc. Common Stock,$13.67,0.00,0.00%,394889323.00,United States,,215329,Finance,Major Banks +NEWTG,NewtekOne Inc. 8.50% Fixed Rate Senior Notes due 2029,$25.2997,-0.0396,-0.156%,665934959.00,United States,,9288,Finance,Major Banks +NEWTH,NewtekOne Inc. 8.625% Fixed Rate Senior Notes due 2029,$25.20,0.06,0.239%,0.00,United States,,6523,Finance,Major Banks +NEWTI,NewtekOne Inc. 8.00% Fixed Rate Senior Notes due 2028,$25.365,-0.05,-0.197%,667653776.00,United States,,2169,Finance,Major Banks +NEWTP,NewtekOne Inc. Depositary Shares Non-Cumulative Perpetual Preferred Stock Series B,$23.6487,-0.0513,-0.216%,683146973.00,United States,,4206,Finance,Major Banks +NEWTZ,NewtekOne Inc. 5.50% Notes Due 2026,$24.97,-0.005,-0.02%,648322229.00,United States,,777,Finance,Major Banks +NEXA,Nexa Resources S.A. Common Shares,$14.12,0.07,0.498%,1870033187.00,Luxembourg,2017,880709,Basic Materials,Metal Mining +NEXM,NexMetals Mining Corp. Common Shares,$4.19,-0.13,-3.009%,0.00,Canada,,54206,, +NEXN,Nexxen International Ltd. Ordinary Shares,$6.35,-0.18,-2.757%,416322955.00,Israel,2021,238132,Technology,Computer Software: Programming Data Processing +NEXT,NextDecade Corporation Common Stock,$5.25,0.07,1.351%,1390207392.00,United States,2015,2435326,Utilities,Oil & Gas Production +NFBK,Northfield Bancorp Inc. Common Stock (Delaware),$11.86,-0.13,-1.084%,495765731.00,United States,2007,159345,Finance,Savings Institutions +NFE,New Fortress Energy Inc. Class A Common Stock,$1.36,-0.03,-2.158%,386991823.00,United States,2019,11215523,Utilities,Oil/Gas Transmission +NFG,National Fuel Gas Company Common Stock,$83.09,-0.08,-0.096%,7895448440.00,United States,,1056168,Utilities,Oil/Gas Transmission +NFGC,New Found Gold Corp Common Shares,$3.34,-0.01,-0.299%,818723262.00,,2021,2329313,Basic Materials,Precious Metals +NFJ,Virtus Dividend Interest & Premium Strategy Fund Common Shares of Beneficial Interest,$13.44,-0.07,-0.518%,0.00,United States,2005,232409,Finance,Finance: Consumer Services +NFLX,Netflix Inc. Common Stock,$84.64,-0.94,-1.098%,357363804376.00,United States,2002,37762612,Consumer Discretionary,Consumer Electronics/Video Chains +NG,Novagold Resources Inc.,$11.30,-0.44,-3.748%,4599038200.00,Canada,2003,7768112,Basic Materials,Precious Metals +NGD,New Gold Inc.,$12.57,-0.01,-0.079%,9951669000.00,Canada,,32731301,Basic Materials,Metal Mining +NGEN,NervGen Pharma Corp. Common stock,$4.32,-0.31,-6.695%,314650613.00,Canada,,239351,, +NGG,National Grid Transco PLC National Grid PLC (NEW) American Depositary Shares,$84.68,0.37,0.439%,84028724172.00,United Kingdom,,852407,Utilities,Natural Gas Distribution +NGL,NGL ENERGY PARTNERS LP Common Units representing Limited Partner Interests,$11.20,-0.21,-1.84%,1391823048.00,United States,2011,388845,Utilities,Natural Gas Distribution +NGL^B,NGL ENERGY PARTNERS LP 9.00% Class B Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Units representing limited partnership interests,$24.28,-0.12,-0.492%,,United States,,31927,, +NGL^C,NGL ENERGY PARTNERS LP 9.625% Class C Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Units representing limited partner interests,$25.00,0.00,0.00%,,United States,,5694,, +NGNE,Neurogene Inc. Common Stock ,$19.27,-0.60,-3.02%,298488446.00,Canada,2014,174026,Health Care,Biotechnology: Pharmaceutical Preparations +NGS,Natural Gas Services Group Inc. Common Stock,$33.37,-2.02,-5.708%,419424760.00,United States,2002,220855,Energy,Oilfield Services/Equipment +NGVC,Natural Grocers by Vitamin Cottage Inc. Common Stock,$25.93,-0.94,-3.498%,597248101.00,United States,2012,241225,Consumer Staples,Food Chains +NGVT,Ingevity Corporation Common Stock ,$66.25,-0.63,-0.942%,2382617120.00,United States,2016,298628,Industrials,Major Chemicals +NHC,National HealthCare Corporation Common Stock,$139.09,-0.84,-0.60%,2158016540.00,United States,1986,52942,Health Care,Hospital/Nursing Management +NHI,National Health Investors Inc. Common Stock,$78.33,-0.90,-1.136%,3731523862.00,United States,,160012,Real Estate,Real Estate Investment Trusts +NHPAP,National Healthcare Properties Inc. 7.375% Series A Cumulative Redeemable Perpetual Preferred Stock,$19.50,0.065,0.334%,554320533.00,United States,,2502,Real Estate,Real Estate Investment Trusts +NHPBP,National Healthcare Properties Inc. 7.125% Series B Cumulative Redeemable Perpetual Preferred Stock,$18.97,-0.0351,-0.185%,539254385.00,United States,,1178,Real Estate,Real Estate Investment Trusts +NHS,Neuberger High Yield Strategies Fund Inc. Common Stock,$7.56,0.06,0.80%,0.00,United States,,147682,Finance,Trusts Except Educational Religious and Charitable +NHTC,Natural Health Trends Corp. Common Stock,$3.75,-0.05,-1.316%,43174031.00,United States,,24478,Consumer Discretionary,Consumer Specialties +NI,NiSource Inc Common Stock,$44.33,-0.06,-0.135%,21154077801.00,United States,,4950076,Utilities,Power Generation +NIC,Nicolet Bankshares Inc. Common Stock,$141.57,-1.86,-1.297%,2113665158.00,United States,2022,116238,Finance,Major Banks +NICE,NICE Ltd American Depositary Shares,$111.14,-2.62,-2.303%,7029587551.00,Israel,,461989,Technology,Computer Software: Prepackaged Software +NIE,Virtus Equity & Convertible Income Fund Common Shares of Beneficial Interest,$25.61,0.00,0.00%,709626594.00,United States,2007,77623,Finance,Investment Managers +NIM,Nuveen Select Maturities Municipal Fund Common Stock,$9.37,0.05,0.536%,0.00,United States,1992,9259,Finance,Trusts Except Educational Religious and Charitable +NINE,Nine Energy Service Inc. Common Stock,$0.555,-0.0749,-11.891%,24065543.00,United States,2018,4443846,Energy,Oilfield Services/Equipment +NIO,NIO Inc. American depositary shares each representing one Class A ordinary share,$4.59,-0.05,-1.078%,10309096845.00,United States,2018,46233338,Industrials,Auto Manufacturing +NIOBW,NioCorp Developments Ltd. Warrant,$3.10,-0.03,-0.958%,381210633.00,United States,,29194,Basic Materials,Metal Mining +NIPG,NIP Group Inc. American Depositary Shares,$1.11,0.02,1.835%,249037110.00,Sweden,2024,8861,Consumer Discretionary,Services-Misc. Amusement & Recreation +NIQ,NIQ Global Intelligence plc Ordinary Shares,$17.23,-0.36,-2.047%,5082850000.00,,2025,726406,Technology,Computer Software: Programming Data Processing +NISN,NiSun International Enterprise Development Group Co. Ltd. Class A Common Shares,$1.04,-0.03,-2.804%,4990292.00,China,2016,7583,Industrials,Metal Fabrications +NITO,N2OFF Inc. Common Stock,$1.41,-0.04,-2.759%,3825165.00,Israel,,104161,Industrials,Agricultural Chemicals +NIU,Niu Technologies American Depositary Shares,$3.23,0.02,0.623%,251823630.00,China,2018,465090,Industrials,Auto Manufacturing +NIVF,NewGenIvf Group Limited Class A Ordinary Shares,$1.585,0.085,5.667%,10444798.00,Singapore,,715963,Health Care,Misc Health and Biotechnology Services +NIXX,Nixxy Inc. Common Stock,$0.89,-0.034,-3.68%,22139264.00,United States,,336487,Technology,EDP Services +NJR,NewJersey Resources Corporation Common Stock,$48.70,-0.24,-0.49%,4906225349.00,United States,,416891,Utilities,Oil/Gas Transmission +NKE,Nike Inc. Common Stock,$62.24,-0.85,-1.347%,92139062940.00,United States,,10363629,Consumer Discretionary,Shoe Manufacturing +NKLR,Terra Innovatum Global N.V. Ordinary shares,$5.60,0.01,0.179%,393685309.00,Italy,,598730,Industrials,Metal Fabrications +NKSH,National Bankshares Inc. Common Stock,$35.93,-0.12,-0.333%,228730416.00,United States,,11532,Finance,Major Banks +NKTR,Nektar Therapeutics Common Stock,$35.91,-2.12,-5.575%,705721742.00,United States,,809466,Health Care,Biotechnology: Pharmaceutical Preparations +NKTX,Nkarta Inc. Common Stock,$2.47,-0.07,-2.756%,175442895.00,United States,2020,469326,Health Care,Biotechnology: Pharmaceutical Preparations +NKX,Nuveen California AMT-Free Quality Municipal Income Fund,$12.77,0.02,0.157%,0.00,United States,2002,97035,Finance,Finance/Investors Services +NL,NL Industries Inc. Common Stock,$6.30,0.14,2.273%,307835224.00,United States,,53380,Basic Materials,Major Chemicals +NLOP,Net Lease Office Properties Common Shares of Beneficial Interest,$19.30,0.31,1.632%,285911648.00,United States,2023,636408,Real Estate,Real Estate Investment Trusts +NLY,Annaly Capital Management Inc. Common Stock,$24.25,-0.11,-0.452%,16563506940.00,United States,,5618132,Real Estate,Real Estate Investment Trusts +NLY^F,Annaly Capital Management Inc 6.95% Series F,$25.8171,0.0155,0.06%,,United States,,53044,, +NLY^G,Annaly Capital Management Inc 6.50% Series G Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.0997,0.0597,0.238%,,United States,,18697,, +NLY^I,Annaly Capital Management Inc 6.750% Series I Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.74,-0.0201,-0.078%,,United States,,15016,, +NLY^J,Annaly Capital Management Inc. 8.875% Series J Fixed-Rate Cumulative Redeemable Preferred Stock,$26.40,0.08,0.304%,,United States,,63782,, +NMAI,Nuveen Multi-Asset Income Fund Common Shares of Beneficial Interest,$13.50,0.04,0.297%,0.00,United States,2021,103958,Finance,Investment Managers +NMAX,Newsmax Inc. Class B Common Stock,$7.07,0.00,0.00%,912942871.00,United States,2025,1217288,Industrials,Broadcasting +NMCO,Nuveen Municipal Credit Opportunities Fund Common Shares,$10.61,0.01,0.094%,581125339.00,,2019,107013,Finance,Finance/Investors Services +NMFC,New Mountain Finance Corporation Common Stock,$8.60,-0.12,-1.376%,887139983.00,United States,,511272,Finance,Finance/Investors Services +NMFCZ,New Mountain Finance Corporation 8.250% Notes due 2028,$25.54,0.01,0.039%,2716458944.00,United States,,3269,, +NMG,Nouveau Monde Graphite Inc. Common Shares,$2.99,-0.09,-2.922%,455760333.00,Canada,,795223,Basic Materials,Other Metals and Minerals +NMI,Nuveen Municipal Income Fund Inc. Common Stock,$9.97,0.03,0.302%,0.00,United States,1988,17838,Finance,Trusts Except Educational Religious and Charitable +NMIH,NMI Holdings Inc. Common Stock,$38.04,-0.20,-0.523%,2924055981.00,United States,2013,498287,Finance,Property-Casualty Insurers +NML,Neuberger Energy Infrastructure and Income Fund Inc. Common Stock,$9.09,0.07,0.776%,0.00,United States,2013,139089,Finance,Finance/Investors Services +NMM,Navios Maritime Partners LP Common Units Representing Limited Partner Interests,$59.65,0.75,1.273%,1796045931.00,Greece,2007,113676,Consumer Discretionary,Marine Transportation +NMP,NMP Acquisition Corp. Class A Ordinary Shares,$10.08,-0.02,-0.198%,0.00,United States,2025,152,Finance,Blank Checks +NMPAU,NMP Acquisition Corp. Units,$10.30,0.00,0.00%,0.00,United States,2025,50,Finance,Blank Checks +NMR,Nomura Holdings Inc ADR American Depositary Shares,$9.10,-0.02,-0.219%,26901519782.00,Japan,,1442115,Finance,Investment Bankers/Brokers/Service +NMRA,Neumora Therapeutics Inc. Common Stock,$2.04,-0.09,-4.225%,340861793.00,United States,2023,782037,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +NMRK,Newmark Group Inc. Class A Common Stock,$17.35,0.17,0.99%,3130155261.00,United States,2017,989613,Finance,Real Estate +NMS,Nuveen Minnesota Quality Municipal Income Fund ,$11.955,0.025,0.21%,0.00,United States,2014,14865,Finance,Finance Companies +NMT,Nuveen Massachusetts Quality Municipal Income Fund Common Stock,$11.72,0.07,0.601%,0.00,United States,,19664,Finance,Finance/Investors Services +NMTC,NeuroOne Medical Technologies Corporation Common Stock,$0.9068,0.0064,0.711%,45714643.00,United States,,216851,Health Care,Medical/Dental Instruments +NMZ,Nuveen Municipal High Income Opportunity Fund Common Stock $0.01 par value per share,$10.39,0.01,0.096%,0.00,United States,2003,564323,Finance,Finance/Investors Services +NN,NextNav Inc. Common Stock,$14.98,0.65,4.536%,2019739738.00,United States,,1685230,Industrials,Industrial Machinery/Components +NNAVW,NextNav Inc. Warrant,$6.50,0.45,7.438%,876389072.00,United States,,19918,Industrials,Industrial Machinery/Components +NNBR,NN Inc. Common Stock,$1.51,-0.01,-0.658%,75795673.00,United States,1994,1012083,Industrials,Industrial Machinery/Components +NNDM,Nano Dimension Ltd. American Depositary Shares,$1.92,-0.03,-1.538%,534753688.00,Israel,,2379420,Technology,Electrical Products +NNE,Nano Nuclear Energy Inc. Common Stock,$34.55,-0.53,-1.511%,1743886858.00,United States,2024,4076922,Utilities,Electric Utilities: Central +NNI,Nelnet Inc. Common Stock,$128.83,-1.92,-1.468%,4629264236.00,United States,2003,91295,Finance,Finance: Consumer Services +NNN,NNN REIT Inc. Common Stock,$41.37,-0.80,-1.897%,7857024117.00,United States,,1224087,Real Estate,Real Estate Investment Trusts +NNNN,Anbio Biotechnology Class A Ordinary Shares,$19.29,-2.22,-10.321%,2775661248.00,Germany,2025,10892,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +NNOX,NANO-X IMAGING LTD Ordinary Shares,$3.01,-0.19,-5.938%,203441478.00,Israel,2020,1132343,Health Care,Medical Electronics +NNVC,NanoViricides Inc. Common Stock,$1.05,-0.03,-2.778%,22646850.00,United States,,377526,Health Care,Biotechnology: Pharmaceutical Preparations +NNY,Nuveen New York Municipal Value Fund Common Stock,$8.47,0.00,0.00%,0.00,United States,1988,41280,Finance,Investment Managers +NOA,North American Construction Group Ltd. Common Shares (no par),$14.89,-0.06,-0.401%,438275729.00,Canada,2006,101038,Energy,Oilfield Services/Equipment +NOAH,Noah Holdings Limited American Depositary Shares,$11.45,-0.06,-0.521%,767501194.00,China,2010,110118,Finance,Investment Managers +NOC,Northrop Grumman Corporation Common Stock,$689.13,10.39,1.531%,97802446680.00,United States,,1222584,Industrials,Industrial Machinery/Components +NODK,NI Holdings Inc. Common Stock,$13.49,0.28,2.12%,277971527.00,United States,2017,16964,Finance,Property-Casualty Insurers +NOEM,CO2 Energy Transition Corp. Common Stock,$10.36,0.00,0.00%,0.00,United States,2025,482,, +NOEMW,CO2 Energy Transition Corp. Warrant,$0.17,0.00,0.00%,0.00,United States,2025,209,, +NOG,Northern Oil and Gas Inc. Common Stock,$24.36,0.33,1.373%,2377608544.00,United States,2022,2172964,Energy,Oil & Gas Production +NOK,Nokia Corporation Sponsored American Depositary Shares,$6.82,-0.12,-1.729%,38231899353.00,Finland,1994,64275523,Technology,Radio And Television Broadcasting And Communications Equipment +NOM,Nuveen Missouri Quality Municipal Income Fund ,$11.90,-0.05,-0.418%,0.00,United States,1993,3894,Finance,Investment Managers +NOMA,NOMADAR Corp. Class A Common Stock,$5.11,-0.07,-1.351%,111602747.00,United States,,131964,Consumer Discretionary,Services-Misc. Amusement & Recreation +NOMD,Nomad Foods Limited Ordinary Shares,$12.28,-0.24,-1.917%,1883788558.00,United Kingdom,2016,1293609,Consumer Staples,Packaged Foods +NOTE,FiscalNote Holdings Inc. Class A common stock,$1.40,-0.06,-4.11%,21993853.00,United States,2022,131560,Real Estate,Real Estate +NOTV,Inotiv Inc. Common Stock,$0.5194,-0.0069,-1.311%,17850350.00,United States,,175655,Health Care,Biotechnology: Commercial Physical & Biological Resarch +NOV,NOV Inc. Common Stock,$18.38,-0.54,-2.854%,6704157879.00,United States,,4824396,Consumer Discretionary,Oil and Gas Field Machinery +NOVT,Novanta Inc. Common Stock,$138.99,0.11,0.079%,4972384346.00,United States,,414136,Miscellaneous,Industrial Machinery/Components +NOVTU,Novanta Inc. Tangible Equity Units,$60.77,-0.06,-0.099%,2174054225.00,United States,,65502,Miscellaneous,Industrial Machinery/Components +NOW,ServiceNow Inc. Common Stock,$129.62,-2.18,-1.654%,134596201886.00,United States,2012,21254084,Technology,Computer Software: Prepackaged Software +NP,Neptune Insurance Holdings Inc. Class A Common Stock,$25.21,0.09,0.358%,3519820200.00,,2025,127348,Finance,Specialty Insurers +NPAC,New Providence Acquisition Corp. III Class A Ordinary Shares,$10.38,0.00,0.00%,0.00,United States,2025,2,, +NPACU,New Providence Acquisition Corp. III Units,$10.55,0.00,0.00%,0.00,United States,2025,93,Finance,Blank Checks +NPB,Northpointe Bancshares Inc. Common Stock,$17.39,-0.51,-2.849%,597601420.00,United States,2025,180422,Finance,Major Banks +NPCE,Neuropace Inc. Common Stock,$15.61,-0.34,-2.132%,519933728.00,United States,2021,143831,Health Care,Medical/Dental Instruments +NPCT,Nuveen Core Plus Impact Fund Common Shares of Beneficial Interest,$10.25,0.02,0.196%,0.00,United States,2021,111102,Finance,Investment Managers +NPFD,Nuveen Variable Rate Preferred & Income Fund Common Shares,$19.21,-0.02,-0.104%,0.00,United States,2021,63505,Finance,Trusts Except Educational Religious and Charitable +NPK,National Presto Industries Inc. Common Stock,$122.11,-2.63,-2.108%,873323393.00,United States,,88671,Industrials,Ordnance And Accessories +NPKI,NPK International Inc. Common Stock,$13.60,-0.26,-1.876%,1149127906.00,United States,,602136,Consumer Discretionary,Oil and Gas Field Machinery +NPO,Enpro Inc. Common Stock,$233.93,-4.33,-1.817%,4927905985.00,United States,,195255,Industrials,Metal Fabrications +NPT,Texxon Holding Limited Ordinary shares,$5.90,0.3099,5.544%,130891500.00,China,2025,22087,Consumer Discretionary,Specialty Chemicals +NPV,Nuveen Virginia Quality Municipal Income Fund Common Stock,$11.16,0.03,0.27%,0.00,United States,1993,51558,Finance,Investment Managers +NPWR,NET Power Inc. Class A Common Stock,$2.34,-0.03,-1.266%,519812465.00,United States,2021,689939,Energy,Industrial Machinery/Components +NQP,Nuveen Pennsylvania Quality Municipal Income Fund Common Stock,$11.89,-0.05,-0.419%,0.00,United States,1991,115433,Finance,Trusts Except Educational Religious and Charitable +NRC,National Research Corporation Common Stock (Delaware),$19.81,-0.54,-2.654%,448843510.00,United States,,76884,Health Care,Biotechnology: Commercial Physical & Biological Resarch +NRDS,NerdWallet Inc. Class A Common Stock,$12.23,-0.08,-0.65%,889282803.00,United States,2021,762027,Technology,EDP Services +NRDY,Nerdy Inc. Class A Common Stock,$1.00,0.00,0.00%,187334048.00,United States,2020,482280,Real Estate,Other Consumer Services +NREF,NexPoint Real Estate Finance Inc. Common Stock,$14.51,-0.01,-0.069%,257143724.00,United States,2020,30615,Real Estate,Real Estate Investment Trusts +NREF^A,NexPoint Real Estate Finance Inc. 8.50% Series A Cumulative Redeemable Preferred Stock,$24.4856,0.0656,0.269%,,United States,,3419,, +NRG,NRG Energy Inc. Common Stock,$155.11,-0.93,-0.596%,29725188575.00,United States,,1607987,Utilities,Electric Utilities: Central +NRGV,Energy Vault Holdings Inc. Common Stock,$5.29,0.08,1.536%,879937732.00,United States,2021,1451503,Miscellaneous,Industrial Machinery/Components +NRIM,Northrim BanCorp Inc Common Stock,$22.61,-0.46,-1.994%,499470003.00,United States,,271993,Finance,Savings Institutions +NRIX,Nurix Therapeutics Inc. Common stock,$17.87,-1.54,-7.934%,1373907001.00,United States,2020,1043665,Health Care,Biotechnology: Pharmaceutical Preparations +NRK,Nuveen New York AMT-Free Quality Municipal Income Fund ,$10.18,0.03,0.296%,0.00,United States,2002,466850,Finance,Trusts Except Educational Religious and Charitable +NRO,Neuberger Real Estate Securities Income Fund Inc. Common Stock,$2.98,-0.01,-0.334%,0.00,United States,2003,140879,Finance,Finance/Investors Services +NRP,Natural Resource Partners LP Limited Partnership,$114.25,0.28,0.246%,1501027582.00,United States,2002,17330,Energy,Coal Mining +NRSN,NeuroSense Therapeutics Ltd. Ordinary Shares,$0.9284,0.0185,2.033%,27435121.00,Israel,2021,137384,Health Care,Biotechnology: Pharmaceutical Preparations +NRSNW,NeuroSense Therapeutics Ltd. Warrant,$0.35,0.00,0.00%,10342840.00,Israel,2021,229,Health Care,Biotechnology: Pharmaceutical Preparations +NRT,North European Oil Royality Trust Common Stock,$8.93,-0.03,-0.335%,82071969.00,United States,,60239,Energy,Oil & Gas Production +NRUC,National Rural Utilities Cooperative Finance Corporation 5.500% Subordinated Notes due 2064 (Subordinated Deferrable Interest Notes),$24.61,-0.14,-0.566%,0.00,United States,2019,15513,Finance,Diversified Financial Services +NRXP,NRX Pharmaceuticals Inc. Common Stock,$2.11,-0.13,-5.804%,62466867.00,United States,2017,699205,Health Care,Biotechnology: Pharmaceutical Preparations +NRXPW,NRX Pharmaceuticals Inc. Warrant,$0.0598,0.0006,1.014%,1770388.00,United States,2017,616,Health Care,Biotechnology: Pharmaceutical Preparations +NRXS,Neuraxis Inc. Common Stock,$4.66,0.09,1.969%,49642104.00,,2023,24585,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +NSA,National Storage Affiliates Trust Common Shares of Beneficial Interest,$31.52,-0.47,-1.469%,2425803376.00,United States,2015,1164779,Real Estate,Real Estate Investment Trusts +NSA^A,National Storage Affiliates Trust 6.000% Series A Cumulative Redeemable Preferred Shares of Beneficial Interest (Liquidation Preference $25.00 per share),$21.07,0.12,0.573%,,United States,,62087,, +NSA^B,National Storage Affiliates Trust 6.000% Series B Cumulative Redeemable Preferred Shares of Beneficial Interest,$21.14,-0.015,-0.071%,,United States,,173,, +NSC,Norfolk Southern Corporation Common Stock,$284.47,-4.50,-1.557%,63831260938.00,United States,,765987,Industrials,Railroads +NSIT,Insight Enterprises Inc. Common Stock,$84.19,0.37,0.441%,2608172271.00,United States,1995,583522,Consumer Discretionary,Catalog/Specialty Distribution +NSP,Insperity Inc. Common Stock,$40.74,-3.61,-8.14%,1536067152.00,United States,,888774,Consumer Discretionary,Professional Services +NSPR,InspireMD Inc. Common Stock,$1.65,0.00,0.00%,69912142.00,Israel,,12750,Health Care,Medical/Dental Instruments +NSRX,Nasus Pharma Ltd. Ordinary Shares,$5.90,0.40,7.273%,53158994.00,,2025,3278,Health Care,Biotechnology: Pharmaceutical Preparations +NSSC,NAPCO Security Technologies Inc. Common Stock,$38.51,0.03,0.078%,1373433117.00,United States,,412841,Telecommunications,Telecommunications Equipment +NSTS,NSTS Bancorp Inc. Common Stock,$12.72,0.07,0.553%,66640563.00,United States,2022,857,Finance,Savings Institutions +NSYS,Nortech Systems Incorporated Common Stock,$8.8336,-0.1451,-1.616%,24611593.00,United States,,8484,Technology,Industrial Machinery/Components +NTAP,NetApp Inc. Common Stock,$99.33,-0.56,-0.561%,19673334367.00,United States,1995,1947206,Technology,Electronic Components +NTB,Bank of N.T. Butterfield & Son Limited (The) Voting Ordinary Shares,$50.84,-0.42,-0.819%,2186120000.00,Bermuda,2016,142012,Finance,Commercial Banks +NTCL,NETCLASS TECHNOLOGY INC Class A Ordinary Shares,$0.3965,-0.0097,-2.388%,8547164.00,China,2024,83857,Technology,Computer Software: Prepackaged Software +NTCT,NetScout Systems Inc. Common Stock,$28.07,0.11,0.393%,2026476401.00,United States,1999,303432,Technology,EDP Services +NTES,NetEase Inc. American Depositary Shares,$133.78,1.92,1.456%,84709266434.00,China,,457963,Technology,Computer Software: Prepackaged Software +NTGR,NETGEAR Inc. Common Stock,$21.42,-0.34,-1.563%,608387012.00,United States,2003,552019,Utilities,Telecommunications Equipment +NTHI,NeOnc Technologies Holdings Inc. Common Stock,$9.76,0.63,6.90%,233954920.00,United States,,64657,Health Care,Biotechnology: Pharmaceutical Preparations +NTIC,Northern Technologies International Corporation Common Stock,$9.01,-0.09,-0.989%,85522929.00,United States,,4698,Industrials,Industrial Specialties +NTIP,Network-1 Technologies Inc. Common Stock,$1.32,0.01,0.763%,30121953.00,United States,,39059,Miscellaneous,Multi-Sector Companies +NTLA,Intellia Therapeutics Inc. Common Stock,$13.82,-1.01,-6.811%,1600769577.00,United States,2016,6208693,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +NTNX,Nutanix Inc. Class A Common Stock,$41.78,0.54,1.309%,11297308825.00,United States,2016,3832177,Technology,Computer Software: Prepackaged Software +NTR,Nutrien Ltd. Common Shares,$71.60,1.28,1.82%,34607183595.00,Canada,2004,3130729,Industrials,Agricultural Chemicals +NTRA,Natera Inc. Common Stock,$235.93,-4.41,-1.835%,32634106088.00,United States,2015,871617,Health Care,Medical Specialities +NTRB,Nutriband Inc. Common Stock,$4.70,-0.27,-5.433%,57221950.00,United States,,16759,Health Care,Industrial Specialties +NTRBW,Nutriband Inc. Warrant,$1.725,0.125,7.813%,21001673.00,United States,,5172,Health Care,Industrial Specialties +NTRP,NextTrip Inc. Common Stock,$3.15,-0.11,-3.374%,43050442.00,United States,,19608,Consumer Discretionary,Miscellaneous manufacturing industries +NTRS,Northern Trust Corporation Common Stock,$150.25,0.29,0.193%,28414884692.00,United States,,1028134,Finance,Major Banks +NTRSO,Northern Trust Corporation Depositary Shares Each Representing a 1/1000th Interest in a Share of Series E Non-Cumulative Perpetual Preferred Stock,$19.70,-0.17,-0.856%,3725612169.00,United States,,29706,Finance,Major Banks +NTSK,Netskope Inc. Class A Common Stock,$16.10,0.34,2.157%,6331467662.00,United States,2025,1892037,Technology,Computer Software: Prepackaged Software +NTST,NetSTREIT Corp. Common Stock,$18.18,0.06,0.331%,1519151270.00,United States,2020,1520209,Real Estate,Real Estate Investment Trusts +NTWK,NetSol Technologies Inc. Common Stock,$3.13,-0.15,-4.573%,36923906.00,United States,,8893,Technology,Computer Software: Prepackaged Software +NTWO,Newbury Street II Acquisition Corp Class A Ordinary Shares,$10.50,0.00,0.00%,0.00,United States,2024,8,, +NTZ,Natuzzi S.p.A.,$2.87,-0.23,-7.419%,31611928.00,Italy,1993,12322,Consumer Discretionary,Home Furnishings +NU,Nu Holdings Ltd. Class A Ordinary Shares,$18.76,0.21,1.132%,90398036086.00,Cayman Islands,2021,49583603,Finance,Finance: Consumer Services +NUAI,New Era Energy & Digital Inc. Common Stock,$7.68,0.08,1.053%,411828703.00,United States,,9167184,Energy,Oil & Gas Production +NUAIW,New Era Energy & Digital Inc. Warrants,$2.5901,0.1801,7.473%,138890302.00,United States,,163093,Energy,Oil & Gas Production +NUE,Nucor Corporation Common Stock,$173.18,-0.40,-0.23%,39633742566.00,United States,,1821084,Industrials,Steel/Iron Ore +NUKK,Nukkleus Inc. Common Stock,$2.38,-0.14,-5.556%,39616923.00,United States,2020,1661936,Consumer Discretionary,Professional Services +NUKKW,Nukkleus Inc. Warrants,$0.13,-0.0025,-1.887%,2163950.00,United States,2020,38276,Consumer Discretionary,Professional Services +NUS,Nu Skin Enterprises Inc. Common Stock,$10.10,-0.60,-5.607%,492375768.00,United States,1996,637774,Health Care,Other Pharmaceuticals +NUTX,Nutex Health Inc. Common Stock,$149.80,-4.01,-2.607%,1059373017.00,United States,,83714,Real Estate,Real Estate +NUV,Nuveen Municipal Value Fund Inc. Common Stock,$9.12,0.02,0.22%,0.00,United States,1987,710321,Finance,Trusts Except Educational Religious and Charitable +NUVB,Nuvation Bio Inc. Class A Common Stock,$5.30,-0.31,-5.526%,1817017195.00,United States,2020,5147407,Health Care,Biotechnology: Pharmaceutical Preparations +NUVL,Nuvalent Inc. Class A Common Stock,$100.27,-6.18,-5.806%,7290302313.00,United States,2021,499997,Health Care,Biotechnology: Pharmaceutical Preparations +NUW,Nuveen AMT-Free Municipal Value Fund,$14.44,0.11,0.768%,0.00,United States,2009,33004,Finance,Investment Managers +NUWE,Nuwellis Inc. Common Stock,$3.86,0.03,0.783%,6402964.00,United States,,2452024,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +NVA,Nova Minerals Limited American Depositary Shares,$10.92,0.42,4.00%,410435669.00,Australia,2024,1120184,Basic Materials,Precious Metals +NVAWW,Nova Minerals Limited Warrant,$46.44,2.13,4.807%,20945749747.00,Australia,2024,2367,Basic Materials,Precious Metals +NVAX,Novavax Inc. Common Stock,$9.23,-0.59,-6.008%,1499865724.00,United States,,5322463,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +NVCR,NovoCure Limited Ordinary Shares,$12.58,-0.47,-3.602%,1408733321.00,Jersey,2015,1489319,Health Care,Medical/Dental Instruments +NVCT,Nuvectis Pharma Inc. Common Stock,$8.37,-0.38,-4.343%,214396680.00,United States,2022,28137,Health Care,Biotechnology: Pharmaceutical Preparations +NVDA,NVIDIA Corporation Common Stock,$191.52,3.00,1.591%,4653936000000.00,United States,1999,148552677,Technology,Semiconductors +NVEC,NVE Corporation Common Stock,$72.28,-1.70,-2.298%,349630358.00,United States,,45450,Technology,Semiconductors +NVG,Nuveen AMT-Free Municipal Credit Income Fund ,$12.78,0.11,0.868%,0.00,United States,2002,495408,Finance,Investment Managers +NVGS,Navigator Holdings Ltd. Ordinary Shares (Marshall Islands),$18.35,-0.05,-0.272%,1273446841.00,Marshall Islands,2013,208677,Consumer Discretionary,Marine Transportation +NVMI,Nova Ltd. Ordinary Shares,$487.18,10.11,2.119%,14264138835.00,Israel,2000,356875,Technology,Electronic Components +NVNI,Nvni Group Limited Ordinary Shares,$1.70,-0.24,-12.371%,47171743.00,Cayman Islands,,212141,Technology,Computer Software: Prepackaged Software +NVNIW,Nvni Group Limited Warrants,$0.06,-0.015,-20.00%,1664885.00,Cayman Islands,,3497,Technology,Computer Software: Prepackaged Software +NVNO,enVVeno Medical Corporation Common Stock,$10.26,0.02,0.195%,5926227.00,United States,2018,16656,Health Care,Medical/Dental Instruments +NVO,Novo Nordisk A/S Common Stock,$60.33,-2.56,-4.071%,269373450000.00,Denmark,,16235907,Health Care,Biotechnology: Pharmaceutical Preparations +NVR,NVR Inc. Common Stock,$7626.08,126.32,1.684%,21653735587.00,United States,1998,30066,Consumer Discretionary,Homebuilding +NVRI,Enviri Corporation Common Stock,$18.84,0.03,0.159%,1519496133.00,United States,,3896980,Miscellaneous,Diversified Commercial Services +NVS,Novartis AG Common Stock,$147.87,-4.35,-2.858%,292056447102.00,Switzerland,,1990013,Health Care,Biotechnology: Pharmaceutical Preparations +NVST,Envista Holdings Corporation Common Stock,$24.08,-0.03,-0.124%,3959383691.00,United States,2019,2676215,Health Care,Medical/Dental Instruments +NVT,nVent Electric plc Ordinary Shares ,$114.15,0.99,0.875%,18419192633.00,United Kingdom,2018,1619372,Industrials,Industrial Machinery/Components +NVTS,Navitas Semiconductor Corporation Common Stock,$10.19,0.63,6.59%,2348756095.00,United States,,27286864,Technology,Semiconductors +NVVE,Nuvve Holding Corp. Common Stock,$1.97,-0.22,-10.046%,2901887.00,United States,2020,592095,Industrials,Electrical Products +NVVEW,Nuvve Holding Corp. Warrant,$0.0143,-0.0005,-3.378%,21064.00,United States,2020,67369,Industrials,Electrical Products +NVX,NOVONIX Limited American Depository Shares,$1.12,-0.01,-0.885%,159023758.00,Australia,,732064,Miscellaneous,Industrial Machinery/Components +NWAX,New America Acquisition I Corp. Class A Common Stock,$10.18,0.00,0.00%,0.00,,2026,40003,Finance,Blank Checks +NWBI,Northwest Bancshares Inc. Common Stock,$12.55,-0.21,-1.646%,1833554636.00,United States,2009,1102424,Finance,Major Banks +NWE,NorthWestern Energy Group Inc. Common Stock,$66.50,-0.94,-1.394%,4083567429.00,United States,,882020,Utilities,Power Generation +NWFL,Norwood Financial Corp. Common Stock,$28.06,-0.56,-1.957%,259953452.00,United States,,29911,Finance,Major Banks +NWG,NatWest Group plc American Depositary Shares (each representing two (2) Ordinary Shares),$18.21,-0.09,-0.492%,72949750741.00,United Kingdom,2022,3631988,Finance,Commercial Banks +NWGL,CL Workshop Group Limited American Depositary Shares,$1.3439,0.0839,6.659%,22245798.00,China,2023,232324,Energy, +NWL,Newell Brands Inc. Common Stock,$4.31,-0.05,-1.147%,1806752000.00,United States,,4264185,Industrials,Plastic Products +NWN,Northwest Natural Holding Company Common Stock,$46.22,-0.68,-1.45%,1918455481.00,United States,,424540,Utilities,Oil/Gas Transmission +NWPX,NWPX Infrastructure Inc. Common Stock,$66.15,-0.79,-1.18%,635678414.00,United States,1995,80209,Industrials,Steel/Iron Ore +NWS,News Corporation Class B Common Stock,$30.61,-0.23,-0.746%,17187797347.00,United States,,985668,Consumer Discretionary,Newspapers/Magazines +NWSA,News Corporation Class A Common Stock,$26.59,-0.06,-0.225%,14930530266.00,United States,,3943933,Consumer Discretionary,Newspapers/Magazines +NWTG,Newton Golf Company Inc. Common Stock,$1.41,-0.12,-7.843%,6700973.00,United States,2023,78491,Consumer Discretionary,Recreational Games/Products/Toys +NX,Quanex Building Products Corporation Common Stock,$18.37,-0.14,-0.756%,839044717.00,United States,,545831,Industrials,Metal Fabrications +NXDR,Nextdoor Holdings Inc. Class A Common Stock,$1.95,-0.09,-4.412%,764611704.00,United States,,3373793,Technology,Computer Software: Programming Data Processing +NXDT,NexPoint Diversified Real Estate Trust Common Stock,$4.69,-0.24,-4.868%,229905718.00,United States,,168857,Real Estate,Real Estate Investment Trusts +NXDT^A,NexPoint Diversified Real Estate Trust 5.50% Series A Cumulative Preferred Shares ($25.00 liquidation preference per share),$13.78,-0.12,-0.863%,,United States,,1519,, +NXE,Nexgen Energy Ltd. Common Shares,$13.92,1.14,8.92%,9111490206.00,Canada,2017,17585341,Basic Materials,Other Metals and Minerals +NXG,NXG NextGen Infrastructure Income Fund Common Shares of Beneficial Interest,$50.24,0.10,0.199%,130710111.00,,2012,23044,, +NXGL,NexGel Inc Common Stock,$1.59,0.01,0.633%,12947581.00,United States,2021,35990,Health Care,Medical/Dental Instruments +NXJ,Nuveen New Jersey Qualified Municipal Fund ,$12.32,0.06,0.489%,0.00,United States,2001,281975,Finance,Finance/Investors Services +NXL,Nexalin Technology Inc. Common Stock,$0.60,0.0085,1.437%,11191163.00,United States,2022,84805,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +NXP,Nuveen Select Tax Free Income Portfolio Common Stock,$14.08,0.07,0.50%,658931511.00,United States,1992,321268,Finance,Trusts Except Educational Religious and Charitable +NXPI,NXP Semiconductors N.V. Common Stock,$240.03,10.61,4.625%,60409423274.00,Netherlands,2010,2943702,Technology,Semiconductors +NXPL,NextPlat Corp Common Stock,$0.6914,-0.0014,-0.202%,18187268.00,United States,,68188,Telecommunications,Telecommunications Equipment +NXPLW,NextPlat Corp Warrants,$0.10,-0.0091,-8.341%,2630499.00,United States,,117,Telecommunications,Telecommunications Equipment +NXRT,NexPoint Residential Trust Inc. Common Stock,$29.58,-0.67,-2.215%,750281023.00,United States,2015,131977,Real Estate,Real Estate Investment Trusts +NXST,Nexstar Media Group Inc. Common Stock,$207.31,-2.11,-1.008%,6286922864.00,United States,2003,225327,Industrials,Broadcasting +NXT,Nextpower Inc. Class A Common Stock,$119.97,14.06,13.275%,17801961997.00,United States,2023,6266111,Industrials,Industrial Machinery/Components +NXTC,NextCure Inc. Common Stock,$10.70,-0.42,-3.777%,55675299.00,United States,2019,29079,Health Care,Biotechnology: Pharmaceutical Preparations +NXTT,Next Technology Holding Inc. Ordinary Shares,$5.51,-0.47,-7.86%,22494884.00,China,,85560,Technology,EDP Services +NXXT,NextNRG Inc. Common Stock,$0.9992,-0.0108,-1.069%,130967464.00,United States,2021,1437944,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +NYAX,Nayax Ltd. Ordinary Shares,$58.31,-1.355,-2.271%,2141479532.00,Israel,,21318,Technology,Computer Software: Prepackaged Software +NYC,American Strategic Investment Co. Class A Common Stock,$11.375,0.785,7.413%,30404727.00,,2020,19104,Real Estate,Real Estate Investment Trusts +NYT,New York Times Company (The) Common Stock,$72.57,-0.25,-0.343%,11781667583.00,United States,,1550513,Consumer Discretionary,Newspapers/Magazines +NYXH,Nyxoah SA Ordinary Shares,$4.90,0.14,2.941%,183393599.00,Belgium,2021,127993,Health Care,Medical/Dental Instruments +NZF,Nuveen Municipal Credit Income Fund ,$12.39,0.04,0.324%,0.00,United States,2007,721122,Finance,Finance Companies +O,Realty Income Corporation Common Stock,$60.07,-0.85,-1.395%,55258739304.00,United States,,5077776,Real Estate,Real Estate Investment Trusts +OABI,OmniAb Inc. Common Stock,$1.85,-0.11,-5.612%,266317490.00,United States,2021,1130674,Health Care,Biotechnology: Commercial Physical & Biological Resarch +OABIW,OmniAb Inc. Warrant,$0.111,0.00,0.00%,15979049.00,United States,2021,30,Health Care,Biotechnology: Commercial Physical & Biological Resarch +OACC,Oaktree Acquisition Corp. III Life Sciences Class A Ordinary Share,$10.67,0.02,0.188%,0.00,United States,2024,50215,Finance,Blank Checks +OAK^A,Brookfield Oaktree Holdings LLC 6.625% Series A Preferred Units,$21.73,-0.0357,-0.164%,,United States,,8772,, +OAK^B,Brookfield Oaktree Holdings LLC 6.550% Series B Preferred Units,$21.37,0.02,0.094%,,United States,,6454,, +OBA,Oxley Bridge Acquisition Limited Class A Ordinary Shares,$10.12,0.00,0.00%,0.00,Hong Kong,2025,6,Finance,Blank Checks +OBDC,Blue Owl Capital Corporation Common Stock,$12.07,-0.20,-1.63%,6168352221.00,United States,2019,4204031,Finance,Diversified Financial Services +OBE,Obsidian Energy Ltd. Common Shares,$7.25,0.08,1.116%,486592610.00,Canada,2022,712457,Energy,Oil & Gas Production +OBIO,Orchestra BioMed Holdings Inc. Ordinary Shares,$3.93,-0.23,-5.529%,221906393.00,United States,2020,121601,Health Care, Medicinal Chemicals and Botanical Products +OBK,Origin Bancorp Inc. Common Stock,$40.73,-0.27,-0.659%,1261494488.00,United States,,255623,Finance,Major Banks +OBT,Orange County Bancorp Inc. Common Stock,$29.70,-0.14,-0.469%,396992178.00,United States,,32155,Finance,Major Banks +OBTC,Osprey Bitcoin Trust Common Units of Beneficial Interest,$28.61,-0.08,-0.279%,109305506.00,United States,,9030,Finance,Investment Bankers/Brokers/Service +OC,Owens Corning Inc Common Stock New,$120.57,-0.64,-0.528%,9909857971.00,United States,,1891733,Industrials,Industrial Machinery/Components +OCC,Optical Cable Corporation Common Stock,$5.00,-0.21,-4.031%,44350350.00,United States,,299775,Industrials,Telecommunications Equipment +OCCI,OFS Credit Company Inc. Common Stock,$4.853,0.003,0.062%,56374923.00,United States,2018,122176,Finance,Trusts Except Educational Religious and Charitable +OCCIM,OFS Credit Company Inc. 7.875% Series F Term Preferred Stock,$25.18,-0.0201,-0.08%,0.00,United States,,736,, +OCCIN,OFS Credit Company Inc. 5.25% Series E Term Preferred Stock Due 2026,$24.5301,0.0001,0.00%,284954152.00,United States,,2640,Finance,Trusts Except Educational Religious and Charitable +OCCIO,OFS Credit Company Inc. 6.125% Series C Term Preferred Stock,$25.0184,0.0174,0.07%,290626494.00,United States,,415,Finance,Trusts Except Educational Religious and Charitable +OCFC,OceanFirst Financial Corp. Common Stock,$18.23,-0.12,-0.654%,1046197532.00,United States,,743307,Finance,Major Banks +OCG,Oriental Culture Holding LTD Ordinary Shares,$1.62,-0.11,-6.358%,2815866.00,China,2020,1077319,Consumer Discretionary,Other Consumer Services +OCGN,Ocugen Inc. Common Stock,$1.54,-0.05,-3.145%,504948096.00,United States,2014,4684074,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +OCS,Oculis Holding AG Ordinary shares,$28.38,0.69,2.492%,1500424207.00,Switzerland,,390925,Health Care,Biotechnology: Pharmaceutical Preparations +OCSAW,Oculis Holding AG Warrants,$17.00,1.00,6.25%,898774190.00,Switzerland,,689,Health Care,Biotechnology: Pharmaceutical Preparations +OCSL,Oaktree Specialty Lending Corporation Common Stock,$12.43,-0.16,-1.271%,1094903051.00,United States,,678864,Finance,Finance: Consumer Services +OCUL,Ocular Therapeutix Inc. Common Stock,$10.28,-0.57,-5.253%,2190128012.00,United States,2014,2948211,Health Care,Biotechnology: Pharmaceutical Preparations +ODC,Oil-Dri Corporation Of America Common Stock,$57.48,-0.34,-0.588%,596250386.00,United States,,67828,Consumer Discretionary,Miscellaneous manufacturing industries +ODD,ODDITY Tech Ltd. Class A Ordinary Shares,$33.47,-1.25,-3.60%,1868572900.00,Israel,2023,417530,Consumer Discretionary,Package Goods/Cosmetics +ODFL,Old Dominion Freight Line Inc. Common Stock,$172.72,-1.72,-0.986%,36115482384.00,United States,1991,1953473,Industrials,Trucking Freight/Courier Services +ODV,Osisko Development Corp. Common Shares,$3.86,0.05,1.312%,984450667.00,Canada,2022,7157368,Basic Materials,Precious Metals +ODVWZ,Osisko Development Corp. Warrant expiring 5/27/2027,$0.23,-0.036,-13.534%,58658978.00,Canada,,7498,Basic Materials,Precious Metals +ODYS,Odysight.ai Inc. Common Stock,$5.90,0.86,17.063%,96495934.00,Israel,,77561,Technology,Electronic Components +OEC,Orion S.A. Common Shares,$6.30,-0.13,-2.022%,353743148.00,Luxembourg,2014,644554,Industrials,Major Chemicals +OESX,Orion Energy Systems Inc. Common Stock,$17.27,0.17,0.994%,60978125.00,United States,2015,49706,Consumer Discretionary,Building Products +OFAL,OFA Group Class A Ordinary Shares,$0.4155,0.0015,0.362%,5909910.00,Hong Kong,2025,61183,Consumer Discretionary,Military/Government/Technical +OFG,OFG Bancorp Common Stock,$37.73,-0.17,-0.449%,1658430413.00,Puerto Rico,,387459,Finance,Major Banks +OFIX,Orthofix Medical Inc. Common Stock (DE),$13.14,-0.19,-1.425%,520339519.00,Curacao,1992,239069,Health Care,Medical/Dental Instruments +OFLX,Omega Flex Inc. Common Stock,$31.55,-2.35,-6.932%,318475859.00,United States,,42200,Industrials,Industrial Specialties +OFS,OFS Capital Corporation Common Stock,$4.98,-0.13,-2.544%,66722428.00,United States,,45969,Finance,Finance/Investors Services +OFSSH,OFS Capital Corporation 4.95% Notes due 2028,$23.69,-0.21,-0.879%,317400468.00,United States,,312,Finance,Finance Companies +OFSSO,OFS Capital Corporation 7.50% Notes due 2028,$25.21,-0.15,-0.591%,0.00,United States,,186,, +OGE,OGE Energy Corp Common Stock,$43.51,-0.35,-0.798%,8942776465.00,United States,,1226733,Utilities,Electric Utilities: Central +OGEN,Oragenics Inc. Common Stock,$0.8358,0.0269,3.326%,3564843.00,United States,,184153,Health Care,Biotechnology: Pharmaceutical Preparations +OGI,Organigram Global Inc. Common Shares,$1.60,-0.05,-3.03%,215137646.00,Canada,,634756,Health Care,Biotechnology: Pharmaceutical Preparations +OGN,Organon & Co. Common Stock ,$8.89,-0.11,-1.222%,2311248088.00,United States,2021,4710381,Health Care,Biotechnology: Pharmaceutical Preparations +OGS,ONE Gas Inc. Common Stock,$78.01,-1.17,-1.478%,4680525188.00,United States,2014,458631,Utilities,Oil/Gas Transmission +OHI,Omega Healthcare Investors Inc. Common Stock,$43.16,-0.02,-0.046%,12755031640.00,United States,1992,2186303,Real Estate,Real Estate Investment Trusts +OI,O-I Glass Inc. Common Stock,$15.03,-0.18,-1.183%,2308525485.00,United States,,1425941,Consumer Discretionary,Containers/Packaging +OIA,Invesco Municipal Income Opportunities Trust Common Stock,$6.17,0.01,0.162%,293726484.00,United States,,93139,Finance,Finance Companies +OII,Oceaneering International Inc. Common Stock,$29.67,-1.30,-4.198%,2960330510.00,United States,,1907982,Energy,Oilfield Services/Equipment +OIMAU,OneIM Acquisition Corp. Units,$10.11,0.01,0.099%,0.00,United States,2026,38955,Finance,Blank Checks +OIS,Oil States International Inc. Common Stock,$8.39,-0.20,-2.328%,501265290.00,United States,2001,1123295,Consumer Discretionary,Oil and Gas Field Machinery +OKE,ONEOK Inc. Common Stock,$79.26,1.52,1.955%,49872893208.00,United States,,4940303,Utilities,Oil & Gas Production +OKLO,Oklo Inc. Class A common stock,$94.39,9.12,10.695%,14748161409.00,United States,2021,16371951,Utilities,Electric Utilities: Central +OKTA,Okta Inc. Class A Common Stock,$90.74,-0.72,-0.787%,16081870254.00,United States,2017,1485253,Technology,Computer Software: Prepackaged Software +OKUR,OnKure Therapeutics Inc. Class A Common Stock,$2.83,-0.02,-0.702%,38341403.00,United States,2021,54255,Health Care,Biotechnology: Pharmaceutical Preparations +OKYO,OKYO Pharma Limited Ordinary Shares,$2.19,0.06,2.817%,74109600.00,Guernsey,2022,1021272,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +OLB,The OLB Group Inc. Common Stock,$0.55,0.0328,6.342%,7388928.00,United States,,138185,Real Estate,Real Estate +OLED,Universal Display Corporation Common Stock,$118.03,0.39,0.332%,5611411177.00,United States,,756567,Technology,Electrical Products +OLLI,Ollie's Bargain Outlet Holdings Inc. Common Stock,$106.83,-4.17,-3.757%,6552156210.00,United States,2015,1263850,Consumer Discretionary,Department/Specialty Retail Stores +OLMA,Olema Pharmaceuticals Inc. Common Stock,$24.57,-1.53,-5.862%,1846967047.00,United States,2020,846699,Health Care,Biotechnology: Pharmaceutical Preparations +OLN,Olin Corporation Common Stock,$22.74,-0.13,-0.568%,2595123569.00,United States,,4078850,Industrials,Major Chemicals +OLOX,Olenox Industries Inc. Common Stock,$1.45,0.03,2.113%,8963553.00,United States,2017,477993,Consumer Discretionary,RETAIL: Building Materials +OLP,One Liberty Properties Inc. Common Stock,$20.62,-0.54,-2.552%,446323240.00,United States,1986,77153,Real Estate,Real Estate Investment Trusts +OLPX,Olaplex Holdings Inc. Common Stock,$1.52,-0.08,-5.00%,1014618096.00,United States,2021,1136422,Consumer Discretionary,Package Goods/Cosmetics +OM,Outset Medical Inc. Common Stock,$5.025,-0.655,-11.532%,91219277.00,United States,2020,659945,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +OMAB,Grupo Aeroportuario del Centro Norte S.A.B. de C.V. ADS,$119.32,-0.90,-0.749%,5759716959.00,Mexico,2006,95528,Consumer Discretionary,Aerospace +OMC,Omnicom Group Inc. Common Stock,$76.54,-1.49,-1.91%,14770962601.00,United States,,3977725,Consumer Discretionary,Advertising +OMCL,Omnicell Inc. Common Stock ($0.001 par value),$49.04,-0.92,-1.841%,2200744639.00,United States,2001,413957,Technology,Computer Manufacturing +OMDA,Omada Health Inc. Common Stock,$15.41,-0.88,-5.402%,892363004.00,United States,2025,1051484,Health Care,Medical/Nursing Services +OMER,Omeros Corporation Common Stock,$11.81,-0.86,-6.788%,837334421.00,United States,2009,1373206,Health Care,Biotechnology: Pharmaceutical Preparations +OMEX,Odyssey Marine Exploration Inc. Common Stock,$2.28,-0.06,-2.564%,127083759.00,United States,,1365403,Consumer Discretionary,Marine Transportation +OMF,OneMain Holdings Inc. Common Stock,$65.05,-0.12,-0.184%,7658460746.00,United States,2013,1933025,Finance,Finance: Consumer Services +OMH,Ohmyhome Limited Class A Ordinary Shares,$1.53,0.01,0.658%,36093171.00,Singapore,2023,107706,Finance,Real Estate +OMSE,OMS Energy Technologies Inc. Ordinary Shares,$4.71,-0.02,-0.423%,199933396.00,Singapore,2025,15621,Consumer Discretionary,Oil and Gas Field Machinery +ON,ON Semiconductor Corporation Common Stock,$64.93,2.30,3.672%,26126430291.00,United States,,11504017,Technology,Semiconductors +ONB,Old National Bancorp Common Stock,$23.77,-0.105,-0.44%,9288674210.00,United States,,3906243,Finance,Major Banks +ONBPO,Old National Bancorp Depositary Shares Each Representing a 1/40th Interest in a Share of Series C Preferred Stock,$25.40,0.0372,0.147%,9925634200.00,United States,,3696,Finance,Major Banks +ONBPP,Old National Bancorp Depositary Shares Each Representing a 1/40th Interest in a Share of Series A Preferred Stock,$25.32,-0.03,-0.118%,9894372360.00,United States,,2309,Finance,Major Banks +ONC,BeOne Medicines Ltd. American Depositary Shares,$350.00,13.84,4.117%,38730280050.00,Cayman Islands,2016,254567,Health Care,Biotechnology: Pharmaceutical Preparations +ONCH,1RT Acquisition Corp. Class A Ordinary Share,$10.20,0.02,0.196%,0.00,United States,2025,53011,, +ONCHU,1RT Acquisition Corp. Units,$10.36,0.00,0.00%,0.00,United States,2025,6520,, +ONCHW,1RT Acquisition Corp. Warrant,$0.60,0.0499,9.071%,0.00,United States,2025,1683,Finance,Blank Checks +ONCO,Onconetix Inc. Common Stock,$1.50,-0.02,-1.316%,2332523.00,United States,2022,21409,Health Care,Biotechnology: Pharmaceutical Preparations +ONCY,Oncolytics Biotech Inc. Common Shares,$1.11,-0.05,-4.31%,119443077.00,Canada,,1270822,Health Care,Biotechnology: Pharmaceutical Preparations +ONDS,Ondas Inc. Common Stock,$12.27,0.01,0.082%,5185013704.00,United States,,100928191,Technology,Radio And Television Broadcasting And Communications Equipment +ONEG,OneConstruction Group Limited Ordinary Shares,$4.84,0.14,2.979%,77440000.00,Hong Kong,2024,161770,Consumer Discretionary,Homebuilding +ONEW,OneWater Marine Inc. Class A Common Stock,$13.22,-0.34,-2.507%,219002269.00,United States,2020,128580,Consumer Discretionary,Auto & Home Supply Stores +ONFO,Onfolio Holdings Inc. Common Stock,$0.6971,-0.0039,-0.556%,4090698.00,United States,2022,109679,Technology,EDP Services +ONIT,Onity Group Inc. Common Stock,$47.21,-4.69,-9.037%,380459442.00,United States,,84019,Finance,Finance: Consumer Services +ONL,Orion Properties Inc. Common Stock,$2.37,-0.04,-1.66%,133465683.00,United States,2021,363970,Real Estate,Real Estate Investment Trusts +ONMD,OneMedNet Corp Class A Common Stock,$0.9097,0.003,0.331%,46399435.00,United Kingdom,2021,143270,Health Care,Biotechnology: Commercial Physical & Biological Resarch +ONMDW,OneMedNet Corp Warrant,$0.134,0.0001,0.075%,6834697.00,United Kingdom,2021,13698,Health Care,Biotechnology: Commercial Physical & Biological Resarch +ONON,On Holding AG Class A Ordinary Shares,$44.86,-0.66,-1.45%,28474160197.00,,2021,4592424,Consumer Discretionary,Shoe Manufacturing +ONTF,ON24 Inc. Common Stock,$7.98,0.00,0.00%,337413512.00,United States,2021,265419,Technology,Computer Software: Prepackaged Software +ONTO,Onto Innovation Inc. Common Stock,$213.70,5.24,2.514%,10473685319.00,United States,,774972,Industrials,Industrial Machinery/Components +OOMA,Ooma Inc. Common Stock,$12.08,-0.18,-1.468%,333408000.00,United States,2015,150484,Technology,EDP Services +OPAD,Offerpad Solutions Inc. Class A Common Stock,$1.16,-0.01,-0.855%,54764351.00,United States,2020,1959872,Finance,Real Estate +OPAL,OPAL Fuels Inc. Class A Common Stock,$2.50,0.18,7.759%,433488035.00,United States,2021,282332,Utilities,Natural Gas Distribution +OPBK,OP Bancorp Common Stock,$13.63,-0.065,-0.475%,202890919.00,United States,2018,37206,Finance,Major Banks +OPCH,Option Care Health Inc. Common Stock,$34.72,-0.61,-1.727%,5511199552.00,United States,,1650215,Health Care,Medical/Nursing Services +OPEN,Opendoor Technologies Inc Common Stock,$5.76,-0.05,-0.861%,5493819565.00,United States,,43490620,Finance,Real Estate +OPENL,Opendoor Technologies Inc Series A Warrants each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $13.00 per warrant,$0.5653,-0.0178,-3.053%,539176424.00,United States,,705706,Finance,Real Estate +OPENW,Opendoor Technologies Inc Series K Warrants each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $9.00 per warrant,$1.04,-0.01,-0.952%,991939644.00,United States,,618864,Finance,Real Estate +OPENZ,Opendoor Technologies Inc Series Z Warrants each whole warrant exercisable to purchase one share of Common Stock at an exercise price of $17.00 per warrant,$0.5001,-0.0355,-6.628%,476989438.00,United States,,907198,Finance,Real Estate +OPFI,OppFi Inc. Class A Common Stock,$9.64,-0.21,-2.132%,832534992.00,United States,2020,530706,Finance,Finance: Consumer Services +OPHC,OptimumBank Holdings Inc. Common Stock,$4.79,-0.02,-0.416%,55247587.00,United States,,19242,Finance,Major Banks +OPK,OPKO Health Inc. Common Stock,$1.28,-0.01,-0.775%,982657638.00,United States,,4527206,Health Care,Biotechnology: Pharmaceutical Preparations +OPLN,OPENLANE Inc. Common Stock,$30.14,0.02,0.066%,3202772456.00,United States,,895959,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +OPP,RiverNorth/DoubleLine Strategic Opportunity Fund Inc. Common Stock,$7.85,-0.005,-0.064%,0.00,United States,2016,72960,Finance,Finance/Investors Services +OPP^A,RiverNorth/DoubleLine Strategic Opportunity Fund Inc. 4.375% Series A Cumulative Preferred Stock,$17.05,0.00,0.00%,,United States,,5406,, +OPP^B,RiverNorth/DoubleLine Strategic Opportunity Fund Inc. 4.75% Series B Cumulative Preferred Stock,$18.94,0.04,0.212%,,United States,,4051,, +OPP^C,RiverNorth/DoubleLine Strategic Opportunity Fund Inc. 6.00% Series C Term Preferred Stock (Liquidation Preference $10.00 per share),$10.25,0.00,0.00%,,United States,,255,, +OPRA,Opera Limited American Depositary Shares,$14.18,0.34,2.457%,1269122110.00,Norway,2018,901142,Technology,Computer Software: Prepackaged Software +OPRT,Oportun Financial Corporation Common Stock,$5.40,-0.38,-6.574%,238296708.00,United States,2019,383591,Finance,Finance: Consumer Services +OPRX,OptimizeRx Corporation Common Stock,$10.97,-0.80,-6.797%,204487952.00,United States,,327487,Real Estate,Real Estate +OPTT,Ocean Power Technologies Inc. Common Stock,$0.6352,-0.063,-9.023%,123838551.00,United States,2007,29386758,Utilities,Electric Utilities: Central +OPTU,Optimum Communications Inc. Class A common stock,$1.58,-0.05,-3.067%,742332563.00,United States,2017,2029451,Telecommunications,Cable & Other Pay Television Services +OPTX,Syntec Optics Holdings Inc. Class A Common Stock,$5.96,0.58,10.781%,220044547.00,United States,2022,1088444,Technology,Electronic Components +OPTXW,Syntec Optics Holdings Inc. Warrant,$1.02,0.04,4.082%,37658631.00,United States,2022,137714,Technology,Electronic Components +OPXS,Optex Systems Holdings Inc. Common Stock,$15.72,0.76,5.08%,109055268.00,United States,,57485,Technology,Electronic Components +OPY,Oppenheimer Holdings Inc. Class A Common Stock (DE),$75.18,-0.44,-0.582%,790934874.00,United States,,20917,Finance,Investment Bankers/Brokers/Service +OR,OR Royalties Inc. Common Shares,$46.82,0.80,1.738%,8816767840.00,Canada,2016,1621609,Basic Materials,Precious Metals +ORA,Ormat Technologies Inc. Common Stock,$127.97,1.77,1.403%,7778245922.00,United States,2004,512696,Utilities,Electric Utilities: Central +ORBS,Eightco Holdings Inc. Common Stock,$1.40,-0.03,-2.098%,276964261.00,United States,,7917097,, +ORC,Orchid Island Capital Inc. Common Stock,$8.32,-0.03,-0.359%,1262245171.00,United States,2013,6705934,Real Estate,Real Estate Investment Trusts +ORCL,Oracle Corporation Common Stock,$172.80,-2.10,-1.201%,496476864000.00,United States,1986,35882668,Technology,Computer Software: Prepackaged Software +ORGN,Origin Materials Inc. Common Stock,$0.1994,-0.0057,-2.779%,30950157.00,United States,2020,748383,Industrials,Major Chemicals +ORGNW,Origin Materials Inc. Warrants,$0.004,0.0006,17.647%,620866.00,United States,2020,58685,Industrials,Major Chemicals +ORGO,Organogenesis Holdings Inc. Class A Common Stock,$3.89,-0.10,-2.506%,493688232.00,United States,2016,444958,Health Care,Biotechnology: Pharmaceutical Preparations +ORI,Old Republic International Corporation Common Stock,$39.05,0.35,0.904%,9662922500.00,United States,,1971959,Finance,Property-Casualty Insurers +ORIC,Oric Pharmaceuticals Inc. Common Stock,$10.98,-1.13,-9.331%,1069334283.00,United States,2020,1768608,Health Care,Biotechnology: Pharmaceutical Preparations +ORIO,Orion Digital Corp. Common Shares,$1.37,0.06,4.58%,32836914.00,Canada,,124563,Finance,Finance: Consumer Services +ORIQ,Origin Investment Corp I Ordinary Shares,$10.20,0.00,0.00%,0.00,Singapore,2025,23,, +ORIQU,Origin Investment Corp I Units,$10.22,0.03,0.294%,70518000.00,Singapore,2025,559,, +ORIS,Oriental Rise Holdings Limited Ordinary Shares,$1.37,-0.09,-6.164%,1507856.00,China,2024,158130,Consumer Staples,Farming/Seeds/Milling +ORKA,Oruka Therapeutics Inc. Common Stock,$35.16,0.26,0.745%,1702068597.00,United States,,568702,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +ORKT,Orangekloud Technology Inc. Class A Ordinary Shares,$0.792,-0.0126,-1.566%,4625082.00,Singapore,2024,33963,Technology,Computer Software: Prepackaged Software +ORLA,Orla Mining Ltd. Common Shares,$19.55,0.74,3.934%,6644971101.00,,2020,2856614,Basic Materials,Precious Metals +ORLY,O'Reilly Automotive Inc. Common Stock,$101.37,0.75,0.745%,85566831806.00,United States,1993,5550693,Consumer Discretionary,Auto & Home Supply Stores +ORMP,Oramed Pharmaceuticals Inc. Common Stock,$3.47,-0.01,-0.287%,138114519.00,Israel,,177586,Health Care,Biotechnology: Pharmaceutical Preparations +ORN,Orion Group Holdings Inc. Common,$12.05,-0.03,-0.248%,480806785.00,United States,,234665,Industrials,Military/Government/Technical +ORRF,Orrstown Financial Services Inc. Common Stock,$34.57,-1.49,-4.132%,674072479.00,United States,,481554,Finance,Major Banks +OS,OneStream Inc. Class A Common Stock,$23.68,0.00,0.00%,5773462785.00,United States,2024,2181443,Technology,Computer Software: Prepackaged Software +OSBC,Old Second Bancorp Inc. Common Stock,$19.51,-0.31,-1.564%,1027576560.00,United States,,374550,Finance,Major Banks +OSCR,Oscar Health Inc. Class A Common Stock,$14.87,-0.01,-0.067%,3935851080.00,United States,2021,7621390,Health Care,Medical Specialities +OSG,Octave Specialty Group Inc. Common Stock,$5.75,-0.22,-3.685%,251919201.00,United States,,671108,Finance,Property-Casualty Insurers +OSIS,OSI Systems Inc. Common Stock (DE),$271.39,-5.58,-2.015%,4607624953.00,United States,1997,315881,Technology,Semiconductors +OSK,Oshkosh Corporation (Holding Company)Common Stock,$146.16,-4.23,-2.813%,9245251265.00,United States,,1508575,Industrials,Auto Manufacturing +OSPN,OneSpan Inc. Common Stock,$11.68,-0.34,-2.829%,444156797.00,United States,,406828,Technology,EDP Services +OSRH,OSR Holdings Inc. Common Stock,$0.62,-0.072,-10.405%,15917129.00,United States,2023,1368539,Health Care,Medical/Dental Instruments +OSRHW,OSR Holdings Inc. Warrant,$0.0663,-0.0001,-0.151%,1702106.00,United States,2023,7668,Health Care,Medical/Dental Instruments +OSS,One Stop Systems Inc. Common Stock,$10.36,-0.15,-1.427%,253980487.00,United States,2018,1796902,Technology,Computer Manufacturing +OSTX,OS Therapies Incorporated Common Stock,$1.42,-0.03,-2.069%,50004380.00,,2024,368307,Health Care,Biotechnology: Pharmaceutical Preparations +OSUR,OraSure Technologies Inc. Common Stock,$2.70,-0.03,-1.099%,193680531.00,United States,,484217,Health Care,Medical/Dental Instruments +OSW,OneSpaWorld Holdings Limited Common Shares,$19.37,-0.18,-0.921%,1974817620.00,Bahamas,,634251,Consumer Discretionary,Hotels/Resorts +OTEX,Open Text Corporation Common Shares,$27.38,-1.06,-3.727%,6900063124.00,Canada,1996,1682193,Technology,EDP Services +OTF,Blue Owl Technology Finance Corp. Common Stock,$13.26,-0.19,-1.413%,6208919126.00,United States,2025,1291515,, +OTGA,OTG Acquisition Corp. I Class A Ordinary Share ,$10.07,0.00,0.00%,0.00,United States,2025,20413,Finance,Blank Checks +OTGAU,OTG Acquisition Corp. I Unit,$10.2501,-0.0199,-0.194%,0.00,United States,2025,3509,Finance,Blank Checks +OTH,Off The Hook YS Inc. Common Stock,$3.20,0.17,5.611%,76000000.00,,2025,128208,Industrials,Marine Transportation +OTIS,Otis Worldwide Corporation Common Stock ,$88.60,-1.95,-2.154%,34528824399.00,United States,2020,6820772,Technology,Consumer Electronics/Appliances +OTLK,Outlook Therapeutics Inc. Common Stock,$0.4488,-0.0484,-9.735%,32991043.00,United States,2016,3604512,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +OTLY,Oatly Group AB American Depositary Shares,$11.13,-0.58,-4.953%,333098551.00,Sweden,2021,55950,Consumer Staples,Packaged Foods +OTTR,Otter Tail Corporation Common Stock,$86.57,-0.82,-0.938%,3627760866.00,United States,,161476,Utilities,Electric Utilities: Central +OUST,Ouster Inc. Common Stock,$23.88,-0.53,-2.171%,1432924630.00,United States,,1352037,Industrials,Industrial Machinery/Components +OUSTZ,Ouster Inc. Warrants,$0.0611,0.0011,1.833%,3666319.00,United States,,5510,Industrials,Industrial Machinery/Components +OUT,OUTFRONT Media Inc. Common Stock,$24.41,-0.44,-1.771%,4082195488.00,United States,2014,983486,Real Estate,Real Estate Investment Trusts +OVBC,Ohio Valley Banc Corp. Common Stock,$41.05,-0.01,-0.024%,193386591.00,United States,,7003,Finance,Major Banks +OVID,Ovid Therapeutics Inc. Common Stock,$1.55,-0.26,-14.365%,201785747.00,United States,2017,4866955,Health Care,Biotechnology: Pharmaceutical Preparations +OVLY,Oak Valley Bancorp (CA) Common Stock,$31.68,-0.47,-1.462%,265738841.00,United States,,15310,Finance,Major Banks +OVV,Ovintiv Inc. (DE),$42.76,-0.01,-0.023%,10829336026.00,Canada,,3746633,Energy,Oil & Gas Production +OWL,Blue Owl Capital Inc. Class A Common Stock,$14.50,-0.03,-0.206%,22614653662.00,United States,2020,11252114,Finance,Investment Managers +OWLS,OBOOK Holdings Inc. Class A Common Shares,$5.91,-0.51,-7.944%,522312036.00,Taiwan,,138963,Technology,Computer Software: Prepackaged Software +OWLT,Owlet Inc. Class A Common Stock,$13.22,-0.69,-4.96%,364615625.00,United States,2020,285008,Industrials,Industrial Machinery/Components +OXBR,Oxbridge Re Holdings Limited Ordinary Shares,$1.05,0.015,1.449%,8059928.00,Cayman Islands,2014,10560,Finance,Property-Casualty Insurers +OXBRW,Oxbridge Re Holdings Limited Warrant expiring 3/26/2029,$0.104,0.00,0.00%,798317.00,Cayman Islands,2014,100,Finance,Property-Casualty Insurers +OXLC,Oxford Lane Capital Corp. Common Stock,$14.10,0.08,0.571%,2447760000.00,United States,2011,601949,Finance,Investment Managers +OXLCG,Oxford Lane Capital Corp. 7.95% Notes due 2032,$25.4116,0.0216,0.085%,0.00,United States,,1419,Finance,Investment Managers +OXLCI,Oxford Lane Capital Corp. 8.75% Notes due 2030,$25.8999,-0.0001,0.00%,0.00,United States,,1806,, +OXLCL,Oxford Lane Capital Corp. 6.75% Notes due 2031,$24.2999,0.1999,0.829%,4218462640.00,United States,,2507,Finance,Finance Companies +OXLCN,Oxford Lane Capital Corp. 7.125% Series 2029 Term Preferred Stock,$24.56,-0.01,-0.041%,4263616000.00,United States,,4936,Finance,Investment Managers +OXLCO,Oxford Lane Capital Corp. Preferred Stock Shares 6.00% Series 2029,$23.63,0.00,0.00%,4102168000.00,United States,,336,Finance,Investment Managers +OXLCP,Oxford Lane Capital Corp. 6.25% Series 2027 Term Preferred Shares,$24.7001,-0.0091,-0.037%,4287937360.00,United States,,14911,Finance,Investment Managers +OXLCZ,Oxford Lane Capital Corp. 5.00% Notes due 2027,$24.57,0.00,0.00%,4265352000.00,United States,,3267,Finance,Finance Companies +OXM,Oxford Industries Inc. Common Stock,$36.95,-0.27,-0.725%,549719597.00,United States,,260316,Industrials,Garments and Clothing +OXSQ,Oxford Square Capital Corp. Common Stock,$1.92,0.04,2.128%,156805263.00,United States,2003,874421,Finance,Blank Checks +OXSQG,Oxford Square Capital Corp. 5.50% Notes due 2028,$24.1898,0.0298,0.123%,1542289882.00,United States,,1298,Consumer Discretionary,Other Consumer Services +OXSQH,Oxford Square Capital Corp. 7.75% Notes due 2030,$25.33,0.08,0.317%,0.00,United States,,472,Finance,Blank Checks +OXY,Occidental Petroleum Corporation Common Stock,$44.83,0.28,0.629%,44166983756.00,United States,,9806248,Energy,Oil & Gas Production +OYSE,Oyster Enterprises II Acquisition Corp Class A Ordinary Shares,$10.24,0.03,0.294%,0.00,United States,2025,633,Finance,Blank Checks +OYSER,Oyster Enterprises II Acquisition Corp Rights,$0.1879,-0.0189,-9.139%,0.00,United States,2025,154,, +OZ,Belpointe PREP LLC Class A Units,$52.12,-0.35,-0.667%,202808145.00,,,4081,Real Estate,Real Estate Investment Trusts +OZK,Bank OZK Common Stock,$46.80,0.33,0.71%,5294770978.00,United States,,1168766,Finance,Major Banks +OZKAP,Bank OZK 4.625% Series A Non-Cumulative Perpetual Preferred Stock,$16.73,0.01,0.06%,1892767488.00,United States,,39043,Finance,Major Banks +PAA,Plains All American Pipeline L.P. Common Units representing Limited Partner Interests,$19.73,0.18,0.921%,13919471002.00,United States,1998,4071016,Energy,Natural Gas Distribution +PAAS,Pan American Silver Corp. Common Stock,$65.92,1.61,2.503%,27821338240.00,Canada,,11709388,Basic Materials,Precious Metals +PAC,Grupo Aeroportuario Del Pacifico S.A. B. de C.V. Grupo Aeroportuario Del Pacifico S.A. de C.V. (each representing 10 Series B shares),$281.46,-2.07,-0.73%,14221539389.00,Mexico,2006,55047,Consumer Discretionary,Aerospace +PACB,Pacific Biosciences of California Inc. Common Stock,$2.38,-0.19,-7.393%,718539686.00,United States,2010,7485697,Industrials,Biotechnology: Laboratory Analytical Instruments +PACH,Pioneer Acquisition I Corp Class A Ordinary Shares,$10.12,0.00,0.00%,0.00,United States,2025,130,, +PACHU,Pioneer Acquisition I Corp Units,$10.21,0.00,0.00%,0.00,United States,2025,1,, +PACHW,Pioneer Acquisition I Corp Warrants,$0.2799,0.00,0.00%,0.00,United States,2025,40,, +PACK,Ranpak Holdings Corp Class A Common Stock,$5.18,-0.05,-0.956%,437067007.00,United States,2018,258048,Consumer Discretionary,Containers/Packaging +PACS,PACS Group Inc. Common Stock,$34.35,-0.03,-0.087%,5379730196.00,United States,2024,1129463,Health Care,Hospital/Nursing Management +PAG,Penske Automotive Group Inc. Common Stock,$159.41,-0.99,-0.617%,10498511774.00,United States,,273726,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +PAGP,Plains GP Holdings L.P. Class A Units representing Limited Partner Interests,$20.86,0.15,0.724%,4127946267.00,United States,,1811072,Energy,Natural Gas Distribution +PAGS,PagSeguro Digital Ltd. Class A Common Shares,$11.97,0.26,2.22%,3945412835.00,Cayman Islands,2018,4362565,Technology,EDP Services +PAHC,Phibro Animal Health Corporation Class A Common Stock,$38.80,-0.72,-1.822%,1572703990.00,United States,2014,157698,Health Care,Biotechnology: Pharmaceutical Preparations +PAI,Western Asset Investment Grade Income Fund Inc.,$12.60,0.04,0.318%,0.00,United States,,13134,Finance,Trusts Except Educational Religious and Charitable +PAII,Pyrophyte Acquisition Corp. II Class A Ordinary Shares,$10.15,0.02,0.197%,0.00,,2025,60528,, +PAL,Proficient Auto Logistics Inc. Common Stock,$9.85,-0.16,-1.598%,274125864.00,United States,2024,67322,Consumer Discretionary,Transportation Services +PALI,Palisade Bio Inc. Common Stock,$1.67,-0.14,-7.735%,248835361.00,United States,,3417263,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PAM,Pampa Energia S.A.,$88.61,-0.62,-0.695%,4819113155.00,Argentina,,299204,Utilities,Electric Utilities: Central +PAMT,PAMT CORP Common Stock,$10.86,0.42,4.023%,227256577.00,United States,,26913,Industrials,Trucking Freight/Courier Services +PANL,Pangaea Logistics Solutions Ltd. Common Shares,$8.42,0.30,3.695%,547078453.00,United States,2013,1043290,Consumer Discretionary,Marine Transportation +PANW,Palo Alto Networks Inc. Common Stock,$183.74,0.24,0.131%,128066780000.00,United States,,4159810,Technology,Computer peripheral equipment +PAPL,Pineapple Financial Inc. Common Stock,$0.9556,-0.0444,-4.44%,24834755.00,,,437495,Finance,Finance: Consumer Services +PAR,PAR Technology Corporation Common Stock,$28.55,0.44,1.565%,1158873964.00,United States,,1938219,Miscellaneous,Office Equipment/Supplies/Services +PARK,Park Dental Partners Inc. Common Stock,$16.84,-2.53,-13.061%,68903150.00,United States,2025,38746,Health Care,Misc Health and Biotechnology Services +PARR,Par Pacific Holdings Inc. Common Stock,$36.24,1.16,3.307%,1822547398.00,United States,,1462922,Energy,Oil & Gas Production +PASG,Passage Bio Inc. Common Stock,$11.34,-1.26,-10.00%,36046571.00,United States,2020,101812,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PASW,Ping An Biomedical Co. Ltd. Ordinary Shares,$0.2409,0.0149,6.593%,4938450.00,Hong Kong,1999,873687,Consumer Discretionary,Apparel +PATH,UiPath Inc. Class A Common Stock,$14.11,-0.25,-1.741%,7545318041.00,United States,2021,16192507,Technology,Computer Software: Prepackaged Software +PATK,Patrick Industries Inc. Common Stock,$129.67,-0.26,-0.20%,4314911368.00,United States,,192467,Consumer Discretionary,Auto Parts:O.E.M. +PAVM,PAVmed Inc. Common Stock,$8.12,-0.53,-6.127%,7601782.00,United States,2016,86775,Health Care,Medical/Dental Instruments +PAVS,Paranovus Entertainment Technology Ltd. Class A Ordinary Shares,$1.59,0.00,0.00%,1134258.00,China,2019,82994,Health Care, Medicinal Chemicals and Botanical Products +PAX,Patria Investments Limited Class A Common Shares,$15.45,-0.50,-3.135%,2463789128.00,Cayman Islands,2021,1955827,Finance,Investment Managers +PAXS,PIMCO Access Income Fund Common Shares of Beneficial Interest,$15.94,0.02,0.126%,0.00,United States,2022,220557,Finance,Investment Managers +PAY,Paymentus Holdings Inc. Class A Common Stock,$28.39,-1.05,-3.567%,3560915314.00,United States,2021,529764,Real Estate,Real Estate +PAYC,Paycom Software Inc. Common Stock,$139.65,-2.54,-1.786%,7857966548.00,United States,2014,1229355,Technology,Computer Software: Prepackaged Software +PAYO,Payoneer Global Inc. Common Stock,$6.30,-0.10,-1.563%,2245573915.00,United States,,6202212,Real Estate,Real Estate +PAYS,Paysign Inc. Common Stock,$4.26,-0.10,-2.294%,234482703.00,United States,,357348,Technology,EDP Services +PAYX,Paychex Inc. Common Stock,$102.45,-1.41,-1.358%,36776215253.00,United States,1983,4080573,Industrials,Diversified Commercial Services +PB,Prosperity Bancshares Inc. Common Stock,$67.11,-5.79,-7.942%,6374901846.00,United States,,5127533,Finance,Major Banks +PBA,Pembina Pipeline Corp. Ordinary Shares (Canada),$41.67,0.48,1.165%,24212270160.00,Canada,,1484643,Energy,Oil & Gas Production +PBF,PBF Energy Inc. Class A Common Stock,$32.90,-0.14,-0.424%,3811382750.00,United States,2012,1914552,Energy,Integrated oil Companies +PBFS,Pioneer Bancorp Inc. Common Stock,$13.60,-0.12,-0.875%,341095439.00,United States,2019,10922,Finance,Banks +PBH,Prestige Consumer Healthcare Inc. Common Stock,$63.15,-0.75,-1.174%,3036505232.00,United States,2005,321181,Health Care,Biotechnology: Pharmaceutical Preparations +PBHC,Pathfinder Bancorp Inc. Common Stock (MD),$14.25,0.01,0.07%,87986739.00,United States,,331,Finance,Major Banks +PBI,Pitney Bowes Inc. Common Stock,$10.13,-0.04,-0.393%,1630101001.00,United States,,1197033,Miscellaneous,Office Equipment/Supplies/Services +PBI^B,Pitney Bowes Inc 6.70% Notes Due 2043,$20.44,-0.04,-0.195%,,United States,,28705,, +PBM,Psyence Biomedical Ltd. Common Shares,$0.77,0.1389,22.009%,787076.00,Canada,,1429875,Health Care,Biotechnology: Pharmaceutical Preparations +PBMWW,Psyence Biomedical Ltd. Warrant,$0.0199,0.0048,31.788%,20341.00,Canada,,6169,Health Care,Biotechnology: Pharmaceutical Preparations +PBR,Petroleo Brasileiro S.A. Petrobras ADS,$15.38,0.36,2.397%,99114354940.00,Brazil,,37940558,Energy,Oil & Gas Production +PBT,Permian Basin Royalty Trust Common Stock,$18.91,0.09,0.478%,881372332.00,United States,,48764,Energy,Oil & Gas Production +PBYI,Puma Biotechnology Inc Common Stock,$6.32,-0.25,-3.805%,318471796.00,United States,,285382,Health Care,Biotechnology: Pharmaceutical Preparations +PCAP,ProCap Acquisition Corp Class A Ordinary Shares,$10.21,0.00,0.00%,0.00,United States,2025,5838,Finance,Blank Checks +PCAPW,ProCap Acquisition Corp Warrant,$0.3899,0.0124,3.285%,0.00,United States,2025,9705,Finance,Blank Checks +PCAR,PACCAR Inc. Common Stock,$123.06,2.25,1.862%,64631648419.00,United States,,3930880,Consumer Discretionary,Motor Vehicles +PCB,PCB Bancorp Common Stock,$21.54,-0.52,-2.357%,307176641.00,United States,2018,21441,Finance,Major Banks +PCF,High Income Securities Fund Common Stock,$6.11,0.00,0.00%,0.00,United States,,36528,Finance,Trusts Except Educational Religious and Charitable +PCG,Pacific Gas & Electric Co. Common Stock,$14.93,-0.24,-1.582%,39947514444.00,United States,,18603634,Utilities,Power Generation +PCG^A,Pacific Gas & Electric Co. 6% Preferred Stock,$22.41,0.08,0.358%,,United States,,8181,, +PCG^B,Pacific Gas & Electric Co. 5 1/2% Preferred Stock,$20.20,0.02,0.099%,,United States,,4918,, +PCG^C,Pacific Gas & Electric Co. 5% 1st Preferred Stock,$19.08,0.00,0.00%,,United States,,13,, +PCG^D,Pacific Gas & Electric Co. 5% 1st Red. Preferred Stock,$19.00,-0.03,-0.158%,,United States,,349,, +PCG^E,Pacific Gas & Electric Co. 5% 1st A Preferred Stock,$18.94,0.00,0.00%,,United States,,128,, +PCG^G,Pacific Gas & Electric Co. 4.80% 1st Preferred Stock,$18.59,0.00,0.00%,,United States,,3,, +PCG^H,Pacific Gas & Electric Co. 4.50% 1st Preferred Stock,$17.9783,0.00,0.00%,,United States,,3,, +PCG^I,Pacific Gas & Electric Co. 4.36% 1st Preferred Stock,$16.60,-0.80,-4.598%,,United States,,1953,, +PCG^X,PG&E Corp 6.000% Series A Mandatory Convertible Preferred Stock,$39.02,-0.3799,-0.964%,,United States,,383401,, +PCH,PotlatchDeltic Corporation Common Stock,$41.43,-1.15,-2.701%,3202166130.00,United States,,927313,Real Estate,Real Estate Investment Trusts +PCLA,PicoCELA Inc. American Depositary Shares,$6.48,1.60,32.787%,26916656.00,Japan,2025,383356,Consumer Discretionary,Building Products +PCM,PCM Fund Inc. Common Stock,$5.99,0.02,0.335%,0.00,United States,1993,79226,Finance,Trusts Except Educational Religious and Charitable +PCN,Pimco Corporate & Income Strategy Fund Common Stock,$12.78,0.00,0.00%,0.00,United States,2001,208697,Finance,Investment Managers +PCOR,Procore Technologies Inc. Common Stock,$62.20,-0.95,-1.504%,9670225292.00,United States,2021,2981233,Technology,Computer Software: Prepackaged Software +PCQ,PIMCO California Municipal Income Fund Common Stock,$8.92,0.03,0.337%,0.00,United States,2001,94588,Finance,Investment Managers +PCRX,Pacira BioSciences Inc. Common Stock,$20.38,0.53,2.67%,876773585.00,United States,2011,696509,Health Care,Biotechnology: Pharmaceutical Preparations +PCSA,Processa Pharmaceuticals Inc. Common Stock,$3.14,-0.05,-1.567%,7114515.00,United States,,22687,Health Care,Biotechnology: Pharmaceutical Preparations +PCSC,Perceptive Capital Solutions Corp Class A Ordinary Shares,$13.90,0.03,0.216%,0.00,United States,2024,24055,, +PCT,PureCycle Technologies Inc. Common stock,$11.35,0.01,0.088%,2045251159.00,United States,,3297605,Industrials,Major Chemicals +PCTTU,PureCycle Technologies Inc. Unit,$9.73,0.00,0.00%,1753329848.00,United States,,264,Industrials,Major Chemicals +PCTTW,PureCycle Technologies Inc. Warrant,$1.4099,0.0143,1.025%,254061640.00,United States,,22439,Industrials,Major Chemicals +PCTY,Paylocity Holding Corporation Common Stock,$140.69,-1.45,-1.02%,7650948289.00,United States,2014,488037,Technology,Computer Software: Prepackaged Software +PCVX,Vaxcyte Inc. Common Stock,$51.37,-2.98,-5.483%,6724654730.00,United States,2020,902574,Health Care,Biotechnology: Pharmaceutical Preparations +PCYO,Pure Cycle Corporation Common Stock,$11.47,-0.38,-3.207%,276319239.00,United States,,67971,Utilities,Water Supply +PD,PagerDuty Inc. Common Stock,$10.76,-0.21,-1.914%,987518411.00,United States,2019,1733583,Technology,Computer Software: Prepackaged Software +PDC,Perpetuals.com Ltd American Depositary Shares,$5.52,-0.87,-13.615%,16839146.00,Japan,2023,260187,Technology,EDP Services +PDCC,Pearl Diver Credit Company Inc. Common Stock,$13.85,-0.0052,-0.038%,0.00,,2024,309,, +PDD,PDD Holdings Inc. American Depositary Shares,$102.81,-4.10,-3.835%,145953852758.00,China,2018,10589407,Technology,EDP Services +PDEX,Pro-Dex Inc. Common Stock,$39.42,-1.81,-4.39%,128588198.00,United States,,45494,Health Care,Medical/Dental Instruments +PDFS,PDF Solutions Inc. Common Stock,$34.46,0.61,1.802%,1361616567.00,United States,2001,269982,Technology,Computer Software: Prepackaged Software +PDI,PIMCO Dynamic Income Fund Common Stock,$18.20,0.02,0.11%,4424238000.00,United States,2012,2374411,Finance,Trusts Except Educational Religious and Charitable +PDLB,Ponce Financial Group Inc. Common Stock,$16.77,0.14,0.842%,402498866.00,United States,2017,180696,Finance,Savings Institutions +PDM,Piedmont Realty Trust Inc. Class A Common Stock,$8.02,-0.30,-3.606%,998644610.00,United States,,606007,Real Estate,Building operators +PDO,PIMCO Dynamic Income Opportunities Fund Common Shares of Beneficial Interest,$13.97,0.03,0.215%,1920143335.00,United States,2021,480438,Finance,Trusts Except Educational Religious and Charitable +PDPA,Pearl Diver Credit Company Inc. 8.00% Series A Preferred Stock Due 2029,$25.27,0.1026,0.408%,0.00,,,1835,, +PDS,Precision Drilling Corporation Common Stock,$78.86,-0.06,-0.076%,1047958869.00,Canada,,144021,Energy,Oil & Gas Production +PDSB,PDS Biotechnology Corporation Common Stock,$0.9085,0.0093,1.034%,44498609.00,United States,2015,2487895,Health Care,Biotechnology: Pharmaceutical Preparations +PDT,John Hancock Premium Dividend Fund,$12.94,0.03,0.232%,0.00,United States,,108967,Finance,Finance Companies +PDX,PIMCO Dynamic Income Strategy Fund Common Shares of Beneficial Interest,$19.99,0.04,0.201%,893692930.00,,2019,163796,Finance,Finance/Investors Services +PDYN,Palladyne AI Corp. Common Stock,$7.43,0.91,13.957%,332191013.00,United States,,70366460,Technology,Computer Software: Prepackaged Software +PDYNW,Palladyne AI Corp Warrants,$0.131,0.031,31.00%,5856934.00,United States,,472883,Technology,Computer Software: Prepackaged Software +PEB,Pebblebrook Hotel Trust Common Shares of Beneficial Interest,$11.31,-0.32,-2.752%,1284766564.00,United States,2009,3215560,Real Estate,Real Estate Investment Trusts +PEB^E,Pebblebrook Hotel Trust 6.375% Series E Cumulative Redeemable Preferred Shares of Beneficial Interest,$19.9601,0.0001,0.001%,,United States,,1002,, +PEB^F,Pebblebrook Hotel Trust 6.3% Series F Cumulative Redeemable Preferred Shares of Beneficial Interest,$20.115,0.095,0.475%,,United States,,21802,, +PEB^G,Pebblebrook Hotel Trust 6.375% Series G Cumulative Redeemable Preferred Shares of Beneficial Interest,$19.99,-0.01,-0.05%,,United States,,40671,, +PEB^H,Pebblebrook Hotel Trust 5.700% Series H Cumulative Redeemable Preferred Shares of Beneficial Interest,$17.975,-0.035,-0.194%,,United States,,1300,, +PEBK,Peoples Bancorp of North Carolina Inc. Common Stock,$35.46,-0.62,-1.718%,193591778.00,United States,,8100,Finance,Major Banks +PEBO,Peoples Bancorp Inc. Common Stock,$31.46,-0.51,-1.595%,1123215216.00,United States,,323377,Finance,Major Banks +PECO,Phillips Edison & Company Inc. Common Stock,$35.19,-0.23,-0.649%,4426902000.00,United States,2021,956979,Real Estate,Real Estate Investment Trusts +PED,Pedevco Corp. Common Stock,$0.638,0.009,1.431%,60941347.00,United States,,51585,Energy,Oil & Gas Production +PEG,Public Service Enterprise Group Incorporated Common Stock,$81.45,1.03,1.281%,40656091345.00,United States,,3638230,Utilities,Power Generation +PEGA,Pegasystems Inc. Common Stock,$49.35,-0.45,-0.904%,8375819341.00,United States,1996,1258968,Technology,EDP Services +PELI,Pelican Acquisition Corporation Ordinary Shares,$10.80,-0.20,-1.818%,0.00,United States,2025,338929,Finance,Blank Checks +PELIR,Pelican Acquisition Corporation Right,$0.7977,-0.0523,-6.153%,0.00,United States,2025,44953,Finance,Blank Checks +PELIU,Pelican Acquisition Corporation Unit,$12.42,0.02,0.161%,0.00,United States,2025,135,Finance,Blank Checks +PEN,Penumbra Inc. Common Stock,$359.03,-0.37,-0.103%,14060396408.00,United States,2015,1319190,Health Care,Medical/Dental Instruments +PENG,Penguin Solutions Inc. Common Stock,$19.72,-0.04,-0.202%,1036486296.00,United States,2017,922085,Technology,Semiconductors +PENN,PENN Entertainment Inc. Common Stock,$13.25,-0.49,-3.566%,1765562129.00,United States,1994,5857677,Consumer Discretionary,Hotels/Resorts +PEO,Adams Natural Resources Fund Inc. Common Stock,$23.91,-0.04,-0.167%,0.00,United States,,39130,Finance,Finance/Investors Services +PEP,PepsiCo Inc. Common Stock,$148.50,-0.28,-0.188%,203050008117.00,United States,,5954075,Consumer Staples,Beverages (Production/Distribution) +PEPG,PepGen Inc. Common Stock,$5.22,-0.38,-6.786%,358865729.00,United States,2022,541533,Health Care,Biotechnology: Pharmaceutical Preparations +PERF,Perfect Corp. Class A Ordinary Share,$1.66,-0.01,-0.599%,169068794.00,Taiwan,2022,49063,Technology,Computer Software: Prepackaged Software +PERI,Perion Network Ltd. Ordinary Shares,$8.93,-0.12,-1.326%,402182017.00,Israel,2006,200086,Technology,EDP Services +PESI,Perma-Fix Environmental Services Inc. Common Stock,$15.56,0.23,1.50%,288134821.00,United States,,142329,Industrials,Environmental Services +PETS,PetMed Express Inc. Common Stock,$3.28,0.04,1.235%,70092029.00,United States,,70550,Consumer Staples,Retail-Drug Stores and Proprietary Stores +PETZ,TDH Holdings Inc. Common Shares,$1.15,-0.03,-2.542%,11871758.00,China,2017,5102,Industrials,Steel/Iron Ore +PEW,GrabAGun Digital Holdings Inc. Common Stock,$3.17,0.02,0.635%,95150473.00,,2025,448458,Consumer Discretionary,Other Specialty Stores +PFAI,Pinnacle Food Group Limited Class A Common Shares,$2.36,0.15,6.787%,27612000.00,Canada,2025,131176,Consumer Staples,Farming/Seeds/Milling +PFBC,Preferred Bank Common Stock,$82.72,-1.77,-2.095%,1187587051.00,United States,,108693,Finance,Major Banks +PFD,Flaherty & Crumrine Preferred and Income Fund Incorporated,$11.77,-0.07,-0.591%,0.00,United States,1991,75661,Finance,Investment Managers +PFE,Pfizer Inc. Common Stock,$25.86,-0.64,-2.415%,147032397295.00,United States,,44976694,Health Care,Biotechnology: Pharmaceutical Preparations +PFG,Principal Financial Group Inc Common Stock,$94.05,1.82,1.973%,20662205934.00,United States,2001,1637907,Finance,Accident &Health Insurance +PFGC,Performance Food Group Company Common Stock,$97.38,-0.05,-0.051%,15270365998.00,United States,2015,1980412,Consumer Discretionary,Food Distributors +PFH,Prudential Financial Inc. 4.125% Junior Subordinated Notes due 2060,$17.84,-0.05,-0.279%,6368880000.00,United States,2020,19771,Finance,Life Insurance +PFIS,Peoples Financial Services Corp. Common Stock,$49.92,-0.68,-1.344%,498930182.00,United States,,36701,Finance,Major Banks +PFL,PIMCO Income Strategy Fund Shares of Beneficial Interest,$8.39,0.01,0.119%,0.00,United States,2003,138582,Finance,Finance Companies +PFLT,PennantPark Floating Rate Capital Ltd. Common Stock,$9.41,-0.11,-1.155%,933640401.00,United States,2022,931685,Finance,Finance: Consumer Services +PFN,PIMCO Income Strategy Fund II,$7.42,0.00,0.00%,0.00,United States,2004,465226,Finance,Finance/Investors Services +PFO,Flaherty & Crumrine Preferred and Income Opportunity Fund Incorporated,$9.59,0.03,0.314%,0.00,United States,1992,36640,Finance,Finance Companies +PFS,Provident Financial Services Inc Common Stock,$22.22,1.39,6.673%,2902429372.00,United States,2003,1746402,Finance,Savings Institutions +PFSA,Profusa Inc. Common Stock,$0.0961,-0.0083,-7.95%,8304414.00,United States,,3723997,Health Care,Medical/Dental Instruments +PFSI,PennyMac Financial Services Inc. Common Stock,$146.98,-2.48,-1.659%,7637885369.00,United States,2013,999382,Finance,Finance: Consumer Services +PFX,PhenixFIN Corporation Common Stock,$44.5578,1.5378,3.575%,89140552.00,United States,,236,Finance,Finance: Consumer Services +PFXNZ,PhenixFIN Corporation 5.25% Notes due 2028,$23.79,0.09,0.38%,47672044.00,United States,,187,Finance,Finance: Consumer Services +PG,Procter & Gamble Company (The) Common Stock,$147.34,-1.00,-0.674%,342418260928.00,United States,,7465812,Consumer Discretionary,Package Goods/Cosmetics +PGACR,Pantages Capital Acquisition Corporation Right,$0.1767,0.00,0.00%,0.00,United States,2025,38,, +PGACU,Pantages Capital Acquisition Corporation Unit,$10.57,0.00,0.00%,0.00,United States,2024,10,, +PGC,Peapack-Gladstone Financial Corporation Common Stock,$29.23,-0.19,-0.646%,513220895.00,United States,,109616,Finance,Commercial Banks +PGEN,Precigen Inc. Common Stock,$4.46,-0.27,-5.708%,1578057266.00,United States,,2786982,Health Care,Biotechnology: Pharmaceutical Preparations +PGNY,Progyny Inc. Common Stock,$24.53,0.28,1.155%,2114771873.00,United States,2019,1503354,Health Care,Misc Health and Biotechnology Services +PGP,Pimco Global StocksPlus & Income Fund Common Shares of Beneficial Interest,$9.25,0.06,0.653%,0.00,United States,2005,59871,Finance,Finance Companies +PGR,Progressive Corporation (The) Common Stock,$212.74,4.66,2.24%,124750147987.00,United States,,5058876,Finance,Property-Casualty Insurers +PGY,Pagaya Technologies Ltd. Class A Ordinary Shares,$21.07,0.30,1.444%,1736654443.00,United States,,2968928,Finance,Finance: Consumer Services +PGYWW,Pagaya Technologies Ltd. Warrants,$0.3444,-0.0006,-0.174%,28386511.00,United States,,7973,Finance,Finance: Consumer Services +PGZ,Principal Real Estate Income Fund Common Shares of Beneficial Interest,$10.01,-0.045,-0.448%,0.00,,2013,12265,Finance,Investment Managers +PH,Parker-Hannifin Corporation Common Stock,$916.27,-9.70,-1.048%,115621086693.00,United States,,1293190,Industrials,Metal Fabrications +PHAR,Pharming Group N.V. ADS each representing 10 ordinary shares,$20.59,-0.59,-2.786%,1408214094.00,Netherlands,,55798,Health Care,Biotechnology: Pharmaceutical Preparations +PHAT,Phathom Pharmaceuticals Inc. Common Stock,$13.84,-0.39,-2.741%,1083599686.00,United States,2019,589108,Health Care,Biotechnology: Pharmaceutical Preparations +PHG,Koninklijke Philips N.V. NY Registry Shares,$29.02,-0.50,-1.694%,26845937680.00,Netherlands,,760297,Health Care,Medical Electronics +PHGE,BiomX Inc. COmmon Stock,$6.58,-0.37,-5.324%,10045291.00,,2019,1101121,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PHI,PLDT Inc. Sponsored ADR,$22.63,-0.33,-1.437%,4889342188.00,Philippines,,43158,Telecommunications,Telecommunications Equipment +PHIN,PHINIA Inc. Common Stock,$69.04,-0.04,-0.058%,2654082213.00,United States,2023,253311,Consumer Discretionary,Auto Parts:O.E.M. +PHIO,Phio Pharmaceuticals Corp. Common Stock,$1.02,-0.01,-0.971%,10979717.00,United States,,132955,Health Care,Biotechnology: Pharmaceutical Preparations +PHK,Pimco High Income Fund,$4.95,0.01,0.202%,0.00,United States,2003,644892,Finance,Finance/Investors Services +PHM,PulteGroup Inc. Common Stock,$123.27,-0.61,-0.492%,24027403428.00,United States,,2289227,Consumer Discretionary,Homebuilding +PHOE,Phoenix Asia Holdings Limited Ordinary Shares,$13.50,0.00,0.00%,291600000.00,Hong Kong,2025,446,Consumer Discretionary,Engineering & Construction +PHR,Phreesia Inc. Common Stock,$14.66,-0.53,-3.489%,883807464.00,United States,2019,857493,Real Estate,Real Estate +PHUN,Phunware Inc. Common Stock,$1.88,-0.06,-3.093%,37952173.00,Greece,2016,134328,Technology,EDP Services +PHVS,Pharvaris N.V. Ordinary Shares,$27.86,0.67,2.464%,1518178936.00,Netherlands,2021,87962,Health Care,Biotechnology: Pharmaceutical Preparations +PHXE^,Phoenix Energy One LLC Series A Cumulative Redeemable Preferred Shares,$21.1999,0.0199,0.094%,,,,1909,, +PI,Impinj Inc. Common Stock,$161.56,-0.23,-0.142%,4864431366.00,United States,2016,381449,Technology,Industrial Machinery/Components +PII,Polaris Inc. Common Stock,$64.94,-1.24,-1.874%,3652766745.00,United States,,1341718,Consumer Discretionary,Industrial Specialties +PIII,P3 Health Partners Inc. Class A Common Stock,$2.23,-0.37,-14.231%,16068463.00,United States,2021,16832,Health Care,Medical/Nursing Services +PIIIW,P3 Health Partners Inc. Warrant,$0.007,-0.0007,-9.091%,50439.00,United States,2021,1640,Health Care,Medical/Nursing Services +PIM,Putnam Master Intermediate Income Trust Common Stock,$3.27,-0.04,-1.208%,164328598.00,United States,1988,196927,Finance,Finance Companies +PINE,Alpine Income Property Trust Inc. Common Stock,$17.22,-0.62,-3.475%,243915480.00,United States,2019,191769,Real Estate,Real Estate Investment Trusts +PINE^A,Alpine Income Property Trust Inc. 8.00% Series A Cumulative Redeemable Preferred Stock,$24.9501,-0.0299,-0.12%,,United States,,3465,, +PINS,Pinterest Inc. Class A Common Stock,$22.56,-0.85,-3.631%,15240583855.00,United States,2019,27534778,Technology,Computer Software: Programming Data Processing +PIPR,Piper Sandler Companies Common Stock,$353.60,0.41,0.116%,6255041499.00,United States,,88632,Finance,Investment Bankers/Brokers/Service +PJT,PJT Partners Inc. Class A Common Stock,$178.73,2.39,1.355%,4344443908.00,United States,2015,202619,Finance,Investment Managers +PK,Park Hotels & Resorts Inc. Common Stock ,$10.73,-0.13,-1.197%,2144908523.00,United States,2016,5525579,Consumer Discretionary,Hotels/Resorts +PKBK,Parke Bancorp Inc. Common Stock,$27.00,-0.55,-1.996%,313079931.00,United States,,150054,Finance,Major Banks +PKE,Park Aerospace Corp. Common Stock,$23.36,-0.41,-1.725%,465466641.00,United States,,174950,Industrials,Military/Government/Technical +PKG,Packaging Corporation of America Common Stock,$217.61,-6.01,-2.688%,19579909550.00,United States,2000,2395664,Consumer Discretionary,Containers/Packaging +PKOH,Park-Ohio Holdings Corp. Common Stock,$21.46,-0.80,-3.594%,309114282.00,United States,,23257,Industrials,Industrial Specialties +PKST,Peakstone Realty Trust Common Shares,$14.95,-0.01,-0.067%,550023462.00,United States,2023,376809,Real Estate,Real Estate Investment Trusts +PKX,POSCO HOLDINGS INC. American Depositary Shares (Each representing 1/4th of a share of Common Stock),$64.71,1.42,2.244%,21386493743.00,South Korea,1994,227885,Industrials,Steel/Iron Ore +PL,Planet Labs PBC Class A Common Stock,$27.88,-0.19,-0.677%,8744972421.00,United States,2021,12768899,Technology,Radio And Television Broadcasting And Communications Equipment +PLAB,Photronics Inc. Common Stock,$35.94,0.32,0.898%,2122783198.00,United States,1987,1095143,Technology,Semiconductors +PLAG,Planet Green Holdings Corp. Common Stock,$3.49,0.14,4.179%,32745672.00,China,,84790,Consumer Staples,Packaged Foods +PLAY,Dave & Buster's Entertainment Inc. Common Stock,$19.22,-0.07,-0.363%,666554693.00,United States,2014,680212,Consumer Discretionary,Restaurants +PLBC,Plumas Bancorp,$49.55,-0.14,-0.282%,344645719.00,United States,,17798,Finance,Finance Companies +PLBL,Polibeli Group Ltd Class A Ordinary Shares,$11.00,0.94,9.344%,4030262170.00,Indonesia,,13637,Consumer Discretionary,Consumer Electronics/Appliances +PLBY,Playboy Inc. Common Stock,$1.58,-0.105,-6.231%,170256648.00,United States,2020,265999,Consumer Discretionary,Other Specialty Stores +PLCE,Children's Place Inc. (The) Common Stock,$4.19,-0.11,-2.558%,92883455.00,United States,1997,198089,Consumer Discretionary,Clothing/Shoe/Accessory Stores +PLD,Prologis Inc. Common Stock,$127.13,-1.57,-1.22%,118086861710.00,United States,,3860119,Real Estate,Real Estate Investment Trusts +PLG,Platinum Group Metals Ltd. Ordinary Shares (Canada),$3.48,0.04,1.163%,429449536.00,Canada,,6206561,Basic Materials,Precious Metals +PLMK,Plum Acquisition Corp. IV Class A Ordinary Shares,$10.56,0.0308,0.293%,0.00,United States,2025,44779,, +PLMKW,Plum Acquisition Corp. IV Warrants,$0.58,0.06,11.538%,0.00,United States,2025,119178,, +PLMR,Palomar Holdings Inc. Common stock,$119.70,-2.17,-1.781%,3172252532.00,United States,2019,195607,Finance,Property-Casualty Insurers +PLNT,Planet Fitness Inc. Common Stock,$91.63,-1.05,-1.133%,7632714218.00,United States,2015,1861290,Consumer Discretionary,Hotels/Resorts +PLOW,Douglas Dynamics Inc. Common Stock,$37.00,-0.88,-2.323%,852512486.00,United States,2010,218381,Industrials,Construction/Ag Equipment/Trucks +PLPC,Preformed Line Products Company Common Stock,$248.09,7.08,2.938%,1216105176.00,United States,,123719,Industrials,Water Sewer Pipeline Comm & Power Line Construction +PLRX,Pliant Therapeutics Inc. Common Stock,$1.25,-0.02,-1.575%,76811731.00,United States,2020,1648951,Health Care,Biotechnology: Pharmaceutical Preparations +PLRZ,Polyrizon Ltd. Ordinary Shares,$14.10,-0.59,-4.016%,22474639.00,Israel,2024,39430,Health Care,Biotechnology: Pharmaceutical Preparations +PLSE,Pulse Biosciences Inc Common Stock (DE),$13.55,-0.77,-5.377%,918250682.00,United States,2016,104784,Health Care,Medical/Dental Instruments +PLSM,Pulsenmore Ltd. Ordinary Shares,$6.30,0.09,1.449%,0.00,Israel,,23000,Health Care,Medical/Dental Instruments +PLTK,Playtika Holding Corp. Common Stock,$3.63,0.06,1.681%,1365082652.00,Israel,2021,1385645,Technology,EDP Services +PLTR,Palantir Technologies Inc. Class A Common Stock,$157.35,-8.35,-5.039%,375033707784.00,United States,,44822848,Technology,Computer Software: Prepackaged Software +PLUG,Plug Power Inc. Common Stock,$2.45,0.04,1.66%,3412589974.00,United States,1999,121612924,Energy,Industrial Machinery/Components +PLUR,Pluri Inc. Common Stock,$3.32,0.02,0.606%,32797938.00,Israel,,4053,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PLUS,ePlus inc. Common Stock,$84.15,-0.88,-1.035%,2220858778.00,United States,1996,153170,Technology,Retail: Computer Software & Peripheral Equipment +PLUT,Plutus Financial Group Limited Ordinary Shares,$3.16,-0.0014,-0.044%,45030000.00,Hong Kong,2025,12742,Finance,Investment Bankers/Brokers/Service +PLX,Protalix BioTherapeutics Inc. (DE) Common Stock,$2.06,-0.06,-2.83%,165667633.00,Israel,,692786,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PLXS,Plexus Corp. Common Stock,$180.85,7.34,4.23%,4842152953.00,United States,,503005,Technology,Electrical Products +PM,Philip Morris International Inc Common Stock,$178.59,-0.29,-0.162%,278000114184.00,United States,,4399144,Health Care, Medicinal Chemicals and Botanical Products +PMAX,Powell Max Limited Class A Ordinary Shares,$2.49,-0.03,-1.19%,31125000.00,Hong Kong,2024,23150,Consumer Discretionary,Other Consumer Services +PMCB,PharmaCyte Biotech Inc. Common Stock,$0.8994,-0.0495,-5.217%,9114664.00,United States,,143020,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PMEC,Primech Holdings Ltd. Ordinary Shares,$0.975,-0.005,-0.51%,37098750.00,Singapore,2023,45378,Consumer Discretionary,Diversified Commercial Services +PMI,Picard Medical Inc. Common Stock,$1.80,-0.03,-1.639%,132662117.00,,2025,126321,Health Care,Medical/Dental Instruments +PML,Pimco Municipal Income Fund II Common Shares of Beneficial Interest,$7.64,0.04,0.526%,0.00,United States,2002,306244,Finance,Investment Managers +PMM,Putnam Managed Municipal Income Trust Common Stock,$6.20,0.01,0.162%,302180616.00,United States,1989,202665,Finance,Investment Managers +PMN,ProMIS Neurosciences Inc. Common Shares (ON),$12.08,1.42,13.321%,26001524.00,Canada,,32107,Health Care,Biotechnology: Pharmaceutical Preparations +PMNT,Perfect Moment Ltd. Common Stock,$0.3803,-0.0023,-0.601%,13394901.00,United Kingdom,2024,68119,Consumer Discretionary,Apparel +PMO,Putnam Municipal Opportunities Trust Common Stock,$10.62,0.10,0.951%,360884242.00,United States,1993,44367,Finance,Finance Companies +PMT,PennyMac Mortgage Investment Trust Common Shares of Beneficial Interest,$13.48,-0.05,-0.37%,1172983822.00,United States,2009,995189,Real Estate,Real Estate Investment Trusts +PMT^A,PennyMac Mortgage Investment Trust 8.125% Series A Fixed-to-Floating Rate Cumulative Redeemable Preferred Shares of Beneficial Interest,$24.35,0.09,0.371%,,United States,,8074,, +PMT^B,PennyMac Mortgage Investment Trust 8.00% Series B Fixed-to-Floating Rate Cumulative Redeemable Preferred Shares of Beneficial Interest,$24.05,-0.02,-0.083%,,United States,,6883,, +PMT^C,PennyMac Mortgage Investment Trust 6.75% Series C Cumulative Redeemable Preferred Shares of Beneficial Interest,$19.615,0.005,0.025%,,United States,,12061,, +PMTR,Perimeter Acquisition Corp. I Class A Ordinary Shares,$10.36,0.02,0.193%,0.00,United States,2025,58877,Finance,Blank Checks +PMTRU,Perimeter Acquisition Corp. I Unit,$10.70,0.00,0.00%,0.00,United States,2025,353,Finance,Blank Checks +PMTRW,Perimeter Acquisition Corp. I Warrant,$0.8825,-0.0175,-1.944%,0.00,United States,2025,75700,Finance,Blank Checks +PMTS,CPI Card Group Inc. Common Stock,$12.83,-0.64,-4.751%,146102113.00,United States,,29378,Consumer Discretionary,Publishing +PMTU,PennyMac Mortgage Investment Trust 8.50% Senior Notes due 2028,$25.65,0.018,0.07%,2231975893.00,United States,2023,6972,Real Estate,Real Estate Investment Trusts +PMTV,PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030,$25.67,-0.02,-0.078%,0.00,United States,2025,36485,Real Estate,Real Estate Investment Trusts +PMTW,PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030,$25.52,-0.06,-0.235%,0.00,United States,2025,8629,Real Estate,Real Estate Investment Trusts +PMVP,PMV Pharmaceuticals Inc. Common Stock,$1.22,0.01,0.826%,64918039.00,United States,2020,291744,Health Care,Biotechnology: Pharmaceutical Preparations +PN,Skycorp Solar Group Limited Ordinary Shares,$0.5963,0.0152,2.616%,23255700.00,China,2025,97320,Technology,Retail: Computer Software & Peripheral Equipment +PNBK,Patriot National Bancorp Inc. Common Stock,$1.53,-0.04,-2.548%,175936256.00,United States,,59224,Finance,Major Banks +PNC,PNC Financial Services Group Inc. (The) Common Stock,$221.39,-2.31,-1.033%,86819959467.00,United States,,2479833,Finance,Major Banks +PNFP,Pinnacle Financial Partners Inc. Common stock,$93.77,-1.53,-1.605%,14178024000.00,United States,,2498645,Finance,Major Banks +PNFP^A,Pinnacle Financial Partners Inc. Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series A,$26.42,0.10,0.38%,,United States,,46662,, +PNFP^B,Pinnacle Financial Partners Inc. Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series B,$26.93,0.08,0.298%,,United States,,125444,, +PNFP^C,Pinnacle Financial Partners Inc. Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series C,$25.80,0.18,0.703%,,United States,,67308,, +PNI,Pimco New York Municipal Income Fund II Common Shares of Beneficial Interest,$6.94,0.03,0.434%,0.00,United States,2002,54634,Finance,Trusts Except Educational Religious and Charitable +PNNT,PennantPark Investment Corporation Common Stock,$5.82,-0.04,-0.683%,380023267.00,United States,2022,624406,Finance,Finance: Consumer Services +PNR,Pentair plc. Ordinary Share,$105.17,-2.43,-2.258%,17210216520.00,Switzerland,,1770493,Industrials,Industrial Machinery/Components +PNRG,PrimeEnergy Resources Corporation Common Stock,$182.17,6.19,3.517%,297847950.00,United States,,46346,Energy,Oil & Gas Production +PNTG,The Pennant Group Inc. Common Stock ,$27.49,-0.14,-0.507%,950981363.00,United States,,447072,Health Care,Medical/Nursing Services +PNW,Pinnacle West Capital Corporation Common Stock,$93.68,-1.08,-1.14%,11212596578.00,United States,,1163284,Utilities,Electric Utilities: Central +POAS,Phaos Technology Holdings (Cayman) Limited Class A Ordinary Shares,$3.56,-0.11,-2.997%,101200124.00,,2025,2380232,Industrials,Industrial Machinery/Components +POCI,Precision Optics Corporation Inc. Common stock,$4.99,-0.19,-3.668%,38496358.00,United States,,28380,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +PODC,PodcastOne Inc. Common Stock,$2.45,-0.16,-6.13%,65931296.00,United States,,58039,Technology,Computer Software: Programming Data Processing +PODD,Insulet Corporation Common Stock,$258.20,-6.71,-2.533%,18163569064.00,United States,2007,1315299,Health Care,Medical/Dental Instruments +POET,POET Technologies Inc. Common Shares,$6.22,-0.57,-8.395%,566085920.00,Canada,,14549177,Technology,Semiconductors +POLA,Polar Power Inc. Common Stock,$1.68,-0.07,-4.00%,4466576.00,United States,2016,128012,Miscellaneous,Industrial Machinery/Components +POLE,Andretti Acquisition Corp. II Class A Ordinary Shares,$10.60,0.02,0.189%,0.00,United States,2024,297807,, +POLEW,Andretti Acquisition Corp. II Warrant,$0.30,0.00,0.00%,0.00,United States,2024,200,, +POM,POMDOCTOR LIMITED American Depositary Shares,$0.25,-0.0023,-0.912%,29605219.00,China,2025,362070,Consumer Discretionary,Other Specialty Stores +PONY,Pony AI Inc. American Depositary Shares ,$15.69,0.00,0.00%,6802266967.00,China,2024,2298030,Technology,EDP Services +POOL,Pool Corporation Common Stock,$258.48,-5.98,-2.261%,9628246624.00,United States,1995,780316,Consumer Discretionary,Industrial Specialties +POR,Portland General Electric Co Common Stock,$49.93,-0.51,-1.011%,5616573373.00,United States,,759784,Utilities,Electric Utilities: Central +POST,Post Holdings Inc. Common Stock,$97.79,-0.24,-0.245%,5100217696.00,United States,2012,810679,Consumer Staples,Packaged Foods +POWI,Power Integrations Inc. Common Stock,$46.77,0.85,1.851%,2588072297.00,United States,1997,1236827,Technology,Semiconductors +POWL,Powell Industries Inc. Common Stock,$443.44,1.16,0.262%,5383575782.00,United States,,214371,Energy,Electrical Products +POWW,Outdoor Holding Company Common Stock,$1.64,-0.03,-1.796%,192061756.00,United States,,292797,Industrials,Ordnance And Accessories +POWWP,Outdoor Holding Company 8.75% Series A Cumulative Redeemable Perpetual Preferred Stock,$24.10,0.07,0.291%,2822370931.00,United States,,981,Industrials,Ordnance And Accessories +PPBT,Purple Biotech Ltd. American Depositary Shares,$0.6386,0.001,0.157%,1691141.00,Israel,2015,153396,Health Care,Biotechnology: Pharmaceutical Preparations +PPC,Pilgrim's Pride Corporation Common Stock,$43.06,-0.21,-0.485%,10228793068.00,United States,,669623,Consumer Staples,Meat/Poultry/Fish +PPCB,Propanc Biopharma Inc. Common Stock,$0.39,0.0928,31.225%,5212055.00,Australia,,4278167,Health Care,Biotechnology: Pharmaceutical Preparations +PPG,PPG Industries Inc. Common Stock,$113.96,3.68,3.337%,25572624000.00,United States,,5740752,Consumer Discretionary,Paints/Coatings +PPHC,Public Policy Holding Company Inc. Common Stock,$11.28,-0.97,-7.918%,283520307.00,United States,2026,1306958,, +PPIH,Perma-Pipe International Holdings Inc. Common Stock,$28.88,-1.22,-4.053%,233756020.00,United States,,79316,Industrials,Pollution Control Equipment +PPL,PPL Corporation Common Stock,$36.70,-0.02,-0.054%,27148427796.00,United States,,5360073,Utilities,Electric Utilities: Central +PPSI,Pioneer Power Solutions Inc. Common Stock,$4.70,0.02,0.427%,52147750.00,United States,,94848,Industrials,Electrical Products +PPT,Putnam Premier Income Trust Common Stock,$3.61,-0.01,-0.276%,359297029.00,United States,1988,233186,Finance,Finance Companies +PPTA,Perpetua Resources Corp. Common Shares,$34.37,-0.59,-1.688%,4188764080.00,Canada,,1608038,Basic Materials,Precious Metals +PR,Permian Resources Corporation Class A Common Stock,$15.54,0.24,1.569%,12995255412.00,United States,2022,13163623,Energy,Oil & Gas Production +PRA,ProAssurance Corporation Common Stock,$24.19,-0.01,-0.041%,1243696024.00,United States,,386472,Finance,Property-Casualty Insurers +PRAA,PRA Group Inc. Common Stock,$12.955,-2.855,-18.058%,505445051.00,United States,2002,1137839,Finance,Finance: Consumer Services +PRAX,Praxis Precision Medicines Inc. Common Stock,$309.92,-4.83,-1.535%,7808462913.00,United States,2020,699591,Health Care,Biotechnology: Pharmaceutical Preparations +PRCH,Porch Group Inc. Common Stock,$8.07,0.14,1.765%,998126337.00,United States,2020,1625763,Technology,Computer Software: Prepackaged Software +PRCT,PROCEPT BioRobotics Corporation Common Stock,$30.02,-0.76,-2.469%,1677475242.00,United States,2021,721797,Health Care,Medical/Dental Instruments +PRDO,Perdoceo Education Corporation Common Stock,$31.79,0.14,0.442%,2044811512.00,United States,,333040,Real Estate,Other Consumer Services +PRE,Prenetics Global Limited Class A Ordinary Share,$19.33,0.04,0.207%,251946853.00,Hong Kong,,252120,Finance,Blank Checks +PRENW,Prenetics Global Limited Warrant,$0.0293,0.0019,6.934%,381896.00,Hong Kong,,9319,Finance,Blank Checks +PRFX,PRF Technologies Ltd. Ordinary Shares,$0.7359,0.0029,0.396%,1481470.00,Israel,2020,142291,Health Care,Biotechnology: Pharmaceutical Preparations +PRG,PROG Holdings Inc. Common Stock,$32.49,-0.41,-1.246%,1284836317.00,United States,,534935,Consumer Discretionary,Diversified Commercial Services +PRGO,Perrigo Company plc Ordinary Shares,$13.95,-0.05,-0.357%,1919854926.00,United States,,1891968,Health Care,Biotechnology: Pharmaceutical Preparations +PRGS,Progress Software Corporation Common Stock (DE),$41.41,-0.25,-0.60%,1743926164.00,United States,1991,861640,Technology,Computer Software: Prepackaged Software +PRH,Prudential Financial Inc. 5.950% Junior Subordinated Notes due 2062,$25.24,-0.03,-0.119%,8884480000.00,United States,2022,7239,Finance,Life Insurance +PRHI,Presurance Holdings Inc. Common Stock,$0.7049,0.0148,2.145%,8615909.00,United States,2015,20821,Finance,Property-Casualty Insurers +PRHIZ,Presurance Holdings Inc. 9.75% Senior Unsecured Notes due 2028,$19.44,0.5125,2.708%,237612807.00,United States,,160,Finance,Property-Casualty Insurers +PRI,Primerica Inc. Common Stock,$259.44,3.28,1.28%,8280302088.00,United States,2010,173130,Finance,Life Insurance +PRIF^D,Priority Income Fund Inc. 7.00% Series D Term Preferred Stock due 2029,$24.61,-0.3169,-1.271%,,,,3184,, +PRIF^J,Priority Income Fund Inc. 6.000% Series J Term Preferred Stock due 2028,$24.65,-0.04,-0.162%,,,,869,, +PRIF^K,Priority Income Fund Inc. 7.000% Series K Cumulative Preferred Stock,$21.36,-0.25,-1.157%,,,,21288,, +PRIF^L,Priority Income Fund Inc. 6.375% Series L Term Preferred Stock Due 2029,$24.236,0.076,0.315%,,,,2992,, +PRIM,Primoris Services Corporation Common Stock,$149.13,-2.81,-1.849%,8057844505.00,United States,,619592,Industrials,Water Sewer Pipeline Comm & Power Line Construction +PRK,Park National Corporation Common Stock,$158.80,-2.30,-1.428%,2553228006.00,United States,1994,62382,Finance,Major Banks +PRKS,United Parks & Resorts Inc. Common Stock,$37.41,0.31,0.836%,2040738358.00,United States,2013,923167,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +PRLB,Proto Labs Inc. Common stock,$51.86,-0.62,-1.181%,1227979716.00,United States,2012,214473,Industrials,Metal Fabrications +PRLD,Prelude Therapeutics Incorporated Common Stock,$1.97,-0.15,-7.075%,123844582.00,United States,2020,96875,Health Care,Biotechnology: Pharmaceutical Preparations +PRM,Perimeter Solutions SA Common Stock,$26.48,-0.25,-0.935%,3917020000.00,Luxembourg,,736311,Industrials,Major Chemicals +PRMB,Primo Brands Corporation Class A Common Stock,$18.73,-0.31,-1.628%,6848273949.00,United States,2024,5665662,Consumer Staples,Beverages (Production/Distribution) +PRME,Prime Medicine Inc. Common Stock,$4.03,-0.25,-5.841%,727457952.00,United States,2022,2143346,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PROF,Profound Medical Corp. Common Stock,$7.58,-0.18,-2.32%,227701752.00,Canada,,96643,Health Care,Medical/Dental Instruments +PROK,ProKidney Corp. Class A Ordinary Shares,$2.10,-0.11,-4.977%,631752196.00,United States,2021,994945,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PROP,Prairie Operating Co. Common Stock,$1.85,-0.04,-2.116%,110346229.00,United States,,1394243,Finance,Finance: Consumer Services +PROV,Provident Financial Holdings Inc. Common Stock,$16.20,0.09,0.559%,104882526.00,United States,,7092,Finance,Savings Institutions +PRPL,Purple Innovation Inc. Common Stock,$0.708,-0.0199,-2.734%,76753521.00,United States,2015,200108,Consumer Discretionary,Home Furnishings +PRPO,Precipio Inc. Common Stock,$24.75,0.25,1.02%,43362173.00,United States,,9674,Industrials,Biotechnology: Laboratory Analytical Instruments +PRQR,ProQR Therapeutics N.V. Ordinary Shares,$1.62,-0.06,-3.571%,170444294.00,Netherlands,2014,692096,Health Care,Biotechnology: Pharmaceutical Preparations +PRS,Prudential Financial Inc. 5.625% Junior Subordinated Notes due 2058,$24.29,-0.06,-0.246%,8550080000.00,United States,2018,20106,Finance,Life Insurance +PRSO,Peraso Inc. Common Stock,$0.9798,0.0138,1.429%,10177094.00,United States,,370348,Technology,Semiconductors +PRSU,Pursuit Attractions and Hospitality Inc. Common Stock,$34.60,-0.18,-0.518%,978600934.00,United States,,224025,Real Estate,Real Estate +PRT,PermRock Royalty Trust Units of Beneficial Interest,$3.44,0.04,1.176%,41850118.00,United States,2018,65930,Energy,Oil & Gas Production +PRTA,Prothena Corporation plc Ordinary Shares,$9.14,-0.59,-6.064%,492006035.00,United States,,422156,Health Care,Biotechnology: Pharmaceutical Preparations +PRTC,PureTech Health plc American Depositary Shares,$18.67,0.00,0.00%,451224103.00,United States,,196,Health Care,Biotechnology: Pharmaceutical Preparations +PRTH,Priority Technology Holdings Inc. Common Stock,$5.86,-0.09,-1.513%,479767388.00,United States,2016,200032,Real Estate,Real Estate +PRTS,CarParts.com Inc. Common Stock,$0.5382,0.0064,1.203%,37546142.00,United States,2007,390824,Consumer Discretionary,Auto & Home Supply Stores +PRU,Prudential Financial Inc. Common Stock,$107.69,0.27,0.251%,41968499994.00,United States,2001,1754208,Finance,Life Insurance +PRVA,Privia Health Group Inc. Common Stock,$22.77,-0.09,-0.394%,2800744815.00,United States,2021,873514,Health Care,Medical/Nursing Services +PRZO,ParaZero Technologies Ltd. Ordinary Shares,$1.23,-0.03,-2.381%,26044466.00,Israel,2023,693570,Industrials,Military/Government/Technical +PSA,Public Storage Common Stock,$273.86,-3.84,-1.383%,48052301014.00,United States,,828561,Real Estate,Real Estate Investment Trusts +PSA^F,Public Storage Depositary Shares Each Representing 1/1000 of a 5.15% Cumulative Preferred Share of Beneficial Interest Series F par value $0.01 per share,$21.195,-0.055,-0.259%,,United States,,21221,, +PSA^G,Public Storage Depositary Shares Each Representing 1/1000 of a 5.05% Cumulative Preferred Share of Beneficial Interest Series G,$21.05,-0.07,-0.331%,,United States,,35632,, +PSA^H,Public Storage Depositary Shares Each Representing 1/1000 of a 5.60% Cumulative Preferred Share of Beneficial Interest Series H,$23.50,-0.16,-0.676%,,United States,,23366,, +PSA^I,Public Storage Depositary Shares Each Representing 1/1000 of a 4.875% Cumulative Preferred Share of Beneficial Interest Series I par value $0.01 per share,$19.845,-0.035,-0.176%,,United States,,17316,, +PSA^J,Public Storage Depositary Shares Each Representing 1/1000 of a 4.700% Cumulative Preferred Share of Beneficial Interest Series J par value $0.01 per share,$19.07,-0.05,-0.262%,,United States,,16324,, +PSA^K,Public Storage Depositary Shares Each Representing 1/1000 of a 4.75% Cumulative Preferred Share of Beneficial Interest Series K,$19.43,-0.15,-0.766%,,United States,,7074,, +PSA^L,Public Storage Depositary Shares Each Representing 1/1000 of a 4.625% Cumulative Preferred Share of Beneficial Interest Series L par value $0.01 per share,$19.03,-0.10,-0.523%,,United States,,16755,, +PSA^M,Public Storage Depositary Shares Each Representing 1/1000 of a 4.125% Cumulative Preferred Share of Beneficial Interest Series M,$16.82,-0.09,-0.532%,,United States,,5172,, +PSA^N,Public Storage Depositary Shares Each Representing 1/1000 of a 3.875% Cumulative Preferred Share of Beneficial Interest Series N,$15.70,-0.0461,-0.293%,,United States,,14788,, +PSA^O,Public Storage Depositary Shares Each Representing 1/1000 of a 3.900% Cumulative Preferred Share of Beneficial Interest Series O,$15.89,-0.07,-0.439%,,United States,,8166,, +PSA^P,Public Storage Depositary Shares Each Representing 1/1000 of a 4.000% Cumulative Preferred Share of Bene cial Interest Series P,$16.28,-0.06,-0.367%,,United States,,25488,, +PSA^Q,Public Storage Depositary Shares Each Representing 1/1000 of a 3.950% Cumulative Preferred Share of Beneficial Interest Series Q par value $0.01 per share,$16.05,-0.02,-0.124%,,United States,,11284,, +PSA^R,Public Storage Depositary Shares Each Representing 1/1000 of a 4.00% Cumulative Preferred Share of Bene cial Interest Series R,$16.32,-0.03,-0.183%,,United States,,13104,, +PSA^S,Public Storage Depositary Shares Each Representing 1/1000 of a 4.100% Cumulative Preferred Share of Beneficial Interest Series S,$16.64,-0.07,-0.419%,,United States,,29895,, +PSBD,Palmer Square Capital BDC Inc. Common Stock,$11.66,-0.09,-0.766%,0.00,,2024,96650,, +PSEC,Prospect Capital Corporation Common Stock,$2.74,-0.085,-3.009%,1290296113.00,United States,2004,5426107,Finance,Finance: Consumer Services +PSEC^A,Prospect Capital Corporation 5.35% Series A Fixed Rate Cumulative Perpetual Preferred Stock,$17.29,0.01,0.058%,,United States,,4393,, +PSF,Cohen & Steers Select Preferred and Income Fund Inc. Common Stock,$20.40,-0.06,-0.293%,1002428011.00,,2010,36105,Finance,Investment Managers +PSFE,Paysafe Limited Common Shares,$6.92,-0.12,-1.705%,414427064.00,,2021,412464,Real Estate,Real Estate +PSHG,Performance Shipping Inc. Common Shares,$2.12,0.02,0.952%,26356175.00,Greece,,20912,Consumer Discretionary,Marine Transportation +PSIG,PS International Group Ltd. Ordinary Shares,$4.10,-0.12,-2.844%,35354718.00,Hong Kong,,3833,Industrials,Integrated Freight & Logistics +PSIX,Power Solutions International Inc. Common Stock,$72.93,-1.08,-1.459%,1680375025.00,United States,,343847,Industrials,Industrial Machinery/Components +PSKY,Paramount Skydance Corporation Class B Common Stock,$11.34,-0.21,-1.818%,12509913519.00,United States,,4473306,Industrials,Broadcasting +PSMT,PriceSmart Inc. Common Stock,$142.00,0.00,0.00%,4375789214.00,United States,,174640,Consumer Discretionary,Department/Specialty Retail Stores +PSN,Parsons Corporation Common Stock,$71.71,0.30,0.42%,7636296215.00,United States,2019,1003061,Technology,EDP Services +PSNL,Personalis Inc. Common Stock,$9.99,-0.33,-3.198%,887155437.00,United States,2019,1076446,Health Care,Medical Specialities +PSNY,Polestar Automotive Holding UK PLC Class A ADS,$17.00,-0.24,-1.392%,1308868624.00,Sweden,,115986,Industrials,Auto Manufacturing +PSNYW,Polestar Automotive Holding UK PLC Class C-1 ADS (ADW),$2.86,0.005,0.175%,220197898.00,Sweden,,4620,Industrials,Auto Manufacturing +PSO,Pearson Plc Common Stock,$13.01,0.04,0.308%,8271405923.00,United Kingdom,,1388651,Consumer Discretionary,Books +PSQH,PSQ Holdings Inc. Class A Common Stock,$0.919,-0.041,-4.271%,50291816.00,,2021,741178,Consumer Discretionary,Advertising +PSTG,Pure Storage Inc. Class A Common Stock,$74.29,0.17,0.229%,24528451804.00,United States,2015,2658396,Technology,Electronic Components +PSTL,Postal Realty Trust Inc. Class A Common Stock,$17.67,-0.29,-1.615%,460526778.00,United States,2019,190944,Real Estate,Real Estate Investment Trusts +PSTV,PLUS THERAPEUTICS Inc. Common Stock ,$0.2493,0.0103,4.31%,34627159.00,United States,,11293391,Health Care,Medical/Dental Instruments +PSX,Phillips 66 Common Stock,$142.08,2.07,1.478%,57247034861.00,United States,,1676528,Energy,Integrated oil Companies +PTA,Cohen & Steers Tax-Advantaged Preferred Securities and Income Fund Common Shares of Beneficial Interest,$19.66,0.00,0.00%,1086676165.00,United States,2020,120375,Finance,Trusts Except Educational Religious and Charitable +PTC,PTC Inc. Common Stock,$161.91,-2.72,-1.652%,19339867939.00,United States,,771739,Technology,Computer Software: Prepackaged Software +PTCT,PTC Therapeutics Inc. Common Stock,$75.60,0.11,0.146%,6069795858.00,United States,2013,1418355,Health Care,Biotechnology: Pharmaceutical Preparations +PTEN,Patterson-UTI Energy Inc. Common Stock,$7.33,-0.11,-1.478%,2779844036.00,United States,1993,10830006,Energy,Oil & Gas Production +PTGX,Protagonist Therapeutics Inc. Common Stock,$81.76,-1.32,-1.589%,5111280852.00,United States,2016,777238,Health Care,Biotechnology: Pharmaceutical Preparations +PTHS,Pelthos Therapeutics Inc. Common Stock,$24.69,-1.195,-4.617%,75592904.00,,2024,12211,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +PTLE,PTL LTD Class A Ordinary Shares,$0.1165,-0.0085,-6.80%,29414794.00,Singapore,2024,1583826,Energy,Oil Refining/Marketing +PTLO,Portillo's Inc. Class A Common Stock,$5.63,-0.26,-4.414%,424359274.00,United States,2021,1514371,Consumer Discretionary,Restaurants +PTN,Palatin Technologies Inc. Common Stock,$16.95,0.73,4.501%,28860341.00,United States,,14287,Health Care,Biotechnology: Pharmaceutical Preparations +PTON,Peloton Interactive Inc. Class A Common Stock,$5.84,-0.03,-0.511%,2439989796.00,United States,2019,6593571,Consumer Discretionary,Recreational Games/Products/Toys +PTORU,Praetorian Acquisition Corp. Units,$9.98,-0.005,-0.05%,0.00,United States,2026,104146,, +PTRN,Pattern Group Inc. Series A Common Stock,$15.62,-0.15,-0.951%,2752633297.00,United States,2025,781656,Consumer Discretionary,Catalog/Specialty Distribution +PTY,Pimco Corporate & Income Opportunity Fund,$13.06,-0.02,-0.153%,0.00,United States,2002,768006,Finance,Investment Managers +PUBM,PubMatic Inc. Class A Common Stock,$7.48,-0.15,-1.966%,347182719.00,United States,2020,459637,Technology,Computer Software: Programming Data Processing +PUK,Prudential Public Limited Company Common Stock,$33.14,0.37,1.129%,42340309600.00,United Kingdom,,2255595,Finance,Life Insurance +PULM,Pulmatrix Inc. Common Stock,$2.6701,0.0642,2.464%,9751966.00,United States,2014,12090,Health Care,Biotechnology: Pharmaceutical Preparations +PUMP,ProPetro Holding Corp. Common Stock,$10.66,-0.09,-0.837%,1108450049.00,United States,2017,5318754,Energy,Oilfield Services/Equipment +PURR,Hyperliquid Strategies Inc Common Stock,$4.65,0.30,6.897%,590668868.00,United States,,5834948,Finance,Finance: Consumer Services +PVH,PVH Corp. Common Stock,$61.23,-1.13,-1.812%,2804499076.00,United States,,965707,Industrials,Garments and Clothing +PVL,Permianville Royalty Trust Units of Beneficial Interest,$1.76,-0.06,-3.297%,58080000.00,United States,2011,56232,Energy,Oil & Gas Production +PVLA,Palvella Therapeutics Inc. Common Stock,$78.71,-5.26,-6.264%,931650128.00,United States,,232540,Health Care,Biotechnology: Pharmaceutical Preparations +PW,Power REIT (MD) Common Stock,$0.9696,0.0285,3.028%,3286615.00,United States,1998,12500,Real Estate,Real Estate Investment Trusts +PW^A,Power REIT 7.75% Series A Cumulative Perpetual Preferred Stock,$8.40,-0.49,-5.512%,,United States,,5353,, +PWP,Perella Weinberg Partners Class A Common Stock,$22.53,0.22,0.986%,2000865013.00,United States,2020,1027790,Finance,Finance: Consumer Services +PWR,Quanta Services Inc. Common Stock,$481.28,2.01,0.419%,71766494095.00,United States,,976259,Industrials,Engineering & Construction +PX,P10 Inc. Class A Common Stock,$10.60,-0.37,-3.373%,1166159954.00,United States,2021,789322,Finance,Investment Managers +PXED,Phoenix Education Partners Inc. Common Stock,$30.29,-0.26,-0.851%,1083162222.00,,2025,60115,Real Estate,Other Consumer Services +PXLW,Pixelworks Inc. Common Stock,$6.54,-0.02,-0.305%,41159784.00,United States,2000,23992,Technology,Semiconductors +PXS,Pyxis Tankers Inc. Common Stock,$3.36,-0.09,-2.609%,35232506.00,Greece,,47178,Consumer Discretionary,Marine Transportation +PYPD,PolyPid Ltd. Ordinary Shares,$4.72,-0.08,-1.667%,48101067.00,Israel,2020,74952,Health Care,Biotechnology: Pharmaceutical Preparations +PYPL,PayPal Holdings Inc. Common Stock,$54.08,-1.43,-2.576%,50600057618.00,United States,,19222688,Industrials,Diversified Commercial Services +PYT,PPlus Tr GSC-2 Tr Ctf Fltg Rate,$23.50,-0.20,-0.844%,0.00,United States,,3674,Finance,Finance: Consumer Services +PYXS,Pyxis Oncology Inc. Common Stock,$1.51,-0.13,-7.927%,137416816.00,United States,2021,499732,Health Care,Biotechnology: Pharmaceutical Preparations +PZG,Paramount Gold Nevada Corp. Common Stock,$1.80,0.05,2.857%,141045167.00,United States,2015,1713612,Basic Materials,Metal Mining +PZZA,Papa John's International Inc. Common Stock,$35.71,-0.57,-1.571%,1170910045.00,United States,1993,856106,Consumer Discretionary,Restaurants +Q,Qnity Electronics Inc. Common Stock,$102.43,2.98,2.996%,21455314961.00,United States,2025,2382159,Technology,Semiconductors +QBTS,D-Wave Quantum Inc. Common Shares,$24.97,0.28,1.134%,9234633751.00,,2022,32934164,Technology,EDP Services +QCLS,Q/C Technologies Inc. Common Stock,$4.67,-0.30,-6.036%,19458769.00,United States,2014,947648,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +QCOM,QUALCOMM Incorporated Common Stock,$152.70,-0.34,-0.222%,163090486923.00,United States,1991,8538968,Technology,Radio And Television Broadcasting And Communications Equipment +QCRH,QCR Holdings Inc. Common Stock,$89.49,1.36,1.543%,1506891057.00,United States,,145771,Finance,Major Banks +QDEL,QuidelOrtho Corporation Common Stock,$26.79,-0.49,-1.796%,1819885957.00,United States,,939216,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +QETA,Quetta Acquisition Corporation Common Stock,$11.64,0.14,1.217%,0.00,United States,2023,1705,Finance,Blank Checks +QFIN,Qfin Holdings Inc. American Depositary Shares,$16.07,0.07,0.438%,2163022000.00,China,2018,1163604,Finance,Finance: Consumer Services +QGEN,Qiagen N.V. Common Shares,$53.99,-0.23,-0.424%,11121519850.00,Netherlands,2026,2862672,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +QH,Quhuo Limited American Depository Shares,$0.8733,0.0033,0.379%,870340.00,China,2020,80198,Real Estate,Real Estate +QIPT,Quipt Home Medical Corp. Common Shares,$3.58,0.00,0.00%,157618350.00,United States,,885548,Health Care,Misc Health and Biotechnology Services +QLYS,Qualys Inc. Common Stock,$132.69,-0.31,-0.233%,4758038889.00,United States,2012,300149,Technology,Computer Software: Prepackaged Software +QMCO,Quantum Corporation Common Stock,$6.79,-0.19,-2.722%,93167566.00,United States,,488120,Technology,Electronic Components +QNCX,Quince Therapeutics Inc. Common Stock,$3.18,-0.13,-3.927%,177067138.00,United States,2019,1205560,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +QNRX,Quoin Pharmaceuticals Ltd. American Depositary Shares,$9.10,-0.34,-3.602%,98682939.00,Israel,2016,43601,Health Care,Medical/Dental Instruments +QNST,QuinStreet Inc. Common Stock,$13.99,-0.23,-1.617%,793954534.00,United States,2010,490018,Real Estate,Real Estate +QNTM,Quantum Biopharma Ltd. Class B Subordinate Voting Shares,$4.91,-0.24,-4.66%,18868811.00,Canada,,82585,Health Care,Biotechnology: Pharmaceutical Preparations +QQQX,Nuveen NASDAQ 100 Dynamic Overwrite Fund Shares of Beneficial Interest,$28.455,-0.075,-0.263%,0.00,United States,,75417,Finance,Finance Companies +QRHC,Quest Resource Holding Corporation Common Stock,$2.24,-0.08,-3.448%,46749011.00,United States,,21435,Utilities,Environmental Services +QRVO,Qorvo Inc. Common Stock,$77.18,-5.63,-6.799%,7131194363.00,United States,,5728559,Technology,Semiconductors +QS,QuantumScape Corporation Class A Common Stock,$9.93,-0.22,-2.167%,5971010216.00,United States,,10289901,Miscellaneous,Industrial Machinery/Components +QSEA,Quartzsea Acquisition Corporation Ordinary Shares,$10.27,-0.01,-0.097%,0.00,United States,2025,316,Finance,Blank Checks +QSI,Quantum-Si Incorporated Class A Common Stock,$1.20,-0.03,-2.439%,258587598.00,United States,2020,3995857,Industrials,Industrial Machinery/Components +QSIAW,Quantum-Si Incorporated Warrant,$0.1742,0.0002,0.115%,37538300.00,United States,2020,2496,Industrials,Industrial Machinery/Components +QSR,Restaurant Brands International Inc. Common Shares,$67.44,-0.06,-0.089%,30671388423.00,Canada,2014,3261679,Consumer Discretionary,Restaurants +QTI,QT Imaging Holdings Inc. Common Stock,$5.99,5.5949,1416.072%,71294166.00,United States,,214200,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +QTRX,Quanterix Corporation Common Stock,$6.68,0.02,0.30%,312028124.00,United States,2017,817521,Industrials,Biotechnology: Laboratory Analytical Instruments +QTTB,Q32 Bio Inc. Common Stock,$3.95,-0.04,-1.003%,48602190.00,United States,2018,188226,Health Care,Biotechnology: Pharmaceutical Preparations +QTWO,Q2 Holdings Inc. Common Stock,$65.09,-0.05,-0.077%,4070078025.00,United States,2014,666348,Technology,Computer Software: Prepackaged Software +QUAD,Quad Graphics Inc Class A Common Stock,$6.01,-0.13,-2.117%,305797064.00,United States,,116609,Consumer Discretionary,Publishing +QUBT,Quantum Computing Inc. Common Stock,$11.13,-0.18,-1.592%,2494492374.00,United States,,11770250,Technology,Computer Software: Prepackaged Software +QUIK,QuickLogic Corporation Common Stock,$8.10,-0.21,-2.527%,138431049.00,United States,1999,147978,Technology,Semiconductors +QUMS,Quantumsphere Acquisition Corp. Ordinary Shares,$10.10,0.01,0.099%,0.00,United States,2025,1907,, +QUMSR,Quantumsphere Acquisition Corp. Rights,$0.22,0.0011,0.503%,0.00,United States,2025,2753,, +QURE,uniQure N.V. Ordinary Shares,$23.02,-1.35,-5.54%,1433954082.00,Netherlands,2014,1434875,Health Care,Biotechnology: Pharmaceutical Preparations +QVCC,QVC Inc. 6.250% Senior Secured Notes due 2068,$8.10,-0.0958,-1.169%,0.00,United States,2019,61889,Consumer Discretionary,Catalog/Specialty Distribution +QVCD,QVC Inc. 6.375% Senior Secured Notes due 2067,$8.26,-0.08,-0.959%,0.00,United States,2018,41941,Consumer Discretionary,Catalog/Specialty Distribution +QVCGA,QVC Group Inc. Series A Common Stock,$10.22,-0.13,-1.256%,82459743.00,United States,,44977,Consumer Discretionary,Catalog/Specialty Distribution +QVCGP,QVC Group Inc. 8.0% Fixed Rate Cumulative Redeemable Preferred Stock,$3.57,-0.14,-3.774%,28804431.00,United States,,27996,Consumer Discretionary,Catalog/Specialty Distribution +QXO,QXO Inc. Common Stock,$23.24,-0.39,-1.65%,15676477323.00,United States,,5111634,Consumer Discretionary,RETAIL: Building Materials +QXO^B,QXO Inc. Depositary Shares each representing a 1/20th interest in a share of 5.50% Series B Mandatory Convertible Preferred Stock,$65.16,-1.31,-1.971%,,United States,,29078,, +R,Ryder System Inc. Common Stock,$190.63,0.43,0.226%,7696978676.00,United States,,208901,Consumer Discretionary,Rental/Leasing Companies +RA,Brookfield Real Assets Income Fund Inc. Common Stock,$12.97,-0.03,-0.231%,0.00,United States,2016,154777,Finance,Investment Managers +RAAQ,Real Asset Acquisition Corp. Class A Ordinary Share,$10.43,0.01,0.096%,0.00,United States,2025,20555,, +RAAQU,Real Asset Acquisition Corp. Unit,$11.10,0.00,0.00%,0.00,United States,2025,1,Finance,Blank Checks +RAAQW,Real Asset Acquisition Corp. Warrants,$0.65,0.02,3.175%,0.00,United States,2025,250,, +RAC,Rithm Acquisition Corp. Class A Ordinary Shares,$10.40,0.00,0.00%,0.00,,2025,250,, +RAC/WS,Rithm Acquisition Corp.,$0.8274,-0.0084,-1.005%,,,,275910,, +RACE,Ferrari N.V. Common Shares,$333.46,-3.94,-1.168%,80823102446.00,Italy,2015,497591,Industrials,Auto Manufacturing +RADX,Radiopharm Theranostics Limited American Depositary Shares,$5.03,0.11,2.236%,64152892.00,Australia,,28836,Health Care,Biotechnology: Pharmaceutical Preparations +RAIL,FreightCar America Inc. Common Stock,$11.54,-0.48,-3.993%,220172883.00,United States,2005,125443,Industrials,Railroads +RAIN,Rain Enhancement Technologies Holdco Inc. Class A Common Stock,$2.89,-0.01,-0.345%,23665727.00,United States,,8995,Technology,Industrial Machinery/Components +RAINW,Rain Enhancement Technologies Holdco Inc. Warrants,$0.23,0.00,0.00%,1883432.00,United States,,458,Technology,Industrial Machinery/Components +RAL,Ralliant Corporation Common Stock,$52.96,-0.36,-0.675%,5974196598.00,United States,2025,1293417,Industrials,Industrial Machinery/Components +RAMP,LiveRamp Holdings Inc. Common Stock,$24.83,-0.34,-1.351%,1580400797.00,United States,2018,588289,Technology,EDP Services +RAND,Rand Capital Corporation Common Stock,$11.25,0.025,0.223%,33410408.00,United States,,1982,Finance,Finance: Consumer Services +RANG,Range Capital Acquisition Corp. Ordinary Shares,$10.46,0.00,0.00%,0.00,United States,2025,5,, +RANGR,Range Capital Acquisition Corp. Rights,$0.3699,-0.0285,-7.154%,0.00,United States,2025,402927,, +RANI,Rani Therapeutics Holdings Inc. Class A Common Stock,$1.34,-0.04,-2.899%,162838596.00,United States,2021,1482928,Health Care,Biotechnology: Pharmaceutical Preparations +RAPP,Rapport Therapeutics Inc. Common Stock,$26.44,-0.94,-3.433%,1259871711.00,United States,2024,296045,Health Care,Biotechnology: Pharmaceutical Preparations +RAPT,RAPT Therapeutics Inc. Common Stock,$57.65,0.04,0.069%,1597531713.00,United States,2019,2983363,Health Care,Biotechnology: Pharmaceutical Preparations +RARE,Ultragenyx Pharmaceutical Inc. Common Stock,$24.44,-0.18,-0.731%,2357911786.00,United States,2014,1810308,Health Care,Biotechnology: Pharmaceutical Preparations +RAVE,Rave Restaurant Group Inc. Common Stock,$3.40,0.07,2.102%,48319324.00,United States,,21254,Consumer Discretionary,Food Distributors +RAY,Raytech Holding Limited Ordinary Shares,$4.59,-0.03,-0.649%,12507199.00,Hong Kong,2024,68924,Consumer Discretionary,Consumer Electronics/Appliances +RAYA,Erayak Power Solution Group Inc. Class A Ordinary Shares,$1.50,0.00,0.00%,1342457.00,China,2022,1028314,Consumer Discretionary,Metal Fabrications +RBA,RB Global Inc. Common Stock,$116.06,-1.34,-1.141%,21551413752.00,Canada,,1920343,Real Estate,Real Estate +RBB,RBB Bancorp Common Stock,$20.35,-1.06,-4.951%,346904354.00,United States,2017,71286,Finance,Major Banks +RBBN,Ribbon Communications Inc. Common Stock,$2.70,-0.07,-2.527%,476818893.00,United States,,410172,Technology,EDP Services +RBC,RBC Bearings Incorporated Common Stock,$508.95,4.41,0.874%,16088643406.00,United States,2022,260714,Industrials,Metal Fabrications +RBCAA,Republic Bancorp Inc. Class A Common Stock,$70.26,-0.56,-0.791%,1372695405.00,United States,1998,26019,Finance,Major Banks +RBKB,Rhinebeck Bancorp Inc. Common Stock,$11.88,-0.31,-2.543%,132410690.00,United States,2019,8220,Finance,Banks +RBLX,Roblox Corporation Class A Common Stock,$75.27,3.13,4.339%,52833932987.00,United States,2021,8974525,Technology,Computer Software: Prepackaged Software +RBNE,Robin Energy Ltd. Common Stock,$4.75,0.39,8.945%,13327294.00,Cyprus,,305159,Consumer Discretionary,Marine Transportation +RBOT,Vicarious Surgical Inc. Class A Common Stock,$2.13,-0.19,-8.19%,0.00,Hong Kong,2020,101777,Health Care,Industrial Specialties +RBRK,Rubrik Inc. Class A Common Stock,$63.19,0.93,1.494%,12646944229.00,United States,2024,4642910,Technology,Computer Software: Prepackaged Software +RC,Ready Capital Corporation Common Stock,$2.21,-0.10,-4.329%,358299070.00,United States,2013,2044566,Real Estate,Real Estate Investment Trusts +RC^C,Ready Capital Corporation 6.25% Series C Cumulative Convertible Preferred Stock,$13.20,0.00,0.00%,,United States,,6,, +RC^E,Ready Capital Corporation 6.50% Series E Cumulative Redeemable Preferred Stock,$13.49,-0.07,-0.516%,,United States,,1659,, +RCAT,Red Cat Holdings Inc. Common Stock,$16.38,0.71,4.531%,1955299257.00,United States,,18194202,Technology,Computer Software: Prepackaged Software +RCB,Ready Capital Corporation 6.20% Senior Notes due 2026,$24.614,-0.04,-0.162%,4044751473.00,United States,2019,930,Real Estate,Real Estate Investment Trusts +RCC,Ready Capital Corporation 5.75% Senior Notes due 2026,$24.91,0.00,0.00%,4093392346.00,United States,2021,415,Real Estate,Real Estate Investment Trusts +RCD,Ready Capital Corporation 9.00% Senior Notes due 2029,$21.69,-0.09,-0.413%,0.00,United States,2024,1782,Real Estate,Real Estate Investment Trusts +RCEL,Avita Medical Inc. Common Stock,$4.44,-0.13,-2.845%,135389413.00,United States,,124962,Health Care,Medical/Dental Instruments +RCG,RENN Fund Inc Common Stock,$2.69,-0.02,-0.738%,0.00,United States,,23380,Finance,Investment Managers +RCI,Rogers Communication Inc. Common Stock,$36.29,-0.37,-1.009%,19604775339.00,Canada,,1266837,Telecommunications,Cable & Other Pay Television Services +RCKT,Rocket Pharmaceuticals Inc. Common Stock,$3.58,-0.07,-1.918%,387435576.00,United States,2015,1645863,Health Care,Biotechnology: Pharmaceutical Preparations +RCKTW,Rocket Pharmaceuticals Inc. Warrant,$0.0157,-0.0004,-2.484%,1699089.00,United States,,900,Health Care,Biotechnology: Pharmaceutical Preparations +RCKY,Rocky Brands Inc. Common Stock,$31.44,-2.57,-7.557%,235601519.00,United States,1993,64615,Consumer Discretionary,Shoe Manufacturing +RCL,Royal Caribbean Cruises Ltd. Common Stock,$291.60,1.02,0.351%,79523102635.00,United States,1993,3746749,Consumer Discretionary,Marine Transportation +RCMT,RCM Technologies Inc. Common Stock,$19.90,-0.10,-0.50%,147469149.00,United States,,39834,Consumer Discretionary,Professional Services +RCON,Recon Technology Ltd. Class A Ordinary Shares,$1.395,-0.045,-3.125%,42725259.00,China,2009,8090,Energy,Oilfield Services/Equipment +RCS,PIMCO Strategic Income Fund Inc.,$5.83,-0.03,-0.512%,0.00,United States,1994,225680,Finance,Investment Managers +RCT,RedCloud Holdings plc Ordinary Shares,$1.25,0.00,0.00%,55283294.00,United Kingdom,2025,153770,Technology,Computer Software: Programming Data Processing +RCUS,Arcus Biosciences Inc. Common Stock,$21.70,-1.29,-5.611%,2343025731.00,United States,2018,1059944,Health Care,Biotechnology: Pharmaceutical Preparations +RDAC,Rising Dragon Acquisition Corp. Ordinary Shares,$7.33,-0.39,-5.052%,0.00,China,2024,3874,, +RDACR,Rising Dragon Acquisition Corp. Rights,$0.20,0.00,0.00%,0.00,China,2024,5394,Finance,Blank Checks +RDACU,Rising Dragon Acquisition Corp. Unit,$7.50,0.00,0.00%,0.00,China,2024,554,Finance,Blank Checks +RDAG,Republic Digital Acquisition Company Class A Ordinary Shares,$10.25,0.00,0.00%,0.00,United States,2025,150030,Finance,Blank Checks +RDCM,Radcom Ltd. Ordinary Shares,$12.55,-0.04,-0.318%,199740981.00,Israel,1997,16808,Technology,Computer peripheral equipment +RDDT,Reddit Inc. Class A Common Stock,$193.14,-3.16,-1.61%,36599212052.00,United States,2024,4372417,Technology,EDP Services +RDGT,Ridgetech Inc. Ordinary Shares,$2.05,-0.154,-6.987%,37485558.00,China,,3789,Consumer Staples,Retail-Drug Stores and Proprietary Stores +RDHL,Redhill Biopharma Ltd. American Depositary Shares,$1.29,-0.04,-3.008%,6595622.00,Israel,,21516,Health Care,Biotechnology: Pharmaceutical Preparations +RDI,Reading International Inc Class A Common Stock,$1.11,-0.01,-0.893%,25216159.00,United States,,22986,Consumer Discretionary,Movies/Entertainment +RDIB,Reading International Inc Class B Common Stock,$11.49,0.13,1.144%,261021317.00,United States,,283,Consumer Discretionary,Movies/Entertainment +RDN,Radian Group Inc. Common Stock,$32.94,-0.11,-0.333%,4463009603.00,United States,,787592,Finance,Property-Casualty Insurers +RDNT,RadNet Inc. Common Stock,$71.66,-0.84,-1.159%,5538060940.00,United States,,457432,Health Care,Medical Specialities +RDNW,RideNow Group Inc. Class B Common Stock,$5.60,0.08,1.449%,213178011.00,United States,,22999,Technology,EDP Services +RDVT,Red Violet Inc. Common Stock ,$47.11,-1.845,-3.769%,658210980.00,United States,,186340,Technology,Computer Software: Prepackaged Software +RDW,Redwire Corporation Common Stock,$13.29,-0.91,-6.408%,2194853906.00,United States,2021,54363535,Industrials,Military/Government/Technical +RDWR,Radware Ltd. Ordinary Shares,$25.06,-0.28,-1.105%,1069724542.00,Israel,1999,272024,Real Estate,Real Estate +RDY,Dr. Reddy's Laboratories Ltd Common Stock,$13.32,-0.39,-2.845%,11114945462.00,India,,1129441,Health Care,Biotechnology: Pharmaceutical Preparations +RDZN,Roadzen Inc. Ordinary Shares,$1.745,0.015,0.867%,139068948.00,United States,2022,109784,Finance,Specialty Insurers +RDZNW,Roadzen Inc. Warrants,$0.17,0.008,4.938%,13548264.00,United States,2022,7787,Finance,Specialty Insurers +REAL,The RealReal Inc. Common Stock,$15.29,-0.80,-4.972%,1784080731.00,United States,2019,2633047,Consumer Discretionary,Other Specialty Stores +REAX,The Real Brokerage Inc. Common Shares,$3.66,-0.05,-1.348%,775188000.00,Canada,,1156811,Finance,Real Estate +REBN,Reborn Coffee Inc. Common Stock,$1.90,-0.03,-1.554%,11355012.00,United States,2022,28298,Consumer Discretionary,Restaurants +RECT,Rectitude Holdings Ltd Ordinary Shares,$1.67,-0.03,-1.765%,24215000.00,Singapore,2024,12300,Consumer Discretionary,Industrial Machinery/Components +REE,REE Automotive Ltd. Class A Ordinary Shares,$0.6451,-0.0247,-3.688%,20011603.00,Israel,,150440,Industrials,Auto Manufacturing +REED,Reed's Inc. Common Stock,$2.49,-0.17,-6.391%,0.00,,2025,19962,, +REFI,Chicago Atlantic Real Estate Finance Inc. Common Stock,$12.24,-0.11,-0.891%,258022529.00,United States,2021,98255,Real Estate,Real Estate Investment Trusts +REFR,Research Frontiers Incorporated Common Stock,$1.27,-0.01,-0.781%,42733241.00,United States,,17488,Miscellaneous,Multi-Sector Companies +REG,Regency Centers Corporation Common Stock,$70.45,-0.84,-1.178%,12885373900.00,United States,1993,1196735,Real Estate,Real Estate Investment Trusts +REGCO,Regency Centers Corporation 5.875% Series B Cumulative Redeemable Preferred Stock,$22.54,0.00,0.00%,4122588044.00,United States,,1802,Real Estate,Real Estate Investment Trusts +REGCP,Regency Centers Corporation 6.25% Series A Cumulative Redeemable Preferred Stock,$23.40,0.0899,0.386%,4279882885.00,United States,,370,Real Estate,Real Estate Investment Trusts +REGN,Regeneron Pharmaceuticals Inc. Common Stock,$751.13,-20.12,-2.609%,78943360394.00,United States,1991,827944,Health Care,Biotechnology: Pharmaceutical Preparations +REI,Ring Energy Inc. Common Stock,$1.09,-0.01,-0.909%,225873263.00,United States,,2145066,Energy,Oil & Gas Production +REKR,Rekor Systems Inc. Common Stock,$1.21,-0.05,-3.968%,165113668.00,United States,,2889127,Telecommunications,Telecommunications Equipment +RELL,Richardson Electronics Ltd. Common Stock,$11.70,-0.54,-4.412%,169859687.00,United States,1983,156566,Technology,Electronic Components +RELX,RELX PLC PLC American Depositary Shares (Each representing One Ordinary Share),$37.38,-0.98,-2.555%,68180278763.00,United Kingdom,2015,3919999,Real Estate,Real Estate +RELY,Remitly Global Inc. Common Stock,$13.61,-0.23,-1.662%,2845115121.00,United States,2021,3009187,Real Estate,Real Estate +RENT,Rent the Runway Inc. Class A Common Stock,$7.09,-0.10,-1.391%,237845415.00,United States,2021,112637,Consumer Discretionary,Other Specialty Stores +RENX,RenX Enterprises Corp. Common Stock,$0.145,-0.0106,-6.812%,14493164.00,United States,,1034013,Finance,Real Estate +REPL,Replimune Group Inc. Common Stock,$7.36,-0.17,-2.258%,577342938.00,United States,2018,729783,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +REPX,Riley Exploration Permian Inc. Common Stock,$27.57,0.06,0.218%,605682738.00,United States,1999,230044,Energy,Oil & Gas Production +RERE,ATRenew Inc. American Depositary Shares (every three of which representing two Class A ordinary shares),$6.09,0.28,4.819%,1338681492.00,Cayman Islands,2021,1406624,Consumer Discretionary,Other Specialty Stores +RES,RPC Inc. Common Stock,$6.35,-0.17,-2.607%,1400647916.00,United States,,2169422,Energy,Oilfield Services/Equipment +RETO,ReTo Eco-Solutions Inc. Class A Shares,$1.24,0.07,5.983%,3544964.00,China,2017,212047,Industrials,Industrial Machinery/Components +REVB,Revelation Biosciences Inc. Common Stock,$2.09,-0.002,-0.096%,3095361.00,United States,2020,1427551,Health Care,Biotechnology: Pharmaceutical Preparations +REVBW,Revelation Biosciences Inc. Warrant,$0.0098,-0.001,-9.259%,14514.00,United States,2020,9153,Health Care,Biotechnology: Pharmaceutical Preparations +REVG,REV Group Inc. Common Stock,$66.25,-1.66,-2.444%,3233407106.00,United States,2017,458625,Industrials,Auto Manufacturing +REX,REX American Resources Corporation,$33.60,0.14,0.418%,1106707325.00,United States,,129396,Industrials,Major Chemicals +REXR,Rexford Industrial Realty Inc. Common Stock,$38.90,-0.52,-1.319%,9056324793.00,United States,2013,1627585,Real Estate,Real Estate Investment Trusts +REXR^B,Rexford Industrial Realty Inc. 5.875% Series B Cumulative Redeemable Preferred Stock,$22.50,0.00,0.00%,,United States,,893,, +REXR^C,Rexford Industrial Realty Inc. 5.625% Series C Cumulative Redeemable Preferred Stock par value $0.01 per share,$21.54,0.135,0.631%,,United States,,406,, +REYN,Reynolds Consumer Products Inc. Common Stock,$22.56,-0.66,-2.842%,4745036182.00,United States,2020,2110592,Consumer Discretionary,Containers/Packaging +REZI,Resideo Technologies Inc. Common Stock ,$33.34,-0.47,-1.39%,4991496233.00,United States,2018,2069004,Industrials,Wholesale Distributors +RF,Regions Financial Corporation Common Stock,$27.86,-0.01,-0.036%,24429779179.00,United States,,13515633,Finance,Major Banks +RF^C,Regions Financial Corporation Depositary Shares each Representing a 1/40th Interest in a Share of 5.700% Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series C,$24.90,0.08,0.322%,,United States,,48717,, +RF^E,Regions Financial Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of 4.45% Non-Cumulative Perpetual Preferred Stock Series E,$17.4401,-0.0899,-0.513%,,United States,,20830,, +RF^F,Regions Financial Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of Non-Cumulative Perpetual Preferred Stock Series F,$25.595,0.045,0.176%,,United States,,23587,, +RFAI,RF Acquisition Corp II Ordinary Shares,$10.80,0.00,0.00%,0.00,Singapore,2024,1,, +RFAIR,RF Acquisition Corp II Right,$0.09,-0.0106,-10.537%,0.00,Singapore,2024,43385,Technology,Computer Software: Prepackaged Software +RFI,Cohen & Steers Total Return Realty Fund Inc. Common Stock,$11.02,-0.13,-1.166%,541507681.00,United States,1993,84773,Finance,Investment Managers +RFIL,RF Industries Ltd. Common Stock,$10.13,-0.73,-6.722%,108530804.00,United States,,112193,Technology,Electrical Products +RFL,Rafael Holdings Inc. Class B Common Stock,$1.22,0.02,1.667%,63150617.00,United States,2018,105498,Finance,Real Estate +RFM,RiverNorth Flexible Municipal Income Fund Inc. Common Stock,$14.26,0.16,1.135%,87195608.00,,2020,14086,Finance,Finance/Investors Services +RFMZ,RiverNorth Flexible Municipal Income Fund II Inc. Common Stock,$12.96,0.10,0.778%,315598758.00,,2021,50794,Finance,Trusts Except Educational Religious and Charitable +RGA,Reinsurance Group of America Incorporated Common Stock,$196.74,0.13,0.066%,12928539504.00,United States,,229556,Finance,Life Insurance +RGC,Regencell Bioscience Holdings Limited Ordinary Shares,$32.29,0.24,0.749%,15967046839.00,Hong Kong,2021,484006,Health Care, Medicinal Chemicals and Botanical Products +RGCO,RGC Resources Inc. Common Stock,$20.62,-0.40,-1.903%,213427949.00,United States,,11090,Utilities,Oil & Gas Production +RGEN,Repligen Corporation Common Stock,$160.05,-3.58,-2.188%,9009334377.00,United States,1986,438821,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RGLD,Royal Gold Inc. Common Stock,$301.21,7.48,2.547%,25421540556.00,United States,,832182,Industrials,Precious Metals +RGNT,Regentis Biomaterials Ltd. Ordinary Shares,$6.44,-0.21,-3.158%,33355194.00,,2025,55569,Health Care,Biotechnology: Pharmaceutical Preparations +RGNX,REGENXBIO Inc. Common Stock,$11.01,-2.40,-17.897%,557360177.00,United States,2015,5016735,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RGP,Resources Connection Inc. Common Stock,$4.24,-0.10,-2.304%,142049133.00,United States,,355949,Real Estate,Real Estate +RGR,Sturm Ruger & Company Inc. Common Stock,$37.52,-0.44,-1.159%,598228373.00,United States,,271797,Industrials,Ordnance And Accessories +RGS,Regis Corporation Common Stock,$24.01,-0.91,-3.652%,59556637.00,United States,1991,16436,Consumer Discretionary,Other Consumer Services +RGT,Royce Global Trust Inc. Common Stock,$14.09,0.06,0.428%,88301227.00,,2013,45909,Finance,Trusts Except Educational Religious and Charitable +RGTI,Rigetti Computing Inc. Common Stock,$22.01,-0.30,-1.345%,7263873977.00,United States,,25838340,Technology,EDP Services +RGTIW,Rigetti Computing Inc. Warrants,$11.17,-0.265,-2.317%,3686391291.00,United States,,43212,Technology,EDP Services +RH,RH Common Stock,$204.55,-5.26,-2.507%,3840978330.00,United States,2012,773764,Consumer Discretionary,Other Specialty Stores +RHI,Robert Half Inc. Common Stock,$26.95,-0.80,-2.883%,2726973237.00,United States,,2852021,Consumer Discretionary,Professional Services +RHLD,Resolute Holdings Management Common Stock ,$202.39,3.70,1.862%,1725576735.00,United States,,63314,Finance,Finance: Consumer Services +RHP,Ryman Hospitality Properties Inc. (REIT),$93.48,-0.62,-0.659%,5889620838.00,United States,,420334,Real Estate,Real Estate Investment Trusts +RIBB,Ribbon Acquisition Corp Class A Ordinary Shares,$10.47,0.00,0.00%,0.00,Japan,2025,137,, +RIBBR,Ribbon Acquisition Corp Rights,$0.22,0.00,0.00%,0.00,Japan,2025,10,, +RICK,RCI Hospitality Holdings Inc. Common Stock,$24.12,-0.63,-2.545%,210337519.00,United States,1995,81318,Consumer Discretionary,Restaurants +RIG,Transocean Ltd (Switzerland) Common Stock,$4.87,-0.09,-1.815%,5364018668.00,Switzerland,,40924501,Energy,Oil & Gas Production +RIGL,Rigel Pharmaceuticals Inc. Common Stock,$35.25,-2.00,-5.369%,639834876.00,United States,2000,382918,Health Care,Biotechnology: Pharmaceutical Preparations +RILY,BRC Group Holdings Inc. Common Stock,$9.41,0.06,0.642%,287918391.00,United States,,979070,Finance,Investment Managers +RILYG,BRC Group Holdings Inc. 5.00% Senior Notes due 2026,$22.50,-0.2499,-1.098%,686183985.00,United States,,31649,Finance,Investment Managers +RILYK,BRC Group Holdings Inc. 5.50% Senior Notes Due 2026,$24.95,0.04,0.161%,760901797.00,United States,,28338,Finance,Investment Managers +RILYL,BRC Group Holdings Inc. Depositary Shares each representing 1/1000th in a share of 7.375% Series B Cumulative Perpetual Preferred Stock par value $0.0001,$11.56,0.2514,2.223%,353702083.00,United States,,11651,Finance,Investment Managers +RILYN,BRC Group Holdings Inc. 6.50% Senior Notes Due 2026,$23.45,-0.03,-0.128%,715156198.00,United States,,19869,Finance,Investment Managers +RILYP,BRC Group Holdings Inc. Depositary Shares each representing a 1/1000th fractional interest in a share of Series A Cumulative Perpetual Preferred Stock,$10.47,-0.02,-0.191%,320351281.00,United States,,9278,Finance,Investment Managers +RILYT,BRC Group Holdings Inc. 6.00% Senior Notes Due 2028,$17.225,-0.075,-0.434%,525311962.00,United States,,9340,Finance,Investment Managers +RILYZ,BRC Group Holdings Inc. 5.25% Senior Notes due 2028,$15.75,0.05,0.318%,480328790.00,United States,,40651,Finance,Investment Managers +RIME,Algorhythm Holdings Inc. Common Stock,$0.931,-0.0182,-1.917%,2533975.00,United States,,183832,Consumer Staples,Diversified Electronic Products +RIO,Rio Tinto Plc Common Stock,$93.37,0.46,0.495%,117113274479.00,Australia,2002,3877035,Basic Materials,Metal Mining +RIOT,Riot Platforms Inc. Common Stock ,$17.55,0.00,0.00%,6525216114.00,United States,,14628657,Finance,Finance: Consumer Services +RITM,Rithm Capital Corp. Common Stock,$11.90,-0.16,-1.327%,6594940373.00,United States,,7423169,Real Estate,Real Estate Investment Trusts +RITM^A,Rithm Capital Corp. 7.50% Series A Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.76,-0.0198,-0.077%,,United States,,14029,, +RITM^B,Rithm Capital Corp. 7.125% Series B Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.65,-0.01,-0.039%,,United States,,13129,, +RITM^C,Rithm Capital Corp. 6.375% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.02,-0.05,-0.199%,,United States,,27202,, +RITM^D,Rithm Capital Corp. 7.00% Fixed-Rate Reset Series D Cumulative Redeemable Preferred Stock,$24.98,-0.03,-0.12%,,United States,,66890,, +RITM^E,Rithm Capital Corp. 8.75% Series E Fixed-Rate Cumulative Redeemable Preferred Stock,$25.62,0.03,0.117%,,United States,,108306,, +RITM^F,Rithm Capital Corp. 8.750% Series F Fixed-Rate Reset Cumulative Redeemable Preferred Stock,$25.00,0.05,0.20%,,United States,,224163,, +RITR,Reitar Logtech Holdings Limited Ordinary shares,$1.02,-0.01,-0.971%,63692625.00,Hong Kong,2024,197560,Finance,Real Estate +RIV,RiverNorth Opportunities Fund Inc. Common Stock,$12.00,-0.04,-0.332%,0.00,United States,2015,181922,Finance,Finance Companies +RIV^A,RiverNorth Opportunities Fund Inc. 6.00% Series A Perpetual Preferred Stock,$23.373,0.0324,0.139%,,United States,,1229,, +RIVN,Rivian Automotive Inc. Class A Common Stock,$15.20,-0.07,-0.458%,18633879348.00,United States,2021,19042103,Industrials,Auto Manufacturing +RJET,Republic Airways Holdings Inc. Common Stock,$16.87,-0.74,-4.202%,791203000.00,United States,2018,43954,Consumer Discretionary,Air Freight/Delivery Services +RJF,Raymond James Financial Inc. Common Stock,$168.31,-0.71,-0.42%,33192388170.00,United States,,1513704,Finance,Investment Bankers/Brokers/Service +RKDA,Arcadia Biosciences Inc. Common Stock,$2.18,-0.05,-2.242%,2993402.00,United States,2015,38027,Consumer Staples,Farming/Seeds/Milling +RKLB,Rocket Lab Corporation Common Stock,$88.57,1.57,1.805%,47310226414.00,United States,2020,16262985,Industrials,Military/Government/Technical +RKT,Rocket Companies Inc. Class A Common Stock,$20.76,-0.27,-1.284%,58457876649.00,United States,2020,20958950,Finance,Finance: Consumer Services +RL,Ralph Lauren Corporation Common Stock,$352.99,-4.80,-1.342%,21405545867.00,United States,1997,647452,Industrials,Garments and Clothing +RLAY,Relay Therapeutics Inc. Common Stock,$7.65,-0.85,-10.00%,1325916245.00,United States,2020,1818772,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RLGT,Radiant Logistics Inc. Common Stock,$6.53,-0.05,-0.76%,305777332.00,United States,,174628,Industrials,Integrated Freight & Logistics +RLI,RLI Corp. Common Stock (DE),$56.98,-0.34,-0.593%,5232919838.00,United States,,1644127,Finance,Property-Casualty Insurers +RLJ,RLJ Lodging Trust Common Shares of Beneficial Interest $0.01 par value,$7.27,-0.17,-2.285%,1098388517.00,United States,2011,1819908,Real Estate,Real Estate Investment Trusts +RLJ^A,RLJ Lodging Trust $1.95 Series A Cumulative Convertible Preferred Shares,$25.5186,0.0486,0.191%,,United States,,12864,, +RLMD,Relmada Therapeutics Inc. Common Stock,$3.95,-0.15,-3.659%,289667807.00,United States,,425957,Health Care,Biotechnology: Pharmaceutical Preparations +RLTY,Cohen & Steers Real Estate Opportunities and Income Fund Common Shares of Beneficial Interest,$14.57,-0.13,-0.884%,0.00,,2022,96091,Finance,Investment Managers +RLX,RLX Technology Inc. American Depositary Shares each representing the right to receive one (1) Class A ordinary share,$2.35,0.01,0.427%,3691357840.00,Cayman Islands,2021,3508296,Health Care, Medicinal Chemicals and Botanical Products +RLYB,Rallybio Corporation Common Stock,$0.6425,0.0024,0.375%,27141625.00,United States,2021,99446,Health Care,Biotechnology: Pharmaceutical Preparations +RM,Regional Management Corp. Common Stock,$35.65,-1.28,-3.466%,346261498.00,United States,2012,40991,Finance,Finance: Consumer Services +RMAX,RE/MAX Holdings Inc. Class A Common Stock,$7.82,0.01,0.128%,156840704.00,United States,2013,105767,Finance,Real Estate +RMBI,Richmond Mutual Bancorporation Inc. Common Stock,$13.91,-0.23,-1.627%,145359597.00,United States,2019,14480,Finance,Major Banks +RMBS,Rambus Inc. Common Stock,$124.44,8.73,7.545%,13395982551.00,United States,1997,2803457,Technology,Semiconductors +RMCF,Rocky Mountain Chocolate Factory Inc. Common Stock,$2.45,0.04,1.66%,22865414.00,United States,,130981,Consumer Staples,Specialty Foods +RMCO,Royalty Management Holding Corporation Class A Common Stock,$4.41,-0.05,-1.121%,66770637.00,United States,2023,51959,Miscellaneous,Multi-Sector Companies +RMCOW,Royalty Management Holding Corporation Warrant,$0.19,0.0103,5.732%,2876739.00,United States,2023,8732,Miscellaneous,Multi-Sector Companies +RMD,ResMed Inc. Common Stock,$257.72,2.22,0.869%,37618433290.00,United States,,1404894,Health Care,Medical/Dental Instruments +RMI,RiverNorth Opportunistic Municipal Income Fund Inc. Common Stock,$14.67,0.1299,0.893%,93495842.00,,2018,13500,Finance,Finance/Investors Services +RMM,RiverNorth Managed Duration Municipal Income Fund Inc. Common Stock,$13.99,0.10,0.72%,276157396.00,,2019,99035,Finance,Trusts Except Educational Religious and Charitable +RMMZ,RiverNorth Managed Duration Municipal Income Fund II Inc. Common Stock,$14.71,0.1287,0.883%,290369928.00,,2022,24964,Finance,Investment Managers +RMNI,Rimini Street Inc. (DE) Common Stock,$3.54,-0.07,-1.939%,324802080.00,United States,2015,302468,Real Estate,Real Estate +RMR,The RMR Group Inc. Class A Common Stock,$15.14,-0.19,-1.239%,485360800.00,United States,,313983,Consumer Discretionary,Professional Services +RMSG,Real Messenger Corporation Ordinary Shares,$1.02,-0.11,-9.735%,9762707.00,United States,,95111,Technology,Computer Software: Programming Data Processing +RMSGW,Real Messenger Corporation Warrants,$0.0422,0.0002,0.476%,403908.00,United States,,213,Technology,Computer Software: Programming Data Processing +RMT,Royce Micro-Cap Trust Inc. Common Stock,$11.51,-0.04,-0.346%,532557422.00,United States,,80918,Finance,Investment Managers +RMTI,Rockwell Medical Inc. Common Stock,$1.13,-0.02,-1.739%,44527991.00,United States,1998,342606,Health Care,Biotechnology: Pharmaceutical Preparations +RNA,Avidity Biosciences Inc. Common Stock,$72.46,-0.18,-0.248%,10917964265.00,United States,2020,2366682,Health Care,Biotechnology: Pharmaceutical Preparations +RNAC,Cartesian Therapeutics Inc. Common Stock,$7.28,-0.12,-1.622%,189306252.00,United States,2016,90468,Health Care,Biotechnology: Pharmaceutical Preparations +RNAZ,TransCode Therapeutics Inc. Common Stock,$11.085,-0.585,-5.013%,10164590.00,United States,2021,27290,Health Care,Biotechnology: Pharmaceutical Preparations +RNG,RingCentral Inc. Class A Common Stock,$26.99,-0.06,-0.222%,2336381658.00,United States,2013,1388794,Technology,EDP Services +RNGR,Ranger Energy Services Inc. Class A Common Stock,$15.15,-0.34,-2.195%,327447358.00,United States,2017,175671,Energy,Oilfield Services/Equipment +RNGT,Range Capital Acquisition Corp II Class A Ordinary Shares,$9.99,0.01,0.10%,0.00,United States,2025,4430,, +RNGTU,Range Capital Acquisition Corp II Units,$10.1999,0.0798,0.789%,0.00,United States,2025,4011,, +RNGTW,Range Capital Acquisition Corp II Warrants,$0.35,0.015,4.478%,0.00,United States,2025,3373,, +RNP,Cohen & Steers REIT and Preferred and Income Fund Inc. Common Shares,$19.85,-0.17,-0.849%,975401766.00,United States,2003,210242,Finance,Investment Managers +RNR,RenaissanceRe Holdings Ltd. Common Stock,$275.40,1.01,0.368%,12698561257.00,Bermuda,,291216,Finance,Property-Casualty Insurers +RNR^F,RenaissanceRe Holdings Ltd. Depositary Shares each Representing a 1/1000th Interest in a 5.750% Series F Preference Share,$22.32,-0.0102,-0.046%,,Bermuda,,12749,, +RNR^G,RenaissanceRe Holdings Ltd. Depositary Shares each representing a 1/1000th interest in a share of 4.20% Series G Preference Shares,$16.16,-0.06,-0.37%,,Bermuda,,10609,, +RNST,Renasant Corporation Common Stock,$38.35,1.13,3.036%,3644070000.00,United States,2023,1083503,Finance,Major Banks +RNTX,Rein Therapeutics Inc. Common Stock,$1.52,-0.03,-1.935%,39955301.00,United States,2017,83471,Health Care,Biotechnology: Pharmaceutical Preparations +RNW,ReNew Energy Global plc Class A Ordinary Shares,$5.58,-0.03,-0.535%,2024251824.00,United Kingdom,,678963,Utilities,Electric Utilities: Central +RNWWW,ReNew Energy Global plc Warrant,$0.0059,0.0003,5.357%,2140338.00,United Kingdom,,6669,Utilities,Electric Utilities: Central +RNXT,RenovoRx Inc. Common Stock,$0.9009,0.0018,0.20%,33017909.00,United States,2021,148379,Health Care,Biotechnology: Pharmaceutical Preparations +ROAD,Construction Partners Inc. Class A Common Stock,$113.35,2.31,2.08%,6404884370.00,United States,2018,352649,Industrials,Military/Government/Technical +ROCK,Gibraltar Industries Inc. Common Stock,$51.07,0.41,0.809%,1508743748.00,United States,1993,331366,Industrials,Steel/Iron Ore +ROG,Rogers Corporation Common Stock,$96.06,-1.48,-1.517%,1727590974.00,United States,1960,95943,Industrials,Major Chemicals +ROIV,Roivant Sciences Ltd. Common Shares,$21.91,-0.62,-2.752%,15238221285.00,United Kingdom,,4091934,Health Care,Biotechnology: Pharmaceutical Preparations +ROK,Rockwell Automation Inc. Common Stock,$414.90,-4.85,-1.155%,46582302948.00,United States,,552918,Industrials,Industrial Machinery/Components +ROKU,Roku Inc. Class A Common Stock,$100.84,-3.74,-3.576%,14899288588.00,United States,2017,2516605,Telecommunications,Cable & Other Pay Television Services +ROL,Rollins Inc. Common Stock,$62.83,-0.66,-1.04%,30230689308.00,United States,,2745480,Consumer Discretionary,Diversified Commercial Services +ROLR,High Roller Technologies Inc. Common Stock,$8.00,0.88,12.36%,86561384.00,,2024,4044356,Consumer Discretionary,Services-Misc. Amusement & Recreation +ROMA,Roma Green Finance Limited Class A Ordinary Shares,$3.40,-0.57,-14.358%,202519541.00,Hong Kong,2024,167686,Consumer Discretionary,Professional Services +ROOT,Root Inc. Class A Common Stock,$65.79,-4.06,-5.812%,1020334544.00,United States,2020,434699,Finance,Property-Casualty Insurers +ROP,Roper Technologies Inc. Common Stock,$360.37,-8.90,-2.41%,38789300649.00,United States,1992,2940727,Technology,Computer Software: Programming Data Processing +ROST,Ross Stores Inc. Common Stock,$186.04,0.04,0.022%,60173694405.00,United States,1985,1753576,Consumer Discretionary,Clothing/Shoe/Accessory Stores +RPAY,Repay Holdings Corporation Class A Common Stock,$3.52,0.03,0.86%,302939060.00,United States,2018,948196,Real Estate,Real Estate +RPD,Rapid7 Inc. Common Stock,$12.53,-0.07,-0.556%,820474123.00,United States,2015,1095377,Technology,Computer Software: Prepackaged Software +RPGL,Republic Power Group Limited Class A Ordinary Shares,$0.3221,-0.0058,-1.769%,21693435.00,Singapore,2025,81236,Technology,Computer Software: Prepackaged Software +RPID,Rapid Micro Biosystems Inc. Class A Common Stock,$4.65,0.40,9.412%,206099881.00,United States,2021,441800,Industrials,Biotechnology: Laboratory Analytical Instruments +RPM,RPM International Inc. Common Stock,$106.85,-0.44,-0.41%,13684886729.00,United States,,844003,Consumer Discretionary,Paints/Coatings +RPRX,Royalty Pharma plc Class A Ordinary Shares ,$40.41,-0.33,-0.81%,23326191904.00,United States,2020,3233110,Health Care,Biotechnology: Pharmaceutical Preparations +RPT,Rithm Property Trust Inc. Common stock,$16.76,-0.16,-0.946%,126820456.00,United States,2015,35989,Real Estate,Real Estate Investment Trusts +RPT^C,Rithm Property Trust Inc. 9.875% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.27,-0.01,-0.04%,,United States,,941,, +RQI,Cohen & Steers Quality Income Realty Fund Inc Common Shares,$11.97,-0.22,-1.805%,1607575884.00,United States,2002,467338,Finance,Trusts Except Educational Religious and Charitable +RR,Richtech Robotics Inc. Class B Common Stock,$5.08,-0.43,-7.804%,1092687543.00,United States,2023,107108663,Industrials,Industrial Machinery/Components +RRBI,Red River Bancshares Inc. Common Stock,$76.66,-0.33,-0.429%,517961646.00,United States,2019,27197,Consumer Discretionary,Hotels/Resorts +RRC,Range Resources Corporation Common Stock,$36.74,0.99,2.769%,8705021770.00,United States,,3988975,Energy,Oil & Gas Production +RRGB,Red Robin Gourmet Burgers Inc. Common Stock,$3.78,-0.09,-2.326%,67905655.00,United States,2002,361467,Consumer Discretionary,Restaurants +RRR,Red Rock Resorts Inc. Class A Common Stock,$61.24,0.84,1.391%,6482582369.00,United States,2016,628224,Consumer Discretionary,Hotels/Resorts +RRX,Regal Rexnord Corporation Common Stock,$156.74,2.15,1.391%,10405917346.00,United States,1976,757890,Consumer Discretionary,Metal Fabrications +RS,Reliance Inc. Common Stock,$325.86,-1.37,-0.419%,17038229763.00,United States,1994,241193,Industrials,Metal Fabrications +RSF,RiverNorth Capital and Income Fund Common Stock,$14.504,-0.085,-0.583%,48466233.00,,2019,13355,Finance,Investment Managers +RSG,Republic Services Inc. Common Stock,$217.60,0.41,0.189%,67361039142.00,United States,1998,972539,Utilities,Environmental Services +RSI,Rush Street Interactive Inc. Class A Common Stock,$16.75,-0.34,-1.989%,3842663931.00,United States,2020,2120284,Consumer Discretionary,Services-Misc. Amusement & Recreation +RSKD,Riskified Ltd. Class A Ordinary Shares,$4.47,-0.02,-0.445%,722729635.00,,2021,484897,Real Estate,Real Estate +RSSS,Research Solutions Inc Common Stock,$2.83,-0.13,-4.392%,93010972.00,United States,,20778,Technology,EDP Services +RSVR,Reservoir Media Inc. Common Stock,$7.34,-0.05,-0.677%,481417557.00,United States,2021,52616,Consumer Discretionary,Services-Misc. Amusement & Recreation +RTAC,Renatus Tactical Acquisition Corp I Class A Ordinary Shares,$10.82,0.03,0.278%,0.00,United States,2025,68752,Finance,Blank Checks +RTACU,Renatus Tactical Acquisition Corp I Unit,$11.23,0.15,1.354%,0.00,United States,2025,3654,Finance,Blank Checks +RTACW,Renatus Tactical Acquisition Corp I Warrant,$0.97,-0.01,-1.02%,0.00,United States,2025,14846,Finance,Blank Checks +RTO,Rentokil Initial plc American Depositary Shares (each representing five (5) Ordinary Shares),$32.39,-1.06,-3.169%,8168758000.00,United States,2022,1130583,Consumer Discretionary,Other Consumer Services +RTX,RTX Corporation Common Stock,$199.46,-1.82,-0.904%,267430371551.00,United States,,6826457,Industrials,Aerospace +RUBI,Rubico Inc. Common Stock,$0.8007,-0.0393,-4.679%,3186347.00,Greece,,86142,Consumer Discretionary,Marine Transportation +RUM,Rumble Inc. Class A Common Stock,$5.96,-0.03,-0.501%,2591780041.00,United States,2021,1862058,Technology,Computer Software: Programming Data Processing +RUMBW,Rumble Inc. Warrant,$1.64,-0.04,-2.381%,713174374.00,United States,2021,47380,Technology,Computer Software: Programming Data Processing +RUN,Sunrun Inc. Common Stock,$21.41,0.69,3.33%,4968015495.00,United States,2015,11182717,Miscellaneous,Industrial Machinery/Components +RUSHA,Rush Enterprises Inc. Common Stock Cl A,$62.28,-0.44,-0.702%,4800630215.00,United States,,353287,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +RUSHB,Rush Enterprises Inc. Class B,$57.91,-0.79,-1.346%,4463784453.00,United States,,26883,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +RVLV,Revolve Group Inc. Class A Common Stock,$28.55,-0.51,-1.755%,2036592381.00,United States,2019,977482,Consumer Discretionary,Catalog/Specialty Distribution +RVMD,Revolution Medicines Inc. Common Stock,$97.33,-2.49,-2.494%,18815816621.00,United States,2020,3133818,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RVMDW,Revolution Medicines Inc. Warrant,$1.70,-0.20,-10.526%,328643669.00,United States,,58422,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RVP,Retractable Technologies Inc. Common Stock,$0.7011,-0.0191,-2.652%,20988942.00,United States,2001,50395,Health Care,Medical/Dental Instruments +RVPH,Reviva Pharmaceuticals Holdings Inc. Common Stock ,$0.293,-0.0099,-3.268%,34237030.00,United States,2020,1797922,Health Care,Biotechnology: Pharmaceutical Preparations +RVSB,Riverview Bancorp Inc Common Stock,$5.19,0.09,1.765%,107694451.00,United States,,56876,Finance,Savings Institutions +RVSN,Rail Vision Ltd. Ordinary Share,$0.3269,-0.0199,-5.738%,19308373.00,Israel,2022,1203174,Industrials,Railroads +RVSNW,Rail Vision Ltd. Warrant,$0.0698,-0.0032,-4.384%,4122742.00,Israel,2022,23144,Industrials,Railroads +RVT,Royce Small-Cap Trust Inc. Common Stock,$17.46,-0.05,-0.286%,1884924244.00,United States,1986,314584,Finance,Trusts Except Educational Religious and Charitable +RVTY,Revvity Inc. Common Stock,$111.13,-3.48,-3.036%,12599432762.00,United States,,1453221,Industrials,Biotechnology: Laboratory Analytical Instruments +RVYL,Ryvyl Inc. Common Stock,$6.90,-0.21,-2.954%,7114093.00,United States,,130657,Consumer Discretionary,Professional Services +RWAY,Runway Growth Finance Corp. Common Stock,$9.15,0.04,0.439%,330626439.00,United States,2021,484522,Finance,Finance: Consumer Services +RWAYL,Runway Growth Finance Corp. 7.50% Notes due 2027,$25.30,0.00,0.00%,916280790.00,United States,,7389,Finance,Finance: Consumer Services +RWAYZ,Runway Growth Finance Corp. 8.00% Notes due 2027,$25.367,-0.003,-0.012%,918707304.00,United States,,26234,Finance,Finance: Consumer Services +RWT,Redwood Trust Inc. Common Stock,$5.86,-0.06,-1.014%,742357751.00,United States,1995,1085815,Real Estate,Real Estate Investment Trusts +RWT^A,Redwood Trust Inc. 10.00% Series A Fixed-Rate Reset Cumulative Redeemable Preferred Stock,$24.87,-0.08,-0.321%,,United States,,3016,, +RWTN,Redwood Trust Inc. 9.125% Senior Notes Due 2029,$25.20,0.11,0.438%,3256431293.00,United States,2024,9561,Real Estate,Real Estate Investment Trusts +RWTO,Redwood Trust Inc. 9.00% Senior Notes Due 2029,$25.225,-0.185,-0.728%,3259661879.00,United States,2024,8614,Real Estate,Real Estate Investment Trusts +RWTP,Redwood Trust Inc. 9.125% Senior Notes Due 2030,$24.89,0.02,0.08%,0.00,United States,2025,14146,Real Estate,Real Estate Investment Trusts +RWTQ,Redwood Trust Inc. 9.500% Senior Notes Due 2030,$25.33,0.12,0.476%,0.00,United States,2025,18421,Real Estate,Real Estate Investment Trusts +RXO,RXO Inc. Common Stock,$14.60,0.07,0.482%,2396033331.00,United States,2022,1490451,Consumer Discretionary,Transportation Services +RXRX,Recursion Pharmaceuticals Inc. Class A Common Stock,$4.47,-0.13,-2.826%,2323674005.00,United States,2021,16212547,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +RXST,RxSight Inc. Common Stock,$9.11,-0.11,-1.193%,374572590.00,United States,2021,590889,Health Care,Ophthalmic Goods +RXT,Rackspace Technology Inc. Common Stock,$0.71,-0.0317,-4.274%,172950405.00,United States,2020,1693528,Technology,Computer Software: Programming Data Processing +RY,Royal Bank Of Canada Common Stock,$166.58,-2.26,-1.339%,233247312794.00,Canada,,1704608,Finance,Commercial Banks +RYAAY,Ryanair Holdings plc American Depositary Shares,$68.70,0.70,1.029%,36152261304.00,Ireland,1997,1904296,Consumer Discretionary,Air Freight/Delivery Services +RYAM,Rayonier Advanced Materials Inc. Common Stock,$8.53,0.18,2.156%,571557708.00,United States,2014,453884,Basic Materials,Paper +RYAN,Ryan Specialty Holdings Inc. Class A Common Stock,$47.55,0.97,2.082%,12544196883.00,United States,2021,1548723,Finance,Specialty Insurers +RYDE,Ryde Group Ltd. Class A Ordinary Shares,$0.3522,0.0084,2.443%,31102016.00,,2024,35522,Real Estate,Real Estate +RYET,Ruanyun Edai Technology Inc. Ordinary shares,$1.09,-0.005,-0.457%,37441504.00,China,2025,17270,Technology,Computer Software: Prepackaged Software +RYI,Ryerson Holding Corporation Common Stock,$27.54,-0.34,-1.22%,887116910.00,United States,2014,358566,Industrials,Metal Fabrications +RYM,RYTHM Inc. Common Stock,$18.78,-1.20,-6.006%,40360624.00,United States,2021,30143,Consumer Staples,Farming/Seeds/Milling +RYN,Rayonier Inc. REIT Common Stock,$22.49,-0.59,-2.556%,3630462104.00,United States,,4324345,Real Estate,Real Estate Investment Trusts +RYOJ,rYojbaba Co. Ltd. Common Shares,$2.94,-0.15,-4.854%,33075000.00,Japan,2025,11452,Consumer Discretionary,Professional Services +RYTM,Rhythm Pharmaceuticals Inc. Common Stock,$102.67,-2.86,-2.71%,6851790870.00,United States,2017,425739,Health Care,Biotechnology: Pharmaceutical Preparations +RZB,Reinsurance Group of America Incorporated 5.75% Fixed-To-Floating Rate Subordinated Debentures due 2056,$25.14,0.07,0.279%,1652045762.00,United States,2016,11686,Finance,Life Insurance +RZC,Reinsurance Group of America Incorporated 7.125% Fixed-Rate Reset Subordinated Debentures due 2052,$25.47,0.00,0.00%,1673731327.00,United States,2022,44074,Finance,Life Insurance +RZLT,Rezolute Inc. Common Stock (NV),$3.38,-0.12,-3.429%,313419058.00,United States,,2627603,Health Care,Biotechnology: Pharmaceutical Preparations +RZLV,Rezolve AI PLC Ordinary Shares,$3.10,0.06,1.974%,1236365520.00,United Kingdom,,20666133,Technology,Computer Software: Programming Data Processing +RZLVW,Rezolve AI PLC Warrants,$1.25,-0.0108,-0.857%,498534484.00,United Kingdom,,20310,Technology,Computer Software: Programming Data Processing +S,SentinelOne Inc. Class A Common Stock,$14.93,-0.18,-1.191%,5074244080.00,United States,2021,8691403,Technology,Computer Software: Prepackaged Software +SA,Seabridge Gold Inc. Ordinary Shares (Canada),$34.64,0.33,0.962%,3597095020.00,Canada,,1099512,Basic Materials,Precious Metals +SAAQU,Space Asset Acquisition Corp. Units,$10.20,0.20,2.00%,0.00,United States,2026,8316143,Finance,Blank Checks +SABA,Saba Capital Income & Opportunities Fund II Shares of Beneficial Interest,$8.18,-0.06,-0.728%,0.00,United States,,125411,, +SABR,Sabre Corporation Common Stock,$1.21,-0.05,-3.968%,477810710.00,United States,2014,5052603,Technology,Computer Software: Programming Data Processing +SABS,SAB Biotherapeutics Inc. Common Stock,$4.41,0.13,3.037%,209946213.00,United States,2021,709921,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SABSW,SAB Biotherapeutics Inc. Warrant,$0.043,0.003,7.50%,2047095.00,United States,2021,6000,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SAC,Safeguard Acquisition Corp. Class A Ordinary Shares,$9.96,0.03,0.302%,0.00,,2026,163783,Finance,Blank Checks +SACH,Sachem Capital Corp. Common Shares,$1.06,0.00,0.00%,50552588.00,United States,2017,67733,Real Estate,Real Estate Investment Trusts +SACH^A,Sachem Capital Corp. 7.75% Series A Cumulative Redeemable Preferred Stock,$18.615,0.02,0.108%,,United States,,2591,, +SAFE,Safehold Inc. New Common Stock ,$13.67,-0.28,-2.007%,980909113.00,United States,2023,343915,Real Estate,Real Estate Investment Trusts +SAFT,Safety Insurance Group Inc. Common Stock,$75.97,-0.10,-0.131%,1131501282.00,United States,2002,59517,Finance,Property-Casualty Insurers +SAFX,XCF Global Inc. Class A Common Stock,$0.1881,-0.1112,-37.153%,39185659.00,United States,,44440153,Industrials,Major Chemicals +SAGT,SAGTEC GLOBAL LIMITED Class A Ordinary shares,$1.91,-0.01,-0.521%,23970500.00,Malaysia,2025,71747,Technology,Computer Software: Prepackaged Software +SAH,Sonic Automotive Inc. Common Stock,$61.70,0.41,0.669%,2108454603.00,United States,1997,215082,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +SAIA,Saia Inc. Common Stock,$349.87,-0.13,-0.037%,9321460807.00,United States,,373880,Industrials,Trucking Freight/Courier Services +SAIC,Science Applications International Corporation Common Stock,$103.55,-0.15,-0.145%,4672943720.00,United States,,425413,Technology,EDP Services +SAIH,SAIHEAT Limited Class A Ordinary Shares,$7.75,-0.40,-4.908%,13585363.00,Singapore,2021,7033,Technology,EDP Services +SAIL,SailPoint Inc. Common Stock,$17.29,-1.02,-5.571%,9710509390.00,United States,2025,3028714,Technology,Computer Software: Prepackaged Software +SAJ,Saratoga Investment Corp 8.00% Notes due 2027,$25.90,0.0049,0.019%,405804593.00,United States,2022,463,Finance,Investment Managers +SAM,Boston Beer Company Inc. (The) Common Stock,$213.34,-5.84,-2.664%,2273856229.00,United States,,121651,Consumer Staples,Beverages (Production/Distribution) +SAMG,Silvercrest Asset Management Group Inc. Class A Common Stock,$14.68,-1.04,-6.616%,179660358.00,United States,2013,57806,Finance,Investment Managers +SAN,Banco Santander S.A. Sponsored ADR (Spain),$12.68,-0.37,-2.835%,186639753168.00,Spain,,4136438,Finance,Commercial Banks +SANA,Sana Biotechnology Inc. Common Stock,$4.75,-0.22,-4.427%,1265239070.00,United States,2021,2391715,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SANG,Sangoma Technologies Corporation Common Shares,$4.855,0.055,1.146%,160890646.00,Canada,,432,Technology,Computer Software: Programming Data Processing +SANM,Sanmina Corporation Common Stock,$152.65,9.46,6.607%,8335436153.00,United States,1993,1815021,Technology,Electrical Products +SAP,SAP SE ADS,$236.11,2.17,0.928%,290062134218.00,Germany,,2173049,Technology,Computer Software: Prepackaged Software +SAR,Saratoga Investment Corp New,$23.34,-0.08,-0.342%,377735914.00,United States,,104601,Finance,Investment Managers +SARO,StandardAero Inc. Common Stock,$31.59,-1.53,-4.62%,10565853534.00,United States,2024,22705976,Industrials,Aerospace +SAT,Saratoga Investment Corp 6.00% Notes due 2027,$24.975,0.02,0.08%,391311572.00,United States,2022,11507,Finance,Investment Managers +SATA,Strive Inc. Variable Rate Series A Perpetual Preferred Stock,$97.27,0.38,0.392%,121338178898.00,United States,,121425,, +SATL,Satellogic Inc. Class A Common Stock,$5.37,-0.13,-2.364%,780365377.00,Uruguay,,18096941,Technology,Radio And Television Broadcasting And Communications Equipment +SATLW,Satellogic Inc. Warrant,$1.53,0.1699,12.492%,222338739.00,Uruguay,,153841,Technology,Radio And Television Broadcasting And Communications Equipment +SATS,EchoStar Corporation Common Stock,$128.57,2.76,2.194%,37012257820.00,United States,,5624282,Consumer Discretionary,Telecommunications Equipment +SAVA,Cassava Sciences Inc. Common Stock,$2.04,-0.08,-3.774%,98548108.00,United States,,507898,Health Care,Biotechnology: Pharmaceutical Preparations +SAY,Saratoga Investment Corp 8.125% Notes due 2027,$25.7576,0.2476,0.971%,403573451.00,United States,2022,12076,Finance,Investment Managers +SAZ,Saratoga Investment Corp 8.50% Notes due 2028,$25.55,0.00,0.00%,400320747.00,United States,2023,2874,Finance,Investment Managers +SB,Safe Bulkers Inc Common Stock ($0.001 par value),$5.45,0.05,0.926%,557644540.00,Monaco,2008,810084,Consumer Discretionary,Marine Transportation +SB^C,Safe Bulkers Inc Cumulative Redeemable Perpetual Preferred Series C (Marshall Islands),$25.85,0.05,0.194%,,Monaco,,783,, +SB^D,Safe Bulkers Inc Perpetual Preferred Series D (Marshall Islands),$25.65,0.08,0.313%,,Monaco,,6302,, +SBAC,SBA Communications Corporation Class A Common Stock,$184.16,-2.63,-1.408%,19621671027.00,United States,1999,745350,Real Estate,Real Estate Investment Trusts +SBC,SBC Medical Group Holdings Incorporated Common Stock,$4.19,-0.01,-0.238%,429797391.00,United States,2022,22095,Health Care,Medical/Nursing Services +SBCF,Seacoast Banking Corporation of Florida Common Stock,$33.56,-0.08,-0.238%,3283112680.00,United States,,586748,Finance,Major Banks +SBCWW,SBC Medical Group Holdings Incorporated Warrants,$0.2873,0.0103,3.718%,29470356.00,United States,2022,11080,Health Care,Medical/Nursing Services +SBDS,Solo Brands Inc. Class A Common Stock,$6.71,-0.30,-4.28%,16608277.00,,,75422,Consumer Discretionary,Recreational Games/Products/Toys +SBET,SharpLink Gaming Inc. Common Stock,$9.97,-0.02,-0.20%,1961031114.00,United States,,5043526,Technology,Computer Software: Prepackaged Software +SBEV,Splash Beverage Group Inc. (NV) Common Stock,$0.799,-0.0712,-8.182%,2322209.00,,2021,299163,Consumer Staples,Beverages (Production/Distribution) +SBFG,SB Financial Group Inc. Common Stock,$21.74,-0.36,-1.629%,136929977.00,United States,,5311,Finance,Major Banks +SBFM,Sunshine Biopharma Inc. Common Stock,$1.29,0.01,0.781%,5877169.00,Canada,,45243,Health Care,Biotechnology: Pharmaceutical Preparations +SBFMW,Sunshine Biopharma Inc. Warrant,$0.18,0.0589,48.637%,820070.00,Canada,,2800,Health Care,Biotechnology: Pharmaceutical Preparations +SBGI,Sinclair Inc. Class A Common Stock,$14.22,-0.58,-3.919%,990900607.00,United States,1995,334483,Industrials,Broadcasting +SBH,Sally Beauty Holdings Inc. (Name to be changed from Sally Holdings Inc.) Common Stock,$14.97,-0.24,-1.578%,1459540030.00,United States,,1244303,Consumer Discretionary,Other Specialty Stores +SBI,Western Asset Intermediate Muni Fund Inc Common Stock,$7.805,0.005,0.064%,0.00,United States,1992,11744,Finance,Finance/Investors Services +SBLK,Star Bulk Carriers Corp. Common Shares,$22.65,0.64,2.908%,2652938577.00,Greece,,1304449,Consumer Discretionary,Marine Transportation +SBLX,StableX Technologies Inc. Common Stock,$2.92,0.06,2.098%,4251447.00,United States,,23016,Consumer Discretionary,Telecommunications Equipment +SBR,Sabine Royalty Trust Common Stock,$71.37,1.41,2.015%,1040527853.00,United States,,60541,Energy,Oil & Gas Production +SBRA,Sabra Health Care REIT Inc. Common Stock,$18.45,-0.06,-0.324%,4600501467.00,United States,,2304803,Real Estate,Real Estate Investment Trusts +SBS,Companhia de saneamento Basico Do Estado De Sao Paulo - Sabesp American Depositary Shares (Each repstg 250 Common Shares),$27.26,0.16,0.59%,19184868936.00,Brazil,2002,928188,Utilities,Water Supply +SBSI,Southside Bancshares Inc. Common Stock,$32.28,-0.07,-0.216%,970534547.00,United States,,155106,Finance,Major Banks +SBSW,D/B/A Sibanye-Stillwater Limited ADS,$21.12,1.06,5.284%,14945395154.00,South Africa,,10587241,Basic Materials,Precious Metals +SBUX,Starbucks Corporation Common Stock,$95.16,-0.56,-0.585%,108412179723.00,United States,1992,25961583,Consumer Discretionary,Restaurants +SBXD,SilverBox Corp IV Class A Ordinary Shares,$10.64,0.02,0.188%,0.00,,2024,101840,, +SBXE,SilverBox Corp V Class A Ordinary Shares,$9.92,0.01,0.101%,0.00,,2026,5004,, +SCAG,Scage Future American Depositary Shares,$2.46,-0.10,-3.906%,178619776.00,China,,2562,Consumer Discretionary,Construction/Ag Equipment/Trucks +SCCD,Sachem Capital Corp. 6.00% Notes due 2026,$24.27,0.00,0.00%,1148997330.00,United States,,42,Real Estate,Real Estate Investment Trusts +SCCE,Sachem Capital Corp. 6.00% Notes due 2027,$23.52,-0.09,-0.381%,1113490614.00,United States,2022,1613,Real Estate,Real Estate Investment Trusts +SCCF,Sachem Capital Corp. 7.125% Notes due 2027,$23.4348,-0.0562,-0.239%,1109457051.00,United States,2022,4451,Real Estate,Real Estate Investment Trusts +SCCG,Sachem Capital Corp. 8.00% Notes due 2027,$23.80,0.05,0.211%,1126746454.00,United States,2022,2544,Real Estate,Real Estate Investment Trusts +SCCO,Southern Copper Corporation Common Stock,$198.18,3.34,1.714%,160960176869.00,United States,,2281262,Basic Materials,Metal Mining +SCD,LMP Capital and Income Fund Inc. Common Stock,$15.49,-0.07,-0.45%,0.00,United States,2004,51448,Finance,Trusts Except Educational Religious and Charitable +SCE^G,SCE Trust II Trust Preferred Securities,$18.6501,-0.1099,-0.586%,,United States,,8583,, +SCE^K,Southern California Edison Company 5.45% Fixed-to-Floating Rate Trust Preference Securities,$24.89,-0.11,-0.44%,,United States,,62323,, +SCE^L,SCE TRUST VI,$18.37,-0.22,-1.183%,,United States,,55977,, +SCE^M,SCE Trust VII 7.50% Trust Preference Securities,$25.17,0.12,0.479%,,United States,,20581,, +SCE^N,SCE Trust VIII 6.95% Trust Preference Securities,$24.32,0.22,0.913%,,United States,,15009,, +SCHL,Scholastic Corporation Common Stock,$34.90,0.85,2.496%,887915086.00,United States,1992,335559,Consumer Discretionary,Books +SCHW,Charles Schwab Corporation (The) Common Stock,$103.47,-0.25,-0.241%,183859647592.00,United States,,7531046,Finance,Investment Bankers/Brokers/Service +SCHW^D,The Charles Schwab Corporation Depositary Shares each representing 1/40th interest in a share of 5.95% Non-Cumulative Perpetual Preferred Stock Series D,$25.32,0.00,0.00%,,United States,,28793,, +SCHW^J,The Charles Schwab Corporation Depositary Shares Each Representing a 1/40th Interest in a Share of 4.450% Non-Cumulative Perpetual Preferred Stock Series J,$19.08,-0.02,-0.105%,,United States,,38979,, +SCI,Service Corporation International Common Stock,$79.82,-0.46,-0.573%,11189275756.00,United States,,1162629,Consumer Discretionary,Other Consumer Services +SCII,SC II Acquisition Corp. Class A ordinary share,$9.94,0.01,0.101%,0.00,United States,2026,5811,, +SCIIR,SC II Acquisition Corp. Rights,$0.25,-0.04,-13.793%,0.00,United States,2026,2900,, +SCIIU,SC II Acquisition Corp. Units,$10.22,0.02,0.196%,0.00,United States,2025,100,, +SCKT,Socket Mobile Inc. Common Stock,$1.2676,0.0476,3.902%,10110963.00,United States,,3062,Technology,Computer Manufacturing +SCL,Stepan Company Common Stock,$56.12,-0.02,-0.036%,1269379122.00,United States,,244764,Consumer Discretionary,Package Goods/Cosmetics +SCLX,Scilex Holding Company Common Stock,$8.85,-0.59,-6.25%,75147713.00,United States,2021,60339,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SCLXW,Scilex Holding Company Warrant,$0.1261,-0.0146,-10.377%,1070749.00,United States,2021,18264,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SCM,Stellus Capital Investment Corporation Common Stock,$12.80,-0.14,-1.082%,370524851.00,United States,2012,196655,Finance,Finance/Investors Services +SCNI,Scinai Immunotherapeutics Ltd. American Depositary Shares,$1.03,-0.06,-5.505%,3283309.00,Israel,2015,85161,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SCNX,Scienture Holdings Inc. Common Stock,$0.4971,-0.0029,-0.58%,20197578.00,United States,,412447,Health Care,Other Pharmaceuticals +SCOR,comScore Inc. Common Stock,$8.72,0.05,0.577%,43736590.00,United States,2018,18512,Real Estate,Real Estate +SCPQU,Social Commerce Partners Corporation Unit,$9.99,0.00,0.00%,0.00,United States,2025,9275,, +SCSC,ScanSource Inc. Common Stock,$41.45,0.32,0.778%,909516749.00,United States,,149500,Technology,Retail: Computer Software & Peripheral Equipment +SCVL,Shoe Carnival Inc. Common Stock,$18.50,-0.30,-1.596%,506436908.00,United States,1993,462599,Consumer Discretionary,Clothing/Shoe/Accessory Stores +SCWO,374Water Inc. Common Stock,$3.20,-0.02,-0.621%,54159616.00,United States,,201668,Consumer Discretionary,Metal Fabrications +SCYX,SCYNEXIS Inc. Common Stock,$0.7746,-0.0254,-3.175%,32506134.00,United States,2014,195276,Health Care,Biotechnology: Pharmaceutical Preparations +SCZM,Santacruz Silver Mining Ltd. Common Shares,$15.15,-1.01,-6.25%,1383893748.00,Canada,,923549,, +SD,SandRidge Energy Inc. Common Stock,$15.50,-0.10,-0.641%,569993063.00,United States,2016,370047,Energy,Oil & Gas Production +SDA,SunCar Technology Group Inc. Class A Ordinary Shares,$2.01,0.04,2.03%,197995167.00,Hong Kong,2021,19334,Consumer Discretionary,Automotive Aftermarket +SDGR,Schrodinger Inc. Common Stock,$14.57,-0.31,-2.083%,1073294723.00,United States,2020,1693404,Health Care,Biotechnology: Pharmaceutical Preparations +SDHC,Smith Douglas Homes Corp. Class A Common Stock,$17.99,-0.49,-2.652%,925649095.00,United States,2024,41654,Consumer Discretionary,Homebuilding +SDHI,Siddhi Acquisition Corp Class A Common stock,$10.27,0.02,0.195%,0.00,United States,2025,50061,Finance,Blank Checks +SDHIU,Siddhi Acquisition Corp Unit,$10.50,0.00,0.00%,0.00,United States,2025,41,Finance,Blank Checks +SDHY,PGIM Short Duration High Yield Opportunities Fund Common Shares,$16.56,-0.03,-0.181%,408585807.00,,2020,95123,Finance,Finance/Investors Services +SDOT,Sadot Group Inc. Common Stock,$3.43,-0.04,-1.153%,5313344.00,United States,2020,28877,Consumer Discretionary,Restaurants +SDRL,Seadrill Limited Common Shares,$37.26,-1.49,-3.845%,2324061611.00,Bermuda,2022,879569,Energy,Oil & Gas Production +SDST,Stardust Power Inc. Common Stock,$4.51,0.11,2.50%,44278319.00,United States,2021,138130,Industrials,Major Chemicals +SDSTW,Stardust Power Inc. Warrant,$0.27,0.0599,28.51%,2650808.00,United States,2021,137701,Industrials,Major Chemicals +SE,Sea Limited American Depositary Shares each representing one Class A Ordinary Share,$126.55,-0.56,-0.441%,74920122648.00,United States,2017,5645607,Consumer Discretionary,Other Consumer Services +SEAL^A,Seapeak LLC 9.00% Series A Cumulative Redeemable Perpetual Preferred Units,$25.545,0.0064,0.025%,,Bermuda,,2374,, +SEAL^B,Seapeak LLC 8.50% Series B Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Units,$25.8484,0.1934,0.754%,,Bermuda,,6777,, +SEAT,Vivid Seats Inc. Class A Common Stock,$6.83,0.11,1.637%,73253908.00,United States,,117258,Consumer Discretionary,Services-Misc. Amusement & Recreation +SEATW,Vivid Seats Inc. Warrant,$0.0568,0.00,0.00%,609198.00,United States,,1,Consumer Discretionary,Services-Misc. Amusement & Recreation +SEB,Seaboard Corporation Common Stock,$4937.43,-101.28,-2.01%,4729816006.00,United States,1996,24732,Industrials,Farming/Seeds/Milling +SEDG,SolarEdge Technologies Inc. Common Stock,$35.80,0.99,2.844%,2140841826.00,Israel,2015,1540517,Technology,Semiconductors +SEE,Sealed Air Corporation Common Stock,$41.90,0.05,0.119%,6164462834.00,United States,,2120818,Industrials,Major Chemicals +SEED,Origin Agritech Limited Common Stock,$1.27,0.01,0.794%,9143997.00,China,,10666,Consumer Staples,Farming/Seeds/Milling +SEER,Seer Inc. Class A Common Stock,$1.87,-0.04,-2.094%,112720034.00,United States,2020,140514,Industrials,Biotechnology: Laboratory Analytical Instruments +SEG,Seaport Entertainment Group Inc. Common Stock,$19.32,-0.63,-3.158%,246041572.00,United States,2024,82035,Consumer Discretionary,Services-Misc. Amusement & Recreation +SEGG,Lottery.com Inc. Common Stock,$1.91,0.56,41.481%,22272084.00,United States,2023,18752055,Technology,Computer Software: Prepackaged Software +SEI,Solaris Energy Infrastructure Inc. Class A Common Stock,$53.77,-0.13,-0.241%,3680962786.00,United States,2017,2082160,Consumer Discretionary,Oil and Gas Field Machinery +SEIC,SEI Investments Company Common Stock,$86.10,1.46,1.725%,10542033201.00,United States,1981,855711,Finance,Investment Bankers/Brokers/Service +SELF,Global Self Storage Inc. Common Stock,$5.04,0.03,0.599%,57142109.00,United States,,41133,Real Estate,Real Estate Investment Trusts +SELX,Semilux International Ltd. Ordinary Shares,$0.7524,-0.0227,-2.929%,28161094.00,Taiwan,,2330,Technology,Semiconductors +SEM,Select Medical Holdings Corporation Common Stock,$14.75,-0.20,-1.338%,1826309467.00,United States,2009,553780,Health Care,Hospital/Nursing Management +SEMR,SEMrush Holdings Inc. Class A Common Stock,$11.91,-0.01,-0.084%,1776777593.00,United States,2021,1094137,Technology,Computer Software: Prepackaged Software +SENEA,Seneca Foods Corp. Class A Common Stock,$113.23,-3.26,-2.799%,775030929.00,United States,,35383,Consumer Staples,Packaged Foods +SENEB,Seneca Foods Corp. Class B Common Stock,$114.99,-3.01,-2.551%,787077688.00,United States,,328,Consumer Staples,Packaged Foods +SENS,Senseonics Holdings Inc. Common Stock,$6.82,-0.53,-7.211%,278654697.00,United States,,435217,Health Care,Medical/Dental Instruments +SEPN,Septerna Inc. Common Stock,$23.66,-1.79,-7.033%,1059357383.00,United States,2024,325705,Health Care,Biotechnology: Pharmaceutical Preparations +SER,Serina Therapeutics Inc. Common Stock,$2.72,-0.02,-0.73%,29006254.00,,2018,7504866,Health Care,Biotechnology: Pharmaceutical Preparations +SERA,Sera Prognostics Inc. Class A Common Stock,$2.88,-0.12,-4.00%,111153004.00,United States,2021,33891,Health Care,Medical Specialities +SERV,Serve Robotics Inc. Common Stock,$12.26,-0.51,-3.994%,913167489.00,United States,,4515756,Consumer Discretionary,Industrial Specialties +SES,SES AI Corporation Class A Common Stock,$2.27,0.07,3.182%,828712895.00,United States,2021,6541711,Miscellaneous,Industrial Machinery/Components +SEV,Aptera Motors Corp. Class B Common Stock,$1.41,-0.035,-2.422%,39456829.00,United States,,671437,Industrials,Auto Manufacturing +SEVN,Seven Hills Realty Trust Common Stock,$8.52,-0.07,-0.815%,128359951.00,United States,,91422,Real Estate,Real Estate Investment Trusts +SEZL,Sezzle Inc. Common Stock,$69.32,1.48,2.182%,2367493031.00,United States,,895824,Real Estate,Real Estate +SF,Stifel Financial Corporation Common Stock,$126.24,-0.10,-0.079%,12854808632.00,United States,,1812706,Finance,Investment Bankers/Brokers/Service +SF^B,Stifel Financial Corporation Depositary Shares Each Representing 1/1000th Interest in a Share of 6.25% Non-Cumulative Preferred Stock Series B,$24.25,-0.08,-0.329%,,United States,,2536,, +SF^C,Stifel Financial Corporation Depositary Shares Each Representing 1/1000th Interest in a Share of 6.125% Non Cumulative Preferred Stock Series C,$23.87,0.0175,0.073%,,United States,,5687,, +SF^D,Stifel Financial Corporation Depositary Shares Each Representing 1/1000th Interest in a Share of 4.50% Non-Cumulative Preferred Stock Series D,$17.38,0.01,0.058%,,United States,,7353,, +SFB,Stifel Financial Corporation 5.20% Senior Notes due 2047,$20.78,-0.09,-0.431%,2123163377.00,United States,2017,9046,Finance,Investment Bankers/Brokers/Service +SFBC,Sound Financial Bancorp Inc. Common Stock,$43.99,0.02,0.045%,112881375.00,United States,,2875,Finance,Savings Institutions +SFBS,ServisFirst Bancshares Inc. Common Stock,$80.26,-0.28,-0.348%,4383948397.00,United States,,365987,Finance,Major Banks +SFD,Smithfield Foods Inc. Common Stock,$23.65,-0.13,-0.547%,9297115615.00,United States,2025,680754,Consumer Staples,Meat/Poultry/Fish +SFHG,Samfine Creation Holdings Group Limited Class A Ordinary Share,$0.679,-0.0111,-1.608%,12222000.00,Hong Kong,2024,304773,Consumer Discretionary,Publishing +SFIX,Stitch Fix Inc. Class A Common Stock,$5.16,-0.48,-8.511%,692466809.00,United States,2017,2572819,Consumer Discretionary,Catalog/Specialty Distribution +SFL,SFL Corporation Ltd,$8.77,0.41,4.904%,1215190257.00,Bermuda,,1988921,Consumer Discretionary,Marine Transportation +SFM,Sprouts Farmers Market Inc. Common Stock,$70.16,-0.73,-1.03%,6831439840.00,United States,2013,2262476,Consumer Staples,Food Chains +SFNC,Simmons First National Corporation Class A Common Stock,$19.89,-0.32,-1.583%,2878433084.00,United States,,906100,Finance,Major Banks +SFST,Southern First Bancshares Inc. Common Stock,$53.70,-0.77,-1.414%,439758805.00,United States,,50621,Finance,Major Banks +SFWL,Shengfeng Development Limited Class A Ordinary Shares,$0.98,0.02,2.083%,80847563.00,China,2023,25877,Industrials,Trucking Freight/Courier Services +SG,Sweetgreen Inc. Class A Common Stock,$6.44,-0.03,-0.464%,762325604.00,United States,2021,3291823,Consumer Discretionary,Restaurants +SGA,Saga Communications Inc. Class A Common Stock (FL),$11.43,0.28,2.511%,74942178.00,United States,,3405,Consumer Discretionary,Broadcasting +SGC,Superior Group of Companies Inc. Common Stock,$9.51,-0.19,-1.959%,151863212.00,United States,,34038,Consumer Discretionary,Apparel +SGHC,Super Group (SGHC) Limited Ordinary Shares,$9.90,0.08,0.815%,5005812171.00,,2022,1346557,Consumer Discretionary,Services-Misc. Amusement & Recreation +SGHT,Sight Sciences Inc. Common Stock,$6.03,0.01,0.166%,318816538.00,United States,2021,256586,Health Care,Medical/Dental Instruments +SGI,Somnigroup International Inc. Common Stock,$89.75,-0.97,-1.069%,18839212665.00,United States,,1697704,Consumer Discretionary,Home Furnishings +SGLY,Singularity Future Technology Ltd. Common Stock,$0.5803,0.0033,0.572%,4232413.00,United States,2008,57037,Industrials,Integrated Freight & Logistics +SGML,Sigma Lithium Corporation Common Shares,$13.06,-0.51,-3.758%,1454674766.00,Canada,,3736341,Basic Materials,Metal Mining +SGMO,Sangamo Therapeutics Inc. Common Stock,$0.3639,-0.0152,-4.009%,122450345.00,United States,2000,4293068,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SGMT,Sagimet Biosciences Inc. Series A Common Stock,$5.855,-0.235,-3.859%,190413962.00,United States,2023,387986,Health Care,Biotechnology: Pharmaceutical Preparations +SGN,Signing Day Sports Inc. Common Stock,$0.165,-0.035,-17.50%,698409.00,,2023,8725094,Technology,EDP Services +SGRP,SPAR Group Inc. Common Stock,$0.7999,-0.0193,-2.356%,19157598.00,United States,,109602,Real Estate,Real Estate +SGRY,Surgery Partners Inc. Common Stock,$14.85,-0.45,-2.941%,1920725418.00,United States,2015,1161368,Health Care,Hospital/Nursing Management +SGU,Star Group L.P. Common Stock,$12.68,0.03,0.237%,418142210.00,United States,,13773,Consumer Discretionary,Other Specialty Stores +SHAK,Shake Shack Inc. Class A Common Stock,$87.87,0.55,0.63%,3751027775.00,United States,2015,1146446,Consumer Discretionary,Restaurants +SHBI,Shore Bancshares Inc Common Stock,$18.37,-0.17,-0.917%,614049508.00,United States,,144039,Finance,Major Banks +SHC,Sotera Health Company Common Stock,$18.27,-0.31,-1.668%,5190396083.00,United States,2020,1323889,Health Care,Misc Health and Biotechnology Services +SHEL,Shell PLC American Depositary Shares (each representing two (2) Ordinary Shares) ,$75.79,0.34,0.451%,220224232617.00,Netherlands,2022,4115581,Energy,Oil & Gas Production +SHEN,Shenandoah Telecommunications Co Common Stock,$11.04,-0.06,-0.541%,606075455.00,United States,,224819,Telecommunications,Telecommunications Equipment +SHFS,SHF Holdings Inc. Class A Common Stock,$1.14,-0.11,-8.80%,3512427.00,United States,2021,216381,Finance,Finance: Consumer Services +SHFSW,SHF Holdings Inc. Warrants,$0.033,-0.0039,-10.569%,101676.00,United States,2021,3700,Finance,Finance: Consumer Services +SHG,Shinhan Financial Group Co Ltd American Depositary Shares,$58.91,-1.83,-3.013%,29657964096.00,South Korea,,239872,Finance,Major Banks +SHIM,Shimmick Corporation Common Stock,$3.42,-0.06,-1.724%,122488938.00,United States,2023,51186,Industrials,Military/Government/Technical +SHIP,Seanergy Maritime Holdings Corp. Common Stock,$10.62,0.33,3.207%,221983116.00,Greece,,252085,Consumer Discretionary,Marine Transportation +SHLS,Shoals Technologies Group Inc. Class A Common Stock,$10.15,0.58,6.061%,1698992443.00,United States,2021,4448077,Technology,Semiconductors +SHMD,SCHMID Group N.V. Class A Ordinary Shares,$9.02,0.36,4.157%,388423092.00,Germany,,440206,Technology,Industrial Machinery/Components +SHMDW,SCHMID Group N.V. Warrants,$3.13,0.09,2.961%,134785397.00,Germany,,225700,Technology,Industrial Machinery/Components +SHO,Sunstone Hotel Investors Inc. Sunstone Hotel Investors Inc. Common Shares,$8.75,-0.10,-1.13%,1661652554.00,United States,2004,1697138,Consumer Discretionary,Hotels/Resorts +SHO^H,Sunstone Hotel Investors Inc. 6.125% Series H Cumulative Redeemable Preferred Stock,$20.87,0.10,0.481%,,United States,,1392,, +SHO^I,Sunstone Hotel Investors Inc. 5.70% Series I Cumulative Redeemable Preferred Stock,$19.28,0.00,0.00%,,United States,,1601,, +SHOO,Steven Madden Ltd. Common Stock,$43.39,-0.60,-1.364%,3152627886.00,United States,1993,1789881,Consumer Discretionary,Shoe Manufacturing +SHOP,Shopify Inc. Class A Subordinate Voting Shares,$138.92,1.42,1.033%,180773963744.00,Canada,,9766675,Technology,Computer Software: Prepackaged Software +SHPH,Shuttle Pharmaceuticals Holdings Inc. Common Stock,$2.18,0.15,7.389%,3495161.00,United States,2022,3700136,Health Care,Biotechnology: Pharmaceutical Preparations +SHW,Sherwin-Williams Company (The) Common Stock,$349.60,3.52,1.017%,86663572145.00,United States,,2525550,Consumer Discretionary,RETAIL: Building Materials +SI,Shoulder Innovations Inc. Common Stock,$14.27,0.00,0.00%,293986031.00,,2025,49232,Health Care,Medical/Dental Instruments +SIBN,SI-BONE Inc. Common Stock,$16.74,-0.29,-1.703%,726369592.00,United States,2018,481020,Health Care,Medical/Dental Instruments +SID,Companhia Siderurgica Nacional S.A. Common Stock,$2.12,0.06,2.913%,2811319168.00,Brazil,,6878132,Industrials,Steel/Iron Ore +SIDU,Sidus Space Inc. Class A Common Stock,$3.36,-0.26,-7.182%,223506706.00,United States,2021,24142729,Telecommunications,Telecommunications Equipment +SIEB,Siebert Financial Corp. Common Stock,$2.84,0.06,2.158%,114812498.00,United States,,28284,Finance,Investment Bankers/Brokers/Service +SIF,SIFCO Industries Inc. Common Stock,$6.50,0.19,3.011%,40128972.00,United States,1969,4220,Industrials,Aerospace +SIFY,Sify Technologies Limited American Depositary Shares,$14.39,-0.37,-2.507%,1041122256.00,India,,110509,Technology,Computer Software: Programming Data Processing +SIG,Signet Jewelers Limited Common Shares,$91.71,1.15,1.27%,3731170176.00,Bermuda,,815491,Consumer Discretionary,Consumer Specialties +SIGA,SIGA Technologies Inc. Common Stock,$6.67,-0.15,-2.199%,477647384.00,United States,,234281,Health Care,Biotechnology: Pharmaceutical Preparations +SIGI,Selective Insurance Group Inc. Common Stock,$81.37,0.75,0.93%,4915489769.00,United States,,529241,Finance,Property-Casualty Insurers +SIGIP,Selective Insurance Group Inc. Depositary Shares each representing a 1/1000th interest in a share of 4.60% Non-Cumulative Preferred Stock Series B,$17.18,-0.01,-0.058%,1037828613.00,United States,,3044,Finance,Property-Casualty Insurers +SII,Sprott Inc. Common Shares,$140.58,7.41,5.564%,3626964000.00,,2020,265070,Finance,Finance: Consumer Services +SILA,Sila Realty Trust Inc. Common Stock,$24.07,-0.41,-1.675%,1326734934.00,United States,2024,241809,Real Estate,Real Estate Investment Trusts +SILC,Silicom Ltd Ordinary Shares,$15.06,-0.80,-5.044%,85790269.00,Israel,,60646,Telecommunications,Computer Communications Equipment +SILO,Silo Pharma Inc. Common Stock,$0.365,-0.005,-1.351%,5982241.00,United States,,68911,Consumer Discretionary,Apparel +SIM,Grupo Simec S.A.B. de C.V. American Depositary Shares,$29.00,-0.27,-0.922%,4456380410.00,Mexico,1998,339,Industrials,Steel/Iron Ore +SIMAW,SIM Acquisition Corp. I Warrant,$0.2601,0.0001,0.038%,0.00,United States,2024,6021,Finance,Blank Checks +SIMO,Silicon Motion Technology Corporation American Depositary Shares,$117.10,0.86,0.74%,3979487757.00,Taiwan,2005,680413,Technology,Semiconductors +SINT,SiNtx Technologies Inc. Common Stock,$3.32,-0.11,-3.207%,13345155.00,United States,2014,49777,Health Care,Medical/Dental Instruments +SION,Sionna Therapeutics Inc. Common Stock,$42.13,-1.27,-2.926%,1880210838.00,United States,2025,180690,Health Care,Biotechnology: Pharmaceutical Preparations +SIRI,SiriusXM Holdings Inc. Common Stock,$20.14,-0.05,-0.248%,6778351349.00,United States,,4622008,Consumer Discretionary,Broadcasting +SITC,SITE Centers Corp. Common Stock,$6.01,-0.06,-0.988%,315298663.00,United States,,794609,Real Estate,Real Estate Investment Trusts +SITE,SiteOne Landscape Supply Inc. Common Stock,$144.37,-0.01,-0.007%,6429736237.00,United States,2016,304279,Consumer Discretionary,Professional and commerical equipment +SITM,SiTime Corporation Common Stock,$361.12,3.04,0.849%,9425459506.00,United States,2019,188598,Technology,Semiconductors +SJ,Scienjoy Holding Corporation Class A Ordinary Shares ,$1.37,-0.10,-6.803%,57544655.00,China,2019,270450,Technology,EDP Services +SJM,The J.M. Smucker Company Common Stock,$103.36,-1.89,-1.796%,11027925639.00,United States,,1076293,Consumer Staples,Packaged Foods +SJT,San Juan Basin Royalty Trust Common Stock,$6.09,-0.03,-0.49%,283847568.00,United States,,244259,Energy,Oil & Gas Production +SKBL,Skyline Builders Group Holding Limited Class A Ordinary Shares,$3.16,-0.16,-4.819%,439889728.00,Hong Kong,2025,136731,Consumer Discretionary,Engineering & Construction +SKE,Skeena Resources Limited Common Shares,$34.91,1.51,4.521%,4227368325.00,,2021,1390243,Basic Materials,Precious Metals +SKIL,Skillsoft Corp. Class A Common Stock,$9.00,0.04,0.446%,78826635.00,United States,2019,190562,Technology,Computer Software: Prepackaged Software +SKIN,The Beauty Health Company Class A Common Stock,$1.51,-0.01,-0.658%,192529619.00,United States,2020,507836,Health Care,Medical/Dental Instruments +SKK,SKK Holdings Limited Ordinary Shares,$0.3173,-0.0127,-3.848%,5949375.00,Singapore,2024,6514,Industrials,Water Sewer Pipeline Comm & Power Line Construction +SKLZ,Skillz Inc. Class A Common Stock,$3.85,-0.03,-0.773%,58166301.00,United States,2020,98224,Technology,EDP Services +SKM,SK Telecom Co. Ltd. Common Stock,$27.21,-0.21,-0.766%,10437211800.00,South Korea,,2447875,Telecommunications,Telecommunications Equipment +SKT,Tanger Inc. Common Stock,$32.31,-0.17,-0.523%,3699818229.00,United States,1993,1159093,Real Estate,Real Estate Investment Trusts +SKWD,Skyward Specialty Insurance Group Inc. Common Stock,$44.98,0.01,0.022%,1821121678.00,United States,2023,353012,Finance,Property-Casualty Insurers +SKY,Champion Homes Inc. Common Stock,$84.12,-2.05,-2.379%,4698798934.00,United States,,572804,Consumer Discretionary,Homebuilding +SKYE,Skye Bioscience Inc. Common Stock,$1.01,-0.06,-5.607%,32378036.00,United States,,100073,Health Care,Biotechnology: Pharmaceutical Preparations +SKYH,Sky Harbour Group Corporation Class A Common Stock,$9.09,-0.22,-2.363%,691167504.00,United States,2022,115169,Finance,Real Estate +SKYQ,Sky Quarry Inc. Common Stock,$0.3491,-0.0504,-12.616%,8893797.00,United States,2024,764380,Industrials,Environmental Services +SKYT,SkyWater Technology Inc. Common Stock,$33.64,0.10,0.298%,1631809120.00,United States,2021,3564463,Technology,Semiconductors +SKYW,SkyWest Inc. Common Stock,$97.48,-0.72,-0.733%,3909328172.00,United States,1986,269987,Consumer Discretionary,Air Freight/Delivery Services +SKYX,SKYX Platforms Corp. Common Stock,$2.58,-0.06,-2.273%,339308979.00,United States,2022,1004910,Consumer Discretionary,Building Products +SLAB,Silicon Laboratories Inc. Common Stock,$144.24,3.73,2.655%,4738708354.00,United States,2000,274427,Technology,Semiconductors +SLAI,SOLAI Limited American Depositary Shares (each representing one hundred (100) Class A Ordinary Shares),$0.9779,0.0104,1.075%,18265739.00,,2013,78357,Technology,EDP Services +SLB,SLB Limited Common Shares,$48.87,-1.79,-3.533%,73076849672.00,France,,24530992,Energy,Oilfield Services/Equipment +SLDB,Solid Biosciences Inc. Common Stock,$6.55,-0.02,-0.304%,510312065.00,United States,2018,622650,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SLDE,Slide Insurance Holdings Inc. Common Stock,$15.98,0.19,1.203%,1986150988.00,United States,2025,741226,Finance,Property-Casualty Insurers +SLDP,Solid Power Inc. Class A Common Stock,$4.755,-0.435,-8.382%,908317075.00,United States,2021,12281284,Miscellaneous,Industrial Machinery/Components +SLDPW,Solid Power Inc. Warrant,$0.59,-0.11,-15.714%,112703906.00,United States,2021,213163,Miscellaneous,Industrial Machinery/Components +SLE,Super League Enterprise Inc. Common Stock,$6.74,0.55,8.885%,6454703.00,United States,2019,164234,Consumer Discretionary,Services-Misc. Amusement & Recreation +SLF,Sun Life Financial Inc. Common Stock,$63.05,0.22,0.35%,35145273372.00,Canada,,450664,Finance,Life Insurance +SLG,SL Green Realty Corp Common Stock,$43.56,-1.35,-3.006%,3093887594.00,United States,1997,1469768,Real Estate,Real Estate Investment Trusts +SLG^I,SL Green Realty Corporation Preferred Series I,$22.29,-0.03,-0.134%,,United States,,7189,, +SLGB,Smart Logistics Global Limited Ordinary Shares,$2.87,0.86,42.786%,117670000.00,Hong Kong,2025,42093399,Industrials,Integrated Freight & Logistics +SLGL,Sol-Gel Technologies Ltd. Ordinary Shares,$63.50,4.50,7.627%,176895887.00,Israel,2018,30815,Health Care,Biotechnology: Pharmaceutical Preparations +SLGN,Silgan Holdings Inc. Common Stock,$42.38,-0.27,-0.633%,4478210476.00,United States,2022,754324,Industrials,Containers/Packaging +SLI,Standard Lithium Ltd. Common Shares,$5.57,0.03,0.542%,1327203046.00,Canada,2021,4624581,Industrials,Major Chemicals +SLM,SLM Corporation Common Stock,$26.37,-0.77,-2.837%,5354129174.00,United States,,4298597,Finance,Finance: Consumer Services +SLMBP,SLM Corporation Floating Rate Non-Cumulative Preferred Stock Series B,$75.00,0.8065,1.087%,15227898675.00,United States,,3554,Finance,Finance: Consumer Services +SLMT,Brera Holdings PLC Class B Ordinary Shares,$1.535,-0.175,-10.234%,125861964.00,Ireland,2023,1393289,Consumer Discretionary,Services-Misc. Amusement & Recreation +SLN,Silence Therapeutics Plc American Depository Share,$5.01,-0.10,-1.957%,234468000.00,United Kingdom,,181115,Health Care,Biotechnology: Pharmaceutical Preparations +SLND,Southland Holdings Inc. Common Stock,$1.85,-0.10,-5.128%,100109117.00,United States,,266817,Industrials,Military/Government/Technical +SLNG,Stabilis Solutions Inc. Common Stock,$5.78,0.07,1.226%,107486620.00,United States,,20648,Utilities,Oil/Gas Transmission +SLNH,Soluna Holdings Inc. Common Stock,$1.27,-0.08,-5.926%,125189574.00,United States,,4869603,Technology,EDP Services +SLNHP,Soluna Holdings Inc 9.0% Series A Cumulative Perpetual Preferred Stock ,$10.34,0.25,2.478%,1019259999.00,United States,,99997,Technology,EDP Services +SLNO,Soleno Therapeutics Inc. Common Stock,$41.60,-1.56,-3.614%,2234337040.00,United States,2014,1203802,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +SLP,Simulations Plus Inc. Common Stock,$18.63,-0.94,-4.803%,375330879.00,United States,,223732,Technology,EDP Services +SLQT,SelectQuote Inc. Common Stock,$1.49,-0.03,-1.974%,262197899.00,United States,2020,778760,Finance,Specialty Insurers +SLRC,SLR Investment Corp. Common Stock,$14.89,-0.17,-1.129%,812318500.00,United States,2010,203048,Finance,Finance/Investors Services +SLS,SELLAS Life Sciences Group Inc. Common Stock,$3.965,-0.435,-9.886%,564783478.00,United States,,6458456,Health Care,Biotechnology: Pharmaceutical Preparations +SLSN,Solesence Inc. Common Stock,$1.45,-0.11,-7.051%,102278425.00,United States,,37069,Consumer Discretionary,Package Goods/Cosmetics +SLSR,Solaris Resources Inc. Common Shares,$10.79,0.45,4.352%,1800817939.00,,2024,191342,, +SLVM,Sylvamo Corporation Common Stock,$49.46,-0.96,-1.904%,1950616191.00,United States,2021,152725,Basic Materials,Paper +SLXN,Silexion Therapeutics Corp Ordinary Shares,$2.04,-0.05,-2.392%,6378350.00,Israel,,14372,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SLXNW,Silexion Therapeutics Corp Warrant,$0.039,-0.0002,-0.51%,121939.00,Israel,,17596,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SM,SM Energy Company Common Stock,$19.18,-0.10,-0.519%,2197149403.00,United States,,5810241,Energy,Oil & Gas Production +SMA,SmartStop Self Storage REIT Inc. Common Stock,$31.14,-0.53,-1.674%,1724026957.00,United States,2025,473634,Real Estate,Real Estate Investment Trusts +SMBC,Southern Missouri Bancorp Inc. Common Stock,$60.66,-0.49,-0.801%,679524785.00,United States,,35895,Finance,Banks +SMBK,SmartFinancial Inc. Common Stock,$39.10,-0.35,-0.887%,665794839.00,United States,,74658,Finance,Major Banks +SMC,Summit Midstream Corporation Common Stock,$27.76,-0.16,-0.573%,521511047.00,United States,2012,37326,Utilities,Natural Gas Distribution +SMCI,Super Micro Computer Inc. Common Stock,$31.21,0.01,0.032%,18631469061.00,United States,2020,24239906,Technology,Computer Manufacturing +SMFG,Sumitomo Mitsui Financial Group Inc Unsponsored American Depositary Shares (Japan),$20.95,-0.40,-1.874%,135631887235.00,Japan,,1594971,Finance,Commercial Banks +SMG,Scotts Miracle-Gro Company (The) Common Stock,$62.80,-0.43,-0.68%,3642109173.00,United States,1992,2621743,Industrials,Agricultural Chemicals +SMHI,SEACOR Marine Holdings Inc. Common Stock ,$6.44,-0.33,-4.874%,173727108.00,United States,2017,77957,Consumer Discretionary,Marine Transportation +SMID,Smith-Midland Corporation Common Stock,$35.82,-0.47,-1.295%,190010987.00,United States,,3025,Industrials,Building Materials +SMJF,SMJ International Holdings Inc. Class A Ordinary Shares,$5.30,0.00,0.00%,132500000.00,,2025,1858426,Consumer Discretionary,RETAIL: Building Materials +SMMT,Summit Therapeutics Inc. Common Stock ,$15.64,-0.26,-1.635%,11643081294.00,United States,2015,2539060,Health Care,Biotechnology: Pharmaceutical Preparations +SMP,Standard Motor Products Inc. Common Stock,$39.52,-0.35,-0.878%,869407989.00,United States,,99312,Consumer Discretionary,Auto Parts:O.E.M. +SMPL,The Simply Good Foods Company Common Stock,$19.23,-0.37,-1.888%,1780222154.00,United States,,1979776,Consumer Staples,Packaged Foods +SMR,NuScale Power Corporation Class A Common Stock,$20.48,1.28,6.667%,6199799419.00,United States,2022,29799857,Industrials,Metal Fabrications +SMRT,SmartRent Inc. Class A Common Stock,$1.68,-0.04,-2.326%,317857213.00,United States,,1112810,Technology,EDP Services +SMSI,Smith Micro Software Inc. Common Stock,$0.5715,-0.0288,-4.798%,14405422.00,United States,1995,89374,Technology,Computer Software: Prepackaged Software +SMTC,Semtech Corporation Common Stock,$81.57,2.08,2.617%,7548492449.00,United States,,700038,Technology,Semiconductors +SMTI,Sanara MedTech Inc. Common Stock,$21.38,0.58,2.788%,191044347.00,United States,,100053,Health Care,Industrial Specialties +SMTK,SmartKem Inc. Common Stock,$0.67,-0.0882,-11.633%,4110425.00,United Kingdom,,255560,Technology,Semiconductors +SMWB,Similarweb Ltd. Ordinary Shares,$5.67,0.04,0.71%,469642857.00,,2021,319282,Technology,Computer Software: Programming Data Processing +SMX,SMX (Security Matters) Public Limited Company Ordinary Shares,$14.81,-1.63,-9.915%,128852065.00,Ireland,,526475,Technology,Industrial Machinery/Components +SMXT,Solarmax Technology Inc. Common Stock,$0.981,0.1007,11.439%,53271194.00,United States,2024,669756,Consumer Discretionary,Engineering & Construction +SMXWW,SMX (Security Matters) Public Limited Company Warrant,$0.06,0.0059,10.906%,522021.00,Ireland,,35685,Technology,Industrial Machinery/Components +SN,SharkNinja Inc. Ordinary Shares,$119.84,-2.80,-2.283%,16819236730.00,United States,2023,1433424,Consumer Discretionary,Consumer Electronics/Appliances +SNA,Snap-On Incorporated Common Stock,$370.07,2.25,0.612%,19246436619.00,United States,,383826,Consumer Discretionary,Industrial Machinery/Components +SNAL,Snail Inc. Class A Common Stock,$0.7421,0.0041,0.556%,28012277.00,United States,2022,35870,Technology,Computer Software: Prepackaged Software +SNAP,Snap Inc. Class A Common Stock,$7.67,0.21,2.815%,13187480546.00,United States,2017,50306771,Technology,Computer Software: Programming Data Processing +SNBR,Sleep Number Corporation Common Stock,$11.08,0.77,7.468%,252513200.00,United States,,914782,Consumer Discretionary,Home Furnishings +SNCR,Synchronoss Technologies Inc. Common Stock,$8.73,-0.09,-1.02%,100459899.00,United States,2018,74381,Technology,EDP Services +SNCY,Sun Country Airlines Holdings Inc. Common Stock,$17.19,0.20,1.177%,906164558.00,United States,2021,1273326,Consumer Discretionary,Air Freight/Delivery Services +SND,Smart Sand Inc. Common Stock,$4.70,0.05,1.075%,204655822.00,United States,2016,349094,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +SNDA,Sonida Senior Living Inc. Common Stock,$30.78,-0.53,-1.693%,577728411.00,United States,,54505,Health Care,Hospital/Nursing Management +SNDK,Sandisk Corporation Common Stock,$527.63,46.20,9.596%,77325853836.00,United States,,16486255,Technology,Electronic Components +SNDL,SNDL Inc. Common Shares,$1.58,-0.02,-1.25%,406850000.00,Canada,2019,1481850,Health Care, Medicinal Chemicals and Botanical Products +SNDR,Schneider National Inc. Common Stock,$30.21,0.66,2.234%,5295800705.00,United States,2017,886699,Industrials,Trucking Freight/Courier Services +SNDX,Syndax Pharmaceuticals Inc. Common Stock,$20.55,-0.76,-3.566%,1786099921.00,United States,2016,864004,Health Care,Biotechnology: Pharmaceutical Preparations +SNES,SenesTech Inc. Common Stock,$1.90,-0.02,-1.042%,9923729.00,United States,2016,42444,Industrials,Agricultural Chemicals +SNEX,StoneX Group Inc. Common Stock,$107.80,-0.86,-0.791%,5645022891.00,United States,,216870,Finance,Investment Bankers/Brokers/Service +SNFCA,Security National Financial Corporation Class A Common Stock,$8.53,-0.37,-4.157%,221656904.00,United States,,68558,Finance,Finance: Consumer Services +SNGX,Soligenix Inc. Common Stock,$1.37,0.03,2.239%,13817998.00,United States,,133869,Health Care,Biotechnology: Pharmaceutical Preparations +SNN,Smith & Nephew SNATS Inc. Common Stock,$33.86,-0.22,-0.646%,14385827659.00,United Kingdom,,587671,Health Care,Industrial Specialties +SNOA,Sonoma Pharmaceuticals Inc. Common Stock,$3.39,0.00,0.00%,5766648.00,United States,2007,4705,Health Care,Biotechnology: Pharmaceutical Preparations +SNOW,Snowflake Inc. Common Stock,$216.00,3.25,1.528%,73915200000.00,United States,2020,4807229,Technology,Computer Software: Prepackaged Software +SNPS,Synopsys Inc. Common Stock,$511.35,8.65,1.721%,97830564638.00,United States,1992,1380123,Technology,Computer Software: Prepackaged Software +SNSE,Sensei Biotherapeutics Inc. Common Stock,$10.08,0.14,1.408%,12713803.00,United States,2021,49230,Health Care,Biotechnology: Pharmaceutical Preparations +SNT,Senstar Technologies Corporation Common Shares,$4.33,-0.07,-1.591%,101004407.00,Canada,,20984,Telecommunications,Telecommunications Equipment +SNTG,Sentage Holdings Inc. Class A Ordinary Shares,$2.26,-0.04,-1.739%,6340035.00,China,2021,6040,Finance,Finance: Consumer Services +SNTI,Senti Biosciences Inc. Common Stock,$1.03,-0.03,-2.83%,27079563.00,United States,2021,136288,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SNWV,SANUWAVE Health Inc. Common Stock,$26.43,-0.27,-1.011%,226668015.00,United States,,50442,Health Care,Medical/Dental Instruments +SNX,TD SYNNEX Corporation Common Stock,$159.03,0.60,0.379%,12838357043.00,United States,2003,644169,Technology,Retail: Computer Software & Peripheral Equipment +SNY,Sanofi ADS,$45.77,-1.72,-3.622%,112388809322.00,France,,3520853,Health Care,Biotechnology: Pharmaceutical Preparations +SNYR,Synergy CHC Corp. Common Stock,$1.82,-0.22,-10.784%,17387741.00,United States,2024,61724,Health Care,Other Pharmaceuticals +SO,Southern Company (The) Common Stock,$88.33,-0.51,-0.574%,97260590782.00,United States,,4251318,Utilities,Electric Utilities: Central +SOAR,Volato Group Inc. Class A Common Stock,$0.5799,0.0226,4.055%,4331816.00,,2022,1974878,Consumer Discretionary,Transportation Services +SOBO,South Bow Corporation Common Shares,$28.07,-0.13,-0.461%,5845591872.00,Canada,2024,692065,Energy,Natural Gas Distribution +SOBR,SOBR Safe Inc. Common Stock,$1.27,-0.04,-3.053%,2395544.00,United States,,129335,Consumer Discretionary,Newspapers/Magazines +SOC,Sable Offshore Corp. Common Stock,$10.15,0.28,2.837%,1471362229.00,United States,2021,4749846,Energy,Oil & Gas Production +SOCA,Solarius Capital Acquisition Corp. Class A Ordinary Share,$10.12,0.00,0.00%,0.00,United States,2025,35,, +SOCAW,Solarius Capital Acquisition Corp. Warrant,$0.28,0.01,3.704%,0.00,United States,2025,26900,, +SOFI,SoFi Technologies Inc. Common Stock ,$24.60,-0.86,-3.378%,30974231681.00,United States,,48776069,Finance,Finance: Consumer Services +SOGP,Sound Group Inc. American Depositary Shares,$14.09,0.09,0.643%,69542238.00,China,2020,29539,Technology,Computer Software: Programming Data Processing +SOHO,Sotherly Hotels Inc. Common Stock,$2.23,0.00,0.00%,45693817.00,United States,,185684,Real Estate,Real Estate Investment Trusts +SOHOB,Sotherly Hotels Inc. 8.0% Series B Cumulative Redeemable Perpetual Preferred Stock,$18.17,0.00,0.00%,372312403.00,United States,,13650,Real Estate,Real Estate Investment Trusts +SOHON,Sotherly Hotels Inc. 8.25% Series D Cumulative Redeemable Perpetual Preferred Stock,$16.22,0.00,0.00%,332355926.00,United States,,69,Real Estate,Real Estate Investment Trusts +SOHOO,Sotherly Hotels Inc. 7.875% Series C Cumulative Redeemable Perpetual Preferred Stock,$18.63,-0.05,-0.268%,381738034.00,United States,,1332,Real Estate,Real Estate Investment Trusts +SOHU,Sohu.com Limited American Depositary Shares,$17.03,0.20,1.188%,512013762.00,China,,24762,Technology,EDP Services +SOJC,Southern Company (The) Series 2017B 5.25% Junior Subordinated Notes due December 1 2077,$22.22,-0.04,-0.18%,24443053384.00,United States,2017,15217,Utilities,Electric Utilities: Central +SOJD,Southern Company (The) Series 2020A 4.95% Junior Subordinated Notes due January 30 2080,$20.85,-0.07,-0.335%,22935988436.00,United States,2020,47533,Utilities,Electric Utilities: Central +SOJE,Southern Company (The) Series 2020C 4.20% Junior Subordinated Notes due October 15 2060,$18.30,-0.03,-0.164%,20030552987.00,United States,2020,17453,Basic Materials,Metal Mining +SOJF,Southern Company (The) Series 2025A 6.50% Junior Subordinated Notes due March 15 2085,$25.71,-0.06,-0.233%,0.00,United States,2025,64706,Basic Materials,Metal Mining +SOLS,Solstice Advanced Materials Inc. Common Stock ,$65.57,3.21,5.148%,10407759290.00,United States,,3509936,Industrials,Aerospace +SOLV,Solventum Corporation Common Stock,$76.60,-1.01,-1.301%,13286082866.00,United States,2024,1209027,Health Care,Medical/Dental Instruments +SOMN,Southern Company (The) 2025 Series A Corporate Units,$50.22,0.17,0.34%,55297485215.00,United States,,10200,Basic Materials,Metal Mining +SON,Sonoco Products Company Common Stock,$47.46,-0.67,-1.392%,4681122797.00,United States,,1181318,Consumer Discretionary,Containers/Packaging +SONM,Sonim Technologies Inc. Common Stock,$6.49,0.425,7.007%,6676218.00,United States,2019,29497,Utilities,Telecommunications Equipment +SONO,Sonos Inc. Common Stock,$14.57,-0.17,-1.153%,1761114612.00,United States,2018,1095132,Consumer Staples,Consumer Electronics/Appliances +SONY,Sony Group Corporation American Depositary Shares ,$22.28,-0.32,-1.416%,134237051133.00,Japan,,7569337,Consumer Staples,Consumer Electronics/Appliances +SOPA,Society Pass Incorporated Common Stock,$2.02,-0.20,-9.009%,12333161.00,United States,2021,611319,Real Estate,Real Estate +SOPH,SOPHiA GENETICS SA Ordinary Shares,$5.25,0.00,0.00%,350863123.00,Switzerland,2021,104925,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SOR,Source Capital Inc. Cmn Shs of BI,$48.35,0.11,0.228%,403455753.00,United States,,2937,Finance,Investment Managers +SORA,AsiaStrategy Ordinary Shares,$2.7811,0.2811,11.244%,69149270.00,Hong Kong,2025,9153,Industrials,Other Specialty Stores +SORNU,Soren Acquisition Corp. Unit,$9.98,0.02,0.201%,0.00,United States,2026,5942,Finance,Blank Checks +SOS,SOS Limited Class A Ordinary Shares,$1.68,0.03,1.818%,11413708.00,China,,41625,Finance,Finance: Consumer Services +SOTK,Sono-Tek Corporation Common Stock,$4.30,-0.03,-0.693%,67554673.00,United States,,22735,Technology,Industrial Machinery/Components +SOUL,Soulpower Acquisition Corporation Class A Ordinary Shares,$10.22,0.00,0.00%,0.00,,2025,1989,Consumer Discretionary,Publishing +SOUN,SoundHound AI Inc Class A Common Stock,$9.69,-0.25,-2.515%,4070728893.00,United States,,21146149,Technology,Computer Software: Prepackaged Software +SOUNW,SoundHound AI Inc. Warrant,$3.41,-0.13,-3.672%,1432526886.00,United States,2021,37185,Technology,Computer Software: Prepackaged Software +SOWG,Sow Good Inc. Common Stock,$0.66,-0.0367,-5.268%,8067575.00,United States,,77892,Consumer Staples,Packaged Foods +SPAI,Safe Pro Group Inc. Common Stock,$5.92,-0.03,-0.504%,124161758.00,United States,2024,165306,Health Care,Industrial Specialties +SPB,Spectrum Brands Holdings Inc. Common Stock,$62.71,-2.55,-3.907%,1465863746.00,United States,,339192,Miscellaneous,Industrial Machinery/Components +SPCB,SuperCom Ltd. Ordinary Shares (Israel),$9.89,0.20,2.064%,43993687.00,Israel,,120053,Technology,Semiconductors +SPCE,Virgin Galactic Holdings Inc. Common Stock,$3.03,-0.12,-3.81%,221581924.00,United States,2017,3882381,Consumer Discretionary,Transportation Services +SPE,Special Opportunities Fund Inc Common Stock,$14.88,-0.06,-0.402%,0.00,United States,,26883,Finance,Finance/Investors Services +SPE^C,Special Opportunities Fund Inc. 2.75% Convertible Preferred Stock Series C,$25.28,-0.01,-0.04%,,United States,,2232,, +SPEG,Silver Pegasus Acquisition Corp Class A Ordinary Shares,$10.13,0.01,0.099%,0.00,United States,2025,119,, +SPEGR,Silver Pegasus Acquisition Corp Rights.,$0.25,-0.03,-10.714%,0.00,United States,2025,609,, +SPEGU,Silver Pegasus Acquisition Corp Unit,$10.35,0.00,0.00%,0.00,United States,2025,4,, +SPFI,South Plains Financial Inc. Common Stock,$40.63,0.22,0.544%,660149699.00,United States,2019,96947,Finance,Major Banks +SPG,Simon Property Group Inc. Common Stock,$183.76,-0.80,-0.433%,59992138226.00,United States,,1326378,Real Estate,Real Estate Investment Trusts +SPG^J,Simon Property Group Inc. Simon Property Group 8 3/8% Series J Cumulative Redeemable Preferred Stock,$53.78,0.0704,0.131%,,United States,,4765,, +SPGI,S&P Global Inc. Common Stock,$528.12,1.45,0.275%,159914736000.00,United States,,1264336,Finance,Finance: Consumer Services +SPH,Suburban Propane Partners L.P. Common Stock,$20.12,-0.10,-0.495%,1331085077.00,United States,1996,122831,Consumer Discretionary,Other Specialty Stores +SPHL,Springview Holdings Ltd Class A Ordinary Shares,$4.77,-0.67,-12.316%,58489645.00,Singapore,2024,155913,Consumer Discretionary,Homebuilding +SPHR,Sphere Entertainment Co. Class A Common Stock,$94.31,-2.06,-2.138%,3330487955.00,United States,2020,349603,Consumer Discretionary,Services-Misc. Amusement & Recreation +SPIR,Spire Global Inc. Class A Common Stock,$12.65,-0.54,-4.094%,437785950.00,United States,2020,673884,Consumer Discretionary,Telecommunications Equipment +SPKL,Spark I Acquisition Corp. Class A Ordinary Share,$11.35,-0.02,-0.176%,0.00,United States,2023,508,, +SPKLW,Spark I Acquisition Corp. Warrant,$0.4714,0.00,0.00%,0.00,United States,2023,1072,, +SPMA,Sound Point Meridian Capital Inc. 8.00% Series A Preferred Shares Due 2029,$25.23,-0.05,-0.198%,0.00,,,394,, +SPMC,Sound Point Meridian Capital Inc. Common Stock,$14.235,0.135,0.957%,0.00,,2024,8986,, +SPME,Sound Point Meridian Capital Inc. 7.875% Series B Preferred Shares due 2030,$25.25,0.06,0.238%,0.00,,,3609,, +SPNT,SiriusPoint Ltd. Common Shares,$20.14,0.37,1.872%,2352646850.00,Bermuda,2013,506517,Finance,Property-Casualty Insurers +SPNT^B,SiriusPoint Ltd. 8.00% Resettable Fixed Rate Preference Shares Series B $25.00 liquidation preference per share,$25.405,0.015,0.059%,,Bermuda,,12004,, +SPOK,Spok Holdings Inc. Common Stock,$13.28,-0.18,-1.337%,273543684.00,United States,,135844,Telecommunications,Telecommunications Equipment +SPOT,Spotify Technology S.A. Ordinary Shares,$508.70,-3.00,-0.586%,103695650858.00,Luxembourg,2018,1788238,Consumer Discretionary,Broadcasting +SPPL,SIMPPLE LTD. Ordinary Shares,$3.11,0.11,3.667%,13839065.00,Singapore,2023,3713,Consumer Discretionary,Diversified Commercial Services +SPRB,Spruce Biosciences Inc. Common Stock,$81.90,-2.34,-2.778%,87663303.00,United States,2020,21267,Health Care,Biotechnology: Pharmaceutical Preparations +SPRC,SciSparc Ltd. Ordinary Shares,$0.8355,-0.0446,-5.068%,2994709.00,Israel,,177679,Health Care,Biotechnology: Pharmaceutical Preparations +SPRO,Spero Therapeutics Inc. Common Stock,$2.23,-0.14,-5.907%,125636628.00,United States,2017,369419,Health Care,Biotechnology: Pharmaceutical Preparations +SPRU,Spruce Power Holding Corporation Class A Common Stock,$6.46,0.62,10.616%,117370855.00,United States,2019,134774,Consumer Discretionary,Auto Parts:O.E.M. +SPRY,ARS Pharmaceuticals Inc. Common Stock,$10.06,-0.48,-4.554%,994417027.00,United States,2020,1367808,Health Care,Biotechnology: Pharmaceutical Preparations +SPSC,SPS Commerce Inc. Common Stock,$90.18,-1.80,-1.957%,3400606097.00,United States,2010,631671,Technology,Computer Software: Prepackaged Software +SPT,Sprout Social Inc Class A Common Stock,$9.31,-0.15,-1.586%,551052839.00,United States,2019,930999,Technology,Computer Software: Prepackaged Software +SPWH,Sportsman's Warehouse Holdings Inc. Common Stock,$1.44,-0.04,-2.703%,55412777.00,United States,2014,199730,Consumer Discretionary,Other Specialty Stores +SPWR,SunPower Inc. Common Stock,$1.85,-0.05,-2.632%,206993712.00,United States,,1150722,Technology,Semiconductors +SPWRW,SunPower Inc. Warrants,$0.2803,-0.0008,-0.285%,31362345.00,United States,,11394,Technology,Semiconductors +SPXC,SPX Technologies Inc. Common Stock,$211.34,-4.34,-2.012%,10532249998.00,United States,,394068,Industrials,Industrial Machinery/Components +SPXX,Nuveen S&P 500 Dynamic Overwrite Fund,$17.97,-0.03,-0.167%,0.00,United States,,59975,Finance,Trusts Except Educational Religious and Charitable +SQFT,Presidio Property Trust Inc. Class A Common Stock,$2.81,-0.15,-5.068%,4043868.00,United States,2020,28590,Real Estate,Real Estate Investment Trusts +SQFTP,Presidio Property Trust Inc. 9.375% Series D Cumulative Redeemable Perpetual Preferred Stock $0.01 par value per share,$5.25,-7.95,-60.227%,7555270.00,United States,,159012,Real Estate,Real Estate Investment Trusts +SQFTW,Presidio Property Trust Inc. Series A Common Stock Purchase Warrants,$0.025,-0.0025,-9.091%,35977.00,United States,,243350,Real Estate,Real Estate Investment Trusts +SQM,Sociedad Quimica y Minera S.A. Common Stock,$83.57,-0.80,-0.948%,23870751615.00,Chile,1993,1561940,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +SQNS,Sequans Communications S.A. American Depositary Shares (each representing one hundred (100) Ordinary Shares),$5.12,-0.11,-2.103%,73382103.00,France,,95805,Technology,Semiconductors +SR,Spire Inc. Common Stock,$83.98,-0.79,-0.932%,4956237079.00,United States,,339369,Utilities,Oil/Gas Transmission +SR^A,Spire Inc. Depositary Shares each representing a 1/1000th interest in a share of 5.90% Series A Cumulative Redeemable Perpetual Preferred Stock,$24.96,0.0099,0.04%,,United States,,16264,, +SRAD,Sportradar Group AG Class A Ordinary Shares,$18.58,0.06,0.324%,5563965425.00,Switzerland,2021,6962196,Technology,Computer Software: Programming Data Processing +SRBK,SR Bancorp Inc. Common stock,$16.74,-0.15,-0.888%,142828526.00,United States,2023,28778,Finance,Banks +SRCE,1st Source Corporation Common Stock,$65.13,-1.59,-2.383%,1591432272.00,United States,,97192,Finance,Major Banks +SRE,DBA Sempra Common Stock,$86.78,-0.33,-0.379%,56639702392.00,United States,,5611937,Utilities,Natural Gas Distribution +SREA,DBA Sempra 5.750% Junior Subordinated Notes due 2079,$22.71,-0.04,-0.176%,14378742821.00,United States,2019,26487,Utilities,Natural Gas Distribution +SRFM,Surf Air Mobility Inc. Common Stock,$2.18,-0.05,-2.242%,137827121.00,United States,2023,2654585,Consumer Discretionary,Transportation Services +SRG,Seritage Growth Properties Class A Common Stock,$3.27,-0.10,-2.967%,184181465.00,United States,2015,214176,Finance,Real Estate +SRG^A,Seritage Growth Properties 7.00% Series A Cumulative Redeemable Preferred Shares of Beneficial Interest,$24.07,-0.125,-0.517%,,United States,,246,, +SRI,Stoneridge Inc. Common Stock,$6.74,-0.08,-1.173%,188834115.00,United States,1997,157344,Consumer Discretionary,Auto Parts:O.E.M. +SRJN,Spire Inc. 6.375% Junior Subordinated Notes due 2086,$24.90,-0.04,-0.16%,0.00,United States,,84360,Utilities,Oil/Gas Transmission +SRL,Scully Royalty Ltd.,$9.11,0.02,0.22%,138712058.00,Canada,,54861,Finance,Commercial Banks +SRPT,Sarepta Therapeutics Inc. Common Stock (DE),$21.31,-0.86,-3.879%,2233014955.00,United States,,2310298,Health Care,Biotechnology: Pharmaceutical Preparations +SRRK,Scholar Rock Holding Corporation Common Stock,$43.13,-0.86,-1.955%,4399581620.00,United States,2018,550927,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SRTA,Strata Critical Medical Inc. Class A Common Stock,$4.96,-0.08,-1.587%,428377969.00,United States,2019,634188,Consumer Discretionary,Transportation Services +SRTAW,Strata Critical Medical Inc. Warrants,$0.128,0.007,5.785%,11054915.00,United States,2019,4100,Consumer Discretionary,Transportation Services +SRTS,Sensus Healthcare Inc. Common Stock,$5.11,0.07,1.389%,83931934.00,United States,2016,102738,Health Care,Medical/Dental Instruments +SRV,NXG Cushing Midstream Energy Fund Common Shares of Beneficial Interest,$40.26,0.45,1.13%,0.00,United States,,41341,Finance,Finance Companies +SRXH,SRX Health Solutions Inc. Common Stock,$0.1502,-0.0002,-0.133%,10447252.00,,2021,22232364,Consumer Staples,Beverages (Production/Distribution) +SRZN,Surrozen Inc. Common Stock,$21.685,-1.345,-5.84%,185871264.00,United States,,63245,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +SSB,SouthState Bank Corporation Common Stock,$100.97,-0.06,-0.059%,10149036000.00,United States,,1155604,Finance,Major Banks +SSBI,Summit State Bank Common Stock,$13.78,0.04,0.291%,91955731.00,United States,2006,1453,Finance,Major Banks +SSD,Simpson Manufacturing Company Inc. Common Stock,$177.46,-1.95,-1.087%,7357362942.00,United States,,205279,Consumer Discretionary,Industrial Machinery/Components +SSEA,Starry Sea Acquisition Corp Ordinary Shares,$10.11,0.00,0.00%,0.00,United States,2025,232,, +SSII,SS Innovations International Inc. Common Stock,$4.43,-0.19,-4.113%,857741690.00,India,,139640,Health Care,Medical/Dental Instruments +SSKN,Strata Skin Sciences Inc. Common Stock,$1.27,0.04,3.252%,7478013.00,United States,2005,147542,Health Care,Medical/Dental Instruments +SSL,Sasol Ltd. American Depositary Shares,$7.41,0.10,1.368%,4811869521.00,South Africa,,1646491,Energy,Oil & Gas Production +SSM,Sono Group N.V. Ordinary Shares,$7.00,0.29,4.322%,,Germany,,3854,, +SSNC,SS&C Technologies Holdings Inc. Common Stock,$84.72,-0.77,-0.901%,20674001582.00,United States,2010,1347936,Technology,Computer Software: Prepackaged Software +SSP,E.W. Scripps Company (The) Class A Common Stock,$3.36,-0.07,-2.041%,298375157.00,United States,,396200,Industrials,Broadcasting +SSRM,SSR Mining Inc. Common Stock,$28.16,0.24,0.86%,5716512074.00,Canada,,3315582,Industrials,Precious Metals +SSSS,SuRo Capital Corp. Common Stock,$9.55,-0.26,-2.65%,239887319.00,United States,2011,132978,Finance,Finance: Consumer Services +SSSSL,SuRo Capital Corp. 6.00% Notes due 2026,$24.96,-0.0387,-0.155%,596247151.00,United States,,2046,Finance,Finance: Consumer Services +SST,System1 Inc. Class A Common Stock,$4.10,-0.08,-1.914%,40991505.00,United States,2020,3829,Technology,Computer Software: Programming Data Processing +SSTI,SoundThinking Inc. Common Stock,$7.06,-0.12,-1.671%,89651078.00,United States,2017,206793,Technology,Computer Software: Prepackaged Software +SSTK,Shutterstock Inc. Common Stock,$19.43,-0.56,-2.801%,690160459.00,United States,2012,188324,Technology,EDP Services +SSYS,Stratasys Ltd. Ordinary Shares (Israel),$11.05,-0.15,-1.339%,940151912.00,United States,1994,904231,Technology,Computer peripheral equipment +ST,Sensata Technologies Holding plc Ordinary Shares,$34.37,-0.87,-2.469%,5006978122.00,Netherlands,2010,1710261,Industrials,Industrial Machinery/Components +STAA,STAAR Surgical Company Common Stock,$19.15,0.11,0.578%,952558400.00,United States,,942413,Health Care,Ophthalmic Goods +STAG,Stag Industrial Inc. Common Stock,$36.63,-0.50,-1.347%,6840655064.00,United States,2011,1724933,Real Estate,Real Estate Investment Trusts +STAI,ScanTech AI Systems Inc. Common stock,$1.81,0.11,6.471%,6842987.00,United States,,215622,Industrials,Electrical Products +STAK,STAK Inc. Class A Ordinary Shares,$0.407,0.057,16.286%,5376612.00,China,2025,103583,Consumer Discretionary,Oil and Gas Field Machinery +STBA,S&T Bancorp Inc. Common Stock,$41.69,-0.42,-0.997%,1593496025.00,United States,,205295,Finance,Major Banks +STC,Stewart Information Services Corporation Common Stock,$67.47,0.06,0.089%,2018677166.00,United States,,199934,Finance,Specialty Insurers +STE,STERIS plc (Ireland) Ordinary Shares,$260.86,-2.21,-0.84%,25602628768.00,United States,,441348,Health Care,Industrial Specialties +STEL,Stellar Bancorp Inc. Common Stock,$36.42,3.79,11.615%,1864248531.00,United States,,3007203,Finance,Major Banks +STEM,Stem Inc. Class A Common Stock,$16.94,-0.37,-2.137%,142130124.00,United States,2020,137628,Miscellaneous,Industrial Machinery/Components +STEP,StepStone Group Inc. Class A Common Stock,$73.19,-0.07,-0.096%,8655300312.00,United States,2020,474113,Finance,Investment Managers +STEW,SRH Total Return Fund Inc. Common Stock,$17.55,-0.13,-0.735%,0.00,United States,,159131,Finance,Investment Managers +STEX,Streamex Corp. Common Stock,$3.78,0.13,3.562%,647399326.00,United States,,3199214,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +STFS,Star Fashion Culture Holdings Limited Class A Ordinary Shares,$0.1135,-0.0152,-11.81%,3853325.00,China,2024,1404498,Consumer Discretionary,Advertising +STG,Sunlands Technology Group American Depositary Shares representing Class A ordinary shares,$5.05,-0.26,-4.896%,68257052.00,,2018,1513,Real Estate,Other Consumer Services +STGW,Stagwell Inc. Class A Common Stock,$6.29,0.11,1.78%,1585823761.00,Canada,,1473864,Consumer Discretionary,Advertising +STHO,Star Holdings Shares of Beneficial Interest,$7.72,-0.22,-2.771%,98318083.00,United States,,75680,Real Estate,Real Estate +STI,Solidion Technology Inc. Common Stock,$8.97,0.22,2.514%,66963589.00,United States,2022,78911,Miscellaneous,Industrial Machinery/Components +STIM,Neuronetics Inc. Common Stock,$2.12,-0.12,-5.357%,145190155.00,United States,2018,915083,Health Care,Medical/Dental Instruments +STK,Columbia Seligman Premium Technology Growth Fund Inc,$40.77,0.83,2.078%,0.00,United States,2009,51657,Finance,Investment Managers +STKE,Sol Strategies Inc. Common Shares,$1.71,-0.05,-2.841%,37770198.00,Canada,,153989,, +STKH,Steakholder Foods Ltd. American Depositary Shares,$2.75,0.28,11.336%,3729657.00,Israel,2021,43742,Consumer Staples,Packaged Foods +STKL,SunOpta Inc. Common Stock,$4.59,-0.18,-3.774%,542615649.00,Canada,,580714,Industrials,Farming/Seeds/Milling +STKS,The ONE Group Hospitality Inc. Common Stock,$2.20,-0.04,-1.786%,68430518.00,United States,,23208,Consumer Discretionary,Restaurants +STLA,Stellantis N.V. Common Shares,$9.70,-0.05,-0.513%,27940775106.00,United Kingdom,2014,9145395,Industrials,Auto Manufacturing +STLD,Steel Dynamics Inc.,$174.38,-1.27,-0.723%,25465558712.00,United States,1996,1286984,Industrials,Steel/Iron Ore +STM,STMicroelectronics N.V. Common Stock,$30.33,0.97,3.304%,27247922602.00,Switzerland,,12391881,Technology,Semiconductors +STN,Stantec Inc Common Stock,$100.53,-0.39,-0.386%,11467155007.00,Canada,,423527,Consumer Discretionary,Military/Government/Technical +STNE,StoneCo Ltd. Class A Common Shares,$16.99,0.40,2.411%,4613500126.00,Brazil,2018,5657328,Technology,EDP Services +STNG,Scorpio Tankers Inc. Common Shares,$62.50,2.50,4.167%,3119783875.00,Monaco,2010,1011387,Consumer Discretionary,Marine Transportation +STOK,Stoke Therapeutics Inc. Common Stock,$29.40,-0.11,-0.373%,1679244210.00,United States,2019,526377,Health Care,Biotechnology: Pharmaceutical Preparations +STRA,Strategic Education Inc. Common Stock,$84.31,0.37,0.441%,1980156764.00,United States,1996,187065,Real Estate,Other Consumer Services +STRC,Strategy Inc Variable Rate Series A Perpetual Stretch Preferred Stock,$98.99,-0.17,-0.171%,28445146228.00,United States,,1092384,Technology,Computer Software: Prepackaged Software +STRD,Strategy Inc 10.00% Series A Perpetual Stride Preferred Stock,$76.68,-0.13,-0.169%,22034284400.00,United States,,94155,Technology,Computer Software: Prepackaged Software +STRF,Strategy Inc 10.00% Series A Perpetual Strife Preferred Stock,$97.90,-2.16,-2.159%,28131930657.00,United States,,716032,Technology,Computer Software: Prepackaged Software +STRK,Strategy Inc 8.00% Series A Perpetual Strike Preferred Stock,$84.15,-0.65,-0.767%,24180816800.00,United States,,75620,Technology,Computer Software: Prepackaged Software +STRL,Sterling Infrastructure Inc. Common Stock,$373.52,1.27,0.341%,11474300203.00,United States,,300597,Industrials,Military/Government/Technical +STRO,Sutro Biopharma Inc. Common Stock,$15.61,-1.01,-6.077%,132896188.00,United States,2018,95883,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +STRR,Star Equity Holdings Inc. Common Stock,$10.4398,0.1798,1.752%,35870140.00,United States,,10533,Consumer Discretionary,Professional Services +STRRP,Star Equity Holdings Inc. 10% Series A Cumulative Perpetual Preferred Stock,$9.69,0.01,0.103%,33293900.00,United States,,3324,, +STRS,Stratus Properties Inc. Common Stock,$28.70,2.64,10.13%,229449210.00,United States,,29651,Real Estate,Homebuilding +STRT,STRATTEC SECURITY CORPORATION Common Stock,$78.02,-0.81,-1.028%,326534843.00,United States,,31319,Consumer Discretionary,Auto Parts:O.E.M. +STRW,Strawberry Fields REIT Inc. Common Stock,$12.81,-0.39,-2.955%,168068417.00,,2023,11397,Real Estate,Real Estate Investment Trusts +STRZ,Starz Entertainment Corp. Common Shares,$10.22,-0.30,-2.852%,170991290.00,United States,,134171,Consumer Discretionary,Movies/Entertainment +STSS,Sharps Technology Inc. Common Stock,$2.32,0.02,0.87%,67269333.00,United States,2022,832095,Health Care,Medical/Dental Instruments +STSSW,Sharps Technology Inc. Warrant,$0.0295,-0.0003,-1.007%,855364.00,United States,2022,10014,Finance,Finance: Consumer Services +STT,State Street Corporation Common Stock,$128.02,0.40,0.313%,35757578057.00,United States,,1575218,Finance,Major Banks +STT^G,State Street Corporation Depositary shares each representing a 1/4000th ownership interest in a share of Fixed-to-Floating Rate Non-Cumulative,$23.46,-0.07,-0.297%,,United States,,43031,, +STTK,Shattuck Labs Inc. Common Stock,$4.17,0.15,3.731%,263876945.00,United States,2020,613515,Health Care,Biotechnology: Pharmaceutical Preparations +STUB,StubHub Holdings Inc. Class A Common Stock,$14.94,1.13,8.182%,5162367227.00,,2025,5819266,Consumer Discretionary,Services-Misc. Amusement & Recreation +STVN,Stevanato Group S.p.A. Ordinary Shares,$16.02,-0.95,-5.598%,4851537427.00,,2021,742300,Health Care,Medical/Dental Instruments +STWD,STARWOOD PROPERTY TRUST INC. Starwood Property Trust Inc.,$18.20,-0.06,-0.329%,6740030188.00,United States,2009,2787306,Real Estate,Real Estate Investment Trusts +STX,Seagate Technology Holdings PLC Ordinary Shares (Ireland),$442.93,71.17,19.144%,94591294991.00,Ireland,2002,14749753,Technology,Electronic Components +STXS,Stereotaxis Inc. Common Stock,$2.49,-0.04,-1.581%,232378660.00,United States,,297662,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +STZ,Constellation Brands Inc. Common Stock,$157.74,-3.51,-2.177%,27349690748.00,United States,,1859114,Consumer Staples,Beverages (Production/Distribution) +SU,Suncor Energy Inc. Common Stock,$53.00,0.97,1.864%,63667134411.00,Canada,,4191041,Energy,Integrated oil Companies +SUGP,SU Group Holdings Limited Ordinary Shares,$5.80,0.01,0.173%,8495678.00,Hong Kong,2024,22103,Consumer Discretionary,Diversified Commercial Services +SUI,Sun Communities Inc. Common Stock,$123.97,-3.07,-2.417%,15331170184.00,United States,1993,804389,Real Estate,Real Estate Investment Trusts +SUIG,Sui Group Holdings Limited Common Stock,$1.68,0.01,0.599%,139555698.00,United States,,627433,Finance,Finance Companies +SUN,Sunoco LP Common Units representing limited partner interests,$58.44,-0.18,-0.307%,11953377326.00,United States,2012,384195,Energy,Integrated oil Companies +SUNC,SunocoCorp LLC Common Units representing limited liability company interests,$54.34,-0.33,-0.604%,2799444539.00,,2025,311032,Energy,Integrated oil Companies +SUNE,SUNation Energy Inc. Common Stock,$1.03,-0.04,-3.738%,3508812.00,United States,,72450,Utilities,Telecommunications Equipment +SUNS,Sunrise Realty Trust Inc. Common Stock,$9.12,-0.12,-1.299%,122399392.00,United States,,62286,Real Estate,Real Estate Investment Trusts +SUPN,Supernus Pharmaceuticals Inc. Common Stock,$48.94,-0.50,-1.011%,2806187789.00,United States,2012,788888,Health Care,Biotechnology: Pharmaceutical Preparations +SUPV,Grupo Supervielle S.A. American Depositary Shares each Representing five Class B shares,$12.27,0.07,0.574%,1120796573.00,,2016,1410679,Finance,Commercial Banks +SUPX,SuperX AI Technology Limited Ordinary Shares,$17.52,0.93,5.606%,583525115.00,Hong Kong,2024,1332270,, +SURG,SurgePays Inc. Common Stock,$1.24,-0.04,-3.125%,26576966.00,United States,,215047,Consumer Discretionary,Advertising +SUUN,PowerBank Corporation Common Stock,$1.77,-0.06,-3.279%,64853660.00,Canada,,2608074,Utilities,Power Generation +SUZ,Suzano S.A. American Depositary Shares (each representing One Ordinary Share),$9.89,0.06,0.61%,12502123212.00,Brazil,2018,2123613,Basic Materials,Paper +SVAC,Spring Valley Acquisition Corp. III Class A Ordinary Shares,$11.00,0.00,0.00%,0.00,United States,2025,396223,Finance,Blank Checks +SVACU,Spring Valley Acquisition Corp. III Unit,$11.54,-0.1599,-1.367%,0.00,United States,2025,4391,Finance,Blank Checks +SVACW,Spring Valley Acquisition Corp. III Warrant,$1.76,-0.19,-9.744%,0.00,United States,2025,83129,Finance,Blank Checks +SVAQU,Silicon Valley Acquisition Corp. Units,$10.01,-0.02,-0.199%,0.00,United States,2025,785,Finance,Blank Checks +SVC,Service Properties Trust Common Stock,$1.98,-0.02,-1.00%,332810682.00,United States,,2865288,Real Estate,Real Estate Investment Trusts +SVCC,Stellar V Capital Corp. Class A Ordinary Shares,$10.39,-0.01,-0.096%,0.00,United States,2025,245,, +SVCCW,Stellar V Capital Corp. Warrant,$0.3278,-0.0023,-0.697%,0.00,United States,2025,317,Finance,Blank Checks +SVCO,Silvaco Group Inc. Common Stock,$4.54,-0.09,-1.944%,139100502.00,United States,2024,212145,Technology,Computer Software: Prepackaged Software +SVM,Silvercorp Metals Inc. Common Shares,$12.76,0.08,0.631%,2811171984.00,Canada,,8874821,Basic Materials,Precious Metals +SVRA,Savara Inc. Common Stock,$5.61,-0.24,-4.103%,1141454610.00,United States,,1640802,Health Care,Biotechnology: Pharmaceutical Preparations +SVRE,SaverOne 2014 Ltd. American Depositary Shares,$1.24,-0.05,-3.876%,1121730.00,Israel,2022,285147,Technology,EDP Services +SVREW,SaverOne 2014 Ltd. Warrant,$0.0163,-0.0008,-4.678%,159249441.00,Israel,2022,1154,Technology,EDP Services +SVRN,OceanPal Inc. Common Stock,$1.04,-0.05,-4.587%,113891221.00,Greece,,189460,Consumer Discretionary,Marine Transportation +SVV,Savers Value Village Inc. Common Stock,$10.40,-0.03,-0.288%,1624765490.00,United States,2023,492053,Consumer Discretionary,Other Specialty Stores +SW,Smurfit WestRock plc Ordinary Shares,$42.41,-0.55,-1.28%,22146065856.00,Ireland,2024,3961011,Consumer Discretionary,Containers/Packaging +SWAG,Stran & Company Inc. Common Stock,$2.14,0.14,7.00%,39136658.00,United States,2021,353315,Consumer Discretionary,Advertising +SWAGW,Stran & Company Inc. Warrant,$0.0876,0.0154,21.33%,1602043.00,United States,2021,473,Consumer Discretionary,Advertising +SWBI,Smith & Wesson Brands Inc. Common Stock,$11.06,-0.31,-2.726%,492100820.00,United States,,581638,Industrials,Ordnance And Accessories +SWIM,Latham Group Inc. Common Stock,$6.32,-0.44,-6.509%,737264498.00,United States,2021,731917,Industrials,Plastic Products +SWK,Stanley Black & Decker Inc. Common Stock,$79.32,-1.74,-2.147%,12285475344.00,United States,,1527243,Consumer Discretionary,Industrial Machinery/Components +SWKH,SWK Holdings Corporation Common Stock,$17.35,-0.02,-0.115%,209863969.00,United States,,11308,Finance,Diversified Financial Services +SWKHL,SWK Holdings Corporation 9.00% Senior Notes due 2027,$25.53,0.004,0.016%,310122892.00,United States,,715,, +SWKS,Skyworks Solutions Inc. Common Stock,$55.28,-4.77,-7.943%,8288143501.00,United States,,9865369,Technology,Semiconductors +SWVL,Swvl Holdings Corp Class A Common Shares,$1.86,-0.05,-2.618%,18411240.00,United Arab Emirates,,37406,Real Estate,Real Estate +SWX,Southwest Gas Holdings Inc. Common Stock (DE),$81.94,-1.92,-2.29%,5914749012.00,United States,,462013,Utilities,Oil & Gas Production +SWZ,Total Return Securities Fund Common Stock,$5.93,-0.05,-0.836%,0.00,United States,,157451,Finance,Finance Companies +SXC,SunCoke Energy Inc. Common Stock,$7.82,-0.26,-3.218%,662084280.00,United States,2011,1266696,Industrials,Steel/Iron Ore +SXI,Standex International Corporation Common Stock,$242.06,-3.02,-1.232%,2933040778.00,United States,,85554,Industrials,Industrial Machinery/Components +SXT,Sensient Technologies Corporation Common Stock,$95.06,0.49,0.518%,4038334167.00,United States,,212290,Industrials,Major Chemicals +SXTC,China SXT Pharmaceuticals Inc. Ordinary Shares,$0.069,-0.0329,-32.287%,8005879.00,China,2019,49843945,Health Care,Biotechnology: Pharmaceutical Preparations +SXTP,60 Degrees Pharmaceuticals Inc. Common Stock,$5.20,0.38,7.884%,5499582.00,United States,2023,2064451,Health Care,Biotechnology: Pharmaceutical Preparations +SXTPW,60 Degrees Pharmaceuticals Inc. Warrant,$0.07,-0.0021,-2.913%,74033.00,United States,2023,3955,Health Care,Biotechnology: Pharmaceutical Preparations +SY,So-Young International Inc. American Depository Shares,$2.93,-0.11,-3.618%,295042055.00,China,2019,578143,Technology,EDP Services +SYBT,Stock Yards Bancorp Inc. Common Stock,$67.65,-0.45,-0.661%,1993879434.00,United States,,197172,Finance,Major Banks +SYF,Synchrony Financial Common Stock,$73.42,0.42,0.575%,26443762015.00,United States,2014,7180246,Finance,Finance: Consumer Services +SYF^A,Synchrony Financial Depositary Shares each Representing a 1/40th Interest in a Share of 5.625% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series A,$19.7514,-0.0186,-0.094%,,United States,,24231,, +SYF^B,Synchrony Financial Depositary Shares Each Representing a 1/40th Interest in a Share of 8.250% Fixed Rate Reset Non-Cumulative Perpetual Preferred Stock Series B,$25.89,0.01,0.039%,,United States,,63201,, +SYK,Stryker Corporation Common Stock,$357.83,3.26,0.919%,136842653964.00,United States,,2026193,Health Care,Medical/Dental Instruments +SYM,Symbotic Inc. Class A Common Stock,$55.10,-3.89,-6.594%,33047473456.00,United States,2021,4701150,Industrials,Industrial Machinery/Components +SYNA,Synaptics Incorporated Common Stock $0.001 Par Value,$86.23,1.31,1.543%,3362113995.00,United States,2002,555903,Technology,Semiconductors +SYNX,Silynxcom Ltd. Ordinary Shares,$1.06,-0.01,-0.935%,5604201.00,,2024,52988,Consumer Staples,Consumer Electronics/Appliances +SYPR,Sypris Solutions Inc. Common Stock,$3.08,-0.28,-8.333%,70932308.00,United States,,107372,Industrials,Industrial Machinery/Components +SYRE,Spyre Therapeutics Inc. Common Stock,$33.14,-0.22,-0.659%,2571403188.00,United States,2016,318653,Health Care,Biotechnology: Pharmaceutical Preparations +SYY,Sysco Corporation Common Stock,$83.51,-0.41,-0.489%,39989686787.00,United States,,5695963,Consumer Discretionary,Food Distributors +SZZL,Sizzle Acquisition Corp. II Class A ordinary shares,$10.29,0.01,0.097%,0.00,United States,2025,1261,Finance,Blank Checks +SZZLR,Sizzle Acquisition Corp. II Right,$0.2302,-0.021,-8.36%,0.00,United States,2025,12000,Finance,Blank Checks +SZZLU,Sizzle Acquisition Corp. II Unit,$10.65,0.15,1.429%,0.00,United States,2025,200,Finance,Blank Checks +T,AT&T Inc.,$24.07,1.07,4.652%,170643049345.00,United States,,84121869,Telecommunications,Telecommunications Equipment +T^A,AT&T Inc. Depositary Shares each representing a 1/1000th interest in a share of 5.000% Perpetual Preferred Stock Series A,$20.73,-0.08,-0.384%,,United States,,62983,, +T^C,AT&T Inc. Depositary Shares each representing a 1/1000th interest in a share of 4.750% Perpetual Preferred Stock Series C,$19.45,-0.02,-0.103%,,United States,,73084,, +TAC,TransAlta Corporation Ordinary Shares,$13.94,0.13,0.941%,4147150000.00,Canada,,2714555,Utilities,Electric Utilities: Central +TACH,Titan Acquisition Corp. Class A Ordinary Shares,$10.28,-0.02,-0.194%,0.00,United States,2025,10708,, +TACHW,Titan Acquisition Corp. Warrants,$0.39,0.0489,14.336%,0.00,United States,2025,3500,, +TACO,Berto Acquisition Corp. Ordinary Shares,$10.21,0.01,0.098%,372075189.00,United States,2025,107306,Finance,Blank Checks +TACOU,Berto Acquisition Corp. Unit,$10.37,0.02,0.193%,0.00,United States,2025,2215,Finance,Blank Checks +TACOW,Berto Acquisition Corp. Warrant,$0.3783,-0.0242,-6.012%,0.00,United States,2025,17240,Finance,Blank Checks +TACT,TransAct Technologies Incorporated Common Stock,$3.63,-0.04,-1.09%,36708684.00,United States,1996,40623,Technology,Computer peripheral equipment +TAK,Takeda Pharmaceutical Company Limited American Depositary Shares (each representing 1/2 of a share of Common Stock),$16.69,-0.22,-1.301%,52528425183.00,Japan,2018,5644049,Health Care,Biotechnology: Pharmaceutical Preparations +TAL,TAL Education Group American Depositary Shares,$10.76,0.11,1.033%,6563833374.00,China,,3197290,Real Estate,Other Consumer Services +TALK,Talkspace Inc. Common Stock,$3.99,-0.06,-1.481%,660967935.00,United States,2020,1773717,Health Care,Medical/Nursing Services +TALKW,Talkspace Inc. Warrant,$0.0259,0.0009,3.60%,4290494.00,United States,2020,51852,Health Care,Medical/Nursing Services +TALO,Talos Energy Inc. Common Stock,$11.79,0.06,0.512%,2004167622.00,United States,2018,2132595,Energy,Oil & Gas Production +TANH,Tantech Holdings Ltd. Common Shares,$0.95,-0.05,-5.00%,1290422.00,China,2015,138382,Industrials,Major Chemicals +TAOP,Taoping Inc. Ordinary Shares ,$1.56,0.16,11.429%,14412352.00,Hong Kong,,859732,Technology,Computer Software: Prepackaged Software +TAOX,Tao Synergies Inc. Common Stock,$5.10,0.25,5.155%,37986549.00,United States,,160251,Health Care,Biotechnology: Pharmaceutical Preparations +TAP,Molson Coors Beverage Company Class B Common Stock,$47.74,-0.72,-1.486%,8968479796.00,Canada,,2643144,Consumer Staples,Beverages (Production/Distribution) +TARA,Protara Therapeutics Inc. Common Stock,$7.17,-0.10,-1.376%,370192399.00,United States,2014,1655221,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TARS,Tarsus Pharmaceuticals Inc. Common Stock,$64.18,-3.97,-5.825%,2724383559.00,United States,2020,506102,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TASK,TaskUs Inc. Class A Common Stock,$10.72,-0.20,-1.832%,969276897.00,United States,2021,219044,Technology,EDP Services +TATT,TAT Technologies Ltd. Ordinary Shares,$51.89,-1.76,-3.281%,652016427.00,Israel,,129014,Industrials,Aerospace +TAVI,Tavia Acquisition Corp. Ordinary Shares,$10.47,0.00,0.00%,0.00,United States,2024,44,Finance,Blank Checks +TAYD,Taylor Devices Inc. Common Stock,$71.43,-1.07,-1.476%,225227147.00,United States,,27517,Industrials,Industrial Machinery/Components +TBB,AT&T Inc. 5.350% Global Notes due 2066,$22.52,-0.06,-0.266%,161026681010.00,United States,2017,63626,Telecommunications,Telecommunications Equipment +TBBB,BBB Foods Inc. Class A Common Shares,$33.50,-0.98,-2.842%,3844687968.00,Mexico,2024,856709,Consumer Staples,Food Chains +TBBK,The Bancorp Inc Common Stock,$67.14,-1.20,-1.756%,2948629477.00,United States,2004,377685,Finance,Major Banks +TBCH,Turtle Beach Corporation Common Stock,$12.09,-0.93,-7.143%,233470159.00,United States,,613581,Telecommunications,Telecommunications Equipment +TBH,Brag House Holdings Inc. Common Stock,$0.4407,-0.0066,-1.476%,9233266.00,United States,2025,63473,Consumer Discretionary,Services-Misc. Amusement & Recreation +TBHC,The Brand House Collective Inc. Common Stock,$1.22,-0.05,-3.937%,27402887.00,United States,2002,21929,Consumer Discretionary,Other Specialty Stores +TBI,TrueBlue Inc. Common Stock,$4.78,-0.23,-4.591%,143110657.00,United States,,111298,Consumer Discretionary,Professional Services +TBLA,Taboola.com Ltd. Ordinary Shares,$4.10,-0.02,-0.485%,1181715801.00,Israel,,741683,Technology,Computer Software: Programming Data Processing +TBLAW,Taboola.com Ltd. Warrant,$0.0398,0.0038,10.556%,11471290.00,Israel,,900,Technology,Computer Software: Programming Data Processing +TBLD,Thornburg Income Builder Opportunities Trust Common Stock,$21.05,-0.02,-0.095%,675323637.00,United States,2021,75720,Finance,Investment Managers +TBMC,Trailblazer Merger Corporation I Class A Common Stock,$12.40,-0.2158,-1.711%,0.00,United States,2023,4911,Finance,Blank Checks +TBMCR,Trailblazer Merger Corporation I Rights,$0.55,0.04,7.843%,0.00,United States,2023,3105,Finance,Blank Checks +TBN,Tamboran Resources Corporation Common stock,$28.57,-0.07,-0.244%,585509837.00,,2024,35187,Energy,Oil & Gas Production +TBPH,Theravance Biopharma Inc. Ordinary Shares,$19.03,-0.79,-3.986%,964296362.00,Cayman Islands,,402174,Health Care,Biotechnology: Pharmaceutical Preparations +TBRG,TruBridge Inc. Common Stock,$20.10,-0.35,-1.711%,301680619.00,United States,2002,63465,Technology,EDP Services +TC,Token Cat Limited American Depositary Shares,$10.5799,0.23,2.222%,21030503.00,China,2018,3812,Real Estate,Real Estate +TCBI,Texas Capital Bancshares Inc. Common Stock,$98.87,1.24,1.27%,4512781249.00,United States,2003,428738,Finance,Major Banks +TCBIO,Texas Capital Bancshares Inc. Depositary Shares 5.75% Fixed Rate Non-Cumulative Perpetual Preferred Stock Series B,$20.92,0.07,0.336%,954863798.00,United States,,11256,Finance,Major Banks +TCBK,TriCo Bancshares Common Stock,$48.83,-0.23,-0.469%,1587543772.00,United States,,163731,Finance,Major Banks +TCBS,Texas Community Bancshares Inc. Common Stock,$17.87,0.67,3.895%,52086457.00,United States,2021,3556,Finance,Banks +TCBX,Third Coast Bancshares Inc. Common Stock,$39.46,-0.39,-0.979%,548260318.00,United States,,60089,Finance,Banks +TCGL,TechCreate Group Ltd. Class A Ordinary Shares,$8.73,-0.20,-2.24%,175036500.00,,2025,2520836,Technology,EDP Services +TCI,Transcontinental Realty Investors Inc. Common Stock,$51.18,0.00,0.00%,442160193.00,United States,,1591,Real Estate,Real Estate Investment Trusts +TCMD,Tactile Systems Technology Inc. Common Stock,$28.63,-0.48,-1.649%,639467713.00,United States,2016,208131,Health Care,Medical/Dental Instruments +TCOM,Trip.com Group Limited American Depositary Shares,$62.40,-0.04,-0.064%,40764092741.00,China,2003,4357084,Real Estate,Real Estate +TCPA,TransCanada PipeLines Limited 6.250% Junior Subordinated Notes due 2085,$24.75,-0.06,-0.242%,0.00,Canada,2025,89966,, +TCPC,BlackRock TCP Capital Corp. Common Stock,$5.15,-0.09,-1.718%,436931341.00,United States,2012,859462,Finance,Finance/Investors Services +TCRT,Alaunos Therapeutics Inc. Common Stock,$2.775,-0.175,-5.932%,6193325.00,United States,,12918,Health Care,Biotechnology: Pharmaceutical Preparations +TCRX,TScan Therapeutics Inc. Common Stock,$1.06,-0.06,-5.357%,60152873.00,United States,2021,390885,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TCX,Tucows Inc. Class A Common Stock,$22.29,-1.72,-7.164%,247506355.00,Canada,,19027,Technology,EDP Services +TD,Toronto Dominion Bank (The) Common Stock,$93.62,-2.45,-2.55%,159828438480.00,Canada,,2514467,Finance,Commercial Banks +TDACW,Translational Development Acquisition Corp. Warrants,$0.33,0.00,0.00%,0.00,United States,2025,7,, +TDAY,USA TODAY Co. Inc. Common Stock,$5.83,-0.14,-2.345%,857644013.00,United States,2014,908689,Consumer Discretionary,Newspapers/Magazines +TDC,Teradata Corporation Common Stock,$29.69,0.11,0.372%,2767108000.00,United States,,954922,Technology,Computer Software: Prepackaged Software +TDF,Templeton Dragon Fund Inc. Common Stock,$12.05,0.10,0.837%,0.00,United States,,154637,Finance,Finance/Investors Services +TDG,Transdigm Group Incorporated Common Stock,$1412.13,-15.05,-1.055%,79718037236.00,United States,2006,270519,Industrials,Military/Government/Technical +TDIC,Dreamland Limited Class A Ordinary Shares,$0.1876,-0.0431,-18.682%,5815600.00,Hong Kong,2025,6210778,Consumer Discretionary,Other Consumer Services +TDOC,Teladoc Health Inc. Common Stock,$5.74,-0.17,-2.876%,1018697345.00,United States,2015,7622483,Health Care,Medical/Nursing Services +TDOG,21Shares Dogecoin ETF Common Shares of Beneficial Interest,$25.215,-0.1715,-0.676%,0.00,United States,,1927,, +TDS,Telephone and Data Systems Inc. Common Shares,$43.63,0.03,0.069%,5039265000.00,United States,,573622,Telecommunications,Telecommunications Equipment +TDS^U,Telephone and Data Systems Inc. Depositary Shares Each Representing a 1/1000th Interest in a 6.625% Series UU Cumulative Redeemable Perpetual Preferred Stock,$22.05,-0.05,-0.226%,,United States,,5257,, +TDS^V,Telephone and Data Systems Inc. Depositary Shares Each Representing a 1/1000th Interest in a 6.000% Series VV Cumulative Redeemable Perpetual Preferred Stock,$20.18,0.08,0.398%,,United States,,17733,, +TDTH,Trident Digital Tech Holdings Ltd American Depository Shares,$0.3623,0.0022,0.611%,41699145.00,Singapore,2024,58244,Real Estate,Real Estate +TDUP,ThredUp Inc. Class A Common Stock,$5.26,-0.07,-1.313%,658246357.00,United States,2021,1116837,Consumer Discretionary,Catalog/Specialty Distribution +TDW,Tidewater Inc. Common Stock,$60.96,-2.46,-3.879%,3021370051.00,United States,2017,1019565,Consumer Discretionary,Marine Transportation +TDWD,Tailwind 2.0 Acquisition Corp. Class A Ordinary Shares,$9.935,0.00,0.00%,0.00,United States,2025,2,Finance,Blank Checks +TDWDR,Tailwind 2.0 Acquisition Corp. Rights,$0.1602,-0.0058,-3.494%,0.00,United States,2025,733,Finance,Blank Checks +TDWDU,Tailwind 2.0 Acquisition Corp. Unit,$10.08,-0.02,-0.198%,0.00,United States,2025,101,, +TDY,Teledyne Technologies Incorporated Common Stock,$620.31,4.29,0.696%,29124166746.00,United States,,513752,Industrials,Industrial Machinery/Components +TE,T1 Energy Inc. Common Stock,$9.49,0.37,4.057%,2453027945.00,Luxembourg,2021,20277375,Miscellaneous,Industrial Machinery/Components +TEAD,Teads Holding Co. Common Stock,$0.6757,-0.0008,-0.118%,64509636.00,United States,2021,229146,Technology,Computer Software: Programming Data Processing +TEAM,Atlassian Corporation Class A Common Stock,$134.76,0.90,0.672%,35473056187.00,Australia,2015,2524161,Technology,Computer Software: Prepackaged Software +TECH,Bio-Techne Corp Common Stock,$65.56,-2.67,-3.913%,10215080678.00,United States,,1814007,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TECK,Teck Resources Ltd Ordinary Shares,$56.85,0.41,0.726%,27754170000.00,Canada,,3025206,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +TECTP,Tectonic Financial Inc. 9.00% Fixed-to-Floating Rate Series B Non-Cumulative Perpetual Preferred Stock,$10.25,0.01,0.098%,69460160.00,United States,2019,1254,Finance,Major Banks +TECX,Tectonic Therapeutic Inc. Common Stock,$19.79,-0.58,-2.847%,370395181.00,United States,2018,182681,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TEI,Templeton Emerging Markets Income Fund Inc. Common Stock,$6.69,0.04,0.602%,0.00,United States,1993,313133,Finance,Finance Companies +TEL,TE Connectivity plc Ordinary Shares,$221.77,-9.01,-3.904%,65074918723.00,Ireland,,3040382,Technology,Electronic Components +TELA,TELA Bio Inc. Common Stock,$0.9589,-0.0211,-2.153%,38683498.00,United States,2019,104061,Health Care,Medical/Dental Instruments +TELO,Telomir Pharmaceuticals Inc. Common Stock,$1.26,-0.06,-4.545%,43320023.00,United States,2024,180658,Health Care,Biotechnology: Pharmaceutical Preparations +TEM,Tempus AI Inc. Class A Common Stock,$64.57,-2.24,-3.353%,11487471714.00,United States,2024,4210951,Technology,Computer Software: Programming Data Processing +TEN,Tsakos Energy Navigation Ltd Common Shares,$27.14,0.67,2.531%,817663145.00,Greece,,421485,Consumer Discretionary,Marine Transportation +TEN^E,Tsakos Energy Navigation Ltd Series E Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Shares par value $1.00,$26.69,0.04,0.15%,,Greece,,9333,, +TEN^F,Tsakos Energy Navigation Ltd Series F Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Shares par value $1.00,$27.10,-0.05,-0.184%,,Greece,,8049,, +TENB,Tenable Holdings Inc. Common Stock,$22.47,-0.28,-1.231%,2681665657.00,United States,2018,1361440,Technology,Computer Software: Prepackaged Software +TENX,Tenax Therapeutics Inc. Common Stock,$14.01,-0.74,-5.017%,87472486.00,United States,,235016,Health Care,Biotechnology: Pharmaceutical Preparations +TEO,Telecom Argentina SA,$13.19,-0.19,-1.42%,5681428970.00,Argentina,,246718,Telecommunications,Telecommunications Equipment +TER,Teradyne Inc. Common Stock,$250.48,11.54,4.83%,39227247735.00,United States,,3909319,Industrials,Electrical Products +TERN,Terns Pharmaceuticals Inc. Common Stock,$34.26,-0.83,-2.365%,3554867962.00,United States,2021,2225931,Health Care,Biotechnology: Pharmaceutical Preparations +TEVA,Teva Pharmaceutical Industries Limited American Depositary Shares,$33.21,0.68,2.09%,38101252224.00,Israel,,21862554,Health Care,Biotechnology: Pharmaceutical Preparations +TEX,Terex Corporation Common Stock,$58.77,-1.70,-2.811%,3854695679.00,United States,,1232979,Industrials,Construction/Ag Equipment/Trucks +TFC,Truist Financial Corporation Common Stock,$50.31,-0.58,-1.14%,64358881906.00,United States,,11102685,Finance,Major Banks +TFC^I,Truist Financial Corporation Depositary Shares,$20.00,-0.05,-0.249%,,United States,,7448,, +TFC^O,Truist Financial Corporation Depositary Shares Each Representing a 1/1000th Interest in a Share of Series O Non-Cumulative Perpetual Preferred Stock,$22.28,-0.0808,-0.361%,,United States,,23644,, +TFC^R,Truist Financial Corporation Depositary Shares each representing 1/1000th interest in a share of Series R Non-Cumulative Perpetual Preferred Stock,$19.8171,-0.0829,-0.417%,,United States,,36277,, +TFII,TFI International Inc. Common Shares,$108.29,0.00,0.00%,8910946620.00,Canada,,410285,Industrials,Trucking Freight/Courier Services +TFIN,Triumph Financial Inc. Common Stock,$63.32,-2.16,-3.299%,1504698551.00,United States,,319302,Finance,Major Banks +TFIN^,Triumph Financial Inc. Depositary Shares Each Representing a 1/40th Interest in a Share of 7.125% Series C Fixed-Rate Non-Cumulative Perpetual Preferred Stock,$21.89,-0.157,-0.712%,,United States,,2279,, +TFPM,Triple Flag Precious Metals Corp. Common Shares,$39.46,1.06,2.76%,8150917027.00,Canada,2022,742231,Industrials,Precious Metals +TFSA,Terra Income Fund 6 LLC 7.00% Notes due 2026,$25.00,-0.02,-0.08%,210972225.00,,2021,1249,, +TFSL,TFS Financial Corporation Common Stock,$14.14,-0.10,-0.702%,3968161918.00,United States,2007,576142,Finance,Savings Institutions +TFX,Teleflex Incorporated Common Stock,$105.33,0.81,0.775%,4654996995.00,United States,,1297678,Health Care,Medical/Dental Instruments +TG,Tredegar Corporation Common Stock,$8.53,-0.17,-1.954%,297788211.00,United States,,188897,Industrials,Metal Fabrications +TGB,Taseko Mines Ltd. Common Stock,$8.25,0.03,0.365%,2973388902.00,Canada,,8434708,Basic Materials,Precious Metals +TGE,The Generation Essentials Group Class A Ordinary Shares,$1.59,0.07,4.605%,77053101.00,,2025,42242,Consumer Discretionary,Newspapers/Magazines +TGEN,Tecogen Inc. Common Stock,$4.13,-0.12,-2.824%,123265958.00,United States,2025,563955,Industrials,Industrial Machinery/Components +TGHL,The GrowHub Limited Class A Ordinary Shares,$0.4101,0.0101,2.525%,10375452.00,Singapore,2025,37342,Technology,EDP Services +TGL,Treasure Global Inc. Common Stock,$5.36,-0.18,-3.249%,8181311.00,United States,2022,63969,Real Estate,Real Estate +TGLS,Tecnoglass Inc. Ordinary Shares,$48.92,-0.85,-1.708%,2278177298.00,Colombia,2022,384459,Consumer Discretionary,Electronic Components +TGNA,TEGNA Inc,$18.85,-0.07,-0.37%,3035920473.00,United States,,798832,Industrials,Broadcasting +TGS,Transportadora de Gas del Sur SA TGS Common Stock,$32.90,-0.60,-1.791%,4953167775.00,Argentina,,332648,Utilities,Natural Gas Distribution +TGT,Target Corporation Common Stock,$101.74,-2.36,-2.267%,46068524967.00,United States,,4644360,Consumer Discretionary,Department/Specialty Retail Stores +TGTX,TG Therapeutics Inc. Common Stock,$30.31,-0.49,-1.591%,4811998960.00,United States,,1138424,Health Care,Biotechnology: Pharmaceutical Preparations +TH,Target Hospitality Corp. Common Stock,$6.76,-0.18,-2.594%,674509636.00,United States,2018,322098,Consumer Discretionary,Hotels/Resorts +THAR,Tharimmune Inc. Common Stock,$4.05,0.46,12.813%,152805880.00,United States,2022,2471906,Health Care,Biotechnology: Pharmaceutical Preparations +THC,Tenet Healthcare Corporation Common Stock,$189.58,0.43,0.227%,16661238300.00,United States,,1031069,Health Care,Hospital/Nursing Management +THCH,TH International Limited Ordinary shares,$2.06,-0.05,-2.37%,68481779.00,China,,8225,Consumer Discretionary,Restaurants +THFF,First Financial Corporation Common Stock,$62.48,-0.92,-1.451%,740428300.00,United States,,54649,Finance,Major Banks +THG,Hanover Insurance Group Inc,$171.34,1.30,0.765%,6096956392.00,United States,,402889,Finance,Property-Casualty Insurers +THH,TryHard Holdings Limited Ordinary Shares,$0.7798,-0.0821,-9.525%,41833346.00,Japan,2025,2312785,Consumer Discretionary,Services-Misc. Amusement & Recreation +THM,International Tower Hill Mines Ltd. Ordinary Shares (Canada),$3.08,0.21,7.317%,730469657.00,Canada,,8500735,Basic Materials,Metal Mining +THO,Thor Industries Inc. Common Stock,$111.87,-2.52,-2.203%,5911061342.00,United States,,390838,Industrials,Homebuilding +THQ,abrdn Healthcare Opportunities Fund Shares of Beneficial Interest,$18.96,-0.27,-1.404%,0.00,United States,2014,247238,Finance,Finance Companies +THR,Thermon Group Holdings Inc. Common Stock,$43.43,-0.54,-1.228%,1426244457.00,United States,2011,366681,Energy,Industrial Machinery/Components +THRM,Gentherm Inc Common Stock,$36.04,-0.67,-1.825%,1100126334.00,United States,,138958,Consumer Discretionary,Auto Parts:O.E.M. +THRY,Thryv Holdings Inc. Common Stock,$4.61,0.09,1.991%,200889468.00,United States,,692388,Consumer Discretionary,Advertising +THS,Treehouse Foods Inc. Common Stock,$24.67,0.10,0.407%,1245835000.00,United States,,548602,Consumer Staples,Packaged Foods +THW,abrdn World Healthcare Fund Shares of Beneficial Interest,$12.45,-0.21,-1.659%,0.00,United States,2015,213907,Finance,Finance Companies +TIC,TIC Solutions Inc. Common Stock,$10.43,-0.08,-0.761%,2307217025.00,United States,2025,1991431,Real Estate,Real Estate +TIGO,Millicom International Cellular S.A. Common Stock,$60.83,0.34,0.562%,10468618233.00,Luxembourg,,632804,Telecommunications,Telecommunications Equipment +TIGR,UP Fintech Holding Ltd American Depositary Share representing fifteen Class A Ordinary Shares,$8.77,-0.04,-0.454%,1559869744.00,China,2019,2447431,Finance,Investment Bankers/Brokers/Service +TII,Titan Mining Corporation Common Shares,$4.94,0.08,1.646%,451959469.00,,2025,700392,, +TIL,Instil Bio Inc. Common Stock,$7.09,-0.07,-0.978%,48084210.00,United States,2021,58707,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TILE,Interface Inc. Common Stock,$31.43,0.22,0.705%,1835217092.00,United States,,435438,Consumer Discretionary,Home Furnishings +TIMB,TIM S.A. American Depositary Shares (Each representing 5 Common Shares) ,$24.16,0.33,1.385%,11697326861.00,Brazil,2020,226375,Telecommunications,Telecommunications Equipment +TIPT,Tiptree Inc. Common Stock,$17.26,-0.01,-0.058%,647252882.00,United States,,208322,Finance,Property-Casualty Insurers +TIRX,TIAN RUIXIANG Holdings Ltd Class A Ordinary Shares,$1.32,0.999,311.215%,32157089.00,China,2021,394897139,Finance,Specialty Insurers +TISI,Team Inc. Common Stock,$14.28,0.18,1.277%,64648987.00,United States,,5964,Consumer Discretionary,Other Consumer Services +TITN,Titan Machinery Inc. Common Stock,$16.15,-0.16,-0.981%,377428310.00,United States,2007,112079,Consumer Discretionary,Other Specialty Stores +TIVC,Tivic Health Systems Inc. Common Stock,$1.26,-0.02,-1.563%,3182480.00,United States,2021,205001,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +TJGC,TJGC Group Limited Ordinary Shares,$1.07,0.02,1.905%,16371000.00,Hong Kong,2025,20838,Consumer Discretionary,Advertising +TJX,TJX Companies Inc. (The) Common Stock,$147.79,-0.22,-0.149%,164115931970.00,United States,,6424549,Consumer Discretionary,Clothing/Shoe/Accessory Stores +TK,Teekay Corporation Ltd. Common Stock,$10.03,0.27,2.766%,837901566.00,Bermuda,,650995,Consumer Discretionary,Marine Transportation +TKC,Turkcell Iletisim Hizmetleri AS Common Stock,$6.61,0.02,0.303%,5816800000.00,Turkey,,724590,Telecommunications,Telecommunications Equipment +TKLF,Tokyo Lifestyle Co. Ltd. American Depositary Shares,$3.39,-0.09,-2.586%,14349128.00,Japan,2022,2797,Consumer Discretionary,Other Specialty Stores +TKNO,Alpha Teknova Inc. Common Stock,$2.97,-0.19,-6.013%,158981647.00,United States,2021,187976,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +TKO,TKO Group Holdings Inc. Class A Common Stock,$194.88,-4.31,-2.164%,38017380798.00,United States,2023,844370,Consumer Discretionary,Services-Misc. Amusement & Recreation +TKR,Timken Company (The) Common Stock,$93.40,-0.49,-0.522%,6505831919.00,United States,,824028,Industrials,Metal Fabrications +TLF,Tandy Leather Factory Inc. Common Stock,$2.865,-0.005,-0.174%,23113393.00,United States,,10546,Consumer Discretionary,Apparel +TLIH,Ten-League International Holdings Limited Ordinary Shares,$0.4001,0.0202,5.317%,11764677.00,Singapore,2025,59734,, +TLK,PT Telekomunikasi Indonesia Tbk,$20.51,-2.92,-12.463%,20317660625.00,Indonesia,,812360,Telecommunications,Telecommunications Equipment +TLN,Talen Energy Corporation Common Stock,$365.17,5.66,1.574%,16683824151.00,United States,,539760,Utilities,Electric Utilities: Central +TLNC,Talon Capital Corp. Class A Ordinary Shares,$10.15,0.04,0.396%,0.00,United States,2025,1035,, +TLNCW,Talon Capital Corp. Warrants,$0.48,0.007,1.48%,0.00,United States,2025,7084,, +TLPH,Talphera Inc. Common Stock,$0.9899,-0.0101,-1.01%,46138861.00,United States,2011,201584,Health Care,Biotechnology: Pharmaceutical Preparations +TLRY,Tilray Brands Inc. Common Stock ,$7.85,-0.57,-6.77%,914702410.00,United States,2018,6670361,Health Care, Medicinal Chemicals and Botanical Products +TLS,Telos Corporation Common Stock,$5.68,0.19,3.461%,418924589.00,United States,2020,675452,Technology,EDP Services +TLSA,Tiziana Life Sciences Ltd. Common Shares,$1.61,-0.09,-5.294%,204887201.00,United Kingdom,2018,222950,Health Care,Biotechnology: Pharmaceutical Preparations +TLSI,TriSalus Life Sciences Inc. Common Stock,$4.95,-0.27,-5.172%,247323339.00,United States,2021,189241,Health Care,Medical Specialities +TLSIW,TriSalus Life Sciences Inc. Warrant,$1.295,0.045,3.60%,64703783.00,United States,2021,55077,Health Care,Medical Specialities +TLX,Telix Pharmaceuticals Limited American Depositary Shares,$8.10,-0.26,-3.11%,2711268329.00,Australia,,139189,Health Care,Biotechnology: Pharmaceutical Preparations +TLYS,Tilly's Inc. Common Stock,$1.53,0.01,0.658%,46624715.00,United States,2012,20442,Consumer Discretionary,Clothing/Shoe/Accessory Stores +TM,Toyota Motor Corporation Common Stock,$218.89,-5.23,-2.334%,285628023736.00,Japan,,437584,Industrials,Auto Manufacturing +TMC,TMC the metals company Inc. Common Stock,$8.41,0.36,4.472%,3477468098.00,Canada,,11463721,Basic Materials,Metal Mining +TMCI,Treace Medical Concepts Inc. Common Stock,$2.40,-0.14,-5.512%,152923375.00,United States,2021,389605,Health Care,Medical/Dental Instruments +TMCWW,TMC the metals company Inc. Warrants,$1.93,0.14,7.821%,798039647.00,Canada,,89711,Basic Materials,Metal Mining +TMDE,TMD Energy Limited Ordinary Shares,$0.6815,-0.0111,-1.603%,16059548.00,,2025,67873,Energy,Oil Refining/Marketing +TMDX,TransMedics Group Inc. Common Stock,$140.99,2.50,1.805%,4818238082.00,United States,2019,1209208,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +TME,Tencent Music Entertainment Group American Depositary Shares each representing two Class A Ordinary Shares,$17.23,0.28,1.652%,26687624604.00,United States,2018,7443533,Consumer Discretionary,Broadcasting +TMHC,Taylor Morrison Home Corporation Common Stock,$61.21,0.05,0.082%,5981749515.00,United States,2013,720750,Consumer Discretionary,Homebuilding +TMO,Thermo Fisher Scientific Inc Common Stock,$608.02,-15.89,-2.547%,228438014033.00,United States,,2338405,Industrials,Industrial Machinery/Components +TMP,Tompkins Financial Corporation Common Stock,$75.07,-0.84,-1.107%,1083401232.00,United States,1997,47803,Finance,Major Banks +TMQ,Trilogy Metals Inc. Common Stock,$6.88,-0.01,-0.145%,1130462501.00,Canada,,12529502,Basic Materials,Precious Metals +TMUS,T-Mobile US Inc. Common Stock,$186.25,1.76,0.954%,208321859093.00,United States,,7418888,Telecommunications,Telecommunications Equipment +TMUSI,T-Mobile US Inc. 5.500% Senior Notes due June 2070,$22.87,-0.04,-0.175%,0.00,United States,,21216,Telecommunications,Telecommunications Equipment +TMUSL,T-Mobile US Inc. 6.250% Senior Notes due 2069,$25.1027,0.0527,0.21%,0.00,United States,,184019,Telecommunications,Telecommunications Equipment +TMUSZ,T-Mobile US Inc. 5.500% Senior Notes due March 2070,$22.94,-0.23,-0.993%,0.00,United States,,21836,Telecommunications,Telecommunications Equipment +TNC,Tennant Company Common Stock,$75.52,-0.01,-0.013%,1368873179.00,United States,,98413,Industrials,Industrial Machinery/Components +TNDM,Tandem Diabetes Care Inc. Common Stock,$19.11,-1.04,-5.161%,1295703080.00,United States,2013,1128957,Health Care,Medical/Dental Instruments +TNET,TriNet Group Inc. Common Stock,$57.73,-3.26,-5.345%,2772792741.00,United States,2014,345183,Real Estate,Real Estate +TNGX,Tango Therapeutics Inc.,$11.18,-0.67,-5.654%,1505689911.00,United States,2020,1674205,Health Care,Biotechnology: Pharmaceutical Preparations +TNK,Teekay Tankers Ltd.,$63.33,1.42,2.294%,2177423586.00,Bermuda,2007,312619,Consumer Discretionary,Marine Transportation +TNL,Travel Leisure Co. Common Stock,$69.58,0.42,0.607%,4475746581.00,United States,,517569,Consumer Discretionary,Hotels/Resorts +TNMG,TNL Mediagene Ordinary Shares,$3.68,-0.70,-15.982%,9405318.00,Taiwan,,126978,Consumer Discretionary,Advertising +TNON,Tenon Medical Inc. Common Stock,$0.9303,-0.0147,-1.556%,10332325.00,United States,2022,79733,Health Care,Medical/Dental Instruments +TNXP,Tonix Pharmaceuticals Holding Corp. Common Stock,$18.29,-0.07,-0.381%,222644975.00,United States,,341159,Health Care,Biotechnology: Pharmaceutical Preparations +TNYA,Tenaya Therapeutics Inc. Common Stock,$0.66,-0.0378,-5.417%,141071393.00,United States,2021,2809946,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TOI,The Oncology Institute Inc. Common Stock,$3.00,-0.06,-1.961%,295144020.00,United States,2020,1969381,Health Care,Medical/Nursing Services +TOIIW,The Oncology Institute Inc. Warrant,$0.1291,0.0091,7.583%,12701031.00,United States,2020,230,Health Care,Medical/Nursing Services +TOL,Toll Brothers Inc. Common Stock,$144.99,1.92,1.342%,13774484970.00,United States,,994788,Consumer Discretionary,Homebuilding +TOMZ,TOMI Environmental Solutions Inc. Common Stock,$0.71,-0.0098,-1.361%,17230438.00,United States,,34841,Industrials,Major Chemicals +TONX,TON Strategy Company Common Stock,$2.59,-0.01,-0.385%,153044449.00,United States,,291979,Consumer Discretionary,Other Consumer Services +TOON,Kartoon Studios Inc. Common Stock,$0.712,-0.0034,-0.475%,38380856.00,United States,,309380,Consumer Discretionary,Movies/Entertainment +TOP,TOP Financial Group Limited Class A Ordinary Shares,$1.00,0.00,0.00%,37068205.00,Hong Kong,2022,41689,Finance,Investment Bankers/Brokers/Service +TOPP,Toppoint Holdings Inc. Common Stock,$0.8596,-0.0164,-1.872%,16676240.00,,2025,8629,Industrials,Trucking Freight/Courier Services +TOPS,TOP Ships Inc. Common Stock,$5.1538,-0.0962,-1.832%,23842494.00,Greece,,3426,Consumer Discretionary,Marine Transportation +TORO,Toro Corp. Common Stock,$3.84,0.07,1.857%,73320396.00,Cyprus,,66612,Consumer Discretionary,Marine Transportation +TOST,Toast Inc. Class A Common Stock,$31.86,-0.62,-1.909%,18733680000.00,United States,2021,12471434,Technology,EDP Services +TOUR,Tuniu Corporation American Depositary Shares,$0.67,0.00,0.00%,77737678.00,China,2014,171088,Consumer Discretionary,Transportation Services +TOVX,Theriva Biologics Inc. Common Stock,$0.1911,-0.0139,-6.78%,6820043.00,United States,,1506688,Health Care,Biotechnology: Pharmaceutical Preparations +TOWN,TowneBank Common Stock,$36.04,-0.21,-0.579%,2689208573.00,United States,,410411,Finance,Major Banks +TOYO,TOYO Co. Ltd Ordinary Shares,$6.92,0.02,0.29%,261396059.00,Japan,,61629,Consumer Discretionary,Miscellaneous manufacturing industries +TPB,Turning Point Brands Inc. Common Stock,$124.49,2.62,2.15%,2374118539.00,United States,2016,280410,Consumer Discretionary,Tobacco +TPC,Tutor Perini Corporation Common Stock,$79.38,0.85,1.082%,4186759026.00,United States,1970,626581,Consumer Discretionary,General Bldg Contractors - Nonresidential Bldgs +TPCS,TechPrecision Corporation Common stock,$4.95,0.12,2.484%,49564103.00,United States,,3550,Industrials,Metal Fabrications +TPET,Trio Petroleum Corp. Common Stock,$0.8302,-0.0098,-1.167%,10212084.00,,2023,355993,Energy,Oil & Gas Production +TPG,TPG Inc. Class A Common Stock,$59.37,-0.47,-0.785%,22446035373.00,United States,2022,2459810,Finance,Investment Managers +TPGXL,TPG Operating Group II L.P. 6.950% Fixed-Rate Junior Subordinated Notes due 2064,$25.27,-0.12,-0.473%,9219147334.00,United States,,10162,, +TPH,Tri Pointe Homes Inc. Common Stock,$33.27,0.00,0.00%,2859672845.00,United States,2013,682697,Consumer Discretionary,Homebuilding +TPL,Texas Pacific Land Corporation Common Stock,$354.78,9.58,2.775%,24457929719.00,United States,,317784,Energy,Oil & Gas Production +TPR,Tapestry Inc. Common Stock,$126.00,-1.54,-1.207%,25785868752.00,United States,,1881797,Consumer Discretionary,Apparel +TPST,Tempest Therapeutics Inc. Common Stock,$2.79,-0.15,-5.102%,13746779.00,United States,,38149,Health Care,Biotechnology: Pharmaceutical Preparations +TPTA,Terra Property Trust Inc. 6.00% Notes due 2026,$23.95,0.04,0.167%,582931911.00,,2021,3351,Real Estate,Real Estate Investment Trusts +TPVG,TriplePoint Venture Growth BDC Corp. Common Stock,$6.20,-0.14,-2.208%,250478741.00,United States,2014,253354,Consumer Discretionary,Other Consumer Services +TR,Tootsie Roll Industries Inc. Common Stock,$37.17,-0.31,-0.827%,2712913037.00,United States,,81975,Consumer Staples,Specialty Foods +TRAK,ReposiTrak Inc. Common Stock,$10.71,-0.42,-3.774%,195869353.00,United States,,71914,Technology,EDP Services +TRAW,Traws Pharma Inc. Common Stock,$2.46,-0.36,-12.766%,19657533.00,United States,2013,508569,Health Care,Biotechnology: Pharmaceutical Preparations +TRC,Tejon Ranch Co Common Stock,$16.18,-0.08,-0.492%,435144192.00,United States,2000,84801,Finance,Real Estate +TRDA,Entrada Therapeutics Inc. Common Stock,$11.15,0.15,1.364%,426144437.00,United States,2021,320033,Health Care,Biotechnology: Pharmaceutical Preparations +TREE,LendingTree Inc. Common Stock,$57.91,-1.03,-1.748%,791670005.00,United States,,254342,Finance,Finance: Consumer Services +TREX,Trex Company Inc. Common Stock,$41.97,0.06,0.143%,4501483284.00,United States,,982469,Basic Materials,Forest Products +TRGP,Targa Resources Inc. Common Stock,$201.13,6.09,3.122%,43174276977.00,United States,2010,1555175,Utilities,Natural Gas Distribution +TRI,Thomson Reuters Corporation Common Shares,$117.28,-1.62,-1.362%,52171126875.00,United States,,1270024,Consumer Discretionary,Publishing +TRIB,Trinity Biotech plc American Depositary Shares,$0.9072,-0.0305,-3.253%,16974013.00,Ireland,1992,129035,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +TRIN,Trinity Capital Inc. Common Stock,$16.97,0.20,1.193%,1284346534.00,United States,2021,1071353,Finance,Finance: Consumer Services +TRINI,Trinity Capital Inc. 7.875% Notes Due 2029,$25.47,0.01,0.039%,1790901655.00,United States,,984,Finance,Finance: Consumer Services +TRINZ,Trinity Capital Inc. 7.875% Notes due 2029,$25.32,0.00,0.00%,1780354531.00,United States,,3252,Finance,Finance: Consumer Services +TRIP,TripAdvisor Inc. Common Stock,$13.01,-0.05,-0.383%,1520977490.00,United States,,1424194,Technology,Computer Software: Programming Data Processing +TRMB,Trimble Inc. Common Stock,$70.07,0.06,0.086%,16671121807.00,United States,1990,2122956,Industrials,Industrial Machinery/Components +TRMD,TORM plc Class A Common Stock,$24.53,1.20,5.144%,2399378671.00,United Kingdom,,1115262,Consumer Discretionary,Marine Transportation +TRMK,Trustmark Corporation Common Stock,$42.11,0.97,2.358%,2524842118.00,United States,,466890,Finance,Major Banks +TRN,Trinity Industries Inc. Common Stock,$28.15,0.09,0.321%,2257081722.00,United States,,673006,Industrials,Railroads +TRNO,Terreno Realty Corporation Common Stock,$59.95,-1.56,-2.536%,6198543499.00,United States,2010,846678,Finance,Real Estate +TRNR,Interactive Strength Inc. Common Stock,$0.54,-0.0837,-13.42%,2836664.00,United States,2023,370969,Technology,Consumer Electronics/Appliances +TRNS,Transcat Inc. Common Stock,$58.81,-1.03,-1.721%,548603910.00,United States,,106781,Industrials,Electrical Products +TRON,Tron Inc. Common Stock,$1.46,-0.03,-2.013%,375388484.00,United States,2023,433496,Consumer Discretionary,Recreational Games/Products/Toys +TROO,TROOPS Inc. Ordinary Shares ,$3.61,0.22,6.49%,406161699.00,China,,361120,Finance,Diversified Financial Services +TROW,T. Rowe Price Group Inc. Common Stock,$105.25,-0.06,-0.057%,22969444250.00,United States,1986,1135033,Finance,Investment Bankers/Brokers/Service +TROX,Tronox Holdings plc Ordinary Shares (UK),$6.53,0.04,0.616%,1035346702.00,United States,,2679192,Industrials,Major Chemicals +TRP,TC Energy Corporation Common Stock,$58.16,0.44,0.762%,60544560000.00,Canada,,1671254,Utilities,Natural Gas Distribution +TRS,TriMas Corporation Common Stock,$34.29,-0.14,-0.407%,1393740059.00,United States,2007,254231,Industrials,Industrial Specialties +TRSG,Tungray Technologies Inc Class A Ordinary Shares,$1.19,0.00,0.00%,19460647.00,Singapore,2024,35,Industrials,Industrial Machinery/Components +TRST,TrustCo Bank Corp NY Common Stock,$42.31,0.01,0.024%,779520244.00,United States,,95293,Finance,Major Banks +TRT,Trio-Tech International Common Stock,$6.25,0.15,2.459%,54381938.00,United States,1998,29042,Technology,Industrial Machinery/Components +TRTN^A,Triton International Limited 8.50% Series A Cumulative Redeemable Perpetual Preference Shares,$25.8475,0.0275,0.107%,,United States,,10225,, +TRTN^B,Triton International Limited 8.00% Series B Cumulative Redeemable Perpetual Preference Shares,$25.42,0.13,0.514%,,United States,,364,, +TRTN^C,Triton International Limited 7.375% Series C Cumulative Redeemable Perpetual Preference Shares,$25.11,-0.01,-0.04%,,United States,,4836,, +TRTN^D,Triton International Limited 6.875% Series D Cumulative Redeemable Perpetual Preference Shares,$23.69,-0.1099,-0.462%,,United States,,1764,, +TRTN^E,Triton International Limited 5.75% Series E Cumulative Redeemable Perpetual Preference Shares,$19.89,-0.03,-0.151%,,United States,,4767,, +TRTN^F,Triton International Limited 7.625% Series F Cumulative Redeemable Perpetual Preference Shares,$25.15,0.01,0.04%,,United States,,3429,, +TRTN^G,Triton International Limited 7.500% Series G Cumulative Redeemable Perpetual Preference Shares,$24.93,0.08,0.322%,,United States,,89921,, +TRTX,TPG RE Finance Trust Inc. Common Stock,$9.25,0.14,1.537%,723917451.00,United States,2017,1039139,Real Estate,Real Estate Investment Trusts +TRTX^C,TPG RE Finance Trust Inc. 6.25% Series C Cumulative Redeemable Preferred Stock $0.001 par value per share,$18.48,0.40,2.212%,,United States,,1330,, +TRU,TransUnion Common Stock,$81.17,-0.86,-1.048%,15763214000.00,United States,2015,3355294,Finance,Finance: Consumer Services +TRUG,TruGolf Holdings Inc. Class A Common Stock,$0.6919,-0.0391,-5.349%,3499246.00,United States,2021,250802,Consumer Discretionary,Recreational Games/Products/Toys +TRUP,Trupanion Inc. Common Stock,$31.41,-0.35,-1.102%,1356854331.00,United States,,287430,Health Care,Medical Specialities +TRV,The Travelers Companies Inc. Common Stock,$282.04,0.77,0.274%,62912806131.00,United States,,1416173,Finance,Property-Casualty Insurers +TRVG,trivago N.V. American Depositary Shares,$2.82,0.02,0.714%,198266600.00,Germany,2016,8291,Technology,EDP Services +TRVI,Trevi Therapeutics Inc. Common Stock,$10.51,-0.45,-4.106%,1347698708.00,United States,2019,1928290,Health Care,Biotechnology: Pharmaceutical Preparations +TRX,TRX Gold Corporation Common Stock,$1.93,0.41,26.974%,553826306.00,Canada,,29523724,Basic Materials,Precious Metals +TS,Tenaris S.A. American Depositary Shares,$44.40,-0.40,-0.893%,24070842662.00,Luxembourg,,1425932,Industrials,Steel/Iron Ore +TSAT,Telesat Corporation Class A Common Shares and Class B Variable Voting Shares ,$29.86,1.46,5.141%,1079978720.00,Canada,,140575,Industrials,Metal Fabrications +TSBK,Timberland Bancorp Inc. Common Stock,$36.69,-0.73,-1.951%,289145561.00,United States,,12045,Finance,Banks +TSCO,Tractor Supply Company Common Stock,$55.14,-0.59,-1.059%,29136174228.00,United States,1994,9151908,Consumer Discretionary,RETAIL: Building Materials +TSE,Trinseo PLC Ordinary Shares ,$0.48,-0.02,-4.00%,17276923.00,United States,2014,602876,Industrials,Major Chemicals +TSEM,Tower Semiconductor Ltd. Ordinary Shares,$138.93,6.31,4.758%,15526347633.00,Israel,1994,2391762,Technology,Semiconductors +TSHA,Taysha Gene Therapies Inc. Common Stock,$4.48,-0.28,-5.882%,1227158791.00,United States,2020,4207697,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TSI,TCW Strategic Income Fund Inc. Common Stock,$4.845,-0.005,-0.103%,0.00,United States,,84356,Finance,Investment Managers +TSLA,Tesla Inc. Common Stock,$431.46,0.56,0.13%,1434957937794.00,United States,2010,54857403,Industrials,Auto Manufacturing +TSLX,Sixth Street Specialty Lending Inc. Common Stock,$22.12,-0.15,-0.674%,2090205621.00,,2014,314607,Finance,Investment Managers +TSM,Taiwan Semiconductor Manufacturing Company Ltd.,$342.30,3.96,1.17%,1775354917610.00,Taiwan,1997,12140053,Technology,Semiconductors +TSN,Tyson Foods Inc. Common Stock,$64.60,-1.15,-1.749%,22807294214.00,United States,,3122576,Consumer Staples,Meat/Poultry/Fish +TSOL,21Shares Solana ETF Shares of Beneficial Interest,$12.62,-0.1771,-1.384%,,,2025,2537,, +TSQ,Townsquare Media Inc. Class A Common Stock,$6.39,0.32,5.272%,105183336.00,United States,2014,396488,Consumer Discretionary,Broadcasting +TSSI,TSS Inc. Common Stock,$10.47,-0.36,-3.324%,302007537.00,United States,,837894,Consumer Discretionary,Professional Services +TT,Trane Technologies plc,$394.20,1.90,0.484%,87409515377.00,Ireland,,2755891,Industrials,Auto Parts:O.E.M. +TTAM,Titan America SA Common Shares,$17.85,0.08,0.45%,3290870000.00,,2025,412939,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +TTAN,ServiceTitan Inc. Class A Common Stock,$91.57,-0.15,-0.164%,8575222275.00,United States,2024,688303,Technology,Computer Software: Prepackaged Software +TTC,Toro Company (The) Common Stock,$90.01,0.05,0.056%,8812401057.00,United States,,932217,Consumer Discretionary,Tools/Hardware +TTD,The Trade Desk Inc. Class A Common Stock,$31.87,-0.32,-0.994%,15412168411.00,United States,2016,9848671,Technology,Computer Software: Programming Data Processing +TTE,TotalEnergies SE Ordinary Shares,$71.52,-0.27,-0.376%,156046756222.00,France,,2180416,Energy,Oil & Gas Production +TTEC,TTEC Holdings Inc. Common Stock,$3.24,-0.18,-5.263%,157300918.00,United States,1996,303679,Consumer Discretionary,Professional Services +TTEK,Tetra Tech Inc. Common Stock,$37.10,-0.23,-0.616%,9689521157.00,United States,1991,2679747,Consumer Discretionary,Military/Government/Technical +TTGT,TechTarget Inc. Common Stock,$5.40,0.03,0.559%,389652692.00,United States,,433670,Telecommunications,Telecommunications Equipment +TTI,Tetra Technologies Inc. Common Stock,$11.39,-0.53,-4.446%,1523375072.00,United States,,2087582,Energy,Oil & Gas Production +TTMI,TTM Technologies Inc. Common Stock,$97.99,3.38,3.573%,10125377743.00,United States,2000,3022358,Technology,Electrical Products +TTRX,Turn Therapeutics Inc. Common Stock,$4.57,-0.36,-7.302%,134564486.00,United States,,69330,Health Care,Biotechnology: Pharmaceutical Preparations +TTWO,Take-Two Interactive Software Inc. Common Stock,$243.18,-2.34,-0.953%,44934516366.00,United States,1997,1554555,Consumer Discretionary,Services-Misc. Amusement & Recreation +TU,Telus Corporation Ordinary Shares,$13.96,0.10,0.722%,21610080000.00,Canada,,5724837,Telecommunications,Telecommunications Equipment +TURB,Turbo Energy S.A. American Depositary Shares,$0.90,-0.0101,-1.11%,9915426.00,Spain,2023,37166,Miscellaneous,Industrial Machinery/Components +TUSK,Mammoth Energy Services Inc. Common Stock,$2.13,-0.06,-2.74%,102653295.00,United States,2016,120083,Energy,Oilfield Services/Equipment +TUYA,Tuya Inc. American Depositary Shares each representing one Class A Ordinary Share,$2.15,-0.02,-0.922%,1310902190.00,China,2021,695522,Technology,Computer Software: Prepackaged Software +TV,Grupo Televisa S.A.B. Common Stock,$3.33,0.02,0.604%,6360300000.00,Mexico,1993,619583,Industrials,Broadcasting +TVA,Texas Ventures Acquisition III Corp Class A Ordinary Share,$10.66,-0.03,-0.281%,0.00,United States,2025,30253,, +TVACW,Texas Ventures Acquisition III Corp Warrants,$0.90,0.00,0.00%,0.00,United States,2025,118,, +TVAI,Thayer Ventures Acquisition Corporation II Class A Ordinary Shares,$10.15,-0.03,-0.295%,0.00,United States,2025,287,, +TVC,Tennessee Valley Authority Common Stock,$24.3398,0.0098,0.04%,0.00,United States,,10006,Utilities,Electric Utilities: Central +TVE,Tennessee Valley Authority,$24.52,0.03,0.122%,0.00,United States,,6232,Utilities,Electric Utilities: Central +TVGN,Tevogen Bio Holdings Inc. Common Stock,$0.3172,-0.0218,-6.431%,63889562.00,United States,2022,486967,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TVGNW,Tevogen Bio Holdings Inc. Warrant,$0.0379,-0.0059,-13.47%,7633715.00,United States,2022,5284,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TVRD,Tvardi Therapeutics Inc. Common Stock,$4.06,-0.25,-5.80%,38088257.00,United States,2014,60929,Health Care,Biotechnology: Pharmaceutical Preparations +TVTX,Travere Therapeutics Inc. Common Stock,$30.28,0.25,0.833%,2709222062.00,United States,,1123313,Health Care,Biotechnology: Pharmaceutical Preparations +TW,Tradeweb Markets Inc. Class A Common Stock,$103.74,-0.11,-0.106%,24532267867.00,United States,2019,1332072,Finance,Investment Bankers/Brokers/Service +TWAV,TaoWeave Inc. Common Stock,$1.71,-0.15,-8.065%,5484329.00,United States,,34738,Technology,Computer Software: Programming Data Processing +TWFG,TWFG Inc. Class A Common Stock,$25.39,0.17,0.674%,1426921605.00,United States,2024,67036,Finance,Specialty Insurers +TWG,Top Wealth Group Holding Limited Class A Ordinary Shares,$4.22,0.02,0.476%,4895445.00,Hong Kong,2024,191725,Consumer Staples,Packaged Foods +TWI,Titan International Inc. (DE) Common Stock,$8.59,-0.16,-1.829%,549343333.00,United States,,462237,Industrials,Steel/Iron Ore +TWIN,Twin Disc Incorporated Common Stock,$17.04,-0.64,-3.62%,245172048.00,United States,,9456,Industrials,Industrial Machinery/Components +TWLO,Twilio Inc. Class A Common Stock,$135.86,2.01,1.502%,20598117453.00,United States,2016,1922173,Technology,Computer Software: Prepackaged Software +TWLV,Twelve Seas Investment Company III Class A Ordinary Shares,$9.89,-0.01,-0.101%,0.00,United States,2026,262,Finance,Blank Checks +TWN,Taiwan Fund Inc. (The) Common Stock,$58.515,0.805,1.395%,0.00,United States,1986,5281,Finance,Trusts Except Educational Religious and Charitable +TWNP,Twin Hospitality Group Inc. Class A Common Stock,$0.3701,0.0201,5.743%,21216299.00,United States,,2847705,Consumer Discretionary,Restaurants +TWO,Two Harbors Investment Corp,$13.71,0.11,0.809%,1427976265.00,United States,,2796776,Real Estate,Real Estate Investment Trusts +TWO^A,Two Harbors Investments Corp 8.125% Series A Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock ($25.00 liquidation preference per share),$24.90,0.04,0.161%,,United States,,21922,, +TWO^B,Two Harbors Investments Corp 7.625% Series B Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$24.88,0.14,0.566%,,United States,,31917,, +TWO^C,Two Harbors Investments Corp 7.25% Series C Fixed-to-Floating Rate Cumulative Redeemable Preferred Stock,$25.05,0.06,0.24%,,United States,,36607,, +TWOD,Two Harbors Investments Corp 9.375% Senior Notes due 2030,$26.04,-0.01,-0.038%,0.00,United States,2025,11354,Real Estate,Real Estate Investment Trusts +TWST,Twist Bioscience Corporation Common Stock,$42.01,-0.59,-1.385%,2570635422.00,United States,2018,995415,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +TX,Ternium S.A. Ternium S.A. American Depositary Shares (each representing ten shares USD1.00 par value),$43.41,0.03,0.069%,8702591273.00,Luxembourg,,276187,Industrials,Steel/Iron Ore +TXG,10x Genomics Inc. Class A Common Stock,$21.08,-0.54,-2.498%,2667738315.00,United States,2019,1764945,Industrials,Biotechnology: Laboratory Analytical Instruments +TXMD,TherapeuticsMD Inc. Common Stock,$2.14,-0.28,-11.57%,24769135.00,United States,,159955,Health Care,Biotechnology: Pharmaceutical Preparations +TXN,Texas Instruments Incorporated Common Stock,$216.17,19.54,9.937%,196417038233.00,United States,,19603428,Technology,Semiconductors +TXNM,TXNM Energy Inc. Common Stock,$59.30,0.04,0.067%,6459036411.00,United States,,1144075,Utilities,Electric Utilities: Central +TXO,TXO Partners L.P. Common Units Representing Limited Partner Interests,$11.80,0.15,1.288%,646454646.00,United States,2023,280779,Energy,Oil & Gas Production +TXRH,Texas Roadhouse Inc. Common Stock,$181.75,-3.21,-1.736%,12022049858.00,United States,2004,735693,Consumer Discretionary,Restaurants +TXT,Textron Inc. Common Stock,$86.79,-7.44,-7.896%,15294486515.00,United States,,6415359,Industrials,Aerospace +TY,Tri Continental Corporation Common Stock,$33.29,-0.09,-0.27%,1809342626.00,United States,,29188,Finance,Finance Companies +TY^,Tri Continental Corporation Preferred Stock,$44.79,0.3599,0.81%,,United States,,351,, +TYG,Tortoise Energy Infrastructure Corporation Common Stock,$43.81,0.13,0.298%,522561430.00,United States,2004,116573,Finance,Investment Managers +TYGO,Tigo Energy Inc. Common Stock,$3.30,-0.14,-4.07%,232162418.00,United States,2021,462895,Technology,Semiconductors +TYL,Tyler Technologies Inc. Common Stock,$419.12,-7.04,-1.652%,18033781359.00,United States,,322934,Technology,Computer Software: Prepackaged Software +TYRA,Tyra Biosciences Inc. Common Stock,$31.08,-0.32,-1.019%,1658804806.00,United States,2021,489333,Health Care,Biotechnology: Pharmaceutical Preparations +TZOO,Travelzoo Common Stock,$5.80,-0.24,-3.974%,63407555.00,United States,,152638,Consumer Discretionary,Advertising +U,Unity Software Inc. Common Stock,$40.16,-1.09,-2.642%,17184979775.00,United States,2020,7131256,Technology,Computer Software: Prepackaged Software +UA,Under Armour Inc. Class C Common Stock,$5.98,-0.23,-3.704%,2534858385.00,United States,2016,8147595,Consumer Discretionary,Apparel +UAA,Under Armour Inc. Class A Common Stock,$6.07,-0.26,-4.107%,2573008427.00,United States,,11561253,Consumer Discretionary,Apparel +UAL,United Airlines Holdings Inc. Common Stock,$104.91,0.87,0.836%,33963352426.00,United States,,4335004,Consumer Discretionary,Air Freight/Delivery Services +UAMY,United States Antimony Corporation Common Stock,$9.70,-0.21,-2.119%,1358345359.00,United States,,17920716,Industrials,Metal Fabrications +UAN,CVR Partners LP Common Units representing Limited Partner Interests,$106.42,2.37,2.278%,1124820770.00,United States,2011,28923,Industrials,Agricultural Chemicals +UAVS,AgEagle Aerial Systems Inc. Common Stock,$1.18,-0.04,-3.279%,47285654.00,United States,,3126055,Industrials,Aerospace +UBCP,United Bancorp Inc. Common Stock,$14.14,0.14,1.00%,81644516.00,United States,,1776,Finance,Major Banks +UBER,Uber Technologies Inc. Common Stock,$79.78,-1.46,-1.797%,165769307796.00,United States,2019,19317305,Real Estate,Real Estate +UBFO,United Security Bancshares Common Stock,$10.43,-0.06,-0.572%,183316147.00,United States,,23170,Finance,Major Banks +UBS,UBS Group AG Registered Ordinary Shares,$47.96,-1.29,-2.619%,152264619038.00,Switzerland,2014,2381588,Finance,Major Banks +UBSI,United Bankshares Inc. Common Stock,$41.74,0.17,0.409%,5860988550.00,United States,,829495,Finance,Major Banks +UBXG,U-BX Technology Ltd. Class A Ordinary Shares,$2.00,-0.02,-0.99%,60568284.00,China,2024,6681,Technology,Computer Software: Programming Data Processing +UCAR,U Power Limited Class A Ordinary Shares,$1.60,-0.08,-4.762%,7954376.00,China,2023,9958,Consumer Discretionary,Auto Parts:O.E.M. +UCB,United Community Banks Inc. Common Stock,$34.23,0.22,0.647%,4160892892.00,United States,2024,1255930,Finance,Major Banks +UCL,uCloudlink Group Inc. American Depositary Shares,$1.58,0.0199,1.276%,59459578.00,Hong Kong,2020,20389,Consumer Discretionary,Telecommunications Equipment +UCTT,Ultra Clean Holdings Inc. Common Stock,$45.33,-0.38,-0.831%,2057396699.00,United States,2004,1113771,Technology,Semiconductors +UDMY,Udemy Inc. Common Stock,$4.89,0.01,0.205%,715782381.00,United States,2021,1431317,Real Estate,Other Consumer Services +UDR,UDR Inc. Common Stock,$36.43,-0.67,-1.806%,12039598423.00,United States,,4401476,Real Estate,Real Estate Investment Trusts +UE,Urban Edge Properties Common Shares of Beneficial Interest,$18.77,-0.40,-2.087%,2362273461.00,United States,2015,608410,Finance,Real Estate +UEC,Uranium Energy Corp. Common Stock,$20.14,0.94,4.896%,9735220876.00,Canada,,13865480,Basic Materials,Other Metals and Minerals +UEIC,Universal Electronics Inc. Common Stock,$4.05,0.03,0.746%,54132729.00,United States,1993,17595,Consumer Staples,Consumer Electronics/Appliances +UFCS,United Fire Group Inc. Common Stock,$34.91,0.10,0.287%,890705225.00,United States,,162831,Finance,Property-Casualty Insurers +UFG,Uni-Fuels Holdings Limited Class A Ordinary Shares,$1.25,0.01,0.806%,40581250.00,Singapore,2025,563737,Energy,Oil Refining/Marketing +UFI,Unifi Inc. New Common Stock,$3.94,0.06,1.546%,72341012.00,United States,,13264,Consumer Discretionary,Textiles +UFPI,UFP Industries Inc. Common Stock,$102.53,-0.78,-0.755%,5973113177.00,United States,1993,230604,Basic Materials,Forest Products +UFPT,UFP Technologies Inc. Common Stock,$243.90,-7.68,-3.053%,1881065092.00,United States,1993,164175,Health Care,Medical/Dental Instruments +UG,United-Guardian Inc. Common Stock,$6.64,0.01,0.151%,30506278.00,United States,,10221,Consumer Discretionary,Package Goods/Cosmetics +UGI,UGI Corporation Common Stock,$40.63,0.66,1.651%,8716269105.00,United States,,2990183,Utilities,Natural Gas Distribution +UGP,Ultrapar Participacoes S.A. (New) American Depositary Shares (Each representing one Common Share),$4.83,0.07,1.471%,5226410624.00,Brazil,,2390005,Utilities,Oil/Gas Transmission +UGRO,urban-gro Inc. Common Stock,$0.1925,-0.0074,-3.702%,3137905.00,United States,,388664,Consumer Discretionary,Industrial Specialties +UHAL,U-Haul Holding Company Common Stock,$56.17,-0.61,-1.074%,11013694520.00,United States,2022,200773,Consumer Discretionary,Rental/Leasing Companies +UHG,United Homes Group Inc Class A Common Stock,$2.04,-0.13,-5.991%,119979822.00,United States,2021,155985,Consumer Discretionary,Homebuilding +UHGWW,United Homes Group Inc. Warrant,$0.3649,-0.0351,-8.775%,21461097.00,United States,2021,8686,Consumer Discretionary,Homebuilding +UHS,Universal Health Services Inc. Common Stock,$203.02,0.38,0.188%,12685194308.00,United States,,949586,Health Care,Hospital/Nursing Management +UHT,Universal Health Realty Income Trust Common Stock,$38.20,-0.84,-2.152%,529972208.00,United States,,51237,Real Estate,Real Estate Investment Trusts +UI,Ubiquiti Inc. Common Stock,$554.74,8.06,1.474%,33561578615.00,United States,,84058,Technology,Radio And Television Broadcasting And Communications Equipment +UIS,Unisys Corporation New Common Stock,$2.74,-0.05,-1.792%,195378730.00,United States,,690382,Technology,EDP Services +UK,Ucommune International Ltd Ordinary Shares,$0.6993,-0.0001,-0.014%,1482427.00,United States,2019,6463,Real Estate,Real Estate +UL,Unilever PLC American Depositary Shares (each representing One Ordinary Share),$66.53,-1.03,-1.525%,148536900512.00,United Kingdom,2025,3167755,Consumer Discretionary,Package Goods/Cosmetics +ULBI,Ultralife Corporation Common Stock,$6.40,0.045,0.708%,106553261.00,United States,1992,73373,Miscellaneous,Industrial Machinery/Components +ULCC,Frontier Group Holdings Inc. Common Stock,$4.95,-0.01,-0.202%,1133307024.00,United States,2021,2517138,Consumer Discretionary,Air Freight/Delivery Services +ULH,Universal Logistics Holdings Inc. Common Stock,$15.41,-0.54,-3.386%,405746194.00,United States,2005,36037,Industrials,Trucking Freight/Courier Services +ULS,UL Solutions Inc. Class A Common Stock,$72.16,-0.25,-0.345%,14505042878.00,United States,2024,833926,Health Care,Precision Instruments +ULTA,Ulta Beauty Inc. Common Stock,$638.21,-13.09,-2.01%,28312381792.00,United States,2007,637530,Consumer Discretionary,Other Specialty Stores +ULY,Urgent.ly Inc. Common Stock,$2.18,-0.10,-4.386%,4776260.00,United States,,23831,Technology,EDP Services +UMAC,Unusual Machines Inc. Common Stock,$16.25,-0.04,-0.246%,599227671.00,United States,2024,2195812,Technology,Radio And Television Broadcasting And Communications Equipment +UMBF,UMB Financial Corporation Common Stock,$124.66,-0.20,-0.16%,9468507916.00,United States,,1238860,Finance,Major Banks +UMBFO,UMB Financial Corporation Depositary Shares Each Representing a 1/400th Interest in a Share of 7.750% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series B,$27.33,-0.04,-0.146%,2075840858.00,United States,,62102,Finance,Major Banks +UMC,United Microelectronics Corporation (NEW) Common Stock,$11.38,-1.10,-8.814%,28588190538.00,Taiwan,,25816702,Technology,Semiconductors +UMH,UMH Properties Inc. Common Stock,$15.34,-0.36,-2.293%,1307438478.00,United States,1994,626341,Real Estate,Real Estate Investment Trusts +UMH^D,UMH Properties Inc. 6.375% Series D Cumulative Redeemable Preferred Stock Liquidation Preference $25 per share,$22.4799,0.0299,0.133%,,United States,,18000,, +UNB,Union Bankshares Inc. Common Stock,$24.87,0.27,1.098%,113964860.00,United States,,8538,Finance,Major Banks +UNCY,Unicycive Therapeutics Inc. Common Stock,$7.02,-0.18,-2.50%,150869600.00,United States,2021,400474,Health Care,Biotechnology: Pharmaceutical Preparations +UNF,Unifirst Corporation Common Stock,$207.38,-2.23,-1.064%,3747881894.00,United States,,116170,Consumer Discretionary,Other Consumer Services +UNFI,United Natural Foods Inc. Common Stock,$37.41,-1.66,-4.249%,2279459274.00,United States,2019,1072612,Consumer Discretionary,Food Distributors +UNH,UnitedHealth Group Incorporated Common Stock (DE),$294.02,11.32,4.004%,266334671052.00,United States,,23396870,Health Care,Medical Specialities +UNIT,Uniti Group Inc. Common Stock,$7.35,0.04,0.547%,1756916989.00,United States,,2040905,Real Estate,Real Estate Investment Trusts +UNM,Unum Group Common Stock,$76.29,0.43,0.567%,12765702512.00,United States,,1009449,Finance,Accident &Health Insurance +UNMA,Unum Group 6.250% Junior Subordinated Notes due 2058,$23.56,-0.07,-0.296%,4012579934.00,United States,2018,9665,Finance,Accident &Health Insurance +UNP,Union Pacific Corporation Common Stock,$227.71,-4.84,-2.081%,135068666034.00,United States,,4248111,Industrials,Railroads +UNTY,Unity Bancorp Inc. Common Stock,$51.70,-0.60,-1.147%,519039255.00,United States,,42991,Finance,Major Banks +UOKA,MDJM LTD Class A Ordinary Shares,$1.24,-0.09,-6.767%,1325171.00,China,2019,48856,Finance,Real Estate +UONE,Urban One Inc. Class A Common Stock,$13.36,0.31,2.375%,60059199.00,United States,,18367,Consumer Discretionary,Broadcasting +UONEK,Urban One Inc. Class D Common Stock,$8.555,-0.21,-2.396%,38458566.00,United States,,2327,Consumer Discretionary,Broadcasting +UP,Wheels Up Experience Inc. Class A Common Stock,$0.693,-0.0382,-5.224%,500143546.00,Singapore,2020,2524926,Consumer Discretionary,Transportation Services +UPB,Upstream Bio Inc. Common Stock,$30.43,-2.07,-6.369%,1644394324.00,United States,2024,658138,Health Care,Biotechnology: Pharmaceutical Preparations +UPBD,Upbound Group Inc. Common Stock,$18.91,-0.40,-2.071%,1094997373.00,United States,,472429,Consumer Discretionary,Diversified Commercial Services +UPC,Universe Pharmaceuticals Inc. Ordinary Shares,$4.30,0.20,4.878%,2422353.00,China,2021,17002,Health Care,Biotechnology: Pharmaceutical Preparations +UPLD,Upland Software Inc. Common Stock,$1.44,0.00,0.00%,41603541.00,United States,2014,155454,Technology,Computer Software: Prepackaged Software +UPS,United Parcel Service Inc. Common Stock,$103.70,-3.50,-3.265%,87977586616.00,United States,1999,9254878,Industrials,Trucking Freight/Courier Services +UPST,Upstart Holdings Inc. Common stock,$43.165,-2.035,-4.502%,4199371082.00,United States,2020,3146740,Finance,Finance: Consumer Services +UPWK,Upwork Inc. Common Stock,$20.51,-0.79,-3.709%,2679731650.00,United States,2018,2132677,Technology,EDP Services +UPXI,Upexi Inc. Common Stock,$1.96,-0.02,-1.01%,123887843.00,United States,2021,2294182,Health Care, Medicinal Chemicals and Botanical Products +URBN,Urban Outfitters Inc. Common Stock,$69.61,-0.37,-0.529%,6242550944.00,United States,1993,1094145,Consumer Discretionary,Clothing/Shoe/Accessory Stores +URG,Ur Energy Inc Common Shares (Canada),$2.00,0.07,3.627%,752427252.00,Canada,,23910498,Basic Materials,Precious Metals +URGN,UroGen Pharma Ltd. Ordinary Shares,$21.32,-0.53,-2.426%,997965577.00,Israel,2017,651393,Health Care,Biotechnology: Pharmaceutical Preparations +URI,United Rentals Inc. Common Stock,$903.19,-4.26,-0.469%,57470112469.00,United States,1997,612475,Consumer Discretionary,Diversified Commercial Services +UROY,Uranium Royalty Corp. Common Stock,$5.46,0.34,6.641%,755405791.00,Canada,,7417756,Finance,Investment Bankers/Brokers/Service +USA,Liberty All-Star Equity Fund Common Stock,$6.10,-0.03,-0.489%,0.00,United States,1986,745870,Finance,Finance Companies +USAC,USA Compression Partners LP Common Units Representing Limited Partner Interests,$25.24,0.04,0.159%,3558473288.00,United States,2013,179095,Utilities,Natural Gas Distribution +USAR,USA Rare Earth Inc. Class A Common Stock,$25.18,-1.17,-4.44%,3339838966.00,United States,2023,37193197,Basic Materials,Metal Mining +USAS,Americas Gold and Silver Corporation Common Shares no par value,$9.23,-0.17,-1.809%,2525601236.00,Canada,2017,8047532,Basic Materials,Metal Mining +USAU,U.S. Gold Corp. Common Stock,$20.26,-1.31,-6.073%,291545493.00,United States,,572906,Basic Materials,Metal Mining +USB,U.S. Bancorp Common Stock,$55.74,-0.79,-1.397%,87012072004.00,United States,,7746650,Finance,Major Banks +USB^A,U.S. Bancorp Depositary Shares Each representing a 1/100th interest in a share of Series A Non-CumulativePerpetual Pfd Stock,$774.97,-1.05,-0.135%,,United States,,1786,, +USB^H,U.S. Bancorp Depositary Shares repstg 1/1000th Pfd Ser B,$19.00,0.01,0.053%,,United States,,52336,, +USB^P,U.S. Bancorp Depositary Shares each representing a 1/1000th interest in a share of Series K Non-Cumulative Perpetual Preferred Stock,$23.515,-0.085,-0.36%,,United States,,23038,, +USB^Q,U.S. Bancorp Depositary Shares Each Representing a 1/1000th Interest in a Share of Series L Non-Cumulative Perpetual Preferred Stock,$15.55,-0.0621,-0.398%,,United States,,21150,, +USB^R,U.S. Bancorp Depositary Shares Each Representing a 1/1000th Interest in a Share of Series M Non-Cumulative Perpetual Preferred Stock,$16.5337,-0.1063,-0.639%,,United States,,35658,, +USB^S,U.S. Bancorp Depositary Shares each representing a 1/1000th interest in a share of Series O Non-Cumulative Perpetual Preferred Stock,$18.69,-0.02,-0.107%,,United States,,21073,, +USBC,USBC Inc. Common Stock,$0.6109,-0.0502,-7.593%,237116974.00,,,2484241,Industrials,Industrial Machinery/Components +USCB,USCB Financial Holdings Inc. Class A Common Stock,$18.01,-0.99,-5.211%,326168034.00,United States,2021,89396,Finance,Major Banks +USEA,United Maritime Corporation Common Stock,$1.77,-0.08,-4.324%,15654353.00,Greece,,21994,Consumer Discretionary,Marine Transportation +USEG,U.S. Energy Corp. Common Stock (DE),$1.13,0.13,13.00%,67500244.00,United States,,1967331,Energy,Oil & Gas Production +USFD,US Foods Holding Corp. Common Stock,$83.79,0.12,0.143%,18680260911.00,United States,2016,2827167,Consumer Discretionary,Food Distributors +USGO,U.S. GoldMining Inc. Common stock,$14.83,0.08,0.542%,196841482.00,United States,2023,90253,Basic Materials,Precious Metals +USGOW,U.S. GoldMining Inc. Warrant,$2.43,-0.07,-2.80%,32253864.00,United States,2023,14462,Basic Materials,Precious Metals +USIO,Usio Inc. Common Stock,$1.38,0.01,0.73%,37684818.00,United States,,25777,Finance,Investment Bankers/Brokers/Service +USLM,United States Lime & Minerals Inc. Common Stock,$122.62,-3.72,-2.944%,3511763105.00,United States,,52843,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +USNA,USANA Health Sciences Inc. Common Stock,$21.37,-0.77,-3.478%,390661914.00,United States,,144438,Health Care, Medicinal Chemicals and Botanical Products +USPH,U.S. Physical Therapy Inc. Common Stock,$82.51,-0.52,-0.626%,1254491859.00,United States,1992,137376,Health Care,Medical/Nursing Services +UTF,Cohen & Steers Infrastructure Fund Inc Common Stock,$25.72,0.06,0.234%,0.00,United States,2004,308267,Finance,Finance Companies +UTG,Reaves Utility Income Fund Common Shares of Beneficial Interest,$38.15,0.35,0.926%,0.00,United States,2004,212706,Finance,Investment Managers +UTHR,United Therapeutics Corporation Common Stock,$467.30,-9.48,-1.988%,20120348713.00,United States,1999,274153,Health Care,Biotechnology: Pharmaceutical Preparations +UTI,Universal Technical Institute Inc Common Stock,$27.61,-0.09,-0.325%,1518995073.00,United States,2003,387990,Real Estate,Other Consumer Services +UTL,UNITIL Corporation Common Stock,$49.26,-0.74,-1.48%,882482703.00,United States,1985,66842,Utilities,Power Generation +UTMD,Utah Medical Products Inc. Common Stock,$60.84,-2.025,-3.221%,194911404.00,United States,,10042,Health Care,Medical/Dental Instruments +UTSI,UTStarcom Holdings Corp. Ordinary Shares,$2.49,-0.11,-4.231%,23580935.00,China,2000,1985,Telecommunications,Telecommunications Equipment +UTZ,Utz Brands Inc Class A Common Stock ,$10.25,-0.23,-2.195%,1464302434.00,United States,2018,981854,Consumer Staples,Packaged Foods +UUU,Universal Safety Products Inc. Common Stock,$5.02,0.12,2.449%,11610693.00,United States,2003,119571,Technology,Electronic Components +UUUU,Energy Fuels Inc Ordinary Shares (Canada),$27.72,3.56,14.735%,6577589209.00,Canada,,30181942,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +UVE,UNIVERSAL INSURANCE HOLDINGS INC Common Stock,$29.60,0.36,1.231%,830246878.00,United States,,156798,Finance,Property-Casualty Insurers +UVSP,Univest Financial Corporation Common Stock,$33.42,-0.07,-0.209%,951658328.00,United States,,198494,Finance,Major Banks +UVV,Universal Corporation Common Stock,$55.36,-0.45,-0.806%,1379635141.00,United States,,160426,Industrials,Farming/Seeds/Milling +UWMC,UWM Holdings Corporation Class A Common Stock,$5.89,0.03,0.512%,9423326950.00,United States,,12717324,Finance,Finance: Consumer Services +UXIN,Uxin Limited ADS,$3.39,-0.13,-3.693%,698913713.00,China,2018,410852,Real Estate,Real Estate +UYSC,UY Scuti Acquisition Corp. Ordinary Shares,$10.29,0.00,0.00%,0.00,United States,2025,629,Finance,Blank Checks +UYSCR,UY Scuti Acquisition Corp. Rights,$0.16,-0.0401,-20.04%,0.00,United States,2025,442,Finance,Blank Checks +UZD,Array Digital Infrastructure Inc. 6.250% Senior Notes due 2069,$21.01,-0.18,-0.849%,1806860000.00,United States,2020,3941,Telecommunications,Telecommunications Equipment +UZE,Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070,$18.47,-0.16,-0.859%,1588420000.00,United States,2020,8584,Telecommunications,Telecommunications Equipment +UZF,Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070,$18.60,-0.08,-0.428%,1599600000.00,United States,2021,6576,Telecommunications,Telecommunications Equipment +V,Visa Inc.,$326.98,1.72,0.529%,629673598757.00,United States,,8105960,Real Estate,Real Estate +VABK,Virginia National Bankshares Corporation Common Stock,$39.63,-0.76,-1.882%,213730099.00,United States,,3629,Finance,Major Banks +VAC,Marriott Vacations Worldwide Corporation Common Stock,$54.37,-0.85,-1.539%,1881962691.00,United States,,409150,Finance,Real Estate +VACH,Voyager Acquisition Corp Class A Ordinary Shares,$10.67,0.01,0.094%,0.00,United States,2024,1706,, +VACHW,Voyager Acquisition Corp Warrants,$0.23,-0.006,-2.542%,0.00,United States,2024,818,Finance,Blank Checks +VACI,Viking Acquisition Corp. I Class A Ordinary Shares,$10.01,-0.06,-0.596%,0.00,,2025,30195,Telecommunications,Telecommunications Equipment +VAL,Valaris Limited Common Shares,$56.88,-1.41,-2.419%,3957555573.00,United States,2021,1043871,Energy,Oil & Gas Production +VALE,VALE S.A. American Depositary Shares Each Representing one common share,$16.76,0.32,1.946%,71544732470.00,Brazil,,43600848,Basic Materials,Metal Mining +VALN,Valneva SE American Depositary Shares,$9.42,-0.20,-2.079%,765476378.00,France,2021,7101,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VALU,Value Line Inc. Common Stock,$37.315,0.315,0.851%,350383111.00,United States,1983,916,Finance,Investment Managers +VANI,Vivani Medical Inc. Common Stock (DE),$1.49,0.11,7.971%,116466638.00,United States,2014,1412746,Health Care,Biotechnology: Electromedical & Electrotherapeutic Apparatus +VATE,INNOVATE Corp. Common Stock,$5.54,0.03,0.544%,75649043.00,United States,,5713,Industrials,Metal Fabrications +VAVX,VanEck Avalanche ETF Common Shares of Beneficial Interest,$24.8502,-0.0794,-0.318%,0.00,United States,,4188,, +VBF,Invesco Bond Fund Common Stock,$15.40,0.02,0.13%,0.00,United States,,68923,Finance,Trusts Except Educational Religious and Charitable +VBIX,Viewbix Inc. Common Stock,$1.90,0.00,0.00%,20273745.00,Israel,,16723,Technology,Computer Software: Prepackaged Software +VBNK,VersaBank Common Shares,$15.58,-0.08,-0.511%,506642686.00,Canada,,35948,Finance,Commercial Banks +VC,Visteon Corporation Common Stock,$91.03,-2.60,-2.777%,2483837480.00,United States,,753321,Consumer Discretionary,Auto Parts:O.E.M. +VCEL,Vericel Corporation Common Stock,$36.20,-0.38,-1.039%,1830779741.00,United States,,456172,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VCIC,Vine Hill Capital Investment Corp. Class A Ordinary Shares,$10.665,0.015,0.141%,0.00,United States,2024,9693,, +VCICW,Vine Hill Capital Investment Corp. Warrant,$2.03,0.03,1.50%,0.00,United States,2024,13158,Finance,Blank Checks +VCIG,VCI Global Limited Ordinary Share,$0.5353,0.0041,0.772%,17192946.00,Malaysia,2023,1216416,Consumer Discretionary,Diversified Commercial Services +VCTR,Victory Capital Holdings Inc. Class A Common Stock,$69.38,0.52,0.755%,4505222145.00,United States,2018,854341,Finance,Investment Managers +VCV,Invesco California Value Municipal Income Trust Common Stock,$11.00,-0.03,-0.272%,526795775.00,United States,,76307,Finance,Trusts Except Educational Religious and Charitable +VCYT,Veracyte Inc. Common Stock,$38.48,-1.32,-3.317%,3041812177.00,United States,2013,748434,Health Care,Medical Specialities +VECO,Veeco Instruments Inc. Common Stock,$32.29,0.03,0.093%,1942647448.00,United States,1994,293593,Technology,Industrial Machinery/Components +VEEA,Veea Inc. Common Stock,$0.6301,-0.0403,-6.011%,31606240.00,United States,2021,103086,Finance,Blank Checks +VEEE,Twin Vee PowerCats Co. Common Stock,$1.363,-0.10,-6.835%,17505500.00,United States,2021,244472,Industrials,Marine Transportation +VEEV,Veeva Systems Inc. Class A Common Stock,$217.99,0.12,0.055%,35833600571.00,United States,2013,1857314,Technology,Computer Software: Prepackaged Software +VEL,Velocity Financial Inc. Common Stock,$20.22,0.07,0.347%,786558607.00,United States,2020,85660,Finance,Finance: Consumer Services +VELO,Velo3D Inc. Common stock,$16.63,2.63,18.786%,409391187.00,United States,,4010227,Technology,Industrial Machinery/Components +VENU,Venu Holding Corporation Common Stock,$5.14,-3.45,-40.163%,220236366.00,United States,2024,1463757,Consumer Discretionary,Services-Misc. Amusement & Recreation +VEON,VEON Ltd. ADS,$54.07,-0.04,-0.074%,3999429592.00,Netherlands,,72735,Telecommunications,Telecommunications Equipment +VERA,Vera Therapeutics Inc. Class A Common Stock,$45.11,-1.64,-3.508%,3477610060.00,United States,2021,1062680,Health Care,Biotechnology: Pharmaceutical Preparations +VERI,Veritone Inc. Common Stock,$3.83,-0.04,-1.034%,351617068.00,United States,2017,2194813,Technology,EDP Services +VERO,Venus Concept Inc. Common Stock,$1.32,-0.08,-5.714%,2454042.00,United States,2017,581229,Health Care,Medical/Dental Instruments +VERU,Veru Inc. Common Stock,$2.60,-0.08,-2.985%,41730832.00,United States,,61431,Health Care,Biotechnology: Pharmaceutical Preparations +VERX,Vertex Inc. Class A Common Stock,$19.77,0.44,2.276%,3153867848.00,United States,2020,1263174,Technology,Computer Software: Prepackaged Software +VET,Vermilion Energy Inc. Common (Canada),$9.69,0.00,0.00%,1486775460.00,Canada,,1717189,Energy,Oil & Gas Production +VFC,V.F. Corporation Common Stock,$19.11,-1.17,-5.769%,7466750125.00,United States,,20473418,Industrials,Garments and Clothing +VFF,Village Farms International Inc. Common Shares,$3.40,0.00,0.00%,392760404.00,Canada,,896101,, +VFL,abrdn National Municipal Income Fund Common Stock,$10.285,0.065,0.636%,0.00,United States,1993,51625,Finance,Finance/Investors Services +VFS,VinFast Auto Ltd. Ordinary Shares,$3.37,0.03,0.898%,7884157718.00,Singapore,,144398,Industrials,Auto Manufacturing +VFSWW,VinFast Auto Ltd. Warrant,$0.1333,0.0029,2.224%,311857040.00,Singapore,,3087,Industrials,Auto Manufacturing +VG,Venture Global Inc. Class A common stock,$9.51,0.60,6.734%,23281531768.00,United States,2025,11523745,Utilities,Oil/Gas Transmission +VGAS,Verde Clean Fuels Inc. Class A Common Stock,$2.22,-0.07,-3.057%,98900159.00,United States,2021,2169,Industrials,Major Chemicals +VGASW,Verde Clean Fuels Inc. Warrant,$0.0412,-0.0005,-1.199%,1835444.00,United States,2021,17689,Industrials,Major Chemicals +VGI,Virtus Global Multi-Sector Income Fund Common Shares of Beneficial Interest,$7.88,0.02,0.254%,0.00,United States,2012,57885,Finance,Investment Managers +VGM,Invesco Trust for Investment Grade Municipals Common Stock (DE),$10.26,0.01,0.098%,556419992.00,United States,,206015,Finance,Trusts Except Educational Religious and Charitable +VGZ,Vista Gold Corp Common Stock,$2.95,-0.02,-0.673%,372316869.00,United States,1986,2834479,Basic Materials,Precious Metals +VHC,VirnetX Holding Corp Common Stock,$19.33,-1.84,-8.692%,82555337.00,United States,,47225,Miscellaneous,Multi-Sector Companies +VHCPU,Vine Hill Capital Investment Corp. II Units,$10.06,0.01,0.10%,0.00,United States,2025,2774,Finance,Blank Checks +VHI,Valhi Inc. Common Stock,$14.21,-0.24,-1.661%,402175584.00,United States,,34109,Basic Materials,Major Chemicals +VIA,Via Transportation Inc. Class A Common Stock,$25.22,-0.55,-2.134%,2042588480.00,,2025,338808,Technology,Computer Software: Prepackaged Software +VIASP,Via Renewables Inc. 8.75% Series A Fixed-to-Floating Rate Cumulative Redeemable Perpetual Preferred Stock,$25.5006,-0.0444,-0.174%,186749283.00,United States,,1853,Utilities,Power Generation +VIAV,Viavi Solutions Inc. Common Stock,$21.03,0.33,1.594%,4693871963.00,United States,,9101284,Technology,Semiconductors +VICI,VICI Properties Inc. Common Stock,$27.89,-0.61,-2.14%,29809149137.00,United States,2018,9103477,Real Estate,Real Estate Investment Trusts +VICR,Vicor Corporation Common Stock,$166.51,2.485,1.515%,7435109754.00,United States,,318859,Technology,Industrial Machinery/Components +VIK,Viking Holdings Ltd Ordinary Shares,$69.63,0.53,0.767%,30842645682.00,United States,2024,2500333,Consumer Discretionary,Marine Transportation +VINP,Vinci Compass Investments Ltd. Class A Common Shares,$12.99,0.05,0.386%,821548120.00,Brazil,2021,39012,Finance,Investment Managers +VIOT,Viomi Technology Co. Ltd American Depositary Shares,$1.34,-0.03,-2.19%,91071052.00,China,2018,1273426,Consumer Discretionary,Consumer Electronics/Appliances +VIPS,Vipshop Holdings Limited American Depositary Shares each representing two ordinary shares,$17.67,0.05,0.284%,10472745805.00,China,2012,2075986,Consumer Discretionary,Catalog/Specialty Distribution +VIR,Vir Biotechnology Inc. Common Stock,$7.57,-0.12,-1.56%,1053176492.00,United States,2019,2115045,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VIRC,Virco Manufacturing Corporation Common Stock,$6.35,0.00,0.00%,100083245.00,United States,,57624,Consumer Discretionary,Industrial Specialties +VIRT,Virtu Financial Inc. Class A Common Stock,$37.49,-0.15,-0.399%,5734793864.00,United States,,1791932,Finance,Investment Bankers/Brokers/Service +VISN,Vistance Networks Inc. Common Stock,$18.79,0.53,2.903%,4162900205.00,United States,2013,3189091,Technology,Radio And Television Broadcasting And Communications Equipment +VIST,Vista Energy S.A.B. de C.V. American Depositary Shares each representing one series A share with no par value,$59.44,1.97,3.428%,5663767326.00,Mexico,2019,1431228,Energy,Oil & Gas Production +VITL,Vital Farms Inc. Common Stock,$27.21,-0.59,-2.122%,1218314689.00,United States,2020,1370085,Consumer Staples,Packaged Foods +VIV,Telefonica Brasil S.A. American Depositary Shares (Each representing One Common Share),$14.53,0.24,1.679%,23635698236.00,Brazil,2020,671374,Telecommunications,Telecommunications Equipment +VIVS,VivoSim Labs Inc. Common Stock,$1.73,-0.07,-3.889%,4511774.00,United States,,21517,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VKI,Invesco Advantage Municipal Income Trust II Common Shares of Beneficial Interest (DE),$8.90,0.01,0.112%,395213578.00,United States,1993,137191,Finance,Finance Companies +VKQ,Invesco Municipal Trust Common Stock,$9.70,0.08,0.832%,536754496.00,United States,,333797,Finance,Trusts Except Educational Religious and Charitable +VKTX,Viking Therapeutics Inc. Common Stock,$30.41,-0.99,-3.153%,3437435221.00,United States,2015,2902087,Health Care,Biotechnology: Pharmaceutical Preparations +VLGEA,Village Super Market Inc. Class A Common Stock,$33.97,-0.86,-2.469%,501175376.00,United States,,51053,Consumer Staples,Food Chains +VLN,Valens Semiconductor Ltd. Ordinary Shares,$1.77,-0.07,-3.804%,187122032.00,,,1308568,Technology,Semiconductors +VLO,Valero Energy Corporation Common Stock,$184.02,1.11,0.607%,56127855367.00,United States,,2756661,Energy,Integrated oil Companies +VLRS,Controladora Vuela Compania de Aviacion S.A.B. de C.V. American Depositary Shares each representing ten (10) Ordinary Participation Certificates,$9.59,0.00,0.00%,1118171636.00,,2013,593354,Consumer Discretionary,Air Freight/Delivery Services +VLT,Invesco High Income Trust II,$11.16,0.04,0.36%,0.00,United States,1989,20049,Finance,Trusts Except Educational Religious and Charitable +VLTO,Veralto Corp Common Stock ,$98.72,-1.84,-1.83%,24511913898.00,United States,2023,1980241,Industrials,Electrical Products +VLY,Valley National Bancorp Common Stock,$12.27,-0.02,-0.163%,6842188297.00,United States,,11453823,Finance,Major Banks +VLYPN,Valley National Bancorp 8.250% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series C,$26.32,0.02,0.076%,14676967887.00,United States,,5289,Finance,Major Banks +VLYPO,Valley National Bancorp 5.50% Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series B,$25.07,0.00,0.00%,13979923439.00,United States,,514,Finance,Major Banks +VLYPP,Valley National Bancorp 6.25% Fixed-to-Floating Rate Non-Cumulative Perpetual Preferred Stock Series A,$25.17,-0.05,-0.198%,14035686995.00,United States,,13728,Finance,Major Banks +VMAR,Vision Marine Technologies Inc. Common Shares,$3.73,-0.345,-8.466%,3715222.00,Canada,2020,83974,Industrials,Marine Transportation +VMC,Vulcan Materials Company (Holding Company) Common Stock,$299.73,1.06,0.355%,39603596156.00,United States,,697591,Industrials,Mining & Quarrying of Nonmetallic Minerals (No Fuels) +VMD,Viemed Healthcare Inc. Common Shares,$7.38,-0.07,-0.94%,280572154.00,United States,,141122,Health Care,Misc Health and Biotechnology Services +VMI,Valmont Industries Inc. Common Stock,$444.94,-1.82,-0.407%,8765157377.00,United States,,106892,Industrials,Metal Fabrications +VMO,Invesco Municipal Opportunity Trust Common Stock,$9.73,0.06,0.62%,656197865.00,United States,,227356,Finance,Trusts Except Educational Religious and Charitable +VNCE,Vince Holding Corp. Common Stock,$2.69,0.09,3.462%,35883056.00,United States,,81599,Consumer Discretionary,Clothing/Shoe/Accessory Stores +VNDA,Vanda Pharmaceuticals Inc. Common Stock,$7.69,-0.33,-4.115%,454453085.00,United States,2006,941435,Health Care,Biotechnology: Pharmaceutical Preparations +VNET,VNET Group Inc. American Depositary Shares,$11.29,-0.05,-0.441%,3037302422.00,China,2011,3696059,Technology,Computer Software: Programming Data Processing +VNME,Vendome Acquisition Corporation I Class A Ordinary Shares,$10.09,0.00,0.00%,0.00,United States,2025,10,Finance,Blank Checks +VNO,Vornado Realty Trust Common Stock,$31.20,-0.89,-2.773%,5992110758.00,United States,,1333099,Real Estate,Real Estate Investment Trusts +VNO^L,Vornado Realty Trust Pfd Ser L %,$18.23,-0.01,-0.055%,,United States,,2024,, +VNO^M,Vornado Realty Trust 5.25% Series M Cumulative Redeemable Preferred Shares of Beneficial Interest liquidation preference $25.00 per share no par value per share,$17.56,-0.055,-0.312%,,United States,,6135,, +VNO^N,Vornado Realty Trust 5.25% Series N Cumulative Redeemable Preferred Shares of Beneficial Interest liquidation preference $25.00 per share,$17.60,-0.01,-0.057%,,United States,,3276,, +VNO^O,Vornado Realty Trust 4.45% Series O Cumulative Redeemable Preferred Shares Liquidation Preference $25.00 Per Share,$14.91,0.0158,0.106%,,United States,,7588,, +VNOM,Viper Energy Inc. Class A Common Stock,$41.22,0.92,2.283%,14818962917.00,United States,2014,2824086,Energy,Oil & Gas Production +VNRX,VolitionRX Limited Common Stock,$0.26,-0.0065,-2.439%,34058333.00,Singapore,2015,1161431,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +VNT,Vontier Corporation Common Stock ,$36.90,-0.10,-0.27%,5354190000.00,United States,2020,689104,Industrials,Industrial Machinery/Components +VNTG,Vantage Corp Class A Ordinary Shares,$0.87,0.01,1.163%,27611625.00,,2025,24980,Industrials,Integrated Freight & Logistics +VOC,VOC Energy Trust Units of Beneficial Interest,$3.10,0.01,0.324%,52700000.00,United States,2011,88859,Energy,Oil & Gas Production +VOD,Vodafone Group Plc American Depositary Shares,$14.57,0.07,0.483%,34616875210.00,United Kingdom,,3497081,Telecommunications,Telecommunications Equipment +VOR,Vor Biopharma Inc. Common Stock,$13.74,-1.02,-6.911%,301052056.00,United States,2021,619318,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VOXR,Vox Royalty Corp. Common Stock,$5.73,0.15,2.688%,391180935.00,Canada,,1470312,Basic Materials,Precious Metals +VOYA,Voya Financial Inc. Common Stock,$75.80,-0.31,-0.407%,7213349639.00,United States,2013,616475,Finance,Life Insurance +VOYA^B,Voya Financial Inc. Depositary Shares each representing a 1/40th interest in a share of 5.35% Fixed-Rate Reset Non-Cumulative Preferred Stock Series B,$24.56,0.02,0.081%,,United States,,13546,, +VOYG,Voyager Technologies Inc. Class A Common Stock,$34.96,-0.11,-0.314%,2081790424.00,United States,2025,1079714,Industrials,Military/Government/Technical +VPG,Vishay Precision Group Inc. Common Stock,$44.37,-0.61,-1.356%,589192957.00,United States,,330064,Technology,Electrical Products +VPV,Invesco Pennsylvania Value Municipal Income Trust Common Stock (DE),$10.59,0.06,0.57%,252354871.00,United States,,18003,Finance,Trusts Except Educational Religious and Charitable +VRA,Vera Bradley Inc. Common Stock,$2.36,0.005,0.212%,65973852.00,United States,2010,234493,Consumer Discretionary,Apparel +VRAR,The Glimpse Group Inc. Common Stock,$1.02,-0.06,-5.556%,21498036.00,United States,2021,123425,Technology,EDP Services +VRAX,Virax Biolabs Group Limited Ordinary Shares,$0.2898,0.0098,3.50%,2151311.00,United Kingdom,2022,116916,Health Care,Biotechnology: In Vitro & In Vivo Diagnostic Substances +VRCA,Verrica Pharmaceuticals Inc. Common Stock,$7.18,-0.13,-1.778%,114807202.00,United States,2018,52921,Health Care,Biotechnology: Pharmaceutical Preparations +VRDN,Viridian Therapeutics Inc. Common Stock,$33.62,0.08,0.239%,3208760309.00,United States,2014,1314374,Health Care,Medical Specialities +VRE,Veris Residential Inc. Common Stock,$14.76,-0.20,-1.337%,1378973295.00,United States,,696067,Real Estate,Real Estate Investment Trusts +VREX,Varex Imaging Corporation Common Stock,$13.98,-0.10,-0.71%,586033659.00,United States,,233648,Technology,Industrial Machinery/Components +VRM,Vroom Inc. Common Stock,$19.38,-0.27,-1.374%,100768636.00,United States,,1151,Consumer Discretionary,Retail-Auto Dealers and Gas Stations +VRME,VerifyMe Inc. Common Stock,$1.22,0.02,1.667%,15180666.00,United States,,204879,Technology,EDP Services +VRNS,Varonis Systems Inc. Common Stock,$33.41,-0.80,-2.338%,3938949060.00,United States,2014,2439189,Technology,Computer Software: Prepackaged Software +VRRM,Verra Mobility Corporation Class A Common Stock,$19.84,-0.19,-0.949%,3165758628.00,United States,2017,848496,Consumer Discretionary,Transportation Services +VRSK,Verisk Analytics Inc. Common Stock,$219.03,2.75,1.271%,30526774007.00,United States,2009,1190783,Industrials,Diversified Commercial Services +VRSN,VeriSign Inc. Common Stock,$253.50,3.87,1.55%,23499450000.00,United States,1998,562087,Technology,EDP Services +VRT,Vertiv Holdings LLC Class A Common Stock,$193.76,4.55,2.405%,74081871527.00,United States,2018,4935707,Technology,Industrial Machinery/Components +VRTS,Virtus Investment Partners Inc. Common Stock,$166.25,-2.81,-1.662%,1122919831.00,United States,,77072,Finance,Investment Managers +VRTX,Vertex Pharmaceuticals Incorporated Common Stock,$477.91,3.74,0.789%,121254766523.00,United States,1991,1089266,Health Care,Biotechnology: Pharmaceutical Preparations +VS,Versus Systems Inc. Common Stock,$1.24,-0.02,-1.587%,6078079.00,Canada,,11583,Technology,EDP Services +VSA,VisionSys AI Inc. American Depositary Shares,$2.34,-0.13,-5.263%,2601095.00,China,2014,21298,Real Estate,Other Consumer Services +VSAT,ViaSat Inc. Common Stock,$47.58,2.54,5.639%,6435859597.00,United States,1996,2275919,Technology,Radio And Television Broadcasting And Communications Equipment +VSCO,Victorias Secret & Co. Common Stock ,$56.44,0.55,0.984%,4530378071.00,United States,2021,1979108,Consumer Discretionary,Clothing/Shoe/Accessory Stores +VSEC,VSE Corporation Common Stock,$206.02,-5.46,-2.582%,4261804093.00,United States,,225430,Consumer Discretionary,Military/Government/Technical +VSEE,VSee Health Inc. Common Stock,$0.3674,-0.0176,-4.571%,13511578.00,United States,2021,588973,Health Care,Medical/Nursing Services +VSEEW,VSee Health Inc. Warrant,$0.0501,-0.0007,-1.378%,1842488.00,United States,2021,920,Health Care,Medical/Nursing Services +VSH,Vishay Intertechnology Inc. Common Stock,$19.27,0.79,4.275%,2612788372.00,United States,,4022029,Technology,Electrical Products +VSME,VS Media Holdings Limited Class A Ordinary Shares,$1.74,-0.21,-10.769%,4786190.00,China,2023,450214,Consumer Discretionary,Publishing +VSNT,Versant Media Group Inc. Class A Common Stock ,$33.59,0.42,1.266%,4854762700.00,United States,,3515898,Industrials,Broadcasting +VST,Vistra Corp. Common Stock,$165.64,1.38,0.84%,56123054164.00,United States,,4263822,Utilities,Electric Utilities: Central +VSTD,Vestand Inc. Class A Common Stock,$0.34,-0.005,-1.449%,4836493.00,United States,2022,105461,Consumer Discretionary,Restaurants +VSTM,Verastem Inc. Common Stock,$6.23,-0.27,-4.154%,416014517.00,United States,2012,1290787,Health Care,Biotechnology: Pharmaceutical Preparations +VSTS,Vestis Corporation Common Stock,$6.32,-0.43,-6.37%,833917288.00,United States,2023,2871808,Consumer Discretionary,Consumer Specialties +VTAK,Catheter Precision Inc. Common Stock,$2.09,-0.03,-1.415%,3486904.00,,2018,17878,Health Care,Medical/Dental Instruments +VTEX,VTEX Class A Common Shares,$3.41,0.03,0.888%,649140067.00,United Kingdom,2021,612062,Technology,Computer Software: Prepackaged Software +VTGN,Vistagen Therapeutics Inc. Common Stock,$0.5857,-0.0225,-3.699%,23132486.00,United States,,1053792,Health Care,Biotechnology: Pharmaceutical Preparations +VTIX,Virtuix Holdings Inc. Class A Common Stock,$10.67,-13.72,-56.253%,329195716.00,United States,,1284412,Technology,Computer peripheral equipment +VTMX,Corporacion Inmobiliaria Vesta S.A.B de C.V. American Depositary Shares each representing ten (10) Common Shares,$32.13,-0.22,-0.68%,2841854932.00,,2023,43877,Finance,Real Estate +VTN,Invesco Trust for Investment Grade New York Municipals Common Stock,$11.47,0.04,0.35%,223504179.00,United States,,54868,Finance,Finance Companies +VTOL,Bristow Group Inc. Common Stock,$44.15,-0.85,-1.889%,1276818000.00,United States,,219376,Consumer Discretionary,Transportation Services +VTR,Ventas Inc. Common Stock,$75.92,-0.03,-0.039%,35662115998.00,United States,,3057717,Real Estate,Real Estate Investment Trusts +VTRS,Viatris Inc. Common Stock,$12.97,-0.15,-1.143%,14938455240.00,United States,,5884306,Health Care,Biotechnology: Pharmaceutical Preparations +VTS,Vitesse Energy Inc. Common Stock,$20.31,-0.10,-0.49%,785461466.00,United States,2023,276613,Energy,Oil & Gas Production +VTSI,VirTra Inc. Common Stock,$4.78,-0.16,-3.239%,54016901.00,United States,,17529,Consumer Discretionary,Miscellaneous manufacturing industries +VTVT,vTv Therapeutics Inc. Class A Common Stock,$34.04,0.03,0.088%,134058336.00,United States,2015,2831,Health Care,Biotechnology: Pharmaceutical Preparations +VTYX,Ventyx Biosciences Inc. Common Stock,$13.97,-0.02,-0.143%,996880173.00,United States,2021,1255579,Health Care,Biotechnology: Pharmaceutical Preparations +VUZI,Vuzix Corporation Common Stock,$2.62,-0.27,-9.343%,209931393.00,United States,,1606882,Technology,Radio And Television Broadcasting And Communications Equipment +VVOS,Vivos Therapeutics Inc. Common Stock,$1.71,-0.08,-4.469%,16138617.00,United States,2020,128451,Health Care,Medical/Dental Instruments +VVPR,VivoPower International PLC Ordinary Shares,$2.23,-0.02,-0.889%,37353046.00,United Kingdom,,172383,Utilities,Power Generation +VVR,Invesco Senior Income Trust Common Stock (DE),$3.31,0.01,0.303%,0.00,United States,1998,325645,Finance,Trusts Except Educational Religious and Charitable +VVV,Valvoline Inc. Common Stock,$32.84,-0.36,-1.084%,4175858014.00,United States,2016,2024941,Industrials,Major Chemicals +VVX,V2X Inc. Common Stock,$67.90,-0.89,-1.294%,2141232136.00,United States,2014,359732,Consumer Discretionary,Diversified Commercial Services +VWAV,VisionWave Holdings Inc. Common Stock,$10.62,0.23,2.214%,207762777.00,United States,,215278,Technology,Computer Software: Prepackaged Software +VWAVW,VisionWave Holdings Inc. Warrant,$2.48,0.08,3.333%,48517108.00,United States,,31621,Technology,Computer Software: Prepackaged Software +VYGR,Voyager Therapeutics Inc. Common Stock,$3.97,0.03,0.761%,314118004.00,United States,2015,765622,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +VYNE,VYNE Therapeutics Inc. Common Stock,$0.5648,-0.0052,-0.912%,18800171.00,United States,2018,305639,Health Care,Biotechnology: Pharmaceutical Preparations +VYX,NCR Voyix Corporation Common Stock,$9.97,-0.13,-1.287%,1380820304.00,United States,,1391096,Miscellaneous,Office Equipment/Supplies/Services +VZ,Verizon Communications Inc. Common Stock,$39.41,0.09,0.229%,166169328521.00,United States,,24412505,Telecommunications,Telecommunications Equipment +VZLA,Vizsla Silver Corp. Common Shares,$6.86,0.20,3.003%,2360486164.00,Canada,2024,8711553,Basic Materials,Precious Metals +W,Wayfair Inc. Class A Common Stock,$108.69,-2.46,-2.213%,14166446024.00,United States,2014,1925221,Consumer Discretionary,Catalog/Specialty Distribution +WAB,Westinghouse Air Brake Technologies Corporation Common Stock,$228.89,-2.83,-1.221%,39130390304.00,United States,,532938,Industrials,Railroads +WABC,Westamerica Bancorporation Common Stock,$49.96,-0.13,-0.26%,1245655228.00,United States,,175842,Finance,Major Banks +WAFD,WaFd Inc. Common Stock,$31.95,-0.07,-0.219%,2450597014.00,United States,,557433,Finance,Major Banks +WAFDP,WaFd Inc. Depositary Shares,$16.52,-0.04,-0.242%,1267100553.00,United States,,12266,Finance,Major Banks +WAFU,Wah Fu Education Group Limited Ordinary Shares,$1.695,0.035,2.108%,7475898.00,China,2019,1883,Real Estate,Other Consumer Services +WAI,Top KingWin Ltd Class A Ordinary Shares,$2.40,0.06,2.564%,3974695.00,China,2023,10354,Real Estate,Real Estate +WAL,Western Alliance Bancorporation Common Stock (DE),$88.68,-0.77,-0.861%,9759559190.00,United States,2005,1178958,Finance,Major Banks +WAL^A,Western Alliance Bancorporation Depositary Shares Each Representing a 1/400th Interest in a Share of 4.250% Fixed-Rate Non-Cumulative Perpetual Preferred Stock Series A,$23.37,0.28,1.213%,,United States,,43749,, +WALD,Waldencast plc Class A Ordinary Share,$1.575,-0.095,-5.689%,201664910.00,United States,2021,48895,Consumer Discretionary,Package Goods/Cosmetics +WALDW,Waldencast plc Warrant ,$0.039,-0.0049,-11.162%,4993607.00,United States,2021,700,Consumer Discretionary,Package Goods/Cosmetics +WASH,Washington Trust Bancorp Inc. Common Stock,$30.19,-0.13,-0.429%,574664688.00,United States,,129629,Finance,Major Banks +WAT,Waters Corporation Common Stock,$385.03,-5.06,-1.297%,22927642460.00,United States,1995,382817,Industrials,Biotechnology: Laboratory Analytical Instruments +WATT,Energous Corporation Common Stock,$6.99,0.09,1.304%,15204208.00,United States,2014,350319,Technology,Radio And Television Broadcasting And Communications Equipment +WAVE,Eco Wave Power Global AB (publ) American Depositary Shares,$5.165,-0.045,-0.864%,241380304.00,Israel,2021,12170,Utilities,Electric Utilities: Central +WAY,Waystar Holding Corp. Common Stock,$27.62,-0.60,-2.126%,5284164022.00,United States,2024,3068137,Technology,EDP Services +WB,Weibo Corporation American Depositary Share,$10.91,0.07,0.646%,2671043805.00,China,2014,862718,Technology,Computer Software: Programming Data Processing +WBD,Warner Bros. Discovery Inc. Series A Common Stock ,$27.98,-0.09,-0.321%,69333726762.00,United States,,17167019,Consumer Discretionary,Services-Misc. Amusement & Recreation +WBI,WaterBridge Infrastructure LLC Class A Shares Representing Limited Liability Company Interests,$22.06,-0.02,-0.091%,2723417300.00,,2025,466872,Energy,Oilfield Services/Equipment +WBS,Webster Financial Corporation Common Stock,$64.53,0.28,0.436%,10408063124.00,United States,,1667714,Finance,Major Banks +WBS^F,Webster Financial Corporation Depositary Shares Each Representing 1/1000th Interest in a Share of 5.25% Series F Non-Cumulative Perpetual Preferred Stock,$19.53,0.00,0.00%,,United States,,5731,, +WBS^G,Webster Financial Corporation Depositary Shares each representing a 1/40th interest in a share of 6.50% Series G non-cumulative perpetual preferred stock,$23.995,-0.01,-0.042%,,United States,,13756,, +WBTN,WEBTOON Entertainment Inc. Common stock,$12.74,-0.09,-0.701%,1699929196.00,United States,2024,173862,Consumer Discretionary,Publishing +WBUY,WEBUY GLOBAL LTD. Class A Ordinary Shares,$1.76,0.32,22.222%,3600168.00,Singapore,2023,8839032,Consumer Discretionary,Other Specialty Stores +WBX,Wallbox N.V. Class A Ordinary Shares,$2.97,-0.02,-0.669%,48494145.00,Spain,,20189,Consumer Discretionary,Industrial Specialties +WCC,WESCO International Inc. Common Stock,$291.30,3.49,1.213%,14170646799.00,United States,1999,317261,Consumer Discretionary,Telecommunications Equipment +WCN,Waste Connections Inc. Common Shares,$169.36,-0.20,-0.118%,43623803165.00,Canada,,1320802,Utilities,Environmental Services +WCT,Wellchange Holdings Company Limited Class A Ordinary shares,$0.1559,-0.0081,-4.939%,23894014.00,Hong Kong,2024,148039,Technology,Computer Software: Prepackaged Software +WD,Walker & Dunlop Inc Common Stock,$64.22,0.60,0.943%,2187604979.00,United States,2010,276041,Finance,Finance: Consumer Services +WDAY,Workday Inc. Class A Common Stock,$189.12,0.54,0.286%,49738560000.00,United States,,3793751,Technology,EDP Services +WDC,Western Digital Corporation Common Stock,$279.70,27.04,10.702%,95629228896.00,United States,,16090469,Technology,Electronic Components +WDFC,WD-40 Company Common Stock,$219.19,-0.175,-0.08%,2956062535.00,United States,1973,102598,Industrials,Major Chemicals +WDH,Waterdrop Inc. American Depositary Shares (each representing the right to receive 10 Class A Ordinary Shares),$1.71,0.04,2.395%,618442892.00,Cayman Islands,2021,229071,Finance,Specialty Insurers +WDI,Western Asset Diversified Income Fund Common Shares of Beneficial Interest,$13.81,0.06,0.436%,0.00,United States,2021,275292,Finance,Trusts Except Educational Religious and Charitable +WDS,Woodside Energy Group Limited American Depositary Shares each representing one Ordinary Share,$17.42,0.07,0.403%,33076221011.00,Australia,2022,671014,Energy,Oil & Gas Production +WEA,Western Asset Bond Fund Share of Beneficial Interest,$11.04,-0.06,-0.541%,0.00,United States,2002,20792,Finance,Trusts Except Educational Religious and Charitable +WEAV,Weave Communications Inc. Common Stock,$6.63,-0.35,-5.014%,517310769.00,United States,2021,1546471,Technology,Computer Software: Prepackaged Software +WEC,WEC Energy Group Inc. Common Stock,$110.04,-0.31,-0.281%,35795379490.00,United States,,1727981,Utilities,Power Generation +WELL,Welltower Inc. Common Stock,$183.94,0.45,0.245%,126243180229.00,United States,,2419641,Real Estate,Real Estate Investment Trusts +WEN,Wendy's Company (The) Common Stock,$7.94,-0.04,-0.501%,1511297861.00,United States,,6561031,Consumer Discretionary,Restaurants +WENN,Wen Acquisition Corp Class A Ordinary Shares,$10.17,0.00,0.00%,0.00,United States,2025,1502,, +WENNU,Wen Acquisition Corp Unit,$10.35,0.00,0.00%,0.00,United States,2025,438,Finance,Blank Checks +WENNW,Wen Acquisition Corp Warrant,$0.43,0.00,0.00%,0.00,United States,2025,22,Finance,Blank Checks +WERN,Werner Enterprises Inc. Common Stock,$34.33,1.32,3.999%,2053974783.00,United States,1986,1763231,Industrials,Trucking Freight/Courier Services +WES,Western Midstream Partners LP Common Units Representing Limited Partner Interests,$41.11,0.14,0.342%,16772704255.00,United States,2012,1584056,Utilities,Natural Gas Distribution +WEST,Westrock Coffee Company Common Stock,$4.61,0.01,0.217%,446362835.00,United States,,257388,Consumer Staples,Beverages (Production/Distribution) +WETH,Wetouch Technology Inc. Common Stock,$1.84,0.12,6.977%,21954023.00,China,,34447,Technology,Computer peripheral equipment +WETO,Webus International Limited Ordinary Shares,$0.66,0.019,2.964%,14520000.00,China,2025,6150,Industrials,Other Transportation +WEX,WEX Inc. common stock,$154.68,-2.02,-1.289%,5303749047.00,United States,,223987,Real Estate,Real Estate +WEYS,Weyco Group Inc. Common Stock,$30.13,-0.37,-1.213%,287692930.00,United States,,11020,Consumer Staples,Apparel +WF,Woori Financial Group Inc. American Depositary Shares (each representing three (3) shares of Common Stock),$62.99,-1.87,-2.883%,15564567717.00,South Korea,,87358,Finance,Commercial Banks +WFC,Wells Fargo & Company Common Stock,$88.03,-0.68,-0.767%,276333612232.00,United States,,16395695,Finance,Major Banks +WFC^A,Wells Fargo & Company Depositary Shares each representing a 1/1000th interest in a share of Non-Cumulative Perpetual Class A Preferred Stock Series AA,$19.47,-0.09,-0.46%,,United States,,52204,, +WFC^C,Wells Fargo & Company Depositary Shares each representing a 1/1000th interest in a share of Non-Cumulative Perpetual Class A Preferred Stock Series CC,$18.35,-0.07,-0.38%,,United States,,37781,, +WFC^D,Wells Fargo & Company Depositary Shares each representing a 1/1000th interest in a share of Non-Cumulative Perpetual Class A Preferred Stock Series DD,$17.86,-0.1209,-0.672%,,United States,,55190,, +WFC^L,Wells Fargo & Company 7.50% Non-Cumulative Perpetual Convertible Class A Preferred Stock Series L,$1243.93,1.93,0.155%,,United States,,7297,, +WFC^Y,Wells Fargo & Company Depositary Shares each representing a 1/1000th interest in a share of Non-Cumulative Perpetual Class A Preferred Stock Series Y,$24.39,-0.08,-0.327%,,United States,,39502,, +WFC^Z,Wells Fargo & Company Depositary Shares each representing a 1/1000th interest in a share of Non-Cumulative Perpetual Class A Preferred Stock Series Z,$19.75,-0.10,-0.504%,,United States,,94809,, +WFCF,Where Food Comes From Inc. Common Stock,$11.30,0.10,0.893%,57764979.00,United States,,321,Technology,Computer Software: Prepackaged Software +WFF,WF Holding Limited Ordinary Shares,$0.5054,0.0854,20.333%,12609730.00,Malaysia,2025,1010497,Consumer Discretionary,Miscellaneous manufacturing industries +WFG,West Fraser Timber Co. Ltd Common stock,$70.77,0.51,0.726%,5545072736.00,,2021,254491,Basic Materials,Forest Products +WFRD,Weatherford International plc Ordinary Shares,$91.44,-1.82,-1.952%,6558994218.00,United States,,1369377,Consumer Discretionary,Oil and Gas Field Machinery +WGO,Winnebago Industries Inc. Common Stock,$46.11,-0.70,-1.495%,1301253065.00,United States,,509243,Industrials,Homebuilding +WGRX,Wellgistics Health Inc. Common Stock,$0.3767,-0.0159,-4.05%,33801020.00,United States,2025,229395,Health Care,Other Pharmaceuticals +WGS,GeneDx Holdings Corp. Class A Common Stock,$95.29,-0.72,-0.75%,2754318381.00,United States,2020,738316,Technology,Retail: Computer Software & Peripheral Equipment +WGSWW,GeneDx Holdings Corp. Warrant,$0.0188,-0.0011,-5.528%,543406.00,United States,2020,550,Technology,Retail: Computer Software & Peripheral Equipment +WH,Wyndham Hotels & Resorts Inc. Common Stock ,$72.80,-3.55,-4.65%,5500181596.00,United States,2018,2971242,Consumer Discretionary,Hotels/Resorts +WHD,Cactus Inc. Class A Common Stock,$54.80,-1.65,-2.923%,4375641027.00,United States,2018,1008919,Consumer Discretionary,Oil and Gas Field Machinery +WHF,WhiteHorse Finance Inc. Common Stock,$6.82,-0.02,-0.292%,158517860.00,United States,,166569,Finance,Finance Companies +WHFCL,WhiteHorse Finance Inc. 7.875% Notes due 2028,$25.404,0.00,0.00%,590467408.00,United States,,199,, +WHG,Westwood Holdings Group Inc Common Stock,$17.44,-0.53,-2.949%,164077787.00,United States,,10228,Finance,Investment Managers +WHLR,Wheeler Real Estate Investment Trust Inc. Common Stock,$5.32,-0.03,-0.561%,3696645.00,United States,2012,40683,Real Estate,Real Estate Investment Trusts +WHLRD,Wheeler Real Estate Investment Trust Inc. Series D Cumulative Preferred Stock,$37.69,0.00,0.00%,26189198.00,United States,,951,Real Estate,Real Estate Investment Trusts +WHLRL,Wheeler Real Estate Investment Trust Inc. 7.00% Senior Subordinated Convertible Notes Due 2031,$97.00,0.00,0.00%,67401226.00,United States,,214,Real Estate,Real Estate Investment Trusts +WHLRP,Wheeler Real Estate Investment Trust Inc. Class B Preferred Stock,$5.80,-0.03,-0.515%,4030176.00,United States,,273,Real Estate,Real Estate Investment Trusts +WHR,Whirlpool Corporation Common Stock,$80.87,-2.60,-3.115%,4540741002.00,United States,,2736223,Consumer Discretionary,Consumer Electronics/Appliances +WHWK,Whitehawk Therapeutics Inc. Common Stock,$2.70,-0.08,-2.878%,127246577.00,United States,,46385,Health Care,Biotechnology: Pharmaceutical Preparations +WIA,Western Asset Inflation-Linked Income Fund,$8.23,0.00,0.00%,0.00,United States,2003,15509,Finance,Trusts Except Educational Religious and Charitable +WILC,G. Willi-Food International Ltd. Ordinary Shares,$27.81,-0.71,-2.489%,385641743.00,Israel,,10885,Consumer Discretionary,Food Distributors +WIMI,WiMi Hologram Cloud Inc. Class B Ordinary Shares,$2.42,-0.19,-7.28%,11883175.00,China,2020,147584,Technology,Computer Software: Prepackaged Software +WINA,Winmark Corporation Common Stock,$460.00,0.04,0.009%,1638582100.00,United States,,50944,Consumer Discretionary,Other Specialty Stores +WING,Wingstop Inc. Common Stock,$272.70,-2.26,-0.822%,7577475086.00,United States,2015,497510,Consumer Discretionary,Restaurants +WIT,Wipro Limited Common Stock,$2.55,-0.06,-2.299%,26703946925.00,India,,9834026,Technology,EDP Services +WIW,Western Asset Inflation-Linked Opportunities & Income Fund,$8.59,0.01,0.117%,0.00,United States,2004,192355,Finance,Finance Companies +WIX,Wix.com Ltd. Ordinary Shares,$93.04,5.08,5.775%,5179366909.00,Israel,2013,3221507,Technology,Computer Software: Programming Data Processing +WK,Workiva Inc. Class A Common Stock,$81.29,0.26,0.321%,4562649103.00,United States,2014,496504,Technology,Computer Software: Prepackaged Software +WKC,World Kinect Corporation Common Stock,$25.73,-0.29,-1.115%,1429527229.00,United States,,860140,Energy,Oil Refining/Marketing +WKEY,WISeKey International Holding Ltd American Depositary Shares,$8.29,-0.02,-0.241%,75521519.00,Switzerland,,125788,Technology,EDP Services +WKHS,Workhorse Group Inc. Common Stock,$4.82,-0.09,-1.833%,10458282.00,United States,,116396,Industrials,Auto Manufacturing +WKSP,Worksport Ltd. Common Stock,$1.955,-0.005,-0.255%,19188061.00,Canada,,114106,Consumer Discretionary,Auto Parts:O.E.M. +WLAC,Willow Lane Acquisition Corp. Class A Ordinary Shares,$11.67,-0.15,-1.269%,0.00,United States,2024,124937,Finance,Blank Checks +WLACU,Willow Lane Acquisition Corp. Unit,$15.79,1.39,9.653%,0.00,United States,2024,300,Finance,Blank Checks +WLACW,Willow Lane Acquisition Corp. Warrants,$3.90,-0.1002,-2.505%,0.00,United States,2024,15261,Finance,Blank Checks +WLDN,Willdan Group Inc. Common Stock,$133.36,-1.58,-1.171%,1967044264.00,United States,2006,273999,Consumer Discretionary,Military/Government/Technical +WLDS,Wearable Devices Ltd. Ordinary Share,$1.06,0.01,0.952%,10937510.00,Israel,2022,295909,Telecommunications,Computer Communications Equipment +WLFC,Willis Lease Finance Corporation Common Stock,$176.68,-5.61,-3.078%,1203924729.00,United States,1996,49819,Consumer Discretionary,Industrial Specialties +WLK,Westlake Corporation Common Stock,$81.88,0.20,0.245%,10503011254.00,United States,2004,1180003,Industrials,Major Chemicals +WLKP,Westlake Chemical Partners LP Common Units representing limited partner interests,$21.41,0.23,1.086%,754614269.00,United States,2014,38972,Industrials,Major Chemicals +WLTH,Wealthfront Corporation Common Stock,$9.02,-0.17,-1.85%,1354085855.00,United States,2025,1248648,Finance,Finance: Consumer Services +WLY,John Wiley & Sons Inc. Common Stock,$31.36,0.43,1.39%,1648231236.00,United States,,525141,Consumer Discretionary,Books +WLYB,John Wiley & Sons Inc. Common Stock,$32.15,0.00,0.00%,1689752367.00,United States,,35,Consumer Discretionary,Books +WM,Waste Management Inc. Common Stock,$231.60,0.26,0.112%,93304009012.00,United States,,3086724,Utilities,Environmental Services +WMB,Williams Companies Inc. (The) Common Stock,$66.92,1.44,2.199%,81723966580.00,United States,,5959126,Utilities,Natural Gas Distribution +WMG,Warner Music Group Corp. Class A Common Stock,$29.84,-0.42,-1.388%,15586655798.00,United States,2020,1266632,Consumer Discretionary,Services-Misc. Amusement & Recreation +WMK,Weis Markets Inc. Common Stock,$68.80,-1.07,-1.531%,1702428274.00,United States,,78089,Consumer Staples,Food Chains +WMS,Advanced Drainage Systems Inc. Common Stock,$151.98,-1.05,-0.686%,11818646734.00,United States,2014,353638,Consumer Discretionary,Containers/Packaging +WMT,Walmart Inc. Common Stock,$116.57,-0.37,-0.316%,929082362993.00,United States,,16341996,Consumer Discretionary,Department/Specialty Retail Stores +WNC,Wabash National Corporation Common Stock,$9.82,-0.11,-1.108%,397873375.00,United States,1991,414424,Industrials,Construction/Ag Equipment/Trucks +WNEB,Western New England Bancorp Inc. Common Stock,$13.17,0.35,2.73%,269879192.00,United States,,136870,Finance,Savings Institutions +WNW,Meiwu Technology Company Limited Ordinary Shares,$1.71,0.03,1.786%,26750134.00,China,2020,66696,Consumer Discretionary,Catalog/Specialty Distribution +WOK,WORK Medical Technology Group LTD Class A Ordinary Shares,$1.92,0.14,7.865%,2342429.00,China,2024,114460,Health Care,Medical/Dental Instruments +WOLF,Wolfspeed Inc. Common Stock New,$17.46,-0.54,-3.00%,650464932.00,United States,2025,887484,Technology,Semiconductors +WOOF,Petco Health and Wellness Company Inc. Class A Common Stock,$2.81,-0.02,-0.707%,896488077.00,United States,2021,1249926,Consumer Discretionary,Other Specialty Stores +WOR,Worthington Enterprises Inc. Common Shares,$53.82,0.53,0.995%,2666596989.00,United States,,175184,Industrials,Steel/Iron Ore +WORX,SCWorx Corp. Common Stock,$0.1997,-0.0003,-0.15%,3160619.00,United States,2016,1465805,Consumer Discretionary,Services-Misc. Amusement & Recreation +WPC,W. P. Carey Inc. REIT,$67.90,-1.28,-1.85%,14879947130.00,United States,,1337128,Real Estate,Real Estate Investment Trusts +WPM,Wheaton Precious Metals Corp Common Shares (Canada),$156.30,6.92,4.632%,70963597493.00,Canada,,3528340,Basic Materials,Precious Metals +WPP,WPP plc American Depositary Shares,$21.17,-0.05,-0.236%,4567649192.00,Ireland,,309075,Consumer Discretionary,Advertising +WPRT,Westport Fuel Systems Inc Common Shares,$2.06,-0.06,-2.83%,35743070.00,Canada,2008,79275,Industrials,Industrial Machinery/Components +WRAP,Wrap Technologies Inc. Common Stock,$2.48,0.07,2.905%,127737415.00,United States,,492185,Industrials,Ordnance And Accessories +WRB,W.R. Berkley Corporation Common Stock,$67.67,0.44,0.654%,25716032845.00,United States,,1990087,Finance,Property-Casualty Insurers +WRB^E,W.R. Berkley Corporation 5.70% Subordinated Debentures due 2058,$22.84,-0.04,-0.175%,,United States,,7751,, +WRB^F,W.R. Berkley Corporation 5.10% Subordinated Debentures due 2059,$20.8499,-0.1601,-0.762%,,United States,,10721,, +WRB^G,W.R. Berkley Corporation 4.25% Subordinated Debentures due 2060,$17.37,-0.07,-0.401%,,United States,,14466,, +WRB^H,W.R. Berkley Corporation 4.125% Subordinated Debentures due 2061,$16.8961,-0.0339,-0.20%,,United States,,10169,, +WRBY,Warby Parker Inc. Class A Common Stock,$25.37,-1.92,-7.036%,3099321306.00,United States,2021,2904614,Health Care,Ophthalmic Goods +WRD,WeRide Inc. American Depositary Shares,$8.66,-0.18,-2.036%,2464020317.00,China,2024,3031875,Technology,EDP Services +WRLD,World Acceptance Corporation Common Stock,$115.57,-1.94,-1.651%,582250559.00,United States,1991,125950,Finance,Finance: Consumer Services +WRN,Western Copper and Gold Corporation Common Stock,$4.05,0.08,2.015%,818328525.00,Canada,2011,2462594,Basic Materials,Metal Mining +WS,Worthington Steel Inc. Common Shares,$39.02,0.07,0.18%,1982435878.00,United States,2023,267849,Industrials,Steel/Iron Ore +WSBC,WesBanco Inc. Common Stock,$34.30,-0.92,-2.612%,3294355402.00,United States,,813424,Finance,Major Banks +WSBCO,WesBanco Inc. Depositary Shares each representing 1/40th interest in a share of 7.375% Fixed-Rate Reset Non-Cumulative Perpetual Preferred Stock Series B,$25.62,-0.03,-0.117%,2460681790.00,United States,,2048,Finance,Major Banks +WSBF,Waterstone Financial Inc. Common Stock (MD),$17.03,-0.47,-2.686%,314321314.00,United States,2005,41445,Finance,Savings Institutions +WSBK,Winchester Bancorp Inc. Common Stock,$11.00,0.10,0.917%,0.00,United States,2025,4444,, +WSC,WillScot Holdings Corporation Class A Common Stock,$20.24,-0.18,-0.881%,3682580745.00,United States,2015,1419850,Industrials,Misc Corporate Leasing Services +WSFS,WSFS Financial Corporation Common Stock,$62.23,0.56,0.908%,3402484306.00,United States,,833114,Finance,Major Banks +WSHP,WeShop Holdings Limited Class A Ordinary Shares,$70.00,-5.00,-6.667%,1641057810.00,Jersey,,23772,Consumer Discretionary,Other Specialty Stores +WSM,Williams-Sonoma Inc. Common Stock (DE),$205.72,-2.53,-1.215%,24558999867.00,United States,,646176,Consumer Discretionary,Home Furnishings +WSO,Watsco Inc. Common Stock,$385.14,-0.70,-0.181%,15620669879.00,United States,,766242,Consumer Discretionary,Industrial Machinery/Components +WSO/B,Watsco Inc.,$375.68,0.00,0.00%,,United States,,40,, +WSR,Whitestone REIT Common Shares,$13.92,-0.33,-2.316%,710200126.00,United States,2010,182357,Real Estate,Real Estate Investment Trusts +WST,West Pharmaceutical Services Inc. Common Stock,$235.89,-4.64,-1.929%,16970731457.00,United States,,682812,Health Care,Medical/Dental Instruments +WSTN,Westin Acquisition Corp Class A Ordinary Share,$9.98,0.01,0.10%,80388900.00,Singapore,2025,178,, +WSTNU,Westin Acquisition Corp Units,$10.12,0.02,0.198%,0.00,Singapore,2026,135,, +WT,WisdomTree Inc. Common Stock,$16.96,0.36,2.169%,2386527757.00,United States,2022,6987294,Finance,Investment Bankers/Brokers/Service +WTBA,West Bancorporation Common Stock,$22.33,-0.50,-2.19%,378287729.00,United States,,24162,Finance,Major Banks +WTF,Waton Financial Limited Ordinary Shares,$3.64,-0.055,-1.488%,175584398.00,Hong Kong,2025,21621,Finance,Investment Bankers/Brokers/Service +WTFC,Wintrust Financial Corporation Common Stock,$145.26,-0.21,-0.144%,9728230411.00,United States,,433060,Finance,Major Banks +WTFCN,Wintrust Financial Corporation Depositary Shares Each Representing a 1/1000th Interest in a Share of 7.875% Fixed-Rate Reset Non-Cumulative Perpetual Preferred StocK,$26.44,0.04,0.152%,1770717418.00,United States,,6875,Finance,Major Banks +WTG,Wintergreen Acquisition Corp. Ordinary Shares,$10.22,0.00,0.00%,0.00,China,2025,147,Finance,Blank Checks +WTGUR,Wintergreen Acquisition Corp. Rights,$0.16,0.00,0.00%,0.00,China,2025,40,Finance,Blank Checks +WTI,W&T Offshore Inc. Common Stock,$2.10,0.02,0.962%,312432170.00,United States,2005,2330917,Energy,Oil & Gas Production +WTM,White Mountains Insurance Group Ltd. Common Stock,$2039.19,-13.25,-0.646%,5206268224.00,United States,,18494,Finance,Property-Casualty Insurers +WTO,UTime Limited Class A Ordinary Shares,$0.64,0.0552,9.439%,1244225.00,China,2021,143779,Technology,Consumer Electronics/Appliances +WTRG,Essential Utilities Inc. Common Stock,$38.10,-1.17,-2.979%,10781367350.00,United States,,2295928,Utilities,Water Supply +WTS,Watts Water Technologies Inc. Class A Common Stock,$293.57,-4.06,-1.364%,9791417018.00,United States,1986,210276,Industrials,Metal Fabrications +WTTR,Select Water Solutions Inc. Class A common stock,$11.48,-0.26,-2.215%,1390569013.00,United States,2017,855712,Energy,Oilfield Services/Equipment +WTW,Willis Towers Watson Public Limited Company Ordinary Shares,$314.33,0.01,0.003%,30096661524.00,United Kingdom,,343650,Finance,Specialty Insurers +WU,Western Union Company (The) Common Stock,$9.34,-0.03,-0.32%,2968671413.00,United States,,6371234,Real Estate,Real Estate +WULF,TeraWulf Inc. Common Stock,$15.11,-0.20,-1.306%,6326283222.00,United States,,28939219,Technology,EDP Services +WVE,Wave Life Sciences Ltd. Ordinary Shares,$12.73,-0.63,-4.716%,2291136540.00,Singapore,2015,13122067,Health Care,Biotechnology: Pharmaceutical Preparations +WVVI,Willamette Valley Vineyards Inc. Common Stock,$2.78,-0.02,-0.714%,13801391.00,United States,,15879,Consumer Staples,Beverages (Production/Distribution) +WVVIP,Willamette Valley Vineyards Inc. Series A Redeemable Preferred Stock,$2.95,-0.10,-3.279%,14645361.00,United States,,16298,Consumer Staples,Beverages (Production/Distribution) +WW,WW International Inc. Common Stock,$21.19,-0.68,-3.109%,211623004.00,United States,,220883,Consumer Discretionary,Other Consumer Services +WWD,Woodward Inc. Common Stock,$325.94,-3.49,-1.059%,19513693712.00,United States,,666761,Energy,Industrial Machinery/Components +WWR,Westwater Resources Inc. Common Stock,$1.18,-0.03,-2.479%,139227568.00,United States,,2601704,Basic Materials,Metal Mining +WWW,Wolverine World Wide Inc. Common Stock,$17.24,0.12,0.701%,1413126544.00,United States,,1600925,Consumer Discretionary,Shoe Manufacturing +WXM,WF International Limited Ordinary Shares,$0.481,0.035,7.848%,4146551.00,China,2025,130098,Consumer Discretionary,Engineering & Construction +WY,Weyerhaeuser Company Common Stock,$26.05,-0.18,-0.686%,18778429050.00,United States,,5893688,Real Estate,Real Estate Investment Trusts +WYFI,WhiteFiber Inc. Ordinary Shares,$22.16,0.56,2.593%,847841356.00,United States,2025,1895906,Finance,Finance: Consumer Services +WYHG,Wing Yip Food Holdings Group Limited American Depositary Shares,$0.519,0.0396,8.26%,26121752.00,China,2024,36781,Consumer Staples,Specialty Foods +WYNN,Wynn Resorts Limited Common stock,$112.88,-0.89,-0.782%,11736639190.00,United States,2002,1252714,Consumer Discretionary,Hotels/Resorts +WYY,WidePoint Corporation Common Stock,$6.90,-0.05,-0.719%,68247914.00,United States,,14221,Technology,EDP Services +XAIR,Beyond Air Inc. Common Stock,$1.27,-0.08,-5.926%,10172050.00,United States,,369930,Health Care,Medical/Dental Instruments +XBIO,Xenetic Biosciences Inc. Common Stock,$2.491,-0.059,-2.314%,5707020.00,United States,,7435,Health Care,Biotechnology: Pharmaceutical Preparations +XBIT,XBiotech Inc. Common Stock,$2.64,-0.07,-2.583%,80487610.00,United States,2015,17017,Health Care,Biotechnology: Pharmaceutical Preparations +XBP,XBP Global Holdings Inc. Common Stock,$8.47,0.09,1.074%,99536027.00,United States,2021,10518,Technology,EDP Services +XBPEW,XBP Europe Holdings Inc. Warrant,$0.0599,0.001,1.698%,703921.00,United States,2021,11633,Technology,EDP Services +XCBEU,X3 Acquisition Corp. Ltd. Unit,$10.00,0.01,0.10%,0.00,United States,2026,5197,Finance,Blank Checks +XCH,XCHG Limited American Depositary Share,$1.11,0.02,1.835%,65991207.00,Germany,2024,9024,Industrials,Electrical Products +XCUR,Exicure Inc. Common Stock,$4.19,-0.26,-5.843%,26706511.00,United States,,64278,Health Care,Biotechnology: Pharmaceutical Preparations +XEL,Xcel Energy Inc. Common Stock,$76.01,-0.32,-0.419%,44962938146.00,United States,,3239992,Utilities,Power Generation +XELB,Xcel Brands Inc. Common Stock,$1.42,-0.05,-3.401%,6825622.00,United States,,62755,Miscellaneous,Multi-Sector Companies +XELLL,Xcel Energy Inc. 6.25% Junior Subordinated Notes Series due 2085,$24.88,-0.05,-0.201%,0.00,United States,,82605,Utilities,Power Generation +XENE,Xenon Pharmaceuticals Inc. Common Shares,$41.95,-0.44,-1.038%,3241686460.00,Canada,2014,610307,Health Care,Biotechnology: Pharmaceutical Preparations +XERS,Xeris Biopharma Holdings Inc. Common Stock,$7.16,-0.35,-4.66%,1188017909.00,United States,2018,1644073,Health Care,Biotechnology: Pharmaceutical Preparations +XFLT,XAI Octagon Floating Rate & Alternative Income Trust Common Shares of Beneficial Interest,$4.56,0.00,0.00%,161736506.00,United States,2017,334584,Finance,Investment Managers +XFOR,X4 Pharmaceuticals Inc. Common Stock,$3.62,-0.08,-2.162%,316520811.00,United States,2017,204442,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +XGN,Exagen Inc. Common Stock,$4.06,-0.25,-5.80%,92012182.00,United States,2019,357217,Health Care,Medical Specialities +XHG,XChange TEC.INC American Depositary Shares ,$0.92,0.01,1.099%,47424092.00,China,2019,7468,Finance,Real Estate +XHLD,TEN Holdings Inc. Common Stock,$2.55,-0.97,-27.557%,7580719.00,United States,2025,2401666,Real Estate,Real Estate +XHR,Xenia Hotels & Resorts Inc. Common Stock,$14.52,-0.35,-2.354%,1376579461.00,United States,2015,702744,Consumer Discretionary,Hotels/Resorts +XIFR,XPLR Infrastructure LP Common Units representing limited partner interests,$10.05,0.22,2.238%,944361777.00,United States,2014,1961988,Utilities,Electric Utilities: Central +XLO,Xilio Therapeutics Inc. Common Stock,$0.6177,0.0027,0.439%,41720032.00,United States,2021,342224,Health Care,Biotechnology: Pharmaceutical Preparations +XMTR,Xometry Inc. Class A Common Stock,$64.87,-0.35,-0.537%,3324435445.00,United States,2021,392334,Real Estate,Real Estate +XNCR,Xencor Inc. Common Stock,$12.35,-0.82,-6.226%,881919292.00,United States,2013,635120,Health Care,Biotechnology: Pharmaceutical Preparations +XNET,Xunlei Limited American Depositary Shares,$6.72,0.06,0.901%,2095701424.00,China,2014,308064,Technology,Computer Software: Prepackaged Software +XOM,Exxon Mobil Corporation Common Stock,$137.58,0.75,0.548%,580197645174.00,United States,,15637279,Energy,Integrated oil Companies +XOMA,XOMA Royalty Corporation Common Stock,$24.66,-1.05,-4.084%,305367320.00,United States,1986,1160480,Health Care,Biotechnology: Pharmaceutical Preparations +XOMAO,XOMA Royalty Corporation Depositary Shares Rep Series B 8.375% Cumulative Preferred Stock,$25.3005,-0.0994,-0.391%,313298697.00,United States,,2077,Health Care,Biotechnology: Pharmaceutical Preparations +XOMAP,XOMA Royalty Corporation 8.625% Series A Cumulative Perpetual Preferred Stock,$26.03,-0.26,-0.989%,322332171.00,United States,,934,Health Care,Biotechnology: Pharmaceutical Preparations +XOS,Xos Inc. Common Stock,$2.81,0.05,1.812%,31849080.00,United States,2020,65219,Consumer Discretionary,Auto Parts:O.E.M. +XOSWW,Xos Inc. Warrants,$0.0048,0.0007,17.073%,54404.00,United States,2020,4466,Consumer Discretionary,Auto Parts:O.E.M. +XP,XP Inc. Class A Common Stock,$20.40,0.20,0.99%,10963437788.00,Brazil,2019,20144370,Finance,Investment Bankers/Brokers/Service +XPEL,XPEL Inc. Common Stock,$52.23,-0.37,-0.703%,1445653330.00,United States,,177972,Industrials,Industrial Specialties +XPER,Xperi Inc. Common Stock ,$5.77,-0.16,-2.698%,267355171.00,United States,2022,395526,Technology,Computer Software: Prepackaged Software +XPEV,XPeng Inc. American depositary shares each representing two Class A ordinary shares,$18.66,0.09,0.485%,17731184748.00,China,2020,5684844,Industrials,Auto Manufacturing +XPL,Solitario Resources Corp. Common Stock,$0.798,0.0685,9.39%,72539257.00,United States,,848480,Basic Materials,Precious Metals +XPO,XPO Inc. Common Stock,$148.23,-0.37,-0.249%,17399869304.00,United States,,1245713,Consumer Discretionary,Transportation Services +XPOF,Xponential Fitness Inc. Class A Common Stock,$7.78,-0.09,-1.144%,380496460.00,United States,2021,597845,Consumer Discretionary,Services-Misc. Amusement & Recreation +XPON,Expion360 Inc. Common Stock,$0.9016,0.0456,5.327%,8706516.00,United States,2022,30224119,Miscellaneous,Industrial Machinery/Components +XPRO,Expro Group Holdings N.V. Common Stock,$15.50,-0.58,-3.607%,1760186526.00,United States,2013,1348707,Energy,Oilfield Services/Equipment +XRAY,DENTSPLY SIRONA Inc. Common Stock,$12.31,-0.46,-3.602%,2456484738.00,United States,1987,5233843,Health Care,Medical/Dental Instruments +XRPN,Armada Acquisition Corp. II Class A Ordinary Shares,$10.24,0.00,0.00%,0.00,United States,2025,91593,Finance,Blank Checks +XRPNU,Armada Acquisition Corp. II Units,$10.66,0.00,0.00%,0.00,United States,2025,62,Finance,Blank Checks +XRPNW,Armada Acquisition Corp. II Warrant,$0.8499,0.0099,1.179%,0.00,United States,2025,34303,Finance,Blank Checks +XRTX,XORTX Therapeutics Inc. Common Stock,$0.5151,-0.0206,-3.845%,3586238.00,Canada,,35086,Health Care,Biotechnology: Pharmaceutical Preparations +XRX,Xerox Holdings Corporation Common Stock,$2.33,0.20,9.39%,298333226.00,United States,,8990905,Technology,Computer peripheral equipment +XTIA,XTI Aerospace Inc. Common Stock,$1.86,-0.06,-3.125%,64186361.00,United States,2014,2182669,Technology,EDP Services +XTKG,X3 Holdings Co. Ltd. Ordinary Shares,$0.45,-0.1512,-25.15%,7294415.00,China,2019,19184183,Technology,EDP Services +XTLB,XTL Biopharmaceuticals Ltd. American Depositary Shares,$0.8886,0.0386,4.541%,1957997.00,Israel,,78718,Health Care,Biotechnology: Pharmaceutical Preparations +XTNT,Xtant Medical Holdings Inc. Common Stock,$0.616,0.0022,0.358%,86242612.00,United States,,148326,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +XWEL,XWELL Inc. Common Stock,$0.324,0.001,0.31%,1868412.00,United States,,104907,Consumer Discretionary,Other Consumer Services +XWIN,XMAX Inc. Common Stock,$5.76,-0.17,-2.867%,248093148.00,United States,,564364,Consumer Discretionary,Home Furnishings +XXI,Twenty One Capital Inc. Class A Common Stock,$8.33,-0.17,-2.00%,5426086297.00,,2025,705440,Finance,Finance: Consumer Services +XXII,22nd Century Group Inc. Common Stock,$8.63,-0.565,-6.145%,4402828.00,United States,,31785,Health Care, Medicinal Chemicals and Botanical Products +XYF,X Financial American Depositary Shares each representing six Class A Ordinary Shares,$5.74,-0.11,-1.88%,242281922.00,Cayman Islands,2018,146988,Finance,Finance: Consumer Services +XYL,Xylem Inc. Common Stock New,$135.52,-4.89,-3.483%,32994927418.00,United States,2011,3438433,Industrials,Fluid Controls +XYZ,Block Inc. Class A Common Stock,$64.22,-0.37,-0.573%,39024246300.00,United States,2015,4927458,Technology,Computer Software: Prepackaged Software +XZO,Exzeo Group Inc. Common Stock,$20.59,-0.07,-0.339%,1868980841.00,,2025,43368,Finance,Property-Casualty Insurers +YAAS,Youxin Technology Ltd Class A Ordinary shares,$1.48,-0.09,-5.732%,6864536.00,China,2024,64142,Technology,Computer Software: Prepackaged Software +YALA,Yalla Group Limited American Depositary Shares each representing one Class A Ordinary Share,$7.15,-0.07,-0.97%,1126381349.00,United Arab Emirates,2020,130861,Technology,Computer Software: Programming Data Processing +YB,Yuanbao Inc. American Depositary Shares,$20.04,0.37,1.881%,903502659.00,China,2025,12076,Finance,Specialty Insurers +YCBD,cbdMD Inc. Common Stock,$0.754,-0.024,-3.085%,7913653.00,United States,2017,645128,Consumer Discretionary,Package Goods/Cosmetics +YCY,AA Mission Acquisition Corp. II Class A Ordinary Shares,$10.0514,0.0014,0.014%,0.00,,2025,30943,, +YDDL,One and One Green Technologies. Inc Class A Ordinary Shares,$6.75,0.43,6.804%,367875000.00,Philippines,2025,96424,Consumer Discretionary,Industrial Specialties +YDES,YD Bio Limited Ordinary Shares,$12.24,0.08,0.658%,863181434.00,United States,,13255,Health Care,Medical Specialities +YDESW,YD Bio Limited Warrants,$0.90,0.0001,0.011%,63469223.00,United States,,1200,Health Care,Medical Specialities +YDKG,Yueda Digital Holding Class A Ordinary Share,$0.8879,-0.0155,-1.716%,4920941.00,China,2007,89185,Consumer Discretionary,Advertising +YELP,Yelp Inc. Common Stock,$27.50,0.19,0.696%,1691029698.00,United States,2012,1185208,Consumer Discretionary,Other Consumer Services +YETI,YETI Holdings Inc. Common Stock,$46.47,-0.94,-1.983%,3615743011.00,United States,2018,1287386,Consumer Discretionary,Recreational Games/Products/Toys +YEXT,Yext Inc. Common Stock,$7.35,-0.15,-2.00%,901308428.00,United States,2017,767477,Technology,EDP Services +YHC,LQR House Inc. Common Stock,$0.9181,0.0179,1.988%,19621317.00,United States,2023,93490,Consumer Staples,Beverages (Production/Distribution) +YHGJ,Yunhong Green CTI Ltd. Common Stock,$3.72,0.27,7.826%,10318770.00,United States,,8313,Industrials,Specialty Chemicals +YI,111 Inc. American Depositary Shares,$5.32,0.07,1.333%,46110760.00,China,2018,21233,Consumer Staples,Retail-Drug Stores and Proprietary Stores +YIBO,Planet Image International Limited Class A Ordinary Shares,$1.09,0.04,3.81%,58730944.00,China,2024,38433,Industrials,Industrial Machinery/Components +YJ,Yunji Inc. American Depository Shares,$1.48,0.17,12.977%,7289799.00,China,2019,57698,Consumer Discretionary,Other Specialty Stores +YMAT,J-Star Holding Co. Ltd. Class A Ordinary Shares,$0.462,0.022,5.00%,7859954.00,Taiwan,2025,37261,Consumer Discretionary,Recreational Games/Products/Toys +YMM,Full Truck Alliance Co. Ltd. American Depositary Shares (each representing 20 Class A Ordinary Shares),$10.02,0.09,0.906%,10479859814.00,China,2021,6493303,Technology,Computer Software: Prepackaged Software +YMT,Yimutian Inc. American Depositary Shares,$1.76,-0.03,-1.676%,201303645.00,China,2025,238797,Technology,EDP Services +YORW,York Water Company (The) Common Stock,$32.66,-0.78,-2.333%,471436649.00,United States,,72980,Utilities,Water Supply +YOU,Clear Secure Inc. Class A Common Stock,$33.48,-0.86,-2.504%,4458206911.00,United States,2021,942735,Technology,Computer Software: Prepackaged Software +YOUL,Youlife Group Inc. American Depositary Shares,$1.58,0.04,2.597%,120156788.00,China,,716037,Real Estate,Other Consumer Services +YPF,YPF Sociedad Anonima Common Stock,$38.60,0.32,0.836%,15181873810.00,Argentina,1993,1631526,Energy,Integrated oil Companies +YQ,17 Education & Technology Group Inc. American Depositary Shares,$3.36,-0.19,-5.352%,29741746.00,China,2020,18121,Real Estate,Other Consumer Services +YRD,Yiren Digital Ltd. American Depositary Shares each representing two ordinary shares,$4.25,0.10,2.41%,367227557.00,China,2015,129023,Finance,Finance: Consumer Services +YSG,Yatsen Holding Limited American Depositary Shares each representing twenty (20) Class A Ordinary Shares,$4.36,0.16,3.81%,409178475.00,China,,204006,Consumer Discretionary,Package Goods/Cosmetics +YSXT,YSX Tech. Co. Ltd Class A Ordinary Shares,$1.15,-0.02,-1.709%,26953125.00,China,2024,378410,Consumer Discretionary,Automotive Aftermarket +YTRA,Yatra Online Inc. Ordinary Shares,$1.63,-0.02,-1.212%,101150873.00,India,,33052,Consumer Discretionary,Transportation Services +YUM,Yum! Brands Inc.,$153.88,-0.13,-0.084%,42725217327.00,United States,,1702697,Consumer Discretionary,Restaurants +YUMC,Yum China Holdings Inc. Common Stock,$49.96,-0.21,-0.419%,18056503981.00,United States,2016,1317252,Consumer Discretionary,Restaurants +YXT,YXT.COM GROUP HOLDING LIMITED American Depository Shares,$0.72,0.00,0.00%,43254383.00,China,2024,328,Technology,Computer Software: Prepackaged Software +YYAI,AiRWA Inc. Common Stock,$1.31,-0.21,-13.816%,24865811.00,United States,,2412912,Consumer Discretionary,Recreational Games/Products/Toys +YYGH,YY Group Holding Limited Class A Ordinary Shares,$0.241,0.0203,9.198%,15721919.00,Singapore,2024,4918286,Consumer Discretionary,Professional Services +Z,Zillow Group Inc. Class C Capital Stock,$65.98,-0.64,-0.961%,15970500567.00,United States,,1858415,Real Estate,Real Estate +ZBAI,ATIF Holdings Limited Ordinary Shares,$7.20,0.00,0.00%,74256286.00,United States,2019,458,Consumer Discretionary,Professional Services +ZBAO,Zhibao Technology Inc. Class A Ordinary Shares,$0.914,-0.0143,-1.54%,44104700.00,China,2024,53137,Finance,Specialty Insurers +ZBH,Zimmer Biomet Holdings Inc. Common Stock,$85.71,-0.28,-0.326%,16986141079.00,United States,,1746967,Health Care,Industrial Specialties +ZBIO,Zenas BioPharma Inc. Common Stock,$21.47,1.40,6.976%,1152491694.00,United States,2024,470455,Health Care,Biotechnology: Pharmaceutical Preparations +ZBRA,Zebra Technologies Corporation Class A Common Stock,$236.23,-2.33,-0.977%,11967468968.00,United States,1991,484404,Industrials,Industrial Machinery/Components +ZCMD,Zhongchao Inc. Class A Ordinary Shares,$0.427,0.0002,0.047%,10841062.00,China,2020,7377,Real Estate,Other Consumer Services +ZD,Ziff Davis Inc. Common Stock,$39.29,-0.25,-0.632%,1552146421.00,United States,,443911,Telecommunications,Telecommunications Equipment +ZDAI,DirectBooking Technology Co. Ltd. Class A Ordinary Shares,$0.6199,-0.0267,-4.129%,79781130.00,Hong Kong,2024,347632,Consumer Discretionary,General Bldg Contractors - Nonresidential Bldgs +ZDGE,Zedge Inc. Class B Common Stock ,$3.17,-0.08,-2.462%,41242036.00,,2016,44973,Technology,Computer Software: Prepackaged Software +ZENA,ZenaTech Inc. Common Stock,$4.05,-0.36,-8.163%,192864584.00,Canada,,1503329,Technology,Computer Software: Prepackaged Software +ZENV,Zenvia Inc. Class A Common Stock,$0.9501,0.0501,5.567%,49343096.00,Brazil,2021,45250,Technology,Computer Software: Prepackaged Software +ZEO,Zeo Energy Corporation Class A Common Stock,$1.03,-0.01,-0.962%,59255829.00,United States,2021,232207,Miscellaneous,Industrial Machinery/Components +ZEOWW,Zeo Energy Corporation Warrants,$0.0421,-0.0081,-16.135%,2422010.00,United States,2021,12045,Miscellaneous,Industrial Machinery/Components +ZEPP,Zepp Health Corporation American depositary shares each representing sixteen Class A ordinary shares,$22.22,-0.72,-3.139%,319258338.00,China,,160514,Technology,Computer Manufacturing +ZETA,Zeta Global Holdings Corp. Class A Common Stock,$20.31,0.30,1.499%,4831447437.00,United States,2021,6306810,Technology,Computer Software: Prepackaged Software +ZEUS,Olympic Steel Inc. Common Stock,$46.92,-0.59,-1.242%,525392377.00,United States,1994,93838,Industrials,Metal Fabrications +ZG,Zillow Group Inc. Class A Common Stock,$65.00,-0.73,-1.111%,15733290950.00,United States,2011,331636,Real Estate,Real Estate +ZGM,Zenta Group Company Limited Ordinary Shares,$2.30,-0.155,-6.314%,27160330.00,Macau,2025,16965,Consumer Discretionary,Professional Services +ZGN,Ermenegildo Zegna N.V. Ordinary Shares,$8.86,-0.41,-4.423%,2237857728.00,,2021,875511,Consumer Discretionary,Apparel +ZH,Zhihu Inc. American Depositary Shares each representing three (3) Class A Ordinary Shares,$3.74,-0.07,-1.837%,327492580.00,China,,169537,Real Estate,Real Estate +ZIM,ZIM Integrated Shipping Services Ltd. Ordinary Shares,$23.24,0.52,2.289%,2799432532.00,,2021,2775133,Consumer Discretionary,Marine Transportation +ZION,Zions Bancorporation N.A. Common Stock,$58.33,-0.80,-1.353%,8611901513.00,United States,,2074099,Finance,Major Banks +ZIONP,Zions Bancorporation N.A. Depositary Shares (Each representing 1/40th Interest in a Share of Series A Floating-Rate Non-Cumulative Perpetual Preferred Stock),$19.65,-0.10,-0.506%,2901146318.00,United States,,1767,Finance,Major Banks +ZIP,ZipRecruiter Inc. Class A Common Stock,$2.43,-0.11,-4.331%,207909437.00,United States,2021,953306,Technology,Computer Software: Programming Data Processing +ZJK,ZJK Industrial Co. Ltd. Ordinary Shares,$2.10,-0.15,-6.667%,128900623.00,China,2024,62498,Industrials,Metal Fabrications +ZJYL,JIN MEDICAL INTERNATIONAL LTD. Ordinary Shares,$0.1532,0.0022,1.457%,23983016.00,China,2023,1986343,Health Care,Industrial Specialties +ZKH,ZKH Group Limited American Depositary Shares each representing thirty-five (35) Class A Ordinary Shares,$3.45,0.00,0.00%,551356685.00,Cayman Islands,2023,178942,Consumer Discretionary,RETAIL: Building Materials +ZKIN,ZK International Group Co. Ltd Ordinary Share,$1.75,0.16,10.063%,9036906.00,China,2017,9469,Industrials,Metal Fabrications +ZKPU,Lafayette Digital Acquisition Corp. I Unit,$10.00,-0.01,-0.10%,0.00,United States,2026,957679,Finance,Blank Checks +ZLAB,Zai Lab Limited American Depositary Shares,$17.20,0.15,0.88%,1902212672.00,China,2017,621326,Health Care,Biotechnology: Pharmaceutical Preparations +ZM,Zoom Communications Inc. Class A Common Stock,$96.22,1.78,1.885%,28490835237.00,United States,2019,4482606,Technology,Computer Software: Programming Data Processing +ZNB,Zeta Network Group Class A Ordinary Shares,$0.88,-0.1101,-11.12%,128726088.00,United States,,5075812,Consumer Discretionary,Engineering & Construction +ZNTL,Zentalis Pharmaceuticals Inc. Common Stock,$2.56,-0.37,-12.628%,184961994.00,United States,2020,535694,Health Care,Biotechnology: Pharmaceutical Preparations +ZONE,CleanCore Solutions Inc. Class B Common Stock,$0.388,-0.0278,-6.686%,78107901.00,,2024,1142577,Industrials,Industrial Machinery/Components +ZOOZ,ZOOZ Strategy Ltd. Ordinary Shares,$0.469,-0.005,-1.055%,75930998.00,Israel,,230705,Technology,Industrial Machinery/Components +ZOOZW,ZOOZ Strategy Ltd. Warrant,$0.048,0.00,0.00%,7771190.00,Israel,,630,Technology,Industrial Machinery/Components +ZS,Zscaler Inc. Common Stock,$213.95,-5.72,-2.604%,34118864952.00,United States,2018,1424998,Technology,EDP Services +ZSPC,zSpace Inc. Common stock,$0.497,-0.028,-5.333%,14437883.00,United States,2024,255831,Technology,Computer Software: Prepackaged Software +ZTEK,Zentek Ltd. Common Stock,$0.756,-0.011,-1.434%,81123716.00,Canada,,78248,Industrials,Major Chemicals +ZTO,ZTO Express (Cayman) Inc. American Depositary Shares each representing one Class A ordinary share.,$21.97,0.29,1.338%,17674172725.00,China,2016,1842466,Industrials,Trucking Freight/Courier Services +ZTR,Virtus Total Return Fund Inc.,$6.46,0.02,0.311%,0.00,United States,1988,162978,Finance,Investment Managers +ZTS,Zoetis Inc. Class A Common Stock,$121.93,-3.03,-2.425%,53733723583.00,United States,2013,6130213,Health Care,Biotechnology: Pharmaceutical Preparations +ZUMZ,Zumiez Inc. Common Stock,$24.52,-0.09,-0.366%,415603653.00,United States,2005,172979,Consumer Discretionary,Clothing/Shoe/Accessory Stores +ZURA,Zura Bio Limited Class A Ordinary Shares,$5.98,-0.45,-6.998%,388839382.00,Cayman Islands,,329912,Health Care,Biotechnology: Biological Products (No Diagnostic Substances) +ZVIA,Zevia PBC Class A Common Stock,$1.89,-0.17,-8.252%,141757539.00,United States,2021,984669,Consumer Staples,Beverages (Production/Distribution) +ZVRA,Zevra Therapeutics Inc. Common Stock,$8.63,-0.30,-3.359%,485847727.00,United States,,1524563,Health Care,Biotechnology: Pharmaceutical Preparations +ZWS,Zurn Elkay Water Solutions Corporation Common Stock,$46.15,-0.70,-1.494%,7723240251.00,United States,2012,1537938,Industrials,Industrial Machinery/Components +ZYBT,Zhengye Biotechnology Holding Limited Ordinary Shares,$1.00,-0.02,-1.961%,47391376.00,China,2025,11694,Health Care,Biotechnology: Pharmaceutical Preparations +ZYME,Zymeworks Inc. Common Stock,$22.31,-0.94,-4.043%,1669603074.00,United States,,652771,Health Care,Biotechnology: Pharmaceutical Preparations diff --git a/backend/database.py b/backend/database.py new file mode 100644 index 0000000..e96e5c2 --- /dev/null +++ b/backend/database.py @@ -0,0 +1,112 @@ +from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, Boolean, Text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker +import datetime +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +DB_URL = f"sqlite:///{os.path.join(BASE_DIR, 'kis_stock.db')}" + +engine = create_engine(DB_URL, connect_args={"check_same_thread": False}) + +# Enable WAL mode for better concurrency +from sqlalchemy import event +@event.listens_for(engine, "connect") +def set_sqlite_pragma(dbapi_connection, connection_record): + cursor = dbapi_connection.cursor() + cursor.execute("PRAGMA journal_mode=WAL") + cursor.close() + +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) +Base = declarative_base() + +class Stock(Base): + __tablename__ = "stocks" + code = Column(String, primary_key=True, index=True) + name = Column(String, index=True) + name_eng = Column(String, nullable=True) # English Name + market = Column(String) # KOSPI, KOSDAQ, NASD, NYSE, AMEX + sector = Column(String, nullable=True) + industry = Column(String, nullable=True) # Detailed Industry + type = Column(String, default="DOMESTIC") # DOMESTIC, OVERSEAS + financial_status = Column(String, nullable=True) # 'N', 'D', 'E' etc from Nasdaq + is_etf = Column(Boolean, default=False) + current_price = Column(Float, default=0.0) + +class Watchlist(Base): + __tablename__ = "watchlist" + id = Column(Integer, primary_key=True, index=True) + code = Column(String, index=True) + name = Column(String) # Cache name for display + market = Column(String) + is_monitoring = Column(Boolean, default=True) + created_at = Column(DateTime, default=datetime.datetime.now) + +class Order(Base): + __tablename__ = "orders" + id = Column(Integer, primary_key=True, index=True) + order_id = Column(String, nullable=True) # KIS Order ID + code = Column(String, index=True) + type = Column(String) # BUY, SELL + price = Column(Float) + quantity = Column(Integer) + status = Column(String) # PENDING, FILLED, CANCELLED + created_at = Column(DateTime, default=datetime.datetime.now) + +class TradeSetting(Base): + __tablename__ = "trade_settings" + code = Column(String, primary_key=True) + target_price = Column(Float, nullable=True) + stop_loss_price = Column(Float, nullable=True) + trailing_stop_percent = Column(Float, nullable=True) + is_active = Column(Boolean, default=False) + +class News(Base): + __tablename__ = "news" + id = Column(Integer, primary_key=True, index=True) + title = Column(String) + link = Column(String, unique=True) + pub_date = Column(String) + analysis_result = Column(Text) + impact_score = Column(Integer) + related_sector = Column(String) + created_at = Column(DateTime, default=datetime.datetime.now) + +class StockPrice(Base): + __tablename__ = "stock_prices" + id = Column(Integer, primary_key=True, index=True) + code = Column(String, index=True) + price = Column(Float) + change = Column(Float) + volume = Column(Integer) + created_at = Column(DateTime, default=datetime.datetime.now) + +class AccountBalance(Base): + __tablename__ = "account_balance" + id = Column(Integer, primary_key=True) + total_eval = Column(Float, default=0.0) # 총평가금액 + deposit = Column(Float, default=0.0) # 예수금 + total_profit = Column(Float, default=0.0) # 평가손익 + updated_at = Column(DateTime, default=datetime.datetime.now) + +class Holding(Base): + __tablename__ = "holdings" + id = Column(Integer, primary_key=True, index=True) + code = Column(String, index=True) + name = Column(String) + quantity = Column(Integer) + price = Column(Float) # 매입평단가 + current_price = Column(Float) # 현재가 + profit_rate = Column(Float) + market = Column(String) # DOMESTIC, NASD, etc. + updated_at = Column(DateTime, default=datetime.datetime.now) + +def init_db(): + Base.metadata.create_all(bind=engine) + +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() diff --git a/backend/kis_api.py b/backend/kis_api.py new file mode 100644 index 0000000..b83c443 --- /dev/null +++ b/backend/kis_api.py @@ -0,0 +1,379 @@ +import requests +import json +import datetime +import os +import time +import copy +from config import get_kis_config +import logging + +# Basic Logging +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger("KIS_API") + +class KisApi: + def __init__(self): + self.config = get_kis_config() + self.app_key = self.config.get("app_key") + self.app_secret = self.config.get("app_secret") + self.account_no = str(self.config.get("account_no", "")).replace("-", "").strip() # 8 digits + self.account_prod = str(self.config.get("account_prod", "01")).strip() # 2 digits + self.is_paper = self.config.get("is_paper", True) + self.htsid = self.config.get("htsid", "") + + logger.info(f"Initialized KIS API: Account={self.account_no}, Prod={self.account_prod}, Paper={self.is_paper}") + + if self.is_paper: + self.base_url = "https://openapivts.koreainvestment.com:29443" + else: + self.base_url = "https://openapi.koreainvestment.com:9443" + + self.token_file = "kis_token.tmp" + self.access_token = None + self.token_expired = None + self.last_req_time = 0 + + self._auth() + + def _auth(self): + # Clean outdated token file if needed or load existing + if os.path.exists(self.token_file): + with open(self.token_file, 'r') as f: + data = json.load(f) + expired = datetime.datetime.strptime(data['expired'], "%Y-%m-%d %H:%M:%S") + if expired > datetime.datetime.now(): + self.access_token = data['token'] + self.token_expired = expired + logger.info("Loaded credentials from cache.") + return + + # Request new token + url = f"{self.base_url}/oauth2/tokenP" + headers = {"content-type": "application/json"} + body = { + "grant_type": "client_credentials", + "appkey": self.app_key, + "appsecret": self.app_secret + } + + res = requests.post(url, headers=headers, data=json.dumps(body)) + if res.status_code == 200: + data = res.json() + self.access_token = data['access_token'] + self.token_expired = datetime.datetime.strptime(data['access_token_token_expired'], "%Y-%m-%d %H:%M:%S") + + # Save to file + with open(self.token_file, 'w') as f: + json.dump({ + "token": self.access_token, + "expired": data['access_token_token_expired'] + }, f) + logger.info("Issued new access token.") + else: + logger.error(f"Auth Failed: {res.text}") + raise Exception("Authentication Failed") + + def get_websocket_key(self): + """ + Get Approval Key for WebSocket + """ + url = f"{self.base_url}/oauth2/Approval" + headers = {"content-type": "application/json"} + body = { + "grant_type": "client_credentials", + "appkey": self.app_key, + "secretkey": self.app_secret + } + res = requests.post(url, headers=headers, data=json.dumps(body)) + if res.status_code == 200: + return res.json().get("approval_key") + else: + logger.error(f"WS Key Failed: {res.text}") + return None + + def _get_header(self, tr_id=None): + header = { + "Content-Type": "application/json", + "authorization": f"Bearer {self.access_token}", + "appkey": self.app_key, + "appsecret": self.app_secret, + "tr_id": tr_id, + "custtype": "P" + } + return header + + def _request(self, method, path, tr_id=None, x_tr_id_buy=None, x_tr_id_sell=None, **kwargs): + """ + Centralized request handler with auto-token refresh logic and 500ms throttling. + """ + # Throttling + now = time.time() + diff = now - self.last_req_time + if diff < 0.5: + time.sleep(0.5 - diff) + self.last_req_time = time.time() + + url = f"{self.base_url}{path}" + + # Determine TR ID + curr_tr_id = tr_id + if x_tr_id_buy and x_tr_id_sell: + pass + + # Prepare headers + headers = self._get_header(curr_tr_id) + + # Execute Request + try: + if method.upper() == "GET": + res = requests.get(url, headers=headers, **kwargs) + else: + res = requests.post(url, headers=headers, **kwargs) + + # Check for Token Expiration (EGW00123) + if res.status_code == 200: + data = res.json() + if isinstance(data, dict): + msg_cd = data.get('msg_cd', '') + if msg_cd == 'EGW00123': # Expired Token + logger.warning("Token expired (EGW00123). Refreshing token and retrying...") + + # Remove token file + if os.path.exists(self.token_file): + os.remove(self.token_file) + + # Re-auth + self._auth() + + # Update headers with new token + headers = self._get_header(curr_tr_id) + + # Retry + if method.upper() == "GET": + res = requests.get(url, headers=headers, **kwargs) + else: + res = requests.post(url, headers=headers, **kwargs) + + return res.json() + return data + else: + logger.error(f"API Request Failed [{res.status_code}]: {res.text}") + return None + + except Exception as e: + logger.error(f"Request Exception: {e}") + return None + + def get_current_price(self, code): + """ + inquire-price + """ + tr_id = "FHKST01010100" + params = { + "FID_COND_MRKT_DIV_CODE": "J", + "FID_INPUT_ISCD": code + } + res = self._request("GET", "/uapi/domestic-stock/v1/quotations/inquire-price", tr_id=tr_id, params=params) + return res.get('output', {}) if res else None + + def get_balance(self, source=None): + """ + inquire-balance + Cached for 2 seconds to prevent rate limit (EGW00201) + """ + # Check cache + now = time.time() + if hasattr(self, '_balance_cache') and self._balance_cache: + last_time, data = self._balance_cache + if now - last_time < 2.0: # 2 Seconds TTL + return data + + log_source = f" [Source: {source}]" if source else "" + logger.info(f"get_balance{log_source}: Account={self.account_no}, Paper={self.is_paper}") + + tr_id = "VTTC8434R" if self.is_paper else "TTTC8434R" + + params = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "AFHR_FLPR_YN": "N", + "OFL_YN": "", + "INQR_DVSN": "02", # 02: By Stock + "UNPR_DVSN": "01", + "FUND_STTL_ICLD_YN": "N", + "FNCG_AMT_AUTO_RDPT_YN": "N", + "PRCS_DVSN": "00", + "CTX_AREA_FK100": "", + "CTX_AREA_NK100": "" + } + res = self._request("GET", "/uapi/domestic-stock/v1/trading/inquire-balance", tr_id=tr_id, params=params) + + # Update Cache if success + if res and res.get('rt_cd') == '0': + self._balance_cache = (now, res) + + return res + + def get_overseas_balance(self, exchange="NASD"): + """ + overseas-stock inquire-balance + """ + # For overseas, we need to know the exchange code often, but inquire-balance might return all if configured? + # Typically requires an exchange code in some params or TR IDs specific to exchange? + # Looking at docs: TTTS3012R is for "Overseas Stock Balance" + + tr_id = "VTTS3012R" if self.is_paper else "TTTS3012R" + # Paper env TR ID is tricky, usually V... but let's assume VTTS3012R or JTTT3012R? + # Common pattern: Real 'T...' -> Paper 'V...' + + params = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "OVRS_EXCG_CD": exchange, # NASD, NYSE, AMEX, HKS, TSE, etc. + "TR_CRCY_CD": "USD", # Transaction Currency + "CTX_AREA_FK200": "", + "CTX_AREA_NK200": "" + } + + return self._request("GET", "/uapi/overseas-stock/v1/trading/inquire-balance", tr_id=tr_id, params=params) + + def place_order(self, code, type, qty, price): + """ + order-cash + type: 'buy' or 'sell' + """ + if self.is_paper: + tr_id = "VTTC0012U" if type == 'buy' else "VTTC0011U" + else: + tr_id = "TTTC0012U" if type == 'buy' else "TTTC0011U" + + # 00: Limit (Specified Price), 01: Market Price + ord_dvsn = "00" if int(price) > 0 else "01" + + body = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "PDNO": code, + "ORD_DVSN": ord_dvsn, + "ORD_QTY": str(qty), + "ORD_UNPR": str(price), + "EXCG_ID_DVSN_CD": "KRX", # KRX for Exchange + "SLL_TYPE": "01", # 01: Normal Sell + "CNDT_PRIC": "" + } + return self._request("POST", "/uapi/domestic-stock/v1/trading/order-cash", tr_id=tr_id, data=json.dumps(body)) + + def place_overseas_order(self, code, type, qty, price, market="NASD"): + """ + overseas-stock order + """ + # Checks for Paper vs Real and Buy vs Sell + # TR_ID might vary by country. Assuming US (NASD, NYSE, AMEX). + if self.is_paper: + tr_id = "VTTT1002U" if type == 'buy' else "VTTT1006U" + else: + # US Real: JTTT1002U (Buy), JTTT1006U (Sell) + # Note: This TR ID is for US Night Market (Main). + tr_id = "JTTT1002U" if type == 'buy' else "JTTT1006U" + + # Price '0' or empty is usually Market Price, but overseas api often requires specific handling. + # US Market Price Order usually uses ord_dvsn="00" and price="0" or empty? + # KIS Docs: US Limit="00", Market="00"?? No, usually "00" is Limit. + # "32": LOO, "33": LOC, "34": MOO, "35": MOC... + # Let's stick to Limit ("00") for now. If price is 0, user might mean Market, but US API requires price for limit. + # If user sends 0, let's try to assume "00" (Limit) with price 0 (might fail) or valid Market ("01"? No). + # Safe bet: US Market Order is "00" (Limit) with Price 0? No. + # Use "00" (Limit) as default. If price is 0, we can't easily do Market on US via standard "01" like domestic. + + ord_dvsn = "00" # Limit + + body = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "OVRS_EXCG_CD": market, + "PDNO": code, + "ORD_QTY": str(qty), + "OVRS_ORD_UNPR": str(price), + "ORD_SVR_DVSN_CD": "0", + "ORD_DVSN": ord_dvsn + } + + return self._request("POST", "/uapi/overseas-stock/v1/trading/order", tr_id=tr_id, data=json.dumps(body)) + + def get_daily_orders(self, start_date=None, end_date=None, expanded_code=None): + """ + inquire-daily-ccld + """ + if self.is_paper: + tr_id = "VTTC0081R" # 3-month inner + else: + tr_id = "TTTC0081R" # 3-month inner + + if not start_date: + start_date = datetime.datetime.now().strftime("%Y%m%d") + if not end_date: + end_date = datetime.datetime.now().strftime("%Y%m%d") + + params = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "INQR_STRT_DT": start_date, + "INQR_END_DT": end_date, + "SLL_BUY_DVSN_CD": "00", # All + "PDNO": "", + "CCLD_DVSN": "00", # All (Executed + Unexecuted) + "INQR_DVSN": "00", # Reverse Order + "INQR_DVSN_3": "00", # All + "ORD_GNO_BRNO": "", + "ODNO": "", + "INQR_DVSN_1": "", + "CTX_AREA_FK100": "", + "CTX_AREA_NK100": "" + } + return self._request("GET", "/uapi/domestic-stock/v1/trading/inquire-daily-ccld", tr_id=tr_id, params=params) + + def get_cancelable_orders(self): + """ + inquire-psbl-rvsecncl + """ + tr_id = "VTTC0084R" if self.is_paper else "TTTC0084R" + + params = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "INQR_DVSN_1": "0", # 0: Order No order + "INQR_DVSN_2": "0", # 0: All + "CTX_AREA_FK100": "", + "CTX_AREA_NK100": "" + } + return self._request("GET", "/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl", tr_id=tr_id, params=params) + + def cancel_order(self, org_no, order_no, qty, is_buy, price="0", total=True): + """ + order-rvsecncl + """ + if self.is_paper: + tr_id = "VTTC0013U" + else: + tr_id = "TTTC0013U" + + rvse_cncl_dvsn_cd = "02" + qty_all = "Y" if total else "N" + + body = { + "CANO": self.account_no, + "ACNT_PRDT_CD": self.account_prod, + "KRX_FWDG_ORD_ORGNO": org_no, + "ORGN_ODNO": order_no, + "ORD_DVSN": "00", + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": str(qty), + "ORD_UNPR": str(price), + "QTY_ALL_ORD_YN": qty_all, + "EXCG_ID_DVSN_CD": "KRX" + } + return self._request("POST", "/uapi/domestic-stock/v1/trading/order-rvsecncl", tr_id=tr_id, data=json.dumps(body)) + +# Singleton Instance +kis = KisApi() + diff --git a/backend/main.py b/backend/main.py new file mode 100644 index 0000000..88fee7f --- /dev/null +++ b/backend/main.py @@ -0,0 +1,313 @@ +import os +import uvicorn +import threading +import asyncio +from fastapi import FastAPI, HTTPException, Depends, Body, Header, BackgroundTasks +import fastapi +from fastapi.staticfiles import StaticFiles +from fastapi.responses import FileResponse, JSONResponse +from sqlalchemy.orm import Session +from typing import List, Optional + +from database import init_db, get_db, TradeSetting, Order, News, Stock, Watchlist +from config import load_config, save_config, get_kis_config +from kis_api import kis +from trader import trader +from news_ai import news_bot +from telegram_notifier import notifier +import logging + +logger = logging.getLogger("MAIN") + + +app = FastAPI() + +# Get absolute path to the directory where main.py is located +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +# Root project directory (one level up from backend) +PROJECT_ROOT = os.path.dirname(BASE_DIR) +# Frontend directory +FRONTEND_DIR = os.path.join(PROJECT_ROOT, "frontend") + +# Create frontend directory if it doesn't exist (for safety) +if not os.path.exists(FRONTEND_DIR): + os.makedirs(FRONTEND_DIR) + +# Mount static files +app.mount("/static", StaticFiles(directory=FRONTEND_DIR), name="static") + +from websocket_manager import ws_manager +from fastapi import WebSocket + +@app.websocket("/ws") +async def websocket_endpoint(websocket: WebSocket): + await ws_manager.connect_frontend(websocket) + try: + while True: + # Keep alive or handle frontend formatting + data = await websocket.receive_text() + # If frontend sends "subscribe:CODE", we could forward to KIS + if data.startswith("sub:"): + code = data.split(":")[1] + await ws_manager.subscribe_stock(code) + except: + ws_manager.disconnect_frontend(websocket) + +@app.on_event("startup") +def startup_event(): + init_db() + # Start Background Threads + trader.start() + news_bot.start() + + # Start KIS WebSocket Loop + # We need a way to run async loop in bg. + # Uvicorn runs in asyncio loop. We can create task. + asyncio.create_task(ws_manager.start_kis_socket()) + + notifier.send_message("🚀 KisStock AI 시스템이 시작되었습니다.") + + +@app.on_event("shutdown") +def shutdown_event(): + notifier.send_message("🛑 KisStock AI 시스템이 종료됩니다.") + trader.stop() + news_bot.stop() + + +# --- Pages --- +@app.get("/") +async def read_index(): + return FileResponse(os.path.join(FRONTEND_DIR, "index.html")) + +@app.get("/news") +async def read_news(): + return FileResponse(os.path.join(FRONTEND_DIR, "news.html")) + +@app.get("/stocks") +async def read_stocks(): + return FileResponse(os.path.join(FRONTEND_DIR, "stocks.html")) + +@app.get("/settings") +async def read_settings(): + return FileResponse(os.path.join(FRONTEND_DIR, "settings.html")) + +@app.get("/trade") +async def read_trade(): + return FileResponse(os.path.join(FRONTEND_DIR, "trade.html")) + +# --- API --- +from master_loader import master_loader +from database import Watchlist + +@app.get("/api/sync/status") +def get_sync_status(): + return master_loader.get_status() + +@app.post("/api/sync/master") +def sync_master_data(background_tasks: fastapi.BackgroundTasks): + # Run in background + background_tasks.add_task(master_loader.download_and_parse_domestic) + background_tasks.add_task(master_loader.download_and_parse_overseas) + return {"status": "started", "message": "Master data sync started in background"} + +@app.get("/api/stocks") +def search_stocks(keyword: str = "", market: str = "", page: int = 1, db: Session = Depends(get_db)): + query = db.query(Stock) + if keyword: + query = query.filter(Stock.name.contains(keyword) | Stock.code.contains(keyword)) + if market: + query = query.filter(Stock.market == market) + + limit = 50 + offset = (page - 1) * limit + items = query.limit(limit).offset(offset).all() + return {"items": items} + +@app.get("/api/watchlist") +def get_watchlist(db: Session = Depends(get_db)): + return db.query(Watchlist).order_by(Watchlist.created_at.desc()).all() + +@app.post("/api/watchlist") +def add_watchlist(code: str = Body(...), name: str = Body(...), market: str = Body(...), db: Session = Depends(get_db)): + exists = db.query(Watchlist).filter(Watchlist.code == code).first() + if exists: return {"status": "exists"} + item = Watchlist(code=code, name=name, market=market) + db.add(item) + db.commit() + return {"status": "added"} + +@app.delete("/api/watchlist/{code}") +def delete_watchlist(code: str, db: Session = Depends(get_db)): + db.query(Watchlist).filter(Watchlist.code == code).delete() + db.commit() + return {"status": "deleted"} + +@app.get("/api/settings") +def get_settings(): + return load_config() + +@app.post("/api/settings") +def update_settings(settings: dict = Body(...)): + save_config(settings) + return {"status": "ok"} + +from database import AccountBalance, Holding +import datetime + +@app.get("/api/balance") +def get_my_balance(source: str = "db", db: Session = Depends(get_db)): + """ + Return persisted balance and holdings from DB. + Structure similar to KIS API to minimize frontend changes, or simplified. + """ + # 1. Balance Summary + acc = db.query(AccountBalance).first() + output2 = [] + if acc: + output2.append({ + "tot_evlu_amt": acc.total_eval, + "dnca_tot_amt": acc.deposit, + "evlu_pfls_smtl_amt": acc.total_profit + }) + + # 2. Holdings (Domestic) + holdings = db.query(Holding).filter(Holding.market == 'DOMESTIC').all() + output1 = [] + for h in holdings: + output1.append({ + "pdno": h.code, + "prdt_name": h.name, + "hldg_qty": h.quantity, + "prpr": h.current_price, + "pchs_avg_pric": h.price, + "evlu_pfls_rt": h.profit_rate + }) + + return { + "rt_cd": "0", + "msg1": "Success from DB", + "output1": output1, + "output2": output2 + } + +@app.get("/api/balance/overseas") +def get_my_overseas_balance(db: Session = Depends(get_db)): + # Persisted Overseas Holdings + holdings = db.query(Holding).filter(Holding.market == 'NASD').all() + output1 = [] + for h in holdings: + output1.append({ + "ovrs_pdno": h.code, + "ovrs_item_name": h.name, + "ovrs_cblc_qty": h.quantity, + "now_pric2": h.current_price, + "frcr_pchs_amt1": h.price, + "evlu_pfls_rt": h.profit_rate + }) + + return { + "rt_cd": "0", + "output1": output1 + } + +@app.post("/api/balance/refresh") +def force_refresh_balance(background_tasks: BackgroundTasks): + trader.refresh_assets() # Run synchronously to return fresh data immediately? Or BG? + # User perception: "Loading..." -> Show data. + # If we run BG, frontend needs to poll. + # Let's run Sync for "Refresh" button (unless it takes too long). + # KIS API is reasonably fast (milliseconds). + # trader.refresh_assets() + return {"status": "ok"} + +@app.get("/api/price/{code}") +def get_stock_price(code: str): + price = kis.get_current_price(code) + if price: + return price + raise HTTPException(status_code=404, detail="Stock info not found") + +@app.post("/api/order") +def place_order_api( + code: str = Body(...), + type: str = Body(...), + qty: int = Body(...), + price: int = Body(...), + market: str = Body("DOMESTIC") +): + if market in ["NASD", "NYSE", "AMEX"]: + res = kis.place_overseas_order(code, type, qty, price, market) + else: + res = kis.place_order(code, type, qty, price) + + if res and res.get('rt_cd') == '0': + return res + raise HTTPException(status_code=400, detail=f"Order Failed: {res}") + +@app.get("/api/orders") +def get_db_orders(db: Session = Depends(get_db)): + orders = db.query(Order).order_by(Order.created_at.desc()).limit(50).all() + return orders + +@app.get("/api/orders/daily") +def get_daily_orders_api(): + res = kis.get_daily_orders() + if res: + return res + raise HTTPException(status_code=500, detail="Failed to fetch daily orders") + +@app.get("/api/orders/cancelable") +def get_cancelable_orders_api(): + res = kis.get_cancelable_orders() + if res: + return res + raise HTTPException(status_code=500, detail="Failed to fetch cancelable orders") + +@app.post("/api/order/cancel") +def cancel_order_api( + org_no: str = Body(...), + order_no: str = Body(...), + qty: int = Body(...), + is_buy: bool = Body(...), + price: int = Body(0) +): + res = kis.cancel_order(org_no, order_no, qty, is_buy, price) + if res and res.get('rt_cd') == '0': + return res + raise HTTPException(status_code=400, detail=f"Cancel Failed: {res}") + + +@app.get("/api/news") +def get_news(db: Session = Depends(get_db)): + news = db.query(News).order_by(News.created_at.desc()).limit(20).all() + return news + +@app.get("/api/trade_settings") +def get_trade_settings(db: Session = Depends(get_db)): + return db.query(TradeSetting).all() + +@app.post("/api/trade_settings") +def set_trade_setting( + code: str = Body(...), + target_price: Optional[float] = Body(None), + stop_loss_price: Optional[float] = Body(None), + is_active: bool = Body(True), + db: Session = Depends(get_db) +): + setting = db.query(TradeSetting).filter(TradeSetting.code == code).first() + if not setting: + setting = TradeSetting(code=code) + db.add(setting) + + if target_price is not None: + setting.target_price = target_price + if stop_loss_price is not None: + setting.stop_loss_price = stop_loss_price + setting.is_active = is_active + + db.commit() + return {"status": "ok"} + +if __name__ == "__main__": + uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) diff --git a/backend/master_loader.py b/backend/master_loader.py new file mode 100644 index 0000000..97f49b1 --- /dev/null +++ b/backend/master_loader.py @@ -0,0 +1,253 @@ + +import os +import requests +import zipfile +import io +import pandas as pd +from database import SessionLocal, Stock, engine +from sqlalchemy.orm import Session +import logging + +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger("MASTER_LOADER") + +class MasterLoader: + def __init__(self): + self.base_dir = os.path.dirname(os.path.abspath(__file__)) + self.tmp_dir = os.path.join(self.base_dir, "tmp_master") + if not os.path.exists(self.tmp_dir): + os.makedirs(self.tmp_dir) + self.sync_status = {"status": "idle", "message": ""} + + def get_status(self): + return self.sync_status + + def _set_status(self, status, message): + self.sync_status = {"status": status, "message": message} + logger.info(f"Sync Status: {status} - {message}") + + def download_and_parse_domestic(self): + self._set_status("running", "Downloading Domestic Master...") + urls = { + "kospi": "https://new.real.download.dws.co.kr/common/master/kospi_code.mst.zip", + "kosdaq": "https://new.real.download.dws.co.kr/common/master/kosdaq_code.mst.zip" + } + + db = SessionLocal() + try: + for market, url in urls.items(): + logger.info(f"Downloading {market} master data from {url}...") + try: + res = requests.get(url) + if res.status_code != 200: + logger.error(f"Failed to download {market} master") + self._set_status("error", f"Failed to download {market}") + continue + + with zipfile.ZipFile(io.BytesIO(res.content)) as z: + filename = f"{market}_code.mst" + z.extract(filename, self.tmp_dir) + + file_path = os.path.join(self.tmp_dir, filename) + self._parse_domestic_file(file_path, market.upper(), db) + + except Exception as e: + logger.error(f"Error processing {market}: {e}") + self._set_status("error", f"Error processing {market}: {e}") + + db.commit() + if self.sync_status['status'] != 'error': + self._set_status("running", "Domestic Sync Complete") + finally: + db.close() + + def _parse_domestic_file(self, file_path, market_name, db: Session): + with open(file_path, 'r', encoding='cp949') as f: + lines = f.readlines() + + logger.info(f"Parsing {len(lines)} lines for {market_name}...") + + batch = [] + for line in lines: + code = line[0:9].strip() + name = line[21:61].strip() + + if not code or not name: + continue + + batch.append({ + "code": code, + "name": name, + "market": market_name, + "type": "DOMESTIC" + }) + + if len(batch) >= 1000: + self._upsert_batch(db, batch) + batch = [] + + if batch: + self._upsert_batch(db, batch) + + def download_and_parse_overseas(self): + if self.sync_status['status'] == 'error': return + + self._set_status("running", "Downloading Overseas Master...") + + # NASDAQ from text file + urls = { + "NASD": "https://www.nasdaqtrader.com/dynamic/symdir/nasdaqlisted.txt", + # "NYSE": "https://new.real.download.dws.co.kr/common/master/usa_nys.mst.zip", + # "AMEX": "https://new.real.download.dws.co.kr/common/master/usa_ams.mst.zip" + } + + db = SessionLocal() + error_count = 0 + try: + for market, url in urls.items(): + logger.info(f"Downloading {market} master data from {url}...") + try: + res = requests.get(url) + logger.info(f"HTTP Status: {res.status_code}") + if res.status_code != 200: + logger.error(f"Download failed for {market}. Status: {res.status_code}") + error_count += 1 + continue + + if url.endswith('.txt'): + self._parse_nasdaq_txt(res.text, market, db) + else: + with zipfile.ZipFile(io.BytesIO(res.content)) as z: + target_file = None + for f in z.namelist(): + if f.endswith(".mst"): + target_file = f + break + if target_file: + z.extract(target_file, self.tmp_dir) + file_path = os.path.join(self.tmp_dir, target_file) + self._parse_overseas_file(file_path, market, db) + + except Exception as e: + logger.error(f"Error processing {market}: {e}") + error_count += 1 + + db.commit() + + if error_count == len(urls): + self._set_status("error", "All overseas downloads failed.") + elif error_count > 0: + self._set_status("warning", f"Overseas Sync Partial ({error_count} failed).") + else: + self._set_status("done", "All Sync Complete.") + finally: + db.close() + + def _parse_nasdaq_txt(self, content, market_name, db: Session): + # Format: Symbol|Security Name|Market Category|Test Issue|Financial Status|Round Lot Size|ETF|NextShares + lines = content.splitlines() + logger.info(f"Parsing {len(lines)} lines for {market_name} (TXT)...") + + batch = [] + parsed_count = 0 + + for line in lines: + try: + if not line or line.startswith('Symbol|') or line.startswith('File Creation Time'): + continue + + parts = line.split('|') + if len(parts) < 7: continue + + symbol = parts[0] + name = parts[1] + # market_category = parts[2] + financial_status = parts[4] # N=Normal, D=Deficient, E=Delinquent, Q=Bankrupt, G=Deficient and Bankrupt + etf_flag = parts[6] # Y/N + + is_etf = (etf_flag == 'Y') + + batch.append({ + "code": symbol, + "name": name, + "name_eng": name, + "market": market_name, + "type": "OVERSEAS", + "financial_status": financial_status, + "is_etf": is_etf + }) + + if len(batch) >= 1000: + self._upsert_batch(db, batch) + parsed_count += len(batch) + batch = [] + except Exception as e: + # logger.error(f"Parse error: {e}") + continue + + if batch: + self._upsert_batch(db, batch) + parsed_count += len(batch) + + logger.info(f"Parsed and Upserted {parsed_count} items for {market_name}") + + def _parse_overseas_file(self, file_path, market_name, db: Session): + with open(file_path, 'r', encoding='cp949', errors='ignore') as f: + lines = f.readlines() + + logger.info(f"Parsing {len(lines)} lines for {market_name}... (File: {os.path.basename(file_path)})") + + batch = [] + parsed_count = 0 + for line in lines: + try: + b_line = line.encode('cp949') + symbol = b_line[0:16].decode('cp949').strip() + name_eng = b_line[16:80].decode('cp949').strip() + + if not symbol: continue + + batch.append({ + "code": symbol, + "name": name_eng, + "name_eng": name_eng, + "market": market_name, + "type": "OVERSEAS" + }) + + if len(batch) >= 1000: + self._upsert_batch(db, batch) + parsed_count += len(batch) + batch = [] + except Exception as e: + continue + + if batch: + self._upsert_batch(db, batch) + parsed_count += len(batch) + + logger.info(f"Parsed and Upserted {parsed_count} items for {market_name}") + + def _upsert_batch(self, db: Session, batch): + for item in batch: + existing = db.query(Stock).filter(Stock.code == item['code']).first() + if existing: + existing.name = item['name'] + existing.market = item['market'] + existing.type = item['type'] + if 'name_eng' in item: existing.name_eng = item['name_eng'] + if 'financial_status' in item: existing.financial_status = item['financial_status'] + if 'is_etf' in item: existing.is_etf = item['is_etf'] + else: + stock = Stock(**item) + db.add(stock) + db.commit() + +master_loader = MasterLoader() + +if __name__ == "__main__": + print("Starting sync...") + master_loader.download_and_parse_domestic() + print("Domestic Done. Starting Overseas...") + master_loader.download_and_parse_overseas() + print("Sync Complete.") diff --git a/backend/migrate_db.py b/backend/migrate_db.py new file mode 100644 index 0000000..a962416 --- /dev/null +++ b/backend/migrate_db.py @@ -0,0 +1,37 @@ + +import sqlite3 +import os + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +DB_PATH = os.path.join(os.path.dirname(BASE_DIR), 'kis_stock.db') + +def migrate(): + print(f"Migrating database at {DB_PATH}...") + conn = sqlite3.connect(DB_PATH) + cursor = conn.cursor() + + # Check if columns exist, if not add them + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN name_eng VARCHAR") + print("Added name_eng") + except Exception as e: + print(f"Skipping name_eng: {e}") + + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN industry VARCHAR") + print("Added industry") + except Exception as e: + print(f"Skipping industry: {e}") + + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN type VARCHAR DEFAULT 'DOMESTIC'") + print("Added type") + except Exception as e: + print(f"Skipping type: {e}") + + conn.commit() + conn.close() + print("Migration complete.") + +if __name__ == "__main__": + migrate() diff --git a/backend/migrate_db_v2.py b/backend/migrate_db_v2.py new file mode 100644 index 0000000..99daa9b --- /dev/null +++ b/backend/migrate_db_v2.py @@ -0,0 +1,57 @@ + +import sqlite3 +import os + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +DB_PATH = os.path.join(os.path.dirname(BASE_DIR), 'kis_stock.db') + +def migrate(): + print(f"Migrating database v2 at {DB_PATH}...") + conn = sqlite3.connect(DB_PATH) + cursor = conn.cursor() + + # Financial Status (Health) + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN financial_status VARCHAR") + print("Added financial_status") + except Exception as e: + print(f"Skipping financial_status: {e}") + + # ETF Facet + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN is_etf BOOLEAN DEFAULT 0") + print("Added is_etf") + except Exception as e: + print(f"Skipping is_etf: {e}") + + # Current Price (Cache) + try: + cursor.execute("ALTER TABLE stocks ADD COLUMN current_price FLOAT DEFAULT 0") + print("Added current_price") + except Exception as e: + print(f"Skipping current_price: {e}") + + # Stock Price History Table + try: + cursor.execute(""" + CREATE TABLE IF NOT EXISTS stock_prices ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + code VARCHAR NOT NULL, + price FLOAT, + change FLOAT, + volume INTEGER, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP + ) + """) + cursor.execute("CREATE INDEX IF NOT EXISTS idx_stock_prices_code ON stock_prices (code)") + cursor.execute("CREATE INDEX IF NOT EXISTS idx_stock_prices_created_at ON stock_prices (created_at)") + print("Created stock_prices table") + except Exception as e: + print(f"Error creating stock_prices: {e}") + + conn.commit() + conn.close() + print("Migration v2 complete.") + +if __name__ == "__main__": + migrate() diff --git a/backend/migrate_db_v3.py b/backend/migrate_db_v3.py new file mode 100644 index 0000000..fa754a1 --- /dev/null +++ b/backend/migrate_db_v3.py @@ -0,0 +1,18 @@ +from sqlalchemy import create_engine, text +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +DB_URL = f"sqlite:///{os.path.join(BASE_DIR, 'kis_stock.db')}" + +engine = create_engine(DB_URL) + +def migrate(): + with engine.connect() as conn: + try: + conn.execute(text("ALTER TABLE watchlist ADD COLUMN is_monitoring BOOLEAN DEFAULT 1")) + print("Added is_monitoring column to watchlist") + except Exception as e: + print(f"Column might already exist: {e}") + +if __name__ == "__main__": + migrate() diff --git a/backend/news_ai.py b/backend/news_ai.py new file mode 100644 index 0000000..df83bf9 --- /dev/null +++ b/backend/news_ai.py @@ -0,0 +1,147 @@ +import time +import threading +import logging +import requests +import json +from sqlalchemy.orm import Session +from database import SessionLocal, News, Stock +from config import get_kis_config, load_config + +logger = logging.getLogger("NEWS_AI") + +class NewsBot: + def __init__(self): + self.is_running = False + self.thread = None + self.config = load_config() + self.naver_id = self.config.get('naver', {}).get('client_id', '') + self.naver_secret = self.config.get('naver', {}).get('client_secret', '') + self.google_key = self.config.get('google', {}).get('api_key', '') + + def start(self): + if self.is_running: + return + self.is_running = True + self.thread = threading.Thread(target=self._run_loop, daemon=True) + self.thread.start() + logger.info("News Bot Started") + + def stop(self): + self.is_running = False + if self.thread: + self.thread.join() + logger.info("News Bot Stopped") + + def _run_loop(self): + while self.is_running: + try: + # Reload config to check current settings + self.config = load_config() + if self.config.get('preferences', {}).get('enable_news', False): + self._fetch_and_analyze() + else: + logger.info("News collection is disabled.") + except Exception as e: + logger.error(f"Error in news loop: {e}") + + # Sleep 10 minutes (600 seconds) + for _ in range(600): + if not self.is_running: break + time.sleep(1) + + def _fetch_and_analyze(self): + logger.info("Fetching News...") + if not self.naver_id or not self.naver_secret: + logger.warning("Naver API Credentials missing.") + return + + # 1. Fetch News (Naver) + # Search for generic economy terms or specific watchlist + query = "주식 시장" # General Stock Market + url = "https://openapi.naver.com/v1/search/news.json" + headers = { + "X-Naver-Client-Id": self.naver_id, + "X-Naver-Client-Secret": self.naver_secret + } + params = {"query": query, "display": 10, "sort": "date"} + + res = requests.get(url, headers=headers, params=params) + if res.status_code != 200: + logger.error(f"Naver News Failed: {res.text}") + return + + items = res.json().get('items', []) + + db = SessionLocal() + try: + for item in items: + title = item['title'] + link = item['originallink'] or item['link'] + pub_date = item['pubDate'] + + # Check duplication + if db.query(News).filter(News.link == link).first(): + continue + + # 2. AI Analysis (Google Gemini) + analysis = self._analyze_with_ai(title, item['description']) + + # Save to DB + news = News( + title=title, + link=link, + pub_date=pub_date, + analysis_result=analysis.get('summary', ''), + impact_score=analysis.get('score', 0), + related_sector=analysis.get('sector', '') + ) + db.add(news) + db.commit() + logger.info(f"Processed {len(items)} news items.") + finally: + db.close() + + def _analyze_with_ai(self, title, description): + if not self.google_key: + return {"summary": "No API Key", "score": 0, "sector": ""} + + logger.info(f"Analyzing: {title[:30]}...") + + # Prompt + prompt = f""" + Analyze the following news for stock market impact. + Title: {title} + Description: {description} + + Return JSON format: + {{ + "summary": "One line summary of impact", + "score": Integer between -10 (Negative) to 10 (Positive), + "sector": "Related Industry/Sector or 'None'" + }} + """ + + url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key={self.google_key}" + headers = {"Content-Type": "application/json"} + body = { + "contents": [{ + "parts": [{"text": prompt}] + }] + } + + try: + res = requests.post(url, headers=headers, data=json.dumps(body)) + if res.status_code == 200: + result = res.json() + text = result['candidates'][0]['content']['parts'][0]['text'] + # Clean markdown json if any + text = text.replace("```json", "").replace("```", "").strip() + return json.loads(text) + else: + logger.error(f"Gemini API Error: {res.text}") + except Exception as e: + logger.error(f"AI Analysis Exception: {e}") + + return {"summary": "Error", "score": 0, "sector": ""} + +news_bot = NewsBot() diff --git a/backend/telegram_notifier.py b/backend/telegram_notifier.py new file mode 100644 index 0000000..5bfcca2 --- /dev/null +++ b/backend/telegram_notifier.py @@ -0,0 +1,43 @@ +import requests +import logging +from config import load_config + +logger = logging.getLogger("TELEGRAM") + +class TelegramNotifier: + def __init__(self): + self.config = load_config() + self.bot_token = self.config.get('telegram', {}).get('bot_token', '') + self.chat_id = self.config.get('telegram', {}).get('chat_id', '') + + def reload_config(self): + self.config = load_config() + self.bot_token = self.config.get('telegram', {}).get('bot_token', '') + self.chat_id = self.config.get('telegram', {}).get('chat_id', '') + + def send_message(self, text): + # Reload to ensure we have latest from settings + self.reload_config() + + # Check if enabled + if not self.config.get('preferences', {}).get('enable_telegram', True): + return + + if not self.bot_token or not self.chat_id: + logger.warning("Telegram credentials missing.") + return + + url = f"https://api.telegram.org/bot{self.bot_token}/sendMessage" + payload = { + "chat_id": self.chat_id, + "text": text + } + + try: + res = requests.post(url, json=payload, timeout=5) + if res.status_code != 200: + logger.error(f"Telegram Send Failed: {res.text}") + except Exception as e: + logger.error(f"Telegram Error: {e}") + +notifier = TelegramNotifier() diff --git a/backend/test_db_verification.py b/backend/test_db_verification.py new file mode 100644 index 0000000..893f9d3 --- /dev/null +++ b/backend/test_db_verification.py @@ -0,0 +1,29 @@ +import sys +import os + +# Ensure current dir is in path +sys.path.append(os.path.dirname(os.path.abspath(__file__))) + +from database import init_db, SessionLocal, AccountBalance, Holding, engine +from trader import trader +import logging + +logging.basicConfig(level=logging.INFO) + +def test_db_migration(): + print("Initializing DB...") + init_db() + + # Check tables + from sqlalchemy import inspect + inspector = inspect(engine) + tables = inspector.get_table_names() + print(f"Tables: {tables}") + + if "account_balance" in tables and "holdings" in tables: + print("PASS: New tables created.") + else: + print("FAIL: Tables missing.") + +if __name__ == "__main__": + test_db_migration() diff --git a/backend/test_telegram_toggle.py b/backend/test_telegram_toggle.py new file mode 100644 index 0000000..e4f739f --- /dev/null +++ b/backend/test_telegram_toggle.py @@ -0,0 +1,43 @@ +import sys +import os + +sys.path.append(os.path.dirname(os.path.abspath(__file__))) + +from telegram_notifier import notifier +from config import save_config, load_config + +def test_telegram_toggle(): + print("Testing Telegram Toggle...") + original_config = load_config() + + try: + # 1. Enable + print("1. Testing ENABLED...") + cfg = load_config() + if 'preferences' not in cfg: cfg['preferences'] = {} + cfg['preferences']['enable_telegram'] = True + save_config(cfg) + + # We can't easily mock requests.post here without importing mock, + # but we can check if it attempts to read credentials. + # Ideally, we'd check if it returns early. + # For this environment, let's just ensure no crash. + notifier.send_message("Test Message (Should Send)") + + # 2. Disable + print("2. Testing DISABLED...") + cfg['preferences']['enable_telegram'] = False + save_config(cfg) + + # This should return early and NOT log "Telegram credentials missing" if implemented right. + notifier.send_message("Test Message (Should NOT Send)") + + print("Toggle logic executed without error.") + + finally: + # Restore + save_config(original_config) + print("Original config restored.") + +if __name__ == "__main__": + test_telegram_toggle() diff --git a/backend/tmp_master/kosdaq_code.mst b/backend/tmp_master/kosdaq_code.mst new file mode 100644 index 0000000..ea8640b --- /dev/null +++ b/backend/tmp_master/kosdaq_code.mst @@ -0,0 +1,1828 @@ +900110 HK0000057197̽ƮƽþȦ FS 000000000000NNN NNNNNNNN0NNNNNNNN0000009730000100001NNN00NNN000000100N0900000001974840000000000002010042300000000002628600000000000090958623012 0 NN0000004770000000590000000770005600000000220250930000000255 NNN +900270 HK0000214814ͱ׷ FS 000000000000NNN NNNNNNNN0NNNNNNNN0000001800000100001NNN00NNN000000100N0900000023369680000000000002016081800000000024404700000000000061037570712 0 NN00000075100000000000000001000008-0000000120250930000000439 NNN +900260 HK0000295359ν FS 000000000000NNN NNNNNNNN0NNNNNNNN0000015760000100001NNN00NNN000000100N0900000002172130000000000002016063000000000004602900000000000102955864312 0 NN0000038440000000420000000950008400000000520250930000000725 NNN +900290 HK0000307485GRT FS 000000000000 NN N N 0 N N0000036850000100001NNN00NNN000000050Y0900000004507280000000000002016102500000000008085000000000000105292947306 0 NN0000026310000004290000004070034300000000820250930000002979 NNN +900300 HK0000312568Ƽڽƽ FS 000000000000 NN N N 0 N N0000001420000100001NNN00NNN000000100N0900000054674650000000000002016110400000000025100400000000000162510108512 0 NN000001224-00000560-00000681-0681-0000002720250930000000356 NNN +900310 HK0000341732÷ FS 000000000000 NN N N 0 N N0000005700000100001NNN00NNN000000100N0900000001239610000000000002017081000000000006404100000000000039834322412 0 NN0000003620000000170000000140001200000000020250930000000365 NNN +900340 HK0000449303Ǫ FS 000000000000 NN N N 0 N N0000008000000100001NNN00NNN000000100N0900000002100150000000000002018113000000000005033000000000000036671486812 0 NN0000014430000000940000000720006100000000320250930000000402 NNN +000250 KR7000250001õ ST1100910240000NNY NNNNNNNN0NNNNNNNY0004395000000100001NNN00NNN000000100N0900000005701660000000005002000100400000000002345700000000001172873600012 0 NY00000165500000003000000005100041-0000000420250930000103095 NNN +000440 KR7000440008߾ӿʺ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000160000000100001NNN00NNN000000100N0900000000544320000000005001993032400000000000622700000000000311356500012 0 NN000000378-00000014-00000012-0012-0000000220250930000000996 NNN +0004V0 KR70004V0003˸ ST0100910260000 NN N N 0 N N0000202500000100001NNN00NNN000000100N0900000062307650000000010002026011400000000001040400000000001040446800012 0 NN0000000000000000000000000000000000000000020250930000002106 NNN +0004Y0 KR70004Y000014ȣ ST0101400000000 NN N Y 0 N N0000020350000100001NNN00NNN000000100N0900000000318620000000001002025072200000000000531500000000000053150000012 0 NN0000000000000000000000000000000000000000020241231000000108 NNN +0007C0 KR70007C0003ũ ST0000000000000 NN N N 0 N N0000422000000100001NNN00NNN000000100N0900000031720730000000005002025121600000000000803000000000000401516200012 0 NN000000075-00000025-00000031-003100000000020250930000003388 NNN +0008Z0 KR70008Z0005ý ST0100910280000 NN N N 0 N N0000330000000100001NNN00NNN000000060Y0900000000862470000000005002025081900000000000943600000000000491416650012 0 NN0000010630000001160000001300012300000000020250930000003114 NNN +0009K0 KR70009K0001ӵ̿ ST0100600000000 NN N N 0 N N0000572000000100001NNN00NNN000000100N0900000004084780000000005002025120400000000006467100000000003233558050012 0 NN000000093-00000048-00000299-029900000000020250930000036991 NNN +001000 KR7001000009Ŷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000021600000100001NNN00NNN000000100N0900000000680100000000001001994062800000000002427700000000000242775400012 0 NN000000037000000004-00000003-0003-0000000220241231000000524 NNN +0010V0 KR70010V0005Ǿコɾ ST0100910290000 NN N N 0 N N0000141500000100001NNN00NNN000000100N0900000000513570000000005002025082100000000000510500000000000255270000012 0 NN0000003620000000340000000360003200000000020250930000000722 NNN +0013V0 KR70013V0002ǰ ST0100910190000 NN N N 0 N N0000087400000100001NNN00NNN000000100N0900000006382650000000005002025122200000000000991800000000000498407800012 0 NN0000007610000000430000000340003700000000020250930000000866 NNN +001540 KR7001540004ȱǰ ST3100910240000NNY NNNYNNNN0NNNNNNNN0000084300000100001NNN00NNN000000060Y0900000000390890000000005002000061500000000001304200000000000652121000012 0 NN0000023030000001570000001320009900000000620250930000001099 NNN +0015G0 KR70015G0009׸ ST0100910290000 NN N N 0 N N0000317500000100001NNN02NNN000000100N0900000005608800000000005002025111700000000001170200000000000613721800012 0 NN000000282000000007-00000003-000400000000020250930000003715 NNN +0015N0 KR70015N0000ƷθƼī ST0100910230000 NN N N 0 N N0000096600000100001NNN00NNN000000100N0900000002929930000000005002025112700000000001271500000000000635752500012 0 NN0000005260000000570000000520004400000030820241231000001228 NNN +0015S0 KR70015S0005佺ī ST0100600000000 NN N N 0 N N0000258000000100001NNN00NNN000000100N0900000066880360000000005002025121000000000000966200000000000483136500012 0 NN0000001180000000050000000120001300000000020250930000002492 NNN +001810 KR7001810001SP ST3100910210000NNN NNNNNNNN0NNNNNNNN0000014270000100001NNN00NNN000000100N0900000000447030000000005002000010400000000002213700000000001106875000012 0 NN0000015110000000190000000310002600000000020250930000000315 NNN +001840 KR7001840008ȭ ST3101000000000NNN NNNNNNNN0NNYNNNNN0000022150000100001YNY00NNN000000100N0900000000000000000000005001994112300000000001626500000000000813271350012 0 NN000001283-00000198-00000232-0231-0000017420241231000000360 NNN +002230 KR7002230001ǿ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000146000000100001NNN02NNN000000100N0900000009368330000000005001991010400000000001927300000000000983462150012 0 NN0000007840000000400000000840006600000000820250930000002813 NNN +002290 KR7002290005ϱ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000038100000100001NNN00NNN000000100N0900000000424410000000005001992113000000000001240000000000000620000000012 0 NN0000011270000000570000000700005800000000920241231000000472 NNN +002680 KR7002680007ž ST3100910190000NNN NNNNNNNN0NNNNNNNN0000006870000100001NNN00NNN000000100N0900000001088790000000005001995070700000000003231600000000001615839950012 0 NN00000062600000002400000001700016-0000000620250930000000222 NNN +002800 KR7002800001Ž ST3100910240000 NN N N 0 N N0000057400000100001NNN00NNN000000100N0900000001008220000000005002017022800000000001517000000000000758525000012 0 NN0000008500000000750000000620005800000001020250930000000870 NNN +003100 KR7003100005 ST3101300000000NNN NNNNNNNN0NNNNNNNN0000196600000100001NNN00NNN000000060Y0900000000164600000000010001999122100000000000660000000000000660000000012 0 NN0000014120000002990000003020027500000000920250930000001297 NNN +003310 KR7003310000ֻ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000046600000100001NNN00NNN000000100N0900000205519440000000005001992080100000000003539200000000001869617500012 0 NN0000007450000000720000000730005800000001020250930000001649 NNN +003380 KR7003380003ϸ ST1101400000000 NN N N 0 N Y0000130800000100001NNN00NNN000000050Y0900000037883140000000001002017063000000000011200500000000001124204780012 0 NN0000982040000071400000054850472500000000420250930000014650HRMNNY +0037T0 KR70037T0008KB32ȣ ST0101400000000 NN N Y 0 N N0000020100000100001NNN00NNN000000100N0900000000074320000000001002025070400000000000633000000000000063300000012 0 NN00000000000000000000000000000000000000000 000000127 NNN +003800 KR7003800000̽ħ ST2100910310000NNN NNNNNNNN0NNNNNNNN0000337500000100001NNN00NNN000000050Y0900000000087700000000010001996050300000000001109000000000001109000000012 0 NN0000023780000004130000005620044100000000920250930000003742 NNN +0041B0 KR70041B000218ȣ ST0101400000000 NN N Y 0 N N0000020800000100001NNN00NNN000000100N0900000000035460000000001002025081400000000000504000000000000050400000012 0 NN00000000000000000000000000000000000000000 000000104 NNN +0041J0 KR70041J00041ȣ ST0101400000000 NN N Y 0 N N0000020050000100001NNN00NNN000000100N0900000000174620000000001002025072200000000000411000000000000041100000012 0 NN00000000000000000000000000000000000000000 000000082 NNN +0041L0 KR70041L0000ϳ35ȣ ST0101400000000 NN N Y 0 N N0000020050000100001NNN00NNN000000100N0900000000139480000000001002025080600000000000603000000000000060300000012 0 NN00000000000000000000000000000000000000000 000000120 NNN +0044K0 KR70044K0008Z10ȣ ST0101400000000 NN N Y 0 N N0000020150000100001NNN00NNN000000100N0900000000221140000000001002025082100000000000752000000000000075200000012 0 NN00000000000000000000000000000000000000000 000000151 NNN +004590 KR7004590006ѱ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000050400000100001NNN00NNN000000100N0900000000879770000000001001993060300000000001500000000000000150000000012 0 NN0000010120000001360000001330010500000000920250930000000756 NNN +004650 KR7004650008âؿź ST3100910190000NNN NNNNNNNN0NNNNNNNN0000095800000100001NNN00NNN000000100N0900000000322080000000005002014073000000000000919000000000000459544250012 0 NN0000009000000001340000001350010100000000820250930000000880 NNN +004780 KR7004780003 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000035850000100001NNN00NNN000000100N0900000000208260000000005001994122900000000001590300000000000795159950012 0 NN0000027470000001580000001570011500000000820241231000000570 NNN +005160 KR7005160007 ST2100910260000NNY NNNNNNNY0NNNNNNNN0000028150000100001NNN00NNN000000060Y0900000001652350000000010001999062500000000005424400000000005424448200012 0 NN000005759000000103-00000048-0063-0000000620250930000001526 NNN +005290 KR7005290002 ST1100910230000NNY NNNNNNYN0NNNNNNNY0000484500000100001NNN00NNN000000050Y0900000022796600000000005001999122100000000005141400000000002570724700012 0 NY0000088490000013080000008430064800000001120250930000024910 NNY +0054V0 KR70054V0002ġ32ȣ ST0101400000000 NN N Y 0 N N0000020100000100001NNN00NNN000000100N0900000000192370000000001002025120500000000000621600000000000062165000012 0 NN00000000000000000000000000000000000000000 000000124 NNN +005670 KR7005670005Ǫ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000061600000100001NNN00NNN000000100N0900000000585560000000005001993120700000000001000000000000000500000000012 0 NN0000024130000001660000001440010200000000820250930000000616136NNN +005710 KR7005710009 ST2100910300000NNN NNNNNNNN0NNNNNNNN0000129700000100001NNN00NNN000000060Y0900000000216070000000005001993062100000000002003700000000001001880000012 0 NN0000082370000007500000009030071400000002220250930000002598 NNN +005860 KR7005860002ϻ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000030150000100001NNN00NNN000000060Y0900000002092260000000005001994110700000000003940300000000001970184250012 0 NN0000034080000000400000000520004500000000320250930000001188 NNY +005990 KR7005990007Ȧ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000106800000100001NNN00NNN000000100N0900000000060830000000005001999051400000000001329800000000000685915200012 0 NN0000165010000004980000006360046800000000520250930000001420 NNN +006050 KR7006050009ؿ ST3100910250000NNN NNNNNNNN0NNNNNNNN0000013050000100001NNN00NNN000000100N0900000001832240000000005001994100700000000003489500000000001744762150012 0 NN0000007540000000090000000220002600000000520241231000000455 NNN +006140 KR7006140008 ST3100910290000NNN NNNNNNNN0NNNNNNNN0000082300000100001NNN00NNN000000100N0900000003232420000000005001993120700000000001500000000000000750000000012 0 NN0000016930000001080000001160009200000000720241231000001234 NNN +006620 KR7006620009̿ ST3100910240000 NN N N 0 N N0000054100000100001NNN00NNN000000060Y0900000003067300000000005002018021300000000002846400000000001423249600012 0 NN0000018080000000650000000990008900000000120250930000001539 NNY +006730 KR7006730006T&D ST2100600000000NNN NNNNNNNN0NNNNNNNY0000149800000100001NNN00NNN000000060Y0900000015253450000000005001995100600000000006492600000000003371346150012 0 NN0000016760000004550000003820029700000000720250930000009726 NNY +0068Y0 KR70068Y00033ȣ ST0101400000000 NN N Y 0 N N0000019950000100001NNN00NNN000000100N0900000000043900000000001002025112100000000000431000000000000043100000012 0 NN00000000000000000000000000000000000000000 000000085 NNN +006910 KR7006910004Ŀ ST3100910260000NNY NNNNNNNN1NNNNYNNN0000078600000100001NNN00NNN000000060Y0900000049941730000000005001994090700000000004912900000000002456491200012 0 NN0000007710000000480000000570006000000000720241231000003861 NNY +006920 KR7006920003 ST3100910250000NNN NNNNNNNN0NNNNNNNN0000032450000100001NNN00NNN000000100N0900000003128320000000005001989010500000000001092000000000000546000000012 0 NN000000594-00000012-00000009-0011-0000000120250930000000354 NNN +0071M0 KR70071M0002Z11ȣ ST0101400000000 NN N Y 0 N N0000020150000100001NNN00NNN000000100N0900000000576120000000001002025093000000000000576000000000000057600000012 0 NN00000000000000000000000000000000000000000 000000116 NNN +0072Z0 KR70072Z0006KB33ȣ ST0101400000000 NN N Y 0 N N0000019920000100001NNN00NNN000000100N0900000000528470000000001002025093000000000000788500000000000078850000012 0 NN00000000000000000000000000000000000000000 000000157 NNN +007330 KR7007330004Ǫ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000102900000100001NNN00NNN000000060Y0900000001710220000000010001993120700000000001508200000000001508280000012 0 NN0000000000000000000000000000000000000000020250930000001552144NNN +007370 KR7007370000 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000051200000100001NNN00NNN000000100N0900000000661290000000005002000072700000000001413400000000000706729350012 0 NN0000011330000001170000003710029700000002820241231000000723 NNN +007390 KR7007390008ó ST1100910240000NNY NNNNNNNN0NNNNNNNY0000241500000100001NNN00NNN000000100N0900000009653470000000005001992113000000000006443500000000003221752800012 0 NY000000144-00000034-00000032-0032-0000000520250930000015561 NNN +007530 KR7007530009̿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000023800000100001NNN00NNN000000100N0900000000230100000000005001994080500000000002225400000000001112711550012 0 NN0000013420000000350000000220002600000001120250930000000529 NNN +007680 KR7007680002 ST3101000000000 NN N N 0 N N0000041750000100001NNN00NNN000000100N0900000000368440000000005002017120100000000001344600000000000672323700012 0 NN000000836-00000122-00000079-0077-0000000420250930000000561 NNN +007720 KR7007720006ҳ뽺 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000006230000100001NNN00NNN000000100N0900000001645000000000005001994010600000000010080000000000005040022500012 0 NN000001249000000019000000000-0002-0000001220250930000000627139NNN +007770 KR7007770001ȭ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000079900000100001NNN00NNN000000100N0900000000029550000000005001992090700000000000351000000000000175500000012 0 NN000000935-00000099-00000112-0101-0000000620250930000000280 NNN +007820 KR7007820004ھ ST3100910270000NNN NNNNNNNN1NNNNNNNN0000064600000100001NNN00NNN000000100N0900000034919730000000005002011110800000000002003300000000001001697300012 0 NN000001194-00000010-00000030-002400000000520250930000001294535NNN +008290 KR7008290009dz ST3100910200000NNN NNNNNNNN0NNNNNNNN0000004400000100001NNN00NNN000000100N0900000000772130000000005001997071800000000004069300000000002034683950012 0 NN000000227-00000047-00000078-0022-0000001320241231000000179 NNN +008370 KR7008370009dz ST3100910230000NNN NNNNNNNN0NNNNNNNN0000047850000100001NNN00NNN000000100N0900000000076620000000005001992121800000000001200000000000000600000000012 0 NN0000000000000000000000000000000000000000020250930000000574 NNN +008470 KR7008470007νŸ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000040300000100001NNN00NNN000000100N0900000000033850000000005002011022300000000000840400000000000420240000012 0 NN0000009230000000230000000200001500000000420250930000000338 NNN +008830 KR7008830002뵿 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000177800000100001NNN00NNN000000060Y0900000002297010000000005001991051700000000000898700000000000449376000012 0 NN0000025710000000450000000030001200000000120241231000001597 NNY +0088D0 KR70088D0004޸1ȣ ST0101400000000 NN N Y 0 N N0000020350000100001NNN00NNN000000100N0900000000561020000000001002025121500000000000579500000000000057950000012 0 NN00000000000000000000000000000000000000000 000000117 NNN +0091W0 KR70091W0006ſ11ȣ ST0101400000000 NN N Y 0 N N0000020350000100001NNN00NNN000000100N0900000000148850000000001002025112400000000000606800000000000060680000012 0 NN00000000000000000000000000000000000000000 000000123 NNN +009300 KR7009300005 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000158600000100001NNN00NNN000000100N0900000000120290000000010002000071900000000000637000000000000637000000012 0 NN0000005700000000830000001180008900000000620250930000001010 NNN +0093G0 KR70093G0004̷º8ȣ ST0101400000000 NN N Y 0 N N0000019830000100001NNN00NNN000000100N0900000000434950000000001002025112700000000000640000000000000064000000012 0 NN00000000000000000000000000000000000000000 000000126 NNN +009520 KR7009520008ڿ ST2100910260000NNN NNNNNNNN0NNNNNNNY0000204500000100001NNN00NNN000000060Y0900000037402230000000005001997111000000000004164200000000002082135150012 0 NN0000034660000000140000000270000600000000020241231000008515853NNY +009620 KR7009620006ﺸ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000016910000100001NNN00NNN000000100N0900000003677080000000001001993120700000000001638600000000000163860910012 0 NN00000215700000010500000002600019-0000015620250930000000277 NNN +0096B0 KR70096B0006Z12ȣ ST0101400000000 NN N Y 0 N N0000020300000100001NNN00NNN000000100N0900000001708190000000001002025112800000000000658000000000000065800000012 0 NN00000000000000000000000000000000000000000 000000133 NNN +0096D0 KR70096D0004̷º9ȣ ST0101400000000 NN N Y 0 N N0000019980000100001NNN00NNN000000100N0900000000728430000000001002025120100000000000550000000000000055000000012 0 NN00000000000000000000000000000000000000000 000000109 NNN +009730 KR7009730003̷ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000006000000100001NNN00NNN000000100N0900000006590630000000005001990072700000000006187700000000003093858600012 0 NN000001098-00000047-00000156-0149-0000003320241231000000371 NNN +009780 KR7009780008 ST3100910190000NNN NNNNNNNN0NNNNNNNN0000079600000100001NNN00NNN000000060Y0900000001448070000000005001993101200000000001760000000000000880000000012 0 NN0000015090000002450000002260018000000001420250930000001400 NNY +0097F0 KR70097F0001̷º10ȣ ST0101400000000 NN N Y 0 N N0000019890000100001NNN00NNN000000100N0900000001089790000000001002025122300000000000650000000000000065000000012 0 NN00000000000000000000000000000000000000000 000000129 NNN +0098T0 KR70098T000419ȣ ST0101400000000 NN N Y 0 N N0000020250000100001NNN00NNN000000100N0900000002703760000000001002025121200000000000540000000000000054000000012 0 NN00000000000000000000000000000000000000000 000000109 NNN +0099W0 KR70099W0008̷º11ȣ ST0101400000000 NN N Y 0 N N0000019950000100001NNN00NNN000000100N0900000001120710000000001002025122200000000000700000000000000070000000012 0 NN00000000000000000000000000000000000000000 000000139 NNN +0099X0 KR70099X0007IBKS25ȣ ST0101400000000 NN N Y 0 N N0000021350000100001NNN00NNN000000100N0900000000183720000000001002025121900000000000598000000000000059800000012 0 NN00000000000000000000000000000000000000000 000000127 NNN +010170 KR7010170009ѱ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000033250000100001NNN00NNN000000100N0900000808100640000000005001994110700000000013198500000000006599283000012 0 NN000001103-00000164-00000163-0163-0000007820250930000004388 NNN +0101C0 KR70101C0008ϳ36ȣ ST0101400000000 NN N Y 0 N N0000019800000100001NNN00NNN000000100N0900000000947230000000001002025122200000000000774000000000000077400000012 0 NN00000000000000000000000000000000000000000 000000153 NNN +010240 KR7010240000ﱹ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000049700000100001NNN00NNN000000100N0900000000443770000000005002009051200000000001170600000000000616134800012 0 NN0000010290000001100000001090008700000001020250930000000581 NNN +010280 KR7010280006Ƽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000012000000100001NNN00NNN000000100N0900000013989960000000005002000041400000000006512300000000003256189300012 0 NN0000037690000001070000000530002800000001720250930000000781 NNN +010470 KR7010470003 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000058200000100001NNN00NNN000000100N0900000000277460000000010002000102400000000001197500000000001197505000012 0 NN0000016520000000410000000500003300000000720250930000000696391NNN +0105P0 KR70105P000912ȣ ST0101400000000 NN N Y 0 N N0000019940000100001NNN00NNN000000100N0900000000568770000000001002025121100000000000566000000000000056600000012 0 NN00000000000000000000000000000000000000000 000000112 NNN +011040 KR7011040003浿 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000057000000100001NNN00NNN000000060Y0900000000713170000000005001992121800000000003076800000000001568438300012 0 NN0000014410000000510000000570005600000000420250930000001753 NNN +011080 KR7011080009I&C ST3100910200000NNN NNNNNNNN0NNNNNNNN0000007020000100001NNN00NNN000000100N0900000006229360000000005002004070200000000004296200000000002148131100012 0 NN000000364-00000048-00000059-005900000000020250930000000301 NNN +011320 KR7011320009ũ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000041700000100001NNN00NNN000000100N0900000000573950000000005001993122900000000001932000000000000966034750012 0 NN0000031990000001330000001180009900000000920250930000000805 NNN +011370 KR7011370004 ST3101000000000NNN NNNNNNNN0NNNNNNNN0000009020000100001NNN00NNN000000100N0900000002687980000000005001994052400000000010089400000000005044743250012 0 NN0000048990000006010000004570033900000000920250930000000910 NNN +011560 KR7011560000̾ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000146800000100001NNN00NNN000000060Y0900000001037170000000005001996122300000000001053000000000000526500000012 0 NN0000051660000002760000003240024800000001020250930000001545 NNN +0115H0 KR70115H0007Z13ȣ ST0101400000000 NN N Y 0 N N0000038100000100001NNN00NNN000000100N0900000012132550000000001002026012100000000000735000000000000073500000012 0 NN0000000000000000000000000000000000000000020250930000000280 NNN +012210 KR7012210001̱ݼ ST0100910260000 NN N N 0 N N0000110100000100001NNN00NNN000000100N0900000014697540000000010002025122900000000002219200000000002219201200012 0 NN0000000000000000000000000000000000000000020250930000002443 NNN +012340 KR7012340006 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000004730000100001NNN00NNN000000100N0900000002201900000000005001997021200000000005352900000000002676476850012 0 NN000000624-00000034-00000049-0050-0000002720250930000000253 NNN +012620 KR7012620001Ư ST3100910260000NNN NNNNNNNN0NNNNNNNN0000082300000100001NNN00NNN000000100N0900000000151890000000005001994062800000000000440000000000000220000000012 0 NN0000029740000001060000000920007800000000520250930000000362 NNN +012700 KR7012700001 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000036700000100001NNN00NNN000000100N0900000000808390000000005001996011900000000002644600000000001377774100012 0 NN0000027780000000640000001140008800000000320250930000000970 NNN +012790 KR7012790002 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000059700000100001NNN00NNN000000100N0900000000666800000000005001999081300000000001198600000000000599320750012 0 NN0000008940000001520000001650014300000001020241231000000715 NNN +012860 KR7012860003̽ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000043800000100001NNN03NNN000000100N0900000286744280000000005001994102600000000007323300000000003661672850012 0 NN0000076420000002700000001520012600000000820250930000003207 NNN +013030 KR7013030002̷ڸ ST2100910260000NNY NNNNNNNN0NNNNYNNN0000327500000100001NNN00NNN000000050Y0900000000365590000000005001989121500000000001176800000000000680661600012 0 NN0000015720000004330000004740036400000001120250930000003854 NNY +013120 KR7013120001 ST2101000000000NNN NNNNNNNN0NNNNNNNN0000029750000100001NNN00NNN000000050Y0900000002278710000000005001994122900000000009080800000000004540405000012 0 NN0000029350000001330000002800020500000000120250930000002701 NNN +013310 KR7013310008 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000035100000100001NNN00NNN000000060Y0900000007511110000000005002015122200000000003880600000000001940329100012 0 NN0000073690000004760000002080009700000000520250930000001362 NNN +013720 KR7013720008THE CUBE& ST3100910300000NNN NNNNNNNN0NNNNNNNN0000009570000100001NNN00NNN000000100N0900000011030340000000010001993122900000000006082800000000006082814300012 0 NN000000195000000010-00000029-0029-0000002120250930000000582 NNN +013810 KR7013810007 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000025300000100001NNN00NNN000000100N0900000001501210000000005001997110300000000001465500000000000732773500012 0 NN000000245-00000019-00000012-0011-0000000220250930000000370 NNN +013990 KR7013990007ư۴ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000047200000100001NNN00NNN000000060Y0900000006721390000000005002002011700000000003288700000000001644376800012 0 NN0000013250000000830000000920006400000000620250930000001552 NNY +014100 KR7014100002޵ӽ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000017100000100001NNN00NNN000000100N0900000000293800000000005001995010300000000001180000000000000590000000012 0 NN000000381-00000012-00000064-0063-0000001720250930000000201 NNN +014190 KR7014190003ť ST3101100000000NNN NNNNNNNN0NNNNNNNN0000020550000100001NNN00NNN000000100N0900000006603860000000005001996042600000000003539900000000001769995300012 0 NN0000022080000000440000000460003800000000320250930000000727140NNN +014470 KR7014470009ι ST3000000000000NNN NNNNNNNN0NNNNNNNN0000013050000100001NNN00NNN000000100N0900000001662340000000005001994022500000000006005200000000003002613000012 0 NN0000025000000000130000000290002400000000720250930000000783 NNN +014570 KR7014570006 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000041700000100001NNN00NNN000000100N0900000000416210000000005002000120700000000001100000000000000550000000012 0 NN0000007300000000910000000500003000000000420241231000000458 NNN +014620 KR7014620009 ST1100910260000NNY NNNNNNNN0NYNNNNNY0000319500000100001NNN00NNN000000050Y0900000003356770000000005002001011100000000002655700000000001430000000012 0 NN0000018640000003320000003360026400000000620250930000008485 NNY +014940 KR7014940001Ż ST2100910270000NNN NNNNNNNN0NNNNNNNN0000086000000100001NNN00NNN000000100N0900000008190760000000005002001122600000000004557300000000002278683050012 0 NN0000015540000002080000002490016900000002120250930000003919 NNN +014950 KR7014950000 ST0100910240000 NN N N 0 N N0000166600000100001NNN00NNN000000100N0900000006276620000000001002025102700000000000919600000000000091964130012 0 NN0000004480000000320000000380002800000000020250930000001532 NNN +014970 KR7014970008︢ ST3100910210000NNN NNNNNNNN0NNNNNNNN0000070600000100001NNN00NNN000000060Y0900000000643950000000005001992122900000000001512500000000000756250000012 0 NN00000070000000002900000004600039-0000000720250930000001067 NNY +015710 KR7015710007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000034550000100001NNN00NNN000000100N0900000000417030000000005001997093000000000001753000000000000876525000012 0 NN0000010500000000370000000250002400000000220241231000000605 NNN +015750 KR7015750003 ST2100910300000NNY NYNNNNNN0NNNNNNNY0000080000000100001NNN00NNN000000050Y0900000017005860000000005001995110400000000008000000000000004000000000012 0 NN0000338800000018710000013870126400000001220250930000006400 NNY +016100 KR7016100000ڽƽ ST3100910210000NNN NNNNNNNN0NNNNNNNN0000018130000100001NNN00NNN000000100N0900000000935560000000005002003011500000000001910000000000000955044700012 0 NN000000567-00000040-00000044-0044-0000001920250930000000346 NNN +016250 KR7016250003SGC E&C ST3101000000000NNY NNNNNNNN0NYNNNNNN0000148400000100001NNN00NNN000000100N0900000000184840000000050001999122800000000000503600000000002570007000012 0 NN000009918000000381-00000280-0202-0000001220250930000000747378NNN +016600 KR7016600009ťijŻ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000002380000100001NNN00NNN000000100N0900000007002750000000005001993062100000000017824700000000008912355600012 0 NN0000001870000000280000000290001800000000120241231000000424 NNN +016670 KR7016670002 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000041050000100001NNN00NNN000000100N0900000000132540000000005001993042100000000000759400000000000379711700012 0 NN0000000670000000240000000000000100000000520250331000000311 NNN +016790 KR7016790008 ST3100910190000 NN N N 0 N N0000009940000100001YNY00NNN000000100N0900000000000000000000001002018060100000000018847100000000001884717290012 0 NN0000008190000000330000000340003000000000020250930000001873 NNN +016920 KR7016920001ī ST3101100000000NNN NNNNNNNN0NNNNNNNN0000010350000100001NNN00NNN000000100N0900000000887140000000005001990010400000000002649300000000001324676900012 0 NN000001140000000002-00000022-0018-0000000120250930000000274 NNN +017000 KR7017000001ſհ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000032250000100001NNN00NNN000000100N0900000002276950000000050001994120700000000001166800000000006098961600012 0 NN0000025980000001500000000280005500000000520241231000000376 NNN +017250 KR7017250002Ϳ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000010010000100001NNN00NNN000000100N0900000000307910000000005001996010300000000002104500000000001052273350009 0 NN0000006010000000400000000210002000000000020250930000000210 NNN +017480 KR7017480005ö ST3100910260000NNN NNNNNNNN0NNNNNNNN0000043400000100001NNN00NNN000000100N0900000000377140000000005002001010900000000001570200000000000855144500012 0 NN0000022370000000360000000690005500000000320241231000000681 NNN +017510 KR7017510009 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000099200000100001NNN00NNN000000060Y0900000005846930000000005001991122600000000001524600000000000762300000012 0 NN0000001440000000300000000560004700000000620241231000001512 NNY +017650 KR7017650003븲 ST3100910210000NNN NNNNNNNN0NNNNNNNN0000082900000100001NNN00NNN000000100N0900000000457820000000005001994110700000000000878500000000000450000000012 0 NN0000012580000000880000001060008600000000520250930000000728 NNN +017890 KR7017890005ѱ ST2100910230000NNN NNNNNNNN0NNNNNNNN0000105100000100001NNN00NNN000000060Y0900000000578630000000005001992080400000000002127300000000001080288000012 0 NN0000032060000002640000004120033400000000620250930000002235 NNN +018000 KR7018000000Ͻ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000009940000100001NNN00NNN000000100N0900000040532610000000005001996011000000000024515700000000012257887100012 0 NN000000357-00000063-00000162-0162-0000002420250930000002436 NNN +018120 KR7018120006ιȿ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000177000000100001NNN00NNN000000100N0900000000041020000000005001993122900000000000662100000000000353301000012 0 NN0000007510000001200000001300010500000001520250930000001171 NNN +018290 KR7018290007Ƽ ST1100910230000NNY NNNNNNNN0NNNNNNNY0000198200000100001NNN00NNN000000100N0900000006045990000000005001994090700000000003494100000000001789900350012 0 NY0000032220000007020000006890053400000003920250930000006925 NNN +018310 KR7018310003񿡽 ST2100910260000NNN NNNNNNNN0NNNNNNNN0000193900000100001NNN00NNN000000100N0900000000087840000000005001996050300000000001470000000000000735000000012 0 NN0000024480000001730000002520013900000000520250930000002850 NNN +018620 KR7018620005 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000007900000100001NNN00NNN000000100N0900000000900580000000005002008052000000000002888900000000001444464650012 0 NN000000413-00000001-00000006-0001-0000001920250930000000228 NNN +018680 KR7018680009 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000029550000100001NNN00NNN000000100N0900000000152040000000005002000081800000000001165900000000000582965950012 0 NN0000005360000000150000000180001700000000420241231000000344 NNN +018700 KR7018700005ٸ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000009380000100001NNN00NNN000000100N0900000000841880000000010001994031800000000003511900000000003511975700012 0 NN00000051300000000700000003000030-0000001320250930000000329 NNN +019010 KR7019010008 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000037050000100001NNN00NNN000000100N0900000008889220000000005001993110500000000004820000000000002410000000012 0 NN0000003440000001030000006770054300000001420250930000001785 NNN +019210 KR7019210004- ST3100910260000NNY NNNNNNNN0NNNNYNNN0000077300000100001NNN00NNN000000060Y0900000016898590000000005001997080600000000003357300000000001678690950012 0 NN0000046110000004720000002620017500000000520250930000002595 NNY +019540 KR7019540004ũ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000048550000100001NNN00NNN000000100N0900000003223840000000005001992110300000000001351300000000000675675000012 0 NN0000062510000002610000002560021500000001320250930000000656 NNN +019550 KR7019550003SBIκƮƮ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000007490000100001NNN00NNN000000100N0900000006543740000000005001989090600000000016206600000000008353328750012 0 NN0000002870000001170000001180011400000000920241231000001213 NNN +019570 KR7019570001÷佺 ST3101400000000NNN NNNNNNNN0NNNNNNNN0000002690000100001NNN00NNN000000100N0900000001412360000000005001989031400000000006711000000000003355502100012 0 NN0000000810000000180000000200002000000000320250930000000180 NNN +019660 KR7019660000۷κ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000025800000100001NNN00NNN000000100N0900000000368480000000005001992060400000000001394400000000000697216650012 0 NN0000001730000000020000000060000600000000520241231000000359 NNN +019770 KR7019770007žŻ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000038500000100001NNN00NNN000000100N0900000000764540000000005002011062400000000001165000000000000582500000012 0 NN0000018240000000930000001020009300000001120241231000000448 NNN +019990 KR7019990001ũ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000083400000100001NNN00NNN000000100N0900000002869270000000005002006020100000000000975600000000000487804400012 0 NN000000152-00000028-00000030-0028-0000000520250930000000813 NNN +020180 KR7020180006 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000010010000100001NNN00NNN000000100N0900000003044550000000005001995100600000000003842800000000001921445750003 0 NN0000020290000000910000000730005700000001620250331000000384 NNN +020400 KR7020400008뵿ݼ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000055400000100001NNN00NNN000000100N0900000000076140000000010001993073000000000000318900000000000318916600012 0 NN000000995-00000065-00000073-0058-0000001220241231000000176 NNN +020710 KR7020710000ðũ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000040700000100001NNN00NNN000000100N0900000001519610000000005001999081300000000002004700000000001002398500012 0 NN0000012660000001120000001340010900000001720250930000000815 NNN +021040 KR7021040001ȣƯ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000012140000100001NNN00NNN000000100N0900000000246740000000025001996082700000000002170400000000005426193500012 0 NN000002105000000025-00000004-0005-0000002320250930000000263 NNN +021045 KR7021041009ȣƯ ST0100910260000NYN NNNNNNNN3NNNNNNNN0000028050000100001NNN00NNN000000100N0900000000022690000000025002001091300000000000084800000000000212123000012 2 NN00000000000000000000000000000000000000000 000000023 NNN +021080 KR7021080007ƼκƮ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000032650000100001NNN00NNN000000060Y0900000018289620000000005001991071200000000004800000000000002400000000012 0 NN0000005170000001350000001380010800000000620241231000001567 NNN +021320 KR7021320007KCCǼ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000055500000100001NNN00NNN000000100N0900000001345510000000050002001082100000000002140000000000010700000000012 0 NN0000182700000006460000002240016000000000320241231000001187KCCNNN +021650 KR7021650007ѱť ST3100910230000NNN NNNNNNNN0NNNNNNNN0000024050000100001NNN00NNN000000100N0900000000359460000000005002003012400000000001635000000000000817528150012 0 NN0000017900000000870000000770005400000000920250930000000393 NNN +021880 KR7021880000̽ijŻ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000002380000100001NNN00NNN000000100N0900000006480130000000005001996090200000000021218400000000010609220400003 0 NN000000098-00000010-00000009-000900000000120250930000000504 NNN +022220 KR7022220008Ƽְ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000006640000100001NNN00NNN000000100N0900000000999730000000005002006041100000000005179400000000002589728950012 0 NN000000480-00000067-00000073-005800000000020250930000000343 NNN +023160 KR7023160005± ST2100910260000NNY NNNNNNNN0NNNNYNNN0000271500000100001NNN00NNN000000050Y0900000002371440000000005001994090700000000002650000000000001325000000012 0 NN0000021640000002660000006970053300000001120250930000007194 NNY +023410 KR7023410004 ST2100910250000NNY NNNNNNNN0NYNNNNNN0000039250000100001NNN00NNN000000050Y0900000010881240000000005001994100700000000007731000000000003865543150012 0 NN0000095120000000950000016030135000000000220250930000003034653NNN +023440 KR7023440001̽Ȧ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000007150000100001NNN00NNN000000100N0900000008342610000000005001994100700000000008861600000000004430802200012 0 NN000000290-00000076-00000168-0168-0000005220250930000000633 NNN +023600 KR7023600000ﺸ ST3100910210000NNN NNNNNNNN0NNNNNNNN0000094700000100001NNN00NNN000000100N0900000000104910000000005001996052900000000001600800000000000808500000012 0 NN0000040740000002340000003010025400000000420250930000001515 NNN +023760 KR7023760002ѱijŻ ST2101400000000NNN NNNNNNNN0NNNNNNNN0000008060000100001NNN00NNN000000100N0900000003016980000000005001994110700000000031560900000000015780478800012 0 NN0000038780000009140000009200072700000001320250930000002543 NNN +023770 KR7023770001÷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000030200000100001NNN00NNN000000100N0900000000375720000000005001994110700000000000894600000000000447324750012 0 NN000000323-00000085-00000068-0069-0000003120241231000000270 NNN +023790 KR7023790009Ͻƿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000012900000100001NNN00NNN000000100N0900000002984480000000005001994110700000000002613900000000001306980850012 0 NN000000166-00000018-00000042-0050-0000002920241231000000337 NNN +023900 KR7023900004dz ST3100910190000NNN NNNNNNNN0NNNNNNNN0000090700000100001NNN00NNN000000100N0900000000196790000000005001994112300000000001260000000000000630000000012 0 NN0000012450000001290000001400011000000000720250930000001142 NNN +023910 KR7023910003Ѿǰ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000287000000100001NNN00NNN000000060Y0900000000173980000000005001994112300000000000600000000000000300000000012 0 NN0000020420000003810000004230033800000001320241231000001722 NNN +024060 KR7024060006ﱸ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000129800000100001NNN00NNN000000100N0900000012457260000000001001994120700000000001500000000000000150000000012 0 NN000001169-000000030000000080000600000000120241231000001947 NNN +024120 KR7024120008KBý ST3100910300000NNN NNNNNNNN0NNNNNNNN0000036550000100001NNN00NNN000000100N0900000000331050000000005001994120700000000001150000000000000575000000012 0 NN0000015980000000490000000210001200000000420250930000000420 NNN +024740 KR7024740003ϴ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000022600000100001NNN00NNN000000100N0900000005837440000000005001996112900000000003289700000000001644852450012 0 NN0000009480000000370000000240002500000000320250930000000743 NNN +024800 KR7024800005Ƽ ST3101300000000NNN NNNNNNNN0NNNNNNNN0000028550000100001NNN00NNN000000100N0900000001002810000000005001999121000000000003705100000000001852590600012 0 NN0000005380000000140000003770038100000000920250930000001057 NNN +024830 KR7024830002 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000112100000100001NNN00NNN000000100N0900000000035030000000005001994122900000000000835000000000000417500000012 0 NN0000023090000000130000002510022000000000620241231000000936 NNN +024840 KR7024840001KBIŻ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000017560000100001NNN00NNN000000100N0900000003779360000000005001994122900000000003490900000000001745459950012 0 NN000005823000000063-00000036-0036-0000000420250930000000613 NNN +024850 KR7024850000HLB̳뺣̼ ST2100910280000NNN NNNNNNNN1NNNNNNNN0000028950000100001NNN00NNN000000100N0900000035127880000000005002001011800000000014688400000000007344222350012 0 NN000000241-00000289-00000299-029100000000020250930000004252 NNN +024880 KR7024880007ǿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000059300000100001NNN00NNN000000060Y0900000003293060000000005001994122900000000002001600000000001034139900012 0 NN0000056880000003330000002520020600000001020250930000001186 NNY +024910 KR7024910002â ST3100910300000NNN NNNNNNNN0NNNNNNNN0000021100000100001NNN00NNN000000100N0900000009033000000000005001994122900000000003581900000000001790950250012 0 NN000005260000000031-00000020-001500000000120250930000000755 NNN +024940 KR7024940009PNdz ST3101100000000NNN NNNNNNNN0NNNNNNNN0000048650000100001NNN00NNN000000100N0900000000770530000000005001995010400000000001000000000000000500000000012 0 NN0000004220000000150000000320002600000000620250930000000486 NNN +024950 KR7024950008õ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000041200000100001YNN00NNN000000100N0900000000000000000000005001995010400000000001327300000000000663678850012 0 NN0000013700000001430000001640013300000000520250930000000546 NNN +025320 KR7025320003ó彺 ST2100910280000NNN NNNNNNNN0NNNNNNNY0000075600000100001NNN00NNN000000100N0900000045505390000000005001995042000000000009211900000000004649280800012 0 NN0000020570000001330000001590014600000001720250930000006964 NNN +025440 KR7025440009DH ST3100910280000NNN NNNNNNNN0NNNNNNNN0000010820000100001NNN00NNN000000100N0900000006871430000000005001995052200000000004878100000000002439061200012 0 NN000003481-0000006900000001100011-0000000220250930000000527 NNN +025550 KR7025550005ѱ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000034000000100001NNN00NNN000000100N0900000001893170000000005001995061900000000002551400000000001336812900012 0 NN0000016550000000820000000840007000000000120250930000000867 NNN +025770 KR7025770009ѱ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000079800000100001NNN00NNN000000050Y0900000000340880000000005001998012000000000003744400000000001940637150012 0 NN0000061540000003930000004180032000000001120250930000002988 NNN +025870 KR7025870007Ŷ󿡽 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000052900000100001NNN00NNN000000100N0900000000203510000000005001995070700000000000400000000000000200000000012 0 NN000000550-00000010-00000016-0016-0000000820250930000000211 NNN +025880 KR7025880006̾ǵ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000026350000100001NNN00NNN000000100N0900000000777050000000005001995070700000000001671500000000000835792900012 0 NN0000008940000000940000001000008700000001120250930000000440 NNN +025900 KR7025900002ȭ ST2100910210000NNN NNNNNNNN0NNNNNNNY0000104600000100001NNN00NNN000000050Y0900000006195300000000002001995080700000000005055700000000001061145700012 0 NN000006088-00000097-00000677-0322-0000000120250930000005288 NNN +025950 KR7025950007ŰǼ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000189700000100001NNN00NNN000000060Y0900000001734600000000005001995080700000000000840000000000000420000000012 0 NN0000006900000000060000000410003000000000320241231000001593 NNN +025980 KR7025980004ƳƼ ST1100600000000NNN NNNNNNNN0NNNNNNNY0000081600000100001NNN00NNN000000050Y0900000011526430000000001001996010600000000009469900000000000976995360012 0 NN000001925000000035-00000339-0281-0000000620250930000007727 NNY +026040 KR7026040006̿Ƽ ST3100910310000NNN NNNNNNNN0NNNNNNNN0000027750000100001NNN00NNN000000100N0900000001416300000000005001999122100000000001650300000000000868479500012 0 NN000000744-00000026-00000015-0015-0000000420241231000000457 NNN +026150 KR7026150003ƯǼ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000064400000100001NNN00NNN000000060Y0900000001964540000000005001997080600000000001754600000000000877316550012 0 NN000001347-000000330000001150008800000001320250930000001129 NNY +026910 KR7026910000Ǿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000026250000100001NNN00NNN000000100N0900000000068500000000005001996010300000000000640500000000000320270250012 0 NN000000429-00000030-00000043-003600000002920250930000000168 NNN +027040 KR7027040005 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000002110000100001NNY00NNN000000100N0900000003139040000000001001999120300000000006958800000000000695888470012 0 NN000000267-00000004-00000040-0043-0000003820250930000000146 NNN +027050 KR7027050004ڸƳ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000022100000100001NNN00NNN000000100N0900000002276630000000005001999121000000000004000000000000002000000000012 0 NN000000564-00000030-00000022-0023-0000000220250930000000884 NNN +027360 KR7027360007IB ST2101400000000 NN N N 0 N N0000034700000100001NNN00NNN000000060Y0900000021906650000000005002018112100000000012114500000000006057270300012 0 NN0000003710000000620000000610005200000000220250930000004203 NNN +027580 KR7027580000 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000008250000100001NNN00NNN000000100N0900000005950040000000005002007100100000000005918100000000002959063950012 0 NN000000401-00000043-00000056-0056-0000003020250930000000488 NNN +027710 KR7027710003ʽ丮 ST3100910190000NNN NNNNNNNN0NNNNNNNN0000011410000100001NNN00NNN000000060Y0900000004190730000000005001996070600000000011141600000000005750862900012 0 NN0000108920000003890000004220035100000000620250930000001271 NNN +027830 KR7027830009뼺â ST3101400000000NNN NNNNNNNN0NNNNNNNN0000016130000100001NNN00NNN000000100N0900000004053990000000005001999113000000000005400000000000002700000000012 0 NN0000002010000001020000001490013800000001520241231000000871 NNN +028080 KR7028080000޸ƽȦ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017930000100001NNN00NNN000000100N0900000000371240000000005001997041600000000001257700000000000628875300012 0 NN000003122-00000146-00000579-0568-0000005420250930000000225 NNN +028300 KR7028300002HLB ST1100910240000NNY YNNNNNNN0NNNNNNNY0000672000000100001NNN00NNN000000100N0900000028556070000000005001996072700000000013306300000000006653185550012 0 NY000000555-00000748-00002122-2061-0000004920250930000089418 NNN +029480 KR7029480001 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000024000000100001NNN00NNN000000100N0900000006026370000000005001996082700000000006187900000000003181791300012 0 NN000000059-00000034-00000320-0250-0000002220250930000001485 NNN +030350 KR7030350003巡ö ST3000000000000NNN NNNNNNNN0NNYNNNNN0000009730000100001YNY00NNN000000100N0900000000000000000000005001997111000000000001559200000000000779603950012 0 NN000000125-00000012-00000024-0025-0000005120250930000000151 NNN +030520 KR7030520001ѱ۰ǻ ST1000000000000NNN NNNNNNNN0NNNNNNNY0000265500000100001NNN00NNN000000050Y0900000009061220000000005001996092400000000002417900000000001346567400012 0 NN0000023140000003710000004420033900000000520250930000006419 NNY +030530 KR7030530000Ȧ ST2100910230000NNY NNYNNNNN0NNNNNNNN0000411500000100001NNN00NNN000000050Y0900000013150270000000005001996092400000000007723700000000003861899050012 0 NN00000472000000000300000051300385-0000000120250930000031783140NNY +030960 KR7030960009 ST3100910220000NNN NNNNNNNN0NNNNNNNN0000079300000100001NNN00NNN000000100N0900000000692400000000005001996102400000000001598000000000000799000000006 0 NN000000559-00000061-00000021-0016-0000000120250630000001267 NNN +031310 KR7031310006 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000014760000100001NNN00NNN000000100N0900000000782580000000005001997072500000000002635500000000001317752150012 0 NN00000129800000002200000009600099-0000000120250930000000389 NNN +031330 KR7031330004̿Ƽ ST2101100000000NNN NNNNNNNN0NNNNNNNN0000045600000100001NNN00NNN000000050Y0900000009852940000000005002000052300000000009999500000000004999753350012 0 NN0000271100000006890000005250041500000001220250930000004559 NNN +031510 KR7031510001 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000010570000100001NNN00NNN000000100N0900000000362270000000005001997021200000000002800000000000001400000000012 0 NN00000095300000003600000002900016-0000003120250930000000295 NNN +031860 KR7031860000ġ۴ ST3101100000000NNN NNNNNNNN0NNYNNNNN0000005960000100001NNN00NNN000000100N0900000001547300000000005001997010700000000001898500000000000949271150012 0 NN000000115-00000054-00000109-0109-0000004420250930000000113 NNN +031980 KR7031980006ǿȦ ST1100910270000NNY NNYNNNNN0NNNNNNNY0000738000000100001NNN00NNN000000050Y0900000004049090000000005001997010700000000002156200000000001078119750012 0 NY0000015640000005920000008740071900000002620250930000015913 NNY +032080 KR7032080004WB ST3100910200000NNN NNNNNNNN0NNNNNNNN0000012680000100001NNN00NNN000000100N0900000000342530000000005002000102600000000002149100000000001074551450012 0 NN000000354000000005-00000029-0020-0000000220241231000000272 NNN +032190 KR7032190001ٿ쵥Ÿ ST2101100000000NNN NNNNNNNN0NNNNNNNY0000258000000100001NNN00NNN000000050Y0900000005359380000000005001999122100000000003830000000000001915000000012 0 NN0001220490000123060000125680903500000000020250930000009881DKGNNY +032280 KR7032280000 ST3101300000000NNN NNNNNNNN0NNNNNNNN0000014050000100001NNN00NNN000000100N0900000000489860000000010001997031500000000001621300000000001621359000012 0 NN0000010510000000250000000140001200000000220241231000000227 NNN +032300 KR7032300006ѱĸ ST3100910240000 NN N N 0 N N0000129100000100001NNN00NNN000000100N0900000000329800000000005002020081000000000001090600000000000545335050012 0 NN0000008130000000610000000390003800000000520241231000001408 NNN +032500 KR7032500001̿ ST2100910280000NNN NNNNNNNN0NNNNNNNY0000185300000100001NNN00NNN000000100N0900000007181480000000005002000032100000000004093000000000002046505450012 0 NN000000719-00000187-00000249-0263-0000002120250930000007584 NNN +032540 KR7032540007TJ̵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000056100000100001NNN00NNN000000100N0900000000104940000000005001997041600000000001393100000000000696580450012 0 NN0000007370000000270000000230002200000000620250930000000781 NNN +032580 KR7032580003ǵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000011360000100001NNN00NNN000000100N0900000003928460000000005001997042200000000003313200000000001656603200012 0 NN000000448-00000045-00000021-0022-0000000520241231000000376 NNN +032620 KR7032620007ɾ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000039500000100001NNN00NNN000000050Y0900000002645940000000005001997050200000000005219700000000002609856950012 0 NN0000014460000000450000004210041400000003420250930000002061 NNY +032680 KR7032680001Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000002610000100001NNN00NNN000000100N0900000006318890000000002001997071800000000010559000000000002111815280012 0 NN000000371000000003-00000017-0027-0000001220250930000000275 NNN +032685 KR7032681009Ʈ ST0000000000000NYN NNNNNNNN0NNNNNNNN0000066000000100001NNN00NNN000000100N0900000000014680000000002002002041600000000000035700000000000007142840012 2 NN00000000000000000000000000000000000000000 000000023 NNN +032750 KR7032750002 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000035400000100001NNN00NNN000000100N0900000000181360000000005001997071400000000000903100000000000451556100012 0 NN0000010450000000520000000460004500000000620250930000000319 NNN +032790 KR7032790008ַ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000011000000100001NNN00NNN000000100N0900000003341710000000005001997062600000000005136000000000002568010600012 0 NN000000230-00000071-00000107-0106-0000001320250930000000564 NNN +032800 KR7032800005Ÿ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000004620000100001NNN00NNN000000100N0900000002755710000000005001997062600000000004595700000000002297852900006 0 NN000000104-00000009-00000012-0012-0000001720250930000000212 NNN +032820 KR7032820003츮 ST2100910280000NNN NNNNNNNN1NNNNNNNY0000087400000100001NNN02NNN000000100N0900000212954000000000005002000062200000000016675600000000008337839500012 0YNN000000623-000000430000001130011400000001120250930000014574 NNN +032850 KR7032850000Ʈǻ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000048550000100001NNN00NNN000000100N0900000001283380000000005001997070400000000001662300000000000831164650012 0 NN0000002530000000450000000690005500000001020250930000000807 NNN +032860 KR7032860009 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000018080000100001NNN00NNN000000100N0900000013876740000000005001997070400000000004039500000000002019793150012 0 NN0000006980000000160000000210002500000000520241231000000730 NNN +032940 KR7032940009 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000149600000100001NNN00NNN000000100N0900000025193390000000005001997071800000000001819300000000000909661500012 0 NN0000012010000000890000001370011500000001120250930000002721140NNN +032960 KR7032960007ϱ⿬ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000150000000100001NNN00NNN000000100N0900000000060920000000005001997071800000000000351800000000000530929750012 0 NN0000001630000000010000000420003800000000520250930000000527 NNN +032980 KR7032980005̿ ST3101100000000NNN NNNNNNNN0NNYNNNNN0000006040000100001YNY00NNN000000100N0900000000000000000000005001997080600000000003038800000000001519449750012 0 NN000000198000000004-00000026-0030-0000005920250930000000183 NNN +033050 KR7033050006̿ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000008800000100001NNN00NNN000000100N0900000000676370000000010001997081800000000003257900000000003257934200012 0 NN0000006300000000280000000240001700000000520250930000000286 NNN +033100 KR7033100009 ST2100910280000NNN NNNNNNNN0NNNNNNNY0000437500000100001NNN00NNN000000050Y0900000005460120000000005001997081800000000001606200000000000803120450012 0 NN0000026270000009780000010280079900000005020241231000007027 NNY +033130 KR7033130006Ʋ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017180000100001NNN00NNN000000100N0900000001531730000000005001997080600000000003711500000000001855763350012 0 NN0000002830000000330000000440003100000000520250930000000637 NNN +033160 KR7033160003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000104400000100001NNN00NNN000000060Y0900000012007640000000005001997111000000000002259600000000001129824000012 0 NN00000996700000004200000010400038-0000000320250930000002359 NNY +033170 KR7033170002ñ׳ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000008600000100001NNN00NNN000000100N0900000008756040000000005002010112600000000008572800000000004286415950012 0 NN000000774-00000200-00000176-0177-0000006720250930000000737632NNN +033200 KR7033200007 ST3100910280000NNN NNNNNNNN0NNYNNNNN0000036700000100001NNN00NNN000000100N0900000000317250000000005001997101300000000001433100000000000766559250003 0 NN000000206-00000010-00000001-0003-0000000220250930000000525 NNN +033230 KR7033230004μ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017490000100001NNN00NNN000000100N0900000004437090000000005001999073000000000005051500000000002525769000012 0 NN000002167-00000075-00000082-0080-0000000920250930000000883 NNN +033290 KR7033290008 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000020900000100001NNN00NNN000000060Y0900000000727510000000005001997101300000000005615600000000003036023200012 0 NN0000058540000002030000001400014300000000620250930000001173 NNN +033310 KR7033310004 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000017570000100001NNN00NNN000000100N0900000000727710000000005001997111000000000004034200000000002017111550012 0 NN00000067300000003300000000800006-0000000020250930000000708 NNN +033320 KR7033320003̾ý ST3101100000000NNN NNNNNNNN0NNNNNNNN0000042950000100001NNN00NNN000000100N0900000001373260000000005001997111000000000001911400000000000955721600012 0 NN0000022160000000500000000800006400000000520250930000000820 NNN +033340 KR7033340001 ST3100910200000NNN NNNNNNNN0NNNNNNNN0000016990000100001NNN00NNN000000100N0900000010994180000000005001997110300000000009695000000000004847527900012 0 NN000000564-00000046-00000053-0053-0000001320250930000001647 NNN +033500 KR7033500000ȭ ST1100910230000NNN NNNNNNNN0NNNNNNNY0000289000000100001NNN00NNN000000050Y0900000003034690000000005001997121900000000002998900000000001532474700012 0 NN0000056680000005300000005290040500000002920250930000008666 NNY +033540 KR7033540006Ķ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000013940000100001NNN00NNN000000100N0900000129507700000000005001997122600000000003775100000000001887553150012 0 NN000001351-00000066-00000090-0084-0000000920250930000000526 NNN +033560 KR7033560004 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000027950000100001NNN00NNN000000100N0900000000689710000000005002011012600000000001710000000000000960000000012 0 NN000000052-000000090000001790014400000000920250930000000477 NNN +033640 KR7033640004н ST2100910280000NNN NNNNNNNN0NNNNNNNN0000177500000100001NNN00NNN000000060Y0900000003591750000000005001999121400000000002305900000000001162960100012 0 NN0000039780000002240000003600020700000002020250930000004093 NNN +033790 KR7033790007dz ST3100910280000NNN NNNNNNNN0NNNNNNNN0000054300000100001NNN00NNN000000100N0900000004391430000000005002001062600000000006803700000000003401866050012 0 NN000000307000000000-00000025-0025-0000000620241231000003694 NNN +033830 KR7033830001Ƽ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000005930000100001NNN00NNN000000100N0900000001074940000000005002010112900000000010000000000000005000000000012 0 NN0000002920000000030000000280002200000000320250930000000593 NNN +034810 KR7034810002ؼ ST2101400000000NNN NNNNNNNN0NNNNNNNN0000083000000100001NNN00NNN000000050Y0900000000817380000000005001999041600000000003255600000000001627842850012 0 NN00001690300000032700000021700185-0000000020250930000002702 NNN +03481K KR703481K019ؼ1 ST0101400000000 NN N N 0 N N0000083500000100001NNN00NNN000000100N0900000000093260000000005002021120200000000000138800000000000069446100012 9 NN00000000000000000000000000000000000000000 000000115 NNN +034940 KR7034940007 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000009430000100001NNN00NNN000000100N0900000000796320000000005001999081300000000003097900000000001548991350012 0 NN000000435-00000051-00000041-0042-0000002420250930000000292 NNN +034950 KR7034950006ѱ ST2100600000000NNN NNNNNNNN0NNNNNNNN0000969000000100001NNN00NNN000000060Y0900000000023170000000050002002020700000000000454000000000002445257000012 0 NN0000008690000003010000003250025300000002220250930000004399 NNN +035080 KR7035080001׷Ʈ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000116800000100001NNN00NNN000000060Y0900000000252390000000025001999070500000000001367600000000004176562650012 0 NN000022503-00000158-00000019-0092-0000000620250930000001597 NNN +035200 KR7035200005ĽƮ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000036250000100001NNN00NNN000000100N0900000000502390000000005002002011500000000000973000000000000486529500012 0 NN0000001930000000000000000150001300000000520250930000000352 NNN +035290 KR7035290006ؿ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000006520000100001NNN00NNN000000100N0900000001054750000000005001999120700000000002383800000000001191912000012 0 NN000000096-000000050000000010000100000000020241231000000155 NNN +035460 KR7035460005ڷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000019710000100001NNN00NNN000000100N0900000000800630000000005001999111800000000001457700000000000728867000012 0 NN0000005790000000210000000120001100000002520250930000000287 NNN +035600 KR7035600006KG̴Ͻý ST2000000000000NNN NNNNNNNN0NNNNNNNN0000112800000100001NNN00NNN000000050Y0900000007290860000000005002002112200000000002755400000000001395221700012 0 NN0000100780000007750000007150054500000001120250930000003108LC4NNY +035610 KR7035610005ֺ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000038150000100001NNN00NNN000000100N0900000001680250000000005001999081300000000002734500000000001367299850012 0 NN0000009200000002030000003500033400000002020250930000001043 NNN +035620 KR7035620004ٸ̾ؿ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000003360000100001NNN00NNN000000100N0900000003597080000000005001999081300000000007443900000000003721983750012 0 NN000000078-0000000500000000200003-0000000020250930000000250 NNN +035760 KR7035760008CJ ENM ST1101500000000NNY NNNNNNNN0NNNNNNNY0000712000000100001NNN00NNN000000050Y0900000001557430000000050001999112300000000002192900000000011057737000012 0 NY0000369680000004690000013450112200000000320250930000015613720NNY +035810 KR7035810001Ȧ ST2100910190000NNN NNNNNNNN0NNNNNNNN0000050600000100001NNN00NNN000000050Y0900000001902670000000005001999112300000000006451600000000003294886200012 0 NN0000251380000013640000012510101800000000520250930000003264 NNN +035890 KR7035890003Ǽ ST2101000000000NNN NNNNNNNN0NNNNNNNN0000016230000100001YNY00NNN000000100N0900000000000000000000005001999122400000000022980800000000011490422850012 0 NN0000082670000011830000010240079000000001220250930000003729 NNN +035900 KR7035900000JYP Ent. ST1101500000000NNY NNNNNNNN0NNNNNNNY0000731000000100001NNN00NNN000000050Y0900000006612540000000005002001083000000000003553200000000001796095150012 0 NY0000058920000011330000018810132700000003020250930000025974 NNY +036000 KR7036000008 ST3101500000000NNN NNNNNNNN0NNNNNNNN0000031050000100001NNN00NNN000000100N0900000002101410000000005001999113000000000002303400000000001161713850012 0 NN000000027-00000001-00000006-0139-0000001520250331000000715 NNN +036010 KR7036010007ƺ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000083600000100001NNN00NNN000000100N0900000003550370000000005002002070300000000001329200000000000689646700012 0 NN0000009970000000620000000840007100000000220250930000001111 NNN +036030 KR7036030005Ƽ ST2101100000000NNN NNNNNNNN0NNNNNNNN0000048150000100001NNN00NNN000000060Y0900000000869090000000010001999122400000000004901900000000004901928300012 0 NN0000038820000002460000002990019700000000820241231000002360905NNN +036090 KR7036090009Ʈ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000006960000100001NNN00NNN000000100N0900000010037680000000005001999121000000000011839200000000005919614200012 0 NN00000349500000021400000022800214-0000000620250930000000824 NNN +036120 KR7036120004 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000019770000100001NNN00NNN000000100N0900000002522900000000005001999120700000000003550000000000001775000000012 0 NN0000003290000000750000000840006500000002120250930000000701 NNN +036170 KR7036170009ġؽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000015280000100001NNN01NNN000000100N0900000010436980000000010001999122100000000006136500000000006136562600012 0 NN0000001990000000150000000710007100000000020250930000000937 NNN +036180 KR7036180008 ST3101100000000NNN NNNNNNNN0NNYNNNNN0000005770000100001YNY00NNN000000100N0900000000000000000000005001999122100000000009346400000000004673226200012 0 NN000000029-00000033-00000027-0027-0000002020250630000000539 NNN +036190 KR7036190007ȭǿ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000332000000100001NNN00NNN000000060Y0900000000245760000000005002000122600000000000600000000000000300000000012 0 NN0000029130000002830000002730020900000000820250930000001992 NNN +036200 KR7036200004ϼ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000106500000100001NNN00NNN000000060Y0900000007646140000000005001999121000000000003066400000000001533211150012 0 NN0000019740000000860000000860006700000000620250930000003265 NNY +036220 KR7036220002コɾ ST2100910290000 NN N N 0 N N0000113500000100001NNN00NNN000000060Y0900000000198580000000005002024031300000000001450900000000000734942400012 0 NN0000009970000000560000000670006700000000220250930000001646 NNN +036480 KR7036480002뼺̻ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000071000000100001NNN00NNN000000100N0900000000201450000000005002000040400000000000380000000000000190000000012 0 NN000000238-00000016-00000016-0018-0000000520241231000000269 NNN +036540 KR7036540003SFAݵü ST2100910280000NNY NNYNNNNN0NNNNNNNY0000063000000100001NNN00NNN000000100N0900000083963880000000005002001050200000000016446000000000008248745150012 0 NN000002478-00000190-00000179-0180-0000000620250930000010360 NNN +036560 KR7036560001KZ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000136500000100001NNN00NNN000000050Y0900000000425630000000005001999122800000000001575000000000000787500000012 0 NN0000011270000001520000002430019200000000520241231000002149632NNN +036620 KR7036620003۷̼ ST2101100000000NNN NNNNNNNN0NNNNNNNY0000065000000100001NNN00NNN000000050Y0900000014333660000000005002000011100000000009050300000000004695262100012 0 NN0000022040000003610000003700029300000003120241231000005882 NNY +036630 KR7036630002ڷ ST3101000000000NNY NNNNNNNN0YNNNNNNN0000090000000100001NNN00NNN000000100N0900000000323070000000050002000010400000000001000000000000006000000000012 0 NN000002165-0000009900000011500112-0000000320250930000000900 NNN +036640 KR7036640001HRS ST3100910230000NNN NNNNNNNN0NNNNNNNN0000051000000100001NNN00NNN000000100N0900000001775810000000005002000053000000000001635400000000000817740000012 0 NN0000005990000001100000001300010800000001220250930000000834 NNN +036670 KR7036670008̾ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000062800000100001NNN00NNN000000100N0900000000484660000000005002001010300000000001127000000000000563500000012 0 NN0000011020000001500000001770014700000001320241231000000707512NNN +036690 KR7036690006ڸƽ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000028850000100001YNY00NNN000000100N0900000000000000000000005002000011800000000001590400000000000795246900012 0 NN000000646-00000049-00000039-0039-0000002320250930000000458 NNN +036710 KR7036710002Ȧ ST3100600000000NNN NNNNNNNN0NNYNNNNN0000026350000100001NNN00NNN000000100N0900000014372780000000005002000010400000000005282700000000002641387700012 0 NN000010905-00000380-00000629-0618-0000015120250930000001392 NNN +036800 KR7036800001̽ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000237000000100001NNN00NNN000000050Y0900000000114380000000005002000050300000000001000000000000000500000000012 0 NN0000081050000004300000004700036500000001320250930000002370 NNN +036810 KR7036810000Ƽ ST2100910280000NNN NNNNNNNN0NNNNNNNY0000495500000100001NNN00NNN000000050Y0900000013243930000000005002000011800000000002195600000000001097817400012 0 NN000002100000000026-00000116-0106-0000000020250930000010879 NNN +036830 KR7036830008ֺ극Ȧ ST1100600000000NNY NNNNNNYN0NNNNNNNY0000561000000100001NNN00NNN000000060Y0900000007152430000000005002000011800000000002096400000000001048202800012 0YNY0000041640000001800000010110107100000000620250930000011760 NNN +036890 KR7036890002Ƽ̾ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000136600000100001NNN00NNN000000050Y0900000002532980000000005002000072000000000002203200000000001124113400012 0 NN0000034160000003630000003240023900000001320250930000003009 NNY +036930 KR7036930006ּϾ ST1100910270000NNY NNYNNNNN0NNNNNNNY0000383500000100001NNN00NNN000000050Y0900000016988050000000005001999122400000000004726800000000002412460600012 0 NY0000025840000004380000004630040400000001020250930000018127 NNY +037030 KR7037030004Ŀ ST3100910280000 NN N N 0 N N0000028700000100001NNN00NNN000000100N0900000003999430000000010002018060700000000002519900000000002519991800012 0 NN0000032310000002070000002400021000000000720250930000000723 NNN +037070 KR7037070000ļ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000073600000100001NNN00NNN000000060Y0900000000560380000000005002000010400000000002000000000000001000000000012 0 NN000001578-00000168-00000161-0168-0000001820241231000001472 NNN +037230 KR7037230000ѱŰ ST3100910210000NNN NNNNNNNN0NNNNNNNN0000018500000100001NNN00NNN000000100N0900000000394050000000005001999122100000000002980000000000001490016350012 0 NN0000022560000000680000000200001200000000120241231000000551 NNN +037330 KR7037330008÷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000014370000100001NNN00NNN000000100N0900000000706020000000005001999121400000000004388500000000002194261200012 0 NN0000056330000001710000001580010100000000120250930000000630 NNN +037350 KR7037350006̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000070700000100001NNN00NNN000000100N0900000001726640000000005002000011100000000001547000000000000773500000012 0 NN0000057770000004820000004820036700000000820250930000001093 NNN +037370 KR7037370004EG ST3100910230000NNN NNNNNNNN0NNNNNNNN0000059500000100001NNN00NNN000000100N0900000001097060000000010002000011100000000000862400000000000862497200012 0 NN000000463-00000014-00000056-005400000000320250930000000513 NNN +037400 KR7037400009츮 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000009570000100001NNN00NNN000000100N0900000001520740000000005001999121600000000002622300000000001311167300012 0 NN000008095000000011-00000046-0078-0000000320250930000000250 NNN +037440 KR7037440005 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000043700000100001NNN00NNN000000100N0900000001060830000000005002000020300000000001392200000000000696123750012 0 NN0000017310000000520000000410003000000001120250930000000608 NNN +037460 KR7037460003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000203000000100001NNN00NNN000000050Y0900000002866480000000005001999121600000000001631800000000000830926100012 0 NN0000310730000009830000008270066900000001720250930000003312 NNN +037760 KR7037760006Ʈ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000017810000100001NNN00NNN000000100N0900000000334740000000005002000040700000000003383200000000001691646050012 0 NN000000951-00000014-00000044-0047-0000000620250930000000602 NNN +037950 KR7037950003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000008500000100001NNN00NNN000000100N0900000009776400000000005002000082400000000008444700000000004222375950012 0 NN0000003360000000160000000180001400000000420250930000000717 NNN +038010 KR7038010005ũ뽺 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000059600000100001NNN00NNN000000100N0900000000486600000000005002000011100000000000900000000000000450000000012 0 NN0000010070000000740000001420011200000001120250930000000536 NNN +038060 KR7038060000ེ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000007090000100001NNN00NNN000000100N0900000002937120000000005002006080800000000004810300000000002405153450012 0 NN000001290-00000032-00000045-0045-0000000120250930000000341 NNN +038070 KR7038070009̿ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000066500000100001NNN00NNN000000100N0900000000750600000000005002005102500000000000910000000000000455033800012 0 NN0000005710000000050000000130001000000000320250930000000605 NNN +038110 KR7038110003öƽ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000032450000100001NNN00NNN000000060Y0900000006463800000000005002000032300000000004116900000000002058468500012 0 NN0000191580000003910000001430007500000000320250930000001335 NNY +038290 KR7038290003ũ ST3100600000000NNY NNNYNNNN0NNNNNNNN0000169900000100001NNN00NNN000000100N0900000000382740000000005002000022200000000001084100000000000542070000012 0 NN000001390-00000035-00000035-0033-0000000020250930000001841 NNN +038390 KR7038390001ĸ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000123000000100001NNN00NNN000000060Y0900000001914390000000005002000020100000000001672000000000000847494550012 0 NN0000028900000004170000002940023000000001320250930000002056 NNN +038460 KR7038460002̿Ʈ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000043750000100001NNN00NNN000000100N0900000077554140000000005002000062200000000002616400000000001308221900012 0 NN0000035860000001740000001020005000000000620250930000001144 NNN +038500 KR7038500005ǥøƮ ST2100910250000NNN NNNNNNNN0NNNNNNNN0000067600000100001NNN00NNN000000100N0900000311894160000000005002001020100000000010791600000000005395815300012 0 NN0000048570000004340000002200017200000000520250930000007295LD6NNN +038530 KR7038530002̹̿ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000002610000100001NNN00NNN000000100N0900000039934400000000001002000060900000000011571400000000001157143470012 0 NN000000589000000002-00000032-0034-0000002120250930000000302 NNN +038540 KR7038540001 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000019030000100001NNN00NNN000000100N0900000000599700000000010002000081800000000005532800000000005718723700012 0 NN000005225-00000707-00000727-0568-0000003020250930000001052 NNN +038620 KR7038620001 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000005680000100001NNN00NNN000000100N0900000004464220000000005002000050400000000007572900000000003786473250012 0 NN0000008280000000170000000540004100000000420250930000000430 NNN +038680 KR7038680005 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000034800000100001NNN00NNN000000100N0900000000980750000000005002000042700000000001991200000000000995632100012 0 NN000002660-00000009-00000048-004600000000620250930000000692 NNN +038870 KR7038870002ڹ̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000031100000100001NNN00NNN000000100N0900000000616050000000005002001052900000000001401400000000000700747450012 0 NN000000129-00000015-00000012-0012-0000000320250930000000435 NNN +038880 KR7038880001̿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000001520000100001NNN00NNN000000100N0900000019168710000000001002000042700000000037572100000000003757211750012 0 NN000000326-00000052-00000138-0114-0000002820250930000000571 NNN +038950 KR7038950002ε ST3100910280000NNN NNNNNNNN0NNNNNNNN0000029550000100001NNN00NNN000000100N0900000000152490000000005002000050400000000001021000000000000510538250012 0 NN000000468-00000047-00000026-0027-0000000320250930000000301 NNN +039010 KR7039010004뿡ġƼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000082700000100001NNN00NNN000000100N0900000000818340000000005002000072000000000000862500000000000431250000012 0 NN0000011830000000630000001060008700000000020250930000000713 NNN +039020 KR7039020003̰Ȧ ST3100910210000NNN NNNNNNNN0NNNNNNNN0000040350000100001NNN00NNN000000100N0900000004685190000000010002000050400000000002258400000000002258470900012 0 NN000003495000000058-00000050-0055-0000000220250930000000911 NNN +039030 KR7039030002̿ũн ST1100910270000NNY NNYNNNNN0NNNNNNNY0003500000000100001NNN00NNN000000050Y0900000002294040000000005002000082400000000001231900000000000615977500012 0 NY0000027960000006630000006410040400000000920250930000043118 NNY +039200 KR7039200001 ST1100910240000NNY NNNYNNNN0NNNNNNNY0000523000000100001NNN00NNN000000100N0900000006635850000000005002007011700000000003825800000000001912908800012 0 NY000000209-00000093-00000095-0096-0000001020250930000020009 NNN +039240 KR7039240007泲ƿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000027450000100001NNN00NNN000000100N0900000001260070000000001002000030700000000002697900000000000269796040012 0 NN0000039550000000940000000940007500000000720241231000000740 NNN +039290 KR7039290002ũ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000059000000100001NNN00NNN000000100N0900000000333080000000005002006070400000000000869300000000000434698900012 0 NN000001001-00000037-00000021-002100000000020250930000000512 NNN +039310 KR7039310008 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000012870000100001NNN00NNN000000100N0900000000624890000000005002000060900000000001812100000000000906083350012 0 NN0000003730000000040000000190001800000000220241231000000233 NNN +039340 KR7039340005ѱTV ST3101500000000NNN NNNNNNNN0NNNNNNNN0000055400000100001NNN00NNN000000100N0900000000406970000000005002004073000000000002250000000000001150000000012 0 NN000000557-000000070000000360003300000000220250930000001246 NNN +039420 KR7039420005̿ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000028150000100001NNN00NNN000000100N0900000001091590000000005002002031200000000002415400000000001207736500012 0 NN0000003560000000810000000910008400000001420250930000000679 NNN +039440 KR7039440003Ƽ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000336000000100001NNN00NNN000000060Y0900000006427930000000005002002022800000000001550700000000000791500000012 0 NN0000024150000001290000001010008000000001020250930000005210 NNY +039560 KR7039560008ٻƮ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000035050000100001NNN00NNN000000060Y0900000004922790000000005002000062200000000003961300000000002103545300012 0 NN0000038530000003250000004310037700000000520250930000001388 NNN +039610 KR7039610001ȭ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000086000000100001NNN00NNN000000100N0900000001250310000000005002000031600000000001041000000000000520520000012 0 NN0000005890000000060000000030000200000000320250930000000895 NNN +039740 KR7039740006ѱ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000031800000100001NNN00NNN000000100N0900000000392540000000005002000070600000000000801800000000000400919850012 0 NN000001213000000006-00000004-000400000000820250930000000254 NNN +039830 KR7039830005ζ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000142700000100001NNN00NNN000000060Y0900000000609670000000005002001010300000000001076200000000000538144500012 0 NN0000024470000003520000002740019400000001120250930000001535 NNN +039840 KR7039840004 ST2100910290000NNY NNNYNNNN0NNNNNNNN0000159300000100001NNN00NNN000000060Y0900000000297310000000005002000062900000000001437500000000000794087750012 0 NN000001174000000087-00000041-002900000000320250930000002289 NNN +039860 KR7039860002뿣 ST3100910290000NNN NNNNNNNN0NNNNNNNN0000052400000100001NNN00NNN000000100N0900000006205870000000005002000081600000000003809300000000001904652650012 0 NN000000255000000002000000002-000100000000420250930000001996 NNN +039980 KR7039980008󸮽AI ST3000000000000NNN NNNNNNNN0NNNNNNNN0000019040000100001NNN00NNN000000100N0900000010979680000000005002002081300000000007277800000000003638938800012 0 NN000000531-000000130000000160001100000000120241231000001385 NNN +040160 KR7040160004÷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000037300000100001NNN00NNN000000100N0900000000320290000000005002000082900000000001205500000000000602776750012 0 NN000000612-00000030-00000061-0054-0000000920250930000000449 NNN +040300 KR7040300006YTN ST3101500000000NNN NNNNNNNN0NNNNNNNN0000035650000100001NNN00NNN000000100N0900000001886970000000010002001090400000000004767600000000004767698000012 0 NN000001312-00000267-00000215-0186-0000000820241231000001699653NNN +040350 KR7040350001ũ ST3000000000000NNN NNNNNNNN0NNYNNNNN0000009650000100001NNN00NYN000000100N0900000022262790000000005002002011000000000009760200000000004880133050012 0 NN000000076-00000045-00000064-0064-0000003520250930000000941 NNN +040420 KR7040420002̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000058400000100001NNN00NNN000000100N0900000000223670000000005002000080100000000001567700000000000847877600012 0 NN0000007800000000790000000820006500000000920250930000000915 NNN +040610 KR7040610008SG&G ST3100910300000NNN NNNNNNNN0NNNNNNNN0000018030000100001NNN00NNN000000100N0900000000711030000000005002000042700000000003408700000000001704359800012 0 NN0000003460000000270000002820026400000000720250930000000614 NNN +040910 KR7040910002̾ ST3100910270000NNY NNYNNNNN0NNYNNNNN0000040500000100001NNN00NNN000000100N0900000000722860000000005002011080500000000001857400000000000928713750012 0 NN000001451000000003-00000064-0066-0000002320250930000000752 NNN +041020 KR7041020009󸮽ǽ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000050300000100001NNN00NNN000000100N0900000007863920000000005002005102800000000004972500000000002486274900012 0 NN0000023900000001040000001500012400000000720250930000002501 NNN +041190 KR7041190000츮 ST1101400000000NNN NNNNNNNN0NNNNNNNY0000082800000100001NNN00NNN000000100N0900000019483190000000005002000060900000000008400000000000004200000000012 0 NN0000019600000017740000017740144500000003020250930000006955 NNN +041440 KR7041440009뿡 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000083800000100001NNN00NNN000000060Y0900000002224850000000005002003111400000000001791500000000000895797200012 0 NN0000021210000000220000000090001000000000520250930000001501Z35NNY +041460 KR7041460007ѱ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000039700000100001NNN00NNN000000100N0900000002481400000000005002010111900000000001900000000000001072962450012 0 NN0000002750000000510000000530004000000001120250930000000754 NNN +041510 KR7041510009 ST1101500000000NNY NNNNNNNN0NNNNNNNY0001181000000100001NNN00NNN000000050Y0900000003394720000000005002000042700000000002289400000000001191545050012 0 NY0000085590000012840000035800328300000003820250930000027038KAONNY +041520 KR7041520008̿ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000069000000100001NNN00NNN000000100N0900000000260710000000005002003070400000000001218800000000000609436500012 0 NN000000252-00000017-00000005-003200000000020250930000000841 NNN +041590 KR7041590001÷ũ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000023700000100001YNY00NNN000000100N0900000000000000000000005002002110100000000004897200000000002448607900012 0 NN000000109-00000033-00000015-001500000000120250930000001160 NNN +041830 KR7041830001ιٵ ST2100910290000NNY NNNYNNNN0NNNNNNNN0000314000000100001NNN00NNN000000050Y0900000000363040000000005002000121400000000001348000000000000684189100012 0 NN0000017160000002720000002880023600000001220250930000004232 NNN +041910 KR7041910001󸮽AIĸ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000069700000100001NNN00NNN000000100N0900000001679940000000005002004020600000000001350100000000000675080350012 0 NN0000005960000000020000000420003900000000320241231000000941 NNN +041920 KR7041920000޵Ƴ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000167400000100001NNN00NNN000000100N0900000003779290000000005002014100700000000001859800000000000929911150012 0 NN0000004570000000410000000440003400000000520250930000003113 NNN +041930 KR7041930009ȭ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000068700000100001NNN00NNN000000060Y0900000001020230000000005002001122600000000001580000000000000800000000012 0 NN0000030700000001700000002720021200000001520250930000001085 NNY +041960 KR7041960006ڹ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000070700000100001NNN00NNN000000100N0900000003108790000000001002001103000000000007388600000000000738864950012 0 NN000000406000000022-00000037-0037-0000000420250930000005223 NNN +042000 KR7042000000ī24 ST1000000000000 NY N N 0 N Y0000394000000100001NNN00NNN000000100N0900000006162850000000005002018020800000000002425300000000001212652700012 0YNY0000022740000002720000003100025900000001620250930000009555 NNN +042040 KR7042040006ǿũ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000002190000100001NNN00NNN000000100N0900000025001980000000001002003010700000000019514500000000001951455740012 0 NN000000577-00000161-00000215-0216-0000004920250930000000427 NNN +042110 KR7042110007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000012910000100001NNN00NNN000000100N0900000000852240000000005002000071300000000004832900000000002416478200012 0 NN0000016500000000570000000780006000000000420250930000000623 NNN +042370 KR7042370007ũ ST2101400000000NNN NNNNNNNN0NNNNNNNN0000105000000100001NNN00NNN000000060Y0900000005719970000000005002000080300000000002620000000000001310001250012 0 NN0000030470000003740000004090027700000000320250930000002751 NNY +042420 KR7042420000׿Ȧ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000272000000100001NNN00NNN000000060Y0900000000212800000000005002000062700000000000836600000000000465343300012 0 NN0000032890000005260000008090060300000000820250930000002275 NNN +042500 KR7042500009Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000038200000100001NNN00NNN000000100N0900000001448970000000005002002011000000000002229100000000001114557200012 0 NN0000010400000000800000001090008900000001120250930000000851 NNN +042510 KR7042510008½ť ST3000000000000NNN NNNNNNNN0NNNNNNNN0000096200000100001NNN00NNN000000100N0900000001492700000000025002001010300000000001120500000000002801293500012 0 NN000000408-00000023-00000038-002000000000920250930000001077 NNN +042520 KR7042520007ѽ̿޵ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000276000000100001NNN00NNN000000100N0900000002048860000000005002009100900000000001424100000000000712068350009 0 NN000000898-00000259-00000298-032100000000020250930000003930 NNN +042600 KR7042600007δн ST3100910280000NNN NNNNNNNN0NNNNNNNN0000150300000100001NNN00NNN000000100N0900000004823520000000005002002100100000000001242300000000000621178700012 0 NN000001305-00000026-00000653-0523-0000006720250930000001867 NNN +042940 KR7042940007Ǽ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000108300000100001NNN00NNN000000100N0900000005511490000000050002000101900000000000682800000000003414356000012 0 NN000000132-00000073-00000048-0072-0000001720250930000000739 NNN +043090 KR7043090000ũ ST3101100000000NNN NNNNNNNN0NNYNNNNN0000003800000100001YNY00NNN000000100N0900000000000000000000005002001101100000000001241800000000000620913750012 0 NN000000062-00000030-00000082-0082-0000005220250930000000047 NNN +043100 KR7043100007AI ST3100910290000NNN NNNNNNNN0NNNNNNNN0000021100000100001NNN00NNN000000100N0900000030369240000000005002000080800000000002011000000000001005504000012 0 NN000000141-00000026-00000029-0037-0000002420250930000000424 NNN +043150 KR7043150002 ST2100910290000NNY NNNYNNNN0NNNNNNNN0000199200000100001NNN00NNN000000050Y0900000000248790000000005002006092900000000001485400000000000742712800012 0 NN0000031200000004250000004580032700000001120250930000002958 NNN +043200 KR7043200005ķ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000007780000100001NNN00NNN000000100N0900000002094630000000005002000071900000000004180400000000002090215750012 0 NN000000208-00000024-00000035-0035-0000001420250930000000325 NNN +043220 KR7043220003Ƽؽ ST3100910270000NNN NNNNNNNN0NNYNNNNN0000017100000100001YNY00NNN000000100N0900000000000000000000005002001070300000000001592200000000000796120800012 0 NN000000110-00000040-00000176-0175-0000005020250930000000272 NNN +043260 KR7043260009ȣ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000149500000100001NNN01NNN000000100N0900000017536020000000005002001112900000000007092200000000003546141150012 0 NN00000171400000003500000006100052-0000000320250930000010602 NNN +043340 KR7043340009ũ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000004300000100001NNN00NNN000000100N0900000000712960000000005002000082900000000009500000000000004750000000012 0 NN000000544-00000004-00000029-0029-0000001120241231000000408 NNN +043360 KR7043360007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000025400000100001NNN00NNN000000100N0900000000154920000000005002001072000000000000900000000000000450000000012 0 NN000000204-00000027-00000019-0019-0000000520241231000000228 NNN +043370 KR7043370006ǿġ ST2100910300000NNN NNNNNNNN0NNNNNNNN0000118300000100001NNN00NNN000000050Y0900000001090710000000005002001121300000000002100000000000001050000000012 0 NN0000090610000003940000004280030300000000620250930000002484 NNN +043590 KR7043590009ŵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000006990000100001NNN00NNN000000100N0900000000572080000000005002001122000000000002713600000000001356838100012 0 NN000000164-00000012-00000006-0006-0000001220250930000000189 NNN +043610 KR7043610005KTϹ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000019370000100001NNN00NNN000000060Y0900000001248340000000005002000072000000000005811500000000002905771900012 0 NN00000225800000014800000013200106-0000000920250930000001125905NNN +043650 KR7043650001 ST3100910190000NNN NNNNNNNN0NNNNNNNN0000039800000100001NNN00NNN000000100N0900000000480760000000005002000082400000000001785800000000000892915200012 0 NN0000005290000000040000000810007100000000220250930000000710 NNN +043710 KR7043710003︮ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000009100000100001NNN00NNN000000100N0900000002139760000000005002002071100000000008656200000000004328125500012 0 NN000000259-00000041-00000050-0050-0000000220250930000000787 NNN +043910 KR7043910009ڿȯ ST3100910250000NNN NNNNNNNN0NNNNNNNN0000006020000100001NNN00NNN000000100N0900000005135760000000005002005111800000000011339100000000005669572850012 0 NN000000323000000001-00000025-0025-0000000520250930000000682 NNN +044180 KR7044180008KD ST3101000000000NNN NNNNNNNN0NNNNNNNN0000003850000100001NNN01NYN000000100N0900000020316290000000005002000111600000000002671700000000001335889950012 0 NN000000213-00000044-00000070-0070-0000002920250930000000102 NNN +044340 KR7044340008н ST3100910280000NNN NNNNNNNN0NNNNNNNN0000051900000100001NNN00NNN000000100N0900000000415260000000005002000102400000000001787300000000000893671250012 0 NN000002905-0000021700000048300220-0000001320250930000000927 NNN +044480 KR7044480002 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000002740000100001NNN00NNN000000100N0900000007883870000000001002001011100000000008066300000000000806637280012 0 NN000000202-00000008-00000029-0029-0000000520250930000000221 NNN +044490 KR7044490001¿ ST1100910260000NNY NNNNNNNN0NNNNYNNN0000317000000100001NNN00NNN000000050Y0900000003101230000000005002001110800000000002000700000000001000369050012 0 NN0000038630000002280000002410024700000000420241231000006342 NNY +044780 KR7044780005ġ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000013120000100001NNN00NNN000000100N0900000000233090000000005002000090700000000001850500000000000925289350012 0 NN000000329-00000030-00000002-0004-0000000020250930000000242 NNN +044960 KR7044960003̱ۺ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000041750000100001NNN00NNN000000100N0900000001648990000000005002000111600000000001264100000000000632094150012 0 NN0000004170000000350000000440003700000000820241231000000527 NNN +044990 KR7044990000ġ ST3100910280000 NN N N 0 N N0000178400000100001NNN00NNN000000060Y0900000001241240000000005002024102500000000000768500000000000401803200012 0 NN0000006030000000770000000680006000000000020250930000001371 NNY +045060 KR7045060001 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000023700000100001NNN00NNN000000100N0900000000883690000000005002000081000000000001694100000000000847098700012 0 NN0000011880000000390000000480003800000000520250930000000401 NNN +045100 KR7045100005Ѿ̿ ST2100600000000NNY NNYNNNNN0NNNNNNNN0000291000000100001NNN00NNN000000050Y0900000007419120000000005002000083100000000001800000000000000900000000012 0 NN0000081080000004400000004210033300000000920250930000005238 NNY +045300 KR7045300001ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000031250000100001NNN00NNN000000100N0900000000408530000000005002001121800000000001034700000000000517368250012 0 NN0000003080000000140000000390003600000000520250930000000323 NNN +045340 KR7045340007ŻƮ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000072900000100001NNN00NNN000000100N0900000000499500000000005002002071900000000000855800000000000427902000012 0 NN0000002070000000520000000740006100000002520241231000000623 NNN +045390 KR7045390002Ƽ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000042450000100001NNN00NNN000000060Y0900000008881570000000001002001051700000000007047300000000000711515220012 0 NN0000010850000000640000001490014100000001420250930000002991 NNY +045510 KR7045510005ý ST3101100000000NNN NNNNNNNN0NNNNNNNN0000008850000100001NNN00NNN000000100N0900000000632310000000005002000090700000000003220900000000001610464600012 0 NN0000013510000000040000000110000500000000420250930000000285 NNN +045520 KR7045520004ũػ̾ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000033250000100001NNN00NNN000000100N0900000000111120000000005002000120500000000000650000000000000365000000012 0 NN000000684000000005-00000007-0009-0000003920250930000000216 NNN +045660 KR7045660008 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000102700000100001NNN00NNN000000100N0900000000660980000000005002001052400000000000826000000000000413000000012 0 NN0000010850000001130000002200015300000001520250930000000848 NNN +045970 KR7045970001ھƽþ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000060900000100001NNN00NNN000000100N0900000010861770000000005002000080300000000002631400000000001315743800012 0 NN000002932000000043-00000066-0083-0000004320250930000001602 NNN +046070 KR7046070009ڴ ST3100910300000NNN NNNNNNNN0NNYNNNNN0000102800000100001YNY00NNN000000100N0900000000000000000000005002000122600000000001548600000000000774304450012 0 NN000002002000000006-00000025-0025-0000009220250930000001591 NNN +046120 KR7046120002 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000045150000100001NNN00NNN000000100N0900000011458730000000005002010061500000000002770300000000001385184200012 0 NN000000424-000000800000001230012300000001920250930000001250 NNN +046210 KR7046210001HLBij ST3100910240000NNN NNNNNNNN0NNNNNNNN0000018680000100001NNN00NNN000000100N0900000002691990000000005002000081600000000004547000000000002273532700012 0 NN000000108-000000180000000050000500000000220250930000000849 NNN +046310 KR7046310009T&A ST3100910280000NNN NNNNNNNN0NNNNNNNN0000037550000100001NNN00NNN000000100N0900000001848720000000005002002020500000000001641800000000000820932050012 0 NN0000011070000000800000000860007800000001420250930000000616 NNN +046390 KR7046390001ȭƮ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000011150000100001NNN00NNN000000100N0900000000566600000000002002001011100000000004317200000000000863458660012 0 NN000000017-00000044-00000040-0040-0000001020250930000000481 NNN +046440 KR7046440004KG ST3000000000000NNN NNNNNNNN0NNNNNNNN0000053800000100001NNN00NNN000000060Y0900000060762750000000005002004121400000000003801000000000001900540100012 0 NN0000017820000002540000002400018300000000720250930000002044LC4NNY +046890 KR7046890000ݵü ST2100910280000NNY NNYNNNNN0NNNNNNNY0000074700000100001NNN00NNN000000100N0900000011133590000000005002002011700000000005830500000000002915270000012 0YNN000007477-00000323-00000479-0522-0000000520250930000004355 NNN +046940 KR7046940003 ST3101000000000NNN NNNNNNNN0NNNNNNNN0000039400000100001NNN00NNN000000100N0900000001513230000000005002002061800000000001807400000000000903717500012 0 NN0000028330000003980000004050030600000002520250930000000712 NNN +046970 KR7046970000츮 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000014490000100001NNN00NNN000000100N0900000008055060000000005002012112700000000004382400000000002191249950012 0 NN000000310-00000007-00000004-0004-0000000720250930000000635 NNN +047080 KR7047080007ѺƮ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000012180000100001NNN00NNN000000100N0900000001072440000000005002002011000000000002482200000000001241118100012 0 NN0000003050000000060000000220002000000000520250930000000302 NNN +047310 KR7047310008Ŀ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000060400000100001NNN00NNN000000100N0900000013471630000000005002003072500000000003661000000000001853760250012 0 NN000005271-00000039-000000060001200000000820250930000002211 NNN +047560 KR7047560008̽ƮƮ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000190000000100001NNN00NNN000000100N0900000001842430000000005002008070100000000001173200000000000586621600012 0 NN000000813-00000088-00000111-0112-0000001620250930000002229 NNN +047770 KR7047770003ڵĹ ST3100910200000NNN NNNNNNNN0NNNNNNNN0000030400000100001NNN00NNN000000060Y0900000007231390000000005002001091800000000003784200000000001892130100012 0 NN0000002740000000160000000340003500000000520250930000001150 NNY +047820 KR7047820006ʷϹ̵ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000048450000100001NNN00NNN000000100N0900000000920650000000050002002122400000000002445300000000012226965000012 0 NN000001372000000013-00000056-0056-0000001420250930000001184 NNN +047920 KR7047920004HLB ST2100600000000NNN NNNNNNNN0NNNNNNNN0000199900000100001NNN00NNN000000100N0900000007192320000000005002015122100000000003279900000000001639967800012 0 NN0000014220000000020000000260002300000000020250930000006556 NNN +048410 KR7048410005̿ ST2100910230000NNN NNNNNNNN1NNNNNNNY0000093000000100001NNN01YNN000000100N0900000134113740000000005002002080800000000009604000000000004802048000012 0 NN000000016-00000137-00000174-0174-0000002920250930000008931 NNN +048430 KR7048430003ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000081500000100001NNN00NNN000000100N0900000000493300000000005002001011100000000001152000000000000576000000012 0 NN0000014930000000230000000900009500000000920250930000000938 NNN +048470 KR7048470009뵿ƿ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000032200000100001NNN00NNN000000100N0900000002244770000000005002002011000000000001000000000000000500000000012 0 NN000001397-000000200000000040000400000000120241231000000322 NNN +048530 KR7048530000Ʈй̿ ST3100910240000NNY NNNYNNNN0NNNNNNNN0000038150000100001NNN00NNN000000100N0900000005365550000000005002011012600000000003319100000000001707538100012 0 NN000000040-00000059-00000048-0048-0000000820250930000001266 NNN +048550 KR7048550008SM C&C ST3100600000000NNN NNNNNNNN0NNNNNNNN0000013220000100001NNN00NNN000000060Y0900000003073690000000005002001011800000000009671400000000004835731000012 0 NN000000642-00000044-00000032-0025-0000002120250930000001278KAONNY +048770 KR7048770002TPC ST3100910270000NNN NNNNNNNN0NNNNNNNN0000039850000100001NNN00NNN000000100N0900000021477370000000005002001011600000000001569700000000000784899550012 0 NN000000615-00000028-00000034-0034-0000001520250930000000625 NNN +048830 KR7048830004 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000009240000100001NNN00NNN000000100N0900000000524290000000005002000101200000000001872300000000000936196150012 0 NN000000615-00000003000000001-0001-0000000120250930000000173 NNN +048870 KR7048870000ó̳뺣̼ ST2100910290000NNN NNNNNNNN0NNNNNNNN0000024550000100001NNN00NNN000000060Y0900000004774710000000005002004081300000000008810600000000004405348150012 0 NN0000008530000001590000001570012200000000620250930000002163 NNN +048910 KR7048910004̵ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000075700000100001NNN00NNN000000100N0900000000898150000000005002001073100000000001257800000000000631947300012 0 NN0000023900000000510000000440002600000000420250930000000952 NNN +049070 KR7049070006ž ST2100910280000NNN NNNNNNNN0NNNNNNNN0000220000000100001NNN00NNN000000060Y0900000002416740000000005002002022100000000001720000000000000860000000012 0 NN000004487-00000101-00000007-003300000000120250930000003784 NNY +049080 KR7049080005Ⱑ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005720000100001NNN00NNN000000100N0900000002996710000000005002013121900000000008488300000000004244167350012 0 NN000000263-00000092-00000094-0094-0000002320250930000000485 NNN +049120 KR7049120009εؾ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000006640000100001NNN00NNN000000100N0900000000980700000000005002001072600000000005300800000000002650415950012 0 NN000000551-00000004-00000060-0058-0000002420250930000000351 NNN +049180 KR7049180003޵ ST3100910240000NNY NNNYNNNN0NNYNNNNN0000018950000100001NNY03NNN000000100N0900000031365370000000005002002052300000000005495700000000002747853150012 0 NN000001119-0000004500000004100041-0000008820250930000001041 NNN +049430 KR7049430002ڸ޷ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000144200000100001NNN00NNN000000060Y0900000000312670000000005002001011600000000000904800000000000452400000012 0 NN0000005680000001360000002110017600000001120250930000001304 NNN +049470 KR7049470008Ʈ÷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000008990000100001NNN00NNN000000100N0900000007490800000000001002001101100000000011772400000000001177244980012 0 NN000000361000000003-00000001-0011-0000000320241231000001058 NNN +049480 KR7049480007º̽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000024000000100001NNN00NNN000000100N0900000002464960000000005002001010900000000003142200000000001571119150012 0 NN0000013900000000180000000360002800000001420250930000000754 NNN +049520 KR7049520000̿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000037300000100001NNN00NNN000000060Y0900000003779260000000005002001080200000000003224700000000001637370300012 0 NN0000031440000002000000002380014700000001120250930000001202 NNN +049550 KR7049550007ũũ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000037800000100001NNN00NNN000000100N0900000013798520000000005002002022800000000001960600000000001010413000012 0 NN000000556-00000014-00000033-0033-0000000520250930000000741 NNN +049630 KR7049630007翵ַ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000050700000100001NNN00NNN000000100N0900000138906480000000005002003012400000000011689700000000005844878000012 0 NN000001161000000041-000000010001500000000420250930000005926 NNN +049720 KR7049720006ſ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000100000000100001NNN00NNN000000060Y0900000000996520000000005002002013100000000001430000000000000715000000012 0 NN0000013300000001200000001240009900000002620250930000001430 NNN +049830 KR7049830003 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000082800000100001NNN00NNN000000100N0900000000037270000000005002001011800000000000613200000000000306605600012 0 NN0000014440000000230000000430003700000000220241231000000507 NNN +049950 KR7049950009̷۴ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000190000000100001NNN00NNN000000100N0900000001662430000000005002005010400000000000881700000000000440894200012 0 NN000000273-00000190-00000192-0190-0000001420250930000001675 NNN +049960 KR7049960008̿ ST3100910240000NNY NNNYNNNN0NNNNNNNN0000132500000100001NNN00NNN000000060Y0900000000247310000000005002002121300000000000940000000000000470000000012 0 NN0000003850000000490000000660005700000001020250930000001245 NNN +050090 KR7050090000Ȧ ST3100600000000NNN NNNNNNNN0NNYNNNNN0000008320000100001NNN00NNN000000100N0900000000878820000000005002004062900000000001978400000000000989236750012 0 NN000000127-00000020-00000020-0020-0000001220241231000000164 NNN +050110 KR7050110006ķý ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005270000100001NNN02NNN000000100N0900000027756510000000005002001051700000000007382400000000003691205900012 0 NN000003963-00000101-00000146-0158-0000004320250930000000389 NNN +050120 KR7050120005ESť ST3101100000000NNN NNNNNNNN0NNNNNNNN0000027950000100001NNN00NNN000000100N0900000000134320000000050002002042500000000001356400000000006909201350012 0 NN000000117-00000066-00000044-003700000000720250930000000379 NNN +050760 KR7050760008 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000012940000100001NNN00NNN000000100N0900000000266840000000005002002051600000000001633400000000000816733900012 0 NN000000499-00000037-00000054-0046-0000000120250930000000211 NNN +050860 KR7050860006Ƽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000019070000100001NNN00NNN000000100N0900000000502990000000005002010012600000000002250000000000001125000000006 0 NN0000011330000000400000000330002800000000220250630000000429 NNN +050890 KR7050890003򸮵 ST2100910280000NNN NNNNNNNN0NNNNNNNY0000082600000100001NNN00NNN000000050Y0900000016771420000000005002005070800000000006075600000000003061082000012 0 NN0000018200000000720000000710009300000000820250930000005018 NNY +050960 KR7050960004̾Ƽ ST3000000000000 NN N N 0 N N0000093800000100001NNN00NNN000000100N0900000000213710000000005002016101100000000000675100000000000337550000012 0 NN0000002670000000570000000520004400000000520241231000000633 NNN +051160 KR7051160000Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000079400000100001NNN00NNN000000060Y0900000001343530000000005002002052800000000001547400000000000773721500012 0 NN0000044680000001720000001980016100000001120250930000001228 NNY +051360 KR7051360006 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000160800000100001NNN00NNN000000060Y0900000000743830000000005002004111900000000001504700000000000835852900012 0 NN0000048480000004700000004100033900000002020250930000002419 NNN +051370 KR7051370005÷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000115800000100001NNN00NNN000000060Y0900000002483890000000005002003012200000000002332700000000001166373600012 0 NN0000031950000001620000002000016200000001520250930000002701632NNY +051380 KR7051380004ǾƮ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000019630000100001NNN00NNN000000100N0900000001087810000000005002002021500000000001534000000000000767003600012 0 NN000003338000000019-00000009-0007-0000000220241231000000301 NNN +051390 KR7051390003YW ST3101100000000NNN NNNNNNNN0NNNNNNNN0000037650000100001NNN00NNN000000100N0900000000030830000000005002001111500000000001135500000000000567768400012 0 NN0000001330000000430000000470003800000000520250930000000427 NNN +051490 KR7051490001󿥾ص ST3100910270000NNN NNNNNNNN0NNNNNNNN0000042000000100001NNN00NNN000000100N0900000003150850000000005002001061200000000001420000000000000723000000012 0 NN0000013950000000350000000840006100000000620250930000000596 NNN +051500 KR7051500007CJÿ ST2101100000000YNN NNNNNNNN0NNNNNNNN0000269000000100001NNN00NNN000000060Y0900000000420820000000010002001072600000000001187100000000001187158600012 0 NN0000258310000007170000004930039900000001520250930000003193720NNN +051780 KR7051780005ťȦ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000010240000100001NNN00NNN000000100N0900000001475570000000005002001062600000000002581100000000001290562250012 0 NN000000426000000000-00000062-0069-0000008220250930000000264 NNN +051980 KR7051980001߾÷ܼ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000027450000100001NNN00NNN000000100N0900000052394150000000005002001073100000000011109100000000005579585450012 0 NN000000125-00000037-00000102-0102-0000000920250930000003049 NNN +052020 KR7052020005Ƽť ST2101100000000NNN NNNNNNNN0NNYNNNNN0000079900000100001NNN00NNN000000100N0900000008526100000000005002001070500000000006798300000000003399164550012 0 NN000000042-00000165-00000152-0152-0000004120250930000005431 NNN +052220 KR7052220001iMBC ST3101500000000NNN NNNNNNNN0NNNNNNNN0000033350000100001NNN00NNN000000100N0900000002068690000000005002005012100000000002300000000000001150000000012 0 NN000000301-00000079-00000064-0065-0000001120250930000000767 NNN +052260 KR7052260007̿ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000043750000100001NNN00NNN000000100N0900000001742830000000005002001051700000000003000000000000001500000000012 0 NN00000103800000015200000014700020-0000000220250930000001312Z35NNN +052300 KR7052300001δ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000022550000100001NNN00NNN000000100N0900000000729850000000050002001080200000000001686500000000008432571500012 0 NN000000057-000000160000006130048400000003720250930000000380 NNN +052330 KR7052330008 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000096100000100001NNN00NNN000000100N0900000000191810000000005002001071000000000001776100000000000888079450012 0 NN0000028430000002560000002300016400000000820250930000001706 NNN +052400 KR7052400009ڳ ST1000000000000NNN NNNNNNNN0NNNNNNNY0000631000000100001NNN00NNN000000050Y0900000007765010000000005002001101800000000001456300000000000777955900012 0 NN0000021880000006010000007000054600000000020250930000009189 NNY +052420 KR7052420007÷ܼ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000015480000100001NNN00NNN000000060Y0900000009835690000000005002001080700000000009442500000000005008926650012 0 NN0000012290000002260000002320022700000001220250930000001461 NNY +052460 KR7052460003ũƮ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000033750000100001NNN00NNN000000100N0900000000636560000000005002005010300000000001460700000000000730396800012 0 NN000000974-000000340000000270002000000000420250930000000493 NNN +052600 KR7052600004ѳƮ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000037300000100001NNN00NNN000000100N0900000000792820000000005002001071000000000001156300000000000578185000012 0 NN0000002590000000420000000380003400000000920241231000000431 NNN +052670 KR7052670007Ϲ̿ ST3100910240000NNN NNNNNNNN0NNYNNNNN0000020800000100001YNY00NNN000000100N0900000000000000000000005002002012400000000002912900000000001456453200012 0 NN000000139-00000011-00000004-0004-0000000120241231000000605 NNN +052710 KR7052710001Ƹ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000100800000100001NNN00NNN000000100N0900000004043520000000005002003080100000000001461500000000000730755450012 0 NN0000020020000000600000001110009500000000120250930000001473 NNN +052770 KR7052770005 ST3000000000000NNN NNNNNNNN0NNYNNNNN0000009690000100001NNY00NYN000000100N0900000005525910000000005002002082200000000001456800000000000728438700012 0 NN000000097-00000058-00000074-0075-0000016620250930000000141 NNN +052790 KR7052790003Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000061900000100001NNN00NNN000000100N0900000000503300000000005002001081400000000001133000000000000566531900012 0 NN0000005780000002350000003240025700000000720250930000000701 NNN +052860 KR7052860004̾ؾ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000029800000100001NNN00NNN000000100N0900000004314780000000005002009100600000000001786200000000000893142700012 0 NN00000032000000006300000006200062-0000000120250930000000532 NNN +052900 KR7052900008KX ST3100910230000NNN NNNNNNNN0NNNNNNNN0000009500000100001NNN00NNN000000100N0900000002221260000000005002005011800000000006537400000000003268722800012 0 NN0000008830000000410000000150002900000000420250930000000621 NNN +053030 KR7053030003̳ؽ ST2100910240000NNY NNNYNNNN0NNNNNNNY0000161700000100001NNN00NNN000000060Y0900000007897670000000005002001080700000000003268400000000001634209400012 0 NN00000129700000001800000000500004-0000000420250930000005285 NNY +053050 KR7053050001 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000023900000100001NNN00NNN000000100N0900000008217800000000005002001101100000000002998700000000001530435750012 0 NN0000015560000000490000000380003600000000420241231000000716 NNN +053060 KR7053060000 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000014330000100001NNN00NNN000000100N0900000005559750000000005002001081700000000001765700000000000882870950012 0 NN0000013330000000760000000860008000000002620250930000000253 NNN +053080 KR7053080008̿ ST3100910270000 NN N N 0 N N0000127200000100001NNN00NNN000000060Y0900000001805850000000005002020092400000000001299900000000000649990350012 0 NN0000036130000000550000000550005400000000520250930000001653 NNY +053160 KR7053160008 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000069400000100001NNN00NNN000000100N0900000000117120000000005002001103000000000000600000000000000300000000012 0 NN0000001810000000030000000120001200000000120250930000000416 NNN +053260 KR7053260006ݰö ST3100910260000NNN NNNNNNNN0NNNNNNNN0000038950000100001NNN00NNN000000100N0900000000227760000000005002002010400000000001872000000000000986000000012 0 NN000001348000000012-00000035-002800000000120250930000000729 NNN +053270 KR7053270005ũ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000025200000100001NNN00NNN000000100N0900000003036790000000005002002020700000000002741000000000001370520250012 0 NN0000030350000001650000001350015200000001420250930000000690 NNN +053280 KR705328000424 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000036150000100001NNN00NNN000000100N0900000000756470000000005002008050700000000002500000000000001250000000012 0 NN000004752000000028-00000002-0008-0000000320250930000000903 NNN +053290 KR7053290003NEɷ ST3101500000000NNN NNNNNNNN0NNYNNNNN0000019000000100001NNN00NNN000000100N0900000000663470000000005002002121000000000001652600000000000826315350012 0 NN000000717-00000010-00000063-0050-0000000620241231000000313 NNN +053300 KR7053300000ѱ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000066400000100001NNN00NNN000000060Y0900000009618060000000005002014020400000000004244100000000002122068050012 0 NN0000009990000002120000002970023700000000820250930000002818DKGNNY +053350 KR7053350005̴ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000043900000100001NNN00NNN000000100N0900000001497490000000005002001111500000000002302100000000001151053250012 0 NN000000234-000000230000002340020400000000020250930000001010 NNN +053450 KR7053450003ڴн ST3100910290000NNN NNNNNNNN0NNNNNNNN0000061800000100001NNN00NNN000000100N0900000003256190000000005002001080900000000001479200000000000739640150012 0 NN0000033690000000710000000910006900000000620250930000000914 NNN +053580 KR7053580007ɽ ST2000000000000 NN N N 0 N N0000103600000100001NNN00NNN000000060Y0900000000981010000000005002019012500000000001363600000000000689312400012 0 NN0000001970000000340000000260001800000000020250331000001412 NNY +053610 KR7053610002 ST2100910270000NNN NNNNNNNN0NNNNNNNN0000400000000100001NNN00NNN000000050Y0900000000747750000000005002001081700000000001100000000000000550000000012 0 NN0000014590000002830000003060020500000001120250930000004400 NNY +053620 KR7053620001¾ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000063700000100001NNN00NNN000000100N0900000000044170000000005002001080700000000000860000000000000430000000012 0 NN0000010340000000060000001290010300000000820250930000000547 NNN +053700 KR7053700001ﺸͽ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000070100000100001NNN02NNN000000100N0900000013436670000000005002001110600000000002411800000000001205937350012 0 NN0000126160000004820000003460034000000000720250930000001690 NNN +053800 KR7053800009ȷ ST1000000000000YNN NNNNNNNN0NNNNNNNY0000670000000100001NNN00NNN000000050Y0900000001240020000000005002001091300000000001112600000000000573897000012 0 NN0000018400000001240000003410028800000001320250930000007454 NNN +053950 KR7053950002泲 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000006360000100001NNN00NNN000000100N0900000003972110000000001002001110600000000007814700000000000781473580012 0 NN000000131000000001-00000015-001600000001020250331000000497 NNN +053980 KR7053980009̿ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000032900000100001NNN00NNN000000100N0900000000867450000000005002002040900000000001898200000000000949139150012 0 NN0000009470000000870000001210008600000001020250930000000624 NNN +054040 KR7054040001ѱǻ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000048250000100001NNN00NNN000000100N0900000000719280000000005002002011500000000001607100000000000803564500012 0 NN0000029870000001260000001260010300000000920250930000000775 NNN +054050 KR7054050000̿ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000083500000100001NNN00NNN000000060Y0900000000400410000000005002002040200000000001603000000000000801528050012 0 NN0000011960000001450000001580013300000000520250930000001338E56NNN +054090 KR7054090006ص ST3100910310000NNN NNNNNNNN0NNNNNNNN0000007910000100001NNN00NNN000000100N0900000001023470000000005002004020600000000002495900000000001247961600012 0 NN000001074-00000012-00000078-0081-0000003720250930000000197 NNN +054180 KR7054180005޵۽ ST3100910300000NNN NNNNNNNN0NNYNNNNN0000022950000100001YNY00NNN000000100N0900000000000000000000005002001101600000000000552700000000000276399050012 0 NN000000212-00000044-00000085-0085-0000003120250930000000126 NNN +054210 KR7054210000̷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000104200000100001NNN00NNN000000050Y0900000004238350000000005002002050900000000002529100000000001264560500012 0 NN0000050120000002230000000520003800000001220250930000002635 NNY +054220 KR7054220009νý ST3100910280000NNN NNNNNNNN0NNNNNNNN0000004330000100001NNN00NNN000000100N0900000003772450000000005002001122600000000005995300000000002997654050012 0 NN000000300-0000000200000004400044-0000000420250930000000259 NNN +054300 KR7054300009ҽŸ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000006870000100001NNN00NNN000000100N0900000008126670000000005002002011000000000011574100000000005787094500012 0 NN0000006290000000030000000360003600000000720241231000000795 NNN +054410 KR7054410006Ƽ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000036500000100001NNN00NNN000000100N0900000000059750000000005002002042500000000000572600000000000286322200012 0 NN0000003330000000080000000400003200000000620241231000000209 NNN +054450 KR7054450002ڷĨ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000160000000100001NNN00NNN000000060Y0900000003873840000000005002004121000000000001514400000000000757211650012 0 NN000001398-00000089-00000110-0108-0000000920250930000002423 NNY +054540 KR7054540000￵ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000149300000100001NNN00NNN000000060Y0900000006168340000000005002001111500000000001300000000000000751315050012 0 NN0000008540000000870000000920007500000001120250930000001940 NNY +054620 KR7054620000APS ST3101400000000NNY NNYNNNNN0NNNNNNNN0000045550000100001NNN00NNN000000100N0900000000735590000000005002001120400000000001839400000000001019711050012 0 NN000000586-00000066-00000092-0088-0000002920250930000000837 NNN +054670 KR7054670005Ѵ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000066100000100001NNN00NNN000000100N0900000000996310000000005002002022600000000001435400000000000717746000012 0 NN0000020220000001870000001840015500000001320241231000000948 NNN +054780 KR7054780002Ű̽Ʈ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000030400000100001NNN00NNN000000100N0900000000689670000000005002003111400000000001965700000000000982889650012 0 NN000000758000000007-00000109-0110-0000002220241231000000597KAONNN +054800 KR7054800008̵Ȧ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000116200000100001NNN00NNN000000100N0900000000075630000000005002001092700000000001034700000000000517387800012 0 NN0000064760000005900000005860045000000000920250930000001202 NNN +054920 KR7054920004 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000057900000100001NNN00NNN000000060Y0900000132484450000000005002001110100000000002821700000000001410854050012 0 NN0000049720000000410000001200011900000000120250930000001633 NNN +054930 KR7054930003 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000227000000100001NNN00NNN000000100N0900000000159470000000050002002011500000000000300000000000001500000000012 0 NN0000033960000000580000002970024400000000020241231000000681 NNN +054940 KR7054940002̿ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000006740000100001NNN00NNN000000100N0900000000815070000000005002001121300000000003317300000000001658677400012 0 NN000001251000000002-00000024-002100000000320250930000000223 NNN +054950 KR7054950001̺̿ ST2100910270000NNY NNNNNNNN0NNNNYNNN0000255500000100001NNN00NNN000000050Y0900000000710530000000005002006060700000000001208900000000000604494600012 0 NN0000013010000002740000002960023100000001520250930000003088 NNY +056080 KR7056080005κ ST2100910270000NNN NNNNNNNN0NNNNNNNY0000340000000100001NNN02NNN000000100N0900000020216210000000005002001111300000000003751200000000001875607600012 0 NN000000260-00000042-00000036-0032-0000000920241231000012754 NNN +056090 KR7056090004޵ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000014750000100001NNN00NNN000000100N0900000023771090000000005002015111200000000010325900000000005162951800012 0 NN0000003570000000350000000330003200000000520250930000001523 NNN +056190 KR7056190002 ST1100910270000NNN NNNNNNNN0NNNNNNNY0000310000000100001NNN00NNN000000050Y0900000002988930000000005002001121800000000003590800000000001795438000012 0YNN0000123740000007690000006490047700000000220250930000011131 NNN +056360 KR7056360001 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000052900000100001NNN00NNN000000100N0900000000625520000000005002001120400000000000979600000000000489840000012 0 NN000000362-00000043-00000030-0020-0000000220250930000000518 NNN +056700 KR7056700008ȭ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000018480000100001NNN00NNN000000100N0900000010591070000000005002001121300000000002913500000000001456754550012 0 NN0000017600000001040000000770005700000000820250930000000538971NNN +056730 KR7056730005CNT85 ST3101000000000NNN NNNNNNNN0NNNNNNNN0000005750000100001NNN00NNN000000100N0900000000180060000000005002002010400000000007411100000000003705559300012 0 NN000000670-00000014-00000013-0013-0000000220241231000000426 NNN +057030 KR7057030009YBM ST3100600000000NNN NNNNNNNN0NNNNNNNN0000029100000100001NNN00NNN000000100N0900000000697040000000005002004060800000000001631200000000000815634850012 0 NN0000003930000000100000000170001500000000420250930000000474 NNN +057540 KR7057540007ȴϽý ST3100910290000NNN NNNNNNNN0NNNNNNNN0000008300000100001NNN00NNN000000100N0900000002619830000000005002007091900000000005944900000000003072467750012 0 NN000000747-00000004-00000007-001400000000320250930000000493 NNN +057680 KR7057680001Ƽ̾Ƽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000008180000100001NNN00NNN000000100N0900000002934170000000005002002061800000000007124800000000003571725100012 0 NN000000236-00000009-00000019-0019-0000000020250930000000582 NNN +057880 KR7057880007Ǫҳ ST2000000000000NNN NNNNNNNN0NNYNNNNN0000000000000100001NYY00NNN000000100N0900000000000000000000005002003122900000000002458000000000001229018400012 0 NN000000047-00000010-00000052-0052-3610000020250930000000000 NNN +058110 KR7058110008߾̾ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000018860000100001NNN00NNN000000100N0900000001083220000000005002015121400000000001605000000000000802526500012 0 NN000000081-00000031-00000030-0030-0000001820250930000000302 NNN +058400 KR7058400003KNN ST3101500000000NNN NNNNNNNN0NNNNNNNN0000007010000100001NNN00NNN000000100N0900000002786810000000005002010110300000000013242900000000006621486000012 0 NN0000004500000000260000000670005500000000420250930000000928 NNN +058450 KR7058450008ֿ̾Ƽ ST3101500000000NNN NNNNNNNN0NNYNNNNN0000010120000100001NNN00NNN000000100N0900000000224740000000005002002011700000000001479300000000000739681050012 0 NN000000045-00000051-00000072-0072-0000006120250930000000149 NNN +058470 KR7058470006 ST1100910280000NNY NNNNNNNN0NNNNNNNY0000869000000100001NNN00NNN000000050Y0900000019728650000000001002001121800000000007621100000000000762118500012 0 NY0000027820000012420000014650113300000001920241231000066228 NNY +058610 KR7058610007 ST2100910280000NNN NNNNNNNN0NNNNNNNY0001515000000100001NNN00NNN000000050Y0900000034103970000000005002002072300000000002217700000000001108868000012 0 NN0000025780000001290000001140009200000000520250930000033598 NNN +058630 KR7058630005 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000057400000100001NNN00NNN000000060Y0900000000914650000000005002008121900000000001920200000000000977193850012 0 NN0000006850000001330000001670012200000001420250930000001102 NNN +058820 KR7058820002CMG ST2100910240000NNY NNNYNNNN0NNNNNNNN0000020350000100001NNN00NNN000000060Y0900000023189190000000005002001083100000000014784200000000007392109150012 0 NN000000737-00000047-00000078-0067-0000000520250930000003008 NNN +058970 KR7058970005 ST2000000000000 NN N N 0 N Y0000419000000100001NNN00NNN000000060Y0900000001840650000000005002021081300000000001236000000000000654476900012 0 NN0000006400000000140000000170002200000000620250930000005179 NNY +059090 KR7059090001 ST2100910280000NNN NNNNNNNN0NNNNNNNY0000163400000100001NNN00NNN000000060Y0900000011969950000000005002002011500000000003341600000000001670838900012 0 NN0000070890000008790000007950061200000002920250930000005460 NNY +059100 KR7059100008Ʈ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000049250000100001NNN00NNN000000100N0900000000147000000000005002008121600000000000707000000000000353543000012 0 NN0000003710000000260000000320003300000000920241231000000348 NNN +059120 KR7059120006 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000098800000100001NNN00NNN000000100N0900000054547910000000005002014072400000000000974800000000000507142850012 0 NN000000252-00000042-00000030-0028-0000000720241231000000963 NNN +059210 KR7059210005Ÿ̿޵ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000049000000100001NNN00NNN000000100N0900000004968140000000005002008041500000000002809400000000001404715050012 0 NN0000007670000001850000001170009200000001820250930000001376 NNN +059270 KR7059270009ؼκƽ ST3100910260000 NN N N 0 N N0000171800000100001NNN00NNN000000100N0900000060342590000000005002021042100000000001116500000000000558264950012 0 NN000000149-00000007-00000005-0005-0000000120241231000001918 NNN +060150 KR7060150000μ̿Ƽ ST2100600000000NNN NNNNNNNN0NNNNNNNN0000044300000100001NNN00NNN000000060Y0900000002036240000000005002002061400000000004656300000000002328180600012 0 NN000001399000000123-00000070-0056-0000001020250930000002062LB1NNN +060230 KR7060230000̽ó ST3100910230000NNN NNNNNNNN0NNNNNNNN0000042100000100001NNN00NNN000000100N0900000028896350000000005002002062500000000000808200000000000404111000012 0 NN000000399-00000067-00000135-0135-0000006320250930000000340 NNN +060240 KR7060240009Ÿڸũ ST3100910300000NNN NNNNNNNN0NNYNNNNN0000019760000100001YNY00NNN000000100N0900000000000000000000005002002010400000000000582100000000000294553000012 0 NN000000194-00000041-00000056-0054-0000015920250930000000115 NNN +060250 KR7060250008NHN KCP ST2101400000000NNN NNNNNNNN1NNNNNNNY0000215000000100001NNN00NNN000000050Y0900000040632270000000005002002010800000000004016000000000002008030550012 0 NN0000089920000003900000004420033200000001720250930000008634 NNN +060260 KR7060260007 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000010770000100001NNN00NNN000000100N0900000000794600000000005002002020500000000001351200000000000675600450012 0 NN000000292-0000000200000000000002-0000000320250930000000145 NNN +060280 KR7060280005ť ST2101100000000NNN NNNNNNNN0NNNNNNNY0000189200000100001NNN00NNN000000100N0900000016347410000000005002002070300000000004108900000000002054499500012 0 NN0000005370000000100000000100001000000000020250930000007774 NNN +060310 KR70603100003S ST3100910290000NNN NNNNNNNN0NNNNNNNN0000014960000100001NNN00NNN000000100N0900000003437110000000005002002042300000000005305900000000002652952000003 0 NN000000158-00000024-00000021-0021-0000002120250930000000793 NNN +060370 KR7060370004LSַ ST1101000000000NNY NNNNNNNN0NNNNNNNY0000313000000100001NNN00NNN000000050Y0900000004472510000000010002002021500000000005223800000000005223885400012 0 NY0000018840000000850000000950007300000000020250930000016350FN2NNY +060380 KR7060380003翡 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000014500000100001NNN00NNN000000100N0900000000762780000000005002002020500000000001970000000000000985000000012 0 NN0000014620000000190000000260001900000000220250930000000285 NNN +060480 KR7060480001Ͻŵ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000015900000100001NNN00NNN000000100N0900000000724420000000005002014122900000000001109000000000000554500000012 0 NN000000314-00000017-00000037-0034-0000000820241231000000176 NNN +060540 KR7060540002Ƽ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000013860000100001NNN00NNN000000100N0900000000946870000000005002006112800000000002613300000000001306665300012 0 NN000001118000000008-00000022-002300000000220250930000000362 NNN +060560 KR7060560000HCȨŸ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000006950000100001NNN00NNN000000100N0900000000826380000000001002002071100000000012694000000000001276695250012 0 NN000002166-00000132-00000012-0013-0000000220250930000000882 NNN +060570 KR7060570009帲۴ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000014750000100001NNN00NNN000000100N0900000000992660000000005002003121900000000007410100000000003781078650012 0 NN00000164000000000700000005800038-0000000820250930000001092535NNN +060590 KR7060590007Ƽ̿ ST3100910240000NNY NNNYNNNN0NNNNNNNN0000044700000100001NNN00NNN000000060Y0900000000943280000000005002002022100000000002418100000000001209051000012 0 NN0000009220000000470000000320002100000000420250930000001080 NNN +060720 KR7060720000KH ST2100910280000NNN NNNNNNNN0NNNNNNNN0000145000000100001NNN00NNN000000050Y0900000004199120000000005002002052100000000002367700000000001183872100012 0 NN0000036640000002940000001740018600000000920250930000003433 NNY +060850 KR7060850005Ʈ ST3000000000000 NN N N 0 N N0000065100000100001NNN00NNN000000100N0900000000318190000000005002020081200000000000813100000000000406550000012 0 NN0000005630000000260000000670006300000001420250930000000529 NNN +060900 KR7060900008ƮAI ST3000000000000NNN NNNNNNNN0NNNNNNNN0000005760000100001NNN00NNN000000100N0900000001802980000000005002002091700000000007982100000000003991073400012 0 NN000000120-00000042-00000051-0051-0000002720250930000000459 NNN +061040 KR7061040002˿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000019190000100001NNN00NNN000000100N0900000001765150000000005002002051600000000003208900000000001604462950012 0 NN000001991-00000156-00000148-0146-0000001820250930000000615 NNN +061090 KR7061090007ũ ST0100910280000 NN N N 0 N N0000482000000100001NNN00NNN000000100N0900000002008130000000005002025111400000000000558500000000000281346200012 0 NN0000014530000001940000002160017400000000020250930000002692 NNN +061250 KR7061250007ȭϾǰ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000011230000100001NNN00NNN000000100N0900000002891580000000005002002041800000000008651500000000004401751350012 0 NN0000011980000000080000000820006500000000320241231000000971 NNN +061970 KR7061970000LB ST2100910280000NNN NNNNNNNN0NNNNNNNN0000043000000100001NNN00NNN000000100N0900000006027400000000005002011013100000000005808300000000002904150300012 0 NN000003581-00000136-00000249-0163-0000001020250930000002497 NNN +062970 KR7062970009ѱ÷ܼ ST3100910280000 NN N N 0 N N0000026850000100001NNN00NNN010001100N0900000014289150000000005002019122600000000002305900000000001152953800012 0 NN000000065-00000048-00000142-0143-0000022420241231000000730 NNN +063080 KR7063080006Ȧ ST3000000000000NNN NNNNNNNN1NNNNNNNN0000230000000100001NNN00NNN000000060Y0900000002154020000000005002009073000000000000659500000000000329759600012 0 NN000000713-00000093-00000184-0181-0000001520250930000001516 NNN +063170 KR7063170005 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000076400000100001NNN00NNN000000100N0900000002392240000000005002008070100000000001777400000000000888713350012 0 NN000000157-00000023-00000061-0061-0000001020250930000001357 NNN +063440 KR7063440002SM Life Design ST3100910220000NNN NNNNNNNN0NNNNNNNN0000017250000100001NNN00NNN000000100N0900000002309150000000005002002053000000000004602900000000002337457700012 0 NN0000004260000000550000000620006100000001120250930000000794KAONNN +063570 KR7063570006NICE ST3100600000000NNN NNNNNNNN0NNNNNNNN0000042100000100001NNN00NNN000000060Y0900000000784900000000005002006071400000000003414700000000001707386400012 0 NN0000027780000002320000000990007700000000320250930000001437 NNN +063760 KR7063760003̿ ST3100910290000 NN N N 0 N N0000025500000100001NNN00NNN000000100N0900000000202020000000005002017040600000000000932500000000000466256500012 0 NN000000181-00000002-00000002-000200000000220250930000000237 NNN +064090 KR7064090004ũ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000010940000100001NNN00NNN000000100N0900000005591080000000005002002121700000000004974200000000002487137250012 0 NN000000055-00000043-00000242-0242-0000001220250930000000544 NNN +064240 KR7064240005ȨijƮ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000019000000100001NNN00NNN000000100N0900000001539670000000005002003061100000000003469400000000001776904750012 0 NN000000234-00000049-00000044-004300000000520250930000000659 NNN +064260 KR7064260003ٳ ST2000000000000NNN NNNNNNNN1NNNNNNNN0000089800000100001NNN00NNN000000060Y0900000285822200000000005002004072300000000007517900000000003758973950012 0 NN000001695000000054-00000541-0566-0000001720250930000006751 NNY +064290 KR7064290000÷ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000176600000100001NNN00NNN000000100N0900000003579830000000005002011010500000000001286300000000000643198100012 0 NN000000495-00000078-00000101-0089-0000002620250930000002271 NNN +064480 KR7064480007긮 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000052600000100001NNN00NNN000000100N0900000000737200000000005002008060400000000001195200000000000617625000012 0 NN000000436-00000033-00000029-0028-0000000620241231000000628 NNN +064520 KR7064520000ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000017780000100001NNN00NNN000000100N0900000000608380000000005002002120400000000002235100000000001117553100012 0 NN000000134-00000036-00000034-0034-0000000320250930000000397 NNN +064550 KR7064550007̿Ͼ ST2100910240000NNN NNNNNNNN0NNNNNNNN0000137900000100001NNN00NNN000000050Y0900000002138610000000005002005122900000000002581000000000001290514550012 0 NN00000250300000012500000007600015-0000000420250930000003559 NNN +064760 KR7064760002Ƽ ST1100910250000NNY NNYNNNNN0NNNNNNNY0002280000000100001NNN00NNN000000050Y0900000001892750000000005002003081800000000001117900000000000583750000012 0 NY0000027570000008070000009070072000000001520241231000025489 NNY +064800 KR7064800006ϸũ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000008080000100001NNN00NNN000000100N0900000005496040000000001002002082200000000012780700000000001278072980012 0 NN000000315-000001450000009940077200000002220250930000001032 NNN +064820 KR7064820004 ST2100910300000NNN NNNNNNNN0NNNNNNNN0000115500000100001NNN00NNN000000100N0900000001914290000000005002007052900000000003090100000000001545086400012 0 NN0000042650000005470000005020031900000001120250930000003569 NNN +064850 KR7064850001ذ̵ ST3000000000000 NN N N 0 N N0000098400000100001NNN00NNN000000100N0900000000309890000000005002020121700000000001141000000000000607016600012 0 NN0000002590000000680000000850007500000001220250930000001122 NNN +065060 KR7065060006 ST3100910200000NNN NNNNNNNN0NNNNNNNN0000007520000100001NNN00NNN000000100N0900000000471280000000005002002052800000000002380000000000001190040200012 0 NN000000816-00000004-00000059-0065-0000003420250930000000178 NNN +065130 KR7065130007žϾ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000037350000100001NNN00NNN000000100N0900000001083010000000005002003012900000000001600400000000000893099100012 0 NN000006258-00000253-00000258-0193-0000000920250930000000597 NNN +065150 KR7065150005F&B ST3101100000000NNN NNNNNNNN0NNNNNNNN0000001450000100001YNY00NNN000000100N0900000000000000000000001002007071800000000015938200000000001593824050012 0 NN00000083500000003300000005800053-0000002320250930000000231 NNN +065170 KR7065170003 ST3101100000000NNN NNNNNNNN0NNYNNNNN0000021300000100001YNN02NNN000000100N0900000006011540000000005002002111900000000002668300000000001334151250012 0 NN000000057-00000017-00000030-0030-0000002420250930000000568 NNN +065350 KR7065350001żŸũ ST1100910280000NNY NNNNNNNN0NNNNNNNY0000725000000100001NNN00NNN000000060Y0900000006105880000000005002004080600000000002748300000000001374197400012 0 NY0000069860000002140000002150014900000000620250930000019925 NNN +065370 KR7065370009 ST3000000000000 NN N N 0 N N0000060300000100001NNN00NNN000000100N0900000000887240000000005002020021000000000000738300000000000369197700012 0 NN0000002280000000060000000010000200000000420250930000000445 NNN +065420 KR7065420002̸ҽ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000002310000100001NNN00NNN000000100N0900000003379710000000001002002082200000000007157700000000000715772990012 0 NN000000105-00000037-00000021-0021-0000002420241231000000165 NNN +065440 KR7065440000̷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000015020000100001NNN00NNN000000100N0900000002481100000000005002003012800000000002727500000000001363751000012 0 NN000000348-00000005000000001-000300000000020250930000000409 NNN +065450 KR7065450009 ST3100910290000NNN NNNNNNNN0NNNNNNNN0000038350000100001NNN00NNN000000060Y0900000004068030000000002002003020500000000002865200000000000573056000012 0 NN0000005410000000240000000150001100000000620250930000001098 NNY +065500 KR7065500001Ʈ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000024150000100001NNN00NNN000000100N0900000004197400000000005002002091900000000003174200000000001587145600012 0 NN0000012010000000190000000080000800000000120250930000000766 NNN +065510 KR7065510000޺ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000088000000100001NNN00NNN000000100N0900000001364790000000005002003103100000000001148500000000000607968550012 0 NN0000009050000000760000000510004900000000220250930000001010 NNN +065530 KR7065530008̾ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000013460000100001NNN00NNN000000100N0900000000713130000000005002002060400000000004783800000000002643000000012 0 NN0000004470000000170000000140001400000000420250930000000643 NNN +065570 KR7065570004￵̿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000007640000100001YNY00NNN000000100N0900000000000000000000005002003012100000000001609300000000000804691900012 0 NN000000361-00000059-00000253-0268-0000010720241231000000122 NNN +065650 KR7065650004۷̼ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000018000000100001NNY00NNN000000100N0900000000635090000000005002003012100000000001333500000000000666760800012 0 NN000000566-0000003100000003200027-0000011020250930000000240 NNN +065660 KR7065660003Ʈ ST2101100000000NNY NNNYNNNN0NNNNNNNN0000410000000100001NNN00NNN000000100N0900000000270300000000005002016021500000000001000600000000000500305000012 0 NN000000069-00000037-00000023-0023-0000000220241231000004102 NNN +065680 KR7065680001ϷƮ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000307000000100001NNN00NNN000000100N0900000000313450000000005002004010200000000000924000000000000496711000012 0 NN0000014110000001810000001870015700000000920250930000002836 NNN +065690 KR7065690000Ŀ ST3100910230000NNN NNNNNNNN0NNYNNNNN0000016240000100001NNN00NNN000000100N0900000000774910000000005002002071600000000001404900000000000702466550012 0 NN000000404-000000980000000950007400000001120250930000000228 NNN +065710 KR7065710006ȣ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000520000000100001NNN00NNN000000060Y0900000000213530000000005002002071600000000000515000000000000257500000012 0 NN0000009590000002130000002060016200000002220250930000002678 NNN +065770 KR7065770000CS ST3100910280000NNN NNNNNNNN0NNNNNNNN0000007790000100001NNN00NNN000000100N0900000000994000000000005002004060400000000001941100000000000970556500012 0 NN000000134-00000013-00000011-0011-0000000720250930000000151 NNN +065950 KR7065950008ũ ST3100910200000NNN NNNNNNNN0NNNNNNNN0000017230000100001NNN00NNN000000100N0900000002383800000000005002003072900000000002823100000000001411565100012 0 NN000002010-00000093-00000138-0143-0000000820250930000000486 NNN +066130 KR7066130006 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000044000000100001NNN00NNN000000100N0900000000241530000000005002003021100000000001280000000000000640000000012 0 NN0000018650000001070000001050008900000000820241231000000563 NNN +066310 KR7066310004ť ST3100910280000NNN NNNNNNNN0NNNNNNNN0000084800000100001NNN00NNN000000100N0900000001403660000000005002006112400000000000927100000000000463581050012 0 NN0000001720000000020000000140001000000000220250930000000786 NNN +066360 KR7066360009üη ST3100910190000 NN N N 0 N N0000007720000100001NNN00NNN000000100N0900000000440570000000005002017120400000000004795200000000002397600750012 0 NN0000030520000001720000001580014500000000220250930000000370 NNN +066410 KR7066410002ŶƩ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000011530000100001YNY00NYN000000100N0900000000000000000000005002003121900000000013845300000000006922690900012 0 NN000000130-00000042-00000147-0147-0000000220250930000001596 NNN +066430 KR7066430000̷κƽ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000024700000100001NNN00NNN000000100N0900000011851430000000005002002122400000000003915300000000001957673800012 0 NN000000361000000009-00000005-0005-0000000120241231000000967 NNN +066590 KR7066590001AMS ST3100910300000NNN NNNNNNNN0NNNNNNNN0000032650000100001NNN00NNN000000100N0900000007971830000000005002003021200000000003867700000000001953655200012 0 NN000002761000000020-00000041-004500000000120250930000001262 NNN +066620 KR7066620006 ST3101000000000NNN NNNNNNNN0NNNNNNNN0000216500000100001NNN00NNN000000060Y0900000000157650000000005002002090500000000000750000000000000375000000012 0 NN0000033710000003610000004620036800000001720250930000001623 NNN +066670 KR7066670001Ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000029600000100001NNN00NNN000000100N0900000000475690000000005002002123000000000001869100000000000934595900012 0 NN000001385-00000007000000003-000400000000220250930000000553 NNN +066700 KR7066700006׶ؽ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000030050000100001NNN00NNN000000100N0900000001551290000000005002004052700000000003715200000000001857618800012 0 NN00000202600000006000000003400021-0000003220250930000001116 NNN +066790 KR7066790007 ST3101500000000NNN NNNNNNNN0NNNNNNNN0000014930000100001YNY00NNN000000100N0900000000000000000000005002003053000000000006515200000000003257601950012 0 NN000000139-00000025-00000021-0021-0000001020250930000000972 NNN +066900 KR7066900002 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000019430000100001NNN00NNN000000100N0900000000142520000000005002004051400000000002274400000000001137225150012 0 NN000003947-00000509-00000525-0531-0000010620250930000000441 NNN +066910 KR7066910001տ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000006800000100001NNN00NNN000000100N0900000066312430000000005002005010700000000006693300000000003346658200012 0 NN000000587-00000038-00000049-0054-0000002720250930000000455 NNN +066980 KR7066980004Ѽũ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000013400000100001NNN00NNN000000100N0900000004801450000000005002003011700000000005193500000000002596756250012 0 NN00000151900000004600000004000033-0000006820250930000000695 NNN +067000 KR7067000000̽Ƽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000023400000100001NNN00NNN000000060Y0900000019074820000000005002008053000000000006990300000000003537915750012 0 NN000000921000000024000000005-0023-0000001220250930000001635 NNY +067010 KR7067010009̾ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000024200000100001NNN00NNN000000100N0900000000165130000000005002007121800000000001229400000000000682350000003 0 NN000000733-00000027-000000140000600000000120250331000000297 NNN +067080 KR7067080002ȭ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000164900000100001NNN00NNN000000060Y0900000001635080000000005002003021400000000001861600000000000930832500012 0 NN000001094000000025-00000002-001000000000020250930000003069 NNY +067160 KR7067160002SOOP ST1000000000000NNY NNNNNNNN0NNNNNNNY0000736000000100001NNN00NNN000000050Y0900000001677430000000005002003121900000000001149400000000000574738350012 0 NY0000035040000009420000009790075300000002520250930000008460 NNY +067170 KR7067170001 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000019120000100001NNN00NNN000000100N0900000001276650000000005002003111400000000002389100000000001194580250012 0 NN00000708600000007900000003600030-0000001620250930000000456 NNN +067280 KR7067280008Ƽķ۽ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000295500000100001NNN00NNN000000060Y0900000000822350000000005002006111600000000000592600000000000296338950012 0 NN0000024570000002150000002470018300000001320250930000001751511NNN +067290 KR7067290007JWž ST3100910240000NNY NNNYNNNN0NNNNNNNN0000020250000100001NNN00NNN000000100N0900000010516030000000005002003021100000000005603700000000002801855150012 0 NN0000005990000000600000001370013700000003220250930000001134 NNN +067310 KR7067310003ϳũ ST1100910280000NNY NNNNNNNN0NNNNNNNY0000362500000100001NNN00NNN000000060Y0900000059590960000000005002005101100000000006638800000000003319407550012 0 NY0000108430000008030000003970029500000000620250930000024065 NNY +067370 KR7067370007̿ ST3100910240000 NN N N 0 N N0000055800000100001NNN00NNN000000100N0900000000316960000000005002022100500000000001219300000000000615677750012 0 NN000000087-00000005-00000002-0001-0000000020241231000000680 NNN +067390 KR7067390005ƽƮ ST2100910300000NNN NNNNNNNN0NNNNNNNN0000006180000100001NNN00NNN000000100N0900000009515760000000005002014122400000000040315700000000020183078950012 0 NN000001894000000082-00000050-0052-0000000120250930000002491 NNN +067570 KR7067570002̿ġڸ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000023050000100001NNN00NNN000000060Y0900000002462610000000005002013120300000000004217000000000002204349550012 0 NN0000122630000005060000003550028000000001020250930000000972 NNN +067630 KR7067630004HLB ST2100910240000NNN NNNNNNNN0NNYNNNNN0000049900000100001NNN00NNN000000100N0900000013983950000000005002008112500000000012191700000000006095852900012 0 NN000000348-00000162-00001204-1201-0000005020250930000006083 NNN +067730 KR7067730002ý ST3000000000000NNN NNNNNNNN0NNNNNNNN0000025700000100001NNN00NNN000000100N0900000000606660000000005002015072900000000000967300000000000483696100012 0 NN0000004290000000240000000250002400000001420241231000000248 NNN +067770 KR7067770008Ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000022500000100001NNN00NNN000000100N0900000000130990000000005002004010900000000000839600000000000419829650012 0 NN000000087-000000020000000020000200000000320250930000000188 NNN +067900 KR7067900001̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000067700000100001NNN00NNN000000100N0900000001771990000000005002005122300000000001819900000000000909982950012 0 NN0000008640000002000000001950016200000000920250930000001232 NNN +067920 KR7067920009̱۷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000053900000100001NNN00NNN000000100N0900000000362570000000005002010080400000000001099600000000000549805950012 0 NN0000007600000000120000000160001600000001220250930000000592 NNN +067990 KR7067990002ġͽ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000043550000100001NNN00NNN000000060Y0900000025688790000000005002004120300000000002918100000000001609077500012 0 NN0000190860000002800000000140001200000000020250930000001270 NNN +068050 KR7068050004ҿθƮ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000018330000100001NNN00NNN000000100N0900000000791600000000005002006070700000000002769400000000001384703800012 0 NN000000212-00000023-00000032-0032-0000000920250930000000507 NNN +068100 KR7068100007̿ ST3100910270000 NN N N 0 N N0000030200000100001NNN00NNN000000100N0900000000181350000000005002024022200000000000993900000000000496980700012 0 NN000000131-00000016-00000016-0016-0000000520250930000000300 NNN +068240 KR7068240001ٿý ST2100910280000NNY NNNNNNNN0NNNNYNNN0000031800000100001NNN00NNN000000100N0900000041503430000000005002010091400000000003816300000000001928025950012 0 NN000001074-00000576-00000682-0579-0000002920250930000001213 NNN +068330 KR7068330000ϽŹ̿ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000016520000100001NNN00NNN000000100N0900000025519080000000001002007122600000000004421600000000000442161400012 0 NN0000001080000000230000000460003800000000620241231000000730 NNN +068760 KR7068760008Ʈ ST1100910240000NNY NNNYNNNN0NNNNNNNY0000740000000100001NNN00NNN000000050Y0900000004646540000000005002006020300000000004368100000000002184096000012 0 NY0000047780000003720000002980022000000000620241231000032324LB3NNY +068790 KR7068790005DMS ST3100910270000NNN NNNNNNNN0NNYNNNNN0000063300000100001YNN00NNN000000100N0900000000000000000000005002004100100000000002257000000000001228653050012 0 NN0000011040000000460000019680203100000005220250930000001428 NNN +068930 KR7068930007д뼺 ST2100600000000NNN NNNNNNNN0NNNNNNNN0000079200000100001NNN00NNN000000060Y0900000000489750000000005002003101700000000002767500000000001491124450012 0 NN0000019990000003650000003380029000000001520250930000002191 NNN +068940 KR7068940006DZ۷ι ST3100910280000NNN NNNNNNNN0NNYNNNNN0000007780000100001YNY00NNN000000100N0900000000000000000000002002010101900000000004591200000000000918254320012 0 NN000000244-00000038-00000065-0065-0000004620250930000000357 NNN +069080 KR7069080000 ST2000000000000NNN NNNNNNNN0NNNNNNNY0000161000000100001NNN00NNN000000050Y0900000003597310000000005002003052300000000003460000000000001765544200012 0YNN0000012450000002270000002160016800000000420250930000005570 NNN +069140 KR7069140002÷ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000028500000100001NNN00NNN000000100N0900000002507760000000005002010102600000000001440200000000000720128200012 0 NN0000008760000000950000000730007300000001720250930000000410 NNN +069330 KR7069330009̵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000010970000100001NNN00NNN000000100N0900000000450670000000005002003081800000000001419100000000000709554550012 0 NN0000003750000000060000000040000400000000520250930000000155 NNN +069410 KR7069410009ڽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000054800000100001NNN00NNN000000100N0900000000575130000000005002007062000000000001024400000000000512241200012 0 NN0000004660000000140000000270002300000001120250930000000561 NNN +069510 KR7069510006 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000144500000100001NNN00NNN000000060Y0900000000177240000000005002003111400000000001091000000000000545500000012 0 NN0000035200000003620000003820030700000002020250930000001576 NNN +069540 KR7069540003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000014390000100001NNN00NNN000000100N0900000054105590000000005002004021300000000006099000000000003049507650012 0 NN000000241-00000082-00000104-0100-0000002520250930000000877 NNN +069920 KR7069920007ÿ±׷ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000006880000100001NNN00NNN000000100N0900000006057260000000005002007120500000000004648200000000002324130450012 0 NN000000019-00000034-00000062-006200000000020250630000000319 NNN +070300 KR7070300009ť ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017290000100001NNN00NNN000000100N0900000002592740000000005002010060900000000002330700000000001165353900012 0 NN000000107-00000022-00000154-0163-0000007720241231000000402 NNN +070590 KR7070590005ѼƼť ST3000000000000NNN NNNNNNNN0NNNNNNNN0000019400000100001NNN00NNN000000100N0900000000820290000000005002004010800000000001387900000000000693976050012 0 NN0000005100000000140000000150001200000000820250930000000269924NNN +071200 KR7071200000ǴƮコɾ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000067900000100001NNN00NNN000000100N0900000003290110000000005002010052600000000002439600000000001219822900012 0 NN0000007240000000260000001540014300000002120250930000001656 NNN +071280 KR7071280002üý ST3100910270000NNN NNNNNNNN0NNNNNNNN0000094300000100001NNN00NNN000000060Y0900000002468080000000005002003111400000000001529600000000000764830150012 0 NN0000008340000001200000001260009800000000820250930000001442 NNN +071670 KR7071670004ũַ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000107100000100001NNN00NNN000000100N0900000002391870000000005002009041700000000001000000000000000500000000012 0 NN0000021140000000220000000020000300000000120250930000001071 NNN +071850 KR7071850002ijڸ ST3100910300000NNN NNNNNNNN0NNYNNNNN0000015100000100001NNN00NNN000000100N0900000000088120000000005002014052700000000002426000000000001226459400012 0 NN000001190-00000020-00000035-0038-0000000820250930000000366 NNN +072020 KR7072020001߾ӹ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000095500000100001NNN00NNN000000100N0900000000441560000000005002003103100000000000945800000000000498000000012 0 NN0000004560000000580000000800006900000000720241231000000903 NNN +072470 KR7072470008츮Ȧ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000034050000100001NNN00NNN000000100N0900000000342380000000005002003102800000000001888700000000000944367050012 0 NN0000053250000002740000001920014200000000620250930000000643 NNN +072770 KR7072770001̺ⷹƼ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000008040000100001NNN00NNN000000100N0900000064957610000000005002007072500000000008017700000000004008861150012 0 NN000000579-00000029-00000055-0065-0000002720250930000000644 NNN +072870 KR7072870009ް͵ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000109600000100001NNN00NNN000000060Y0900000000284640000000005002004122100000000001192000000000000596047950012 0 NN0000009900000001750000002860024200000000620250930000001306 NNN +072950 KR7072950009 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000054500000100001NNN00NNN000000100N0900000000442070000000005002012032100000000000805200000000000402630500012 0 NN0000008920000000550000000570005000000001020250930000000438 NNN +072990 KR7072990005ġƼ ST3100600000000 NN N N 0 N N0000060000000100001NNN00NNN000000100N0900000000942680000000005002016101700000000001440600000000000720310300012 0 NN0000008290000001090000000950007300000000920250930000000864 NNN +073010 KR7073010001̿ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000046500000100001NNN00NNN000000100N0900000002926150000000005002004121700000000004019100000000002009562500012 0 NN0000006960000000910000000760006100000000020250930000001868 NNN +073110 KR7073110009 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000052800000100001NNN00NNN000000100N0900000000203200000000005002007101200000000000889500000000000452287750012 0 NN000000506-00000076-00000084-0079-0000001620250930000000469 NNN +073190 KR7073190001 ST3100910310000NNN NNNNNNNN0NNNNNNNN0000016370000100001NNN00NNN000000100N0900000001206790000000005002004020600000000001196800000000000598402000012 0 NN000000231-00000034-00000036-0036-0000002420241231000000195 NNN +073490 KR7073490005̳̾ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000293000000100001NNN00NNN000000060Y0900000002324740000000005002005020400000000000760300000000000380192300012 0 NN000001244-00000089-00000091-0093-0000000220250930000002227142NNN +073540 KR7073540007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000019980000100001NNN00NNN000000100N0900000000296110000000005002007051800000000001140000000000000570000000012 0 NN0000001890000000050000000160001600000000420250930000000227 NNN +073560 KR7073560005츮տ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000016250000100001NNN00NNN000000060Y0900000004702780000000005002016072700000000006923700000000003461882150012 0 NN0000021170000003590000003200026200000000720250930000001125 NNN +073570 KR7073570004Ƭ ST3100910310000NNN NNNNNNNN0NNNNNNNN0000010260000100001NNY00NNN000000100N0900000028832780000000005002004010600000000006018600000000003009332050012 0 NN000000152-00000052-00000964-1022-0000012020241231000000617 NNN +073640 KR7073640005׶̾ ST3100910260000NNN NNNNNNNN0NNYNNNNN0000006540000100001YNY00NNN000000100N0900000000000000000000001002004010600000000010637800000000001063787700012 0 NN000000107-00000081-00000095-0100-0000001720250930000000695 NNN +074430 KR7074430000ƹ̳ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000016010000100001NNN00NNN000000100N0900000010955230000000001002004060400000000008782600000000000878268440012 0 NN0000001550000000210000000360003800000000420250930000001406 NNN +074600 KR7074600008QnC ST2100910250000NNN NNNNNNNN0NNNNNNNY0000278500000100001NNN00NNN000000050Y0900000008300190000000005002003121200000000002628800000000001314400000012 0 NN0000069460000004120000001340006400000000620250930000007321140NNY +075130 KR7075130005÷Ƽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000023900000100001NNN00NNN000000100N0900000000449250000000005002005061000000000001662200000000000831116000012 0 NN0000003600000000340000000420003500000000420250930000000397 NNN +075970 KR7075970004˾ؿ ST3100910250000NNN NNNNNNNN0NNNNNNNN0000022300000100001NNN00NNN000000100N0900000001241190000000010002004021300000000001840000000000001840000000012 0 NN0000008470000000320000000150001000000000320250930000000410 NNN +076080 KR7076080001ũ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000015440000100001NNN00NNN000000100N0900000101100330000000005002008071800000000002259400000000001129707800012 0 NN000001292-00000095-00000129-0123-0000000620250930000000348 NNN +076610 KR7076610005ؼƽ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000016690000100001NNN02NNN000000100N0900000244992340000000005002013110600000000004836700000000002418387400012 0 NN000001054-00000074-00000152-0151-0000015720250930000000807 NNN +077360 KR7077360006̸Ż ST3100910280000NNN NNNNNNNN0NNNNNNNN0000078900000100001NNN00NNN000000050Y0900000022116970000000002002005101400000000004543700000000000908740040012 0 NN0000016300000000280000000570004400000000320250930000003584 NNN +078020 KR7078020005LS ST2101400000000NNN NNNNNNNN0NNNNNNNN0000053600000100001NNN00NNN000000060Y0900000002723850000000050002007022100000000005548100000000027740595000012 0 NN0000133880000004250000004920037100000000320250930000002973FN2NNN +078070 KR7078070000Ȧ ST3101400000000NNN NNNNNNNN0NNNNNNNN0000107800000100001NNN00NNN000000060Y0900000000276410000000005002009012300000000001760400000000001034831400012 0 NN0000011210000002050000002950023200000000620250930000001897 NNN +078130 KR7078130002 ST1100910210000NNN NNNNNNNN0NNNNNNNN0000003550000100001NNN00NNN000000100N0900000019871650000000001002004102200000000112740500000000011274058710012 0 NN00000052800000000100000000000016-0000000520250930000004002LB8NNN +078140 KR7078140001 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000120600000100001NNN00NNN000000060Y0900000000450200000000005002005122300000000001108600000000000554328950012 0 NN0000007720000000670000001570013100000000720250930000001337 NNN +078150 KR7078150000HBũ ST3100910270000NNY NNYNNNNN0NNNNNNNN0000021350000100001NNN00NNN000000060Y0900000019911220000000005002004120800000000009271500000000004635795800012 0 NN000001085-0000003200000025300249-0000000120250930000001979 NNN +078160 KR7078160009޵Ʈ ST2100910240000NNY NNNYNNNN1NNNNNNNN0000239000000100001NNN01YNN000000100N0900000015598940000000005002005072900000000003920400000000001960230150012 0 NN000000557-00000467-00000585-0580-0000003520250930000009369 NNN +078340 KR7078340007 ST2000000000000NNN NNNNNNNN0NNNNNNNY0000375500000100001NNN00NNN000000100N0900000001653450000000005002007070600000000001209100000000000643321000012 0 NN000005140-00000166-00000041-0097-0000001220250930000004540 NNN +078350 KR7078350006Ѿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000280000000100001NNN00NNN000000050Y0900000006270110000000005002004051400000000001524400000000000762219100012 0 NN0000048310000001440000001120008900000001120250930000004268 NNY +078590 KR7078590007޸ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000010000000100001NNN02NNN000000100N0900000097558290000000005002005102700000000008025500000000004012763950012 0 NN0000007030000000400000000400004600000001020241231000000802 NNN +078600 KR7078600004 ST1100910280000NNY NNNNNNNN0NNNNNNNY0000787000000100001NNN00NNN000000060Y0900000004719030000000005002004121000000000001548000000000000774029650012 0 NY0000018100000001610000001990017600000001820250930000012183 NNN +078860 KR7078860004 ST3101500000000NNN NNNNNNNN0NNYNNNNN0000010060000100001NNN00NNN000000100N0900000001955250000000001002006062700000000005936200000000000593622570012 0 NN000000095-00000051-00000061-0064-0000002320250930000000597 NNN +078890 KR7078890001±׷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000068300000100001NNN00NNN000000100N0900000013444530000000005002005071200000000001804600000000000902343600012 0 NN000003763000000040-00000078-0008-0000001620250930000001232 NNN +079000 KR7079000006佺ڸ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000067800000100001NNN00NNN000000100N0900000000078770000000005002005111500000000000720000000000000360000000012 0 NN000000175-000000020000000250002100000000320241231000000488 NNN +079170 KR7079170007â ST3100910260000NNN NNNNNNNN0NNNNNNNN0000064400000100001NNN00NNN000000100N0900000000135760000000005002005020100000000000520000000000000260000000012 0 NN0000009460000000880000000850006800000001120241231000000334 NNN +079190 KR7079190005ɽǿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005000000100001NNN00NNN000000100N0900000002263110000000005002005112900000000003835500000000001917775700012 0 NN000000313-00000027-00000018-0013-0000001020250930000000191 NNN +079370 KR7079370003콺 ST2100910270000NNN NNNNNNNN1NNNNNNNY0000204500000100001NNN00NNN000000060Y0900000027508740000000005002006020100000000003101600000000001553099500012 0 NN000002845-00000022-00000055-013900000000420250930000006342 NNY +079650 KR7079650008 ST3100910250000NNN NNNNNNNN0NNNNNNNN0000013580000100001NNN00NNN000000100N0900000000185970000000001002005012100000000002000000000000000200000000012 0 NN000000323-00000030-00000028-0030-0000000420250930000000271 NNN +079810 KR7079810008̿Ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000056400000100001NNN00NNN000000060Y0900000003106120000000005002005012600000000002152800000000001101404700012 0 NN000000491000000023-00000004-000400000000820250930000001214 NNN +079940 KR7079940003 ST2000000000000NNN NNNNNNNN0NNNNNNNN0000344000000100001NNN00NNN000000060Y0900000000252840000000005002005101900000000001342000000000000676784200012 0 NN0000023820000002140000001850014600000000820250930000004616 NNN +079950 KR7079950002κϾ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000035300000100001NNN02NNN000000100N0900000002567230000000005002005020400000000000580000000000000290000000012 0 NN000000065-00000064-00000096-0096-0000005220250930000000204 NNN +079960 KR7079960001̿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000291500000100001NNN00NNN000000060Y0900000000631920000000005002005020100000000000786000000000000393000000012 0 NN0000046990000004570000004560039000000001820250930000002291 NNN +079970 KR7079970000Ʈ ST3000000000000NNN NNNNNNNN0NNYNNNNN0000005960000100001YNY00NNN000000100N0900000000000000000000005002010060100000000001282900000000000641461700012 0 NN000000198-00000004-00000001-0001-0000003620250930000000076 NNN +080010 KR7080010002̻Ʈ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000070600000100001NNN00NNN000000100N0900000000064860000000005002005093000000000000983500000000000500000000012 0 NN0000007640000001980000002210017900000001320250930000000694 NNN +080160 KR7080160005 ST2100600000000NNN NNNNNNNN0NNNNNNNN0000108500000100001NNN00NNN000000100N0900000001017790000000005002005072600000000001890000000000000945000000012 0 NN0000014260000000720000000890012000000002420250930000002050 NNN +080220 KR7080220007ֹݵü ST2100910280000NNN NNNNNNNN0NNNNNNNY0000365000000100001NNN00NNN000000060Y0900000128039210000000005002005020100000000003444200000000001737141650012 0 NN0000021050000002190000002130024400000001920250930000012571 NNY +080420 KR7080420003̳Ĩ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000020200000100001NNN00NNN000000100N0900000000440010000000005002005120600000000007972100000000003986081100012 0 NN000002640000000165-00000009-0033-0000000120250930000001610 NNN +080470 KR7080470008â ST3100910300000NNN NNNNNNNN0NNNNNNNN0000043200000100001NNN00NNN000000100N0900000000420630000000005002006110300000000000730000000000000365000000012 0 NN0000018620000001030000001090008900000001620250930000000315 NNN +080520 KR7080520000 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000030900000100001NNN00NNN000000100N0900000000159660000000005002007100800000000001132200000000000587330450012 0 NN000000281-0000002400000000700000-0000000620250930000000349 NNN +080530 KR7080530009ڵ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000010350000100001NNN00NNN000000100N0900000000731750000000005002010010500000000005551000000000002775543750012 0 NN0000006200000000430000000370003300000000520250930000000574 NNN +080580 KR7080580004Ų ST3100910280000NNN NNNNNNNN0NNNNNNNN0000138300000100001NNN00NNN000000060Y0900000041199660000000005002014122400000000002058100000000001029058800012 0 NN0000006930000000850000000540004000000000220250930000002846 NNN +080720 KR7080720006ѱϿ ST3100910240000 NN N N 0 Y N0000027250000100001YNY00NNN000000100N0900000000000000000000005002018072600000000000791200000000000395641400012 0 NN000000299-00000146-00000177-0177-3610000020250930000000215 NNN +081150 KR7081150005Ƽ÷ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000030650000100001NNN00NNN000000100N0900000002296110000000005002009042300000000002426800000000001213420100012 0 NN0000020750000000480000000190001400000000120241231000000743 NNN +081180 KR7081180002ũ ST3100910270000 NN N N 0 N N0000149300000100001NNN00NNN000000100N0900000003083400000000005002025042800000000000882500000000000441276750012 0 NN000000365-00000041-00000045-0045-0000001520250930000001317 NNN +081580 KR7081580003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000023800000100001NNN00NNN000000100N0900000002214850000000005002007101200000000001550800000000000775407150012 0 NN0000013520000000290000000530004800000000420250930000000369 NNN +082210 KR7082210006Ʈ ST3100910290000NNN NNNNNNNN0NNYNNNNN0000019510000100001NNN00NNN000000100N0900000001490400000000005002005062400000000003319200000000001659618700012 0 NN000001371000000023-00000044-003700000005720250930000000647 NNN +082270 KR7082270000齺 ST1100910270000NNY NNYNNNNN0NNNNNNNY0000416000000100001NNN01YNN000000100N0900000012054810000000005002005062400000000004268000000000002134019450012 0 NY000000554-00000037-00000131-0130-0000009520250930000017755 NNN +082660 KR7082660002ڽ ST3100910230000NNN NNNNNNNN0NNYNNNNN0000004800000100001YNY00NNN000000100N0900000000000000000000005002005100500000000009964000000000004982043450012 0 NN000000049-00000055-00000174-0174-0000013920250930000000478 NNN +082800 KR7082800004 ST2100910240000NNN NNNNNNNN0NNNNNNNN0000054400000100001NNN00NNN000000100N0900000015568580000000025002005111800000000005010400000000012526166500012 0 NN000000431-00000154-00000195-0196-0000002920250930000002725 NNN +082850 KR7082850009츮̿ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000020650000100001NNN00NNN000000100N0900000004959730000000005002005072900000000004845600000000002422828900012 0 NN000007932000000008-00000048-0081-0000000720250930000001000 NNN +082920 KR7082920000μ ST1100910280000NNN NNNNNNNN0NNNNNNNN0000213500000100001NNN00NNN000000050Y0900000002109430000000005002009102800000000004533900000000002266973850012 0 NN0000016580000004790000005000039000000002020250930000009679 NNY +083310 KR7083310003ƼŨ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000134800000100001NNN00NNN000000060Y0900000003267360000000005002005100500000000001781000000000000890501650012 0 NN000001774-00000049-00000031-0055-0000000320250930000002400 NNY +083450 KR7083450007GST ST2100910270000NNN NNNNNNNN0NNNNNNNN0000303000000100001NNN00NNN000000060Y0900000009168260000000005002006020100000000001843000000000000930913000012 0 NN0000025500000004360000004220032700000001620250930000005584 NNY +083470 KR7083470005̿ؾ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000007980000100001NNN00NNN000000100N0900000001168790000000005002008091800000000002134000000000001067016450012 0 NN0000002970000000030000000180001500000001020241231000000170 NNN +083500 KR7083500009ũ ST3100910270000 NN N N 0 N N0000157300000100001NNN00NNN000000100N0900000002462800000000005002017022700000000000857500000000000428786100012 0 NN0000006010000000890000000910008200000001720250930000001348 NNN +083550 KR7083550004̿ ST3100910200000NNN NNNNNNNN0NNNNNNNN0000036500000100001NNN00NNN000000100N0900000000818240000000005002005122000000000001295000000000000647544350012 0 NN0000009920000000020000000250001900000000120250930000000472 NNN +083640 KR7083640003 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000002780000100001NNN00NNN000000100N0900000009788280000000001002005122700000000007772000000000000777203510012 0 NN000000491000000016-00000029-0029-0000000420241231000000216 NNN +083650 KR7083650002ġ ST1100910270000NNY NNNNNNNN0NNNNNNNY0000727000000100001NNN00NNN000000060Y0900000011104170000000005002005120200000000003094400000000001547218750012 0 NY0000050930000005120000006310050200000004520250930000022496 NNY +083660 KR7083660001CSA ڽ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000005100000100001NNN00NNN000000100N0900000012625030000000002002006072500000000006282900000000001256589180012 0 NN000000221-00000034-00000037-0037-0000004620250930000000320 NNN +083790 KR7083790006CGι ST3100600000000NNY NNNYNNNN0NNNNNNNN0000013000000100001NNN00NNN000000100N0900000003581910000000005002006010600000000007689400000000003844709100012 0 NN000000154-00000200-00000318-0298-0000005420250930000000999 NNN +083930 KR7083930008ƹ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000147400000100001NNN00NNN000000050Y0900000001833470000000005002005101100000000001467700000000000799825250012 0 NN0000023600000002300000001910014800000001620250930000002163 NNY +084110 KR7084110006޿½۷ι ST2100910240000NNY NNNYNNNN0NNNNNNNN0000513000000100001NNN00NNN000000050Y0900000000289030000000005002006121900000000001265900000000000632990600012 0 NN0000062290000007120000008960066400000000520250930000006494 NNY +084180 KR7084180009 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000027850000100001NNN00NNN000000100N0900000001370380000000050002005121600000000001807400000000009037141500012 0 NN00000093000000009200000004900025-0000000820250930000000503 NNN +084370 KR7084370006ũ ST1100910270000NNY NNYNNNNN0NNNNNNNY0001022000000100001NNN00NNN000000050Y0900000008044270000000005002006011700000000002291600000000001145802100012 0 NY0000025040000003410000003270027600000001520250930000023420 NNY +084440 KR7084440007 ST3000000000000 NN N N 0 N N0000010650000100001NNN00NNN000000100N0900000000616440000000001002022111800000000001971200000000000197128000009 0 NN0000003370000000140000000140001300000000020250930000000209 NNN +084650 KR7084650001ͽ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000018010000100001NNN00NNN000000100N0900000027832080000000005002014121600000000007423900000000003717977300012 0 NN000000672-00000280-00000275-0235-0000001820250930000001337 NNN +084730 KR7084730001ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000099900000100001NNN00NNN000000100N0900000001621070000000005002006051900000000001110900000000000555471200012 0 NN00000412900000013000000008100033-0000000120250930000001109 NNN +084850 KR7084850007Ƽݵü ST2100910280000 NN N N 0 N N0000101900000100001NNN00NNN000000100N0900000001313780000000005002019110700000000002268200000000001157270000012 0 NN000004362-00000052-00000239-0245-0000000720250930000002311 NNN +084990 KR7084990001︯̽ ST3100600000000NNY NNNYNNNN0NNNNNNNN0000058400000100001NNN00NNN000000100N0900000004546550000000005002005122900000000004609200000000002304639850012 0 NN000000021-00000075-00000033-0033-0000000420250930000002691 NNN +085660 KR7085660009̿ ST1100910240000NNY NNNYNNNN0NNNNNNNY0000201500000100001NNN00NNN000000100N0900000017851500000000005002005122700000000007947100000000003973561550012 0YNY000009217-00000413-00001100-1114-0000003420250930000016013 NNN +085670 KR7085670008 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000067200000100001NNN00NNN000000060Y0900000007460460000000005002006011700000000002445000000000001222538050012 0 NN0000011460000000600000000480004900000000920250930000001643 NNY +085810 KR7085810000ƼijƮ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000006010000100001NNN00NNN000000100N0900000001438280000000005002013120600000000006228600000000003151915850012 0 NN00000036800000002800000004100037-0000000020250930000000374 NNN +085910 KR7085910008׿Ƽ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000120500000100001NNN00NNN000000100N0900000002568110000000005002007100100000000001393400000000000696740900012 0 NN0000005100000000560000000480003900000000720250930000001679 NNN +086040 KR7086040003̿彺 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000027150000100001NNN00NNN000000100N0900000000407510000000005002007092100000000001595800000000000797912350012 0 NN000000328-000000470000000210000400000000220250930000000433 NNN +086060 KR7086060001̿ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000043250000100001NNN00NNN000000100N0900000000562750000000005002006042800000000000861000000000000430529350012 0 NN0000007030000000300000000360003000000000720250930000000372 NNN +086390 KR7086390002׽Ʈ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000143500000100001NNN00NNN000000100N0900000002569740000000005002006120500000000002113400000000001056706300012 0 NN000000829-00000088-00000108-0107-0000001920250930000003032 NNN +086450 KR7086450004 ST1100910240000NNY NNNYNNNN0NNNNNNNY0000184400000100001NNN00NNN000000050Y0900000005065630000000005002007052900000000004523000000000002261521000012 0 NN0000068400000007230000007480058400000001020250930000008340 NNY +086520 KR7086520004 ST1101400000000NNY YNNNNNNN0NNNNNNNY0001686000000100001NNN01YNN000000100N0900000169025920000000001002007072000000000013577600000000001357761520012 0 NY00002697900000167000000063301252-0000000120250930000228918LD2NNN +086670 KR7086670007Ƽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000122700000100001NNN00NNN000000060Y0900000000491660000000005002007110200000000000992500000000000496294250012 0 NN0000011330000001200000002000017200000001620250930000001217 NNN +086710 KR7086710001Ƽ̾ ST3100910230000 NN N N 0 N N0000095800000100001NNN00NNN000000060Y0900000000570760000000005002021012700000000001220300000000000610164000012 0 NN0000006300000000650000000610006700000001020250930000001169 NNN +086820 KR7086820008ַ̿ ST3100910240000 NN N N 0 N N0000079800000100001NNN00NNN000000100N0900000001417780000000005002018082000000000002429200000000001214612600012 0 NN000000108-00000039-00000052-005200000000020250930000001938 NNN +086890 KR7086890001̼ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000060400000100001NNN00NNN000000100N0900000003838700000000005002009020300000000004055400000000002027739300012 0 NN000000603000000134-000000560014700000001720241231000002449 NNN +086900 KR7086900008޵彺 ST1100910240000NNY NNNYNNNN0NNNNNNNY0001380000000100001NNN00NNN000000050Y0900000001634280000000005002009011600000000000729800000000000364924850012 0 NY0000018660000002070000002060018700000000520250930000010071 NNN +086960 KR7086960002MDSũ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000015340000100001NNN00NNN000000060Y0900000784624560000000002002006092600000000010165800000000002106208820012 0 NN0000013630000000580000000690002500000000420250930000001559 NNY +086980 KR7086980000ڽ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000025600000100001NNN00NNN000000100N0900000003447290000000005002006070700000000006263800000000003131900000012 0 NN000000479-00000081-00000097-0094-0000000720250930000001603 NNN +087010 KR7087010005Ʈ ST1100910240000NNY YNNYNNNN0NNNNNNNY0003165000000100001NNN00NNN000000100N0900000005583760000000005002015072200000000002331700000000001165867500012 0 NY000000032-00000165-00000216-0220-0000002320241231000073799 NNN +087260 KR7087260006Ͼö̾ ST3000000000000 NN N N 0 N N0000020900000100001NNN00NNN000000100N0900000010882990000000005002017022400000000003255200000000001627643050012 0 NN000000274-000000030000000040002000000000920250930000000680 NNN +087600 KR7087600003ȼ÷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000075500000100001NNN00NNN000000100N0900000000734890000000005002015061200000000000816600000000000408327900012 0 NN0000005350000000080000000360003500000000420241231000000616 NNN +088130 KR7088130000ƿ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000039850000100001NNN00NNN000000100N0900000001504480000000005002007010300000000001748500000000000994647650012 0 NN00000343400000058400000066800618-0000000220250930000000696 NNN +088280 KR7088280003н ST3100910280000 NN N N 0 N N0000017910000100001NNN00NNN000000100N0900000000681770000000010002023110700000000001730600000000001730649000012 0 NN000000170-00000045-00000022-0022-0000000520241231000000309 NNN +088290 KR7088290002̿ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000007660000100001NNN00NNN000000100N0900000001512250000000005002009120100000000003988000000000001994018200012 0 NN000000525000000025-00000210-0210-0000006020241231000000305 NNN +088340 KR7088340005Ŭ ST3000000000000 NN N N 0 N N0000150400000100001NNN00NNN000000100N0900000000870860000000005002024081600000000000436400000000000218218400012 0 NN000000359-00000035-00000034-0034-0000001020250930000000656 NNN +088390 KR7088390000̳콺 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000102200000100001NNN00NNN000000100N0900000000726610000000005002006102000000000000938500000000000469292200012 0 NN00000048400000008500000009500082-0000000720250930000000959 NNN +088800 KR7088800008̽ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000030800000100001NNN00NNN000000100N0900000003262180000000005002006032700000000007550600000000003775321700012 0 NN000001370-00000111-00000194-0197-0000006220250930000002325 NNN +088910 KR7088910005̺ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000020850000100001NNN00NNN000000100N0900000000401880000000005002006062300000000002583100000000001291588200012 0 NN0000024490000000850000002390020500000000420250930000000538 NNN +089010 KR7089010003Ʈδн ST2100910230000NNN NNNNNNNN0NNNNNNNN0000362000000100001NNN00NNN000000060Y0900000006575210000000005002007011700000000001633900000000000816966150012 0 NN0000047590000002130000001860015400000000720250930000005914 NNY +089030 KR7089030001ũ ST1100910270000NNY NNYNNNNN0NNNNNNNY0000441500000100001NNN00NNN000000060Y0900000015900700000000005002011111000000000003705300000000001897772150012 0 NY00000125200000015300000018100134-0000000620250930000016359 NNY +089140 KR7089140008ؽϾطڸ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000026000000100001NNN00NNN000000100N0900000002648360000000025002006110100000000001491600000000003729058500012 0 NN00000048700000004300000016300155-0000000120250930000000387 NNN +089150 KR7089150007̾Ƽ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000028700000100001NNN00NNN000000100N0900000001646270000000005002006121300000000001715000000000000857500000012 0 NN0000001170000000160000000100000900000000320241231000000492 NNN +089230 KR7089230007THE E&M ST3000000000000NNN NNNNNNNN0NNNNNNNN0000012060000100001NNN00NNN000000100N0900000001308840000000010002006101000000000003051200000000003051295300012 0 NN000000134-00000057-00000115-0115-0000006020250930000000367 NNN +089600 KR7089600001KT̵ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000121300000100001NNN00NNN000000060Y0900000000302380000000005002013071700000000001156800000000000596443900012 0 NN00000023500000002400000003700030-0000000320250331000001403905NNN +089790 KR7089790000Ƽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000049350000100001NNN00NNN000000100N0900000001892450000000005002006102700000000001031500000000000515775650012 0 NN000000262-00000022-00000015-001500000000420250930000000509 NNN +089850 KR7089850002񺧷Ͻ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000054700000100001NNN00NNN000000100N0900000000773490000000005002010061800000000001473000000000000736509950012 0 NN0000051090000001710000000950004300000000520250930000000805 NNN +089890 KR7089890008ڼ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000284500000100001NNN00NNN000000060Y0900000004517060000000005002006110800000000001658400000000000842598100012 0 NN0000005810000001440000001330011000000001920250930000004718 NNN +089970 KR7089970008̿ ST2100910270000 NN N N 0 N N0000293500000100001NNN00NNN000000050Y0900000012462420000000001002018082300000000002441100000000000244116950012 0 NN0000009360000001530000001500015000000001220250930000007164 NNN +089980 KR7089980007ũ ST2100910230000NNN NNNNNNNN0NNNNNNNN0000164600000100001NNN00NNN000000060Y0900000000455790000000005002011072100000000001598900000000000799451850012 0 NN0000013540000000480000000390003700000000620250930000002631 NNY +090150 KR7090150004 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000007460000100001NNN00NNN000000100N0900000002250520000000005002006102000000000004187500000000002093764650012 0 NN00000088800000006400000004800037-0000000620250930000000312 NNN +090360 KR7090360009κŸ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000891000000100001NNN00NNN000000100N0900000006662460000000005002011101700000000000975000000000000487500000012 0 NN000000511-00000043-00000041-0041-0000000220250930000008687282NNN +090410 KR7090410002Ǿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000012220000100001NNN00NNN000000100N0900000002531790000000001002014080100000000004608400000000000460840950012 0 NN00000079100000000700000000900002-0000000120250930000000563 NNN +090470 KR7090470006̽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000052600000100001NNN00NNN000000100N0900000001435720000000005002007011000000000001747600000000000873829700012 0 NN000000109-00000180-00000183-0198-0000001220250930000000919 NNN +090710 KR7090710005޸κ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000157700000100001NNN03NNN000000100N0900000334269500000000005002006120500000000011945700000000005972859850012 0 NN000001437-00000015-00000048-004900000000220250930000018838365NNN +090850 KR7090850009 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000051400000100001NNN00NNN000000100N0900000001565210000000005002013122700000000002374600000000001187318050012 0 NN0000010620000001990000002250020100000001620250930000001220Z35NNN +091120 KR7091120006̿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000084500000100001NNN00NNN000000100N0900000000977860000000005002007050200000000001713200000000000865296800012 0 NN000001587-00000098-00000110-0079-0000001820250930000001447 NNN +091340 KR7091340000S&K ST3100910280000NNN NNNNNNNN0NNNNNNNN0000023350000100001NNN00NNN000000100N0900000000580600000000005002007073000000000001170300000000000585186050012 0 NN0000022460000000970000000700007200000000320250930000000273 NNN +091440 KR7091440008ѿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000028800000100001NNN00NNN000000100N0900000001268210000000005002008020100000000003084300000000001542172250012 0 NN000000075-00000166-00000226-0227-0000006420250930000000888 NNN +091580 KR7091580001̵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000150000000100001NNN00NNN000000060Y0900000003593480000000005002007052300000000001332800000000000692910950012 0 NN000001795000000029-00000025-0027-0000000220250930000001999 NNY +091590 KR7091590000ȭ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000036900000100001NNN00NNN000000100N0900000000231750000000005002012013100000000001174000000000000587000000012 0 NN0000004940000000100000000330002400000000220250930000000433 NNN +091700 KR7091700005Ʈ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000072000000100001NNN00NNN000000050Y0900000002935560000000005002006121300000000005500000000000002945910700012 0 NN0000101090000002920000002660019900000000720250930000003960 NNY +091970 KR7091970004ķ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000005750000100001NNN00NNN000000100N0900000001883800000000005002007013000000000003767300000000001883695150012 0 NN000000296-00000013-00000033-0033-0000002820250930000000216 NNN +092040 KR7092040005ƹ ST2100910190000NNY NNNYNNNN0NNNNNNNN0000017030000100001NNN00NNN000000100N0900000008404430000000005002013091200000000005573000000000002786500650012 0 NN000000311-00000132-00000250-0248-0000004720250930000000949 NNN +092070 KR7092070002𿣿 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000178800000100001NNN00NNN000000100N0900000001061990000000005002007111600000000001157100000000000578592900012 0 NN000000739-00000010-000000090000600000000020241231000002069 NNN +092130 KR7092130004ũ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000156800000100001NNN00NNN000000060Y0900000000131730000000005002008102400000000001204300000000000614680000012 0 NN0000003950000001410000001500011600000002920250930000001888 NNN +092190 KR7092190008̿ý ST3100910280000 NN N N 0 N N0000027600000100001NNN00NNN000000100N0900000000829680000000005002020030600000000004586800000000002293419150012 0 NN000005435-00000148-00000258-0251-0000014320250930000001265 NNN +092300 KR7092300003 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000036650000100001NNN00NNN000000100N0900000041960840000000005002007102400000000001898700000000000949354150012 0 NN0000017650000000890000000790006600000000820250930000000695 NNN +092460 KR7092460005ѶIMS ST3100910300000NNN NNNNNNNN0NNNNNNNN0000162500000100001NNN00NNN000000060Y0900000001153430000000005002007052200000000001710900000000000880873350012 0 NN0000009390000001670000002440020000000001320250930000002780 NNY +092600 KR7092600006ؾ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005610000100001NNY00NNN000000100N0900000001164590000000005002007062600000000002508300000000001254175850012 0 NN000000754-00000163-00000216-0216-0000009420250930000000140 NNN +092730 KR7092730001׿ ST2100910230000NNN NNNNNNNN0NNNNNNNN0000189500000100001NNN00NNN000000060Y0900000000853840000000005002007013000000000001602700000000000801399450012 0 NN0000009580000002160000002380021100000001520250930000003037 NNN +092870 KR7092870005 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000229500000100001NNN00NNN000000060Y0900000010401500000000005002015102200000000001305000000000000652539850012 0 NN000000209-00000106-00000074-0040-0000000220250930000002995 NNN +093190 KR7093190007ַ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000061100000100001NNN00NNN000000100N0900000000043690000000005002007082000000000001923800000000000961945250012 0 NN0000008710000000590000001140008600000000920250930000001175 NNN +093320 KR7093320000̾̿ ST2000000000000NNN NNNNNNNN0NNNNNNNN0001380000000100001NNN00NNN000000050Y0900000000147740000000005002011020800000000000488000000000000244000000012 0 NN0000011800000001700000001540012200000000920250930000006734 NNN +093380 KR7093380004dz ST3100910260000NNN NNNNNNNN0NNNNNNNN0000028050000100001NNN00NNN000000100N0900000000086690000000005002007060100000000000987900000000000493965650008 0 NN0000002100000000030000000130001200000000320251130000000277 NNN +093520 KR7093520005Ŀ ST2101100000000NNN NNNNNNNN0NNNNNNNN0000217000000100001NNN00NNN000000060Y0900000000585930000000005002007021200000000001416300000000000808154600012 0 NN0000018120000002290000002330018200000002320250930000003073 NNY +093640 KR7093640001̾˿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000038100000100001NNN00NNN000000100N0900000000713810000000005002007101900000000003262300000000001631192550012 0 NN000000063-00000083-00000074-0075-0000002020250930000001242 NNN +093920 KR7093920007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000051600000100001NNN00NNN000000100N0900000001424240000000005002007122000000000001860000000000000930000000012 0 NN0000015700000000630000000850006100000000720250930000000959 NNN +094170 KR7094170008Ƴ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000279000000100001NNN00NNN000000050Y0900000002053210000000005002015063000000000002090900000000001065115100012 0 NN0000013830000001750000002610024700000003720241231000005833 NNY +094360 KR7094360005Ĩع̵ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000188400000100001NNN00NNN000000060Y0900000003173160000000005002015080500000000002127900000000001078313700012 0 NN0000001860000000310000000280002300000001220250930000004009 NNN +094480 KR7094480001þƸӴƮ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000103000000100001NNN00NNN000000060Y0900000009988610000000005002007072000000000003922900000000001961491900012 0 NN0000009640000001430000001040008100000000420250930000004040971NNN +094820 KR7094820008Ŀ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000157600000100001NNN00NNN000000060Y0900000007199270000000005002007110600000000001507800000000000753935450012 0 NN0000018160000001600000001460012000000000720250930000002376 NNN +094840 KR7094840006ġť ST3100910280000NNN NNNNNNNN0NNNNNNNN0000069300000100001NNN00NNN000000100N0900000002567970000000005002008071100000000001047100000000000523592000012 0 NN0000001580000000280000001020010500000000820250930000000725 NNN +094850 KR7094850005 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000057800000100001NNN00NNN000000100N0900000001038270000000005002007043000000000001400000000000000700000000012 0 NN0000008080000000200000000370003100000000420241231000000809 NNN +094860 KR7094860004׿ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000011550000100001NNN00NNN000000100N0900000010955960000000005002007041600000000002511000000000001255500700012 0 NN000000232-00000044-00000052-0052-0000002220250930000000290 NNN +094940 KR7094940004Ǫ ST3100910280000NNN NNNNNNNN1NNNNNNNN0000109800000100001NNN00NNN000000100N0900000006512180000000005002007091400000000000836100000000000418069300012 0 NN000000150-00000014-00000006-0006-0000000020250930000000918 NNN +094970 KR7094970001̿Ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000026450000100001NNN00NNN000000100N0900000001251120000000005002007101200000000001674800000000000837412000012 0 NN0000013800000000710000000990009300000000520250930000000442 NNN +095190 KR7095190005̿ڸ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000024900000100001NNN00NNN000000100N0900000003519730000000005002007102900000000006526000000000003263023100012 0 NN000001208000000022-00000043-0046-0000000520241231000001624 NNN +095270 KR7095270005̺ϷƮ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000046500000100001NNN00NNN000000100N0900000000938670000000005002007091200000000001437200000000000748562800012 0 NN000000559-00000019-00000015-0011-0000001220250930000000668 NNN +095340 KR7095340006ISC ST1101100000000NNY NNYNNNNN0NNNNNNNY0001316000000100001NNN00NNN000000050Y0900000004794770000000005002007100100000000002119700000000001059852900012 0 NY0000014790000003810000004260034600000000920250930000027895535NNY +095500 KR7095500005̷ ST2100910230000NNN NNNNNNNN0NNNNNNNN0000126100000100001NNN00NNN000000060Y0900000010779750000000005002007100100000000003100900000000001550499950012 0 NN0000041780000002180000001440008800000000720250930000003910 NNY +095610 KR7095610002׽ ST2100910270000NNY NNYNNNNN0NNNNNNNY0000668000000100001NNN00NNN000000050Y0900000017512980000000005002008052000000000001976800000000000988411300012 0 NN0000023410000004510000005090046900000002020250930000013205 NNY +095660 KR7095660007׿ ST2000000000000NNN NNNNNNNN0NNNNNNNY0000297000000100001NNN00NNN000000050Y0900000003172710000000005002007070200000000002185600000000001101685950012 0 NN0000032650000005530000005930043900000000420250930000006491 NNY +095700 KR7095700001ؽ ST2100600000000NNY NNNYNNNN0NNNNNNNN0000051300000100001NNN00NNN000000100N0900000004844550000000005002009091500000000004554000000000002277024700012 0 NN000000029-00000372-00000654-0637-0000002320241231000002336 NNN +095910 KR7095910006 ST3100910280000NNN NNNNNNNN1NNNNNNNN0000013480000100001NNN00NNN000000100N0900000011683400000000005002007101600000000002290200000000001145141050012 0 NN000000743-00000103-00000136-0136-0000005620250930000000308 NNN +096240 KR7096240007ũ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000119600000100001NNN00NNN000000100N0900000000407950000000005002008062700000000001113800000000000576950250012 0 NN0000017090000000460000001530010100000003220250930000001332 NNN +096250 KR7096250006 ST3000000000000 NN N N 0 N N0000121200000100001NNN00NNN000000060Y0900000001571250000000005002025012400000000001309600000000000654826800012 0YNN000000224-00000020-00000006-000400000000820250930000001587 NNN +096350 KR7096350004âַ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000022500000100001NNN00NNN000000100N0900000003853470000000005002007121700000000003685400000000001842738100012 0 NN000000421-00000003-00000070-0070-0000003120250930000000829 NNN +096530 KR7096530001 ST1100910240000NNY NNNYNNNN0NNNNNNNY0000275000000100001NNN00NNN000000050Y0900000005659260000000005002010091000000000005222500000000002611299700012 0 NY00000343600000027600000041200435-0000000020250930000014362 NNY +096610 KR7096610001˿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000029650000100001YNY00NNN000000100N0900000000000000000000005002007112000000000001738600000000000869320550012 0 NN0000001830000000330000000340003400000001920250930000000515 NNN +096630 KR7096630009ڳ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000007120000100001NNN00NNN000000100N0900000004990110000000002002007122600000000007938100000000001587632320012 0 NN0000021380000000910000001640013800000000720250930000000565 NNN +096690 KR7096690003̷Ʈ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000017240000100001NNN00NNN000000100N0900000000674590000000025002010120100000000002413700000000006034263250012 0 NN000000362-00000062-00000137-0134-0000002420250930000000416 NNN +096870 KR7096870001Ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000023950000100001NNN00NNN000000100N0900000000706160000000005002008050200000000000834700000000000417399950012 0 NN000000100-00000008-00000003-0003-0000000220241231000000199 NNN +097780 KR7097780001ںƮ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000008350000100001NNN00NNN000000100N0900000001234650000000010002008012300000000006773000000000007078460700012 0 NN000001700-00000054-00000142-0138-0000000920250930000000565 NNN +097800 KR7097800007 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005350000100001NNN00NNN000000100N0900000008146100000000005002013030700000000013645000000000006822511450012 0 NN000000741-00000233-00000303-0300-0000005320241231000000730 NNN +097870 KR7097870000ȿغ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000059200000100001NNN00NNN000000100N0900000000297410000000005002008040800000000000849000000000000424500000006 0 NN000000030-000000030000000000000000000000420250930000000502 NNN +098070 KR7098070006 ST2100910270000 NN N N 0 N N0000368000000100001NNN00NNN000000060Y0900000000741920000000050002025032000000000001112100000000005560570500012 0 NN0000012410000002910000002730026400000002820250930000004092 NNY +098120 KR7098120009ũؼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000214000000100001NNN00NNN000000060Y0900000004755030000000005002008092300000000000831200000000000415638300012 0 NN0000007310000001260000001210010600000002320250930000001778 NNY +098460 KR7098460009 ST1100910270000NNY NNYNNNNN0NNNNNNNY0000338500000100001NNN00NNN000000050Y0900000073956750000000001002008060300000000006865400000000000686547550012 0 NY0000016350000001040000000900007000000000620250930000023239 NNY +098660 KR7098660004Ƽ ST3100910200000NNN NNNNNNNN0NNNNNNNN0000017300000100001NNN00NNN000000100N0900000000527230000000005002009041700000000001250000000000000625048800012 0 NN000000492-00000025-00000038-0036-0000001120250930000000216 NNN +099190 KR7099190001̼ ST2100910290000NNY NNNYNNNN0NNNNNNNN0000159400000100001NNN00NNN000000050Y0900000001282030000000005002013013000000000002760700000000001386813650012 0 NN0000023180000000580000000320002200000000020250930000004400 NNY +099220 KR7099220006SDN ST3101100000000NNN NNNNNNNN0NNNNNNNN0000010970000100001NNN00NNN000000100N0900000003353710000000005002009051900000000006494400000000003247217500012 0 NN00000065400000002000000002500023-0000001720250930000000712 NNN +099320 KR7099320004Ʈ ST2100910300000NNN NNNNNNNN0NNNNNNNN0001500000000100001NNN00NNN000000100N0900000002385190000000005002008061300000000001095100000000000547563900012 0 NN0000013500000000620000000840006500000000520250930000016426 NNN +099390 KR7099390007극۴ ST3000000000000 NN N N 0 N N0000049700000100001NNN00NNN000000100N0900000000219890000000005002021081900000000000820800000000000410414150012 0 NN000000133-00000026-00000010-000500000001020250930000000407 NNN +099410 KR7099410003漱 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000053100000100001NNN00NNN000000100N0900000002174270000000005002009111000000000001400000000000000700000000012 0 NN0000003570000000410000000450006000000001620241231000000743 NNN +099430 KR7099430001̿÷ ST2100910240000 NN N N 0 N N0000054800000100001NNN00NNN000000060Y0900000004726590000000005002021092700000000006164000000000003082036100012 0 NN0000006770000001400000001710016400000001120250930000003377 NNY +099440 KR7099440000 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000066900000100001NNN00NNN000000100N0900000022699970000000005002009052600000000006824300000000003412169700012 0 NN0000011340000000290000000180001200000000320250930000004565 NNN +099520 KR7099520009DGI ST3100910280000NNN NNNNNNNN0NNNNNNNN0000012840000100001YNY00NNN000000100N0900000000000000000000005002009122200000000004528100000000002264091200012 0 NN000000148-00000035-00000034-0034-0000001320250930000000581 NNN +099750 KR7099750002ɾ ST3000000000000 NN N N 0 N N0000093200000100001NNN00NNN000000100N0900000000562770000000005002019032200000000001365900000000000682958650003 0 NN0000003300000000220000000250002300000000820250930000001273 NNN +100030 KR7100030006Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000219500000100001NNN00NNN000000100N0900000000196890000000005002010052500000000000328300000000000164185700012 0 NN0000001310000000120000001570012800000001920250930000000720 NNN +100120 KR7100120005 ST2100910290000NNY NNNYNNNN0NNNNNNNN0000249000000100001NNN00NNN000000060Y0900000006696130000000005002009041000000000000936000000000000500093250012 0 NN0000017080000001290000001310010400000000920250930000002330 NNN +100130 KR7100130004S&C ST3100910260000NNY NNNNNNNN0NYNNNNNN0000019330000100001NNN00NNN000000100N0900000002131400000000005002009083100000000005714300000000002857150000012 0 NN00000110200000010200000001900002-0000002020250930000001104 NNN +100590 KR7100590009ť ST3100910280000 NN N N 0 N N0000034150000100001NNN00NNN000000100N0900000002311710000000005002018121400000000001583000000000000791501150012 0 NN000000833-00000028-00000034-0021-0000000620250930000000540 NNN +100660 KR7100660000ϱ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000050400000100001NNN00NNN000000100N0900000002915130000000005002011121900000000001260000000000000630000000012 0 NN000000336-000000020000000090000300000000020250930000000635 NNN +100700 KR7100700004޵Į ST3100910240000NNN NNNNNNNN0NNNNNNNN0000023800000100001NNN00NNN000000100N0900000000435230000000001002008093000000000004380000000000000438000000012 0 NN0000004710000000900000001030008500000000820250930000001042 NNN +100790 KR7100790005̷ºó ST2101400000000 NN N N 0 N N0000148900000100001NNN00NNN000000100N0900000012795400000000010002019031500000000005312400000000005502735000012 0 NN0000012610000001290000001290011700000000120250930000007910FB2NNN +101000 KR7101000008KSδƮ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000010240000100001NNN00NNN000000100N0900000049986560000000005002009110600000000003344600000000001672340100012 0 NN000000323-00000042-00000050-0050-0000001520250930000000342 NNN +101160 KR7101160000 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000242000000100001NNN00NNN000000060Y0900000003057540000000005002008061900000000001651000000000000825549650012 0 NN0000020770000003620000002140011100000001020250930000003995 NNY +101170 KR7101170009츲Ƽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000204500000100001NNN02NNN000000100N0900000008346250000000005002009042800000000001350000000000000675000000012 0 NN00000041500000002500000002900024-0000000920250930000002760 NNN +101240 KR7101240000ť ST3100910230000NNN NNNNNNNN0NNNNNNNN0000039900000100001NNN00NNN000000100N0900000000757820000000005002011110800000000001086100000000000543069500012 0 NN0000006010000001020000001100009300000001120241231000000433 NNN +101330 KR7101330009̽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000064000000100001NNN02NNN000000100N0900000136714890000000005002010020400000000002314700000000001197909400012 0 NN0000101180000003260000002200017900000000520250930000001481 NNN +101360 KR7101360006ھص帲 ST2100910230000 NN N N 0 N Y0000231000000100001NNN00NNN000000100N0900000004990960000000005002020073000000000001778600000000000889305700012 0 NN0000010470000000040000000070000300000000720250930000004108 NNN +101390 KR7101390003̿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000003960000100001YNY00NNN000000100N0900000000000000000000005002008072300000000001391400000000000695717700012 0 NN000000488-00000070-00000062-0068-0000017920250630000000055 NNN +101400 KR7101400000Ʈ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000004950000100001NNN00NNN000000100N0900000158891790000000005002009033100000000007045000000000003522536500012 0 NN000000274-00000033-00000034-0034-0000001120250930000000348 NNN +101490 KR7101490001ؿ ST1100910280000NNY NNNNNNNN0NNNNNNNY0000928000000100001NNN00NNN000000050Y0900000011291000000000005002009041400000000002133400000000001072572350012 0 NY0000018010000003710000003760034700000001620250930000019798 NNN +101670 KR7101670008̵θƬ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000029000000100001NNN00NNN000000100N0900000151098020000000002002008071500000000005649800000000001129965680012 0 NN000000028-00000105-00000310-035400000000020250930000001638 NNN +101680 KR7101680007ѱб ST3100910270000NNN NNNNNNNN0NNNNNNNN0000031950000100001NNN00NNN000000100N0900000002188360000000005002009051900000000000840400000000000420200000012 0 NN0000006370000000210000000150001500000000420241231000000268 NNN +101730 KR7101730000̵ƽ ST2000000000000NNN NNNNNNNN0NNNNNNNY0000079300000100001NNN00NNN000000060Y0900000003704510000000005002009060300000000008380300000000004190164300012 0 NN000001183-00000308-00000283-0246-0000001120250930000006645 NNN +101930 KR7101930006ȭ ST2100910300000NNN NNNNNNNN0NNNNNNNN0000438000000100001NNN00NNN000000100N0900000000184560000000005002010102200000000000923200000000000494008250012 0 NN0000008250000001190000001690013800000000420250930000004044 NNN +101970 KR7101970002翡ġ ST2100910260000 NN N N 0 N N0000118600000100001NNN00NNN000000060Y0900000000577730000000005002025032800000000001479000000000000739500450012 0 NN0000018320000003110000003460027400000001720241231000001754 NNN +102120 KR7102120003ݵü ST3100910280000NNN NNNNNNNN0NNNNNNNN0000129300000100001NNN00NNN000000060Y0900000014256720000000005002009060500000000001778000000000000889037650012 0 NN0000018090000000880000000960006000000001020250930000002299 NNY +102370 KR7102370004̿ ST3101100000000 NN N N 0 N N0000036300000100001NNN00NNN000000100N0900000002417800000000005002022012400000000002722900000000001361460500012 0 NN000000090-00000031-00000047-0042-0000000520250930000000988 NNN +102710 KR7102710001̿ũ ST2100910230000NNN NNNNNNNN0NNNNNNNN0000549000000100001NNN00NNN000000050Y0900000003301650000000005002009052800000000001428700000000000714391800012 0 NN0000049410000006700000006040044500000001220250930000007844 NNY +102940 KR7102940004ڿջ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000587000000100001NNN00NNN000000100N0900000000980960000000005002009040700000000001290700000000000645355950012 0 NN0000016430000002020000003490034500000000820250930000007576KOLNNN +103230 KR7103230009ش ST3100910270000NNN NNNNNNNN0NNNNNNNN0000040900000100001NNN00NNN000000100N0900000000443200000000005002009080500000000000720000000000000360000000012 0 NN0000004710000000350000000360004800000001020241231000000294 NNN +103840 KR7103840005 ST3100910190000 NN N N 0 N N0000030950000100001NNN00NNN000000100N0900000001319930000000001002019112000000000001636600000000000163664280012 0 NN000001763000000005-00000059-0013-0000000320241231000000506 NNN +104040 KR7104040001뼺 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000007530000100001NNN00NNN000000100N0900000003726750000000001002009012300000000013406700000000001340678260012 0 NN000000156-000000520000000360002900000000020250930000001009 NNN +104200 KR7104200001NHN ST3000000000000NNN NNNNNNNN0NNNNNNNN0000066600000100001NNN00NNN000000100N0900000004015870000000005002009100600000000001482700000000000741377500012 0 NN000000521000000004-00000124-0127-0000002020241231000000987 NNN +104460 KR7104460001ǿ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000148000000100001NNN00NNN000000060Y0900000000412780000000005002009122200000000001051800000000000535681250012 0 NN0000031000000003830000004060031400000002920250930000001556 NNN +104480 KR7104480009ƼɹĮ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000017600000100001NNN00NNN000000060Y0900000007728560000000005002011042600000000009089500000000004544771700012 0 NN000003396-00000016-00001128-1121-0000001120241231000001599LB8NNN +104540 KR7104540000ڷ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000067100000100001NNN00NNN000000100N0900000000817100000000005002013030500000000001278500000000000639287000012 0 NN0000007180000000600000000210003100000000420250930000000857 NNN +104620 KR7104620000dz ST3100600000000 NN N N 0 N N0000051400000100001NNN00NNN000000100N0900000001939560000000005002019013000000000001681000000000000840527600012 0 NN000000808-00000019-00000049-0044-0000001320250930000000864 NNN +104830 KR7104830005͸Ʈ ST2100910230000NNY NNNNNNYN0NNNNNNNN0000387000000100001NNN00NNN000000060Y0900000001009010000000005002011122800000000001260800000000000630400000012 0 NN0000023580000004020000004300034600000000720250930000004879140NNY +105330 KR7105330005̿ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000050400000100001NNN00NNN000000100N0900000000253720000000005002009092900000000001606000000000000803001400012 0 NN000000597-00000021-00000040-0043-0000000120250930000000809LD7NNN +105550 KR7105550008Ŀ帮 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000015970000100001NNN00NNN000000100N0900000006886300000000005002014071100000000007830700000000003915352550012 0 NN000000278-000001130000001300013000000000420250930000001250 NNN +105740 KR7105740005̶ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000101800000100001NNN00NNN000000100N0900000002036820000000005002010111200000000001016800000000000508425650012 0 NN0000008940000000850000000570004800000000620250930000001035 NNN +105760 KR7105760003ũ ST3100910270000 NN N N 0 N N0000054000000100001NNN00NNN000000100N0900000000552190000000005002024012900000000001017200000000000508619350012 0 NN0000006540000000180000000150001600000000820250930000000549 NNN +106080 KR7106080005̿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000006560000100001NNN00NNN000000100N0900000007758910000000010002010020900000000002880900000000002880908800012 0 NN000000066-00000055-00000070-0071-0000003320250930000000188 NNN +106190 KR7106190002 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000118300000100001NNN00NNN000000060Y0900000000438470000000005002010072800000000001063300000000000531658650012 0 NN0000007750000001560000001710013700000001220241231000001257 NNN +106240 KR7106240005ũн ST3100910280000NNN NNNNNNNN0NNNNNNNN0000020100000100001NNN00NNN000000100N0900000001972880000000005002009031600000000002113400000000001056731250012 0 NN000000330-00000048-00000131-0127-0000001820250930000000424 NNN +106520 KR7106520000غ ST3100910290000NNN NNNNNNNN0NNYNNNNN0000004110000100001YNY00NNN000000100N0900000000000000000000010002012071300000000003869500000000003869595200012 0 NN000000030-00000022-00000021-0021-0000001520250930000000159 NNN +107600 KR7107600009 ST3100910230000 NN N N 0 N N0000385000000100001NNN00NNN000000100N0900000002175370000000005002022080400000000000563000000000000310542700012 0 NN000000303-00000062-00000123-0107-0000001820241231000002167 NNN +107640 KR7107640005߿ÿ ST2100910280000 NN N N 0 N N0000516000000100001NNN00NNN000000060Y0900000002370860000000005002024062400000000000906400000000000453247300012 0 NN0000011540000000130000000080000700000001920250930000004677 NNN +108230 KR7108230004 ST3100910270000NNY NNYNNNNN0NNNNNNNN0000048700000100001NNN00NNN000000100N0900000001465430000000005002009091500000000003802300000000001914795600012 0 NN000001273000000006-00000200-0181-0000000120250930000001851 NNN +108380 KR7108380007 ST2100910300000NNN NNNNNNNN0NNNNNNNN0000272000000100001NNN00NNN000000060Y0900000000887700000000005002011070800000000000956700000000000478366650012 0 NN0000017350000001920000002250018200000001120250930000002602 NNY +108490 KR7108490004κƼ ST1100910270000 NY N N 0 N Y0003070000000100001NNN00NNN000000100N0900000010260410000000005002018102600000000001457000000000000728504400012 0 NY0000002730000000130000000290002300000000420250930000044730 NNN +108860 KR7108860008ٽAI ST2000000000000NNN NNNNNNNN0NNNNNNNY0000132400000100001NNN00NNN000000060Y0900000006974110000000005002009121000000000002691400000000001345739500012 0 NN000000803000000007-00000015-0018-0000000620250930000003563 NNY +109080 KR7109080002Ƽý ST3100910280000NNN NNNNNNNN0NNNNNNNN0000088900000100001NNN00NNN000000100N0900000000522120000000005002011071200000000000563600000000000281800000012 0 NN0000002380000000270000000550004700000000920241231000000501 NNN +109610 KR7109610006 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000028250000100001NNN00NNN000000060Y0900000003311000000000005002015122900000000004890700000000002445370000012 0 NN000003688-00000031-00000080-0093-0000000620250930000001381 NNY +109670 KR7109670000Ʈ ST3100910200000 NN N N 0 N N0000065000000100001NNN00NNN000000100N0900000003114590000000005002023122100000000000583600000000000291830100012 0 NN000001357000000009000000000-0001-0000000220250930000000379 NNN +109740 KR7109740001𿡽 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000076700000100001NNN00NNN000000100N0900000002021940000000005002009092300000000002571000000000001351245500012 0 NN000000388-00000173-00000152-0138-0000001120250930000001971 NNN +109820 KR7109820001Ʈ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000025000000100001NNN00NNN000000100N0900000001698390000000005002009110600000000002039300000000001019682000012 0 NN000000100-00000016-00000037-0037-0000001820241231000000509 NNN +109860 KR7109860007ϱݼ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000075900000100001NNN00NNN000000100N0900000000057400000000005002009072800000000000910000000000000455000000012 0 NN0000006850000000120000000620005000000000320250930000000690 NNN +109960 KR7109960005ũ ST3101100000000NNN NNNNNNNN0NNYNNNNN0000002550000100001NNN00NNN000000100N0900000002465740000000005002009111300000000022078900000000011039463450012 0 NN000000074-00000018-00000012-0023-0000002120250930000000563 NNN +110020 KR7110020005̿ ST3100910230000 NN N N 0 N N0000023600000100001NNN00NNN000000100N0900000000255980000000005002018121400000000000905800000000000452938100012 0 NN0000001930000000120000000430004300000003620241231000000213 NNN +110790 KR7110790003ũؾ ST3100910200000 NN N N 0 N N0000039950000100001NNN00NNN000000100N0900000000197200000000005002018100100000000002343000000000001171548000012 0 NN000003863-0000003400000010400125-0000000320250930000000936 NNN +110990 KR7110990009Ƽ ST2100910270000 NN N N 0 N N0000193500000100001NNN00NNN000000060Y0900000002548470000000001002018080700000000001890000000000000189000000012 0 NN0000008110000002230000002720023600000001720250930000003657 NNY +111710 KR7111710000ȭ ST3101500000000 NN N N 0 N N0000042300000100001NNN00NNN000000100N0900000000023830000000002002018112900000000002058800000000000411760000012 0 NN0000002070000000800000001350010900000000620241231000000870 NNN +112040 KR7112040001̵ ST1000000000000NNY NNNNNNNN0NNNNNNNY0000321500000100001NNN00NNN000000050Y0900000006329270000000005002009121800000000003394800000000001725424150012 0 NY000004223-000001360000001930008400000006120250930000010914 NNY +112290 KR7112290002̾ ST2100910230000 NN N N 0 N N0000237500000100001NNN00NNN000000100N0900000006014240000000010002022071400000000001011000000000001026246500012 0 NN000000703-00000082-00000138-0160-0000003020241231000002401 NNN +113810 KR7113810006 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000007800000100001NNN00NNN000000100N0900000004172180000000005002012112200000000003262800000000001631402550012 0 NN0000005880000000200000000170001900000001620250930000000254 NNN +114190 KR7114190002 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000185900000100001NNN00NNN000000100N0900000009985710000000005002009112000000000002612300000000001306151900012 0 NN000001616-00000062-00000103-0087-0000001620250930000004856 NNN +114450 KR7114450000׸ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000030100000100001NNN00NNN000000100N0900000003650550000000005002009122200000000002000000000000001000000000012 0 NN0000002490000000040000000160001600000000420241231000000602 NNN +114630 KR7114630007󸮽 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000004950000100001NNN00NNN000000100N0900000002044220000000005002010011500000000008794700000000004407377400012 0 NN0000007640000000550000000470003600000000520250930000000435 NNN +114810 KR7114810005Ѽ־̿ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000135500000100001NNN00NNN000000060Y0900000006006970000000005002013020700000000002859300000000001467608700012 0 NN0000014710000003040000003150024500000001520250930000003874924NNY +114840 KR7114840002йи ST2100910230000 NN N N 0 N N0000151700000100001NNN00NNN000000060Y0900000000780020000000005002021102800000000001731900000000000865995000012 0 NN0000016550000002050000002070017000000002220250930000002627 NNY +115160 KR7115160004޸ƽ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000008790000100001NNN00NNN000000100N0900000000788130000000005002009111600000000004397000000000002198506200012 0 NN000003074-00000142-00000535-0530-0000004720250930000000386 NNN +115180 KR7115180002ťƮ ST2100600000000NNY NNNYNNNN0NNNNNNNN0000346500000100001NNN00NNN000000100N0900000005614390000000005002016022900000000003719100000000001859593350012 0 NN000000055-00000205-00000192-0192-0000004820250930000012886 NNN +115310 KR7115310005 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000725000000100001NNN00NNN000000060Y0900000000031870000000005002010020900000000000319200000000000159644150012 0 NN0000002170000000440000000560004900000000620250930000002314 NNN +115440 KR7115440000츮 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000077400000100001NNN00NNN000000100N0900000001530020000000005002010012700000000001079400000000000539714600012 0 NN0000005780000000230000000290003200000000620250930000000835 NNN +115450 KR7115450009HLB׶ǻƽ ST2101100000000NNN NNNNNNNN0NNNNNNNN0000033900000100001NNN00NNN000000100N0900000011590110000000005002010032600000000008438200000000004219113150012 0 NN000000468-00000076-00000099-0102-0000000520250930000002860 NNN +115480 KR7115480006޵Į ST3100910290000NNN NNNNNNNN0NNNNNNNN0000006180000100001NNN00NNN000000100N0900000004533110000000005002011121500000000006062400000000003031227900012 0 NN00000032500000006800000003600032-0000000320250930000000374 NNN +115500 KR7115500001̾ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000098000000100001NNN00NNN000000060Y0900000001250500000000005002010041400000000001200000000000000600000000012 0 NN0000002950000000200000000240002000000001020241231000001176 NNY +115530 KR7115530008÷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000003230000100001NNN00NNN000000100N0900000004254200000000001002011110200000000006796300000000000679630000012 0 NN000000450-00000006-00000044-0044-0000007420250930000000219 NNN +115570 KR7115570004Ÿ÷ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000030050000100001NNN00NNN000000100N0900000000063760000000005002010012700000000000798400000000000399225400012 0 NN0000007300000000490000000010000100000000520250930000000239 NNN +115610 KR7115610008̹ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000016160000100001NNN00NNN000000100N0900000065941980000000005002010022600000000002363700000000001181876900012 0 NN000000130-00000052-00000037-0037-0000006720241231000000381 NNN +117670 KR7117670000Ĩ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000156000000100001NNY00NNN000000100N0900000000360210000000005002010091700000000000666100000000000336164250012 0 NN000000201-00000014-00000004-0004-0000002320250331000001039 NNN +117730 KR7117730002Ƽκƽ ST2100910270000 NN N N 0 N N0000255000000100001NNN00NNN000000100N0900000008905910000000005002018112900000000002214100000000001107080400012 0 NN000000368-00000009-00000155-0149-0000004520250930000005646 NNN +118990 KR7118990001Ʈ ST2100910300000 NN N N 0 N N0000098800000100001NNN00NNN000000060Y0900000004896270000000005002017080400000000002486100000000001245320650012 0 NN0000053430000004060000003040019100000000720250930000002456 NNY +119500 KR7119500007Ż ST3100910260000NNN NNNNNNNN0NNNNNNNN0000048300000100001NNN00NNN000000100N0900000005504000000000005002010091700000000001184700000000000601234000012 0 NN0000006510000000150000000150001600000000320241231000000572 NNN +119610 KR7119610004ͷ ST2100910290000NNY NNNYNNNN0NNNNNNNN0000165200000100001NNN00NNN000000060Y0900000000407880000000005002010072800000000001141300000000000660823900012 0 NN0000008680000001320000001000008700000000220250930000001885 NNN +119830 KR7119830008 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000076000000100001NNN00NNN000000100N0900000019573160000000005002010102600000000002339300000000001169672950012 0 NN000000437-000000350000000010000300000000020250930000001777 NNN +119850 KR7119850006 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000361500000100001NNN00NNN000000050Y0900000003172890000000005002013100200000000001644800000000000837445450012 0 NN0000019660000004000000004700034600000002220250930000005946 NNN +120240 KR7120240007ȭ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000129400000100001NNN00NNN000000100N0900000000111780000000005002010122000000000000719000000000000359519550012 0 NN0000009230000000850000001190009700000000620241231000000930 NNN +121440 KR7121440002Ȧ ST2101100000000NNN NNNNNNNN0NNNNNNNN0000046200000100001NNN00NNN000000050Y0900000000888860000000005002011052000000000004283600000000002141840900012 0 NN0000027570000002740000002910027300000000420250930000001979 NNN +121600 KR7121600001ż ST2100910230000NNN NNNNNNNN0NNNNNNNY0000718000000100001NNN00NNN000000050Y0900000003195420000000005002011020900000000001221100000000000610559550012 0 NN00000083000000003000000000400004-0000000220250930000008767 NNN +121800 KR7121800007Ʈ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000033200000100001YNY00NNN000000100N0900000000000000000000005002011120100000000007720100000000003860080550012 0 NN000000072-000000660000004320040600000001420250930000002563 NNN +121850 KR7121850002 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000036650000100001NNN00NNN000000100N0900000000495430000000005002012092700000000000306100000000000153070850012 0 NN000000106-00000041-00000044-0044-0000005120250930000000112 NNN +121890 KR7121890008ý ST3100910280000NNN NNNNNNNN0NNNNNNNN0000016080000100001NNN00NNN000000100N0900000000333900000000005002010071600000000001329100000000000664572300012 0 NN000000181-00000022-00000018-0018-0000001620241231000000213 NNN +122310 KR7122310006뷹 ST3100910290000 NN N N 0 N N0000042150000100001NNN00NNN000000100N0900000000325060000000005002018052800000000001455300000000000727692200012 0 NN000000740-00000016-00000027-0028-0000001020250930000000613 NNN +122350 KR7122350002 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000018540000100001NNN00NNN000000100N0900000097475650000000001002010031900000000003833900000000000383394280012 0 NN000004262000000135-000000070001000000000120250930000000710 NNN +122450 KR7122450000KX ST3101500000000NNN NNNNNNNN0NNNNNNNN0000034700000100001NNN00NNN000000060Y0900000000827960000000005002011052500000000004481900000000002276823850012 0 NN0000025370000003750000003410030500000000120250930000001555 NNN +122640 KR7122640006Ƽ ST2100910270000NNN NNNNNNNN0NNNNNNNN0000200000000100001NNN00NNN000000100N0900000003702370000000005002015121600000000002134900000000001067491050012 0 NN000000676000000062-00000018-002700000000520250930000004269 NNN +122690 KR7122690001Ƽ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000029350000100001NNN00NNN000000100N0900000003716140000000005002010052500000000002295600000000001147810800012 0 NN00002208700000044000000010700022-0000000220250930000000673 NNN +122870 KR7122870009θƮ ST1101500000000NNY NNNNNNNN0NNNNNNNY0000742000000100001NNN00NNN000000050Y0900000006818120000000005002011112300000000001869100000000000934552450012 0 NY0000037360000003620000006230045900000001020250930000013868 NNY +122990 KR7122990005̼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000061200000100001NNN00NNN000000100N0900000001091960000000005002010091000000000002663900000000001409347050012 0 NN000002452-00000363-00000211-0228-0000000620250930000001630 NNN +123010 KR7123010001÷ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000012160000100001NNN00NNN000000100N0900000011975300000000005002016072000000000003265800000000001632927100012 0 NN00000030500000001000000000800005-0000003120250930000000397 NNN +123040 KR7123040008 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000023100000100001NNN00NNN000000060Y0900000002179730000000005002010080600000000006262800000000003131414950012 0 NN000013117000000436-00000294-0514-0000002920250930000001446 NNN +123330 KR7123330003 ST2100910230000NNN NNNNNNNN0NNNNNNNN0000193200000100001NNN00NNN000000100N0900000001013360000000005002011080300000000000796800000000000398434000012 0 NN0000006600000001490000001470012800000007120250930000001539 NNN +123410 KR7123410003ڸƿƼ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000078800000100001NNN00NNN000000060Y0900000005953170000000001002010082700000000002784100000000000278410640012 0 NN0000058750000004000000004430037700000002120250930000002193 NNY +123420 KR7123420002̵÷ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000086600000100001NNN00NNN000000100N0900000002637960000000005002010111000000000001055200000000000573492100012 0 NN0000009310000000760000002510021900000001820250930000000913 NNN +123570 KR7123570004̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000019350000100001NNN00NNN000000100N0900000000251610000000005002011112500000000002227600000000001113803900012 0 NN000000238-000000030000000170001800000000420250930000000431 NNN +123750 KR7123750002 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000019770000100001NNN00NNN000000100N0900000001466030000000005002010070200000000001274600000000000637314850012 0 NN000000266000000006-00000005-0005-0000001920250930000000251 NNN +123840 KR7123840001 ST3100910190000NNN NNNNNNNN0NNYNNNNN0000009490000100001NNY00NNN000000100N0900000000447930000000010002010100500000000006365400000000006365430700012 0 NN000000402-00000131-00000239-0239-0000005520250930000000604 NNN +123860 KR7123860009Ƴн ST2100910280000NNN NNNNNNNN0NNNNNNNN0000167500000100001NNN00NNN000000060Y0900000000531030000000005002010110500000000001212300000000000608491500012 0 NN0000018220000002000000001850018900000003020241231000002030 NNN +124500 KR7124500000Ƽ۷ι ST2000000000000NNN NNNNNNNN0NNNNNNNN0000497000000100001NNN02NNN000000100N0900000010435340000000005002014122300000000002320400000000001160226350012 0 NN0000463060000011990000012110089900000002520250930000011532 NNN +124560 KR7124560004¿ ST3101300000000 NN N N 0 N N0000026100000100001NNN00NNN000000060Y0900000001374980000000001002019121000000000003872000000000000402209110012 0 NN000008274000000055-00000036-005000000000220250930000001010 NNY +125020 KR7125020008ƼƼ ST3100910280000 NN N N 0 N N0000040350000100001NNN00NNN000000060Y0900000008585790000000005002025051500000000003503800000000001751927500012 0 NN0000030390000001090000000820006300000001220241231000001413 NNN +125210 KR7125210005Ƹ׸ ST3100910280000 NN N N 0 N N0000068300000100001NNN00NNN000000100N0900000001531850000000005002019032900000000001649600000000000824839500012 0 NN0000010100000000790000000530005000000001120250930000001126 NNN +125490 KR7125490003ѶijƮ ST0100910300000 NN N N 0 N N0000189500000100001NNN00NNN000000060Y0900000010811880000000001002025082000000000003650200000000000365023520012 0 NN0000011490000000920000000420003300000000020250930000006917 NNN +126340 KR7126340009 ST3100910280000 NN N N 0 N N0000991000000100001NNN00NNN000000060Y0900000002593220000000005002020092300000000000673300000000000336685400012 0 NN000000594000000011-00000030-0033-0000000920250930000006673 NNN +126600 KR7126600006BGFڸƼ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000040000000100001NNN00NNN000000060Y0900000000914300000000005002010111200000000006276600000000003138344950012 0 NN0000030360000001670000001300009000000000420250930000002510LD7NNN +126640 KR7126640002ȭ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000013740000100001NNN00NNN000000100N0900000002255430000000001002010083100000000003505500000000000363738870012 0 NN0000032200000000130000000270002600000000220241231000000481 NNN +126700 KR7126700004̺ý ST2100910290000NNN NNNNNNNN0NNNNNNNN0000170100000100001NNN00NNN000000060Y0900000002442050000000005002010091000000000001494200000000000747105600012 0 NN000001227-00000175-00000118-0130-0000000120250930000002541 NNY +126730 KR7126730001Ĩ ST3100910280000 NN N N 0 N N0000179500000100001NNN00NNN000000060Y0900000004104260000000005002024050700000000000850300000000000425173000012 0 NN0000002690000000100000000270002400000000720250930000001526 NNY +126880 KR7126880004̱̿۷ι ST3100910270000NNN NNNNNNNN0NNNNNNNN0000037000000100001NNN00NNN000000100N0900000001603400000000005002011013100000000002320400000000001160245150012 0 NN000000953-000000020000000180001400000000020250930000000858 NNN +127120 KR7127120004̿ũ ST2100600000000NNN NNNNNNNN0NNNNNNNN0000238000000100001NNN00NNN000000100N0900000002329720000000005002011122600000000003229400000000001614708900012 0 NN000000104-00000110-00000108-0108-0000003420250930000007686 NNN +127710 KR7127710002ƽþư ST3000000000000NNN NNNNNNNN0NNNNNNNN0000010910000100001NNN00NNN000000100N0900000000573680000000005002015073100000000003490400000000001745204100012 0 NN00000051700000007000000006600058-0000004020250930000000380 NNN +127980 KR7127980001ȭνŰƮ ST3100910280000 NN N N 0 N N0000055700000100001NNN00NNN000000100N0900000000141080000000001002023021700000000001184000000000000118406840012 0 NN000000667-00000010-00000036-0044-0000000620250930000000659 NNN +128540 KR7128540002ĸ ST3100910300000 NN N N 0 N N0000024200000100001NNN00NNN000000100N0900000009065420000000001002018120500000000002669000000000000266904600012 0 NN0000011270000000100000000240003300000003220250930000000645 NNN +128660 KR7128660008̸Ż ST3100910260000NNN NNNNNNNN0NNNNNNNN0000030000000100001NNN00NNN000000100N0900000000920660000000005002010121300000000002480300000000001240168450012 0 NN0000025820000000630000000620004800000000620250930000000744 NNN +129890 KR7129890000 ST3100910280000 NN N N 0 N N0000009260000100001NNN00NNN000000100N0900000004587220000000001002020120200000000004554500000000000506434100012 0 NN0000005820000000400000000420004200000000020250930000000421 NNN +129920 KR7129920005뼺 ST3100910270000 NN N N 0 N N0000051000000100001NNN00NNN000000100N0900000016123840000000001002022082200000000001371500000000000161694530012 0 NN000000703-00000021-00000055-0050-0000001820250930000000699 NNN +130500 KR7130500002GHż ST3100910200000NNN NNNNNNNN0NNNNNNNN0000026000000100001NNN00NNN000000100N0900000000654770000000005002013080200000000001454500000000000727252600012 0 NN0000006490000000600000000330002800000000420250930000000378 NNN +130580 KR7130580004̽غ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000058200000100001NNN00NNN000000100N0900000000118130000000005002011122200000000001540000000000000770000000012 0 NN0000007020000001410000001530012100000001320250930000000896 NNN +130740 KR7130740004ƼǾ۷ι ST3100910300000NNN NNNNNNNN1NNNNNNNN0000022100000100001NNN00NNN000000100N0900000010182160000000005002011020800000000001127600000000000563833950012 0 NN000000581-00000025-00000003-0006-0000000120250930000000249 NNN +131030 KR7131030009 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000080400000100001NNN00NNN000000060Y0900000002735100000000005002010120300000000001764600000000000902911250012 0 NN0000008190000000860000001210010300000000720241231000001418 NNY +131090 KR7131090003ť ST3000000000000NNN NNNNNNNN0NNNNNNNN0000038100000100001NNN00NNN000000100N0900000000095410000000005002011122100000000000800000000000000440000000012 0 NN0000001210000000340000000340003000000000720241231000000304 NNN +131100 KR7131100000ƼθƮ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000014060000100001NNN00NNN000000100N0900000000682400000000005002011061400000000003224600000000001612336200012 0 NN0000014290000000970000000060002200000000320241231000000453 NNN +131180 KR7131180002 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000009470000100001NNN00NNN000000100N0900000000484400000000001002011013100000000002935000000000000293500000012 0 NN0000003820000000230000000630004800000000820241231000000277 NNN +131220 KR7131220006Ѱ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000047850000100001NNN00NNN000000100N0900000000579590000000005002011101100000000000745400000000000372724500012 0 NN0000005590000000490000000500004600000001020250930000000356 NNN +131290 KR7131290009Ƽ ST2100910290000NNN NNNNNNNN0NNNNNNNY0000826000000100001NNN00NNN000000050Y0900000001844150000000005002011010500000000001106100000000000553071450012 0 NN0000030500000002940000002420018100000001220250930000009136 NNN +131370 KR7131370009˼Ʈ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000024550000100001NNN00NNN000000060Y0900000001945710000000001002011010500000000005326700000000000532670830012 0 NN0000003760000000360000000360002900000000320250930000001307 NNY +131400 KR7131400004̺÷ܼ ST3100910280000NNN NNNNNNNN1NNNNNNNN0000021350000100001NNN00NNN000000100N0900000057040600000000005002010122700000000005959100000000002979594100012 0 NN000000477-00000014-00000114-0126-0000002120250930000001272 NNN +131760 KR7131760001 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000007790000100001NNN00NNN000000100N0900000001476020000000005002015081700000000004343100000000002184570100012 0 NN000000331-00000027-00000043-0045-0000001220250930000000338 NNN +131970 KR7131970006λ׽ ST2100600000000NNN NNNNNNNN0NNNNNNNY0000687000000100001NNN00NNN000000060Y0900000008614180000000005002013102200000000001932700000000000966361900012 0 NN0000037310000003790000002990036800000000920241231000013277391NNY +133750 KR7133750000ް ST3100600000000NNN NNNNNNNN0NNNNNNNN0000018500000100001NNN00NNN000000100N0900000000620790000000005002015121800000000002340700000000001170353850012 0 NN0000001810000000070000000150001200000000420250630000000433 NNN +134060 KR7134060003ǻ ST3101500000000NNN NNNNNNNN0NNNNNNNN0000041500000100001NNN00NNN000000100N0900000000295430000000005002011042700000000000476900000000000238462500012 0 NN0000001100000000070000000240002400000001120241231000000197 NNN +134580 KR7134580000žڹ̵ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000018980000100001NNN00NNN000000100N0900000000887520000000005002013112600000000004929400000000002464707450012 0 NN0000003440000000240000000240001500000000120250930000000935 NNN +136150 KR7136150000Ƽ ST2100910270000 NN N N 0 N N0000200000000100001NNN00NNN000000060Y0900000000562730000000005002025050900000000000838100000000000419051500012 0 NN0000004220000000640000000830007900000002420241231000001676 NNN +136410 KR7136410008Ƽ ST3100910230000 NN N N 0 N N0000091300000100001NNN00NNN000000060Y0900000000937320000000005002022020700000000001101900000000000567118300012 0 NN0000004640000001090000000990008400000001420250930000001006 NNN +136480 KR7136480001ϸ ST2100910190000NNN NNNNNNNN0NNNNNNNN0000030450000100001NNN00NNN000000060Y0900000004929160000000005002011050200000000010620900000000005310485100012 0 NN0000112410000004520000005190041300000000420250930000003234HRMNNN +136540 KR7136540002ũ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000111400000100001NNN00NNN000000060Y0900000000322050000000005002011050200000000001227900000000000693208100012 0 NN0000005840000001060000001300010500000000920250930000001367 NNN +137080 KR7137080008 ST3100910270000 NN N N 0 N N0000043200000100001NNN00NNN000000100N0900000001605270000000005002022020800000000001105900000000000643567100012 0 NN000000387-00000092-00000125-0099-0000001720250930000000477 NNN +137400 KR7137400008ǿƼ ST1100910270000NNY NNNNNNNN0NNNNNNNY0000512000000100001NNN00NNN000000050Y0900000008517260000000005002012070600000000002369000000000001187154300012 0 NY0000037280000005040000004110030000000001720250930000012129 NNY +137940 KR7137940003ؽƮ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000002940000100001NNN00NNN000000100N0900000003680200000000001002011061400000000008536800000000000875263920012 0 NN000000663-00000180-00000160-0160-0000002020250930000000250 NNN +137950 KR7137950002̾ɹĮ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000032850000100001NNN00NNN000000100N0900000000800610000000005002011080800000000002226700000000001113390700012 0 NN000002813000000081-00000021-001400000000020250930000000731 NNN +138070 KR7138070008 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000019330000100001NNN00NNN000000100N0900000000240840000000005002011112800000000001750300000000000875160200012 0 NN000000407000000001-00000001-0002-0000000120250930000000338 NNN +138080 KR7138080007ַ̼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000164500000100001NNN00NNN000000100N0900000005642550000000005002014022700000000001187500000000000593761250012 0 NN000000430-00000126-00000139-0139-0000003220250930000001953 NNN +138360 KR7138360003 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000025250000100001NNN03NNN000000100N0900000037370720000000005002013110800000000007699100000000003849586100012 0 NN000000215-000000120000000580004600000001020241231000001944 NNN +138610 KR7138610001̺ ST2100910240000NNN NNNNNNNN0NNNNNNNN0000355000000100001NNN00NNN000000100N0900000001852590000000005002011071300000000001136400000000000568248500012 0 NN000000246-00000049-00000093-0093-0000003120241231000004034 NNN +139050 KR7139050009BF ST3000000000000NNN NNNNNNNN0NNYNNNNN0000028050000100001YNY00NNN000000100N0900000000000000000000005002011072900000000000864400000000000432227550012 0 NN000000112-00000024-00000016-0016-0000004920250930000000242 NNN +139670 KR7139670004Ű׸ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000023050000100001NNN00NNN000000100N0900000000507030000000005002011120200000000001411800000000000705940500012 0 NN0000000920000000070000000350003500000002820250930000000325 NNN +140070 KR7140070004÷۷ι ST3101100000000 NN N N 0 N N0000021250000100001NNN00NNN000000100N0900000001270940000000001002017012500000000003698800000000000369880000012 0 NN000001410-00000069-00000137-0096-0000000520250930000000785 NNN +140410 KR7140410002 ST1100600000000NNY NNNYNNNN0NNNNNNNY0001687000000100001NNN01YNN000000100N0900000006312030000000005002012012000000000003036300000000001518195700012 0 NY000000058-00000117-00000122-0103-0000004820250930000051223 NNN +140430 KR7140430000īƼ ST3000000000000 NN N N 0 N N0000008220000100001NNN00NNN000000100N0900000005131160000000001002024050300000000005344700000000000534475390012 0 NN000000317000000016-00000058-0051-0000001920241231000000439 NNN +140520 KR7140520008âƿ ST3100910260000NNN NNNNNNNN0NNNNNNNN0000020800000100001NNN00NNN000000100N0900000000390660000000005002014120500000000002110900000000001055462150012 0 NN000002981000000015-000000100000900000000120250930000000439 NNN +140670 KR7140670001˿̼ ST3100910280000 NN N N 0 N N0000244500000100001NNN00NNN000000100N0900000016846550000000005002017081100000000001283900000000000641992000012 0 NN000000472-00000023-00000028-0028-0000002320250930000003139 NNN +140860 KR7140860008ũý۽ ST1100910290000NNY NNNNNNNN0NNNNNNNY0002985000000100001NNN00NNN000000050Y0900000001220490000000005002015121700000000000699600000000000349823850012 0 NY0000014880000003380000003140028700000002620250930000020884 NNY +141000 KR7141000000Ʈ ST3100910270000NNY NNYNNNNN0NNNNNNNN0000076000000100001NNN00NNN000000100N0900000000522410000000005002012050400000000001211400000000000605735500012 0 NN0000005250000000880000000780006400000000720250930000000920 NNN +141080 KR7141080002͹̿ ST1100600000000NNY NNNYNNNN0NNNNNNNY0002025000000100001NNN00NNN000000100N0900000008516330000000005002013051000000000003661000000000001830516900012 0 NY000001256-00000334-00000270-0270-0000000420250930000074135 NNN +142210 KR7142210004Ʈ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000067200000100001NNN00NNN000000060Y0900000006640350000000005002016020200000000002101000000000001050503550012 0 NN0000057030000002050000001020006500000001020250930000001411 NNY +142280 KR7142280007ڿ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000038750000100001NNN00NNN000000100N0900000001018880000000005002014121700000000002174100000000001087096300012 0 NN0000008340000000250000000170003100000001420250930000000842 NNN +142760 KR7142760008ƶ÷ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000015920000100001NNN00NNN000000100N0900000006927250000000005002016070700000000003989800000000001994920400012 0 NN000000066-00000037-00000091-0091-0000003420250930000000635 NNN +143160 KR7143160000̵ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000179300000100001NNN00NNN000000060Y0900000000346570000000005002011092600000000001071600000000000535819500012 0 NN0000023860000001480000001850015300000000520250930000001921 NNN +143240 KR7143240000 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000130800000100001NNN00NNN000000060Y0900000000152920000000005002012022100000000001170900000000000585463150012 0 NN0000009040000001270000001490012500000000620250930000001531DKGNNN +143540 KR7143540003𿡽 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000009610000100001NNN00NNN000000100N0900000004087600000000005002014102900000000004459900000000002229994750012 0 NN0000004600000000080000000170000600000000220250930000000428 NNN +144510 KR7144510005 ST2100600000000NNY NNNYNNNN0NNNNNNNN0000261500000100001NNN00NNN000000100N0900000000880630000000005002016062300000000001580000000000000790017200012 0 NN000001275-00000095-00000342-0299-0000002120250930000004131 NNN +144960 KR7144960002Ŀ ST2100910270000 NN N N 0 N N0000061000000100001NNN00NNN000000050Y0900000007145700000000001002016113000000000004369200000000000436926240012 0 NN0000042290000002170000001200007300000000020250930000002665 NNY +145020 KR7145020004 ST1100910240000NNY NNNYNNNN0NNNNNNNY0002965000000100001NNN00NNN000000050Y0900000001946400000000005002015122400000000001230400000000000658779800012 0 NY0000030600000014300000014540107100000001720250930000036481FN4NNY +145170 KR7145170007귣 ST3100910200000 NN N N 0 N N0000039950000100001NNN00NNN000000100N0900000000648880000000005002024052300000000001690800000000000857920250012 0 NN00000465700000012700000011100071-0000000120250930000000675 NNN +146060 KR7146060009 ST3100910260000 NN N N 0 N N0000016790000100001NNN00NNN000000100N0900000080184000000000001002023090800000000002401500000000000240155950012 0 NN0000005970000000440000000440004400000000920250930000000403 NNN +146320 KR7146320007񾾿 ST3100910280000 NN N N 0 N N0000148300000100001NNN00NNN000000060Y0900000000882780000000005002022030300000000001279700000000000639896150012 0 NN000000637000000029-0000000500004-0000000220250930000001897 NNN +147760 KR7147760003ǿƼ ST3100910290000 NN N N 0 N N0000033500000100001NNN00NNN000000100N0900000001137330000000005002016121200000000001081900000000000540993300012 0 NN000000244-00000131-00000138-0142-0000003720241231000000362 NNN +147830 KR7147830004 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000071300000100001NNN00NNN000000100N0900000005946210000000005002012021300000000002000000000000001000000000012 0 NN0000002930000000410000000750006200000000820241231000001426 NNN +148150 KR7148150006ũ ST2100910280000 NN N N 0 N N0000049450000100001NNN00NNN000000060Y0900000001747520000000005002019073000000000003554200000000001793021450012 0 NN0000020700000000120000002030019900000001020250930000001757 NNY +148250 KR7148250004˿ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000034000000100001NNN00NNN000000100N0900000002380420000000005002016062200000000000944600000000000485098750012 0 NN000000142-00000026-00000025-0024-0000000820250930000000321 NNN +148780 KR7148780000ťAI ST3000000000000 NN N N 0 N N0000016410000100001NNN00NNN000000100N0900000013632200000000005002022062000000000003144500000000001572286250012 0 NN000000123-00000010-00000008-0008-0000000820250930000000516 NNN +148930 KR7148930001ġƼ ST3100910260000 NN N N 0 N N0000032300000100001NNN00NNN000000100N0900000000358640000000005002022080900000000001017500000000000508760650012 0 NN000000209-00000032-00000002-000400000000120250930000000328 NNN +149950 KR7149950008ƹ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000094500000100001NNN00NNN000000060Y0900000000262250000000005002012110600000000001366700000000000815375000012 0 NN0000008450000000580000000840008900000000620241231000001291 NNN +149980 KR7149980005̷δ ST3100910290000NNN NNNNNNNN0NNYNNNNN0000050900000100001YNY00NNN000000100N0900000000000000000000001002014121700000000001859400000000000185943630012 0 NN00000023700000002400000001800011-0000000820250930000000946 NNN +150840 KR7150840007Ʈθ޵ ST2100910290000NNN NNNNNNNN0NNNNNNNN0000000000000100001NYY00NNN000000100N0900000000000000000000001002013121900000000004299700000000000429979010012 0 NN000000080-00000006-00000010-0010-0000002520250930000000000 NNN +150900 KR7150900009ļ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000040150000100001NNN00NNN000000100N0900000000511010000000005002013101800000000001170300000000000585196100012 0 NN000000296-00000034-00000032-003500000000720250930000000469 NNN +151860 KR7151860004KGڼַ ST2100910300000NNN NNNNNNNN0NNNNNNNN0000064100000100001NNN00NNN000000050Y0900000016798480000000005002013072400000000004760300000000002685336100012 0 NN0000562260000018260000014900119400000000620250930000003051LC4NNY +153460 KR7153460001̺ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000073500000100001NNN00NNN000000100N0900000000074910000000005002012071900000000000653000000000000326500700012 0 NN0000001720000000040000000130001300000000420241231000000479 NNN +153490 KR7153490008츮̾ؿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000006460000100001NNN00NNN000000100N0900000001096490000000005002013020500000000005148000000000002574000000012 0 NN0000009550000000220000000090000900000000220250930000000332 NNN +153710 KR7153710009Ƽ ST3100910240000 NN N N 0 N N0000052400000100001NNN00NNN000000100N0900000000348760000000005002018102600000000001466900000000000733497900012 0 NN000000196-00000025-00000024-0024-0000000920241231000000768 NNN +154030 KR7154030001ƽþ ST3000000000000 NN N N 0 N N0000020400000100001NNN00NNN000000100N0900000000608740000000005002018021200000000001206100000000000603093350012 0 NN0000002780000000090000000120001900000000020250930000000246 NNN +154040 KR7154040000ٻַ翡Ÿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000011900000100001NNN00NNN000000100N0900000000512690000000005002013122700000000001795000000000000897504700012 0 NN000000354000000020-00000206-0193-0000003920241231000000213 NNN +155650 KR7155650005̿ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000038800000100001NNN00NNN000000100N0900000001625960000000005002012111500000000001947400000000000998717900012 0 NN0000012530000000440000000180001600000000420250930000000755 NNN +156100 KR7156100000̹̿ ST3100910290000 NN N N 0 N N0000155600000100001NNN00NNN000000100N0900000002695710000000005002016113000000000002178600000000001089325250012 0 NN000000303000000019-00000009-000400000001320250930000003389 NNN +158430 KR7158430009 ST2000000000000 NN N N 0 N N0000073100000100001NNN00NNN000000060Y0900000023968320000000001002019101700000000002448200000000000248505290012 0 NN0000005130000000710000000500005200000000620250930000001789 NNY +159010 KR7159010008ƽ÷ ST3100910270000 NN N N 0 N N0000051300000100001NNN00NNN000000100N0900000001155180000000005002021100700000000001333400000000000666736950012 0 NN000000543-00000043-00000073-0075-0000001420250930000000684 NNN +159580 KR7159580000 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000039100000100001NNN00NNN000000100N0900000000843040000000005002013021900000000002003200000000001001631800012 0 NN0000005400000000250000000310002100000000220250930000000783 NNN +159910 KR7159910009ڱ۷ο ST3100910230000NNN NNNNNNNN0NNNNNNNN0000006240000100001NNN00NNN000000100N0900000002162930000000001002012122700000000005233500000000000523354850012 0 NN000000091-00000030-00000025-0029-0000003120250930000000326 NNN +160190 KR7160190005˾ؿ ST1100910280000 NY N N 0 N Y0000847000000100001NNN00NNN000000060Y0900000014775550000000005002024062700000000003088800000000001544400000012 0 NY000000508-00000059-00000064-0064-0000001220250930000026162 NNN +160550 KR7160550000NEW ST3101500000000NNN NNNNNNNN0NNNNNNNN0000023100000100001NNN00NNN000000100N0900000001699590000000005002014122300000000002790600000000001395305300012 0 NN00000117400000005100000002700029-0000000620250930000000644 NNN +160980 KR7160980009̸ƽ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000175700000100001NNN00NNN000000060Y0900000004171070000000005002015061700000000001092400000000000546212150012 0 NN0000013530000002100000001910015400000001520250930000001919 NNY +161580 KR7161580006ʿƽ ST1100910270000 NN N N 0 N Y0000532000000100001NNN00NNN000000100N0900000013914850000000005002017060100000000002340200000000001209031450012 0 NN000000770-00000212-00000215-0221-0000000420250930000012450 NNN +162300 KR7162300008Žƿ ST3100910260000 NN N N 0 N N0000017480000100001NNN00NNN000000100N0900000000602870000000001002022122300000000004147100000000000414713820012 0 NN0000027170000000220000000170000800000000420250930000000724 NNN +163280 KR7163280001 ST3100910270000 NN N N 0 N N0000124000000100001NNN00NNN000000100N0900000000752240000000001002024110800000000000680100000000000081747890012 0 NN0000002450000000190000000230002000000000420241231000000843 NNN +163730 KR7163730005ΰ ST3000000000000 NN N N 0 N N0000122900000100001NNN00NNN000000060Y0900000008116200000000005002021012900000000000940600000000000470328400012 0 NN0000006770000000180000000300002700000000620250930000001156 NNN +166090 KR7166090001ϳƼ ST2100910280000 NN N N 0 N Y0000667000000100001NNN00NNN000000050Y0900000003743840000000005002017042800000000001977700000000000988883700012 0 NN0000019260000002920000002670020800000000920250930000013191 NNY +166480 KR7166480004ھƽͿ ST3100910240000NNY NNNYNNNN0NNNNNNNN0000038650000100001NNN01YNN000000100N0900000026136500000000005002015062600000000005287000000000002643518800012 0 NN000000152-00000181-00000167-0168-0000004020250930000002043 NNN +168330 KR7168330009򷲿 ST3100600000000NNY NNNYNNNN0NNNNNNNN0000028600000100001NNN00NNN000000100N0900000001733610000000005002013103100000000003175400000000001587745000012 0 NN000000170-00000025-00000025-0025-0000001220250930000000908 NNN +168360 KR7168360006Ʈ ST2100910270000 NN N N 0 N N0000185100000100001NNN00NNN000000100N0900000002061420000000005002022112400000000002128800000000001064414200012 0 NN000000457-00000017-00000077-0068-0000002620250930000003940 NNN +169330 KR7169330008극 ST3100600000000 NN N N 0 N N0000019590000100001NNN00NNN000000100N0900000000043980000000005002020070100000000001831600000000000915845900006 0 NN00000013600000000300000000300002-0000000220250930000000358 NNN +170030 KR7170030001 ST3100910300000NNN NNNNNNNN0NNNNNNNN0000063400000100001NNN00NNN000000100N0900000001734110000000005002013120400000000001534000000000000767000000012 0 NN0000026910000001120000001420010700000000920250930000000972 NNN +170790 KR7170790000̿ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000087300000100001NNN00NNN000000100N0900000000149620000000005002013080100000000000639700000000000342816500012 0 NN000000414-000000100000000050001500000000820250930000000558 NNN +170920 KR7170920003Ƽ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000272000000100001NNN00NNN000000100N0900000003107090000000005002013100800000000001056400000000000543206300012 0 NN0000020510000002260000001410012100000000920250930000002873 NNN +171010 KR7171010002ũ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000040700000100001NNN00NNN000000100N0900000001544620000000005002013111800000000001429800000000000714937600012 0 NN000000320000000003-00000006-0008-0000000420250930000000581 NNN +171090 KR7171090004ͽý ST2100910270000 NN N N 0 N Y0000580000000100001NNN00NNN000000100N0900000003478670000000005002017092000000000000956100000000000478075200012 0 NN0000029470000005800000006750062500000003820250930000005545 NNN +171120 KR7171120009̿ ST3100910230000NNY NNNNNNNN0NYNNNNNN0000021200000100001NNN00NNN000000100N0900000000568540000000005002013111900000000003590100000000001842222800012 0 NN0000010000000000780000000770006000000000820250930000000761 NNN +172670 KR7172670002̿Ƽ ST3100910280000 NN N N 0 N N0000139100000100001NNN00NNN000000100N0900000001936080000000005002023072700000000000896000000000000448012950012 0 NN000000333-00000082-00000131-0123-0000001520250930000001246 NNN +173130 KR7173130006Ľ ST3000000000000 NN N N 0 N N0000064000000100001NNN00NNN000000100N0900000000712340000000005002018082400000000001304600000000000652323650012 0 NN0000014530000000950000001010008100000002720250930000000834 NNN +173940 KR7173940008 ST3101500000000NNN NNNNNNNN0NNNNNNNN0000038500000100001NNN00NNN000000100N0900000000258020000000005002014120400000000001539200000000000769640400012 0 NN000000674-00000010-00000019-0036-0000002520250930000000592 NNN +174900 KR7174900001Ŭ ST2100910240000 NN N N 0 N N0000658000000100001NNY00NNN000000100N0900000003669460000000005002017091800000000001990800000000000995419700012 0 NN000000023-00000156-00000163-0163-0000005820241231000013099 NNN +175140 KR7175140003޸ũ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000043950000100001NNN00NNN000000100N0900000002482380000000005002015092300000000002494400000000001247212650012 0 NN000000385-00000112-00000119-0118-0000004820250930000001096 NNN +175250 KR7175250000ť ST3100910240000 NN N N 0 N N0000021700000100001YNY00NNN000000100N0900000000000000000000005002018071200000000003755800000000001877918400012 0 NN000000725-00000101-00000162-0162-0000005220250930000000815 NNN +176750 KR7176750008͹̿ ST2100910240000 NN N N 0 N N0000090500000100001NNN00NNN000000060Y0900000000333520000000005002024122000000000002845500000000001460261000012 0 NN0000002790000000450000000400003200000002120250930000002575 NNN +177350 KR7177350006 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000011820000100001NNN00NNN000000100N0900000002394960000000005002015061900000000001965300000000000982688350012 0 NN000000123-000000200000001410014100000003520250930000000232 NNN +177830 KR7177830007Ĺ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000029600000100001NNN00NNN000000100N0900000000842170000000005002014080400000000001349300000000000724697550012 0 NN000001024000000029-000000040000300000000520250930000000399 NNN +177900 KR7177900008̷ ST3100910280000 NN N N 0 N N0000064700000100001NNN00NNN000000100N0900000001101120000000005002024122400000000000958400000000000479240000012 0 NN0000001810000000170000000090008600000002520241231000000620 NNN +178320 KR7178320008ý ST1100910280000 NY N N 0 N Y0000346000000100001NNN00NNN000000060Y0900000013704180000000005002017032700000000005587300000000002814107450012 0 NY000007553-00000224-00001359-1281-0000001620250930000019332 NNY +178780 KR7178780003Ͽ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000025800000100001NNN00NNN000000100N0900000000158080000000005002015063000000000001863900000000000931959750012 0 NN000000070-000000130000000060000300000002420250930000000480 NNN +179290 KR7179290002 ST2100910290000 NN N N 0 N N0000076400000100001NNN00NNN000000060Y0900000002849930000000005002018112900000000003236500000000001637658900012 0 NN0000005380000001760000002240018300000001820241231000002472 NNN +179530 KR7179530001ֵ̿ ST3100910240000 NN N N 0 N N0000018550000100001NNN00NNN000000100N0900000001370940000000005002022012400000000001636000000000000818018950012 0 NN000000099-00000038-00000105-0103-0000035420250930000000303 NNN +179900 KR7179900006Ƽ ST2100910280000 NN N N 0 N Y0000248000000100001NNN00NNN000000100N0900000002441130000000005002017092700000000001979000000000000989520600012 0 NN000000148-00000326-00000335-036300000000020250930000004908 NNN +180400 KR7180400004DXVX ST3100600000000NNN NNNNNNNN0NNYNNNNN0000034350000100001NNY00NNN000000100N0900000003705220000000005002015112000000000009842900000000004921471600012 0 NN000000218-00000214-00000254-0240-3610000020250930000003381 NNN +182360 KR7182360008ť꿣 ST2101500000000NNN NNNNNNNN0NNNNNNNN0000132900000100001NNN00NNN000000060Y0900000001226550000000005002013112100000000001554900000000000807340250012 0 NN000001466-00000053-00000022-0034-0000000120250930000002066 NNY +182400 KR7182400002̸ƽ ST3100910240000NNY NNNYNNNN0NNYNNNNN0000036850000100001YNY00NNN000000100N0900000000000000000000005002015102300000000007137800000000003568926750012 0 NN000000057-00000012-00000066-006600000001620250930000002630 NNN +183300 KR7183300003ڹ ST1100910270000 NN N N 0 N Y0001260000000100001NNN00NNN000000060Y0900000003084820000000005002017032300000000001046000000000000523034200012 0 NN0000044000000008730000007390056700000002420250930000013180 NNY +183490 KR7183490002ͻ ST3100910240000 NN N N 0 N N0000013180000100001NNN00NNN000000100N0900000009327590000000005002018022100000000008506500000000004253278100012 0 NN000000537-00000100-00000082-0082-0000001520250930000001121 NNN +184230 KR7184230001SGAַ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000006220000100001NNN00NNN000000100N0900000002440610000000001002013122000000000008877600000000000887769930012 0 NN00000038300000006100000004300047-0000000120250930000000552 NNN +185490 KR7185490000 ST3100600000000NNN NNNNNNNN0NNNNNNNN0000015550000100001NNN00NNN000000100N0900000002034350000000005002015111600000000004322900000000002161489200012 0 NN000000028-00000066-00000070-0070-0000002020250930000000672 NNN +186230 KR7186230009׸÷ ST3100910260000 NN N N 0 N N0000054600000100001NNN00NNN000000100N0900000000601250000000005002019080700000000001092000000000000546009400012 0 NN000000758000000004-00000019-002700000000320250930000000596 NNN +187220 KR7187220009Ƽؾ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000024200000100001NNN00NNN000000100N0900000000492740000000005002014121700000000001169800000000000584901050012 0 NN000000908-00000015-00000029-004500000000220250930000000283 NNN +187270 KR7187270004ȭ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000036000000100001NNN00NNN000000100N0900000001410290000000005002014080800000000001014300000000000507192250012 0 NN0000003920000000480000000390003100000000820250930000000365 NNN +187420 KR7187420005HLBؽ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000028500000100001NNN00NNN000000100N0900000001098530000000005002015052900000000002917300000000001458655650012 0 NN00000030900000001900000014100139-0000001120250930000000831 NNN +187660 KR7187660006ADM ST3100600000000 NN N N 0 N N0000029300000100001NNN00NNN000000100N0900000128140770000000001002021060300000000005546600000000000554662530012 0 NN000000097-00000159-00000182-0203-0000011820241231000001625 NNN +187790 KR7187790001 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000035950000100001NNN00NNN000000100N0900000009269930000000005002014050800000000003084000000000001542041500012 0 NN0000006390000000530000000980009800000006720250930000001108 NNN +187870 KR7187870001̽ ST3100910270000 NN N N 0 N N0000154500000100001NNN00NNN000000100N0900000000677960000000005002017122000000000000703600000000000351830450012 0 NN0000005700000001480000001590012700000001520250930000001087 NNN +188040 KR7188040000̿Ʈ ST3100910190000 NN N N 0 N N0000074600000100001NNN00NNN000000100N0900000000325440000000002002025051600000000000467900000000000093586160012 0 NN000000552000000013-00000014-001400000000020250930000000349 NNN +188260 KR7188260004 ST3100910310000 NN N N 0 N N0000020100000100001NNN00NNN000000100N0900000000347060000000005002023110300000000000722800000000000361423500012 0 NN000000240-00000051-00000051-0051-0000004220241231000000145 NNN +189300 KR7189300007ڸũ ST2100910280000 NN N N 0 N Y0000870000000100001NNN00NNN000000060Y0900000003263130000000005002016101800000000001073300000000000536666700012 0 NN000001953-00000079-00000155-0148-0000000120250930000009338 NNY +189330 KR7189330004̷ ST3000000000000 NN N N 0 N N0000045500000100001NNN00NNN000000100N0900000000676870000000005002021022400000000000938200000000000469114200012 0 NN000000053-00000030-00000027-0027-0000001620250930000000426 NNN +189690 KR7189690001ÿ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000020400000100001NNN00NNN000000100N0900000000899020000000005002015021100000000002732100000000001366098450006 0 NN0000000750000000010000000030000300000000620250930000000557 NNN +189860 KR7189860000 ST3100910280000NNN NNNNNNNN1NNYNNNNN0000043850000100001NNN00NNN000000100N0900000003733930000000005002014122400000000000969800000000000484939000012 0 NN000000633000000006-000000020001100000000420241231000000425 NNN +189980 KR7189980006ﱹ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000015500000100001NNN00NNN000000100N0900000000823570000000001002015080700000000004013700000000000401378270012 0 NN0000007820000000800000000750005900000000620250930000000622 NNN +190510 KR7190510008 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000240500000100001NNN00NNN000000060Y0900000003522640000000005002015111200000000001404500000000000834343150012 0 NN0000036380000002460000002560021500000001820250930000003377 NNY +190650 KR7190650002ڸƿ ST3101400000000 NN N N 0 N N0000074400000100001NNN00NNN000000100N0900000000143860000000050002019112000000000000638800000000003194000000003 0 NN0000026850000001030000001110007700000000820250331000000475 NNN +191410 KR7191410000Ͼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000036450000100001NNN00NNN000000100N0900000016930960000000005002015122400000000001120400000000000560212750012 0 NN000000351-000000110000001140011200000004520250930000000408 NNN +191420 KR7191420009װ̾ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000150400000100001NNN00NNN000000100N0900000000203270000000005002014110600000000000810800000000000405441700012 0 NN000000045-00000023-00000021-0020-0000000620250930000001219 NNN +192250 KR7192250009̻ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000106000000100001NNN00NNN000000100N0900000001105920000000010002014042800000000000706700000000000706712500012 0 NN000000265-00000031-00000029-0034-0000000120250930000000749 NNN +192390 KR7192390003 ST3100910260000NNN NNNNNNNN0NNNNNNNN0000021900000100001NNN00NNN000000100N0900000000251350000000005002014072500000000001103200000000000551611450012 0 NN000000619-00000026-00000047-0049-0000001120250930000000241 NNN +192410 KR7192410009̿ ST3100910280000NNN NNNNNNNN0NNYNNNNN0000008370000100001NNN00NNN000000100N0900000001534660000000001002014081400000000004666100000000000466615730012 0 NN000000128-00000011-00000685-0685-3610000020250930000000390 NNN +192440 KR7192440006ǰڸ ST3100910310000NNN NNNNNNNN0NNNNNNNN0000226000000100001NNN00NNN000000100N0900000000101050000000005002014110500000000000621600000000000310818150012 0 NN0000033480000001940000002160019000000000620250930000001404 NNN +193250 KR7193250008ũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000004270000100001NNN00NNN000000100N0900000006492270000000001002014122900000000006459200000000000645924130012 0 NN000000070-00000053-00000125-0123-0000003420250930000000275 NNN +194480 KR7194480000ý ST2000000000000NNN NNNNNNNN0NNNNNNNY0000418500000100001NNN00NNN000000060Y0900000002388910000000005002014100600000000001212900000000000610157500012 0YNN0000023590000001880000002220022100000001220250930000005076 NNN +194700 KR7194700001ٷ ST2100910190000 NN N N 0 N N0000141900000100001NNN00NNN000000060Y0900000000593140000000005002018111400000000001875400000000000937742400012 0 NN0000030360000003230000003200027400000001620250930000002661 NNY +195500 KR7195500004Ŀ ST3100910190000 NN N N 0 N N0000027750000100001NNN00NNN000000100N0900000000329050000000005002019082000000000001597800000000000798900000012 0 NN0000010770000000380000000360003000000000420241231000000443 NNN +195940 KR7195940002HK̳뿣 ST1100910240000 NY N N 0 N Y0000545000000100001NNN00NNN000000050Y0900000003732310000000005002021080900000000002832900000000001445224950012 0 NY0000089710000008820000007170061600000000520241231000015439 NNY +195990 KR7195990007̺ι̿ ST3100910270000NNN NNNNNNNN0NNYNNNNN0000001870000100001NNN00NNN000000100N0900000020395730000000005002015041300000000028468900000000014234486050012 0 NN000000259-00000075-00000478-0478-0000007320250930000000532 NNN +196170 KR7196170005׿ ST1100600000000NNY YNNYNNNN0NNNNNNNY0004350000000100001NNN00NNN000000050Y0900000017429350000000005002014121200000000005350500000000002675289400012 0 NY0000015140000008730000009350070700000004620250930000232750 NNY +196300 KR7196300008HLB ST3100910240000 NN N N 0 N N0000084500000100001NNY00NNN000000100N0900000000155450000000005002016120700000000000929300000000000464669900012 0 NN000000062-00000054-00000068-0068-0000008520241231000000785 NNN +196450 KR7196450001ھƽþƾ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000008400000100001NNN00NNN000000100N0900000003353660000000010002014060200000000004531900000000004531958200012 0 NN00000209900000003900000003200029-0000001520250930000000380 NNN +196490 KR7196490007ũ ST3100910270000NNN NNNNNNNN0NNYNNNNN0000002030000100001YNY00NNN000000100N0900000000000000000000005002014111900000000017854900000000008927468000012 0 NN00000030400000006700000004100041-3610000020250930000000362 NNN +196700 KR7196700009 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000023200000100001NNN00NNN000000100N0900000006686260000000005002015082400000000001436400000000000718207200012 0 NN0000003310000000400000000290002800000000820250930000000333 NNN +197140 KR7197140007ĸ ST3000000000000 NN N N 0 N N0000022400000100001NNN00NNN000000100N0900000000124120000000005002018090700000000001301300000000000650657700012 0 NN000000320-000000160000000030001200000000220241231000000291 NNN +198080 KR7198080004ij ST3100910280000 NN N N 0 N N0000024500000100001NNN00NNN000000100N0900000001579320000000005002020031600000000002153500000000001076759250012 0 NN0000021260000001590000001460013300000001320250930000000527 NNN +198440 KR7198440000ؿ ST3100910250000NNN NNNNNNNN0NNNNNNNN0000010500000100001NNN00NNN000000100N0900000001551530000000001002014081300000000006093100000000000609318960012 0 NN000000474000000056-00000090-0077-0000000720241231000000639 NNN +198940 KR7198940009ֶƮŻ ST3100910260000 NN N N 0 N N0000007750000100001NNN00NNN000000100N0900000004036320000000005002023011900000000003892200000000001946148900012 0 NN000002005000000042-00000008-0005-0000000120250930000000301 NNN +199430 KR7199430000̿˽ý ST3100910290000 NN N N 0 N N0000351000000100001NNN00NNN000000100N0900000003749000000000001002024030700000000001099800000000000109980430012 0 NN000000063-00000071-00000074-0074-0000003320250930000003860 NNN +199480 KR7199480005ũ۷ι ST3000000000000 NN N N 0 N N0000063000000100001NNN01NNN000000100N0900000007408920000000005002024081200000000001019600000000000509829400012 0 NN000000461-00000029-00000031-0029-0000003520250930000000642 NNN +199550 KR7199550005 ST3100910290000 NN N N 0 N N0000063800000100001NNN00NNN000000100N0900000000640690000000005002024020100000000001226500000000000613289550012 0 NN000000190-00000076-00000082-0082-0000003020250930000000782 NNN +199730 KR7199730003̿ ST3100600000000 NN N N 0 N N0000047700000100001NNN00NNN000000100N0900000000162720000000005002023030200000000000486400000000000243218350012 0 NN000000238-00000051-00000059-0040-0000001320241231000000232 NNN +199800 KR7199800004 ST2100600000000 NN N N 0 N N0000586000000100001NNN00NNN000000100N0900000000255260000000005002021121000000000000897500000000000448751850012 0 NN000000009-00000164-00000143-014300000002420250930000005259 NNN +199820 KR7199820002ϷƮ ST2100910280000 NN N N 0 N N0000102500000100001NNN00NNN000000060Y0900000005114070000000005002020112600000000002222000000000001111000000012 0 NN0000015150000001200000001030008500000000720250930000002277 NNN +200130 KR7200130003ݸؿġ ST2100910240000NNN NNNNNNNN0NNNNNNNY0000146300000100001NNN00NNN000000050Y0900000002309400000000005002014072300000000002941500000000001477177900012 0 NN0000045270000002400000002000014300000000420250930000004303 NNY +200230 KR7200230001RF ST3100910240000NNN NNNNNNNN0NNNNNNNN0000010170000100001NNN00NNN000000100N0900000008321310000000010002014112400000000006852300000000006852353300012 0 NN000000298-00000019-00000213-0213-0000003420250930000000696 NNN +200350 KR7200350007ƼƮƩ ST3101500000000 NN N N 0 N N0000055000000100001NNN00NNN000000100N0900000000357590000000005002021123000000000000999600000000000499801250012 0 NN000000115-00000024-00000017-0017-0000002620250930000000549 NNN +200470 KR7200470003Ʈ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000093000000100001NNN00NNN000000100N0900000056142810000000005002014122600000000004236200000000002118104650012 0 NN000000867-00000215-00000489-0507-0000006620241231000003939 NNN +200670 KR7200670008޸޵ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000426500000100001NNN00NNN000000050Y0900000001080240000000005002014122600000000001122900000000000561496500012 0 NN0000016190000004310000004840039300000001820241231000004789 NNY +200710 KR7200710002̵ũ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000394500000100001NNN00NNN000000100N0900000005500440000000005002014121600000000001344000000000000701516950012 0 NN000001035000000001-00000020-0019-0000000820250930000005302 NNN +200780 KR7200780005񾾿 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000050400000100001NNN00NNN000000100N0900000000259010000000002002014121500000000000973600000000000194724800012 0 NN000000555000000013-00000026-0031-0000000520250930000000490 NNN +201490 KR7201490000 ST3000000000000 NN N N 0 N N0000040700000100001NNN00NNN000000060Y0900000041584380000000005002016101000000000003259300000000001673074400012 0 NN00000068100000009600000011100096-0000000020250930000001326 NNN +203400 KR7203400007̺ ST3100600000000 NN N N 0 N N0000036550000100001NNN00NNN000000100N0900000021747140000000005002021090800000000009010100000000004505065200012 0 NN000000008-00000137-00000216-0216-0000036120250930000003293 NNN +203450 KR7203450002Ͽ¹̿Ʈ ST3100910280000 NN N N 0 N N0000034600000100001NNN00NNN000000100N0900000001385610000000005002016120700000000001407900000000000733950350012 0 NN0000003790000000100000000130001600000001320250930000000487 NNN +203650 KR7203650007帲ťƼ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017150000100001NNN00NNN000000100N0900000006594030000000001002014101300000000009563200000000000984221760012 0 NN0000022420000001240000000360004100000001320250930000001640 NNN +203690 KR7203690003ũַǽ ST3100910210000NNY NNNYNNNN0NNNNNNNN0000044250000100001YNY00NNN000000100N0900000000000000000000005002014093000000000002015700000000001007866000012 0 NN000000130-00000051-00000077-0077-0000004020250930000000891 NNN +204020 KR7204020002׸Ƽ ST3100910200000 NN N N 0 N N0000021100000100001NNN00NNN000000100N0900000000350860000000005002018072300000000001945000000000001039304900012 0 NN0000015960000000720000000640005100000000620250930000000410 NNN +204270 KR7204270003̾Ƽ ST1100910280000 NY N N 0 N Y0000242000000100001NNN00NNN000000100N0900000008274190000000005002020030400000000005784800000000002892423300012 0 NY000001432-00000559-00000702-0733-0000002920250930000013999 NNN +204610 KR7204610000Ƽ ST3000000000000 NN N N 0 N N0000019100000100001NNN00NNN000000100N0900000001913900000000001002022111700000000005869100000000000683917200012 0 NN0000005240000001240000001470012500000001520250930000001121 NNN +204620 KR7204620009۷ιؽ ST2101400000000NNN NNNNNNNN0NNNNNNNN0000044750000100001NNN00NNN000000060Y0900000020541940000000005002014111900000000007028300000000003514166500012 0 NN0000012430000002160000002720021600000001920250930000003145 NNN +204630 KR7204630008ƩŸŬν ST3101500000000NNN NNNNNNNN0NNYNNNNN0000046500000100001YNY00NNN000000100N0900000000000000000000005002014122900000000000508900000000000254497050012 0 NN000000114-00000025-00000052-0052-0000005620250930000000236 NNN +204840 KR7204840003 ST3101100000000NNN NNNNNNNN0NNNNNNNN0000010750000100001NNN00NNN000000100N0900000003630390000000001002014112000000000007754900000000000775490060012 0 NN0000002570000000060000000020000200000000220250930000000833 NNN +205100 KR7205100001 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000021550000100001NNN00NNN000000060Y0900000014941020000000001002014110700000000007146200000000000719634310012 0 NN000000378-00000020-00000008-000900000000820250930000001540 NNY +205470 KR7205470008޸ý ST3100910240000NNN NNNNNNNN0NNNNNNNN0000010290000100001NNN00NNN000000100N0900000019485330000000001002014120100000000012937500000000001296884890012 0 NN000000237-00000072-00000088-0093-0000001620250930000001331 NNN +205500 KR7205500002ؽᾲ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000022950000100001NNN00NNN000000100N0900000004220510000000005002014111200000000006121200000000003060614400012 0 NN000000251000000008-00000016-0012-0000000820250930000001404 NNN +206400 KR7206400004Ƽؾ ST3101000000000NNN NNNNNNNN0NNNNNNNN0000017220000100001NNN00NNN000000100N0900000001992140000000005002014121000000000003751000000000001875507900012 0 NN000000038-00000038-00000180-0180-0000002620250930000000645 NNN +206560 KR7206560005 ST3101500000000NNN NNNNNNNN0NNNNNNNN0000041500000100001NNN00NNN000000100N0900000001200680000000005002015122200000000002541100000000001270586800012 0 NN000000399-00000068-00000073-0073-0000002820250930000001054 NNN +206640 KR7206640005ٵظ޵ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000131100000100001NNN00NNN000000050Y0900000001081650000000010002014122900000000002348600000000002348656000012 0 NN0000012050000002390000002690022500000001320250930000003079 NNY +206650 KR7206650004̿ ST2100910240000 NN N N 0 N N0000118700000100001NNN00NNN000000050Y0900000001805360000000005002017012400000000003667200000000001833615350012 0 NN0000009600000003430000001850019000000001620241231000004353 NNY +207760 KR7207760000̽ͺ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000012990000100001NNN00NNN000000060Y0900000004759920000000001002014121200000000008307900000000000830797830012 0 NN000000510-00000029-00000025-0021-0000001720250930000001079 NNN +208140 KR7208140004ٿ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000025500000100001NNN00NNN000000100N0900000000931800000000001002014121700000000003268400000000000326842460012 0 NN0000012660000000630000000730005600000000520250930000000833 NNN +208340 KR7208340000ĸ ST2100910240000 NN N N 0 N N0000000000000100001NYY00NNN000000100N0900000000000000000000005002018112100000000008020100000000004010055400012 0 NN00000011300000000000000002600026-0000000220250930000000000 NNN +208350 KR7208350009ťƼ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000029950000100001NNN00NNN000000100N0900000000342110000000005002014122400000000000850100000000000441927450012 0 NN000000246-00000018-00000011-0002-0000000320250930000000254 NNN +208370 KR7208370007ٽコɾ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000057600000100001NNN00NNN000000060Y0900000006892320000000005002014121700000000002574000000000001287028200012 0 NN000000206-000000010000000020000200000000420250930000001482 NNY +208640 KR7208640003濡 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000002880000100001NNN00NNN000000100N0900000016093260000000001002014122900000000013924000000000001392402540012 0 NN000000050-00000067-00000059-0059-0000002920250930000000401 NNN +208710 KR7208710004 ST3100910280000NNN NNNNNNNN0NNNNNNNN0000024600000100001NNN00NNN000000100N0900000001861690000000005002014122400000000001318000000000000659006600012 0 NN000000881-00000025-00000057-0062-0000001720250930000000324 NNN +208860 KR7208860007ٻ𿥾 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000015190000100001NNN00NNN000000100N0900000002766610000000005002016072800000000003394900000000001697498650012 0 NN0000007830000000370000000380003100000000020250930000000515 NNN +209640 KR7209640002̸ũ ST3100910270000 NN N N 0 N N0000042250000100001NNN00NNN000000100N0900000009112730000000005002024101800000000002844300000000001426157300012 0 NN000000284-00000040-00000048-005100000000020250930000001201 NNN +210120 KR7210120002ĵ ST3101500000000 NN N N 0 N N0000019260000100001NNN00NNN000000100N0900000009582770000000002002023081700000000002423700000000000484749560012 0 NN000000096-00000051-00000042-0070-0000003520241231000000466 NNN +211050 KR7211050000ī ST2101400000000 NN N N 0 N Y0000151900000100001NNN00NNN000000060Y0900000004223910000000001002022021600000000004926300000000000513798000012 0 NN0000073970000007080000007130054200000004120250930000007483 NNN +211270 KR7211270004AP ST3100910280000NNN NNNNNNNN1NNNNNNNN0000189600000100001NNN00NNN000000060Y0900000007928440000000005002016030400000000001508200000000000754115200012 0 NN0000005860000000730000001340010400000001020241231000002859 NNN +212560 KR7212560007׿ ST3100910300000NNN NNNNNNNN0NNNNNNNN0000107900000100001NNN00NNN000000100N0900000003138980000000005002015111800000000001181200000000000590612050012 0 NN0000021860000001260000002110017700000001520241231000001274 NNN +212710 KR7212710008̿Ƽ ST3100910280000 NN N N 0 N N0000091900000100001NNN00NNN000000100N0900000003433440000000005002025021200000000000962200000000000481148900012 0 NN000000189-00000017-00000022-0016-0000000920250930000000884 NNN +213420 KR7213420003׿轺 ST1100910280000NNY NNNNNNYN0NNNNNNNY0000395000000100001NNN00NNN000000050Y0900000003581080000000002002015020600000000002483100000000000496623580012 0 NY0000021720000003770000003950031300000001220250930000009808 NNY +214150 KR7214150005Ŭý ST1100910290000NNY NNNNNNNN0NNNNNNNY0000679000000100001NNN00NNN000000050Y0900000007188260000000001002015040300000000006550500000000000662828420012 0 NY0000024340000011940000011430089300000002720250930000044478 NNN +214180 KR7214180002̳뺣̼ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000196900000100001NNN00NNN000000050Y0900000009484450000000005002015063000000000001299300000000000678859250012 0 NN0000027700000003980000004340034600000001420250930000002558 NNY +214260 KR7214260002Ľ ST3100910230000 NN N N 0 N N0000131100000100001NNN00NNN000000100N0900000000387590000000005002019111100000000000892200000000000446123150012 0 NN000000248-00000021-00000030-002900000000220250930000001169 NNN +214270 KR7214270001FSN ST3000000000000NNN NNNNNNNN0NNNNNNNN0000018820000100001NNN00NNN000000100N0900000001569330000000005002015032500000000004369000000000002184547950012 0 NN00000205100000026300000023200156-0000001320250930000000822 NNN +214370 KR7214370009ɾ ST1100910240000NNY NNNYNNNN0NNNNNNNY0001092000000100001NNN00NNN000000060Y0900000003615160000000001002015111700000000005371500000000000537150000012 0 NY0000005650000002750000002720023400000001320250930000058656 NNY +214430 KR7214430001̾ý ST1100910280000NNN NNNNNNNN0NNNNNNNY0001173000000100001NNN00NNN000000050Y0900000001745020000000005002015073000000000000730700000000000368088750012 0 NN0000012070000001480000001640015000000001520241231000008571 NNY +214450 KR7214450009ĸġ ST1100910240000NNY YNNYNNNN0NNNNNNNY0005150000000100001NNN00NNN000000050Y0900000002409280000000005002015072400000000001038900000000000525480000012 0 NY0000039290000016250000016660128900000002620250930000053506 NNY +214610 KR7214610008Ѹ ST3100910290000 NN N N 0 Y N0000034750000100001NNN00NNN000000100N0900000000222790000000005002020102200000000000838300000000000419166100012 0 NN000000035-00000063-00000094-0094-0000012120250930000000291 NNN +214680 KR7214680001 ST3100910290000NNN NNNNNNNN0NNNNNNNN0000021150000100001NNN00NNN000000100N0900000009945380000000001002015042000000000008347700000000000834770560012 0 NN000000930-00000009-00000090-0075-0000001620250930000001765 NNN +215000 KR7215000001 ST2000000000000NNN NNNNNNNN0NNNNNNNY0000602000000100001NNN00NNN000000050Y0900000000599580000000005002015040300000000000627500000000000313770750012 0 NN0000037170000006180000006270042500000000820250930000003777 NNY +215090 KR7215090002ֵ潺 ST3100910290000NNN NNNNNNNN0NNNNNNNN0000029250000100001NNN00NNN000000100N0900000003548430000000005002015042800000000002315500000000001157783050012 0 NN0000002030000000120000000200002000000000020250930000000677 NNN +215100 KR7215100009κκ ST3100910280000NNN NNNNNNNN1NNNNNNNN0000111000000100001NNN00NNN000000100N0900000024682630000000001002015042200000000002034800000000000203484540012 0 NN000000097-00000012-00000007-0007-0000000220250930000002258 NNN +215200 KR7215200007ް͵ ST2100600000000NNN NNNNNNNN0NNNNNNNY0000462000000100001NNN00NNN000000050Y0900000001023110000000001002015050400000000001036500000000000118618800012 0YNN0000068840000011200000011670088700000001020250930000004788 NNN +215360 KR7215360009츮 ST3100910300000NNY NYNNNNNN0NNNNNNNN0000088300000100001NNN00NNN000000100N0900000000445650000000005002015050600000000000913200000000000456608150012 0 NN0000039960000001300000000910007500000001120250930000000806 NNN +215380 KR7215380007̿ ST3100600000000NNN NNNNNNNN0NNNNNNNN0000022650000100001NNN00NNN000000100N0900000002333220000000005002015051800000000001682900000000000841478800012 0 NN0000004320000000180000000020000200000000120241231000000381 NNN +215480 KR7215480005ڽڸ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000020850000100001NNN00NNN000000100N0900000000313470000000005002015051300000000000918000000000000480747850012 0 NN000000294000000001-00000001-0004-0000000420250930000000191 NNN +215600 KR7215600008Ŷ ST2100600000000 NN N N 0 N N0000038300000100001NNN00NNN000000100N0900000041826950000000005002016120600000000013812900000000006906491800012 0 NN000000063-00000174-00000160-0164-0000001820250930000005290 NNN +215790 KR7215790007̳νƮƮ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000005800000100001NNN00NNN000000100N0900000001953060000000005002015050800000000004028300000000002014157450012 0 NN000000342-00000068-00000081-0082-0000005420250930000000233 NNN +216050 KR7216050005ũν ST3100600000000 NN N N 0 N N0000069900000100001NNN00NNN000000100N0900000000656790000000005002016103100000000001284300000000000642161100012 0 NN0000003350000000790000001060008400000000920250930000000897535NNN +216080 KR7216080002׸ ST2100910240000 NN N N 0 N N0000095300000100001NNN00NNN000000100N0900000006009700000000005002019111400000000003600700000000001800375900012 0 NN000000565000000026-00000098-0094-0000000720250930000003431 NNN +217190 KR7217190008ʼ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000055000000100001NNN00NNN000000100N0900000001887340000000005002015092500000000001315300000000000657688050012 0 NN0000004280000000100000000020000200000000520250930000000723 NNN +217270 KR7217270008ƪ ST2000000000000NNN NNNNNNNN0NNNNNNNN0000053900000100001NNN00NNN000000060Y0900000000908530000000005002015061800000000004673500000000002336782150012 0 NN000000954000000041-00000069-0072-0000001620250930000002519LC2NNN +217330 KR7217330000 ST3100600000000 NN N N 0 N N0000082500000100001NNN00NNN000000100N0900000006020210000000005002018112200000000002312900000000001156477350012 0 NN000000195-00000056-00000070-0069-0000003120250930000001908 NNN +217480 KR7217480003 ST3100910230000 NN N N 0 N N0000004990000100001YNY00NNN000000100N0900000000000000000000002002017030200000000010973300000000002194662820012 0 NN000000237-00000048-00000042-0045-0000002720250930000000547 NNN +217500 KR7217500008 ST3100910270000NNN NNNNNNNN1NNNNNNNN0000041800000100001NNN02NNN000000100N0900000014911910000000001002015061600000000003181200000000000318120000012 0 NN000000139-00000028-00000034-003300000000020250930000001329 NNN +217620 KR7217620004Ǫ ST3100600000000NNN NNNNNNNN0NNYNNNNN0000038100000100001YNY00NNN000000100N0900000000000000000000001002015061000000000000703500000000000070350870012 0 NN000000352-00000067-00000073-0073-3610000020241231000000268 NNN +217730 KR7217730001۹̿ ST3100910240000NNN NNNNNNNN0NNNNNNNN0000021500000100001NNN00NNN000000100N0900000012173710000000005002015122100000000009405400000000004702707450012 0 NN000000077-00000148-00000071-0080-0000001820241231000002022 NNN +217820 KR7217820000Ǿ ST3100910270000NNN NNNNNNNN0NNNNNNNN0000040900000100001NNN00NNN000000060Y0900000005711610000000005002015120700000000004745400000000002372727950012 0 NN0000031670000001120000000930009300000001120250930000001940140NNN +218150 KR7218150001̷ڿ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000030100000100001NNN00NNN000000100N0900000000677200000000001002015061800000000002041500000000000204158020012 0 NN0000005020000000190000000200002000000000120250930000000614 NNN +218410 KR7218410009RFHIC ST1100910280000NNN NNNNNNNN0NNNNNNNY0000445500000100001NNN00NNN000000050Y0900000006887860000000005002015063000000000002650300000000001340271700012 0 NN0000011700000001940000002480019900000000520250930000011807 NNY +219130 KR7219130002Ÿ̰Ϸ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000352000000100001NNN00NNN000000100N0900000000509540000000005002015092500000000000631400000000000315714500012 0 NN000000618-000000190000000050000300000000120241231000002222 NNN +219420 KR7219420007ũϽý ST3000000000000 NN N N 0 N N0000059900000100001NNN00NNN000000100N0900000006417860000000001002018020500000000001146900000000000114695070012 0 NN0000001040000000060000000230001800000000120250930000000687 NNN +219550 KR7219550001̵ ST3101100000000NNN NNNNNNNN0NNYNNNNN0000017590000100001NNY00NNN000000100N0900000003586750000000001002015072200000000003127700000000000312776690012 0 NN000000318-00000009-00000150-015000000000020250930000000550 NNN +219750 KR7219750007ѱƼ ST3100910290000 NN N N 0 N N0000007730000100001NNN00NNN000000100N0900000001470430000000001002018092100000000006542600000000000654268850012 0 NN000000301000000010000000000-0002-0000000120241231000000505 NNN +220100 KR7220100002ǻ ST2100910240000 NN N N 0 N N0000258500000100001NNN00NNN000000100N0900000002814710000000005002016120100000000002242700000000001121371000012 0 NN000000125-00000063-00000037-0037-0000000820250930000005797 NNN +220180 KR7220180004ڵƮ ST3000000000000 NN N N 0 N N0000019000000100001NNN00NNN000000100N0900000000883920000000005002016112400000000002393000000000001196542100012 0 NN000000213-000000110000000030000300000000420250930000000454 NNN +220260 KR7220260004Ʈν ST3100910230000NNN NNNNNNNN0NNNNNNNN0000068500000100001NNN00NNN000000060Y0900000023857420000000001002015072700000000002655800000000000265583070012 0 NN0000005030000000380000000540005100000000820241231000001819 NNN +221800 KR7221800006̿ ST3100600000000 NN N N 0 N N0000048900000100001NNN00NNN000000100N0900000002252500000000005002023110200000000001354400000000000677209800012 0 NN000000250-00000031-00000016-0028-0000000820241231000000662 NNN +221840 KR7221840002װ ST3100910300000NNN NNNNNNNN0NNYNNNNN0000023750000100001NNN00NNN000000100N0900000001466070000000005002015112500000000001870000000000000935028050012 0 NN00000057800000003200000001500015-0000001220250930000000444 NNN +221980 KR7221980006̵ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000105600000100001NNN00NNN000000100N0900000000059250000000005002015111900000000000403400000000000201740000012 0 NN0000004780000000570000000260002800000000520250930000000426 NNN +222040 KR7222040008ڽƽƼ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000032150000100001NNN00NNN000000100N0900000000467490000000005002015121600000000002062800000000001031400000012 0 NN000002135000000022-00000106-0126-0000002620250930000000663 NNN +222080 KR7222080004̿ ST2100910270000NNN NNNNNNNN2NNNNNNNY0000118600000100001NNN01YNN000000100N0900000026331400000000001002015090200000000007737100000000000773718390012 0 NN0000032510000002590000002380017800000001220250930000009176 NNN +222110 KR7222110009 ST3100910240000NNN NNNNNNNN0NNNNNNNN0000056300000100001NNN00NNN000000100N0900000000097830000000005002016031100000000001349400000000000674709850012 0 NN0000001470000000100000000100000900000000520241231000000759 NNN +222160 KR7222160004NPX ST3100910270000 NN N N 0 N N0000080400000100001YNY00NNN000000100N0900000000000000000000005002021111800000000000989400000000000502537300012 0 NN000000030-00000061-00000072-0072-0000005220250930000000795 NNN +222420 KR7222420002 ST3100910250000NNN NNNNNNNN0NNNNNNNN0000014400000100001NNN00NNN000000100N0900000062931960000000001002015080600000000004546000000000000454602310012 0 NN000000315000000010-00000019-0025-0000000720241231000000654 NNN +222800 KR7222800005 ST1100910280000NNN NNNNNNNN0NNNNNNNY0000597000000100001NNN00NNN000000060Y0900000035311000000000005002015080700000000003734200000000001867110900012 0 NN000010172000000016-00000550-0478-0000001420250930000022293 NNN +222810 KR7222810004Ǿ ST3100910260000NNN NNNNNNNN0NNYNNNNN0000054000000100001YNY00NNN000000100N0900000000000000000000005002015081300000000001513100000000000756593500012 0 NN000000117-00000047-00000068-0068-3610000020250930000000817 NNN +222980 KR7222980005ѱƳƼ ST3100910190000NNN NNNNNNNN0NNNNNNNN0000029750000100001NNN00NNN000000100N0900000000219290000000005002015122300000000001103100000000000551574150012 0 NN000000743-00000005-00000008-0010-0000000620250930000000328 NNN +223250 KR7223250002帲̿ ST3100600000000 NN N N 0 N N0000064000000100001NNN00NNN000000060Y0900000003123970000000005002020052200000000002379900000000001189966200012 0 NN0000004730000000560000001970015900000002520250930000001523 NNN +223310 KR7223310004Ȧ ST3101100000000NNN NNNNNNNN0NNNNNNNN0000021850000100001NNN00NNN000000100N0900000000816990000000001002015122400000000002602300000000000260232140012 0 NN000000143-00000052-00000173-0174-0000006820250930000000568 NNN +224060 KR7224060004ڵ ST3100910270000NNN NNNNNNNN0NNYNNNNN0000039500000100001NNN00NNN000000100N0900000003659630000000005002015122900000000000516000000000000258036100012 0 NN000000201000000001-00000027-0060-0000001120250930000000203 NNN +224110 KR7224110007ظƼ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000099700000100001NNN00NNN000000100N0900000000218400000000005002015082500000000000534000000000000267000000012 0 NN0000001280000000090000000140001300000001120250331000000532 NNN +225190 KR7225190008LK ST3100910290000 NN N N 0 N N0000014870000100001NNN00NNN000000100N0900000018947110000000001002017060200000000007046800000000000704684400012 0 NN000000163-00000081-00000085-0060-0000003220250930000001047 NNN +225220 KR7225220003 ST3100910240000 NN N N 0 N N0000019840000100001NNN00NNN000000100N0900000001772940000000005002020072400000000001919000000000000959501050012 0 NN000000070-00000066-00000073-0073-0000001020250930000000380 NNN +225430 KR7225430008̿ ST3100910230000NNN NNNNNNNN0NNNNNNNN0000005420000100001NNN00NNN000000100N0900000000994050000000001002015100800000000002788700000000000278870500012 0 NN000000145-00000026-00000042-0046-0000001320241231000000151 NNN +225530 KR7225530005HC ST3100910250000NNN NNNNNNNN0NNNNNNNN0000028450000100001NNN00NNN000000100N0900000000630410000000005002015121700000000003633800000000001816936350012 0 NN000000275-00000022-00000020-0015-0000000420250930000001033 NNN +225570 KR7225570001ؽ ST1000000000000NNY NNNNNNNN0NNNNNNNY0000133000000100001NNN00NNN000000060Y0900000004357870000000005002015092500000000006586000000000003293008700012 0 NY000001400-00000372-00000347-0347-0000001120250930000008759LB5NNY +225590 KR7225590009м÷ ST3100910200000NNN NNNNNNNN0NNNNNNNN0000008150000100001NNN00NNN000000100N0900000003933790000000001002015100500000000002663600000000000266367130012 0 NN000000717000000043-00000009-0014-0000000620250930000000217 NNN +226330 KR7226330009ī̿ ST3000000000000 NN N N 0 N N0000038300000100001NNN00NNN000000100N0900000005861580000000005002019121700000000002425800000000001212923750012 0 NN000000017-00000083-00000134-0134-0000008620250930000000929 NNN +226340 KR7226340008 ST3100910230000NNN NNNNNNNN0NNNNNNNN0000006090000100001NNN00NNN000000100N0900000001325480000000001002015110500000000004195200000000000419524200012 0 NN000000374-00000058-00000066-0062-0000002320250930000000255 NNN +226400 KR7226400000׿ ST3100910290000 NN N N 0 N N0000064100000100001NNN00NNN000000100N0900000001997580000000005002018022200000000002066100000000001033080050012 0 NN0000003240000000650000000480003800000001120250930000001324 NNN +226590 KR7226590008̽ ST3100910280000 NN N N 0 N N0000168900000100001NNN00NNN000000060Y0900000007449340000000005002025030700000000001063000000000000531539200012 0 NN0000006350000000760000000520004100000000020250930000001795 NNN +226950 KR7226950004ø ST1100600000000 NY N N 0 N Y0001505000000100001NNN00NNN000000100N0900000005218220000000005002018071800000000002018900000000001009494150012 0 NY000000101-00000215-00000288-0311-0000005520250930000030385 NNN +227100 KR7227100005κ ST3000000000000 NN N N 0 Y N0000006120000100001YNY00NNN000000100N0900000000000000000000005002018111500000000002413400000000001206709100012 0 NN000000031-00000047-00000056-0056-3610000020250331000000147 NNN +227610 KR7227610003ƿǻĽ ST3100910230000 NN N N 0 N N0000007760000100001NNN00NNN000000100N0900000000721460000000005002017071200000000003788200000000001894104700012 0 NN000000324-00000006-00000021-0021-0000001720250930000000293 NNN +227950 KR7227950003 ST3100910270000NNN NNNNNNNN0NNNNNNNN0000003530000100001NNN00NNN000000100N0900000037280170000000001002015111800000000017254100000000001725410470012 0 NN0000002150000000710000001770016600000000120250930000000609 NNN +228340 KR7228340006 ST3100910250000NNN NNNNNNNN0NNNNNNNN0000017320000100001NNN00NNN000000100N0900000000572570000000005002016040600000000002000000000000001000000000012 0 NN000000566-00000044-00000033-0053-0000000420241231000000346 NNN +228670 KR7228670006 ST3100910290000 NN N N 0 N N0000056200000100001NNN00NNN000000100N0900000002067930000000005002019080800000000001560200000000000780102500012 0 NN000000823-0000001500000012500126-0000002420250930000000876 NNN +228760 KR7228760005Ʈ ST2100600000000 NN N N 0 N N0000246500000100001NNN00NNN000000100N0900000002995910000000005002019032700000000002438200000000001219103550012 0 NN000000029-00000087-00000072-0072-0000000720250930000006010 NNN +228850 KR7228850004̾ ST3100910290000NNN NNNNNNNN0NNNNNNNN0000050900000100001NNN00NNN000000100N0900000000177000000000005002016041100000000001659100000000000829550700012 0 NN000000856-000000100000000310001400000000020250930000000844 NNN +229000 KR7229000005ť ST3100910240000 NN N N 0 N N0000018170000100001NNN00NNN000000100N0900000001403500000000005002020062500000000002342800000000001171408250012 0 NN000000051-00000085-00000041-0041-0000002920241231000000425 NNN +230240 KR7230240004ġ ST2100910280000NNN NNNNNNNN0NNNNNNNN0000145400000100001NNN00NNN000000060Y0900000001438550000000005002015121600000000001330900000000000674451300012 0 NN000000937-0000002100000001800003-0000000020250930000001935 NNN +230360 KR7230360000ڸ ST2100600000000NNN NNNNNNNN0NNNNNNNN0000158900000100001NNN00NNN000000060Y0900000000816410000000001002016080800000000003099800000000000329530290012 0 NN0000032100000003730000003660027900000001220250930000004925 NNN +230980 KR7230980005ũ ST3000000000000NNN NNNNNNNN0NNYNNNNN0000002290000100001YNY00NNN000000100N0900000000000000000000001002016030200000000009332000000000000933205570012 0 NN000000080000000006-00000006-0006-0000005520250930000000213 NNN +232140 KR7232140004̾ ST1100910270000NNY NNNNNNNN0NNNNNNNY0000192100000100001NNN00NNN000000050Y0900000035079930000000001002015122400000000008204500000000000820453500012 0 NY0000018590000000770000000880008700000000220250930000015760 NNN +232680 KR7232680009·κƽ ST3100910270000 NN N N 0 N N0000164000000100001NNN00NNN000000100N0900000052551130000000005002021061700000000001301400000000000650736750012 0 NN0000003880000000280000000240001800000000020250930000002134 NNN +232830 KR7232830000Ƽǿ ST3000000000000 NN N N 0 N N0000023450000100001NNN00NNN000000100N0900000000571910000000005002023062900000000001653300000000000826686300012 0 NN000002083000000001-00000030-002900000000020250930000000387 NNN +234030 KR7234030005̴мַ ST0100910280000 NN N N 0 N N0000102200000100001NNN00NNN000000060Y0900000013443230000000001002025070700000000002360500000000000236050000012 0 NN0000011250000000160000000060000700000000020250930000002412 NNY +234100 KR7234100006󸮽 ST3100910300000 NN N N 0 N N0000012460000100001NNN00NNN000000100N0900000008497460000000001002017102000000000007079600000000000707962030012 0 NN0000017830000000500000000760006000000000220250930000000882 NNN +234300 KR7234300002Ʈ ST3000000000000 NN N N 0 N N0000036250000100001NNN00NNN000000100N0900000001590740000000005002017120500000000002720700000000001390492400012 0 NN000001090000000012-00000007-002100000000420250930000000986 NNN +234340 KR7234340008̳ ST2000000000000 NN N N 0 N N0000225500000100001NNN00NNN000000100N0900000030620850000000005002019071200000000001397000000000000698532800012 0 NN0000013630000001200000001380009800000000520250930000003150 NNN +234690 KR7234690006 ST3100910240000 NN N N 0 N N0000094200000100001NNN00NNN000000060Y0900000000963990000000005002019101400000000001775200000000000887613800012 0 NN0000011600000001440000001220009200000000920250930000001672 NNY +234920 KR7234920007̱ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000053100000100001YNY00NNN000000100N0900000000000000000000005002016090600000000001353000000000000676545500012 0 NN000000121-00000049-00000067-0068-0000002420241231000000718 NNN +235980 KR7235980000޵ ST3100600000000 NN N N 0 N N0000067900000100001NNN00NNN000000100N0900000005452460000000005002019121900000000003427500000000001713756050012 0 NN000000025-00000111-00000101-0101-0000002820250930000002327 NNN +236200 KR7236200002 ST2100910280000NNN NNNNNNNN0NNNNNNNN0000464000000100001NNN00NNN000000060Y0900000005090670000000005002016020500000000000725700000000000362863650012 0 NN0000009170000001980000002230019400000001420250930000003367 NNY +236810 KR7236810008Ƽ ST3100600000000 NN N N 0 N N0000022050000100001NNN00NNN000000100N0900000001974260000000001002021012100000000001697500000000000169754260012 0 NN000000666-00000058-00000065-0064-0000004420250930000000374 NNN +237690 KR7237690003Ƽ ST1100910240000NNY NNNYNNNN0NNNNNNNY0001505000000100001NNN00NNN000000050Y0900000003698360000000005002016062300000000002070100000000001035084200012 0 NY0000020260000002870000002940023500000000720250930000031156 NNY +237750 KR7237750005Ǿؾũ ST3100910280000NNN NNNNNNNN0NNNNNNNN0000050100000100001NNN00NNN000000100N0900000001056000000000005002016070400000000000649600000000000324830000012 0 NN0000003470000000180000000300002200000000320241231000000325 NNN +237820 KR7237820006÷̵ ST3100600000000 NN N N 0 N N0000044200000100001NNN00NNN000000100N0900000000282110000000005002020031200000000001282700000000000641357000012 0 NN0000002690000000320000000430003400000000020250930000000566 NNN +237880 KR7237880000Ŭ ST2100910230000 NN N N 0 N N0000132700000100001NNN00NNN000000060Y0900000000735280000000005002016110900000000001807100000000000903567650012 0 NN0000024830000000940000001200010100000000520250930000002398 NNY +238090 KR7238090005ص ST3100910230000 NN N N 0 N N0000017390000100001NNN00NNN000000100N0900000000618780000000005002016101200000000002354100000000001220613950012 0 NN00000038900000003200000006500065-0000001420250930000000409 NNN +238120 KR7238120000ε ST3100910290000 NN N N 0 N N0000036650000100001NNN00NNN000000100N0900000000261990000000005002016110300000000001437800000000000718944800012 0 NN0000001170000000130000000140001400000001120250930000000526 NNN +238200 KR7238200000ǵ ST3100910190000 NN N N 0 N N0000029950000100001NNN00NNN000000100N0900000000146300000000005002018122600000000000818000000000000409000000012 0 NN00000014900000001000000000800007-0000000120250930000000244 NNN +238490 KR7238490007 ST3100910270000 NN N N 0 N N0000032800000100001NNN00NNN000000100N0900000000296440000000005002017072000000000001131200000000000565611800012 0 NN0000006130000000020000000190002700000000420241231000000371 NNN +239340 KR7239340003̽Ʈ̵ ST3000000000000NNN NNNNNNNN0NNNNNNNN0000017580000100001NNN00NNN000000100N0900000001945750000000001002016060900000000002697900000000000269796340012 0 NN000000129-00000039-00000039-0039-0000003620250930000000474 NNN +239610 KR7239610009ġ̾ ST3100910190000 NN N N 0 N N0000078800000100001NNN00NNN000000100N0900000000095530000000005002016102800000000000539200000000000269605750012 0 NN000000144-00000087-00000076-0074-0000001220250930000000424 NNN +239890 KR7239890007ǿġũ ST3100910230000 NN N N 0 N N0000051000000100001NNN00NNN000000100N0900000000490740000000005002021021600000000000993500000000000496787750012 0 NN0000003360000000250000000300003400000000720241231000000506 NNN +240550 KR7240550004޵ ST2100910290000 NN N N 0 N N0000077200000100001NNN00NNN000000060Y0900000001924240000000005002025021300000000002081000000000001118712800012 0 NN0000008380000001150000000980007900000001020250930000001606 NNN +240600 KR7240600007ũ ST3100910260000 NN N N 0 N N0000041600000100001NNN00NNN000000100N0900000000665330000000005002023110200000000000692800000000000346407550012 0 NN000000191-00000055-00000050-0050-0000001420250930000000288 NNN +240810 KR7240810002IPS ST1100910270000NNY NNYNNNNN0NNNNNNNY0001044000000100001NNN00NNN000000050Y0900000015072200000000005002016050200000000004908300000000002454195050012 0 NY0000063480000005660000006750051200000000920250930000051243140NNY +241520 KR7241520006DSCκƮƮ ST3101400000000 NN N N 0 N N0000081900000100001NNN00NNN000000100N0900000015380230000000005002016121900000000002700000000000001390570150012 0 NN0000002460000000610000000620004600000000720250930000002211 NNN +241690 KR7241690007ũ ST3100910300000 NN N N 0 N N0000041600000100001NNN00NNN000000100N0900000079730100000000005002016092000000000002447000000000001250578250012 0 NN0000008070000000250000000080000800000000320250930000001017 NNN +241710 KR7241710003ڽīڸ ST1100910230000 NN N N 0 N Y0000866000000100001NNN00NNN000000050Y0900000001562790000000005002016102800000000001068000000000000534000000012 0 NN0000046250000006250000005780042400000002120250930000009248 NNY +241770 KR7241770007ī ST3100910280000 NN N N 0 N N0000240000000100001NNN00NNN000000060Y0900000000163050000000005002017120600000000001019200000000000534632000012 0 NN0000007020000001140000001350011800000000820250930000002446 NNN +241790 KR7241790005Ƽ̿ ST3100910270000 NN N N 0 N N0000072900000100001NNN00NNN000000100N0900000000803130000000005002016120100000000001000200000000000500131700012 0 NN0000011620000000810000000500003500000000720250930000000729 NNN +241820 KR7241820000Ǿ ST3100910240000 NN N N 0 Y N0000060400000100001YNY00NNN000000100N0900000000000000000000005002017022300000000000278200000000000139104900012 0 NN000000049-00000040-00000044-0044-0000017920250930000000168 NNN +241840 KR7241840008̽丮 ST3101500000000 NN N N 0 N N0000074100000100001NNN00NNN000000100N0900000000439010000000005002019071900000000000953900000000000476999700012 0 NN000000089-00000031-00000036-0033-0000001220250930000000706 NNN +242040 KR7242040004 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000023350000100001NNN00NNN000000100N0900000031196530000000001002016090700000000003460600000000000346062640012 0 NN000000673000000011-00000009-0015-0000000720250930000000808 NNN +243070 KR7243070000޿½ ST2100910240000NNY NNNYNNNN0NNNNNNNN0000273000000100001NNN00NNN000000050Y0900000000267540000000005002016060300000000001197900000000000598983250012 0 NN0000045560000003580000003720032400000001020250930000003270 NNY +243840 KR7243840006£̾ ST3100910280000 NN N N 0 N N0000061600000100001NNN00NNN000000060Y0900000010319950000000005002017092700000000003855800000000001945951750012 0 NN000003064000000005-00000077-0137-0000000120250930000002375 NNY +244460 KR7244460002øн ST3100910240000 NN N N 0 Y N0000016510000100001YNY00NNN000000100N0900000000000000000000005002019092000000000000811700000000000405875250012 0 NN000000008-00000101-00000058-0053-0000007520241231000000134 NNN +245620 KR7245620000EDGC ST3100600000000 NN N N 0 Y N0000004150000100001YNY00NNN000000100N0900000000000000000000001002018062600000000013849300000000001384939510012 0 NN000000062-0000001200000006200080-0000014220250930000000574 NNN +246250 KR7246250005̿ ST3100600000000 NN N N 0 N N0000019690000100001YNY00NNN000000100N0900000000000000000000005002023102000000000001534800000000000767410300012 0 NN0000000840000000030000000040000300000000320241231000000302 NNN +246690 KR7246690002TSκƮƮ ST3101400000000 NN N N 0 N N0000013450000100001NNN00NNN000000100N0900000002632490000000005002016121500000000004467100000000002233580750012 0 NN0000001320000000180000000190001800000000220250930000000600 NNN +246710 KR7246710008Ƽؾ˹̿ ST3100910240000 NN N N 0 N N0000035450000100001NNN00NNN000000100N0900000021407750000000005002018112800000000004756900000000002378452400012 0 NN000000194-00000068-00000154-015400000000020250930000001686 NNN +246720 KR7246720007ƽŸ ST3100910240000 NN N N 0 N N0000083600000100001NNN00NNN000000100N0900000000518290000000005002017032000000000001518100000000000759065000012 0 NN000000034-00000040-00000039-0039-0000007520241231000001269 NNN +246960 KR7246960009SCL̾ ST3100910240000 NN N N 0 N N0000023000000100001NNN00NNN000000100N0900000000413210000000005002019020100000000003401700000000001700852350012 0 NN000000137-00000026-00000015-0015-0000001720250930000000782 NNN +247540 KR7247540008κ ST1100910280000 NY Y N 0 N Y0002290000000100001NNN00NNN000000050Y0900000028700490000000005002019030500000000009780100000000004894090900012 0 NY0000203460000010180000005200073400000000020250930000223965LD2NNY +247660 KR7247660004뾾 ST3100910280000 NN N N 0 N N0000052200000100001NNN00NNN000000100N0900000000248490000000005002021030900000000000434300000000000217196000012 0 NN000000046-00000089-00000088-0088-0000003820241231000000226 NNN +250000 KR7250000007Ƽ ST3101100000000 NN N N 0 N N0000079900000100001NNN00NNN000000100N0900000000116930000000005002017060800000000000675000000000000337536650012 0 NN0000007650000000770000000140001100000000320250930000000539 NNN +250060 KR7250060001 ST3000000000000NNN NNNNNNNN0NNNNNNNN0000052700000100001NNN02NNN000000100N0900000048471800000000001002016090800000000003217100000000000321713140012 0 NN000000050-00000024-000000630009200000003220241231000001695 NNN +250930 KR7250930005ũ ST3100910230000 NN N N 0 N N0000004610000100001NNN00NNN000000100N0900000001422900000000001002016092900000000003300000000000000330004400012 0 NN000000290-00000011-00000022-0020-0000003120250930000000152 NNN +251120 KR7251120002̿𿣾 ST3100910240000 NN N N 0 N N0000160700000100001NNN00NNN000000060Y0900000000427660000000005002022022100000000000869500000000000434785000012 0 NN0000001610000000490000000520004500000000720241231000001397 NNN +251370 KR7251370003̿Ƽ ST3100910230000 NN N N 0 N N0000114500000100001NNN00NNN000000060Y0900000001899130000000005002017042700000000001762400000000000881200500012 0 NN0000010620000000880000000790005000000000120250930000002017 NNN +251630 KR7251630000̿ ST3100910270000 NN N N 1 N N0000080000000100001NNN00NNN000000100N0900000003827760000000005002017071300000000001594200000000000797144300012 0 NN000000290-00000089-00000092-0087-0000000720250930000001275 NNN +251970 KR7251970000ڸ ST1100910230000 NN N N 0 N Y0000642000000100001NNN00NNN000000050Y0900000001168500000000005002019070400000000001240000000000000620000000012 0 NN0000029480000004820000004870037700000001620250930000007960 NNN +252500 KR7252500004ȭǾؾ ST3100910230000 NN N N 0 N N0000008100000100001NNN00NNN000000100N0900000001277090000000001002016110200000000004148600000000000414863900012 0 NN0000004390000000270000000390003300000000820241231000000336 NNN +252990 KR7252990007 ST2100910280000 NN N N 0 N N0000093700000100001NNN00NNN000000060Y0900000030953650000000005002021052000000000005838800000000002919403150012 0 NN0000005330000000520000000500003300000000320241231000005470 NNN +253450 KR7253450001Ʃ巡 ST1101500000000 NY N N 0 N Y0000486000000100001NNN00NNN000000050Y0900000002318820000000005002017112400000000003005800000000001502924900012 0 NY0000038480000001180000001140007500000000220250930000014608720NNY +253590 KR7253590004׿ ST2100910270000 NN N N 0 N Y0000164900000100001NNN00NNN000000060Y0900000117392970000000001002018040400000000004386900000000000438691640012 0 NN0000004140000000150000000130000900000000820250930000007234 NNN +253840 KR7253840003 ST3100910240000 NN N N 0 N N0000064300000100001NNN00NNN000000100N0900000005689220000000005002019052800000000001674300000000000837160000012 0 NN000000065-00000137-00000122-0122-0000002120250930000001076 NNN +254120 KR7254120009ں ST3100910270000 NN N N 0 N N0000014960000100001NNN00NNN000000100N0900000003163130000000001002016120200000000003075400000000000307542700012 0 NN000000209-00000007-00000009-0009-0000000220250930000000460 NNN +254490 KR7254490006̷ݵü ST2101100000000 NN N N 0 N N0000171800000100001NNN00NNN000000060Y0900000003061720000000001002023012700000000001443800000000000144380000012 0 NN0000048760000001020000000760006000000000720241231000002480 NNY +255220 KR7255220006SG ST2100910250000 NN N N 0 N N0000027050000100001NNN00NNN000000100N0900000057335100000000001002018012600000000010393700000000001039378900012 0 NN000000714-0000002600000003900039-0000001120250930000002811 NNN +255440 KR7255440000߽ ST3100910270000 NN N N 0 N N0000109600000100001NNN00NNN000000100N0900000000514790000000005002017092900000000001305800000000000656900000012 0 NN000000208-00000089-00000079-0079-0000001120250930000001431 NNN +256150 KR7256150004ѵũ ST3100910270000 NN N N 0 N N0000052500000100001NNN00NNN000000100N0900000000097060000000005002019090500000000000839500000000000419750000012 0 NN0000006820000000350000000450003600000000620241231000000440 NNN +256630 KR7256630005ƮϾ ST3100910260000 NN N N 0 N N0000010020000100001NNN00NNN000000100N0900000001117510000000001002017050200000000005799700000000000579970720012 0 NN0000002650000000020000000000000400000000320250930000000581 NNN +256840 KR7256840000ѱ񿣾 ST2100910240000 NN N N 0 N N0000049400000100001NNN00NNN000000060Y0900000014239280000000001002016122800000000006839400000000000683948860012 0 NN0000007230000000400000000650005000000000620250930000003378 NNY +256940 KR7256940008ŵĸ ST2100910240000 NN N N 0 N N0000097500000100001NNN00NNN000000100N0900000002143950000000005002017090600000000002007800000000001003907350012 0 NN000001249000000006-00000017-0011-0000000020250930000001957 NNN +257370 KR7257370007ǿƼ ST3100910270000 NN N N 0 N N0000037400000100001NNN00NNN000000100N0900000001203650000000005002018091300000000001250400000000000625243050012 0 NN0000002620000000120000000140001400000000620241231000000467 NNN +257720 KR7257720003Ǹ ST1101100000000 NY N N 0 N Y0000513000000100001NNN00NNN000000050Y0900000008192000000000005002021092900000000006117100000000003068667700012 0 NY0000081030000016300000016280132800000005120250930000031381 NNN +258610 KR7258610005Ϸ ST3100910260000 NN N N 0 N N0000013460000100001NNN00NNN000000100N0900000000708740000000005002017082200000000003648500000000001824253150012 0 NN000000701000000010-00000002-0005-0000000120250930000000491 NNN +258790 KR7258790005Ʈķ ST3000000000000 NN N N 0 N N0000014030000100001NNN00NNN000000100N0900000001191910000000001002017042700000000002499100000000000249912840012 0 NN0000001570000000030000000020000100000001020250930000000350 NNN +258830 KR7258830009޵Į ST3100910290000 NN N N 0 Y N0000004120000100001YNY00NNN000000100N0900000000000000000000001002018052900000000006578600000000000657863510012 0 NN0000001400000000160000000340003200000001620250930000000271 NNN +259630 KR7259630002÷ ST3100910270000 NN N N 0 N N0000126300000100001NNN00NNN000000060Y0900000002719450000000005002017092000000000001219000000000000615770100012 0 NN0000017080000002160000002000017300000002520250930000001539 NNY +260660 KR7260660006˸ ST3100910240000 NN N N 0 N N0000040900000100001NNN00NNN000000100N0900000001359740000000005002018021200000000001532700000000000766351050012 0 NN000001904-00000052-00000062-0054-0000000620241231000000626 NNN +260930 KR7260930003Ƽ ST3100910230000 NN N N 0 N N0000044000000100001NNN00NNN000000100N0900000000572840000000005002017120700000000001934100000000000967079550012 0 NN000000733-00000035-00000025-0036-0000000520250930000000851 NNN +260970 KR7260970009ص ST2100910190000 NN N N 0 N N0000735000000100001NNN00NNN000000060Y0900000000401820000000005002021092900000000000289200000000000202971000012 0 NN0000011610000002010000002070017000000002220241231000002126 NNY +261200 KR7261200000Ƽ ST3100910290000 NN N N 0 N N0000043350000100001NNN00NNN000000100N0900000000324500000000005002017062600000000001580900000000000790485000012 0 NN000000915-00000009-00000079-0077-0000001320250930000000685 NNN +261520 KR7261520001 ST0000000000000 NN N N 0 N N0000102200000100001NNN00NNN000000100N0900000001716830000000001002025121100000000000976900000000000097691610012 0 NN0000003030000000240000000170003100000001320241231000000998 NNN +261780 KR7261780001ſ ST3100600000000 NN N N 0 N N0000029050000100001NNN00NNN000000100N0900000002183140000000005002021102200000000002686500000000001343262300012 0 NN000000004-00000077-00000104-0101-0000003220241231000000780 NNN +262260 KR7262260003 ST3100910280000 NN N N 0 N N0000057000000100001NNN00NNN000000100N0900000000842770000000005002020071600000000001446800000000000723407600012 0 NN000001330-00000039-00000073-007800000000320250930000000824 NNN +262840 KR7262840002Ʈ ST3000000000000 NN N N 0 N N0000018260000100001NNN00NNN000000100N0900000000710850000000001002021020500000000002113300000000000211339050012 0 NN0000003210000000300000000420004000000001120250930000000385 NNN +263020 KR7263020000̾ص ST3100910230000 NN N N 0 N N0000030300000100001NNN00NNN000000100N0900000000806130000000005002018112000000000001383600000000000776320200012 0 NN0000010380000000840000000790006400000001020250930000000419 NNN +263050 KR7263050007ƿ ST3100910240000 NN N N 0 N N0000007300000100001NNN00NNN000000100N0900000003075850000000005002018122400000000003683400000000001841742800012 0 NN000000079-00000139-00000127-0127-0000006020250930000000268 NNN +263600 KR7263600009 ST3100910280000 NN N N 0 N N0000050600000100001NNN00NNN000000100N0900000001066560000000005002017082800000000001593000000000000803761050012 0 NN000001248000000003-00000024-0019-0000000120250930000000806 NNN +263690 KR7263690000 ST3100910290000 NN N N 0 N N0000054900000100001NNN00NNN000000100N0900000000263850000000005002018112200000000001132500000000000566280500012 0 NN0000007490000000690000000460004100000000920250930000000621 NNN +263700 KR7263700007ɾ ST3100600000000 NN N N 0 N N0000028950000100001NNN00NNN000000100N0900000001050210000000005002018032800000000001941400000000000980488300012 0 NN0000006670000000280000002820023600000001720250930000000562140NNN +263720 KR7263720005ؾ̵ ST2101500000000 NN N N 0 N N0000123200000100001NNN00NNN000000060Y0900000000665800000000005002017080100000000001241200000000000626223650012 0 NN0000007010000001320000001420008700000001120250930000001529 NNY +263750 KR7263750002޾ ST1000000000000 NY N N 0 N Y0000551000000100001NNN00NNN000000100N0900000008390200000000001002017091400000000006424700000000000662345000012 0 NY000002701-00000064-000000620006800000000720250930000035400 NNN +263770 KR7263770000Ƽ ST3100910260000 NN N N 0 N N0000018860000100001NNN00NNN000000100N0900000000784960000000001002017040600000000002370000000000000237001720012 0 NN0000007480000000690000000690005500000000720241231000000446 NNN +263800 KR7263800005Ÿַ ST3101100000000 NN N N 0 N N0000052600000100001NNN00NNN000000100N0900000001585570000000005002017080300000000001622200000000000811119000012 0 NN0000011010000000010000000030000200000000120241231000000853 NNN +263810 KR7263810004 ST3100910280000 NN N N 0 N N0000031700000100001NNN00NNN000000100N0900000001002290000000005002017101600000000001592400000000000796241250012 0 NN0000009850000000290000000190001500000000620250930000000504 NNN +263860 KR7263860009Ͼ ST3000000000000 NN N N 0 N N0000192400000100001NNN00NNN000000060Y0900000000534210000000005002017080200000000000907900000000000472230000012 0 NN0000003120000000220000000290003200000001720250930000001746 NNN +263920 KR7263920001޿ؾ ST3100910310000 NN N N 0 N N0000039450000100001NNN00NNN000000100N0900000000261970000000005002017092800000000000980900000000000490451300012 0 NN0000003930000000200000000150000900000000220250930000000386 NNN +264450 KR7264450008 ST3100910280000 NN N N 0 N N0000115300000100001NNN00NNN000000060Y0900000002253260000000005002017033100000000001466500000000000760925000012 0 NN0000008150000001400000001790014700000001320250930000001690 NNN +264660 KR7264660002ũ ST3100910270000 NN N N 0 N N0000186000000100001NNN00NNN000000060Y0900000004255840000000005002018012500000000000972100000000000486058600012 0 NN0000014050000001440000001610012400000001420250930000001808 NNN +264850 KR7264850009̷ý ST3100910280000 NN N N 0 N N0000080800000100001NNN00NNN000000060Y0900000032203550000000001002017060100000000003029400000000000302946120012 0 NN0000005200000000320000000370003300000000820250930000002447 NNN +265520 KR7265520007APý ST2100910270000 NN N N 0 N N0000209500000100001NNN00NNN000000060Y0900000003444220000000005002017040700000000001505000000000000764071050012 0 NN0000032850000002370000001450013700000001020250930000003153 NNY +265560 KR7265560003ȭũ ST3100910300000 NN N N 0 N N0000081500000100001NNN00NNN000000100N0900000001471700000000005002017102600000000001069000000000000534509000012 0 NN0000007990000001200000001270010200000001720250930000000871 NNN +265740 KR7265740001 ST3100910230000 NN N N 0 N N0000046450000100001NNN00NNN000000100N0900000001029070000000001002020120200000000001786300000000000178636000012 0 NN000000402-00000071-00000072-0052-0000000920241231000000829 NNN +267320 KR7267320000ũ ST2100910270000 NN N N 0 N N0000034900000100001NNN00NNN000000100N0900000061957690000000001002017062200000000005741500000000000574152950012 0 NN000000658-00000019-00000104-0081-0000001620250930000002003 NNN +267790 KR7267790004跲 ST3100910200000 NN N N 0 N N0000035550000100001NNN00NNN000000100N0900000000366500000000005002018020100000000000768900000000000394425000012 0 NN0000005070000000720000000640005200000000920250930000000273 NNN +267980 KR7267980001 ST2100910190000 NN N N 0 N N0000354000000100001NNN00NNN000000050Y0900000000059580000000005002017060500000000000766300000000000392181900012 0 NN0000138840000004530000005640040800000000920250930000002712 NNN +269620 KR7269620001ý ST3100910290000 NN N N 0 Y N0000008890000100001YNY00NNN000000100N0900000000000000000000001002017122600000000014858200000000001485826910012 0 NN000000090-00000015-00000009-0036-3610000020250930000001320 NNN +270520 KR7270520000ư ST2100600000000 NN N N 0 N N0000003900000100001NNN00NNN000000100N0900000025593910000000001002017082200000000019658900000000001965891470012 0 NN000000146-00000075-00000158-0158-0000003120250930000000766 NNN +270660 KR7270660004긮 ST3100910280000 NN N N 0 N N0000263000000100001NNN00NNN000000060Y0900000005289660000000005002021072800000000001269000000000000634529150012 0 NN000000213-00000024-00000048-0041-0000000620250930000003337 NNN +270870 KR7270870009Ʈ ST3100910190000 NN N N 0 N N0000049500000100001NNN00NNN000000100N0900000000171540000000005002018121300000000000920000000000000460011200012 0 NN0000007660000000150000000270001900000000020250930000000455 NNN +271830 KR7271830002 ST3100910270000 NN N N 0 N N0000017680000100001NNN00NNN000000100N0900000003421990000000001002023052300000000002949000000000000294902020012 0 NN000000161-00000059-00000058-0061-0000000620250930000000521 NNN +272110 KR7272110008̿ ST3100910280000 NN N N 0 N N0000285000000100001NNN00NNN000000060Y0900000003944850000000005002019102500000000000802500000000000401269750012 0 NN0000006110000001640000001630015600000002120250930000002287 NNY +272290 KR7272290008̳콺÷ܼ ST2100910280000 NN N N 0 N Y0000310000000100001NNN00NNN000000050Y0900000008219920000000005002017071000000000001992700000000001011382900012 0 NN0000033730000006920000006460050400000001820250930000006177 NNY +273060 KR7273060004 ST3100600000000 NN N N 0 N N0000010610000100001NNN00NNN000000100N0900000015342830000000001002017080700000000005045900000000000504595820012 0 NN000000300000000047-00000021-001800000000720250930000000535DKGNNN +273640 KR7273640003̿ ST3100910280000 NN N N 0 N N0000083300000100001NNN00NNN000000100N0900000000261140000000005002021091000000000001096600000000000548300000012 0 NN0000003090000000430000000600004900000000920241231000000913 NNN +274090 KR7274090000ھƿν̽ ST3100910300000 NN N N 0 N N0000241000000100001NNN00NNN000000100N0900000015692120000000005002020030300000000001324100000000000662091450012 0 NN000000562-00000060-00000045-0058-0000000720250930000003191 NNN +274400 KR7274400001̳ùķ̼ ST3000000000000 NN N N 0 N N0000040650000100001NNN00NNN000000100N0900000000351760000000005002023070600000000000908600000000000454324650012 0 NN000000093-00000048-00000060-0066-0000002620241231000000369 NNN +275630 KR7275630002 ST3000000000000 NN N N 0 N N0000028250000100001NNN00NNN000000100N0900000000091800000000005002018080600000000000601700000000000300899450012 0 NN000000079-00000011-00000007-0005-0000000320250930000000170 NNN +276040 KR7276040003ڳ ST3000000000000 NN N N 0 N N0000012280000100001NNN00NNN000000100N0900000012010800000000005002022020400000000002163000000000001081516750012 0 NN000000039-00000067-00000061-0061-0000003220250930000000265 NNN +276730 KR7276730009ѿ ST3100910190000 NN N N 0 N N0000012290000100001NNN00NNN000000100N0900000001909570000000005002021052600000000002214900000000001107492350012 0 NN000000101-00000030-00000036-0036-0000015420250930000000272 NNN +277070 KR7277070009վƽþ ST3101400000000 NN N N 0 N N0000046700000100001NNN00NNN000000100N0900000000125090000000005002018031400000000001369200000000000684600000012 0 NN0000000470000000220000000220002000000000820250930000000639 NNN +277410 KR7277410007λ갡 ST3100910190000 NN N N 0 N N0000011720000100001NNN00NNN000000100N0900000001016100000000001002017092900000000003841100000000000384115050012 0 NN0000002710000000200000000050000500000000220250930000000450 NNN +277810 KR7277810008κκƽ ST1100910270000 NY Y N 0 N Y0006950000000100001NNN00NNN000000100N0900000007933040000000005002021020300000000001939900000000000969992900012 0 NY000000211-00000042-00000020-001300000000120250930000134829 NNN +277880 KR7277880001Ƽ ST3100910270000 NN N N 0 N N0000059300000100001NNN00NNN000000100N0900000002498710000000005002020072200000000002020600000000001010312400012 0 NN0000019680000000690000000470003200000001220250930000001198 NNN +278280 KR7278280003õ ST2100910230000 NN N N 0 N Y0000610000000100001NNN00NNN000000050Y0900000002913260000000005002019021100000000001169000000000000584523100012 0 NN000000993000000063-00000085-008800000000520250930000007131 NNN +278650 KR7278650007HLB̿ ST3100600000000 NN N N 0 N N0000015960000100001NNN00NNN000000060Y0900000010103060000000001002019112700000000008700500000000000870055390012 0 NN000000553-00000064-00000061-0057-0000000720250930000001388 NNN +279600 KR7279600001̵ ST3000000000000 NN N N 0 N N0000070500000100001NNN00NNN000000100N0900000000057480000000005002019110500000000000468400000000000234239050012 0 NN000000120-00000047-00000048-0042-0000002920241231000000330 NNN +281740 KR7281740001ũƼ ST1100910230000 NY N N 1 N Y0000256500000100001NNN00NNN000000060Y0900000020538910000000001002017121200000000006573000000000000657305480012 0YNY0000009940000000850000000220003300000001020250930000016859 NNN +282720 KR7282720002ݾ׸Ŀ ST3101000000000 NN N N 0 N N0000106600000100001NNN00NNN000000100N0900000001138070000000005002023031300000000001211900000000000605975000012 0 NN000001771-00000039-00000014-001400000000320250930000001291 NNN +282880 KR7282880004ũ ST3100910270000 NN N N 0 N N0000192600000100001NNN00NNN000000060Y0900000003228590000000005002019080500000000001146900000000000573468500012 0 NN000001138-00000052-00000060-002900000000220250930000002209 NNN +284620 KR7284620002ī̳뽺޵ ST3100600000000 NN N N 0 Y N0000010870000100001YNY00NNN000000100N0900000000000000000000005002018060800000000003308600000000001654347650012 0 NN000000009-00000041-00000059-0059-0000024920250930000000359 NNN +285490 KR7285490009 ST3100910310000 NN N N 0 N N0000242000000100001NNN00NNN000000060Y0900000001720680000000005002018110200000000001057500000000000528791550012 0 NN0000004320000000780000001760015100000001120250930000002559 NNN +285800 KR7285800009 ST3100910230000 NN N N 0 N N0000015450000100001NNN00NNN000000100N0900000000640680000000001002023060100000000001747700000000000174772700012 0 NN000000240-00000014-00000030-0036-0000001420250930000000270 NNN +286750 KR7286750005Ǹĭ÷ܼ ST3100910230000 NN N N 0 N N0000017340000100001NNN00NNN000000100N0900000001159610000000005002019081900000000003202800000000001601442850012 0 NN000000039-00000041-00000052-0052-0000003520250930000000555 NNN +287840 KR7287840003 ST2100600000000 NN N N 0 N N0000513000000100001NNN00NNN000000100N0900000002698330000000005002025052300000000001500000000000000750045000012 0 NN000000029-00000098-00000099-0099-0000009620241231000007695 NNN +288330 KR7288330004Ķýýڸ ST3100910240000 NN N N 0 N N0000011650000100001NNY00NNN000000100N0900000011548830000000005002019122000000000010607800000000005303938550012 0 NN000000000-00000131-00000130-0130-0000004520250930000001235 NNN +288620 KR7288620008ǻ ST3100910280000 NN N N 0 N N0000103400000100001NNN00NNN000000100N0900000000328190000000005002018101500000000000697900000000000348965800012 0 NN000000104-00000066-00000095-0095-0000001720250930000000721 NNN +288980 KR7288980006ƵŸ ST3000000000000 NN N N 0 N N0000008710000100001NNN00NNN000000100N0900000001760260000000005002022031000000000003455600000000001727828100012 0 NN000000167-00000036-00000087-0087-0000002520250930000000300 NNN +289010 KR7289010001̽ũ ST3101500000000 NN N N 0 N N0000016110000100001NNN00NNN000000100N0900000000711480000000005002019071100000000001394500000000000697262800012 0 NN000000683-00000018-00000026-0026-0000001120250930000000224 NNN +289080 KR7289080004SVκƮƮ ST3101400000000 NN N N 1 N N0000024800000100001NNN00NNN000000100N0900000027538060000000005002018070600000000005428600000000002714315500003 0 NN000000108-00000016-00000002-0002-0000000620250930000001346 NNN +289220 KR7289220006̾Ʈ ST3101500000000 NN N N 0 N N0000043600000100001NNN00NNN000000100N0900000001120220000000005002021032400000000002231200000000001115611050012 0 NN000000268-00000175-00000165-0165-0000004320250930000000972 NNN +289930 KR7289930000̺ ST3100910280000 NN N N 0 N N0000121000000100001NNN00NNN000000100N0900000005324690000000005002024102500000000001251900000000000625979650012 0 NN000000294-00000049-00000055-0055-0000002220241231000001514 NNN +290090 KR7290090000Ʈ ST3000000000000 NN N N 0 N N0000073300000100001NNN00NNN000000100N0900000000221520000000005002021111700000000000744000000000000372013400012 0 NN000000148-00000027-00000023-0023-0000000020250930000000545 NNN +290120 KR7290120005DH丮 ST3100910300000 NN N N 0 N N0000028450000100001NNN00NNN000000100N0900000000735850000000005002018120700000000001582400000000000791212450012 0 NN0000025960000001770000001420011300000000820250930000000450 NNN +290270 KR7290270008޳׽ÿ ST3000000000000 NN N N 0 N N0000040050000100001NNN00NNN000000100N0900000000386270000000005002018080200000000000960700000000000480383600012 0 NN0000002280000000060000000110000800000001220250930000000384 NNN +290520 KR7290520006ŵ⿬ ST3100910270000 NN N N 0 Y N0000018730000100001NNN00NNN000000100N0900000000336950000000005002020070600000000001592900000000000796468100012 0 NN000000058-00000012-00000019-0019-0000000420250930000000298 NNN +290550 KR7290550003Ƽ ST3100910280000 NN N N 0 N N0000088200000100001NNN00NNN000000060Y0900000008855950000000005002018122100000000002000100000000001000061500012 0 NN0000031100000001550000002020015200000001220250930000001764 NNN +290560 KR7290560002Žÿ ST3000000000000 NN N N 0 N N0000088300000100001NNN00NNN000000100N0900000000150490000000005002023110300000000000372700000000000199324600012 0 NN0000001180000000240000000300002500000001220241231000000329 NNN +290650 KR7290650001ؾ̿ ST1100910240000 NN N N 0 N Y0000748000000100001NNN01NNN000000100N0900000014072310000000005002018110100000000002484200000000001246702950012 0 NN000000608000000025-00000660-066300000003920250930000018581 NNN +290660 KR7290660000׿Ʈ ST3100910290000 NN N N 0 N N0000008630000100001NNN00NNN000000100N0900000068095070000000005002018112800000000007575300000000003787662550012 0 NN000000116-00000022-00000175-0172-0000005620250930000000653 NNN +290670 KR7290670009뺸׳ƽ ST3100910280000 NN N N 0 N N0000140600000100001NNN00NNN000000100N0900000000514930000000005002018110600000000000785700000000000392883000012 0 NN000000215-00000059-00000059-0059-0000003220250930000001104 NNN +290690 KR7290690007ҷ轺 ST2100910280000 NN N N 0 N N0000042300000100001NNN00NNN000000100N0900000007266360000000005002020110600000000004875400000000002437707800012 0 NN000000507-00000066-00000421-0410-0000005820241231000002062 NNN +290720 KR7290720002Ǫ峪 ST3101100000000 NN N N 0 Y N0000019720000100001NNY00NNN000000100N0900000000272710000000005002018100400000000003436600000000001718342750012 0 NN000000715-00000066-00000108-0109-0000031620250930000000677 NNN +290740 KR7290740000Ʈ ST3100910280000 NN N N 0 N N0000225500000100001NNN00NNN000000100N0900000004262030000000005002018082800000000001006500000000000503250550012 0 NN0000018260000000450000000450004000000000320250930000002269 NNN +291230 KR7291230001 ST3100600000000 NN N N 0 N N0000008740000100001NNN00NNN000000100N0900000003834930000000001002018091300000000004409500000000000440957750012 0 NN000000193-00000038-00000040-0040-0000001620250930000000385 NNN +291650 KR7291650000Ÿӻ̾ ST3100600000000 NN N N 0 N N0000011780000100001NNN00NNN000000100N0900000006035400000000005002020091600000000004025700000000002012854600012 0 NN000000011-00000071-00000087-0087-0000004320241231000000474 NNN +291810 KR7291810000 ST3000000000000 NN N N 0 N N0000023900000100001NNN00NNN000000100N0900000000825320000000005002022102000000000001136800000000000568435600012 0 NN000000106-000000150000000010000100000000020241231000000271 NNN +293490 KR7293490009īī ST1000000000000 NY N N 0 N Y0000172000000100001NNN00NNN000000060Y0900000008718930000000001002020091000000000008978600000000000897869110012 0 NY000003661-00000265-00000573-0324-0000000820250930000015443KAONNN +293580 KR7293580007IB ST3101400000000 NN N N 0 N N0000017020000100001NNN00NNN000000100N0900000237473000000000005002018100400000000009492900000000004788500000012 0 NN0000002250000001280000001290010200000000520250930000001615 NNN +293780 KR7293780003Ÿ̿ ST2100600000000 NN N N 0 N N0000087400000100001NNN00NNN000000100N0900000003761610000000005002019061200000000002809300000000001404670250012 0 NN000000027-00000101-00000099-0099-0000004320250930000002455 NNN +294090 KR7294090006̿÷ο ST3100910290000 NN N N 0 Y N0000014900000100001YNY00NNN000000100N0900000000000000000000001002020091400000000004107900000000000410791050012 0 NN000000035-00001114-00001230-1230-3610000020250930000000612 NNN +294140 KR7294140009 ST3100910230000 NN N N 0 N N0000072600000100001NNN00NNN000000100N0900000004069890000000005002020022800000000002241400000000001120740900012 0 NN000000036-00000051-00000052-005200000000020250930000001627 NNN +294570 KR7294570007 ST2000000000000 NN N N 0 N N0000338000000100001NNN00NNN000000060Y0900000002593560000000005002021042800000000001009100000000000512734250012 0 NN0000007300000001660000001900015800000001120241231000003411 NNY +294630 KR7294630009 ST3100910280000 NN N N 0 N N0000030600000100001NNN00NNN000000100N0900000008622560000000005002020022000000000002636600000000001318315950012 0 NN000000014-00000045-00000039-0039-0000004220241231000000806 NNN +295310 KR7295310007ġ̿ ST2100910260000 NN N N 0 N N0000842000000100001NNN00NNN000000100N0900000003955130000000005002024062800000000001190100000000000595096550012 0 NN000000451-00000068-00000092-0084-0000001720241231000010021 NNN +296640 KR7296640006̳꽺 ST3000000000000 NN N N 0 N N0000054800000100001NNN00NNN000000100N0900000000149140000000005002022100700000000000517800000000000260912600012 0 NN0000001700000000090000000150001400000000820250930000000283 NNN +297090 KR7297090003 ST3100910270000 NN N N 0 N N0000059000000100001NNN00NNN000000060Y0900000002190230000000005002019112100000000002727000000000001363500000012 0 NN0000009250000000740000000620007100000000820250930000001608 NNN +297570 KR7297570004˷̽ ST3100910280000 NN N N 0 N N0000012000000100001NNN00NNN000000100N0900000041010890000000001002018072000000000003462100000000000346212180012 0 NN0000002760000000430000000440003400000000020250930000000415 NNN +297890 KR7297890006HBַ ST3100910270000 NN N N 0 N N0000023800000100001NNN00NNN000000060Y0900000006224620000000005002020062200000000007314000000000003676413400012 0 NN0000005650000000470000003460026900000000820250930000001740 NNY +298060 KR7298060005 ST3100910240000 NN N N 0 N N0000008240000100001NNY00NNN000000100N0900000001052020000000005002020061700000000004420300000000002210158800012 0 NN000000118-00000034-00000006-000600000000020250930000000364 NNN +298380 KR7298380007̺񿤹̿ ST1100910240000 NY N N 0 N Y0002415000000100001NNN00NNN000000100N0900000018580510000000005002018121900000000005512500000000002756258250012 0 NY000000793-00000107-00000097-0097-0000001620250930000133127 NNN +298540 KR7298540006Ȧ ST3100910200000 NN N N 0 N N0000080100000100001NNN00NNN000000060Y0900000000380110000000005002020072700000000001448600000000000742412800012 0 NN000003189000000024000000003-002700000000320250930000001160 NNN +298830 KR7298830001Ʈũ ST2000000000000 NN N N 0 N N0000089700000100001NNN00NNN000000060Y0900000026666520000000001002023042800000000005345800000000000542954690012 0 NN000000620000000017000000004-000200000001020250930000004795 NNN +299030 KR7299030007ϳ ST3100910270000 NN N N 0 N N0000327500000100001NNN00NNN000000100N0900000001376620000000005002020112500000000000799400000000000408529650012 0 NN000000840-00000003-00000061-0061-0000001120250930000002618 NNN +299170 KR7299170001 ST3101100000000 NN N N 0 N N0000037200000100001NNN00NNN000000100N0900000026277310000000001002018092100000000004151100000000000415112880012 0 NN000000392000000033-00000005-000600000000020250930000001544 NNN +299660 KR7299660001 ST3100600000000 NN N N 0 N N0000034300000100001NNN00NNN000000100N0900000042847570000000005002019022000000000002950200000000001475148850012 0 NN000000042-00000120-00000123-0123-0000002720241231000001011 NNN +299900 KR7299900001Ʃ ST3101500000000 NN N N 0 N N0000006830000100001NNN00NNN000000100N0900000012046320000000005002018122000000000017104800000000008552444200012 0 NN000000749-00000084-00000180-0168-0000003220250930000001168 NNN +300080 KR7300080009ø ST3000000000000 NN N N 0 N N0000172600000100001NNN00NNN000000100N0900000003609590000000005002019071700000000001650500000000000825272550012 0 NN0000002580000000540000000550005500000004420250930000002848 NNN +300120 KR7300120003 ST3000000000000 NN N N 0 N N0000021950000100001NNN00NNN000000100N0900000003872430000000005002019101800000000002086000000000001051393100012 0 NN000001288-00000186-00000232-0230-0000009020250930000000457 NNN +301300 KR7301300000̺۴ ST3000000000000 NN N N 0 N N0000034200000100001NNN00NNN000000100N0900000000588600000000005002020102800000000001315400000000000657735600012 0 NN000000126-00000044-00000038-0031-0000000120250930000000449 NNN +302430 KR7302430004̳Ʈ ST3100910270000 NN N N 0 N N0000077300000100001NNN00NNN000000100N0900000003030410000000005002018121200000000000983300000000000491660400012 0 NN000000288-00000015-00000011-0008-0000001120250930000000760 NNN +302550 KR7302550009޵ ST3100910290000 NN N N 0 N N0000029550000100001NNN00NNN000000100N0900000000489150000000001002019120600000000003149500000000000314955280012 0 NN0000001780000000070000000000000200000000820250930000000930 NNN +303030 KR7303030001ƽ ST3100910280000 NN N N 0 N N0000007860000100001NNN00NNN000000100N0900000011820890000000001002018083000000000003707300000000000370736890012 0 NN0000005410000000030000000070000700000000420241231000000291 NNN +303360 KR7303360002Ƽ ST3100910290000 NN N N 0 N N0000055300000100001NNN00NNN000000100N0900000001793410000000005002023061600000000001287700000000000643860750012 0 NN0000001050000000150000000230002400000001020241231000000712 NNN +303530 KR7303530000̳뵪 ST3000000000000 NN N N 0 N N0000052700000100001NNN00NNN000000100N0900000000212440000000005002021061800000000000733900000000000366964950012 0 NN000000426-00000054-00000053-005300000000220250930000000386 NNN +303810 KR7303810006 ST3100910240000 NN N N 0 N N0000035500000100001NNN00NNN000000060Y0900000001737730000000005002025021700000000003198400000000001599207000012 0 NN0000013180000001190000000480002200000000320241231000001135 NNN +304100 KR7304100001Ʈ轺 ST2000000000000 NN N N 0 N Y0000309000000100001NNN00NNN000000100N0900000003114310000000005002020072300000000001259300000000000629692750012 0 NN000000219-00000119-00000120-0121-0000001620250930000003891 NNN +304360 KR7304360001̿޵ ST2100910240000 NN N N 0 N N0000348000000100001NNN00NNN000000100N0900000001205000000000005002023050400000000001238500000000000619256400012 0 NN000000125-00000057-00000067-0068-0000011820250930000004310 NNN +304840 KR7304840002ù̿ ST3100910240000 NN N N 0 Y N0000012520000100001NNN00NNN000000100N0900000003506550000000005002020101900000000002122800000000001061415550012 0 NN000000027-00000066-00000059-0059-0000011120250930000000265 NNN +305090 KR7305090003ũεŻ ST3100910290000 NN N N 0 N N0000091500000100001NNN00NNN000000100N0900000002143400000000005002019060500000000001859500000000000929752750012 0 NN0000001150000000030000000000000400000000220241231000001701 NNN +306040 KR7306040007̱׷ ST3100910200000 NN N N 0 N N0000120600000100001NNN02NNN000000100N0900000010044920000000005002019111800000000000986500000000000493291400012 0 NN000001237-00000106-00000085-0083-0000000720250930000001189 NNN +306620 KR7306620006̿ ST3100910270000 NN N N 0 N N0000025650000100001NNN00NNN000000100N0900000004623650000000001002018103100000000004501400000000000450142600012 0 NN000000547-00000009-00000029-0032-0000001520250930000001154 NNN +307180 KR7307180000̿ ST3100910280000 NN N N 0 N N0000045400000100001NNN00NNN000000100N0900000062104050000000001002018122100000000003279500000000000327955650012 0 NN000000835000000008-00000011-0012-0000002020250930000001488 NNN +307280 KR7307280008̿ ST3100910240000 NN N N 0 N N0000070500000100001NNN00NNN000000100N0900000001487710000000005002018120500000000000709400000000000369590100012 0 NN0000002590000000580000000600004900000001720250930000000500 NNN +307750 KR7307750000ǰ ST3100910240000 NN N N 0 N N0000032700000100001NNN00NNN000000060Y0900000001254760000000001002018121900000000005017600000000000501763800012 0 NN000001008-00000027-00000029-0023-0000000420250930000001640 NNN +307870 KR7307870006 ST3000000000000 NN N N 0 N N0000012600000100001NNN00NNN000000100N0900000008409780000000001002018121200000000005956400000000000595645110012 0 NN000000109-00000052-00000076-0091-0000002920250930000000750 NNN +307930 KR7307930008۴ ST3101400000000 NN N N 0 N N0000065000000100001NNN00NNN000000100N0900000015402460000000005002019052300000000001561000000000000975500000012 0 NN0000001510000000330000000320002100000000320241231000001014 NNN +308080 KR7308080001 ST3100600000000 NN N N 0 N N0000082900000100001NNN00NNN000000100N0900000007359260000000005002021082500000000002049900000000001024963000012 0 NN000000000-00000027-00000026-0026-0000002020250331000001699 NNN +308100 KR7308100007۷ι ST3101100000000 NN N N 0 N N0000013400000100001NNN00NNN000000100N0900000005352080000000005002019061000000000002402300000000001201150400012 0 NN000000285-00000018-00000248-0272-0000007020250930000000321 NNN +308430 KR7308430008 ST2100910240000 NN N N 0 N N0000245000000100001NNN00NNN000000100N0900000001503960000000005002024101600000000001283100000000000641575500012 0 NN000000023-00000071-00000073-0073-0000003920241231000003143 NNN +309710 KR7309710002Ƽ ST0100910240000 NN N N 0 N N0000341000000100001NNN00NNN000000100N0900000001227940000000005002025080700000000001278300000000000639150050012 0 NN000000639-00000020-00000071-006200000000020250930000004359 NNN +309930 KR7309930006̿ ST3101100000000 NN N N 0 N N0000011020000100001NNN00NNN000000100N0900000001730850000000001002018122000000000002448700000000000244870480012 0 NN000000269-00000042-00000085-0080-0000002220250930000000269 NNN +309960 KR7309960003LBκƮƮ ST3101400000000 NN N N 0 N N0000060500000100001NNN00NNN000000100N0900000001450760000000010002023032900000000002321700000000002321723900012 0 NN0000002030000000890000000910007600000001220250930000001404 NNN +310200 KR7310200001ִ÷ ST2101500000000 NN N N 0 N N0000030250000100001NNN00NNN000000060Y0900000003541140000000001002018122100000000005216200000000000521628360012 0 NN0000011370000002470000002330018600000001920250930000001577 NNN +310210 KR7310210000γ ST1100600000000 NY N N 0 N Y0002180000000100001NNN00NNN000000100N0900000002051870000000005002022062400000000001839300000000000919676050012 0 NY000000075-00000382-00000384-0384-0000007420250930000040097 NNN +310870 KR7310870001̾ ST3100910300000 NN N N 0 N N0000012750000100001NNN00NNN000000100N0900000003231560000000001002018122000000000002068700000000000206872710012 0 NN0000008030000000360000000340002800000000420250930000000263 NNN +311320 KR7311320006Ʈ ST3100910280000 NN N N 0 N N0000077900000100001NNN00NNN000000100N0900000001065870000000005002021111100000000001261400000000000630728000012 0 NN0000004160000000340000000350003700000000620250930000000982 NNN +311390 KR7311390009׿ũ ST3100910190000 NN N N 0 N N0000051200000100001NNN00NNN000000100N0900000006438910000000005002019082200000000001265300000000000632689450012 0 NN0000006030000000650000000770006000000000520250930000000647 NNN +311690 KR7311690002CJ ̿̾ ST3100600000000 NN N N 0 N N0000088900000100001NNN00NNN000000100N0900000000378600000000005002019122600000000001306500000000000653273100012 0 NN000000024-00000196-00000188-0188-0000005320250930000001161720NNN +312610 KR7312610009̿ ST3100910280000 NN N N 0 N N0000013860000100001NNN00NNN000000100N0900000000675200000000005002019070100000000002025600000000001012844400012 0 NN000000157-00000065-00000056-0056-0000000920241231000000280 NNN +313760 KR7313760001ij ST3100910280000 NN N N 0 Y N0000015140000100001NNN00NYN000000100N0900000001673550000000005002019072500000000001120700000000000560359300012 0 NN000000056-00000038-00000041-005100000000020250930000000169 NNN +314130 KR7314130006۴ ST3100910240000 NN N N 0 N N0000092700000100001NNN00NNN000000100N0900000013355230000000005002020122300000000003464800000000001732439350012 0 NN000000187-00000222-00000226-0220-0000004020250930000003211 NNN +314140 KR7314140005ǹ̿ ST3100910240000 NN N N 0 N N0000068200000100001NNN00NNN000000100N0900000000227740000000005002022092900000000000866600000000000433318050012 0 NN000001240-00000007-00000012-0009-0000000120241231000000591 NNN +314930 KR7314930009̿ ST2100910290000 NN N N 0 N N0000131100000100001NNN00NNN000000100N0900000001235160000000005002021031700000000002976400000000001488205150012 0 NN000000053-00000017-000000010000000000000020241231000003902 NNN +315640 KR7315640003̵ ST3000000000000 NN N N 0 N N0000035450000100001NNN00NNN000000100N0900000004816220000000005002021081700000000002937200000000001468611600012 0 NN000000108-00000101-00000091-0091-0000003920241231000001041 NNN +317120 KR7317120004н ST3100910280000 NN N N 0 N N0000022650000100001NNN00NNN000000100N0900000002744230000000005002019091800000000001526000000000000770692000012 0 NN000000057-00000043-00000056-0056-0000003020250930000000345 NNN +317240 KR7317240000TSƮ ST3100910230000 NN N N 0 N N0000004960000100001NNN00NNN000000100N0900000103062730000000001002019042900000000014118800000000001411887220012 0 NN000000200-00000001-00000015-0015-0000001920250930000000700 NNN +317330 KR7317330009Ǿ ST2100910230000 NN N N 0 N N0000198600000100001NNN00NNN000000100N0900000004967280000000005002019080200000000002047600000000001023829200012 0 NN000000833-00000333-00000428-0436-0000002220250930000004066 NNN +317530 KR7317530004ijƮ ST3101500000000 NN N N 0 N N0000047200000100001NNN00NNN000000100N0900000000827720000000005002019102900000000001584100000000000792077400012 0 NN000000046-00000018-00000023-0023-0000008220250930000000747 NNN +317690 KR7317690006ŸƮ ST3100910290000 NN N N 0 N N0000043750000100001NNN00NNN000000100N0900000001879340000000005002020120900000000002004600000000001002348150012 0 NN000000029-00000110-00000140-0140-0000033120250930000000877 NNN +317770 KR7317770006丯 ST3100910280000 NN N N 0 N N0000028800000100001NNN00NNN000000100N0900000003300030000000005002019080100000000003327500000000001663759050012 0 NN000000145-00000025-00000164-0161-0000002120250930000000958 NNN +317830 KR7317830008ǽý۽ ST3100910270000 NN N N 0 N N0000143900000100001NNN00NNN000000100N0900000009965190000000001002019081400000000001077300000000000107738180012 0 NN000000466-00000026-00000023-0023-0000000620250930000001550 NNN +317850 KR7317850006 ST3100910270000 NN N N 0 N N0000081300000100001NNN00NNN000000100N0900000001717230000000005002019072400000000000832400000000000416221000012 0 NN0000003100000000240000000230002000000000520250930000000676 NNN +317870 KR7317870004̿Ͼ ST3100910310000 NN N N 0 N N0000101100000100001NNN00NNN000000100N0900000000273150000000005002019102400000000000854600000000000427325950012 0 NN000000098-00000042-00000031-0031-0000000720250930000000864 NNN +318000 KR7318000007KBG ST3100910230000 NN N N 0 N N0000046650000100001NNN00NNN000000100N0900000000623590000000002002019080100000000000874000000000000174804460012 0 NN0000001700000000200000000230002000000000620250930000000407 NNN +318010 KR7318010006ʽ ST3100910190000 NN N N 0 N N0000034300000100001NNN00NNN000000100N0900000000084780000000005002019102200000000000792900000000000396466900012 0 NN000000098-000000030000000240002100000000620250930000000271 NNN +318020 KR7318020005Ʈ ST3100910280000 NN N N 0 N N0000036350000100001NNN00NNN000000100N0900000000272750000000001002020120300000000001230100000000000126622720012 0 NN000000572000000007-00000011-001300000000420250930000000447 NNN +318060 KR7318060001׷ ST0100910230000 NN N N 0 N N0000450000000100001NNN00NNN000000100N0900000003467460000000005002025082500000000001111700000000000555888850012 0 NN000000101-00000099-00000103-010300000000020250930000005002 NNN +318160 KR7318160009̿޸ ST3100910200000 NN N N 0 N N0000081500000100001NNN00NNN000000100N0900000000774700000000005002023042000000000000934100000000000467060050012 0 NN0000003680000000810000000720006500000001720250930000000761 NNN +318410 KR7318410008 ST3100910230000 NN N N 0 N N0000074000000100001NNN00NNN000000100N0900000000214420000000005002020092100000000000555500000000000277762150012 0 NN0000003610000000570000000670005400000000820250930000000411 NNN +319400 KR7319400008빫 ST2100910270000 NN N N 0 N N0000318500000100001NNN03NNN000000100N0900000058104770000000001002019050800000000011137600000000001179700390012 0 NN0000028000000001640000001230010100000001620250930000035473 NNN +319660 KR7319660007ǿ ST2100910270000 NN N N 0 N Y0000537000000100001NNN00NNN000000050Y0900000011981070000000005002019051000000000002896600000000001462418850012 0 NN0000031450000006660000007000059200000001520250930000015555 NNN +320000 KR7320000003ѿݵü ST3100910270000 NN N N 0 N N0000019000000100001NNN00NNN000000100N0900000003125090000000001002019091800000000003289700000000000328972240012 0 NN000000095-00000044-00000226-0208-0000006720241231000000625 NNN +321260 KR7321260002õ ST3100910280000 NN N N 0 N N0000017950000100001NNN00NNN000000100N0900000001072610000000001002019053100000000002819200000000000281920840012 0 NN0000002330000000110000000160001400000001020250930000000506 NNN +321370 KR7321370009 ST3100910280000 NN N N 0 N N0000037550000100001NNN02NNN000000100N0900000148272770000000005002023071900000000004549900000000002274953650012 0 NN000000131-00000102-00000120-0120-0000020820250930000001708 NNN +321550 KR7321550006Ƽ̿ ST3100600000000 NN N N 0 N N0000057900000100001NNN00NNN000000100N0900000001403080000000005002019112200000000002902400000000001451245100012 0 NN000000078-00000134-00000165-0165-0000002820250930000001680 NNN +321820 KR7321820003ƼƮ۴ ST3000000000000 NN N N 0 N N0000040950000100001NNN00NNN000000100N0900000000446570000000005002021020300000000001559100000000000779568800012 0 NN000000393-0000002000000002200022-0000000220250930000000638 NNN +322180 KR7322180001LSƼ ST3000000000000 NN N N 0 N N0000090300000100001NNN00NNN000000100N0900000004973940000000001002019103100000000002092100000000000209542590012 0 NN000000405-00000044-00000100-0089-0000001020250930000001889 NNN +322310 KR7322310004νũ ST3100910270000 NN N N 0 N N0000272000000100001NNN00NNN000000100N0900000002454330000000005002021022400000000000936600000000000468327100012 0 NN000000383-00000068-00000073-006800000000320250930000002547 NNN +322510 KR7322510009̿ ST3000000000000 NN N N 0 N N0000073700000100001NNN00NNN000000100N0900000006396250000000001002019121100000000002552800000000000255288920012 0 NN000000024-00000089-00000088-0082-0000004420250930000001881 NNN +322780 KR7322780008۽ڸ ST3101500000000 NN N N 0 N N0000007730000100001NNN00NNN000000100N0900000014202150000000001002019053100000000004292800000000000429286390012 0 NN000000183-00000066-00000109-0096-0000005820250930000000331 NNN +323280 KR7323280008¼ ST1100910270000 NN N N 0 N Y0000712000000100001NNN01NNN000000100N0900000026172900000000001002019062400000000003050000000000000305007300012 0 NN000000250-00000039-00000053-0053-0000000220250930000021716 NNN +323350 KR7323350009ٿؽ ST3100910270000 NN N N 1 N N0000084300000100001NNN02NNN000000100N0900000004416380000000001002024061100000000000801000000000000080107720012 0 NN000000187000000013-00000042-0041-0000004320241231000000675 NNN +323990 KR7323990002ڼ̿ ST2100600000000 NN N N 0 N N0000103200000100001NNN00NNN000000100N0900000007064670000000005002020092200000000002325700000000001162867250012 0 NN000000019-00000150-00000106-0106-0000001420241231000002400 NNN +327260 KR7327260006RFƮ ST3100910280000 NN N N 0 N N0000317500000100001NNN00NNN000000100N0900000003299660000000005002019122400000000000843300000000000421661550012 0 NN0000004300000000460000000530005100000000020250930000002677 NNN +328130 KR7328130000 ST1000000000000 NY N N 0 N Y0000469000000100001NNN00NNN000000100N0900000007858810000000005002022072100000000002925600000000001462837300012 0 NY000000567-00000635-00000147-0149-0000004420250930000013721 NNN +328380 KR7328380001Ʈ ST3000000000000 NN N N 0 N N0000008400000100001NNN00NNN000000100N0900000000934210000000001002019082000000000003426200000000000342627780012 0 NN0000004730000000000000000000000000000000120250930000000287 NNN +330350 KR7330350000 ST3100910240000 NN N N 0 N N0000086400000100001NNN00NNN000000100N0900000003951050000000002002020070300000000001320200000000000264042780012 0 NN0000010270000000570000000510004800000000520241231000001140 NNN +330730 KR7330730003긴ó ST3101400000000 NN N N 0 N N0000054500000100001NNN00NNN000000100N0900000000843280000000005002022022500000000001821700000000000910891500012 0 NN0000001420000000340000000340002300000000320241231000000992 NNN +330860 KR7330860008нũ ST3100600000000 NN N N 0 N N0000185600000100001NNN00NNN000000060Y0900000002577690000000005002020111700000000001218400000000000609202250012 0 NN000001193-00000026-00000131-0287-0000001520241231000002261 NNY +331380 KR7331380006Ŀ̾ ST3100910280000 NN N N 0 Y N0000028450000100001NNN00NNN000000100N0900000012162010000000001002019100200000000002953400000000000295345060012 0 NN000000582-00000051-00000083-0110-0000005620241231000000840 NNN +331520 KR7331520007 ST3000000000000 NN N N 0 N N0000005650000100001NNN00NNN000000100N0900000000507520000000001002019102900000000005086400000000000508643900012 0 NN0000002640000000110000000100000500000000620250930000000287 NNN +331740 KR7331740001ƿũƮ ST0000000000000 NN N N 0 N N0000161000000100001NNN00NNN000000100N0900000002119110000000005002025071500000000000971800000000000485924550012 0 NN000000159-00000130-00000139-014000000000020250930000001564 NNN +331920 KR7331920009ͽ ST3100910240000 NN N N 0 N N0000029350000100001NNN00NNN000000100N0900000000423040000000005002020082100000000000816400000000000408207400012 0 NN000000041-00000029-00000032-0032-0000005220250930000000239 NNN +332290 KR7332290006 ST3100910230000 NN N N 0 N N0000011320000100001NNN00NNN000000100N0900000000817370000000001002019101100000000003990400000000000399044040012 0 NN0000008060000000510000000140001600000001220250930000000451 NNN +332370 KR7332370006̵ ST3100910280000 NN N N 0 N N0000050800000100001NNN00NNN000000100N0900000000101660000000005002020082400000000001327300000000000663686300012 0 NN0000003640000000970000001030008500000001920250930000000674 NNN +332570 KR7332570001PSϷƮδн ST3100910280000 NN N N 0 N N0000075400000100001NNN00NNN000000100N0900000033514310000000005002020073100000000004378900000000002287142550012 0 NN0000009680000000510000001350011600000001120250930000003301 NNN +333050 KR7333050003ڿý ST3000000000000 NN N N 0 N N0000012890000100001NNN00NNN000000100N0900000000657860000000001002019103100000000002461300000000000246133260012 0 NN0000002800000000200000000280002400000001120241231000000317 NNN +333430 KR7333430007Ͻ ST3100910300000 NN N N 0 N N0000061200000100001NNN00NNN000000100N0900000003147300000000001002019110600000000003072600000000000307267470012 0 NN0000003540000000530000000640005800000001320250930000001880 NNN +333620 KR7333620003ý ST3100910280000 NN N N 0 N N0000069000000100001NNN00NNN000000100N0900000000670550000000001002021040100000000001055600000000000105563440012 0 NN000000404-00000043-00000045-0036-0000000120250930000000728 NNN +334970 KR7334970001Ƽ̿ ST2100910240000 NN N N 0 N N0000030000000100001NNN00NNN000000100N0900000002601970000000005002021031100000000007775200000000003887631850006 0 NN000000125-00000337-00000275-0275-0000002720250630000002332 NNN +335810 KR7335810008̿ ST3100910290000 NN N N 0 N N0000026500000100001NNN00NNN000000100N0900000000281490000000005002020122200000000001795700000000000897890500012 0 NN000000146-00000040-00000062-0062-0000003420250930000000475 NNN +335870 KR7335870002Dz ST3101100000000 NN N N 0 N N0000021700000100001NNN00NNN000000100N0900000000564580000000001002019120900000000001675000000000000167504730012 0 NN0000004650000000190000000150001200000000420241231000000363 NNN +336060 KR7336060009̹ ST3000000000000 NN N N 0 N N0000010300000100001NNN00NNN000000100N0900000002107430000000001002019112800000000004815500000000000481552000012 0 NN000000478-00000012-00000003-000100000000620250930000000495 NNN +336570 KR7336570007 ST1100910290000 NN N N 0 N Y0000089800000100001NNN00NNN000000050Y0900000009996850000000001002019121900000000008996800000000000899688970012 0 NN0000011050000003940000003460029000000003220250930000008079 NNY +336680 KR7336680004žŻַ ST3100910280000 NN N N 0 N N0000044700000100001NNN00NNN000000060Y0900000000906250000000005002024110100000000003914500000000001957277900012 0 NN0000039610000000670000000420003600000000020250930000001749 NNY +337930 KR7337930002ùͽ ST3000000000000 NN N N 0 N N0000052800000100001NNN00NNN000000100N0900000008522430000000005002020081300000000002967600000000001509390100012 0 NN0000019520000001440000001130009500000001220250930000001566 NNN +338220 KR7338220007 ST2000000000000 NN N N 0 N N0000221500000100001NNN00NNN000000100N0900000002022660000000001002021022600000000001400100000000000140018230012 0 NN000000276-00000026-00000031-0031-0000003620250930000003101 NNN +338840 KR7338840002̹̿ ST3100600000000 NN N N 0 N N0000256500000100001NNN00NNN000000100N0900000002716800000000005002023120500000000001517800000000000758904050012 0 NN000000058-00000084-00000064-0064-0000003120241231000003893 NNN +339950 KR7339950008̺迵 ST3100600000000 NN N N 0 N N0000020500000100001NNN00NNN000000100N0900000000710540000000001002019122400000000004494600000000000449466550012 0 NN0000008630000001310000001900014800000003220250930000000921 NNN +340360 KR7340360007ٺũ ST3100910280000 NN N N 0 N N0000015520000100001NNN00NNN000000100N0900000006509690000000001002019121900000000005101200000000000510129090012 0 NN000000496-00000006-00000006-000600000000020250930000000791 NNN +340440 KR7340440007B&G ST3100910230000 NN N N 0 N N0000014340000100001NNN00NNN000000100N0900000000938970000000001002019122700000000002837800000000000283783640012 0 NN0000005540000000310000000270002300000000720241231000000406 NNN +340450 KR7340450006 ST0100600000000 NN N N 0 N N0000078600000100001NNN00NNN000000100N0900000008198150000000005002025061100000000002365000000000001182539650012 0 NN000000259-00000012-00000011-0013-0000000420241231000001858 NNN +340570 KR7340570001Ƽؿ ST2100910240000 NN N N 0 N N0000494500000100001NNN00NNN000000050Y0900000000408850000000005002020112000000000000812800000000000446400000012 0 NN0000013080000004230000004410035000000002420250930000004019 NNY +340810 KR7340810001üAI ST3000000000000 NN N N 1 N N0000038600000100001NNN00NNN000000100N0900000048152770000000005002023051900000000001295600000000000650304000012 0 NN000000053-00000088-00000135-0135-0000013620250930000000500 NNN +340930 KR7340930007Ͽũ ST3100910270000 NN N N 0 N N0000013420000100001NNN00NNN000000100N0900000062249150000000005002021022500000000006887500000000003443789250012 0 NN000000274-00000054-00000089-0089-0000005520250930000000924 NNN +342870 KR7342870003 ST0101100000000 NN N N 0 N N0000073100000100001NNN00NNN000000100N0900000000330810000000005002025090900000000000624800000000000406807100012 0 NN000000767000000069-00000004-000800000000020250930000000456 NNN +344860 KR7344860002̳ ST3100910230000 NN N N 0 N N0000017680000100001NNN00NNN000000100N0900000000583500000000001002023022000000000001203000000000000120300000012 0 NN0000000890000000060000000110000900000000620241231000000212 NNN +347000 KR7347000002 ST3100910290000 NN N N 0 N N0000021550000100001NNN00NNN000000100N0900000001474230000000005002020102900000000003781000000000001930292300012 0 NN0000002420000000160000000350003600000001420250930000000814 NNN +347700 KR7347700007Ǿ ST2000000000000 NN N N 0 N N0000224500000100001NNN02NNN000000100N0900000026367990000000005002021032300000000004687200000000002343619400012 0 NN0000006180000000540000002800021000000000020250930000010522 NNN +347740 KR7347740003ǿǺӻ󿬱Ÿ ST3100600000000 NN N N 0 N N0000023950000100001NNN00NNN000000100N0900000000876590000000005002020090900000000003001000000000001500528800012 0 NN0000001700000000320000000660005500000000820250930000000718 NNN +347770 KR7347770000˽ ST3100910280000 NN N N 0 N N0000010830000100001NNN00NNN000000100N0900000001449350000000005002020091800000000002285700000000001152827100012 0 NN000000494-00000028-00000036-0037-0000000920250930000000247 NNN +347850 KR7347850000صĸ ST1100600000000 NY N N 0 N Y0000993000000100001NNN00NNN000000100N0900000011753710000000005002024050200000000004353500000000002176771500012 0 NY000000033-00000236-00000265-0258-0000004920250930000043230 NNN +347860 KR7347860009ü ST3000000000000 NN N N 0 N N0000021400000100001NNN00NNN000000100N0900000008295700000000005002020122100000000003871000000000001935548050012 0 NN000000058-00000100-00000036-0036-0000000720250930000000828 NNN +347890 KR7347890006 ST3100910290000 NN N N 0 N N0000069900000100001NNN00NNN000000060Y0900000000828120000000001002020072900000000001691300000000000169132040012 0 NN0000002570000000240000000310002900000000020250930000001182 NNN +348030 KR7348030008񸯽 ST3000000000000 NN N N 0 N N0000028900000100001NNN00NNN000000100N0900000000158330000000001002021012800000000000960300000000000096038000012 0 NN000000305-00000066-00000064-0066-0000002120250930000000277 NNN +348080 KR7348080003ťƼ ST3100600000000 NN N N 0 Y N0000010580000100001NNN00NNN000000100N0900000004581020000000005002023061500000000008178600000000004089339700012 0 NN000000004-00000197-00000263-0263-0000009320241231000000865 NNN +348150 KR7348150004̿ ST3100600000000 NN N N 0 N N0000059000000100001NNN00NNN000000100N0900000001247010000000005002020111800000000001941800000000000970944450012 0 NN000000542-00000067-00000054-0054-0000001820250930000001145 NNN +348210 KR7348210006ؽƾ ST2100910270000 NN N N 0 N Y0000934000000100001NNN00NNN000000050Y0900000002044480000000005002020100800000000001047700000000000523850250012 0 NN000000510000000023000000012-000500000000920250930000009785 NNN +348340 KR7348340001θī ST2100910270000 NN N N 0 N N0000957000000100001NNN03NNN000000100N0900000030006510000000005002022110400000000001198900000000000599456850012 0 NN000000111-00000113-00000162-0162-0000015520250930000011473 NNN +348350 KR7348350000 ST3100910290000 NN N N 0 N N0000092300000100001NNN00NNN000000100N0900000000574930000000005002020103000000000001018300000000000509180000012 0 NN0000003500000000140000000180001700000000520250930000000939 NNN +348370 KR7348370008 ST1100910230000 NY N N 0 N Y0000885000000100001NNN00NNN000000100N0900000012855870000000005002021110100000000002185000000000001092506800012 0 NY000002225-0000065700000001600004-0000003720250930000019337 NNN +351320 KR7351320007ػ̳ͽ ST3100910270000 NN N N 0 N N0000012640000100001NNN00NNN000000100N0900000001043060000000001002020062200000000002882300000000000288237520012 0 NN000000113-00000076-00000103-0100-0000007420250930000000364 NNN +351330 KR7351330006̻迣Ͼ ST3000000000000 NN N N 0 N N0000097700000100001NNN00NNN000000100N0900000001894120000000005002021042100000000000828800000000000414426000012 0 NN000000547-00000036-00000047-0059-0000002320250930000000809 NNN +351870 KR7351870001Ŀ´̼ ST3100600000000 NN N N 0 N N0000047100000100001NNN00NNN000000100N0900000000102820000000005002024092700000000001116000000000000558032100012 0 NN0000004310000000190000000090000700000000120250930000000525 NNN +352090 KR7352090005ũ ST3100910230000 NN N N 0 N N0000034600000100001NNN00NNN000000100N0900000001456180000000001002023112000000000002687200000000000268729980012 0 NN0000005420000000970000001060007900000001220250930000000929 NNN +352480 KR7352480008ؾͳų ST2100910230000 NN N N 0 N Y0000359500000100001NNN00NNN000000060Y0900000000731340000000001002021051700000000001362900000000000136299010012 0 NN0000021520000002110000001650012700000000820250930000004899 NNY +352700 KR7352700009 ST3100910230000 NN N N 0 N N0000021900000100001NNN00NNN000000100N0900000000320670000000005002021012800000000002627600000000001433664950012 0 NN000000500-000000160000000380002700000000120250930000000575 NNN +352770 KR7352770002Ʈ ST3100600000000 NN N N 0 Y N0000052500000100001YNY00NNN000000100N0900000000000000000000001002020120400000000000259200000000000025924070012 0 NN000000033-00000076-00000089-0089-3610000020250930000000136 NNN +352910 KR7352910004 ST3000000000000 NN N N 0 N N0000058000000100001NNN00NNN000000100N0900000000789220000000005002021071300000000001263700000000000631890100012 0 NN000000249-00000024-00000020-0020-0000000320250930000000732 NNN +352940 KR7352940001ι̿ ST3100910230000 NN N N 0 N N0000021400000100001NNN00NNN000000100N0900000000185210000000005002020121100000000001086700000000000599154500012 0 NN0000003570000000140000000090000600000000220241231000000232 NNN +353190 KR7353190002޷ ST3100910190000 NN N N 0 N N0000006540000100001NNN00NNN000000100N0900000004237050000000001002020061700000000003937800000000000393784200012 0 NN0000007550000000080000000120000600000000420250930000000257 NNN +353590 KR7353590003 ST3101100000000 NN N N 0 N N0000035400000100001NNN00NNN000000100N0900000000901770000000005002022012000000000001287500000000000643778500012 0 NN000000441-00000004-00000022-0022-0000002420250930000000455 NNN +353810 KR7353810005̿ ST3100910190000 NN N N 0 N N0000071500000100001NNN00NNN000000100N0900000005907190000000001002020060500000000003308100000000000341917200012 0 NN0000034760000003140000002490018500000002720250930000002365 NNN +354200 KR7354200008̿ ST3100600000000 NN N N 0 N N0000020150000100001NNN00NNN000000100N0900000051215370000000010002020121000000000002503800000000002503812800012 0 NN000000093-00000064-00000080-0111-0000010520250930000000504 NNN +354320 KR7354320004˸ ST3100910260000 NN N N 0 N N0000581000000100001NNN02NNN000000100N0900000001257490000000005002023063000000000000639100000000000319569050012 0 NN000001436000000068-00000010-000800000000220250930000003713 NNN +355150 KR7355150004ڽؽý ST3100910280000 NN N N 0 N N0000149200000100001NNN00NNN000000100N0900000004486500000000005002020091800000000000779700000000000389867500012 0 NN000000142-00000019-00000018-0018-0000000720241231000001163 NNN +355390 KR7355390006ũ ST3000000000000 NN N N 0 N N0000037400000100001NNN00NNN000000100N0900000001837080000000005002023083100000000001360300000000000680158800012 0 NN000000062-00000088-00000126-0126-0000007120250930000000508 NNN +355690 KR7355690009 ST3100910280000 NN N N 0 N N0000040450000100001NNN00NNN000000100N0900000000580680000000005002023120100000000000540400000000000270249000012 0 NN000000427-00000056-00000101-010000000000020250930000000218 NNN +356680 KR7356680009Ʈ ST2000000000000 NN N N 0 N N0000076700000100001NNN00NNN000000060Y0900000001412870000000001002023031600000000002854300000000000285434920012 0 NN0000004320000000350000000410004000000000920241231000002189 NNN +356860 KR7356860007Ƽ ST2100910280000 NN N N 0 N N0000617000000100001NNN00NNN000000100N0900000003171030000000005002020121400000000000983200000000000491631500012 0 NN0000018590000001740000001560011900000001220250930000006066 NNN +356890 KR7356890004̹ ST3000000000000 NN N N 0 N N0000040600000100001NNN00NNN000000100N0900000001368840000000002002021031100000000001195300000000000239076500012 0 NN000000243-000000020000000060000500000002120250930000000485 NNN +357230 KR7357230002ġǿ ST3100910190000 NN N N 0 N N0000025550000100001NNN00NNN020000100N0900000001335220000000005002021051400000000004129300000000002104474350012 0 NN0000019470000000930000000940006900000000420250930000001055 NNN +357550 KR7357550003濡Ƽ ST2100910230000 NN N N 0 N N0000603000000100001NNN00NNN000000060Y0900000000160940000000005002020122300000000000545500000000000272750000012 0 NN0000001350000000380000000310002600000001120250930000003289 NNN +357580 KR7357580000Ƹ𼾽 ST3100910280000 NN N N 0 N N0000125400000100001NNN00NNN000000100N0900000003818220000000005002021062500000000001128200000000000565574600012 0 NN000000885000000029-00000008-000600000000020250930000001414 NNN +357780 KR7357780006ֺ극 ST1100910230000 NY N N 0 N Y0004125000000100001NNN00NNN000000050Y0900000001726690000000005002020080600000000000777800000000000388928300012 0 NY0000067940000009060000009440073300000000720250930000032086 NNN +357880 KR7357880004SKAI ST3000000000000 NN N N 0 N N0000017400000100001NNN00NNN000000100N0900000006404100000000005002021111000000000004689900000000002344950900012 0 NN000000114-00000030-00000062-0062-0000024820250930000000816 NNN +358570 KR7358570000̳뺣̼ ST1100600000000 NY N N 0 N Y0000165000000100001NNN00NNN000000100N0900000008937430000000005002023033000000000006387200000000003193799550012 0 NY000000000-00000483-00000590-0588-0000011720241231000010539 NNN +359090 KR7359090008˸ġ ST3100600000000 NN N N 0 N N0000008810000100001NNN00NNN000000100N0900000001914830000000001002020092300000000005747000000000000574707170012 0 NN0000004980000000130000000120001400000000620250930000000506 NNN +360070 KR7360070007žƼ ST3100910280000 NN N N 0 N N0000238000000100001NNN00NNN000000060Y0900000000924040000000005002022101800000000000814500000000000407252150012 0 NN000001061-00000072-00000111-0082-0000000620241231000001938 NNY +360350 KR7360350003ڼ ST3100910290000 NN N N 0 N N0000063100000100001NNN00NNN000000100N0900000000191830000000005002024022300000000000572700000000000286398500012 0 NN000000086-00000018-00000018-001700000000020250930000000361 NNN +361390 KR7361390008 ST3100910280000 NN N N 0 N N0000252500000100001NNN00NNN000000060Y0900000004170570000000005002021032400000000000880000000000000443239450012 0 NN000000568-00000022-00000034-0031-0000000920241231000002222 NNN +361570 KR7361570005˺ ST3101500000000 NN N N 0 N N0000018890000100001NNN00NNN000000100N0900000000607890000000005002021112200000000002874300000000001444819350012 0 NN000000328-00000022-00000042-0042-0000001420250930000000542 NNN +361670 KR7361670003￵ؾ ST3100910280000 NN N N 0 N N0000035350000100001NNN00NNN000000100N0900000000067150000000005002021052100000000000566700000000000283382900012 0 NN000000083-00000014-00000010-001000000000020250930000000200 NNN +362320 KR7362320004û۷ι ST3101100000000 NN N N 0 N N0000058500000100001NNN00NNN000000060Y0900000001318390000000005002022060300000000002115100000000001057564500012 0 NN0000014750000001080000000920007200000000220250930000001237 NNN +362990 KR7362990004帲λƮ ST3100600000000 NN N N 0 N N0000017700000100001NNN00NNN000000100N0900000000249170000000001002024012500000000001680000000000000168005740012 0 NN000000154-00000008-00000005-000500000000320250930000000297 NNN +363250 KR7363250002ý ST3100910290000 NN N N 0 N N0000054400000100001NNN00NNN000000100N0900000000680140000000005002021052600000000000704200000000000352139900012 0 NN000000002-00000067-00000066-0065-0000005320250930000000383 NNN +363260 KR7363260001 ST3100600000000 NN N N 0 N N0000016560000100001NNN00NNN000000100N0900000002633530000000005002021021000000000003216300000000001608188450012 0 NN0000003630000000470000000470004000000000820250930000000532 NNN +364950 KR7364950006̾ڸ ST3100910270000 NN N N 0 N N0000082600000100001NNN00NNN000000100N0900000002175660000000005002025042900000000000829600000000000414822250012 0 NN000000718000000033-00000017-001200000000020250930000000685 NNN +365270 KR7365270008ťŬ ST3100600000000 NN N N 0 N N0000088900000100001NNN00NNN000000100N0900000004660320000000005002021072200000000002100900000000001050457750012 0 NN000000016-00000126-00000149-0149-0000004120241231000001867 NNN +365330 KR7365330000̽ƿ ST3100910260000 NN N N 0 N N0000034900000100001NNN00NNN000000060Y0900000010906210000000005002023111300000000005017100000000002508550000012 0 NN0000011700000000810000000720006100000001320241231000001750 NNY +365340 KR7365340009 ST2100910230000 NN N N 0 N Y0000730000000100001NNN01NNN000000100N0900000002319620000000005002022072800000000001223500000000000611772300012 0 NN000001412-00000452-00000655-0665-0000006320250930000008931 NNN +365590 KR7365590009̵ ST3100910280000 NN N N 0 N N0000024300000100001NNN00NNN000000100N0900000003353960000000001002020122100000000003095600000000000309566220012 0 NN000000059-00000091-00000094-0094-0000008220241231000000752 NNN +365900 KR7365900000̾ ST3100910310000 NN N N 0 N N0000028550000100001NNN00NNN000000100N0900000000264810000000005002022022400000000000731000000000000365515000012 0 NN000000354-00000006-00000016-0018-0000001320250930000000208 NNN +366030 KR7366030005 ST3100910200000 NN N N 0 N N0000062400000100001NNN00NNN000000060Y0900000003983460000000001002022032300000000002265300000000000226538500012 0 NN0000003220000000490000000630004900000000920250930000001413 NNN +367000 KR7367000007÷Ƽ ST3000000000000 NN N N 0 N N0000041850000100001NNN00NNN000000100N0900000000799340000000005002021081200000000000838800000000000419410350012 0 NN000000267-00000060-00000057-005800000000020250930000000351 NNN +368600 KR7368600003̾ġ ST3100910280000 NN N N 0 N N0000011400000100001NNN00NNN000000100N0900000001379150000000005002022072900000000001753800000000000876917300012 0 NN000000349-00000115-00000153-0167-0000006220250930000000199 NNN +368770 KR7368770004̹ ST2100910290000 NN N N 0 N N0000160100000100001NNN00NNN000000100N0900000005375020000000001002021012100000000003285400000000000328542250012 0 NN0000003120000000710000000710006500000002320250930000005259 NNN +368970 KR7368970000 ST3100910190000 NN N N 0 N N0000019240000100001NNN00NNN000000100N0900000000194130000000005002022101400000000000934600000000000467308000012 0 NN000000188-00000013-00000024-0019-0000000420250930000000179 NNN +369370 KR7369370002̿θƮ ST3101500000000 NN N N 0 N N0000014150000100001NNN00NNN000000100N0900000000398700000000001002020122300000000004987100000000000498719110012 0 NN000000216-00000061-00000086-0083-0000003820250930000000705 NNN +370090 KR7370090003ǻƼ ST3100910290000 NN N N 0 N N0000153600000100001NNN00NNN000000100N0900000002812760000000005002022022300000000000855600000000000434860000012 0 NN000000253-00000038-000000080000100000000020241231000001314 NNN +371950 KR7371950007dz ST2100910280000 NN N N 0 N N0000108200000100001NNN00NNN000000100N0900000000668150000000005002022022800000000002266200000000001133127400012 0 NN000000223-00000120-00000156-0156-0000006820250930000002452 NNN +372170 KR7372170001ؾ ST2100910270000 NN N N 0 N N0000373000000100001NNN00NNN000000060Y0900000000832890000000001002022111400000000000797900000000000079790480012 0 NN000000751-00000171-00000180-017000000000120250930000002976 NNN +372320 KR7372320002ťμ ST2100600000000 NN N N 0 N N0000510000000100001NNN00NNN000000100N0900000001794910000000005002023110900000000001445800000000000722941400012 0 NN000000000-00000276-00000288-0288-0000013620250930000007374 NNN +372800 KR7372800003Ƽ ST3000000000000 NN N N 0 N N0000057400000100001NNN00NNN000000100N0900000004891750000000005002021111100000000000604600000000000302349500012 0YNN000000618-00000011-00000064-0064-0000003620250930000000347 NNN +373110 KR7373110006ǻƽ ST3100910240000 NN N N 0 N N0000016160000100001NNN00NNN000000100N0900000001015540000000005002024071500000000001729400000000000864719700012 0 NN000000009-00000076-00000076-0076-0000015520250930000000279 NNN +373160 KR7373160001̿۴ ST3100600000000 NN N N 0 N N0000045000000100001NNN00NNN000000100N0900000000320280000000005002025012400000000001380500000000000690260950012 0 NN0000009000000000250000000260002600000000820250930000000621 NNN +373170 KR7373170000ťַ ST3000000000000 NN N N 1 N N0000122000000100001NNN00NNN000000100N0900000002971980000000001002023080400000000000503700000000000050379300012 0 NN000000296-00000011-00000001-0001-0000000120241231000000614 NNN +373200 KR7373200005÷ ST3100910310000 NN N N 0 N N0000006160000100001NNN00NNN000000100N0900000010660440000000001002021022600000000011000500000000001100053360012 0 NN000000087-00000029-00000074-007200000000020250930000000677 NNN +376180 KR7376180006ڱ׷ ST3100910310000 NN N N 0 N N0000024800000100001NNN00NNN000000100N0900000002947660000000001002021110300000000001856100000000000186610380012 0 NN0000003210000000280000000860007100000001820241231000000460 NNN +376270 KR7376270005HEMĸ ST3100600000000 NN N N 0 N N0000877000000100001NNN01YNN000000100N0900000000755700000000005002024110500000000000715700000000000357886350012 0 NN000000093-00000088-00000092-009200000000020250930000006277 NNN +376290 KR7376290003ũ ST3100910280000 NN N N 0 N N0000028800000100001NNN00NNN000000100N0900000000234420000000005002021100800000000001765700000000000882875000012 0 NN0000014990000000260000000150000200000000620250930000000508 NNN +376300 KR7376300000 ST1000000000000 NY N N 0 N Y0000385000000100001NNN00NNN000000050Y0900000003201900000000005002021111000000000002373800000000001186920300012 0 NY0000006000000002160000001160008300000000720250930000009139KAONNY +376900 KR7376900007Ŷコɾ ST2100910240000 NN N N 0 N N0000663000000100001NNN00NNN000000100N0900000003872680000000005002025051200000000001566100000000000783074450012 0 NN000000167-00000001-00000018-002500000002320250930000010383 NNN +376930 KR7376930004 ST3100910290000 NN N N 0 N N0000019220000100001NNN00NNN000000100N0900000010992990000000005002022030300000000005129100000000002564566150012 0 NN000000039-00000134-00000136-0136-0000011920250930000000985 NNN +376980 KR7376980009Ƽ左 ST3000000000000 NN N N 0 N N0000035500000100001NNN00NNN000000100N0900000000677620000000005002021081100000000000976600000000000488319700012 0 NN000000273-0000000100000001000009-0000000220250930000000346 NNN +377030 KR7377030002Ʈƽ ST3000000000000 NN N N 0 N N0000019140000100001NNN00NNN000000100N0900000004912680000000005002021072700000000004193700000000002096855200012 0 NN000000207-00000087-00000762-0760-0000042820250930000000802 NNN +377220 KR7377220009ҹ̿ ST3100910190000 NN N N 0 N N0000013830000100001NNN00NNN000000100N0900000004577570000000001002021092800000000002831000000000000283100000012 0 NN000000527-00000106-00000125-0125-0000004720250930000000391 NNN +377330 KR7377330006Ʈδн ST3100910280000 NN N N 0 N N0000035950000100001NNN00NNN000000100N0900000000158610000000005002022020400000000000813900000000000408997700012 0 NN000000087-00000162-00000135-0135-0000002620250930000000292 NNN +377450 KR7377450002 ST2000000000000 NN N N 0 N N0000117300000100001NNN00NNN000000060Y0900000000748450000000001002021102900000000001733000000000000173300000012 0 NN0000006780000002050000002530020600000001320241231000002032 NNN +377460 KR7377460001Ͼƿ̵ ST3100600000000 NN N N 0 N N0000040800000100001YNY00NNN000000100N0900000000000000000000005002022062300000000006205500000000003102784350012 0 NN000000700-0000001200000003800038-0000004220250930000002531 NNN +377480 KR7377480009AI ST3000000000000 NN N N 0 N N0000201000000100001NNN00NNN000000100N0900000001778520000000005002021112300000000000711000000000000355513750012 0 NN000000064-00000051-00000079-0079-0000005920250930000001429 NNN +378340 KR7378340004ʿ ST2100910270000 NN N N 0 N N0000172500000100001NNN00NNN000000060Y0900000007940880000000005002023071400000000002146200000000001073144100012 0 NN000000252-00000153-00000138-0130-0000000620250930000003702 NNY +378800 KR7378800007 ST3100910240000 NN N N 0 N N0000019320000100001NNN00NNN000000100N0900000009832690000000005002022101900000000004624300000000002312151550012 0 NN000000002-00000114-00000112-0112-0000012020250930000000893 NNN +380540 KR7380540005Ƽھ ST3100910280000 NN N N 0 N N0000037500000100001NNN02NNN000000100N0900000038567960000000001002022122900000000004879300000000000487931670012 0 NN000000083-00000051-00000156-0156-0000008120250930000001829 NNN +380550 KR7380550004 ST0000000000000 NN N N 0 N N0000218000000100001NNN00NNN000000100N0900000003048510000000010002025072500000000001163600000000001163660300012 0 NN000000022-00000146-00000151-0151-3610000020241231000002536 NNN +381620 KR7381620004нκƽ ST3100910270000 NN N N 0 N N0000144100000100001NNN00NNN000000060Y0900000007938210000000001002024093000000000001311700000000000131179200012 0 NN000000208-00000082-00000066-005400000000020250930000001890 NNN +382150 KR7382150001ũν ST3100600000000 NN N N 0 N N0000094600000100001NNN00NNN000000100N0900000001464670000000005002024121800000000001211100000000000605597850012 0 NN000000002-00000066-00000061-0061-0000005820250930000001145 NNN +382480 KR7382480002 ST3100910270000 NN N N 0 N N0000024100000100001NNN00NNN000000100N0900000007414980000000001002021102100000000003935700000000000393571400012 0 NN000000234-00000013-00000015-001400000000320250930000000948 NNN +382800 KR7382800001غ񿡽 ST3100910270000 NN N N 0 N N0000033800000100001NNN00NNN000000100N0900000002804800000000005002021102900000000003183100000000001598284650012 0 NN0000006230000000320000000260002100000000520250930000001075 NNN +382840 KR7382840007 ST3100910270000 NN N N 1 N N0000107100000100001NNN00NNN000000060Y0900000018436540000000001002021100700000000001527100000000000152715810012 0 NN000001341000000049-00000022-0040-0000000820250930000001635 NNN +382900 KR7382900009ǻ ST3100910280000 NN N N 0 N N0000317500000100001NNN00NNN000000060Y0900000001160840000000005002022061700000000000876100000000000438050000012 0 NN000000279000000017-00000002-0003-0000000020250930000002781 NNN +383310 KR7383310000οġ ST2100910230000 NN N N 0 N Y0000364500000100001NNN00NNN000000050Y0900000026003090000000005002021052800000000002097400000000001048746600012 0YNN0000010180000000940000001190009600000000820250930000007645LD2NNN +383930 KR7383930005Ƽؾ˿ ST3100600000000 NN N N 0 N N0000025700000100001NNN00NNN000000100N0900000000973580000000005002022111100000000001278400000000000639206400012 0 NN000000360-00000113-00000015-0020-0000000720241231000000328 NNN +384470 KR7384470001ھμƮ ST3000000000000 NN N N 0 N N0000043800000100001NNN00NNN000000100N0900000001813390000000005002023091800000000001794600000000000897334600012 0 NN000000030-00000105-00000113-0113-0000010820250930000000786 NNN +387570 KR7387570005θ޵ ST3100910290000 NN N N 0 N N0000073000000100001NNN00NNN000000100N0900000000128630000000001002024122600000000000562500000000000056259000012 0 NN000000066-00000024-00000024-0023-0000001020250930000000410 NNN +388050 KR7388050007Ŀ ST3100910280000 NN N N 0 N N0000088000000100001NNN00NNN000000100N0900000004221860000000005002022040100000000001870900000000000937266850012 0 NN0000003980000000250000000280002300000001220250930000001646 NNN +388210 KR7388210007Ƽ ST0100910280000 NN N N 0 N N0001317000000100001NNN00NNN000000100N0900000004693870000000005002025112000000000000927200000000000463634400012 0 NN000001184000000418-00000296-030300000000020250930000012212 NNN +388610 KR7388610008 ST0100910230000 NN N N 0 N N0000129600000100001NNN00NNN000000100N0900000000236440000000005002025063000000000000526300000000000263185450012 0 NN000000168000000017-00000057-0059-0000012220241231000000682 NNN +388720 KR7388720005Ϸκƽ ST1100910270000 NN N N 0 N Y0001457000000100001NNN00NNN000000100N0900000006177320000000005002022031800000000001169600000000000584839750012 0 NN000000352000000004-00000085-0091-0000001420241231000017042 NNN +388790 KR7388790008 ST3100910280000 NN N N 0 N N0000025400000100001NNN00NNN000000100N0900000002979660000000001002021090300000000003060900000000000306093970012 0 NN000000131-00000053-00000047-0038-0000001720241231000000777 NNN +388870 KR7388870008ķν̹̿ ST3100600000000 NN N N 0 N N0000100400000100001NNN00NNN000000100N0900000002928690000000005002023072700000000001294500000000000647296600012 0 NN000000000-00000086-00000076-0076-0000006220250930000001299 NNN +389020 KR7389020009ڶũ ST2100910280000 NN N N 0 N N0000416000000100001NNN00NNN000000100N0900000001212230000000005002023030700000000000619700000000000321286500012 0 NN0000002220000000040000000230002000000000520241231000002578 NNN +389030 KR7389030008ϳʽ ST3100600000000 NN N N 0 N N0000040100000100001NNN00NNN000000100N0900000009443430000000005002021110800000000003335100000000001667592250012 0 NN000000073-00000087-00000092-0092-0000006620250930000001337 NNN +389140 KR7389140005 ST3101500000000 NN N N 0 N N0000086100000100001NNN00NNN000000100N0900000008039700000000005002022042800000000001426900000000000716236750012 0 NN000000244-00000047-00000058-0059-0000002620250930000001228 NNN +389260 KR7389260001 ST2101000000000 NN N N 0 N N0000170500000100001NNN00NNN000000060Y0900000000375280000000001002022051600000000001791600000000000179163250012 0 NN0000007820000000890000000520003300000000320250930000003054 NNN +389470 KR7389470006κƼ ST2100600000000 NN N N 0 N N0000819000000100001NNN00NNN000000100N0900000007295840000000005002022112200000000001273900000000000636962250012 0 NN000000019-00000209-00000138-015000000000020250930000010433 NNN +389500 KR7389500000ũ ST3100910270000 NN N N 0 N N0000787000000100001NNN00NNN000000100N0900000015099240000000005002022101700000000000633300000000000316695200012 0 NN000000055-00000069-00000008-0009-0000000820241231000004984 NNN +389650 KR7389650003ؽƮ̿޵ ST2100910290000 NN N N 0 N N0000759000000100001NNN00NNN000000100N0900000001893220000000005002024082000000000000820300000000000410194300012 0 NN000000095-000000360000000290002900000001520241231000006226 NNN +389680 KR7389680000 ST3000000000000 NN N N 2 N N0000009710000100001NNN01YNN000000100N0900000367185120000000001002024112000000000004159200000000000415924650012 0 NN000000061-00000020-00000052-0052-0000006120241231000000403 NNN +391710 KR7391710001ڴп̼ ST3100910270000 NN N N 0 N N0000027100000100001NNN00NNN000000100N0900000009061390000000001002021101500000000004262000000000000426204700012 0 NN0000005550000000000000000120001000000000420241231000001155 NNN +393210 KR7393210000丶ý ST3000000000000 NN N N 0 N N0000050500000100001NNN00NNN000000100N0900000002635500000000005002023042700000000001561400000000000780727200012 0 NN000000184-00000023-00000025-0021-0000001020250930000000788 NNN +393890 KR7393890009 ST2100910280000 NN N N 0 N N0000090100000100001NNN00NNN000000100N0900000016297480000000005002022093000000000003384300000000001692157200012 0 NN000000836-00000874-00001075-1074-0000001720250930000003049 NNN +393970 KR7393970009÷ܼ ST3100910230000 NN N N 0 N N0000042300000100001NNN00NNN000000100N0900000003934190000000005002025030600000000001780000000000000890041000012 0 NN000000650-00000022-00000076-0104-0000001620250930000000752 NNN +394280 KR7394280002¿ũ ST2000000000000 NN N N 0 N N0000146300000100001NNN00NNN000000100N0900000003382350000000001002022092600000000002205900000000000220595790012 0 NN000000127-00000213-00000209-0209-0000006220250930000003227 NNN +394800 KR7394800007 ST2100600000000 NN N N 0 N N0000147700000100001NNN00NNN000000100N0900000003772620000000001002024111400000000003176100000000000317614760012 0 NN000000058-00000074-00000066-0066-0000003320241231000004691 NNN +396270 KR7396270001ؽƮĨ ST3100910280000 NN N N 0 Y N0000033900000100001NNN00NNN000000100N0900000008271310000000005002022070100000000003286800000000001643426550012 0 NN000000323-00000184-00000207-0207-0000010820241231000001114 NNN +396300 KR7396300006Ƹīн ST3100910260000 NN N N 0 N N0000038000000100001NNN00NNN000000100N0900000029117070000000001002022032400000000002648900000000000264895000012 0 NN000000923-000000270000000130002500000000420241231000001006 NNN +396470 KR7396470007Ʈ ST3100910270000 NN N N 0 N N0000075800000100001NNN00NNN000000060Y0900000002711390000000001002023102600000000001612000000000000161200000012 0 NN0000000930000000120000000250002000000000520250930000001221 NNN +397030 KR7397030008̿ ST2100600000000 NN N N 0 N N0000583000000100001NNN00NNN000000060Y0900000007105290000000010002022072800000000002320800000000002320832600012 0 NN0000002750000001690000002000020000000002720241231000013530 NNN +397810 KR7397810003ֵ ST0100600000000 NN N N 0 N N0000075500000100001NNN00NNN000000100N0900000000420870000000005002025082200000000000516000000000000258038500012 0 NN000000237000000025-00000019-002300000000020250930000000389 NNN +398120 KR7398120006コɾ ST3100910290000 NN N N 0 N N0000031100000100001NNN00NNN000000100N0900000000468720000000001002024121900000000001181800000000000118185110012 0 NN000000129-00000006-00000009-000700000000020250930000000367 NNN +399720 KR7399720002Ĩ ST2100910280000 NN N N 0 N Y0000741000000100001NNN00NNN000000100N0900000003834150000000005002022052000000000001160000000000000580021000012 0 NN000000354-00000184-00000218-0157-0000001820250930000008595 NNN +402030 KR7402030001ڳũ ST2000000000000 NN N N 0 N N0000246000000100001NNN00NNN000000100N0900000001555370000000005002022070700000000001251700000000000625874400012 0YNN000000263-00000141-00000136-0136-0000005320241231000003079 NNN +402490 KR7402490007׸ҽ ST3100910280000 NN N N 0 N N0000088500000100001NNN00NNN000000100N0900000002576010000000005002023112400000000001656500000000000828274400012 0 NN0000007380000000360000001290011900000001920250930000001466 NNN +403490 KR7403490006 ST3100910190000 NN N N 0 N N0000014800000100001NNN00NNN000000100N0900000002774240000000001002023091900000000004593200000000000459324640012 0 NN000000467000000002-00000008-000900000000220250930000000679 NNN +403850 KR7403850001ũ۴ ST0101500000000 NN N N 0 N N0000242500000100001NNN00NNN000000100N0900000001510820000000001002025111800000000001435100000000000143510100012 0 NN0000006810000001260000001230010600000000620250930000003480 NNN +403870 KR7403870009HPSP ST1100910270000 NY N N 0 N Y0000440000000100001NNN00NNN000000050Y0900000076495410000000005002022071500000000008399900000000004199956000012 0 NY0000018140000009390000011380086300000003120241231000036959 NNY +405000 KR7405000001ö ST3100910290000 NN N N 0 N N0000062200000100001NNY00NNN000000100N0900000000078730000000005002022102100000000000383800000000000191922200012 0 NN000000043-00000066-00000053-0053-0000013220250930000000238 NNN +405100 KR7405100009ťƼ ST3100600000000 NN N N 0 N N0000170300000100001NNN00NNN000000060Y0900000002142950000000005002022110200000000001228900000000000614465050012 0 NN0000005180000000380000000320002600000000320250930000002092 NNN +405920 KR7405920000󼿶 ST3101100000000 NN N N 0 N N0000024800000100001NNN00NNN000000100N0900000000191200000000050002023060200000000001287800000000006439038000012 0 NN000000602-00000002-00000003-0003-0000000120250930000000319 NNN +406820 KR7406820001ƼŲ ST3100910230000 NN N N 0 N N0000036600000100001NNN01NNN000000100N0900000021947240000000005002023072400000000000353400000000000176702000012 0 NN000000447-00000024-00000043-0040-0000003020250930000000129 NNN +407400 KR7407400001޺ ST3100910310000 NN N N 0 N N0000050400000100001NNN00NNN000000100N0900000003430950000000001002023020900000000001463400000000000148145340012 0 NN000000546-00000030-00000049-0046-0000001120250930000000737 NNN +408900 KR7408900009Ʃ̸ ST3101500000000 NN N N 0 N N0000029450000100001NNN00NNN000000100N0900000001799090000000001002023020700000000003272900000000000328312260012 0 NN000000113-00000025-00000025-0021-0000000420250930000000963 NNN +408920 KR7408920007޽̻ ST3100600000000 NN N N 0 N N0000033800000100001NNN00NNN000000060Y0900000001221850000000001002022030700000000004323200000000000432324550012 0 NN0000005260000001610000001600012900000002820250930000001461 NNN +411080 KR7411080005 ST3000000000000 NN N N 0 N N0000075800000100001NNN00NNN000000100N0900000001567230000000001002023021500000000001526700000000000152676380012 0 NN000000052-00000043-00000018-002100000000020250930000001157 NNN +412350 KR7412350001 ST3100910270000 NN N N 0 N N0000021300000100001NNN00NNN000000100N0900000002610430000000005002022062400000000001302600000000000651348600012 0 NN000000024-00000097-00000098-0098-0000004820250930000000277 NNN +412540 KR7412540007Ͽؿ ST3100910270000 NN N N 0 Y N0000039350000100001YNY00NYN000000100N0900000000000000000000005002024043000000000002060000000000001030033250012 0 NN000002396-00000129-00000203-0221-3610000020250930000000810 NNN +413390 KR7413390006Ƽ ST3100910270000 NN N N 0 N N0000105400000100001NNN00NNN000000100N0900000032182020000000005002024111800000000001158000000000000579009000012 0 NN0000004920000000340000000320002300000000020250930000001220 NNN +413630 KR7413630005ǽý ST3100910230000 NN N N 0 N N0000049100000100001NNN00NNN000000060Y0900000014001790000000001002022033100000000003643600000000000402834250012 0 NN0000001480000000170000000190001600000000620250930000001789 NNN +413640 KR7413640004̸Ʈ ST3000000000000 NN N N 0 N N0000092300000100001NNN00NNN000000100N0900000000266510000000005002023110900000000000720600000000000360347000012 0 NN0000003090000000200000000290003700000001320241231000000665 NNN +415380 KR7415380005Ʃ ST3101100000000 NN N N 0 N N0000023300000100001NNN00NNN000000100N0900000000401840000000005002024020600000000001144200000000000592707400012 0 NN0000010790000000400000000450003600000001320241231000000266 NNN +416180 KR7416180008żƼ ST2100910300000 NN N N 0 N N0000365000000100001NNN00NNN000000060Y0900000003282960000000005002023101900000000000903900000000000451988900012 0 NN0000008300000000450000000410002100000000220250930000003299 NNY +417010 KR7417010006 ST3100910270000 NN N N 0 N N0000100000000100001NNN00NNN000000100N0900000015590090000000005002023030300000000002017200000000001008636400012 0 NN000000302-00000003-00000008-0009-0000000620250930000002017 NNN +417180 KR7417180007ΰŽ丮 ST3000000000000 NN N N 0 N N0000018460000100001NNN00NNN000000100N0900000000943670000000001002022120800000000001754800000000000175486230012 0 NN0000001840000000150000000200001700000000720241231000000323 NNN +417200 KR7417200003LSƮ ST1100910280000 NN N N 0 N Y0000150000000100001NNN00NNN000000050Y0900000020127880000000005002023121200000000006765200000000003382632950012 0 NN000001130-00000013-00000010-001900000000020250930000010147FN2NNY +417500 KR7417500006̾ũ ST3100910230000 NN N N 0 N N0000032900000100001NNN00NNN000000060Y0900000001605140000000001002022110400000000003278400000000000327847440012 0 NN0000004010000000740000000780007200000001620250930000001078 NNN +417790 KR7417790003Ʈ翣 ST3100910280000 NN N N 0 N N0000080500000100001NNN00NNN000000100N0900000000355770000000001002023051700000000001046800000000000109996500012 0 NN0000005360000001550000001750014400000001520241231000000842 NNN +417840 KR7417840006 ST3100910270000 NN N N 0 N N0000060800000100001NNN00NNN000000100N0900000059698510000000005002022102800000000002257300000000001128679050012 0 NN0000003400000000430000000390003900000001420250930000001372 NNN +417860 KR7417860004 ST3000000000000 NN N N 0 Y N0000112400000100001NNN00NNN000000100N0900000000183060000000005002023013000000000000469600000000000234845300012 0 NN000000152-00000041-00000033-0033-0000003620241231000000527 NNN +417970 KR7417970001𵨼ַ ST3100910270000 NN N N 0 N N0000247500000100001NNN00NNN000000100N0900000001636280000000005002022100700000000000639600000000000319835000012 0 NN0000005530000000550000000580004700000001020250930000001583912NNN +418250 KR7418250007ť ST3000000000000 NN N N 0 N N0000065500000100001YNY00NNN000000100N0900000000000000000000005002023082400000000000727100000000000363580250012 0 NN000000014-00000073-00000094-0094-0000008220241231000000476 NNN +418420 KR7418420006 ST3100910280000 NN N N 0 N N0000057200000100001NNN00NNN000000100N0900000004812880000000001002023030900000000003047900000000000320993080012 0 NN000000089-00000070-00000065-0065-0000003520241231000001743 NNN +418470 KR7418470001KTиǼ ST3000000000000 NN N N 0 N N0000140300000100001NNN00NNN000000060Y0900000000334330000000005002023092700000000000856500000000000428289450012 0 NN0000007260000001100000001290011500000001820241231000001201 NNN +418550 KR7418550000̿ ST2100600000000 NN N N 0 N N0000089900000100001NNN00NNN000000100N0900000005485830000000001002023021600000000003201700000000000320176730012 0 NN000000458-00000004-00000043-003900000000020250930000002878 NNN +418620 KR7418620001E8 ST3000000000000 NN N N 0 N N0000014370000100001NNN00NNN000000100N0900000003472170000000005002024022300000000001985000000000000992523850012 0 NN000000014-00000080-00000084-0084-0000011120250930000000285 NNN +419050 KR7419050000⿡ַ ST3100910300000 NN N N 0 N N0000018610000100001NNN00NNN000000100N0900000007181890000000001002023020300000000005719600000000000571962400012 0 NN0000010460000000850000000170001300000000420250930000001064 NNN +419080 KR7419080007 ST3100910270000 NN N N 0 N N0000087300000100001NNN00NNN000000100N0900000002488840000000005002022111800000000001068500000000000534256850012 0 NN000000049-00000045-00000042-005200000000020250930000000932 NNN +419120 KR7419120001굹 ST3000000000000 NN N N 0 N N0000041600000100001NNN00NNN000000100N0900000001103950000000005002022102700000000001513300000000000756675350012 0 NN0000001490000000320000000410003900000001320250930000000629 NNN +419530 KR7419530001SAMG ST1101500000000 NN N N 0 N N0000386500000100001NNN00NNN000000100N0900000001142980000000005002022120600000000000982400000000000491225750012 0 NN0000009280000001090000003040030200000006520250930000003797 NNN +419540 KR7419540000佺 ST3100910290000 NN N N 0 N N0000012200000100001NNN00NNN000000100N0900000016216990000000001002022101800000000002299200000000000229925110012 0 NN0000002030000000030000000100000800000000420241231000000280 NNN +420570 KR7420570004̹̿ ST3100910230000 NN N N 0 N N0000084800000100001NNN00NNN000000100N0900000000162750000000005002024032500000000000584700000000000292374150012 0 NN0000002440000000230000000230002000000000720250930000000495 NNN +420770 KR7420770000Ⱑ ST2100910270000 NN N N 0 N N0000552000000100001NNN00NNN000000060Y0900000002263370000000002002023052400000000001267500000000000253515160012 0 NN0000002070000000100000000400003200000000020250930000006997 NNN +424760 KR7424760007ũ ST3000000000000 NN N N 0 N N0000011670000100001NNN00NNN000000100N0900000001266560000000001002022072200000000001977800000000000197783170012 0 NN000000309-00000020-00000020-0012-0000000520241231000000230 NNN +424870 KR7424870004̹ÿ½þ ST2100600000000 NN N N 0 N N0000113100000100001NNN00NNN000000100N0900000009640540000000005002025051900000000007416500000000003708253450012 0 NN000000007-00000126-00000057-0057-3610000020241231000008388 NNN +424960 KR7424960003Ʈ̴ý ST3100910290000 NN N N 0 N N0000086900000100001NNN00NNN000000100N0900000002912300000000005002023082200000000001648500000000000824255500012 0 NN000000065-00000047-00000027-0027-0000003620250930000001432 NNN +424980 KR7424980001ũ ST3100910280000 NN N N 0 N N0000143600000100001NNN00NNN000000100N0900000001448460000000005002023042600000000000591800000000000295944500012 0 NN000000102-00000095-00000107-0079-0000002520241231000000849 NNN +425040 KR7425040003Ƽ̿ ST3100910230000 NN N N 0 N N0000093600000100001NNN00NNN000000060Y0900000006275530000000005002023011900000000002132900000000001066454100012 0 NN0000019730000001860000001430010600000000620250930000001996 NNY +425420 KR7425420007Ƽ ST2100910280000 NN N N 0 N N0000387000000100001NNN00NNN000000050Y0900000002668510000000001002022111700000000001196000000000000119607100012 0 NN0000007430000001170000001260010800000001220250930000004628 NNY +429270 KR7429270002Ʈδн ST3100910280000 NN N N 0 N N0000041900000100001NNN00NNN000000100N0900000000798610000000005002023080300000000000644900000000000322461550012 0 NN000000122-00000063-00000058-0057-0000002220241231000000270 NNN +430690 KR7430690008ѽ ST3000000000000 NN N N 0 N N0000047600000100001NNN00NNN000000100N0900000000943460000000005002023100400000000001089500000000000544766350012 0 NN000000149-00000027-00000026-0026-0000000120250930000000518 NNN +431190 KR7431190008̾ ST3000000000000 NN N N 0 N N0000055000000100001NNN00NNN000000100N0900000001416280000000005002024082000000000000748600000000000374322100012 0 NN000000107-00000029-00000024-003200000000020250930000000411 NNN +432430 KR7432430007̷ ST3101500000000 NN N N 0 N N0000041100000100001NNN00NNN000000100N0900000000333940000000005002023072000000000001650800000000000825416000012 0 NN000000358-00000066-00000065-0065-0000002320250930000000678 NNN +432470 KR7432470003̿ ST3100910270000 NN N N 0 N N0000174000000100001NNN00NNN000000100N0900000039797880000000001002023120600000000000877100000000000087715560012 0 NN0000003510000000160000000240002300000000420250930000001526 NNN +432720 KR7432720001Ÿݵü ST3100910280000 NN N N 0 N N0000147900000100001NNN00NNN000000100N0900000007161470000000005002023102700000000001414300000000000707150600012 0 NN000000061-00000227-00000191-0191-0000004920241231000002091 NNN +432980 KR7432980001 ST3100910240000 NN N N 0 N N0000035800000100001NNN00NNN000000100N0900000004770070000000005002024122600000000000859100000000000429587100012 0 NN000000206000000015-00000013-0012-0000000520241231000000307 NNN +434480 KR7434480000ͷ ST3000000000000 NN N N 0 N N0000039650000100001NNN00NNN000000100N0900000000532080000000001002023051900000000001231000000000000123103000012 0 NN000000123-00000001-00000006-000200000000320250930000000488 NNN +435570 KR7435570007ڽ ST3100910190000 NN N N 0 N N0000138400000100001NNN00NNN000000100N0900000004531480000000005002025022800000000000761600000000000380849150012 0 NN000000259000000004-00000083-008300000000020250930000001054 NNN +437730 KR7437730005 ST2100910300000 NN N N 0 N N0000697000000100001NNN00NNN000000050Y0900000008166600000000005002024032100000000003170700000000001585378350012 0 NN0000007370000000210000000470005300000000620250930000022100 NNY +438700 KR7438700007Ʈ ST3000000000000 NN N N 0 N N0000041050000100001NNN00NNN000000100N0900000001480060000000005002023072600000000001114400000000000557244500012 0 NN000000022-00000078-00000069-0069-0000003220250930000000457 NNN +439090 KR7439090002 ST2100910230000 NN N N 0 N N0000146300000100001NNN00NNN000000060Y0900000000855790000000001002023060800000000001638300000000000163832600012 0 NN0000008730000000840000000880007400000001020250930000002396 NNY +439580 KR7439580002翥 ST3101100000000 NN N N 0 N N0000048550000100001NNN00NNN000000100N0900000008159450000000001002023121300000000003384600000000000338465470012 0 NN000001320-00000015-00000046-0046-0000001420250930000001643 NNN +440110 KR7440110005ĵ ST2100910280000 NN N N 0 N N0000212500000100001YNN00NNN000000100N0900000000000000000000001002023080700000000004949300000000000494932930012 0 NN000000685-00000360-00000377-0378-0000006920250930000010517 NNN +440290 KR7440290005HBκƮƮ ST3101400000000 NN N N 0 N N0000020350000100001NNN00NNN000000100N0900000000935160000000005002024012500000000002750600000000001375321500012 0 NN0000001520000000650000000740006000000000820241231000000559 NNN +440320 KR7440320000³ ST3000000000000 NN N N 0 N N0000037900000100001NNN00NNN000000100N0900000000132430000000001002023063000000000000983000000000000098300000012 0 NN000000657000000003000000002-0003-0000000020250930000000372 NNN +441270 KR7441270006ο ST2100910280000 NN N N 0 N N0000094600000100001NNN00NNN000000060Y0900000004268200000000005002022100700000000003946800000000001973401500012 0 NN000001776000000039-00000041-0061-0000001020250930000003733 NNN +443250 KR7443250006۷̼ ST3100600000000 NN N N 0 N N0000105700000100001NNN00NNN000000060Y0900000000233020000000005002023100600000000001113400000000000581884300012 0 NN0000004020000000640000000670005200000001320250930000001176 NNN +443670 KR7443670005ǼƮ ST3101100000000 NN N N 0 N N0000058800000100001NNN00NNN000000060Y0900000015227710000000001002024021500000000002474100000000000247413920012 0 NN0000004030000000270000000330002500000000720250930000001454 NNN +444530 KR7444530000÷ ST3000000000000 NN N N 0 N N0000075400000100001NNN00NNN000000100N0900000000355100000000005002025032100000000000639000000000000319544150012 0 NN000000072-00000001-00000080-0080-0000158320241231000000481 NNN +444920 KR7444920003Ÿ11ȣ ST3101400000000 NN N Y 0 N N0000020950000100001NNN00NNN000000100N0900000000615920000000001002023090100000000000524000000000000052400000012 0 NN0000000000000000000000000030000300000000220241231000000109 NNN +445090 KR7445090004 ST2100910280000 NN N N 0 N N0000337000000100001NNN00NNN000000100N0900000003354510000000005002023111300000000001092500000000000546282900012 0 NN000000466-00000176-00000188-0195-0000003620250930000003681 NNN +445180 KR7445180003ǻ ST3100910230000 NN N N 0 N N0000095000000100001NNN00NNN000000060Y0900000001332490000000005002023101800000000001718900000000000859459400012 0 NN0000012250000001400000001430011800000001320241231000001632 NNY +445680 KR7445680002ť̿ý ST2100910290000 NN N N 0 N N0001198000000100001NNN00NNN000000100N0900000000937170000000005002023081000000000001711900000000000855991650012 0 NN000000033-00000097-00000251-0249-0000004720250930000020509 NNN +446150 KR7446150005Ÿ12ȣ ST3101400000000 NN N Y 0 N N0000000000000100001NYY00NNN000000100N0900000000000000000000001002023031700000000000477000000000000047700000012 0 NN000000000-000000010000000020000200000000220241231000000000 NNN +446540 KR7446540007ްġ ST3100910280000 NN N N 0 N N0000043750000100001NNN00NNN000000100N0900000012906010000000005002023110900000000002077100000000001038550000012 0 NN0000005300000000400000000620005000000001020241231000000908 NNN +446840 KR7446840001 ST3100910290000 NN N N 0 N N0000016800000100001NNN00NNN000000100N0900000001181990000000001002023051700000000005482300000000000548230830012 0 NN000000136-00000018-00000021-0021-0000003520241231000000921 NNN +448280 KR7448280008ھ ST2100600000000 NN N N 0 N N0000111900000100001NNN00NNN000000100N0900000000469140000000005002023112100000000002963100000000001481556450012 0 NN0000002220000000000000000090000600000000120250930000003315 NNN +448710 KR7448710004ũ ST3100910280000 NN N N 0 N N0000189900000100001NNN00NNN000000100N0900000000967040000000001002023081000000000000528500000000000062808500012 0 NN0000006500000000950000000980008200000002020241231000001003 NNN +448900 KR7448900001ѱǾ̿ ST3100910300000 NN N N 0 N N0000739000000100001NNN00NNN000000100N0900000002599740000000005002025040400000000000600400000000000300222850012 0 NN000000288000000009-00000016-001000000000120250930000004437 NNN +450050 KR74500500008ȣ ST3101400000000 NN N Y 0 N N0000000000000100001NYY00NNN000000100N0900000000000000000000001002023062200000000000501400000000000050140000012 0 NN0000000000000000000000000030000200000000220241231000000000 NNN +450330 KR7450330006Ͻ ST3100910240000 NN N N 0 N N0000060300000100001NNN00NNN000000100N0900000000324350000000005002024070300000000000818600000000000409342150012 0 NN0000001280000000060000000080000500000000320250930000000493 NNN +450520 KR7450520002ν̺ ST3000000000000 NN N N 0 N N0000036650000100001NNN00NNN000000100N0900000003071280000000005002023092500000000001470400000000000735228900012 0 NN000000289-00000053-00000052-0044-0000001120250930000000538 NNN +450940 KR7450940002Ÿ14ȣ ST3101400000000 NN N Y 0 N N0000021050000100001NNY00NNN000000100N0900000000017620000000001002023072700000000000454000000000000045400000012 0 NN0000000000000000000000000020000200000000220241231000000095 NNN +450950 KR7450950001ƽ׶ý ST2100910290000 NN N N 0 N N0000130900000100001NNN00NNN000000050Y0900000004704000000000001002025012400000000003750700000000000375070920012 0 NN0000002580000000670000000670005400000003120250930000004909 NNN +451220 KR7451220008̿Ƽ ST3100910270000 NN N N 0 N N0000101300000100001NNN00NNN000000100N0900000001129730000000005002023101000000000000787400000000000393730550012 0 NN000000228-00000013-0000000500002-0000000520250930000000797 NNN +451250 KR7451250005߾ ST3100910230000 NN N N 0 N N0000094100000100001NNN00NNN000000100N0900000000455460000000005002024042500000000001022500000000000511293850012 0 NN0000005160000000330000000390003100000000920250930000000962 NNN +451700 KR7451700009ġ29ȣ ST3101400000000 NN N Y 0 N N0000021050000100001YNN00NNN000000100N0900000000000000000000001002023062300000000001435000000000000143500000012 0 NN000000000-000000010000000090000600000000220241231000000302 NNN +451760 KR7451760003 ST3000000000000 NN N N 0 N N0000207000000100001NNN00NNN000000100N0900000010124080000000005002023110900000000001525200000000000762609800012 0 NN000000606-00000155-00000169-0158-0000002820250930000003157 NNN +452160 KR7452160005̿ ST3100910270000 NN N N 0 N N0000073600000100001NNN00NNN000000100N0900000001813910000000001002023112400000000000961700000000000190370270012 0 NN0000001170000000060000000010000500000000320250930000000707 NNN +452190 KR7452190002Ѻ ST3100910270000 NN N N 0 N N0000049750000100001NNN00NNN000000100N0900000006034190000000001002024010400000000002336600000000000257515570012 0 NN000000140-00000006-00000002-0005-0000000720250930000001162 NNN +452200 KR7452200009ũ ST3100910290000 NN N N 0 N N0000026600000100001NNN00NNN000000100N0900000004731420000000001002024050300000000002372700000000000237273000012 0 NN000000209-00000110-00000144-0145-0000006320241231000000631 NNN +452280 KR7452280001ѼϾ ST3100910260000 NN N N 0 N N0000108400000100001NNN00NNN000000100N0900000002983600000000005002023112400000000001727500000000000863782500012 0 NN0000004850000000490000000510004200000000720241231000001872 NNN +452300 KR7452300007ĸƮʽ ST3101400000000 NN N N 0 N N0000029800000100001NNN00NNN000000100N0900000001190890000000002002023111500000000001411900000000000282390100012 0 NN0000000970000000220000000220001800000000620241231000000420 NNN +452400 KR7452400005̴н ST3100910300000 NN N N 0 N N0000113200000100001NNN00NNN000000100N0900000000815100000000005002024020100000000000907100000000000453571400012 0 NN0000009620000000020000000150000800000000120250930000001026 NNN +452430 KR7452430002ǿݵü ST2100910280000 NN N N 0 N N0000399500000100001NNN00NNN000000100N0900000001402090000000001002024021900000000000821800000000000082180460012 0 NN000000080-00000034-00000171-0171-0000012520241231000003283 NNN +452450 KR7452450000Ǿ ST2100910270000 NN N N 0 N N0000072500000100001NNN00NNN000000060Y0900000006533980000000001002025020400000000003587800000000000358785000012 0 NN000000484-00000148-00000153-0153-0000001320250930000002601 NNY +452670 KR74526700034ȣ ST3101400000000 NN N Y 0 N N0000021100000100001NNN00NNN000000100N0900000000384050000000001002023091400000000000522000000000000052200000012 0 NN0000000000000000000000000030000300000000320241231000000110 NNN +452980 KR745298000611ȣ ST3101400000000 NN N Y 0 N N0000020850000100001NNN00NNN000000100N0900000001157900000000001002023100400000000001890500000000000189050000012 0 NN000000000-000000010000000110000900000000220241231000000394 NNN +453450 KR7453450009׸ ST3100600000000 NN N N 0 N N0000163600000100001NNN00NNN000000100N0900000000494280000000002002024061400000000000794200000000000158855000012 0 NN0000009090000000140000000720006400000000020250930000001299 NNN +453860 KR7453860009̿ ST3100910230000 NN N N 0 N N0000160800000100001NNN00NNN020000100N0900000000161650000000005002023112800000000000644400000000000322221150012 0 NN0000004260000000870000000940009500000001820241231000001036 NNN +454640 KR7454640004ϳ29ȣ ST3101400000000 NN N Y 0 N N0000021150000100001NYY00NNN000000100N0900000000024210000000001002023062800000000000540100000000000054010000012 0 NN0000000000000000000000000020000200000000220241231000000114 NNN +455180 KR7455180000 ST0100910270000 NN N N 0 N N0000038100000100001NNN00NNN000000100N0900000004508120000000005002025061700000000001395800000000000697915800012 0 NN0000005140000000340000000330002800000001520241231000000531 NNN +455250 KR7455250001KB25ȣ ST3101400000000 NN N Y 0 N N0000000000000100001NYY00NNN000000100N0900000000000000000000001002023062300000000000430500000000000043050000012 0 NN000000000-000000010000000020000200000000220241231000000000 NNN +455310 KR7455310003ȭ÷4ȣ ST3101400000000 NN N Y 0 N N0000020850000100001NNN00NNN000000100N0900000000783260000000001002023090700000000000506000000000000050600000012 0 NN000000000-000000010000000020000200000000220241231000000105 NNN +455900 KR7455900001κƽ ST2100910270000 NN N N 0 N N0000382000000100001NNN00NNN000000100N0900000005011390000000005002024032600000000001521800000000000760902650012 0 NN000000042-00000108-00000100-0100-0000004120241231000005813 NNN +455910 KR74559100009ȣ ST3101400000000 NN N Y 0 N N0000021100000100001NNY00NNN000000100N0900000000026970000000001002023072100000000000502000000000000050200000012 0 NN0000000000000000000000000020000200000000220241231000000105 NNN +456010 KR7456010008̾Ƽ ST3100910280000 NN N N 0 N N0000165400000100001NNN00NNN000000100N0900000005318610000000005002024051700000000001390100000000000695092700012 0 NN000000016-00000081-00000089-008900000000020250930000002299 NNN +456070 KR7456070002̿ ST3100910240000 NN N N 0 N N0000169500000100001NNN00NNN000000100N0900000004770600000000005002024082300000000001091800000000000545942750012 0 NN000000072-00000157-00000152-0152-0000003520241231000001850 NNN +456160 KR7456160001̿ ST0100910240000 NN N N 0 N N0000850000000100001NNN00NNN000000100N0900000013003160000000005002025081400000000001642000000000000821028000012 0 NN000000008-00000108-00000833-0833-3610000020241231000013957 NNN +456490 KR745649000214ȣ ST3101400000000 NN N Y 0 N N0000021150000100001YNY00NNN000000100N0900000000172510000000001002023070600000000000420000000000000042000000012 0 NN000000000-000000010000000020000100000000220241231000000088 NNN +457370 KR7457370005 ST3100910230000 NN N N 0 N N0000094500000100001NNN00NNN000000100N0900000001937090000000005002024102200000000000802700000000000401356700012 0 NN0000003670000000650000000690005800000001520241231000000758 NNN +457550 KR7457550002 ST2100600000000 NN N N 0 N N0000274000000100001NNN00NNN000000060Y0900000004019980000000005002024012400000000000931800000000000465947900012 0 NN0000004400000000530000000620005400000001320241231000002553 NNN +457600 KR7457600005Ʈ ST3100910280000 NN N N 0 N N0000023000000100001NNN00NNN000000100N0900000000308080000000001002024121600000000001370700000000000137075000012 0 NN000000359-00000024-00000029-0031-0000003220250930000000315 NNN +457630 KR7457630002Ź뷱16ȣ ST3101400000000 NN N Y 0 N N0000020900000100001NNN00NNN000000100N0900000000352380000000001002023090400000000000731000000000000073100000012 0 NN000000000-000000010000000030000200000000220241231000000152 NNN +457940 KR745794000510ȣ ST3101400000000 NN N Y 0 N N0000020950000100001NNN00NNN000000100N0900000000436900000000001002023081100000000000331000000000000033100000012 0 NN0000000000000000000000000010000100000000120241231000000069 NNN +458610 KR7458610003ѱ12ȣ ST3101400000000 NN N Y 0 N N0000020900000100001NNN00NNN000000100N0900000000295340000000001002023083000000000000423000000000000042300000012 0 NN000000000-000000010000000010000100000000120241231000000088 NNN +458650 KR7458650009 ST3100910280000 NN N N 0 N N0000127900000100001NNN00NNN000000100N0900000045899150000000005002024103100000000001504500000000000752283500012 0 NN000000662-000000030000000150001300000000020250930000001924 NNN +458870 KR7458870003ũ ST2100910290000 NN N N 0 N N0001557000000100001NNN00NNN000000100N0900000000787720000000005002024061900000000001266500000000000633294000012 0 NN0000002780000000760000000760007600000000020250930000019720 NNN +459100 KR7459100004 ST3100910280000 NN N N 0 N N0000069500000100001NNN00NNN000000100N0900000000998280000000005002024112000000000001336500000000000668250000012 0 NN0000012410000000460000000170001600000000020250930000000928 NNN +459510 KR7459510004κƽ ST2100910270000 NN N N 1 N N0000310500000100001NNN00NNN000000100N0900000005386660000000005002025050800000000001295500000000000647769100012 0 NN000000121-00000029-00000037-0037-0000028520241231000004022 NNN +459550 KR7459550000Ʈ ST0100910280000 NN N N 0 N N0000049050000100001NNN00NNN000000100N0900000242034840000000001002025111700000000002506700000000000268487690012 0 NN0000008900000000730000000710004700000000020250930000001229 NNN +460470 KR7460470008̺ũ ST3100910290000 NN N N 0 N N0000030400000100001NNN00NNN000000100N0900000000692680000000005002024080600000000001511900000000000755968500012 0 NN000000036-00000043-00000040-0040-0000001820241231000000459 NNN +460870 KR7460870009 ST3100910250000 NN N N 0 N N0000037500000100001NNN00NNN000000100N0900000001484490000000001002025030700000000001994800000000000199483040012 0 NN000000546000000044-00000016-0021-0000001220241231000000748 NNN +460930 KR7460930001 ST1100910300000 NN N N 0 N N0000182200000100001NNN00NNN000000050Y0900000003852940000000005002024012600000000003551000000000001775533550012 0 NN0000018130000002230000002090016800000000820250930000006470 NNY +460940 KR7460940000Ǿؿκƽ ST3100910290000 NN N N 0 N N0000122900000100001NNN00NNN000000060Y0900000014307340000000005002024073100000000001325500000000000662774000012 0 NN0000000710000000160000000250002300000001020241231000001629 NNN +461030 KR7461030009̿𿢽 ST3100600000000 NN N N 0 N N0000095300000100001NNN00NNN000000100N0900000001259530000000001002024040300000000001401700000000000140177500012 0 NN000000034-00000106-00000096-0096-0000004720241231000001335 NNN +461300 KR7461300006̽ũ̵ ST2000000000000 NN N N 0 N N0000156900000100001NNN00NNN000000060Y0900000000372580000000005002024083000000000001329800000000000664946650012 0 NN0000015220000004610000003940031100000002320241231000002086 NNN +462020 KR7462020009ġ6ȣ ST3101400000000 NN N Y 0 N N0000020850000100001NNN00NNN000000100N0900000000677280000000001002023101300000000000434500000000000043450000012 0 NN0000000000000000000000000020000200000000220241231000000090 NNN +462310 KR7462310004Ű ST0100910200000 NN N N 0 N N0000048500000100001NNN00NNN000000100N0900000000583730000000001002025070900000000000818500000000000081851210012 0 NN000000311-00000006-00000043-004200000000020250930000000396 NNN +462350 KR7462350000̳뽺̽ ST3100910300000 NN N N 0 N N0000202000000100001NNN02NNN000000100N0900000009029640000000010002024070200000000002062100000000002062102900012 0 NN000000018-00000493-00000494-0495-0000014820250930000004165 NNN +462510 KR7462510009޵ ST3100910290000 NN N N 0 N N0000061900000100001NNN00NNN000000100N0900000000460330000000005002024061700000000000880200000000000440148250012 0 NN000000066-00000097-00000095-0095-0000006820241231000000544 NNN +462860 KR7462860008 ST2000000000000 NN N N 0 N N0000048050000100001NNN00NNN000000060Y0900000048839590000000001002025032400000000007184300000000000718437110012 0 NN0000004510000000970000001030008700000002120250930000003452 NNN +462980 KR7462980004 ST3000000000000 NN N N 0 N N0000020300000100001NNN00NNN000000100N0900000001051780000000005002025020400000000001823400000000000911721850012 0 NN0000002430000000050000000080000700000000620250930000000370 NNN +463020 KR7463020008AI ST0000000000000 NN N N 0 N N0000165000000100001NNN00NNN000000100N0900000001488140000000005002025070400000000000887900000000000444754000012 0 NN000000197000000004-00000055-0056-0000003620241231000001465 NNN +463480 KR7463480004Ƽ긵ũ ST3100910280000 NN N N 0 N N0000092400000100001NNN00NNN000000100N0900000000953500000000002002025022000000000001239000000000000247807160012 0 NN000000544-0000000400000000100005-0000000020250930000001144 NNN +464080 KR7464080001 ST2100910290000 NN N N 0 N N0000257500000100001NNN00NNN000000100N0900000014962990000000001002024062500000000001779700000000000177970350012 0 NN000000049-00000128-00000120-0120-0000004620241231000004582 NNN +464280 KR7464280007Ƽ𿡽 ST3100910240000 NN N N 0 N N0000099700000100001NNN00NNN000000100N0900000000171810000000001002024082100000000000553000000000000055300000012 0 NN0000002750000000370000000420003700000001220241231000000551 NNN +464440 KR7464440007ѱ13ȣ ST3101400000000 NN N Y 0 N N0000020950000100001NNN00NNN000000100N0900000000242360000000001002023111300000000000432000000000000043200000012 0 NN000000000-000000010000000020000200000000220241231000000090 NNN +464490 KR7464490002޵ ST0100910240000 NN N N 0 N N0000149500000100001NNN00NNN000000100N0900000006128930000000005002025121200000000001134100000000000567072150012 0 NN000000073-00000059-00000064-0064-0000011120250930000001695 NNN +464500 KR7464500008̾̽ ST3100910280000 NN N N 0 N N0000033600000100001NNN00NNN000000100N0900000002245010000000005002024092300000000001396300000000000698163150012 0 NN000000051-00000040-00000038-0035-0000001720250930000000469 NNN +464580 KR7464580000 ST3101500000000 NN N N 0 N N0000026550000100001NNN00NNN000000100N0900000004618630000000005002024111300000000001840600000000000920304450012 0 NN0000002360000000100000000080001000000000620241231000000488 NNN +464680 KR7464680008KB27ȣ ST3101400000000 NN N Y 0 N N0000020750000100001NNN00NNN000000100N0900000000802770000000001002023110300000000001290500000000000129050000012 0 NN0000000000000000000000000090000700000000320241231000000267 NNN +465320 KR746532000015ȣ ST3101400000000 NN N Y 0 N N0000023350000100001YNN00NNN000000100N0900000000000000000000001002023120500000000000381000000000000038100000012 0 NN0000000000000000000000000020000100000000220241231000000088 NNN +465480 KR7465480002νǾ ST3000000000000 NN N N 0 N N0000052200000100001NNN00NNN000000100N0900000000140940000000001002024101800000000001013700000000000101377720012 0 NN000000123-000000060000000010000300000000020250930000000529 NNN +466100 KR7466100005Ŭκ ST2000000000000 NN N N 0 N Y0000735000000100001NNN00NNN000000100N0900000017993910000000005002024102800000000002499200000000001249606950012 0 NN000000235-00000045-00000032-003200000000020250930000018369 NNN +466410 KR7466410008̳Ʈ ST3000000000000 NN N N 0 N N0000130300000100001NNN00NNN000000100N0900000000211930000000005002024111900000000000503700000000000251851150012 0 NN0000001330000000510000000640006000000001220241231000000656 NNN +466690 KR7466690005Ű1ȣ ST0101400000000 NN N Y 0 N N0000020000000100001NNN00NNN000000100N0900000000262930000000001002025121200000000000509500000000000050950000012 0 NN00000000000000000000000000000000-0000000520241231000000101 NNN +466910 KR7466910007ġ30ȣ ST3101400000000 NN N Y 0 N N0000021350000100001YNN00NNN000000100N0900000000000000000000001002023120100000000000910000000000000091000000012 0 NN0000000000000000000000000060000400000000220241231000000194 NNN +467930 KR7467930004IBKS23ȣ ST3101400000000 NN N Y 0 N N0000022450000100001NNN00NNN000000100N0900000000023800000000001002023122200000000000423000000000000042300000012 0 NN000000000-000000010000000020000100000000120241231000000094 NNN +468530 KR7468530001Ƽ ST0100600000000 NN N N 0 N N0000810000000100001NNN00NNN000000100N0900000003152610000000001002025072900000000001093900000000000109394800012 0 NN000000023-00000091-00000057-0057-3610000020241231000008860 NNN +468760 KR746876000410ȣ ST3101400000000 NN N Y 0 N N0000020950000100001NNN00NNN000000100N0900000000184350000000001002024022900000000000424000000000000042400000012 0 NN0000000000000000000000000020000100000000320241231000000088 NNN +469480 KR7469480008IBKS24ȣ ST3101400000000 NN N Y 0 N N0000022650000100001NNN00NNN000000100N0900000000166010000000001002024020100000000000423000000000000042300000012 0 NN0000000000000000000000000010000100000000320241231000000095 NNN +469610 KR7469610000̳ũ ST0100910270000 NN N N 0 N N0000260500000100001NNN00NNN000000060Y0900000002523230000000005002025110700000000000887600000000000443845000012 0 NN0000005810000000900000000980008500000000020250930000002312 NNN +469750 KR7469750004̺ ST3100910270000 NN N N 0 N N0000013370000100001NNN00NNN000000100N0900000005667220000000001002024090300000000003445600000000000344564810012 0 NN000000352000000024-00000046-0046-0000001720241231000000460 NNN +469880 KR7469880009ϳ30ȣ ST3101400000000 NN N Y 0 N N0000020650000100001NNN00NNN000000100N0900000000415430000000001002023122200000000000730500000000000073050000012 0 NN0000000000000000000000000040000400000000220241231000000150 NNN +469900 KR7469900005ϳ31ȣ ST3101400000000 NN N Y 0 N N0000020650000100001NNN00NNN000000100N0900000000018660000000001002024030500000000000560500000000000056050000012 0 NN0000000000000000000000000020000200000000320241231000000115 NNN +471050 KR7471050005Ź뷱17ȣ ST3101400000000 NN N Y 0 N N0000021650000100001NNN00NNN000000100N0900000000299950000000001002024012400000000000606000000000000060600000012 0 NN000000000-000000010000000020000200000000220241231000000131 NNN +471820 KR7471820001θƽ̾ ST3100910190000 NN N N 0 N N0000051700000100001NNN00NNN000000100N0900000001485130000000001002024121300000000001158100000000000117652030012 0 NN0000001770000000270000000340002700000000020250930000000598 NNN +472220 KR7472220003ſ10ȣ ST3101400000000 NN N Y 0 N N0000021950000100001NNN00NNN000000100N0900000000100350000000001002024020600000000000469000000000000046900000012 0 NN0000000000000000000000000020000100000000320241231000000102 NNN +472230 KR747223000211ȣ ST3101400000000 NN N Y 0 N N0000020500000100001NNN00NNN000000100N0900000000106050000000001002024030400000000000415500000000000041550000012 0 NN0000000000000000000000000010000100000000220241231000000085 NNN +472850 KR7472850007׷ ST2101100000000 NN N N 0 N N0000052900000100001NNN00NNN000000060Y0900000000668210000000005002024020200000000005757100000000002878582600012 0 NN0000030940000003720000003200026000000001620250930000003045 NNN +473000 KR747300000812ȣ ST3101400000000 NN N Y 0 N N0000020500000100001NNN00NNN000000100N0900000000000270000000001002024050700000000000331000000000000033100000012 0 NN0000000000000000000000000000000100000000220241231000000067 NNN +473050 KR7473050003Ÿ15ȣ ST3101400000000 NN N Y 0 N N0000020500000100001NNN00NNN000000100N0900000000103770000000001002024022900000000000701000000000000070100000012 0 NN0000000000000000000000000030000200000000320241231000000143 NNN +473370 KR74733700052ȣ ST3101400000000 NN N Y 0 N N0000027200000100001NNN00NNN000000100N0900000000290410000000001002024030500000000000421000000000000042100000012 0 NN0000000000000000000000000020000200000000320241231000000114 NNN +473950 KR747395000413ȣ ST3101400000000 NN N Y 0 N N0000020450000100001NNN00NNN000000100N0900000000014380000000001002024072500000000000442000000000000044200000012 0 NN0000000000000000000000000000000000000000120241231000000090 NNN +473980 KR7473980001ӽ ST2101500000000 NN N N 0 N N0000254000000100001NNN00NNN000000060Y0900000001599530000000005002024111200000000001105700000000000552866100012 0 NN0000006280000001420000001370013700000000020250930000002808 NNN +474170 KR7474170008̸ ST3100910300000 NN N N 0 N N0000137000000100001NNN00NNN000000100N0900000010610820000000005002024102100000000001781700000000000890884800012 0 NN000000143-00000012-00000011-0011-0000000220241231000002441 NNN +474490 KR7474490000Ÿ16ȣ ST3101400000000 NN N Y 0 N N0000020300000100001NNN00NNN000000100N0900000000075440000000001002024050200000000000551000000000000055100000012 0 NN0000000000000000000000000020000200000000320241231000000111 NNN +474610 KR7474610003RFý ST3100910260000 NN N N 0 N N0000061100000100001NNN00NNN000000100N0900000002057280000000001002024111900000000001342700000000000134278220012 0 NN000000327000000017-00000042-0041-0000001220241231000000820 NNN +474650 KR7474650009ũַ ST0100910270000 NN N N 0 N N0000646000000100001NNN00NNN000000100N0900000005815140000000001002025061000000000000562400000000000056240320012 0 NN000000112-00000040-00000038-002500000000020241231000003633 NNN +474660 KR747466000812ȣ ST3101400000000 NN N Y 0 N N0000021000000100001YNN00NNN000000100N0900000000000000000000001002024041500000000000552000000000000055200000012 0 NN000000000-00000002-0000000100000-0000000120241231000000115 NNN +474930 KR747493000513ȣ ST3101400000000 NN N Y 0 N N0000021250000100001NNN00NNN000000100N0900000000034980000000001002024042200000000000362000000000000036200000012 0 NN0000000000000000000000000010000100000000220241231000000076 NNN +475230 KR7475230009˺ ST0100910260000 NN N N 0 N N0000183800000100001NNN00NNN000000060Y0900000004300580000000005002025072800000000001050900000000000525491950012 0 NN000000337000000038-00000023-000900000000020250930000001931 NNN +475240 KR7475240008ϳ32ȣ ST3101400000000 NN N Y 0 N N0000021100000100001NNN00NNN000000100N0900000000021110000000001002024032700000000000320000000000000032000000012 0 NN0000000000000000000000000010000100000000020241231000000067 NNN +475250 KR7475250007ϳ33ȣ ST3101400000000 NN N Y 0 N N0000021000000100001NNN00NNN000000100N0900000000015060000000001002024042400000000000370000000000000037000000012 0 NN0000000000000000000000000010000100000000020241231000000077 NNN +475400 KR7475400008޽ ST2100910270000 NN N N 0 N N0000419500000100001NNN00NNN000000100N0900000003846680000000005002024102400000000001170100000000000585083100012 0 NN000000084-00000131-00000118-011800000000020250930000004908 NNN +475430 KR7475430005ŰƮ ST0100910280000 NN N N 0 N N0000047400000100001NNN00NNN000000100N0900000000949360000000005002025060200000000001784800000000000892405500012 0 NN0000006900000000590000000880008800000000620241231000000846 NNN +475460 KR7475460002Ʈڽ ST3000000000000 NN N N 0 N N0000082500000100001NNN00NNN000000100N0900000000422360000000001002025012300000000000561300000000000056130250012 0 NN0000010140000000090000000040000600000000220250930000000463 NNN +475580 KR7475580007̷ ST3100910310000 NN N N 0 N N0000102900000100001NNN00NNN000000100N0900000001680910000000002002024110100000000001362400000000000272498000012 0 NN000000426-00000062-00000049-004600000000020250930000001402 NNN +475660 KR7475660007 ST3100910230000 NN N N 0 N N0000050000000100001NNN00NNN000000100N0900000000172310000000005002024111800000000000792900000000000396491750012 0 NN0000003310000000220000000100001000000000620241231000000396 NNN +475830 KR7475830006׶ǻƽ ST2100910240000 NN N N 0 N N0001172000000100001NNN00NNN000000100N0900000004124550000000001002025021400000000002123200000000000212323680012 0 NN000000000-00000335-00000260-0260-0000002720250930000024884 NNN +475960 KR7475960001ť ST2100910290000 NN N N 0 N N0000474500000100001NNN00NNN000000100N0900000001391120000000005002024110700000000001338300000000000669163700012 0 NN000000063-00000060-00000055-005500000000020250930000006350 NNN +476040 KR7476040001̵̾ ST2100600000000 NN N N 0 N N0000338000000100001NNN00NNN000000100N0900000001928680000000005002025050900000000000658500000000000329268000012 0 NN000000012-00000124-00000121-012100000000020250930000002225 NNN +476060 KR7476060009ڴ׶ǻƽ ST2100600000000 NN N N 0 N N0000193500000100001NNN00NNN000000100N0900000008076880000000005002024121900000000004488700000000002244392000012 0 NN000000148-00000048-00000099-0081-0000004520241231000008685 NNN +476080 KR7476080007M83 ST3101500000000 NN N N 0 N N0000087300000100001NNN00NNN000000100N0900000000455390000000001002024082200000000000803700000000000080370000012 0 NN000000755-00000069-00000079-0061-0000001020250930000000701 NNN +476830 KR7476830005ͽ ST0100600000000 NN N N 0 N N0001595000000100001NNN00NNN000000100N0900000007630570000000005002025121800000000001393300000000000696692100012 0 NN000000000-00000129-00000189-0189-3610000020241231000022224 NNN +477340 KR7477340004ġ7ȣ ST3101400000000 NN N Y 0 N N0000020200000100001NNN00NNN000000100N0900000000027610000000001002024062400000000000751000000000000075100000012 0 NN0000000000000000000000000020000100000000020241231000000151 NNN +477380 KR7477380000̷º4ȣ ST3101400000000 NN N Y 0 N N0000020900000100001NNN00NNN000000100N0900000000030350000000001002024052900000000000810000000000000081000000012 0 NN0000000000000000000000000020000200000000020241231000000169 NNN +477470 KR7477470009̷º5ȣ ST3101400000000 NN N Y 0 N N0000021150000100001NNN00NNN000000100N0900000000064090000000001002024061900000000000548000000000000054800000012 0 NN0000000000000000000000000010000100000000020241231000000115 NNN +477760 KR7477760003DB12ȣ ST3101400000000 NN N Y 0 N N0000021950000100001NNN00NNN000000100N0900000000007530000000001002024061800000000000584000000000000058400000012 0 NN000000000-000000010000000010000100000000020241231000000128 NNN +478110 KR7478110000̺Ʈ6ȣ ST3101400000000 NN N Y 0 N N0000020200000100001NNN00NNN000000100N0900000000036000000000001002024071200000000000502000000000000050200000012 0 NN0000000000000000000000000010000000000000020241231000000101 NNN +478340 KR7478340003̽ũ ST0100910300000 NN N N 0 N N0000491000000100001NNN00NNN000000100N0900000009130790000000001002025121700000000001153300000000000115335910012 0 NN000000043-00000044-00000107-0107-3610000020241231000005662 NNN +478390 KR7478390008KB29ȣ ST3101400000000 NN N Y 0 N N0000020700000100001NNN00NNN000000100N0900000000043600000000001002024062100000000000622000000000000062200000012 0 NN0000000000000000000000000020000100000000020241231000000128 NNN +478440 KR7478440001̷º6ȣ ST3101400000000 NN N Y 0 N N0000020500000100001NNN00NNN000000100N0900000000670500000000001002024062400000000000693000000000000069300000012 0 NN0000000000000000000000000020000100000000020241231000000142 NNN +478560 KR7478560006ũ̾ؾ ST3100910200000 NN N N 0 N N0000035150000100001NNN00NNN000000100N0900000000813360000000001002025012100000000002583000000000000258302980012 0 NN000000370000000065-00000081-008100000000020250930000000907 NNN +479880 KR7479880007ѱ15ȣ ST3101400000000 NN N Y 0 N N0000020600000100001NNN00NNN000000100N0900000000066400000000001002024062600000000000687000000000000068700000012 0 NN0000000000000000000000000020000200000000020241231000000141 NNN +479960 KR7479960007ʽ ST3100910280000 NN N N 0 N N0000103400000100001NNN00NNN000000100N0900000000185820000000002002025022400000000000685100000000000137020000012 0 NN0000002640000000290000000300002500000001020241231000000708 NNN +481070 KR7481070001귣 ST2101100000000 NN N N 0 N N0000260000000100001NNN00NNN000000060Y0900000000790080000000001002025040300000000001416000000000000141600000012 0 NN0000003360000000420000000460004300000000020250930000003681 NNN +481890 KR7481890002ġ31ȣ ST3101400000000 NN N Y 0 N N0000021100000100001NNN00NNN000000100N0900000000815160000000001002024072600000000000634500000000000063450000012 0 NN0000000000000000000000000010000100000000020241231000000133 NNN +482520 KR748252000416ȣ ST3101400000000 NN N Y 0 N N0000020950000100001YNN00NNN000000100N0900000000000000000000001002024081300000000000610000000000000061000000012 0 NN000000000-000000010000000000000000000000020241231000000127 NNN +482630 KR7482630001翣 ST3100910230000 NN N N 0 N N0000286500000100001NNN00NNN000000060Y0900000003872980000000005002025020300000000001094400000000000547207000012 0 NN0000011050000001070000000920009000000001120241231000003135512NNY +482680 KR7482680006̷º7ȣ ST3101400000000 NN N Y 0 N N0000020150000100001NNN00NNN000000100N0900000000007580000000001002024091100000000000821500000000000082150000012 0 NN0000000000000000000000000010000000000000020241231000000165 NNN +482690 KR7482690005Ź뷱19ȣ ST3101400000000 NN N Y 0 N N0000021650000100001NNN00NNN000000100N0900000000075070000000001002024112000000000000561500000000000056150000012 0 NN000000000000000000-00000001-000100000000020241231000000121 NNN +484120 KR7484120001νý ST0100910280000 NN N N 0 N N0000252000000100001NNN00NNN000000060Y0900000000959500000000005002025072300000000001095700000000000547871100012 0 NN000000996-00000004-00000070-007000000000020250930000002761 NNY +484130 KR7484130000ϳ34ȣ ST3101400000000 NN N Y 0 N N0000020750000100001NNN00NNN000000100N0900000000034670000000001002024111900000000000452000000000000045200000012 0 NN0000000000000000000000000000000000000000020241231000000093 NNN +484590 KR7484590005 ST0100910260000 NN N N 0 N N0000132000000100001NNN00NNN000000060Y0900000002649770000000005002025081800000000004121000000000002106493500012 0 NN0000014160000001810000001680016500000003620241231000005439 NNN +484810 KR7484810007Ƽ˷κƽ ST2100910270000 NN N N 0 N N0000210500000100001NNN00NNN000000060Y0900000004672400000000005002025032000000000001545000000000000772545750012 0 NN0000005720000000530000000420003800000001620241231000003252 NNN +486630 KR7486630007KB30ȣ ST3101400000000 NN N Y 0 N N0000020750000100001NNN00NNN000000100N0900000000007040000000001002024092500000000000531000000000000053100000012 0 NN0000000000000000000000000010000000000000020241231000000110 NNN +486990 KR7486990005Ÿ ST0000000000000 NN N N 0 N N0000448500000100001NNN00NNN000000100N0900000005486450000000001002025110300000000002132400000000000213240300012 0 NN000000036-00000125-00000139-013900000000020250930000009563 NNN +487360 KR748736000014ȣ ST3101400000000 NN N Y 0 N N0000020750000100001NNN00NNN000000100N0900000000052770000000001002024122300000000000564000000000000056400000012 0 NN0000000000000000000000000000000000000000020241231000000117 NNN +487720 KR7487720005Ű10ȣ ST3101400000000 NN N Y 0 N N0000021000000100001NNN00NNN000000100N0900000000070590000000001002024122000000000000423000000000000042300000012 0 NN0000000000000000000000000000000000000000020241231000000088 NNN +487830 KR748783000215ȣ ST3101400000000 NN N Y 0 N N0000021000000100001NNN00NNN000000100N0900000000010960000000001002024111500000000000435000000000000043500000012 0 NN0000000000000000000000000000000000000000020241231000000091 NNN +488060 KR748806000511ȣ ST3101400000000 NN N Y 0 N N0000020550000100001NNN00NNN000000100N0900000000022160000000001002024103100000000000472000000000000047200000012 0 NN0000000000000000000000000000000000000000020241231000000096 NNN +488280 KR7488280009 ST0000000000000 NN N N 0 N N0000233500000100001NNN00NNN000000100N0900000002174430000000005002025091900000000001065900000000000532963150012 0 NN000000064-00000052-00000050-005000000000020250930000002488 NNN +488900 KR7488900002γؽ ST0100910300000 NN N N 0 N N0000230500000100001NNN00NNN000000100N0900000007196550000000005002025112100000000002897600000000001448822150012 0 NN000000304-00000141-00000154-0154-0000005920241231000006679 NNN +489210 KR748921000517ȣ ST3101400000000 NN N Y 0 N N0000021250000100001NNN00NNN000000100N0900000000021390000000001002024112100000000000518000000000000051800000012 0 NN0000000000000000000000000000000000000000020241231000000110 NNN +489460 KR7489460006̿ ST2100910230000 NN N N 0 N N0000128400000100001NNN00NNN000000060Y0900000001369950000000005002025052000000000001504400000000000752221500012 0 NN0000002450000000700000000700005500000000020250930000001931 NNN +489480 KR7489480004Ű11ȣ ST3101400000000 NN N Y 0 N N0000020600000100001NNN00NNN000000100N0900000000008150000000001002024121100000000000660000000000000066000000012 0 NN0000000000000000000000000000000000000000020241231000000135 NNN +489500 KR7489500009 ST3100910230000 NN N N 0 N N0000294500000100001NNN00NNN000000060Y0900000001952160000000001002025022500000000000627800000000000062780560012 0 NN0000001470000000380000000360003000000001120250930000001848 NNN +489730 KR748973000213ȣ ST3101400000000 NN N Y 0 N N0000020550000100001NNN00NNN000000100N0900000000005120000000001002024112800000000000633200000000000063320000012 0 NN0000000000000000000000000000000000000000020241231000000130 NNN +490470 KR7490470002̺ ST0100600000000 NN N N 0 N N0000291000000100001NNN00NNN000000100N0900000012251500000000010002025122900000000003371000000000003371046600012 0 NN000000898-00000353-00000362-036100000000020250930000009809 NNN +491000 KR7491000006꽺޵ ST0100910290000 NN N N 0 N N0000803000000100001NNN00NNN000000100N0900000012004460000000005002025122400000000002468100000000001234084550012 0 NN000000346-00000166-00000172-017200000000020250930000019819 NNN +492220 KR7492220009KB31ȣ ST3101400000000 NN N Y 0 N N0000020300000100001NNN00NNN000000100N0900000000006050000000001002024121200000000000621000000000000062100000012 0 NN0000000000000000000000000000000000000000020241231000000126 NNN +493330 KR7493330005 ST0100910270000 NN N N 0 N N0000194900000100001NNN00NNN000000100N0900000003880200000000001002026011400000000000768200000000000076821460012 0 NN0000001320000000210000000220001900000000020250630000001497 NNN +493790 KR7493790000Ÿ17ȣ ST3101400000000 NN N Y 0 N N0000020000000100001NNN00NNN000000100N0900000000178930000000001002025012300000000000531000000000000053100000012 0 NN0000000000000000000000000000000000000000020241231000000106 NNN +494120 KR7494120009ťý ST0100910290000 NN N N 0 N N0000620000000100001NNN00NNN000000100N0900000002381630000000005002025111300000000000761600000000000380824100012 0 NN000000046-00000052-00000056-005600000000020250930000004722 NNN +496070 KR749607000416ȣ ST3101400000000 NN N Y 0 N N0000020250000100001NNN00NNN000000100N0900000000020420000000001002025052900000000000562000000000000056200000012 0 NN0000000000000000000000000000000000000000020241231000000113 NNN +498390 KR7498390004ȭ÷5ȣ ST3101400000000 NN N Y 0 N N0000020150000100001NNN00NNN000000100N0900000000063260000000001002025032000000000000496000000000000049600000012 0 NN0000000000000000000000000000000000000000020241231000000099 NNN +950190 KR8344390008ƮƩ DR 000000000000 NN N N 0 N N0000084800000100001NNN00NNN000000060Y0900000000224620000000000002020081800000000001301700000000000000000000012 0 NN0000006200000001220000001380012100000001120250930000001103 NNN +950170 KR8392080006JTC DR 000000000000 NN N N 0 N N0000051600000100001NNN00NNN000000100N0900000002062380000000000002018040600000000005174600000000000000000000002 0 NN0000017230000001270000001390008900000004620250830000002670 NNN +950250 KR8826050005׶ DR 000000000000 NN N N 0 N N0000091700000100001NNN00NNN000000100N0900000017698820000000000002025120900000000003551700000000000000000000004 0 NN000000034-00000035-00000028-002800000000020251030000003256 NNN +950130 KR8840090003̿ DR 000000000000NNN NNNNNNNN0NNNNNNNN0000038750000100001NNN00NNN000000100N0900000001827570000000000002013053000000000003772700000000000000000000012 0 NN000000260-00000410-00000353-0288-0000000620250930000001461 NNN +950140 KR8840110108ױۿ左 DR 000000000000 NN N N 0 N N0000119000000100001NNN00NNN000000060Y0900000001321360000000000002016101400000000001986700000000000000000000012 0 NN0000016230000002810000002500017400000001820250930000002364 NNY +950160 KR8840120008ڿƼ DR 000000000000 NN N N 0 N N0000972000000100001NNN00NNN000000100N0900000009049920000000000002017110600000000008322100000000000000000000012 0 NN000000051-00000220-00000339-0338-0000002620241231000080891 NNN +950220 KR8840140006׿̹ DR 000000000000 NN N N 0 N N0000007460000100001NNN00NNN000000100N0900000025243500000000000002021031600000000016763800000000000000000000012 0 NN000000001-00000191-00000211-0211-0000005420250930000001250 NNN +950200 KR8840150005Ҹ DR 000000000000 NN N N 0 N N0000036200000100001NNN00NNN000000100N0900000000345180000000000002020071300000000001923600000000000000000000012 0 NN000000421-00000021-00000038-0038-0000001520250930000000696 NNN +900120 KYG2114A1094 FS 000000000000NNN NNNNNNNN0NNNNNNNN0000005140000100001NNN00NNN000000100N0900000001089930000000000002010033100000000003005700000000000001502889206 0 NN0000001630000000480000000470004700000000220250930000000154 NNN +900250 KYG2115T1076ũŻż FS 000000000000NNN NNNNNNNN0NNNNNNNN0000006760000100001NNN00NNN000000100N0900000007201480000000000002016012800000000013064000000000000006532000212 0 NN0000007870000001280000001340010800000000420250930000000883 NNN +900070 KYG3931T1076۷ι FS 000000000000NNN NNNNNNNN0NNNNNNNN0000004510000100001NNN00NNN000000100N0900000011533180000000000002009122300000000005374300000000000002687198412 0 NN0000009530000000600000000750005700000000320250930000000242 NNN +900100 USU652221081ָӸ FS 000000000000NNN NNNNNNNN0NNNNNNNN0000005660000100001NNN00NNN000000100N0900000001208500000000000022010042100000000004603700000000000006905593812 0 NN000000054-00000073-00000107-0104-0000003520250930000000260 NNN diff --git a/backend/tmp_master/kospi_code.mst b/backend/tmp_master/kospi_code.mst new file mode 100644 index 0000000..63c1c81 --- /dev/null +++ b/backend/tmp_master/kospi_code.mst @@ -0,0 +1,2482 @@ +F70100022KR5701000220ֵ̱1(A) BC 000000000000NN 0NNN NN N 0 N 0000009500000100000NNN00NNN000000100N09000000000000000000000100020250418000000000021941000000000021941377000 0 NNN00000000000000000000000000000000000000.00 000000208 NNN +F70100023KR5701000238ֵ̱1(A-e) BC 000000000000NN 0NNN NN N 0 N 0000009510000100000NNN00NNN000000100N09000000000000000000000100020250418000000000013437000000000013437576000 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +F70100024KR5701000246ֵ̱2(A) BC 000000000000NN 0NNN NN N 0 N 0000009500000100000NNN00NNN000000100N09000000000000000000000100020250418000000000008921000000000008921895000 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +F70100025KR5701000253ֵ̱2(A-e) BC 000000000000NN 0NNN NN N 0 N 0000009510000100000NNN00NNN000000100N09000000000000000000000100020250418000000000026508000000000026508581000 0 NNN00000000000000000000000000000000000000.00 000000252 NNN +F70100026KR5701000261۷ιؽƮ̺1(A) BC 000000000000NN 0NNN NN N 0 N 0000010820000100000NNN00NNN000000100N09000000000000000000000100020250901000000000023788000000000023788084000 0 NNN00000000000000000000000000000000000000.00 000000257 NNN +F70100027KR5701000279۷ιؽƮ̺1(A-e) BC 000000000000NN 0NNN NN N 0 N 0000010830000100000NNN00NNN000000100N09000000000000000000000100020250901000000000001498000000000001498487000 0 NNN00000000000000000000000000000000000000.00 000000016 NNN +F70100028KR5701000287۷ιؽƮ̺2(A) BC 000000000000NN 0NNN NN N 0 N 0000010820000100000NNN00NNN000000100N09000000000000000000000100020250901000000000000268000000000000268807000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F70100029KR5701000295۷ιؽƮ̺2(A-e) BC 000000000000NN 0NNN NN N 0 N 0000010830000100000NNN00NNN000000100N09000000000000000000000100020250901000000000023925000000000023925541000 0 NNN00000000000000000000000000000000000000.00 000000259 NNN +F70100030KR5701000303ѹٽɼĿ1(A) BC 000000000000NN 0NNN NN N 0 N 0000010890000100000NNN00NNN000000100N09000000000000000000000100020251128000000000029375000000000029375937000 0 NNN00000000000000000000000000000000000000.00 000000319 NNN +F70100031KR5701000311ѹٽɼĿ1(A-e) BC 000000000000NN 0NNN NN N 0 N 0000010900000100000NNN00NNN000000100N09000000000000000000000100020251128000000000030072000000000030072154000 0 NNN00000000000000000000000000000000000000.00 000000327 NNN +F70100032KR5701000329ѹٽɼĿ2(A) BC 000000000000NN 0NNN NN N 0 N 0000010890000100000NNN00NNN000000100N09000000000000000000000100020251128000000000035209000000000035209775000 0 NNN00000000000000000000000000000000000000.00 000000383 NNN +F70100033KR5701000337ѹٽɼĿ2(A-e) BC 000000000000NN 0NNN NN N 0 N 0000011220000100000NNN00NNN000000100N09000000000000000000000100020251128000000000024254000000000024254045000 0 NNN00000000000000000000000000000000000000.00 000000272 NNN +F70101B95KR570101B954жε BC 000000000000NN 0NNN NN N 0 N 0000005490000100000NNN00NNN000000100N09000000000000000000000100020190521000000000053532000000000053532869000 0 NNN00000000000000000000000000000000000000.00 000000293 NNN +F70101B96KR570101B962⿡ھǽ2ȣ BC 000000000000NN 0NNN NN N 0 N 0000004640000100000YNN00NNN000000100N09000000000000000000000100020190911000000000090387000000000090387607000 0 NNN00000000000000000000000000000000000000.00 000000419 NNN +F70101B9AKR570101B9A2ѱڴǽ1ȣ BC 000000000000NN 0NNN NN N 0 N 0000002500000100000NNN00NNN000000100N09000000000000000000000100020200121000000000126300000000000126300000000 0 NNN00000000000000000000000000000000000000.00 000000315 NNN +F70102B96KR570102B960θũھǽ(Ļ)(A) BC 000000000000NN 0NNN NN N 0 N 0000011000000100000NNN00NNN000000100N09000000000000000000000100020190920000000000078856000000000078856510000 0 NNN00000000000000000000000000000000000000.00 000000867 NNN +F70103B96KR570103B968θũھǽ(Ļ)(C-I) BC 000000000000NN 0NNN NN N 0 N 0000009940000100000NNN00NNN000000100N09000000000000000000000100020190920000000000016000000000000016000000000 0 NNN00000000000000000000000000000000000000.00 000000159 NNN +F70900001KR5709000016ϵ־2ȣ A BC 000000000000NN 0NNN NN N 0 N 0000010100000100000NNN00NNN000000100N09000000000000000000000100020250425000000000006716000000000006716038000 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +F70900002KR5709000024ϵ־2ȣ A-e BC 000000000000NN 0NNN NN N 0 N 0000010040000100000NNN00NNN000000100N09000000000000000000000100020250425000000000007847000000000007847577000 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +F71201B98KR571201B985Űǽε1ȣ A BC 000000000000NN 0NNN NN N 0 N 0000003990000100000NNN00NNN000000100N09000000000000000000000100020191112000000000016355000000000016355918000 0 NNN00000000000000000000000000000000000000.00 000000065 NNN +F71202B98KR571202B983Űǽε1ȣ C-I BC 000000000000NN 0NNN NN N 0 N 0000009290000100000NNN00NNN000000100N09000000000000000000000100020191112000000000000644000000000000644082000 0 NNN00000000000000000000000000000000000000.00 000000005 NNN +F71203B98KR571203B981Űǽε2ȣ A BC 000000000000NN 0NNN NN N 0 N 0000009800000100000NNN00NNN000000100N09000000000000000000000100020191112000000000015529000000000015529644000 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +F71204B98KR571204B989Űǽε2ȣ C-I BC 000000000000NN 0NNN NN N 0 N 0000009290000100000NNN00NNN000000100N09000000000000000000000100020191112000000000001470000000000001470356000 0 NNN00000000000000000000000000000000000000.00 000000013 NNN +F71205B98KR571205B986Űǽε3ȣ A BC 000000000000NN 0NNN NN N 0 N 0000003000000100000NNN00NNN000000100N09000000000000000000000100020191112000000000014272000000000014272637000 0 NNN00000000000000000000000000000000000000.00 000000042 NNN +F71206B98KR571206B984Űǽε3ȣ C-I BC 000000000000NN 0NNN NN N 0 N 0000009290000100000NNN00NNN000000100N09000000000000000000000100020191112000000000002727000000000002727363000 0 NNN00000000000000000000000000000000000000.00 000000025 NNN +F71207B98KR571207B982Űǽε4ȣ A BC 000000000000NN 0NNN NN N 0 N 0000010500000100000NNN00NNN000000100N09000000000000000000000100020191112000000000001400000000000001400000000 0 NNN00000000000000000000000000000000000000.00 000000014 NNN +F71208B98KR571208B980Űǽε4ȣ C-I BC 000000000000NN 0NNN NN N 0 N 0000009290000100000NNN00NNN000000100N09000000000000000000000100020191112000000000015600000000000015600000000 0 NNN00000000000000000000000000000000000000.00 000000144 NNN +F73400006KR5734000064ڷƮϵָ2ȣ A BC 000000000000NN 0NNN NN N 0 N 0000010070000100000NNN00NNN000000100N09000000000000000000000100020250214000000000026502000000000026502566000 0 NNN00000000000000000000000000000000000000.00 000000266 NNN +F73400007KR5734000072ڷƮϵָ2ȣ A-e BC 000000000000NN 0NNN NN N 0 N 0000010070000100000NNN00NNN000000100N09000000000000000000000100020250214000000000005865000000000005865734000 0 NNN00000000000000000000000000000000000000.00 000000059 NNN +F73400008KR5734000080ڷƮϵָ3ȣ A BC 000000000000NN 0NNN NN N 0 N 0000010120000100000NNN00NNN000000100N09000000000000000000000100020250808000000000006707000000000006707382000 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +F73400009KR5734000098ڷƮϵָ3ȣ A2 BC 000000000000NN 0NNN NN N 0 N 0000010120000100000NNN00NNN000000100N09000000000000000000000100020250808000000000009177000000000009177718000 0 NNN00000000000000000000000000000000000000.00 000000092 NNN +F73400010KR5734000106ڷƮϵָ3ȣ Ae BC 000000000000NN 0NNN NN N 0 N 0000010120000100000NNN00NNN000000100N09000000000000000000000100020250808000000000002599000000000002599391000 0 NNN00000000000000000000000000000000000000.00 000000026 NNN +F74201773KR5742017738ϳüε1ȣ BC 000000000000NN 0NNN NN N 0 N 0000001250000100000NNN00NNN000000100N09000000000000200000000100020170627000000000136688000000000136688658000 0 NNN00000000000000000000000000000000000000.00 000000170 NNN +F74201BAAKR574201BAA6ϳü̱ε1ȣ A BC 000000000000NN 0NNN NN N 0 N 0000007000000100000NNN00NNN000000100N09000000000000000000000100020210108000000000021241000000000021241331000 0 NNN00000000000000000000000000000000000000.00 000000148 NNN +F74202BAAKR574202BAA4ϳü̱ε1ȣ C-I BC 000000000000NN 0NNN NN N 0 N 0000009200000100000NNN00NNN000000100N09000000000000000000000100020210108000000000019758000000000019758669000 0 NNN00000000000000000000000000000000000000.00 000000181 NNN +F74401777KR5744017777ʽ̱11ȣ BC 000000000000NN 0NNN NN N 0 N 0000002770000100000NNN00NNN000000100N09000000020987600000000100020170901000000000146999000000000146999951000 0 NNN00000000000000000000000000000000000000.00 000000407 NNN +F74401BAAKR574401BAA2ʽ̱16ȣ A BC 000000000000NN 0NNN NN N 0 N 0000003700000100000NNN00NNN000000100N09000000030450200000000100020201222000000000092595000000000092595835000 0 NNN00000000000000000000000000000000000000.00 000000342 NNN +F74601669KR5746016694KCGIƮڽŹ BC 000000000000NN 0NNN NN N 0 N 0000013000000100000NNN00NNN000000100N09000000000580500000000100020161201000000000053086000000000053086337000 0 NNN00000000000000000000000000000000000000.00 000000690 NNN +F74701776KR5747017766ھε126ȣ A BC 000000000000NN 0NNN NN N 0 N 0000090000000100000NNN00NNN000000100N09000000000000000000000100020170908000000000061133000000000061133729000 0 NNN00000000000000000000000000000000000000.00 000005502 NNN +F74701B97KR574701B973۷ι281ȣ Class A BC 000000000000NN 0NNN NN N 0 N 0000009100000100000NNN00NNN000000100N09000000000000000000000100020191010000000000230574000000000230574068000 0 NNN00000000000000000000000000000000000000.00 000002098 NNN +F74701B9AKR574701B9A8299ȣA BC 000000000000NN 0NNN NN N 0 N 0000010150000100000NNN00NNN000000100N09000000000000000000000100020200109000000000021670000000000021670028000 0 NNN00000000000000000000000000000000000000.00 000000219 NNN +F74702776KR5747027765ھε126ȣ C-i BC 000000000000NN 0NNN NN N 0 N 0000010050000100000NNN00NNN000000100N09000000000000000000000100020170908000000000000402000000000000402701000 0 NNN00000000000000000000000000000000000000.00 000000004 NNN +F75601BA2KR575601BA20ε3ȣClassA BC 000000000000NN 0NNN NN N 0 N 0000000900000100000NNN00NNN000000100N09000000000000000000000100020200512000000000038319000000000038319438000 0 NNN00000000000000000000000000000000000000.00 000000034 NNN +F75602BA2KR575602BA29ε3ȣClassC-I BC 000000000000NN 0NNN NN N 0 N 0000010150000100000NNN00NNN000000100N09000000000000000000000100020200512000000000067679000000000067679890000 0 NNN00000000000000000000000000000000000000.00 000000686 NNN +F75701BA7KR575701BA78۽Ʈε30ȣ[Ļ] A BC 000000000000NN 0NNN NN N 0 N 0000006600000100000NNN00NNN000000100N09000000000000000000000100020200928000000000028809000000000028809945000 0 NNN00000000000000000000000000000000000000.00 000000190 NNN +F75702BA7KR575702BA77۽Ʈε30ȣ[Ļ] C-i BC 000000000000NN 0NNN NN N 0 N 0000009650000100000NNN00NNN000000100N09000000000000000000000100020200928000000000023488000000000023488200000 0 NNN00000000000000000000000000000000000000.00 000000226 NNN +F76201BC5KR576201BC53Żƹ1ȣ A BC 000000000000NN 0NNN NN N 0 N 0000008700000100000NNN00NNN000000100N09000000000000000000000100020220823000000000066985000000000066985800000 0 NNN00000000000000000000000000000000000000.00 000000582 NNN +F77200005KR5772000059ѱAIżҺ1ȣ(A) BC 000000000000NN 0NNN NN N 0 N 0000010630000100000NNN00NNN000000100N09000000000000000000000100020240621000000000011454000000000011454937000 0 NNN00000000000000000000000000000000000000.00 000000121 NNN +F77200006KR5772000067ѱAIżҺ1ȣ(A-e) BC 000000000000NN 0NNN NN N 0 N 0000010640000100000NNN00NNN000000100N09000000000000000000000100020240621000000000012492000000000012492822000 0 NNN00000000000000000000000000000000000000.00 000000132 NNN +F77200007KR5772000075ѱAIżҺ1ȣ(C-F) BC 000000000000NN 0NNN NN N 0 N 0000010650000100000NNN00NNN000000100N09000000000000000000000100020240621000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F77200008KR5772000083ѱAIżҺ2ȣ(A) BC 000000000000NN 0NNN NN N 0 N 0000010630000100000NNN00NNN000000100N09000000000000000000000100020240621000000000011515000000000011515156000 0 NNN00000000000000000000000000000000000000.00 000000122 NNN +F77200009KR5772000091ѱAIżҺ2ȣ(A-e) BC 000000000000NN 0NNN NN N 0 N 0000009900000100000NNN00NNN000000100N09000000000000000000000100020240621000000000012453000000000012453976000 0 NNN00000000000000000000000000000000000000.00 000000123 NNN +F77200010KR5772000109ѱAIżҺ2ȣ(C-F) BC 000000000000NN 0NNN NN N 0 N 0000010650000100000NNN00NNN000000100N09000000000000000000000100020240621000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F77200017KR5772000174ѱVĿ1(A) BC 000000000000NN 0NNN NN N 0 N 0000010990000100000NNN00NNN000000100N09000000000000000000000100020251219000000000026098000000000026098184000 0 NNN00000000000000000000000000000000000000.00 000000286 NNN +F77200018KR5772000182ѱVĿ1(A-e) BC 000000000000NN 0NNN NN N 0 N 0000011000000100000NNN00NNN000000100N09000000000000000000000100020251219000000000024055000000000024055627000 0 NNN00000000000000000000000000000000000000.00 000000264 NNN +F77200019KR5772000190ѱVĿ1(C-F) BC 000000000000NN 0NNN NN N 0 N 0000011010000100000NNN00NNN000000100N09000000000000000000000100020251219000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F77200020KR5772000208ѱVĿ2(A) BC 000000000000NN 0NNN NN N 0 N 0000010980000100000NNN00NNN000000100N09000000000000000000000100020251219000000000024298000000000024298944000 0 NNN00000000000000000000000000000000000000.00 000000266 NNN +F77200021KR5772000216ѱVĿ2(A-e) BC 000000000000NN 0NNN NN N 0 N 0000010990000100000NNN00NNN000000100N09000000000000000000000100020251219000000000025958000000000025958965000 0 NNN00000000000000000000000000000000000000.00 000000285 NNN +F77200022KR5772000224ѱVĿ2(C-F) BC 000000000000NN 0NNN NN N 0 N 0000011000000100000NNN00NNN000000100N09000000000000000000000100020251219000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F77300005KR5773000058ýSAFE3ȣ(A) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000002119000000000002119735000 0 NNN00000000000000000000000000000000000000.00 000000023 NNN +F77300006KR5773000066ýSAFE3ȣ(Ae) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000002865000000000002865521000 0 NNN00000000000000000000000000000000000000.00 000000032 NNN +F77300007KR5773000074ýSAFE3ȣ(CF) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +F77300008KR5773000082ýSAFE4ȣ(A) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000001449000000000001449484000 0 NNN00000000000000000000000000000000000000.00 000000016 NNN +F77300009KR5773000090ýSAFE4ȣ(Ae) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000003535000000000003535769000 0 NNN00000000000000000000000000000000000000.00 000000039 NNN +F77300010KR5773000108ýSAFE4ȣ(CF) BC 000000000000NN 0NNN NN N 0 N 0000011170000100000NNN00NNN000000100N09000000000000000000000100020251114000000000000200000000000000200000000 0 NNN00000000000000000000000000000000000000.00 000000002 NNN +000020 KR7000020008ȭǰ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000061100000100001NNN00NNN000000060Y0900000000886540000000010001976032400000000002793100000000002793147000012 0 NNY00000372700000004300000010900056000002.0220250930000001706 NNN +000040 KR7000040006KRͽ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000004440000100001NNN00NNN000000100N0900000002596410000000005001976052500000000008637500000000004318759200012 0 NNY000000109-00000023-00000041-0041-00012.9620250930000000383 NNN +000050 KR7000050005 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000088400000100001NNN00NNN000000050Y0900000001863020000000005001956030300000000002741500000000001370763500012 0 NNY00000294300000027100000035700293000005.7120250930000002423 NNY +000070 KR7000070003Ȧ ST2002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000610000000100001NNN00NNN000000050Y0900000000232830000000050001968122700000000000776300000000004021595500012 0 NNY00002663100000121000000143901153000001.9220250930000004735512NNN +000080 KR7000080002Ʈ ST2002700050000 NN7NNY NNNNNNNNN0NNNNNNNN0000178800000100001NNN00NNN000000050Y0900000002763020000000050002009101900000000007013300000000036316805500012 0 NYY00001928900000181600000142701048000007.4620250930000012539732NNY +000087 KR7000082008Ʈ2B ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000142900000100001NNN00NNN000000100N0900000000070580000000050002011092600000000000113000000000000565069000012 2 NNN00000000000000000000000000000000000000.00 000000161 NNN +0000D0 KR70000D0009TIGER ƹ̱äĿݹ뷱(ռ)EF 000000000000NN 0NNN2NN N 0 Y 0000097600000100001NNN00NNN030000100N0900000001607060000000000002024121700000000000615000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000606 NNN +0000H0 KR70000H0005KODEX εNifty̵ĸ100 EF 000000000000NN 0NNN2NN N 0 Y 0000103500000100001NNN00NNN030000100N0900000000092830000000000002025040800000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000165 NNN +0000J0 KR70000J0003PLUS ȭ׷ EF 000000000000NN 0NNN2NN N 0 Y 0000327450000100001NNN00NNN000000050Y0900000002883310000000000002024122400000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001997 NNN +0000Y0 KR70000Y0004HK 26-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001002700000100001NNN00NNN000000100N0900000000000000000000000002024122400000000000121000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001213 NNN +0000Z0 KR70000Z0003RISE ̿TOP10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000171150000100001NNN00NNN000000100N0900000009041260000000000002024122400000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000564 NNN +000100 KR7000100008Ѿ ST1002700090000 NNAYNY YYNNYNNNN0NNNNNNNN0001097000000100001NNN00NNN000000050Y0900000005572830000000010001962110100000000007996800000000008020906400012 0 NYY00001640600000078300000101800752000003.1920250930000087725 NNY +000105 KR7000101006Ѿ ST0002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000966000000100001NNN00NNN000000060Y0900000000038320000000010001995022100000000000118000000000000118094000012 1 NNN00000000000000000000000000000000000000.00 000001140 NNN +000120 KR7000120006CJ ST2001900000000 NN9NNY NNNNNNNNN0NNNNNNYY0000993000000100001NNN00NNN000000050Y0900000000488850000000050001956070200000000002281200000000011406172000012 0 NYY00009107600000348500000232701726000006.6120250930000022652720NNY +000140 KR7000140004ƮȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000095400000100001NNN00NNN000000050Y0900000000410620000000050001973091900000000002320600000000011603382500012 0 NNY00001918400000190100000133800937000007.3320250930000002213732NNN +000145 KR7000141002ƮȦ ST0002100000000 YN0NNN NNNNNNNNN0NNNNNNNN0000118000000100001NNN00NNN000000100N0900000000005370000000050001987092900000000000047000000000000235405000012 1 NNN00000000000000000000000000000000000000.00 000000055 NNN +000150 KR7000150003λ ST1002100000000 NY2YNY YYNNNNNNN0NNNNNNNY0009070000000100001NNN00NNN000000050Y0900000000953590000000050001973062900000000001619300000000009929060500012 0 NYY00014097500000787500000669603559000003.6720250930000146878391NNY +000155 KR7000151001λ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0004975000000100001NNN00NNN000000050Y0900000000260900000000050001986073100000000000399600000000001998231000012 1 NNN00000000000000000000000000000000000000.00 000019882 NNY +000157 KR7000152009λ2B ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0004325000000100001NNN00NNN000000050Y0900000000016220000000050001999120300000000000089300000000000446519000012 2 NNN00000000000000000000000000000000000000.00 000003862 NNN +000180 KR7000180000â ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000014130000100001NNN00NNN000000100N0900000000886170000000005001976060200000000006975100000000003600000000012 0 NNY000000965-00000048-00000058-0057-00001.8520250930000000985 NNN +0001P0 KR70001P0004Ƽ ̿ùз&CDMOƼ EF 000000000000NN 0NNN2NN N 0 Y 0000136000000100001NNN00NNN000000100N0900000000409000000000000002024122400000000000112000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +0001S0 KR70001S0001TIGER 26-04 ȸä(A+̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000510300000100001NNN00NNN000000100N0900000000120050000000000002024122400000000000371400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001895 NNN +000210 KR7000210005DL ST2002700080000 NN1NNY NNNNNNNNN0NYNNNNNY0000412000000100001NNN00NNN000000050Y0900000001267010000000050001976020200000000002095500000000012827942000012 0 NYY000040963000002868-00000321-0788-00000.6920250930000008633321NNY +000215 KR7000211003DL ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000237000000100001NNN00NNN000000100N0900000000167280000000050001989082100000000000168600000000001043057500012 1 NNN00000000000000000000000000000000000000.00 000000399 NNN +000220 KR7000220004 ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000044650000100001NNN00NNN000000100N0900000000965090000000010001975111800000000001703200000000001760919100012 0 NNY00000106500000011100000009300079000004.8320250930000000760 NNN +000225 KR70002210021 ST0002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000047150000100001NNN00NNN000000100N0900000001136300000000010001990010500000000000226600000000000226693000012 1 NNN00000000000000000000000000000000000000.00 000000106 NNN +000227 KR70002220002B ST0002700090000 YN0NNN NNNNNNNNN0NNNNNNNN0000105900000100001NNN00NNN000000100N0900000000022950000000010002000062000000000000032500000000000032556000012 2 NNN00000000000000000000000000000000000000.00 000000034 NNN +000230 KR7000230003ϵȦ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000125000000100001NNN00NNN000000100N0900000000925640000000010001975062800000000001154000000000001154040000012 0 NNY00000437100000007700000009200018000070.1220250930000001442 NNN +000240 KR7000240002ѱ۴ ST2002100000000 NN8NNY NNNNNNNNN0NNNNNNNY0000260500000100001NNN00NNN000000050Y0900000001077590000000005001968122700000000009493500000000004746762000012 0 NYY00001117200000337800000331103017000006.9420250930000024730912NNN +000270 KR7000270009 ST1002700150000 NN8YYY YYYNNNNNN0NNNNNNNY0001497000000100001NNN00NNN000000050Y0900000017561190000000050001973072100000000039041200000000213931673500012 0 NYY00086053200007235600008130460833000014.1020250930000584448BH1NNY +0002C0 KR70002C0008÷ εϵĿ20Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000093350000100001NNN00NNN000000100N0900000000046840000000000002025022500000000000108000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +000300 KR7000300004DHؽ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000042000000100001YNN00NNN000000100N0900000000000000000000005001975060900000000004143700000000002071852750012 0 NNY00000026900000002700000004400039-00259.2320250930000001740 NNN +000320 KR7000320002Ȧ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000212500000100001NNN00NNN000000100N0900000000298600000000005001973081000000000001329100000000000840757550012 0 NNY00000952500000055600000062500456000007.1220250930000002824 NNN +000325 KR7000321000Ȧ ST0002100000000 YN0NNN NNNNNNNNN0NNNNNNNN0000309000000100001NNN00NNN000000100N0900000000002530000000005001989012100000000000024300000000000012177950012 1 NNN00000000000000000000000000000000000000.00 000000075 NNN +000370 KR7000370007ȭغ ST2002100250000 NN0NNY NNNNNNNNN0NNNNNYNN0000059600000100001NNN00NNN000000050Y0900000006323410000000050001975063000000000011673800000000058369457500012 0 NNY00005391400000342700000340602331000008.7020250930000006957913NNY +000390 KR7000390005ȭƮ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000066700000100001NNN00NNN000000060Y0900000002912860000000005001993091000000000002720300000000001360173450012 0 NNY00000466300000005900000009800070000000.0020250930000001814 NNY +000400 KR7000400002Եغ ST2002100250000 NN0NNY NNNNNNNNN0NNNNNYNN0000016610000100001NNN00NNN000000060Y0900000006942700000000010001971041600000000031033600000000031033632000012 0 NNY00000000000000000000000000000000000000.0020250930000005154 NNN +000430 KR7000430009 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000042500000100001NNN00NNN000000060Y0900000001788060000000005001977062200000000006200000000000003100000000012 0 NNY00001193600000031600000033600201000001.9920250930000002635Z35NNN +000480 KR7000480004CRȦ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000047250000100001NNN00NNN000000060Y0900000000239450000000005001978063000000000004689000000000002344524500012 0 NNY00000634500000032800000007400025-00003.4920250930000002215 NNN +000490 KR7000490003뵿 ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000098900000100001NNN00NNN000000050Y0900000001360720000000010001975062700000000002882600000000002882686500012 0 NNY00001155400000047300000012700122-00001.0420250930000002850 NNY +0004G0 KR70004G00021Q ̱TOP30 EF 000000000000NN 0NNN2NN N 0 Y 0000091350000100001NNN00NNN030000100N0900000000289320000000000002025012100000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000091 NNN +000500 KR7000500009 ST2002700130000 NN0NNY NNNNNNNNN0NNNNNNNN0000876000000100001NNN00NNN000000050Y0900000000613120000000050001987060800000000001654300000000008271557500012 0 NYY00001932000000071200000058300483000011.8520250930000014491FN2NNY +000520 KR7000520007 ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000098000000100001NNN00NNN000000060Y0900000007307440000000005001985052900000000002169100000000001084590550012 0 NNY000001572-00000136-00000244-0235-00017.0420250930000002125 NNY +000540 KR7000540005ﱹȭ ST3002100250000 NN0NNN NNNNNNNNN0NNNNNNNN0000036100000100001NNN00NNN000000060Y0900000000798350000000050001974120500000000006424200000000032121322500012 0 NNY00003374000000148800000143701067000009.9720241231000002319841NNN +000545 KR7000541003ﱹȭ ST0002100250000 NN0NNN NNNNNNNNN3NNNNNNNN0000071500000100001NNN00NNN000000100N0900000000057320000000050001990032000000000000076800000000000384000000012 1 NNN00000000000000000000000000000000000000.00 000000054 NNN +000590 KR7000590000CSȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000768000000100001NNN00NNN000000100N0900000000026920000000050001975122200000000000115400000000000577241000012 0 NNY00000099100000016600000018400152000009.0120250930000000886 NNN +0005A0 KR70005A0007KODEX ̱S&P500ϸĿOTM EF 000000000000NN 0NNN2NN N 0 Y 0000096700000100001NNN00NNN030000100N0900000003887350000000000002025010700000000001460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001429 NNN +0005C0 KR70005C0005RISE ̱S&P500ȭ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000112100000100001NNN00NNN000000100N0900000000023500000000000002025011400000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000089 NNN +0005D0 KR70005D0004SOL ü͸&Ǹ EF 000000000000NN 0NNN2NN N 0 Y 0000186050000100001NNN00NNN000000100N0900000019629080000000000002025010700000000000670000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001246 NNN +0005G0 KR70005G0001ITF K-AIݵüھũ EF 000000000000NN 0NNN2NN N 0 Y 0000250750000100001NNN00NNN030000100N0900000000394960000000000002025012100000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000313 NNN +000640 KR7000640003ƽÿȦ ST2002100000000 NN0NNY NNNNYNNNN0NNNNNNNN0001080000000100001NNN00NNN000000050Y0900000000214670000000050001970021000000000000653600000000003268217000012 0 NNY00001057900000081800000078701031000009.8020250930000007059 NNN +000650 KR7000650002õϰ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0002915000000100001NNN00NNN000000100N0900000000384780000000050001977062300000000000142900000000000714610000012 0 NNY000000447-00000053-00000042-0042-00025.3220241231000004166 NNN +000660 KR7000660001SK̴н ST1002700130000 NN5YYY YYNYNNNNN0NNNNNNNY0008410000000100001NNN00NNN000000050Y0900000067084970000000050001996122600000000072800200000000365765205000012 0 NYY00064320000028036700032812227701000043.2020250930006122499535NNY +000670 KR7000670000dz ST2002700110000 NN3NNY NNNNNNNNY0NNNNNNNN0000632000000100001NNN00NNN000000100N0900000000625860000000005001976061200000000001807700000000000955422500012 0 NYY000019213-0000159200000175301362-00005.2420250930000011425632NNN +000680 KR7000680009LSƮ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000035100000100001NNN00NNN000000100N0900000003315630000000050001973111500000000007880300000000039401508000012 0 NNY00001573100000048400000032500192000000.0020250930000002765FN2NNN +000700 KR7000700005Ȧ ST3002600000000 NN0NNY NNNNNNNNN0NNNNNNYN0000060100000100001NNN00NNN000000100N0900000000251220000000025001956030300000000002604100000000006510453000012 0 NNY00000315300000024400000024200175000004.6520250930000001565926NNN +000720 KR7000720003Ǽ ST1001800000000 NN1YNY YYNNNNNNN0NYNNNNNY0001057000000100001NNN00NNN000000060Y0900000013841400000000050001984122200000000011135500000000055677882500012 0 NYY00023002800000534200000489403932-00003.2220250930000117703BH1NNY +000725 KR7000721001Ǽ ST0001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000650000000100001NNN00NNN000000100N0900000000143280000000050001989092100000000000105400000000000527346500012 1 NNN00000000000000000000000000000000000000.00 000000685 NNN +000760 KR7000760009ȭ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000147500000100001NNN00NNN000000100N0900000000032940000000050001994042900000000000280000000000001400000000012 0 NNY00000035500000001000000000400003-00000.7020250930000000413 NNN +0007F0 KR70007F0000KODEX 27-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000101200000100001NNN00NNN000000100N0900000000481070000000000002025011400000000003995000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004042 NNN +0007G0 KR70007G0009PLUS ۷ιڷ¹ü EF 000000000000NN 0NNN2NN N 0 Y 0000178850000100001NNN00NNN000000100N0900000000848560000000000002025011400000000000375000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000670 NNN +0007N0 KR70007N0000̿ 200 EF 000000000000NN 0NNN2NN N 0 Y 0000773750000100001NNN00NNN000000100N0900000000012550000000000002025021100000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000696 NNN +000810 KR7000810002Zȭ ST1002100250000 NY6YYY YYNNNNNNN0NNNNNYNY0004910000000100001NNN00NNN000000050Y0900000001148880000000005001975063000000000004601100000000002480241850012 0 NYY00018695500002267900002372517859000011.4420250930000225914511NNN +000815 KR7000811000Zȭ ST0002100250000 NN0NNN NNNNNNNNN0NNNNNNNN0003720000000100001NNN00NNN000000050Y0900000000140990000000005001990041000000000000309900000000000167100000012 1 NNN00000000000000000000000000000000000000.00 000011530 NNN +000850 KR7000850008ȭõ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000419000000100001NNN00NNN000000100N0900000000247700000000050001999111800000000000220000000000001100000000012 0 NNY00000170600000005900000012700105000003.8320250930000000921 NNN +000860 KR7000860007 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000166500000100001NNN00NNN000000060Y0900000000965630000000005001975111200000000001300000000000000650000000012 0 NNY00000450100000011500000008900058000000.9620250930000002164 NNN +000880 KR7000880005ȭ ST1002700080000 NN4NNY YYNNNNNNN1NNNNNNNY0001135000000100001NNN00NNN000000050Y0900000004429810000000050001976062400000000007495800000000037479367500012 0 NYY00053671400003751600002167917602000000.0020250930000085078913NNN +00088K KR700088K015ȭ3B ST0002700080000 N 0NNN NN N 1 N 0000475000000100001NNN00NNN000000050Y0900000000634600000000050002016101900000000001940400000000009702220500012 2 NNN00000000000000000000000000000000000000.00 000009217 NNN +000890 KR7000890004ؾ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000004080000100001NNN00NNN000000100N0900000008551610000000005001988092300000000013812000000000006956006450012 0 NNY00000043200000002500000002100019000008.7520250630000000563 NNN +0008E0 KR70008E0000ACE ̱߽߼ EF 000000000000NN 0NNN2NN N 0 Y 0000127950000100001NNN00NNN000000100N0900000000128210000000000002025012100000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000147 NNN +0008S0 KR70008S0004TIGER ̱ٿŸٵϸĿEF 000000000000NN 0NNN2NN N 0 Y 0000093450000100001NNN00NNN000000060Y0900000002408050000000000002025012100000000001765000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001649 NNN +0008T0 KR70008T0003SOL ȭǰTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000144750000100001NNN00NNN000000050Y0900000008948940000000000002025012100000000000790000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001143 NNN +000910 KR7000910000Ͽ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000044700000100001NNN00NNN000000100N0900000001369100000000005001996070300000000001561100000000000780580950012 0 NNY00000154200000002000000014900096-00013.7020250930000000697 NNN +000950 KR7000950006 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000372000000100001NNN00NNN000000100N0900000000056380000000050001968102100000000000168000000000000840000000012 0 NNY000000314-0000005800000030400303000014.2820250930000000624 NNN +000970 KR7000970004ѱö ST3002700110000 NN0NNY NNNNNNNNN0NYNNNNNN0000067200000100001NNN00NNN000000060Y0900000000355740000000005001969121200000000002280000000000001200000000012 0 NNY00000302900000011200000015900127000004.2520250930000001532 NNN +000990 KR7000990002DB ST2002700130000 NN0NNY NNNYNNNNN0NNNNNNNN0001047000000100001NNN00NNN000000050Y0900000008022180000000050001975121200000000004350400000000022199294000012 0 NYY00001009400000206900000250301966000012.3820250930000045549LB9NNY +001020 KR7001020007ڸ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000006100000100001NNN00NNN000000100N0900000001270700000000005001976062600000000017798300000000008899165650012 0 NNY000001978-00000051-00000116-0122-00007.8920250930000001085 NNN +001040 KR7001040005CJ ST1002100000000 NN7NNY NNNNNNNNN0NNNNNNNY0001983000000100001NNN00NNN000000050Y0900000001901740000000050001973062900000000002917600000000014661369500012 0 NYY00033148000001815400001322307980000007.3320250930000057857720NNY +001045 KR7001041003CJ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000911000000100001NNN00NNN000000050Y0900000000060250000000050001989081800000000000226000000000001130111500012 1 NNN00000000000000000000000000000000000000.00 000002059 NNN +00104K KR700104K010CJ4(ȯ) ST0002100000000 N 0NNN NN N 0 N 0001667000000100001NNN00NNN000000050Y0900000000202570000000050002019080900000000000422600000000002113256000012 2 NNN00000000000000000000000000000000000000.00 000007045 NNN +001060 KR7001060003JW߿ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000303000000100001NNN00NNN000000050Y0900000001861600000000025001976061400000000002328500000000005821482500012 0 NNY00000576400000079000000071300462000019.0920250930000007055 NNY +001065 KR7001061001JW߿ ST0002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000285000000100001NNN00NNN000000100N0900000000004780000000025001994102100000000000034100000000000085487750012 1 NNN00000000000000000000000000000000000000.00 000000097 NNN +001067 KR7001062009JW߿2B ST0002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000596000000100001NNN00NNN000000100N0900000000000060000000025001998041300000000000020900000000000052493250012 2 NNN00000000000000000000000000000000000000.00 000000125 NNN +001070 KR7001070002ѹ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000064000000100001NNN00NNN000000100N0900000000182420000000010001973122800000000000530000000000000530000000012 0 NNY000001179-00000004-00000010-0009-00000.5120250930000000339 NNN +001080 KR7001080001ȣ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000530000000100001NNN00NNN000000100N0900000000035810000000010001977061800000000000415000000000000415000000006 0 NNY000001530-00000120-00000044-0035-00001.9220250630000002199 NNN +0010E0 KR70010E0006ACE FTSE WGBI Korea EF 000000000000NN 0NNN2NN N 0 Y 0000942250000100001NNN00NNN000000100N0900000000001460000000000002025021800000000000004800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000045 NNN +001120 KR7001120005LXͳų ST2001600000000 NN0NNY NNNNNNNNN0NNNNNNNN0000367000000100001NNN00NNN000000050Y0900000001426520000000050001976013000000000003876000000000019380000000012 0 NYY00012386200000236700000242402139000004.3420250930000014224LD1NNN +001130 KR7001130004 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0001430000000100001NNN00NNN000000050Y0900000000063200000000050001970112500000000000169000000000000845000000012 0 NNY00001024700000047300000068900576000005.7320250930000002416 NNN +001140 KR7001140003 ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000000000000100001NYY00NNN000000100N0900000000000000000000005001989120200000000001585600000000000792819400012 0 NNY000000034-00000043-00000142-0142-3610000020250930000000000 NNN +001200 KR7001200005 ST3002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000038600000100001NNN00NNN000000060Y0900000018952060000000050001987082400000000009686600000000053759209000012 0 NNY00001121400000072800000073500578000005.9020250930000003739653NNN +001210 KR7001210004ȣ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000010600000100001NNN02NNN000000100N0900000051979150000000005001973111500000000006155300000000003077699850012 0 NNY000000328-00000013-00000018-0017-00043.4920250930000000652 NNN +001230 KR7001230002Ȧ ST3002100000000 NN0NNY NNNNNNNNY0NNNNNNNN0000073000000100001NNN00NNN000000060Y0900000001269130000000050001988050900000000003180000000000027106676500012 0 NNY00001443200000037800000022800172-00000.9520250930000002321364NNN +001250 KR7001250000GS۷ι ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000023250000100001NNN00NNN000000060Y0900000004982700000000025001976062600000000008253300000000020633441000012 0 NNY00003041500000042200000028900197000005.5520250930000001918FN4NNN +001260 KR7001260009 ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000082300000100001NNN00NNN000000100N0900000000321630000000050001976122800000000000983200000000004916286000012 0 NNY00000267400000005400000005100049000003.8520250930000000809 NNN +001270 KR7001270008α ST3002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000680000000100001NNN00NNN000000100N0900000000290970000000050001988071900000000001036900000000005184943000012 0 NNY00000664500000056700000059300466000005.6820250930000007051 NNN +001275 KR7001271006αǿ ST0002100240000 YN0NNN NNNNNNNNN0NNNNNNNN0000281500000100001NNN00NNN000000100N0900000000076090000000050001989111000000000000300000000000001500000000012 1 NNN00000000000000000000000000000000000000.00 000000844 NNN +001290 KR7001290006 ST3002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000006570000100001NNN00NNN000000100N0900000004288040000000010001988092300000000010833700000000010964059600012 0 NNY000001365-00000072-00000053-0042-00009.9720250930000000711 NNN +001340 KR7001340009PKC ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000059800000100001NNN00NNN000000060Y0900000003250420000000005001976061000000000004491800000000002245920350012 0 NNY00000200600000008700000006600055000002.8320250930000002686 NNY +001360 KR7001360007Z ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000016760000100001NNN00NNN000000100N0900000025881940000000005001975070400000000009416200000000004708103950012 0 NNY000000443-00000148-00000141-0141-00015.3620241231000001578 NNN +001380 KR7001380005SG۷ι ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000015780000100001NNN00NNN000000100N0900000001801480000000005001976062900000000004496400000000002248207150012 0 NNY00000066500000004000000003400025000003.3320250930000000709 NNN +001390 KR7001390004KGɹĮ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000058600000100001NNN00NNN000000100N0900000019542710000000010001989082500000000006723300000000007112835000012 0 NNY00006765500000275600000237501844000008.0420250930000003939LC4NNN +0013P0 KR70013P0000RISE ̱TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000117400000100001NNN00NNN030000100N0900000000303640000000000002025021800000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +0013R0 KR70013R0008RISE ׽̱äŸĿȥ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000094700000100001NNN00NNN030000100N0900000001586470000000000002025021800000000000380000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000364 NNN +001420 KR7001420009¿ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000032750000100001NNN00NNN000000100N0900000000082330000000005001975062400000000000760000000000000380000000012 0 NNY000000116-0000000900000001200175000047.0620241231000000248 NNN +001430 KR7001430008ƺƿ ST2002700110000 NN3NNY NNNNNNNNY0NNNNNNNN0000683000000100001NNN00NNN000000050Y0900000002727960000000050001991031200000000003586200000000021931059500012 0 NYY00002790300000089600000079500581000000.2120250930000024493474NNY +001440 KR7001440007 ST2002700130000 NN9NNY NNNNNNNNN0NNNNYNNN0000270000000100001NNN00NNN000000050Y0900000024343160000000010001968122700000000018644700000000018644730000012 0 NYY00002626800000085200000055000474000002.9720250930000050340LB7NNY +001450 KR7001450006ػ ST2002100250000 NY6NNY NNNNNNNNN0NNNNNYNY0000276500000100001NNN00NNN000000050Y0900000005188810000000005001989082500000000008940000000000004470000000012 0 NYY00013803900001388900001369411343000020.1920250930000024719117NNY +001460 KR7001460005BYC ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000413500000100001NNN00NNN000000050Y0900000000035460000000005001975060200000000000624600000000000312307500012 0 NNY00000113900000015200000015000111000003.5220250930000002582 NNN +001465 KR7001461003BYC ST0002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000234500000100001NNN00NNN000000100N0900000000092460000000005001989090500000000000215300000000000107692500012 1 NNN00000000000000000000000000000000000000.00 000000505 NNN +001470 KR7001470004 ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000003470000100001YNY00NNN000000100N0900000000000000000000010001976062600000000022968100000000022968182400012 0 NNY000000857-00000448-00000607-0607-3610000020250930000000796 NNN +001500 KR7001500008 ST3002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000090100000100001NNN00NNN000000060Y0900000003283570000000050001990060900000000006183300000000030916522000012 0 NNY00001363600000068200000068000522000003.8420250930000005571BH1NNN +001510 KR7001510007SK ST3002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000006880000100001NNN00NNN000000100N0900000095236200000000005001986092000000000047259000000000023629508550012 0 NNY00000898000000013500000044100344000000.6220250930000003251 NNN +001515 KR7001511005SKǿ ST0002100240000 NN0NNN NNNNNNNNN3NNNNNNNN0000023550000100001NNN00NNN000000100N0900000000435300000000005001989082900000000000391200000000000195625700012 1 NNN00000000000000000000000000000000000000.00 000000092 NNN +001520 KR7001520006 ST3002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000008380000100001NNN00NNN000000060Y0900000021918640000000005001976062500000000023868400000000011934203150012 0 NNY000004805-00000154-00000091-0107-00010.6420250930000002000653NNY +001525 KR7001521004 ST0002700100000 YN0NNN NNNNNNNNN3NNNNNNNN0000049050000100001NNN00NNN000000100N0900000000059010000000005001989093000000000000061700000000000030886550012 1 NNN00000000000000000000000000000000000000.00 000000030 NNN +001527 KR70015220022B ST0002700100000 YN0NNN NNNNNNNNN0NNNNNNNN0000089200000100001NNN00NNN000000100N0900000000022940000000005001999012800000000000030800000000000015428450012 2 NNN00000000000000000000000000000000000000.00 000000027 NNN +001530 KR7001530005DI ST2001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000202500000100001NNN00NNN000000060Y0900000000343080000000005001964010400000000001972900000000001374736800012 0 NNY000004636000000016-00000058-0070-00002.1420250930000003995 NNN +001550 KR7001550003 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000112100000100001NNN00NNN000000100N0900000000158490000000050001976122800000000000519200000000002596119500012 0 NNY00000102400000004800000000400006000001.2220241231000000582 NNN +001560 KR7001560002Ͽ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000093600000100001NNN00NNN000000100N0900000000086940000000005002005120900000000000980000000000000500000000012 0 NNY00000059000000003300000015700127000013.5520250930000000917 NNN +001570 KR7001570001ݾ ST2002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000099000000100001YNY00NNN000000100N0900000000000000000000005001976121700000000006396700000000003198359800012 0 NNY000000811-00000390-00000506-0558-00027.8720250930000006332 NNN +0015B0 KR70015B0004KoAct ̱ڼƼ EF 000000000000NN 0NNN2NN N 0 Y 0000159900000100001NNN00NNN000000060Y0900000005389000000000000002025022500000000000745000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001191 NNN +0015E0 KR70015E0001KIWOOM ƹ̱30ⱹäȥվƼ(H)EF 000000000000NN 0NNN2NN N 0 Y 0000106600000100001NNN00NNN030000100N0900000000219210000000000002025021100000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000064 NNN +0015F0 KR70015F0000KIWOOM ȶƼ̱30ⱹäȥվƼ(H)EF 000000000000NN 0NNN2NN N 0 Y 0000106600000100001NNN00NNN030000100N0900000000384520000000000002025021100000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000213 NNN +0015K0 KR70015K0003TIGER ̱ҺƮƼ EF 000000000000NN 0NNN2NN N 0 Y 0000081500000100001NNN00NNN000000100N0900000000157890000000000002025021800000000000063000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000051 NNN +001620 KR7001620004̵̺Ǿ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000005500000100001NNN00NNN000000100N0900000007254130000000005001990091500000000011129300000000005564651550012 0 NNY00000592800000004300000009800046000012.3120250930000000612 NNN +001630 KR7001630003ٴȦ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000498500000100001NNN00NNN000000050Y0900000000139680000000025001976063000000000000500900000000001252465250012 0 NNY00000723000000046500000052100392000005.7920250930000002497 NNN +001680 KR7001680008 ST2002700050000 NN7NNY NNNNNNNNN0NNNNNNNN0000219000000100001NNN00NNN000000050Y0900000001232800000000010001970040100000000003464800000000003464802500012 0 NYY00003351900000149000000096900690000005.9220250930000007587 NNY +001685 KR7001681006 ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000171400000100001NNN00NNN000000100N0900000000053820000000010001989112100000000000137000000000000137022300012 1 NNN00000000000000000000000000000000000000.00 000000234 NNN +0016X0 KR70016X0007SOL ߴܱȸä(A-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000508100000100001NNN00NNN000000100N0900000000133160000000000002025021800000000000740600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003762 NNN +001720 KR7001720002ſ ST2002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0001668000000100001NNN00NNN000000100N0900000000329220000000050001987082400000000001644000000000008220000000003 0 NYY00001360100000111800000118300912000007.1420250930000027421 NNN +001740 KR7001740000SKƮ ST2001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000047850000100001NNN00NNN000000050Y0900000007706680000000025001977063000000000022127700000000062046911750012 0 NNY00005125600000081900000050900399-00000.4120250930000010588535NNN +001750 KR7001750009Ѿ ST3002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000200000000100001NNN00NNN000000060Y0900000000342720000000050001988030400000000001272800000000006364267000012 0 NNY00000200300000029400000028700211000000.0020250331000002545 NNN +001755 KR7001751007Ѿǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000188300000100001NNN00NNN000000100N0900000000011370000000050001989102400000000000052500000000000262500000012 1 NNN00000000000000000000000000000000000000.00 000000098 NNN +001770 KR7001770007SHD ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000176500000100001NNN00NNN000000100N0900000000025550000000050001988112300000000000121400000000000607439000012 0 NNY000001066-0000004000000001200029000005.5820241231000000214 NNN +001780 KR7001780006˷ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000022250000100001NNN00NNN000000060Y0900000014410070000000005002007060700000000009683000000000004841506600012 0 NNY00000457700000030100000012200099000003.8720250930000002154 NNY +001790 KR7001790005 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000027850000100001NNN00NNN000000050Y0900000005325280000000005001968122700000000008969600000000004484829000012 0 NNY00001027300000041600000075400583000009.9020250930000002498 NNY +001795 KR7001791003 ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000024650000100001NNN00NNN000000100N0900000000763730000000005001995012100000000000648200000000000324138000012 1 NNN00000000000000000000000000000000000000.00 000000159 NNN +0017Y0 KR70017Y00051Q ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000974550000100001NNN00NNN000000100N0900000000003100000000000002025022500000000000072800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000709 NNN +001800 KR7001800002Ȧ ST2002100000000 NN7NNY NNNNNNNNN0NNNNNNNN0000209000000100001NNN00NNN000000050Y0900000001291200000000005001975062700000000006264500000000003132271100012 0 NYY00002454100000338500000336402442000006.9920250930000013092 NNY +001820 KR7001820000ȭܵ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000315000000100001NNN00NNN000000050Y0900000000870050000000010001976062600000000001039500000000001039500000012 0 NNY00000223700000013000000013000110000005.7220250930000003274 NNY +0018C0 KR70018C0000PLUS ŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000124750000100001NNN00NNN000000100N0900000001439620000000000002025030500000000000545000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000679 NNN +0018Z0 KR70018Z0003RISE ̱ǻ EF 000000000000NN 0NNN2NN N 0 Y 0000164050000100001NNN00NNN000000100N0900000000230210000000000002025031100000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000155 NNN +001940 KR7001940006KISCOȦ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000261500000100001NNN00NNN000000060Y0900000000192580000000010001989111300000000001417600000000001847638000012 0 NNY000006060-00000418-00000212-0161-00000.2720250930000003707 NNN +0019K0 KR70019K0009TIME ̱100äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000118200000100001NNN00NNN000000100N0900000002633800000000000002025032500000000001265000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001495 NNN +002020 KR7002020006ڿ ST2002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000544000000100001NNN00NNN000000050Y0900000000666020000000050001975062300000000001290700000000006453840000012 0 NNY000043537000001493-00000788-0972-00007.4820250930000007021KOLNNY +002025 KR7002021004ڿտ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000263000000100001NNN00NNN000000100N0900000000087890000000050001989082200000000000116000000000000580218500012 1 NNN00000000000000000000000000000000000000.00 000000305 NNN +002030 KR7002030005Ƽ ST2002600000000 NN3NNN NNNNNNNNN0NNNNNNNN0002915000000100001NNN00NNN000000050Y0900000000042470000000050001974060300000000000207200000000001095512000012 0 NNY00001395300000103300000084900644000003.6920250930000006041 NNN +002070 KR7002070001 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000005620000100001NNN00NNN000000100N0900000002582570000000005001976071300000000004519600000000002259803850012 0 NNY000001937000000019-00000023-0001-00009.5720250930000000254 NNN +0020H0 KR70020H0001KoAct ۷ιǻþƼ EF 000000000000NN 0NNN2NN N 0 Y 0000206300000100001NNN00NNN000000100N0900000000491080000000000002025031100000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000464 NNN +002100 KR7002100006 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000090700000100001NNN00NNN000000060Y0900000000297740000000005001977063000000000001952200000000001084587500012 0 NNY00000296500000043700000043800333000006.3820250930000001770 NNN +002140 KR7002140002 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000024100000100001NNN00NNN000000100N0900000001459950000000010001991011400000000002493900000000002493942500012 0 NNY00000224100000011100000010600083000008.1320250930000000601 NNN +002150 KR7002150001ȭϾ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000061600000100001NNN00NNN000000060Y0900000000282240000000005002010081200000000003372000000000001686000000012 0 NNY00000505100000016000000008900055-00001.2220250930000002077 NNN +002170 KR7002170009 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000587000000100001NNN00NNN000000100N0900000000071300000000050001989111000000000000300000000000001500000000012 0 NNY00000134600000014000000020900159000003.0120250930000001761FN4NNN +0021C0 KR70021C0005ACE ڻоƼ EF 000000000000NN 0NNN2NN N 0 Y 0000130650000100001NNN00NNN000000100N0900000000048160000000000002025031100000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000130 NNN +0021D0 KR70021D0004ACE TDF2030Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000112400000100001NNN00NNN000000100N0900000000234990000000000002025031100000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +0021E0 KR70021E0003ACE TDF2050Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000122800000100001NNN00NNN000000100N0900000001755570000000000002025031100000000000395000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000485 NNN +002200 KR7002200004ѱ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000032250000100001NNN00NNN000000060Y0900000002634820000000005001974062800000000004000000000000002000000000012 0 NNY000002220-0000001400000001300008-00000.7620250930000001290 NNN +002210 KR7002210003 ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000009730000100001YNY00NNN000000100N0900000000000000000000010001990011900000000002661900000000002661950700012 0 NNY000000884-00000066-00000077-0073-00015.2720241231000000259 NNN +002220 KR7002220002ö ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000049100000100001NNN00NNN000000060Y0900000001478330000000005001988100700000000002669700000000001334873000012 0 NNY00000150700000003200000001200008000000.1220250930000001310 NNN +002240 KR7002240000 ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000214500000100001NNN00NNN000000050Y0900000000340970000000010001976052500000000002700000000000002700000000012 0 NNY00001359700000039900000044000326000002.9620250930000005791 NNN +0022T0 KR70022T0005SOL ĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000165050000100001NNN00NNN030000100N0900000001523560000000000002025031100000000000490000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000811 NNN +002310 KR7002310001Ƽ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000076100000100001NNN00NNN000000050Y0900000002102300000000010001988121500000000004048200000000004478251000012 0 NNY00000641700000028000000034800262000002.4320250930000003080 NNN +002320 KR7002320000 ST3001900000000 NN0NNY NNNNNNNNN0NNNNNNYN0000193400000100001NNN00NNN000000050Y0900000000908690000000050001974081200000000001523500000000007617505000012 0 NNY00002269200000095100000014500095-00000.8420250930000002946926NNN +002350 KR7002350007ؼŸ̾ ST2002700080000 NN0NNY NNYNNNNNN0NNNNNNNN0000079300000100001NNN00NNN000000050Y0900000001451460000000005001976051900000000009766700000000005083393850012 0 NNY00002356600000129800000145901140000008.5720250930000007745 NNN +002355 KR7002351005ؼŸ̾1B ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000037250000100001NNN00NNN000000100N0900000000086030000000005001999060800000000000650000000000000325000000012 2 NNN00000000000000000000000000000000000000.00 000000242 NNN +002360 KR7002360006SHȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000003670000100001NNN00NNN000000100N0900000002598990000000005001985122300000000011113300000000005556686500012 0 NNY000000735-00000090-00000089-0072-00015.6720250930000000407 NNN +002380 KR7002380004KCC ST2002700080000 NN1NNY NNNNNNNNN0NYNNNNNN0004660000000100001NNN00NNN000000050Y0900000000269580000000050001973062500000000000888600000000004808466000012 0 NYY00004927400000361100001821612637000018.7820250930000041410KCCNNN +002390 KR7002390003ѵ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000113900000100001NNN00NNN000000060Y0900000000228250000000005001976063000000000001376300000000000688176650012 0 NNY000003951-00000013-00000118-0102-00014.8920250930000001567 NNN +0023A0 KR70023A0005SOL ̱ǻTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000262100000100001NNN00NNN000000050Y0900000006989150000000000002025031100000000001905000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004993 NNN +0023B0 KR70023B0004PLUS ̱ǻTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000170400000100001NNN00NNN000000100N0900000000740820000000000002025031100000000000175000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000298 NNN +002410 KR7002410009ǿ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000019350000100001YNY00NNN000000100N0900000000000000000000010001988052500000000002747900000000002747982000012 0 NNY000000657-00000269-00000359-0349-3610000020250930000000531 NNN +002420 KR7002420008 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000049150000100001NNN00NNN000000100N0900000000223340000000005001968122700000000000596900000000000298497400012 0 NNY000000320-00000020-00000027-0028-00010.9920241231000000293 NNN +002450 KR7002450005;DZ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000011570000100001NNN00NNN000000100N0900000000680660000000005001988093000000000009053000000000004526545750012 0 NNY00000169700000003800000023000210000007.7220250930000001047 NNN +002460 KR7002460004HSȭ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000124700000100001NNN00NNN000000060Y0900000000209890000000050001988092900000000001015000000000006225400000012 0 NNY00000562800000046700000046900328000008.4420250930000001265 NNN +0025N0 KR70025N0008TIGER TDF2045 EF 000000000000NN 0NNN2NN N 0 Y 0000114700000100001NNN00NNN000000100N0900000010138060000000000002025032500000000004985000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005717 NNN +002600 KR7002600005 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0001607000000100001NNN00NNN000000100N0900000000000140000000050001976122300000000000060000000000000300000000012 0 NNY00000360400000014000000006000068-00002.0120250930000000964 NNN +002620 KR7002620003ĸȦ ST3002600000000 NN0NNY NNNNYNNNN0NNNNNNNN0000080100000100001NNN00NNN000000100N0900000000070100000000005001988012000000000001597300000000000798667750012 0 NNY00000503200000032100000027700217-00009.1720250930000001279 NNN +002630 KR7002630002Ʈ̿ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000005710000100001NNN00NNN000000100N0900000007798440000000005001976122800000000011858300000000005929150250003 0 NNY000000294-00000031-00000132-0132-00016.8120250331000000677 NNN +002690 KR7002690006 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000016090000100001NNN00NNN000000100N0900000000307590000000005002015092400000000002030000000000001015018000012 0 NNY000001511-00000058-00000007-0005-00000.3220241231000000326 NNN +0026E0 KR70026E0008KODEX ̱S&P5003Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000108350000100001NNN00NNN000000100N0900000000018610000000000002025032500000000000675000000000000000000000003 0 NNN00000000000000000000000000000000000000.00 000000731 NNN +0026S0 KR70026S00021Q ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000121050000100001NNN00NNN000000100N0900000003919040000000000002025031800000000002050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002481 NNN +002700 KR7002700003 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000013200000100001NNN00NNN000000100N0900000005124890000000005001975093000000000007104700000000003552376050012 0 NNY00000178300000004000000001900014000001.7620241231000000937 NNN +002710 KR7002710002TCCƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000168800000100001NNN00NNN000000060Y0900000004801500000000010001984122100000000002621300000000002621369700012 0 NNY000004597-00000070-00000023-0018000003.1220250930000004424 NNY +002720 KR7002720001ǰ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000046000000100001NNN00NNN000000100N0900000002231160000000010001975122700000000002115900000000002115983200012 0 NNY00000132200000007700000008000064000007.7120250930000000973 NNN +002760 KR7002760007 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000012840000100001NNN00NNN000000100N0900000348649360000000002001989113000000000005990000000000001198000000012 0 NNY000000476-00000018-00000016-0015-00003.1620241231000000769 NNN +002780 KR7002780005 ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000006830000100001NNN00NNN000000060Y0900000008996030000000005001977062500000000014547100000000007273587250012 0 NNY000007262-0000004700000000600022000000.8120241231000000993971NNN +002785 KR7002781003B ST0001800000000 YN0NNN NNNNNNNNN3NNNNNNNN0000034500000100001NNN00NNN000000100N0900000000079430000000005002003061600000000000085700000000000042860900012 2 NNN00000000000000000000000000000000000000.00 000000029 NNN +002787 KR70027820012B ST0001800000000 YN0NNN NNNNNNNNN0NNNNNNNN0000085300000100001NNN00NNN000000100N0900000000003770000000005002006120500000000000029400000000000014740400012 2 NNN00000000000000000000000000000000000000.00 000000025 NNN +002790 KR7002790004Ƹ۽Ȧ ST2002700080000 NN7NNY NNNNNNNNN0NNNNNNNN0000286500000100001NNN00NNN000000050Y0900000002200510000000005001973043000000000007945800000000004122909000012 0 NYY00003368000000313200000341802741000003.3720250930000022764842NNY +002795 KR7002791002Ƹ۽Ȧ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000121200000100001NNN00NNN000000100N0900000000243590000000005001989063000000000000644300000000000322188500012 1 NNN00000000000000000000000000000000000000.00 000000780 NNN +00279K KR700279K010Ƹ۽Ȧ3C ST0002700080000 N 0NNN NN N 0 N 0000226000000100001NNN00NNN000000060Y0900000000066960000000005002019122600000000000709200000000000354610000012 2 NNN00000000000000000000000000000000000000.00 000001602 NNN +002810 KR7002810000￵ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000170800000100001NNN00NNN000000050Y0900000000159750000000005001988032800000000001846600000000000923347400012 0 NNY00000346300000013800000057000507000010.3920250930000003154 NNN +002820 KR7002820009SUN&L ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000023700000100001NNN00NNN000000100N0900000000770100000000010001976052200000000001260700000000001260798900012 0 NNY000002146-00000118000000011-0008-00001.7120250930000000298 NNN +002840 KR7002840007̿ ST2002700080000 NN4NNN NNNNNNNNN0NNNNNNNN0001396000000100001NNN00NNN000000050Y0900000000036870000000005001989092500000000000475000000000000666178000012 0 NNY00000332500000034600000038800308000011.0720250930000006631 NNN +002870 KR7002870004dz ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000010550000100001NNN00NNN000000100N0900000003086940000000005001976063000000000003495800000000001747935000012 0 NNY000000185-0000001700000002000020000000.1320250930000000368 NNN +002880 KR7002880003 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000010630000100001NNN00NNN000000100N0900000000912410000000005001977021800000000004677300000000002338699750012 0 NNY00000459600000027100000013300090-00003.7620250930000000497 NNN +0028X0 KR70028X0003KODEX ̱ũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000119850000100001NNN00NNN030000100N0900000000311680000000000002025052700000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000192 NNN +002900 KR7002900009TYM ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000069100000100001NNN00NNN000000050Y0900000004534310000000025001973062600000000004140000000000011262739000012 0 NNY00000712500000055300000048000341000010.0220250930000002860 NNY +002920 KR7002920007 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000020950000100001NNN00NNN000000100N0900000000475810000000005001988101000000000002594700000000001297375000012 0 NNY000002354-0000005600000010100084000000.8620250930000000543 NNN +002960 KR7002960003ѱ ST2002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0004375000000100001NNN00NNN000000050Y0900000000026750000000050001988081000000000000130000000000000700000000012 0 NNY00000327200000046000000050800367000028.9320241231000005687 NNN +002990 KR7002990000ȣǼ ST3001800000000 NN0NNY NNNNNNNNN0NYNNNNNN0000042200000100001NNN00NNN000000100N0900000001693880000000050001976062600000000003699600000000018498380000012 0 NNY00001522600000037300000024800189000009.9720250930000001561 NNN +002995 KR7002991008ȣǼ ST0001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000166500000100001NNN00NNN000000100N0900000000061020000000050001988100600000000000029200000000000146133000012 1 NNN00000000000000000000000000000000000000.00 000000048 NNN +003000 KR7003000007αǰ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000040000000100001NNN00NNN000000100N0900000006547770000000005001988080500000000009866400000000005150699300012 0 NNY00000138200000006000000003400078000003.4520250930000003946378NNN +003010 KR7003010006 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000052800000100001NNN00NNN000000100N0900000000959910000000005001988092000000000001271200000000000635637350012 0 NNY00000248800000014200000009700073000006.1920241231000000671 NNN +003030 KR7003030004 ST2002100000000 NN3NNY NNNNNNNNY0NNNNNNNN0001353000000100001NNN00NNN000000050Y0900000000238040000000050001969051300000000000414100000000002070828500012 0 NYY00002891000000189800000177201214000002.7520250930000005603474NNN +003060 KR7003060001̿ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000005260000100001NNN00NNN000000100N0900000008742640000000005001984101900000000019840700000000009920392250012 0 NNY000000529-00000444-00001344-1345-00057.2020250930000001043 NNN +003070 KR7003070000ڿձ۷ι ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000089100000100001NNN00NNN000000100N0900000000362640000000050001978091500000000002542300000000012711979500012 0 NNY000019858000000564-00000535-0443000015.1320250930000002265KOLNNN +003075 KR7003071008ڿձ۷ι ST0001800000000 NN0NNN NNNNNNNNN3NNNNNNNN0000142500000100001NNN00NNN000000100N0900000000041230000000050001989121100000000000074000000000000370368500012 1 NNN00000000000000000000000000000000000000.00 000000105 NNN +003080 KR7003080009SB ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000027500000100001NNN00NNN000000100N0900000000460170000000005001976122300000000002002000000000001001000000012 0 NNY000000626-0000000700000060600460000027.3220250930000000550 NNN +003090 KR7003090008 ST2002700090000 NNANNY NNNNYNNNN0NNNNNNNN0000235000000100001NNN00NNN000000050Y0900000000889270000000005001973062600000000005814100000000002907099000012 0 NYY00001552000000227000000193901585000007.3320250930000013663 NNY +0030R0 KR70030R0007Ź RT0002100000000 N 0NNN NN N 0 Y 0000044950000100001NNN00NNN000000060Y09000000006321700000000050020250710000000000059780000000000029890000000 0 NNY00000000000000000000000000000000000000.00 000002687 NNN +003120 KR7003120003ϼ̿ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000214500000100001NNN00NNN000000100N0900000000069790000000010001985011400000000001330000000000001330000000012 0 NNY000000690-0000009500000011200131000003.4120241231000002852 NNN +003160 KR7003160009 ST3002700140000 NN0NNN NNNNNNNNN0NNNNNNNN0000348500000100001NNN00NNN000000050Y0900000009124350000000005001996073100000000002830000000000001724839250012 0 NNY00000338400000032200000029900238000014.3020250930000009862 NNY +003200 KR7003200003ϽŹ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000128600000100001NNN00NNN000000050Y0900000001625870000000005001973052300000000002296000000000001200000000012 0 NNY00000382600000005500000026100215000002.8020250930000002952 NNN +003220 KR7003220001 ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000116100000100001NNN00NNN000000060Y0900000000797050000000005001999121500000000002242700000000001121379150012 0 NNY000004456-00000024-00000092-0166-00005.9920250930000002603 NNN +003230 KR7003230000ǰ ST1002700050000 NN7YNY YYNNNNNNN0NNNNNNNN0011990000000100001NNN00NNN000000050Y0900000000535020000000050001975063000000000000753300000000003766507500012 0 NYY00001714100000385000000377802931000040.5720250930000090320 NNY +003240 KR7003240009± ST2002700080000 NN4NNY NNNNNNNNN0NNNNNNNN0008090000000100001NNN00NNN000000100N0900000000020960000000050001975122700000000000111300000000000556700000012 0 NYY000014173-0000058100000056900477000004.1420250930000009007841NNN +003280 KR7003280005ؿ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000016710000100001NNN00NNN000000060Y0900000099846800000000005001976062900000000024042400000000012021244950012 0 NNY00000135800000011700000010000097000013.1320250930000004017LA2NNY +003300 KR7003300001Ȧ ST2002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000155500000100001NNN00NNN000000050Y0900000000236630000000010001969112000000000003083200000000003335955400012 0 NNY00001458700000109100000097100703000002.7420250930000004794 NNN +003350 KR7003350006ѱȭǰ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000498000000100001NNN00NNN000000100N0900000000476180000000005001978020600000000000453200000000000226600000012 0 NNY00000167500000026500000027800231000036.4820241231000002256 NNN +003460 KR7003460003ȭ ST3002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000028150000100001NNN00NNN000000100N0900000001042210000000010001987082400000000005670200000000005670241500012 0 NNY00000037700000012200000021800178000003.5020241231000001596 NNN +003465 KR7003461001ȭǿ ST0002100240000 YN0NNN NNNNNNNNN0NNNNNNNN0000026550000100001NNN00NNN000000100N0900000000339440000000010001990022000000000001747600000000001747642500012 1 NNN00000000000000000000000000000000000000.00 000000463 NNN +003470 KR7003470002Ÿ ST2002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000041300000100001NNN00NNN000000050Y0900000007789200000000050001988012100000000019959600000000099798288000012 0 NNY00002238200000078900000081800624000004.5020250930000008243 NNN +003475 KR7003471000Ÿǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000041100000100001NNN00NNN000000100N0900000000570500000000050001989032200000000001291200000000006456106000012 1 NNN00000000000000000000000000000000000000.00 000000530 NNN +003480 KR7003480001߰Ȧ ST3001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000048400000100001NNN00NNN000000060Y0900000000670590000000050001956030300000000002952900000000015514906000012 0 NNY00000855400000049700000041500334000017.2620250930000001429 NNN +003490 KR7003490000װ ST1001900000000 NN9YNY NYNNNNNNN0NNNNNNYN0000238000000100001NNN00NNN000000050Y0900000022664670000000050001966031800000000036822000000000184110330500012 0 NYY00018729500000958700000897106290000008.9920250930000087636926NNY +003495 KR7003491008װ ST0001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000235000000100001NNN00NNN000000100N0900000000077210000000050001990033100000000000111000000000000555397000012 1 NNN00000000000000000000000000000000000000.00 000000261 NNN +003520 KR7003520004ǰ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000019080000100001NNN00NNN000000100N0900000007331980000000005001973062500000000018289200000000009144636550012 0 NNY00000252000000008700000002900012000001.3720241231000003489KTGNNN +003530 KR7003530003ȭ ST2002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000060900000100001NNN00NNN000000060Y0900000088829500000000050001986112500000000021454700000000107273887500012 0 NYY00002196000000122500000115200879000003.7320250930000013065913NNN +003535 KR7003531001ȭǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000089500000100001NNN00NNN000000100N0900000002286000000000050001989050600000000000480000000000002400000000012 1 NNN00000000000000000000000000000000000000.00 000000429 NNN +003540 KR7003540002 ST2002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000293000000100001NNN00NNN000000050Y0900000003119520000000050001975100100000000005077300000000025486700000012 0 NYY00003272700000248200000298201922000006.6520250930000014876137NNY +003545 KR7003541000ǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000222000000100001NNN00NNN000000050Y0900000001072860000000050001988090100000000002600000000000013000000000012 1 NNN00000000000000000000000000000000000000.00 000005772 NNN +003547 KR70035420082B ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000212500000100001NNN00NNN000000050Y0900000000314550000000050002007110900000000001000000000000005000000000012 2 NNN00000000000000000000000000000000000000.00 000002125 NNN +003550 KR7003550001LG ST1002100000000 NY5YYY NYNNNNNNN0NNNNNNNY0000914000000100001NNN00NNN000000050Y0900000002928230000000050001970021300000000015422100000000078625582500012 0 NYY00005730000001333900001372912261000002.6120250930000140958282NNY +003555 KR7003551009LG ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000715000000100001NNN00NNN000000050Y0900000000086270000000050001988111800000000000301100000000001505599500012 1 NNN00000000000000000000000000000000000000.00 000002153 NNN +003570 KR7003570009SNT̳ͽ ST2002700150000 NN0NNY NNNNNNNNN0NNNNNNNN0000529000000100001NNN00NNN000000050Y0900000000973710000000025001976070800000000003325200000000008563174250012 0 NYY00000488400000067200000078300629000009.9820250930000017590 NNY +003580 KR7003580008HLB۷ι ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000025400000100001NNN00NNN000000100N0900000006429330000000005001990032300000000005066300000000002533175250012 0 NNY000000785-00000054-00000074-0103-00017.9120250930000001286 NNN +0035T0 KR70035T0000PLUS ۷ι޸ӳ̵κƼ EF 000000000000NN 0NNN2NN N 0 Y 0000205450000100001NNN00NNN000000100N0900000001783340000000000002025041500000000000460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000945 NNN +003610 KR7003610003渲 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000054900000100001NNN00NNN000000100N0900000000772560000000005001989053000000000004020200000000002115704500009 0 NNY00000122500000001100000009300065000000.0020250930000002207 NNN +003620 KR7003620002KGƼ ST2002700150000 NN0NNY NNYNNNNNN0NNNNNNNN0000039800000100001NNN00NNN000000060Y0900000400623560000000010001975052900000000020237400000000020237491200012 0 NNY00003120200000015100000004300035000000.2220250930000008054LC4NNY +003650 KR7003650009â ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0001211000000100001NNN00NNN000000100N0900000000012920000000050001989092700000000000173900000000000869836000012 0 NNY00000431900000045600000067500526000013.5420241231000002106 NNN +003670 KR7003670007ǻó ST1002700130000 NN9YYY YYNNNNNNN0NYNNNNNY0002395000000100001NNN00NNN000000050Y0900000009689940000000005002019052900000000008894600000000004447311000012 0 NYY00002381100000072400000074200598-00006.6020250930000213026853NNY +003680 KR7003680006Ѽ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000052600000100001NNN00NNN000000100N0900000000479550000000050001989012600000000000620900000000003104757500012 0 NNY00000332500000011000000003300028000004.2520241231000000326 NNN +003690 KR7003690005ڸȸ ST2002100250000 NN0NNY NNNNNNNNN0NNNNNYNN0000112200000100001NNN00NNN000000050Y0900000005824160000000005001969122200000000019482100000000009741051550012 0 NYY00005050900000415300000410402825000009.7720250930000021858 NNN +0036D0 KR70036D0007TIME ̱ٿƼ EF 000000000000NN 0NNN2NN N 0 Y 0000105250000100001NNN00NNN000000100N0900000000401560000000000002025042900000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +0036R0 KR70036R0001RISE ̱޸ӳ̵κ EF 000000000000NN 0NNN2NN N 0 Y 0000168150000100001NNN00NNN000000100N0900000001538830000000000002025041500000000000695000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001168 NNN +0036Z0 KR70036Z0001RISE ̱õü EF 000000000000NN 0NNN2NN N 0 Y 0000112000000100001NNN00NNN000000100N0900000000040590000000000002025042200000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +003720 KR7003720000￵ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000056100000100001NNN00NNN000000060Y0900000008869180000000005001976063000000000003400000000000001700000000012 0 NNY00000110600000010200000009800092000013.1620250930000001907 NNY +003780 KR7003780004 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000063200000100001NNN00NNN000000100N0900000001370360000000005001973062600000000001300000000000000650000000012 0 NNY00000070400000007400000007300059000011.5220250930000000821 NNN +003830 KR7003830007ȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0001128000000100001NNN00NNN000000100N0900000000007700000000050001985122300000000000132800000000000664000000012 0 NNY000001238-00000015-00000064-0025-00000.3520241231000001497841NNN +003850 KR7003850005 ST2002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000091600000100001NNN00NNN000000050Y0900000002431930000000005001988102400000000008578700000000004339360350012 0 NNY00000772100000065700000051200432000007.9720250930000007858 NNY +0038A0 KR70038A0008KODEX ̱޸ӳ̵κ EF 000000000000NN 0NNN2NN N 0 Y 0000160200000100001NNN00NNN030000100N0900000007250060000000000002025041500000000002160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003463 NNN +003920 KR7003920006 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000481000000100001NNN00NNN000000100N0900000000161750000000005001978062400000000000600000000000000360000000012 0 NNY00000685200000002700000005300041000003.7320250930000002886 NNN +003925 KR7003921004 ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000327500000100001NNN00NNN000000100N0900000000076940000000005001988062000000000000200000000000000100000000012 1 NNN00000000000000000000000000000000000000.00 000000655 NNN +003960 KR7003960002븲 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000358000000100001NNN00NNN000000060Y0900000000129230000000050001976091600000000000916400000000004582233500012 0 NNY00002651200000078600000066900531000007.3620250930000003280144NNN +004000 KR7004000006Եȭ ST2002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0000485000000100001NNN00NNN000000050Y0900000000712480000000050001976041500000000002580000000000012900000000012 0 NYY00001313600000055100000087800791000002.5220250930000012513283NNY +004020 KR7004020004ö ST1002700110000 NN3YNY NYNNNNNNY0NNNNNNNY0000324000000100001NNN00NNN000000050Y0900000007809600000000050001987052300000000013344500000000066722892500012 0 NYY000172434000001760-0000031100008-00000.1220250930000043236BH1NNN +004060 KR7004060000SG蹰 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000003250000100001NNN00NNN000000100N0900000028052840000000005001976041900000000020242400000000010121248000012 0 NNY000000978-0000001900000002000016-00001.5320250930000000657 NNN +004080 KR7004080008 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000135300000100001NNN00NNN000000100N0900000000116710000000005001991020800000000000950000000000000673307000012 0 NNY00000072300000003900000004500032000003.9620250930000001285 NNN +004090 KR7004090007ѱ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000143500000100001NNN00NNN000000060Y0900000001847530000000005001977062500000000001269400000000000634706000012 0 NNY00000523800000008700000007200047000004.1020250930000001821 NNY +0040S0 KR70040S0004HANARO ۷ιAIƼ EF 000000000000NN 0NNN2NN N 0 Y 0000176150000100001NNN00NNN030000100N0900000000464790000000000002025042200000000000215000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000378 NNN +0040X0 KR70040X0007SOL ȶƼ̱äĿȥ EF 000000000000NN 0NNN2NN N 0 Y 0000106450000100001NNN00NNN030000100N0900000011407360000000000002025042200000000001965000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002135 NNN +0040Y0 KR70040Y0006SOL ȶƼĿOTMäȥ EF 000000000000NN 0NNN2NN N 0 Y 0000095050000100001NNN00NNN030000100N0900000010598080000000000002025042200000000003510000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003402 NNN +004100 KR7004100004¾ݼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000022800000100001NNN00NNN000000100N0900000005165960000000005001976052500000000003670000000000001835000000012 0 NNY000004651000000113-00000039-0046-00005.4820250930000000836 NNN +004105 KR7004101002¾ݼӿ ST0002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000032900000100001NNN00NNN000000100N0900000000335300000000005001990010800000000000330000000000000165000000012 1 NNN00000000000000000000000000000000000000.00 000000108 NNN +004140 KR7004140000 ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000024950000100001NNN00NNN000000060Y0900000004673320000000010001988081000000000004797100000000004797176600012 0 NNY00000663400000027600000011400181000009.0620250930000001196 NNY +004150 KR7004150009ѼȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000031750000100001NNN00NNN000000060Y0900000001456750000000010001972051700000000004102600000000004200857700012 0 NNY00000832200000023100000035900283000001.2820250930000001302924NNN +004170 KR7004170007ż ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNY0002975000000100001NNN00NNN000000050Y0900000001539450000000050001985081900000000000964500000000004922590500012 0 NYY00004995800000307400000179301337000000.8520250930000028694577NNN +0041D0 KR70041D0000KODEX ̱AIƮTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000137700000100001NNN00NNN030000100N0900000001692310000000000002025042200000000000465000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000640 NNN +0041E0 KR70041E0009KODEX ̱S&P500Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000141550000100001NNN00NNN030000100N0900000001393510000000000002025042200000000000410000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000581 NNN +004250 KR7004250007NPC ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000038700000100001NNN00NNN000000100N0900000000604880000000005001969090800000000003672000000000001836000000012 0 NNY00000327800000021000000017700125-00001.9820250930000001421 NNN +004255 KR7004251005NPC ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000023700000100001NNN00NNN000000100N0900000000146640000000005001990011500000000000528000000000000264000000012 1 NNN00000000000000000000000000000000000000.00 000000125 NNN +004270 KR7004270005 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000008250000100001NNN00NNN000000100N0900000001102680000000005001989111400000000003621200000000001810608000012 0 NNY000000564000000007-00000034-0031000004.2620250930000000298 NNN +004310 KR7004310009ǰ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000117100000100001NNN02NNN000000100N0900000008872570000000005001978062800000000003200000000000001600000000011 0 NNY000001757000000002-00000017-0006-00000.7020241130000003747 NNN +004360 KR7004360004 ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000143600000100001NNN00NNN000000050Y0900000000534570000000005001977051900000000001911500000000000965434500012 0 NNY00000967600000029600000062900570000005.0520250930000002745 NNN +004365 KR7004361002 ST0001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000089100000100001NNN00NNN000000100N0900000000019620000000005001989102100000000000368900000000000184462500012 1 NNN00000000000000000000000000000000000000.00 000000328 NNN +004370 KR7004370003 ST2002700050000 NN7NNY NNNNNNNNN0NNNNNNNN0004095000000100001NNN00NNN000000050Y0900000000284430000000050001976063000000000000608200000000003041321000012 0 NYY00002631900000150600000177301392000006.1420250930000024908LC8NNY +004380 KR7004380002THK ST3002700120000 NN0NNY NNNNNNNNN0NNNNYNNN0000099600000100001YNN00NNN000000100N0900000000000000000000005001989092600000000002070000000000001050000000012 0 NNY000001658-00000241-00000498-0412-00023.6620250930000002061 NNN +0043B0 KR70043B0000TIGER ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001015150000100001NNN00NNN000000060Y0900000001306340000000000002025042200000000003637500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000036926 NNN +0043Y0 KR70043Y0003TIME ̳AIũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000161000000100001NNN00NNN000000100N0900000003492670000000000002025051300000000001370000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002205 NNN +004410 KR7004410007ǰ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000001440000100001NNN00NNN000000100N0900000016131540000000001001973122800000000039017500000000003901751360012 0 NNY000000586-00000022-00000030-0030-00012.0220241231000000561 NNN +004415 KR7004411005ǰ ST0002700050000 YN0NNN NNNNNNNNN3NNNNNNNN0000012110000100001NNN00NNN000000100N0900000000002140000000001001989052200000000000222400000000000022245000012 1 NNN00000000000000000000000000000000000000.00 000000026 NNN +004430 KR7004430005ۿ ST3002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000091200000100001NNN00NNN000000060Y0900000000882220000000005001977062500000000002400000000000001200000000012 0 NNY00000799800000024900000012700051000002.8820250930000002188 NNY +004440 KR7004440004Ͼ ST3002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000059000000100001NNN00NNN000000100N0900000000908860000000010002016033000000000001273100000000001273194700012 0 NNY000002213-00000017-00000026-0020-00000.7520241231000000751 NNN +004450 KR7004450003ȭհ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000286500000100001NNN00NNN000000100N0900000000012560000000050001976052800000000000215400000000001077189500012 0 NNY00000125700000005400000004900039000003.8720250930000000617 NNN +004490 KR7004490009 ST2002700130000 NN8NNY NNYNNNNNN0NNNNNNNN0000643000000100001NNN00NNN000000050Y0900000000432300000000005001987112800000000001386000000000000700000000012 0 NYY00001606600000113500000134401016000008.8220250930000008911 NNY +004540 KR7004540001ѳ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000019280000100001NNN00NNN000000100N0900000001072540000000010001975062500000000003724000000000003724069300012 0 NNY000003856-00000133-00000265-0271-00015.5620250930000000718 NNN +004545 KR7004541009ѳ ST0002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000113200000100001NNN00NNN000000100N0900000000007750000000010001988112100000000000036600000000000036616000012 1 NNN00000000000000000000000000000000000000.00 000000041 NNN +004560 KR7004560009ƿ ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000130200000100001NNN00NNN000000060Y0900000001892030000000050001987032400000000001507800000000007539405500012 0 NNY00000569100000020100000013500092000002.3720250930000001963BH1NNY +004690 KR7004690004õ ST2001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0001304000000100001NNN00NNN000000050Y0900000000128800000000050001976122300000000000405500000000002027512500012 0 NNY00003829100000148900000160901284000006.1220250930000005287SCLNNN +0046A0 KR70046A0008TIGER ̱ʴܱ(3)ä EF 000000000000NN 0NNN2NN N 0 Y 0000098450000100001NNN00NNN030000100N0900000030598480000000000002025042900000000004179000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004124 NNN +0046Y0 KR70046Y0000ACE ̱Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000120450000100001NNN00NNN030000100N0900000000435180000000000002025051300000000000400000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000482 NNN +004700 KR7004700001 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000712000000100001NNN00NNN000000100N0900000000054160000000050001977052700000000000664900000000003424569000012 0 NNY00000090200000007200000015500126000002.5820241231000004734 NNN +004710 KR7004710000Ѽũн ST3002700130000 NN0NNY NNNYNNNNN0NNNNNNNN0000060200000100001NNN00NNN000000060Y0900000003132750000000010001988070600000000003210900000000003210987800012 0 NNY00000963000000049800000047100376000004.0820250930000001933924NNN +004720 KR7004720009̾ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000042550000100001NNN00NNN000000100N0900000000909200000000005001990061500000000002195400000000001097725100012 0 NNY000000429000000020-00000007-0007000000.0520250331000000934 NNN +004770 KR7004770004 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000016390000100001NNN00NNN000000100N0900000004342710000000005001987042200000000003550700000000001930144200012 0 NNY00000012800000002600000005500044000005.3620241231000000581 NNN +0047A0 KR70047A0007TIGER ̳ũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000122000000100001NNN00NNN000000100N0900000005771090000000000002025051300000000002350000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002867 NNN +0047N0 KR70047N0002PLUS ̳AIũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000119500000100001NNN00NNN000000100N0900000000263050000000000002025051300000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +0047P0 KR70047P0000RISE ׽ũ100 EF 000000000000NN 0NNN2NN N 0 Y 0000140900000100001NNN00NNN000000100N0900000000270350000000000002025051300000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000204 NNN +0047R0 KR70047R0008RISE ȶƼũ100 EF 000000000000NN 0NNN2NN N 0 Y 0000138500000100001NNN00NNN000000100N0900000000988790000000000002025051300000000000275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000380 NNN +004800 KR7004800009ȿ ST2002100000000 NN0NNY NNNNNNNYN0NNNNNNNN0001515000000100001NNN00NNN000000050Y0900000000539180000000050001973063000000000001674000000000008672549000012 0 NYY00001768000000302800000288202469000014.7720250930000025361971NNN +004830 KR7004830006 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000048300000100001NNN00NNN000000100N0900000001129550000000005001987092500000000001568000000000000784000000012 0 NNY00000115900000007500000007600060000008.3420250930000000757 NNN +004835 KR7004831004 ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000070000000100001NNN00NNN000000100N0900000000131730000000005001989121900000000000139200000000000069600000012 1 NNN00000000000000000000000000000000000000.00 000000097 NNN +004840 KR7004840005DRB ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000052900000100001NNN00NNN000000100N0900000000690870000000005001976052100000000001993000000000000996500000012 0 NNY00000599200000022500000014900119000002.9920250930000001054 NNN +004870 KR7004870002ƼȦ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000004600000100001NNN00NNN000000100N0900000006907590000000005001977063000000000011316300000000005658174700012 0 NNY000000052-00000052-00000250-0208-00013.1520241231000000520139NNN +004890 KR7004890000ϻ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000377000000100001NNN00NNN000000100N0900000000007460000000050002005063000000000000242500000000001212607500012 0 NNY000002695-0000002000000002400020000001.2220250930000000914 NNN +0048J0 KR70048J0007KODEX ̱ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000142200000100001NNN00NNN030000060Y0900000013756020000000000002025051300000000004114100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005870 NNN +0048K0 KR70048K0004KODEX ̳޸ӳ̵κ EF 000000000000NN 0NNN2NN N 0 Y 0000114700000100001NNN00NNN030000100N0900000021068480000000000002025051300000000002270000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002604 NNN +004910 KR7004910006Ʈ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000049500000100001NNN00NNN000000100N0900000000306790000000005001976122700000000001280000000000000640000000012 0 NNY000001535-00000120-00000058-0064000000.0020250930000000633 NNN +004920 KR7004920005ũ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000011570000100001NNN00NNN000000100N0900000001598980000000005001989113000000000005217900000000002608993600012 0 NNY00000041400000000400000000900004000000.6320250930000000603 NNN +004960 KR7004960001ѽŰ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000103000000100001NNN00NNN000000060Y0900000001650600000000050001976070700000000001157000000000005785351000012 0 NNY00000890600000056500000043000333000001.6820250930000001191 NNN +004970 KR7004970000Ŷ󱳿 ST3000000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000091000000100001NNN00NNN000000100N0900000000100140000000005001976063000000000001600000000000000800000000012 0 NNY000003267-00000023-00000079-0075000002.4120250930000001456 NNN +004980 KR7004980009žȸ ST3002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000098700000100001NNN00NNN000000050Y0900000001731260000000050001976063000000000002451600000000012483036500012 0 NNY00000882100000028800000019300141000003.3120250930000002419 NNY +004985 KR7004981007žȸ ST0002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000113700000100001NNN00NNN000000100N0900000000119750000000050001988122100000000000073500000000000367822500012 1 NNN00000000000000000000000000000000000000.00 000000083 NNN +004990 KR7004990008Ե ST2002100000000 NN7YNY NNNNNNNNN0NNNNNNNY0000304000000100001NNN00NNN000000050Y0900000002251780000000002001974021600000000010490900000000002098184740012 0 NYY000117827000003452-00001124-1761-00015.7320250930000031892283NNY +00499K KR700499K014Եֿ ST0002100000000 N 0NNN NN N 0 N 0000287500000100001NNN00NNN000000100N0900000000027310000000002002017103000000000000080500000000000016112060012 1 NNN00000000000000000000000000000000000000.00 000000231 NNN +0049K0 KR70049K0003ACE ̱Ƽäȥ50 EF 000000000000NN 0NNN2NN N 0 Y 0000109550000100001NNN00NNN030000100N0900000000489130000000000002025051300000000000170000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000186 NNN +0049M0 KR70049M0001ACE ̱Ƽ+ĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000113900000100001NNN00NNN030000100N0900000001263280000000000002025051300000000000705000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000807 NNN +005010 KR7005010004޽ƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000041550000100001NNN00NNN000000060Y0900000005464480000000010001973062900000000005618800000000005618807500012 0 NNY00000471600000008300000019800315000002.6320250930000002334 NNY +005030 KR7005030002λְ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000004860000100001YNY00NNN000000100N0900000000000000000000005001975122600000000007878200000000003939149400012 0 NNY000002130000000073-00000030-0006-00003.7520241231000000382 NNN +005070 KR7005070008ڽż ST2002700080000 NN0NNY NNNNNNNNN0NNNNNNNN0000545000000100001NNN00NNN000000050Y0900000008454720000000010001987092800000000003251000000000003251075600012 0 NYY00000569700000025000000020000176000003.6220241231000017718FN4NNY +005090 KR7005090006SGC ST3001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000218000000100001NNN00NNN000000060Y0900000000406250000000050001993010600000000001440900000000007338502000012 0 NNY000018359000000770-00000334-0260-00003.3920250930000003141378NNN +0050E0 KR70050E0007PLUS ̱AIƮ EF 000000000000NN 0NNN2NN N 0 Y 0000090100000100001NNN00NNN000000100N0900000000089450000000000002025052000000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000054 NNN +005110 KR7005110002â ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000012540000100001YNY00NNN000000100N0900000000000000000000005001976060100000000002110600000000001055320350012 0 NNY000000048-0000006500000041300657000459.2320250930000000264 NNN +005180 KR7005180005׷ ST2002700050000 NN0NNY NNNNNNNNN0NNNNNNNN0000758000000100001NNN00NNN000000050Y0900000000454960000000050001978083100000000000955500000000004975620500012 0 NYY00001197300000099200000098900812000010.7220250930000007243 NNN +0051A0 KR70051A0000KoAct εĹüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000181100000100001NNN00NNN000000100N0900000000258640000000000002025052000000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000244 NNN +0051G0 KR70051G0004SOL ̱ڷSMR EF 000000000000NN 0NNN2NN N 0 Y 0000179450000100001NNN00NNN000000100N0900000006360150000000000002025052000000000001990000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003571 NNN +005250 KR7005250006Ȧ ST2002600000000 NNANNY NNNNYNNNN0NNNNNNNN0000155900000100001NNN00NNN000000050Y0900000001056910000000005001978082800000000004702800000000002532190500012 0 NNY00001832000000043000000098801001000013.3820250930000007331 NNN +005257 KR7005252002Ȧ2 ST0002600000000 NN0NNN NNNNNNNNN3NNNNNNNN0000253000000100001NNN00NNN000000100N0900000000016540000000005001997031900000000000084500000000000042299500012 2 NNN00000000000000000000000000000000000000.00 000000214 NNN +0052D0 KR70052D0006TIGER ڸƹٿ EF 000000000000NN 0NNN2NN N 0 Y 0000146250000100001NNN00NNN000000050Y0900000002870920000000000002025052000000000003110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004548 NNN +0052S0 KR70052S00091Q ̱S&P500̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000113300000100001NNN00NNN030000100N0900000006253930000000000002025061000000000002220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002523 NNN +0052T0 KR70052T00081Q ߴܱȸä(A-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000501450000100001NNN00NNN000000100N0900000000010310000000000002025052700000000000230800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001157 NNN +005300 KR7005300009Եĥ ST2002700050000 NN7NNY NNNNNNNNN0NNNNNNNN0001302000000100001NNN00NNN000000050Y0900000000268380000000005001973062100000000000927800000000000463944200012 0 NYY00003076800000179200000127700951000004.5320250930000012081283NNN +005305 KR7005301007Եĥ ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000794000000100001NNN00NNN000000100N0900000000032770000000005001989092100000000000077500000000000038765500012 1 NNN00000000000000000000000000000000000000.00 000000615 NNN +005320 KR7005320007Ÿ̵ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000004150000100001NNN00NNN000000100N0900000003289200000000005001996122400000000006837500000000003418784500012 0 NNY000001709-00000016-00000060-0064-00003.5720250930000000283 NNN +005360 KR7005360003𳪹 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000018750000100001NNN00NNN000000100N0900000000939980000000010001974062600000000001889700000000001889730700012 0 NNY000000979-00000045-00000073-0074-00007.4920250930000000354 NNN +005380 KR7005380001 ST1002700150000 NN8YYY YYYNNNNNN0NNNNNNNN0004925000000100001NNN00NNN000000050Y0900000025146040000000050001974062800000000020475700000000115798239500012 0 NYY00139415900009772500012175991807000009.9620250930001008431BH1NNY +005385 KR7005381009 ST0002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0002695000000100001NNN00NNN000000050Y0900000002721960000000050001989091100000000002334000000000012554991000012 1 NNN00000000000000000000000000000000000000.00 000062903 NNY +005387 KR70053820072B ST0002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0002720000000100001NNN00NNN000000050Y0900000003045820000000050001998120200000000003496300000000019306932500012 2 NNN00000000000000000000000000000000000000.00 000095101 NNY +005389 KR70053830053B ST0002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0002615000000100001NNN00NNN000000050Y0900000000312780000000050001999041500000000000232700000000001239149500012 2 NNN00000000000000000000000000000000000000.00 000006086 NNN +0053L0 KR70053L0005TIGER ̳޸ӳ̵κ EF 000000000000NN 0NNN2NN N 0 Y 0000136250000100001NNN00NNN030000100N0900000022022420000000000002025052700000000003445000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004697 NNN +0053M0 KR70053M0004 ߼ĿƼ EF 000000000000NN 0NNN2NN N 0 Y 0000126800000100001NNN00NNN000000100N0900000000257350000000000002025072200000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000114 NNN +005420 KR7005420005ڽȭ ST2002700080000 NN4NNN NNNNNNNNN0NNNNNNNN0000172900000100001NNN00NNN000000060Y0900000007831430000000010001987072300000000003840800000000003840822800012 0 NNY000004907-00000087-00000159-0153-00025.9220250930000006640FN4NNY +005430 KR7005430004ѱ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000667000000100001NNN00NNN000000060Y0900000000132560000000050001976122800000000000316600000000001583177500012 0 NNY00000484100000040500000041800325000009.0220250930000002111926NNN +005440 KR7005440003Ȧ ST2002100000000 NN0NNY NNNNNNNNN0NNNNNNNN0000089700000100001NNN00NNN000000050Y0900000002608530000000005001989082200000000015590400000000007884593350012 0 NYY00005996100000244800000552404709000014.9520250930000013984Z35NNN +005490 KR7005490008POSCOȦ ST1002700110000 NY3YYY YYNNNNNNY0NNNNNNNY0003780000000100001NNN00NNN000000050Y0900000011853360000000050001988061000000000008093200000000048240312500012 0 NYY00052253400001814400001255508150000000.8220250930000305926853NNY +005500 KR7005500004 ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000193600000100001NNN00NNN000000050Y0900000000444750000000010001988061800000000001332000000000001390000000012 0 NNY00000308300000031600000043600392000014.8920241231000002578 NNN +005610 KR7005610001SPC︳ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000506000000100001NNN00NNN000000050Y0900000000092640000000050001975050200000000000862900000000004314504500012 0 NNY00002501500000034000000022300142000006.7820250930000004366 NNN +005680 KR7005680004￵ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000109600000100001NNN00NNN000000050Y0900000000390910000000005001976122800000000002000000000000001000000000012 0 NNY00000115200000008700000015800125000002.1120250930000002192 NNN +005690 KR7005690003Ĺ̼ ST2002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000142200000100001NNN00NNN000000060Y0900000010099270000000005001988052000000000006001600000000003000848200012 0 NNY00000064900000004700000006300063000007.5920241231000008534 NNY +005720 KR7005720008ؼ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000057500000100001NNN00NNN000000050Y0900000000467160000000005001987121900000000005354300000000002677198850012 0 NNY00002658700000154500000171901321000007.3720250930000003078 NNN +005725 KR7005721006ؼ ST0002700080000 YN0NNN NNNNNNNNN0NNNNNNNN0000044000000100001NNN00NNN000000100N0900000000045390000000005001989092300000000000360000000000000180030000012 1 NNN00000000000000000000000000000000000000.00 000000158 NNN +005740 KR7005740006ũȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000066300000100001NNN00NNN000000100N0900000000331870000000005001976063000000000001484700000000000742367350012 0 NNY00000801000000045900000034500261000005.7020250930000000984 NNN +005745 KR7005741004ũȦ ST0002100000000 YN0NNN NNNNNNNNN0NNNNNNNN0000077200000100001NNN00NNN000000100N0900000000027520000000005001994112200000000000060000000000000030036300012 1 NNN00000000000000000000000000000000000000.00 000000046 NNN +005750 KR7005750005븲ٽ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000046650000100001NNN00NNN000000100N0900000000173140000000010001992122300000000001667200000000001667224000012 0 NNY00000225700000016000000015000119000006.3120250930000000777 NNN +0057H0 KR70057H0007PLUS ̱S&P500̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000114000000100001NNN00NNN030000100N0900000001881880000000000002025061000000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000616 NNN +005800 KR7005800008ſڷ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000152300000100001NNN00NNN000000060Y0900000000160560000000005001976122800000000000900000000000000450000000012 0 NNY00000151600000004600000009100097000002.2120250930000001370 NNN +005810 KR7005810007dzȦ ST2002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000396000000100001NNN00NNN000000050Y0900000000268920000000050001988072800000000001441700000000008474951500012 0 NNY00000323800000064400000063300580000006.8420250930000005709 NNN +005820 KR7005820006 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000144600000100001NNN00NNN000000100N0900000000015300000000050001990042000000000000229700000000001148985000012 0 NNY00000062200000003000000004300035000003.0220250930000000332 NNN +005830 KR7005830005DBغ ST1002100250000 NY6YNY NYNNNNNNN0NNNNNYNY0001365000000100001NNN00NNN000000050Y0900000001814750000000005001973062800000000006938400000000003540000000012 0 NYY00017472000001859600001921814118000016.1120250930000094709LB9NNN +005850 KR7005850003 ST2002700150000 NN8NNY NNYNNNNNN0NNNNNNNN0000575000000100001NNN00NNN000000050Y0900000003365510000000005001988110800000000004644800000000002322426000012 0 NYY00003831000000293600000322102442000013.4920250930000026707 NNY +005870 KR7005870001޴ϵ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000079100000100001NNN00NNN000000060Y0900000001308380000000050001991090300000000001411600000000007058007500012 0 NNY00000230800000009100000013700107000006.4520241231000001116 NNY +005880 KR7005880000ؿ ST2001900000000 NN0NNY NNNNNNNNN0NNNNNNYN0000019570000100001NNN00NNN000000050Y0900000073296440000000005001992042300000000032274700000000016137367000012 0 NNY00000980700000156300000166501546000007.3820250930000006316LB8NNY +005930 KR7005930003Z ST1002700130000 NN5YYY YYNNNNNNN0NNNNNNNY0001624000000100001NNN00NNN000000050Y0900000294564320000000001001975061100000000591963700000000077804668500012 0 NYY00239768600023527400028453325565000008.3720250930009613491511NNN +005935 KR7005931001Zڿ ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0001179000000100001NNN00NNN000000050Y0900000049025150000000001001989092500000000081597400000000011946713500012 1 NNN00000000000000000000000000000000000000.00 000962034 NNY +005940 KR7005940002NH ST1002100240000 NY6YNY NYNNNNNNN0NNNYNNNY0000249000000100001NNN00NNN000000050Y0900000009825470000000050001975093000000000035634400000000184449568000012 0 NYY00008834800001002300000968407481000010.0820250930000088729E56NNY +005945 KR7005941000NHǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000222500000100001NNN00NNN000000050Y0900000000725980000000050001988091300000000001887000000000009935484000012 1 NNN00000000000000000000000000000000000000.00 000004198 NNN +005950 KR7005950001̼ȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000095100000100001NNN00NNN000000100N0900000006174910000000050001988042800000000002629400000000013147084500012 0 NNY000011823000000103-00000146-0182-00031.0620250930000002500 NNN +005960 KR7005960000ΰǼ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000054600000100001NNN00NNN000000060Y0900000000388280000000050001978103000000000002294600000000011473331500012 0 NNY00001234900000017300000027600223000000.2920250930000001252365NNN +005965 KR7005961008ΰǼ ST0001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000191800000100001NNN00NNN000000100N0900000000023420000000050001990062100000000000022500000000000112866000012 1 NNN00000000000000000000000000000000000000.00 000000043 NNN +006040 KR7006040000 ST2002100000000 NN7NNY NNNNNNNNN0NNNNNNNN0000414500000100001NNN00NNN000000050Y0900000000715590000000010001989030700000000004414700000000004414798600012 0 NYY00007264400000406600000342002643000010.1520250930000018299359NNY +006060 KR7006060008ȭδ ST3001600000000 NN0NNY NNNNNNNYN0NNNNNNNN0000033650000100001NNN00NNN000000060Y0900000001409470000000005001991020400000000005532000000000002766000000012 0 NNY000013340000000523000000053-0029000006.9120250930000001861 NNN +006090 KR7006090005 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000084000000100001NNN00NNN000000100N0900000000186380000000050001986122400000000000942200000000004711369500012 0 NNY00000400700000020900000016400126000005.6120241231000000791144NNN +0060H0 KR70060H0002TIGER Ż彺ŹƼ EF 000000000000NN 0NNN2NN N 0 Y 0000120750000100001NNN00NNN030000100N0900000004299780000000000002025062400000000003010000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003649 NNN +006110 KR7006110001ƾ˹̴ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000294000000100001NNN00NNN000000060Y0900000002703820000000005001980120500000000001471100000000000735595800012 0 NNY000002002-00000102-00000132-0132-00006.8120250930000004325 NNY +006120 KR7006120000SKĿ ST2002100000000 NN0NNY NNNNNNNYN0NNNNNNNN0000580000000100001NNN00NNN000000050Y0900000001176330000000050001976062900000000001834700000000010488487500012 0 NYY00007505200000366800000176701568000002.1420250930000010641535NNN +006125 KR7006121008SKĿ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000381000000100001NNN00NNN000000100N0900000000070610000000050001989112400000000000131200000000000679227500012 1 NNN00000000000000000000000000000000000000.00 000000500 NNN +0061Z0 KR70061Z0009RISE ܱƯäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000501600000100001NNN00NNN000000060Y0900000000009230000000000002025062400000000002554000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012810 NNN +006200 KR7006200000ѱȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000006860000100001NNN00NNN000000100N0900000000718830000000005001979113000000000004680300000000002340156800012 0 NNY000002088-00000092-00000067-0071000001.2320250930000000321 NNN +006220 KR7006220008 ST3002100000000 NN0NNY NNNNNYNNN0NNNNNNNN0000142600000100001NNN00NNN000000060Y0900000034267470000000050001972122800000000003779800000000018899278500012 0 NNY00000275100000008300000014400123000002.1420250930000005390 NNN +006260 KR7006260004LS ST1002100000000 NN9NNY NYNNNNNNN0NNNNYNNN0002190000000100001NNN00NNN000000050Y0900000002200880000000050001977063000000000003170000000000016100000000012 0 NYY00022840800000805200000549104091000004.5820250930000069423FN2NNN +006280 KR7006280002 ST2002700090000 NNANNY NNNNYNNNN0NNNNNNNN0001701000000100001NNN00NNN000000050Y0900000000923700000000050001989080100000000001168600000000005843269000012 0 NYY00001493500000064500000074700731000004.3520250930000019878 NNY +006340 KR7006340004 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000038050000100001NNN00NNN000000060Y0900000079682430000000005001988050400000000007707400000000003853733550012 0 NNY00000457500000014800000014000124000009.5020250930000002932 NNY +006345 KR7006341002 ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000036450000100001NNN00NNN000000100N0900000000614380000000005001989062100000000000262100000000000131060000012 1 NNN00000000000000000000000000000000000000.00 000000095 NNN +006360 KR7006360002GSǼ ST2001800000000 NN1NNY NNNNNNNNN0NYNNNNNY0000189500000100001NNN00NNN000000050Y0900000008308240000000050001981080300000000008558100000000042790745000012 0 NYY00009467000000380900000091100487000000.4620250930000016217FN4NNY +006370 KR7006370001뱸ȭ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000050200000100001NNN00NNN000000100N0900000000305600000000050001988101000000000001082100000000005410805500012 0 NNY000000401-00000103-00000239-0238-00018.6820250930000000543 NNN +006380 KR7006380000ī ST2002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000036600000100001YNN00NNN000000100N0900000000000000000000005001974052800000000016899900000000008449999800012 0 NNY000000071-0000032400000033800332000102.3620241231000006185 NNN +006400 KR7006400006ZSDI ST1002700130000 NN5YYY YYNNNNNNN0NNNNNNNY0003965000000100001NNN00NNN000000050Y0900000020710720000000050001979022700000000008058500000000040757765000012 0 NYY000094080-00016185-00011276-3770-00002.6920250930000319521511NNN +006405 KR7006401004ZSDI ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0002075000000100001NNN00NNN000000050Y0900000000265210000000050001989112400000000000161700000000000823948000012 1 NNN00000000000000000000000000000000000000.00 000003357 NNN +006490 KR7006490007νں ST3002000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000007010000100001NNY00NNN000000100N0900000007995460000000005001985011700000000012588600000000006294305850012 0 NNY000000791000000031-00000303-0303-00085.5620250930000000882 NNN +0064K0 KR70064K0003KODEX ݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000157000000100001NNN00NNN000000100N0900000012366320000000000002025061700000000001844000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002895 NNN +006570 KR7006570006븲 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000021250000100001NNN00NNN000000100N0900000000334740000000010001975112000000000001522500000000001642500000012 0 NNY000000908-00000075-00000111-0110-00028.8920250930000000323 NNN +0065G0 KR70065G0008KODEX ̳ũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000112650000100001NNN00NNN030000100N0900000000409200000000000002025061700000000000435000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000490 NNN +006650 KR7006650006ȭ ST2002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0001610000000100001NNN00NNN000000060Y0900000000397150000000050001999081100000000000650000000000004100000000012 0 NNY00002498300000028400000059200532000003.0020250930000010465 NNN +006660 KR7006660005Z ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000139300000100001NNN00NNN000000060Y0900000000834850000000005001987112800000000000812600000000000406315700012 0 NNY00000092800000004600000008900075000004.3020250930000001131 NNN +0066W0 KR70066W0007SOL EF 000000000000NN 0NNN2NN N 0 Y 0000158500000100001NNN00NNN000000100N0900000006916560000000000002025061700000000000885000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001402 NNN +006740 KR7006740005 ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000008420000100001NNN00NNN000000100N0900000001130980000000005001996070300000000005697500000000002964471300012 0 NNY000000690-00000105-00000106-0107-00021.8520250930000000479 NNN +0067V0 KR70067V0007TIGER ̳۷ιTOP3+ EF 000000000000NN 0NNN2NN N 0 Y 0000115450000100001NNN00NNN030000100N0900000000303130000000000002025061700000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000631 NNN +0067Y0 KR70067Y0004TIGER ̳AIƮ EF 000000000000NN 0NNN2NN N 0 Y 0000145000000100001NNN00NNN000000100N0900000000177490000000000002025061700000000000180000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000261 NNN +006800 KR7006800007̷ ST1002100240000 NY6YNY YYNNNNNNN0NNNYNNNY0000348000000100001NNN00NNN000000050Y0900000045796220000000050001975093000000000056708500000000333158204000012 0 NYY00020419900001069400001313510079000010.6020250930000197345FB2NNY +006805 KR7006801005̷ǿ ST0002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000155500000100001NNN00NNN000000100N0900000004091490000000050001989040800000000001407500000000007037875000012 1 NNN00000000000000000000000000000000000000.00 000002188 NNN +00680K KR700680K019̷2B ST0002100240000 N 0NNN NN N 0 N 0000138000000100001NNN00NNN000000050Y0900000009742270000000050002018031400000000013667800000000070000000000012 2 NNN00000000000000000000000000000000000000.00 000018861 NNY +006840 KR7006840003AKȦ ST3002100000000 NN0NNY NNNNNNNYN0NNNNNNNN0000078300000100001NNN00NNN000000100N0900000000452520000000050001999081100000000001324700000000006623780500012 0 NNY000028463-00001075-00000970-1186-00024.4420250930000001037615NNN +006880 KR7006880009żȦ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000067800000100001NNN00NNN000000100N0900000000818430000000005002013112100000000001182800000000000591442900012 0 NNY00000124900000006400000002600012000004.4120250930000000801 NNN +006890 KR7006890008°ɹ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000075000000100001NNN00NNN000000100N0900000000568140000000005002003012800000000001160000000000000580000000012 0 NNY00000046800000002800000006400056000004.1720250930000000870 NNN +0068M0 KR70068M0007KODEX ̱S&P5006Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000115300000100001NNN00NNN000000100N0900000000001090000000000002025062400000000000500000000000000000000000006 0 NNN00000000000000000000000000000000000000.00 000000576 NNN +006980 KR7006980007켺 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000164500000100001NNN00NNN000000100N0900000000030640000000050001988101000000000000309000000000001545000000012 0 NNY00000450000000013600000012500093000013.2620250930000000508 NNN +0069M0 KR70069M00061Q ̱100 EF 000000000000NN 0NNN2NN N 0 Y 0000123500000100001NNN00NNN000000100N0900000002262900000000000002025062400000000000900000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001111 NNN +007070 KR7007070006GS ST2001600000000 NN7NNY NNNNNNNNN0NNNNNNNN0000208500000100001NNN00NNN000000050Y0900000001150760000000010002011122300000000008360700000000008360741500012 0 NYY00008931400000238800000145401093000002.3120250930000017432FN4NNN +007110 KR7007110000Ͻż ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000016060000100001NNN00NNN000000060Y0900000005551860000000005001986030400000000007745600000000003872830500012 0 NNY00000078700000003800000002200014000002.4520241231000001243 NNY +007120 KR7007120009̷̾ ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000010850000100001NNN00NNN000000100N0900000002810620000000005001999112600000000002887800000000001443930400012 0 NNY000000117000000020-00000061-0080-00014.7320241231000000313 NNN +007160 KR7007160005 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000599000000100001NNN00NNN000000060Y0900000000286300000000050001989072500000000000500000000000002500000000012 0 NNY00000517000000038900000065200538000003.4420250930000002995144NNN +007210 KR7007210008 ST3002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000017000000100001NNN00NNN000000060Y0900000001846510000000005001972010400000000006686000000000003428000000012 0 NNY00000448900000017000000028000245000006.1620250930000001136 NNN +007280 KR7007280001ѱƯ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000013920000100001NNN00NNN000000100N0900000001506850000000005001989111300000000006081300000000003040665550012 0 NNY000007688000000106-00000020-0029-00001.3020241231000000846 NNN +0072R0 KR70072R0006TIGER KRX EF 000000000000NN 0NNN2NN N 0 Y 0000168800000100001NNN00NNN000000060Y0900000046741160000000000002025062400000000008685000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000014660 NNN +007310 KR7007310006ѱ ST2002700050000 NN7NNY NNNNNNNNN0NNNNNNNN0003870000000100001NNN00NNN000000050Y0900000000086390000000050001994081200000000000400700000000002003915000012 0 NYY00002778300000157900000132100993000004.9020250930000015510 NNN +007340 KR7007340003DNƼ ST2002700130000 NN8NNY NNYNNNNNN0NNNNNNNN0000255000000100001NNN00NNN000000050Y0900000001487130000000001001988092400000000005851000000000000605649650012 0 NYY00002707100000378000000304002188000014.0420250930000014920LD5NNY +0073X0 KR70073X0007FOCUS ˸ٹٹ̱äĿȥ EF 000000000000NN 0NNN2NN N 0 Y 0000112150000100001NNN00NNN030000100N0900000000260660000000000002025070100000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +007460 KR7007460009 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000007670000100001NNN00NNN000000100N0900000150417930000000005001995070800000000032930500000000016465251500012 0 NNY000000864-00000687-00001050-1061-00036.2820250930000002525 NNN +0074K0 KR70074K0001KoAct KٽɱTOP30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000154150000100001NNN00NNN000000100N0900000003158710000000000002025070800000000000900000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001387 NNN +007540 KR7007540008ǥ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000486500000100001NNN00NNN000000060Y0900000000069980000000010001976062900000000000287500000000000287580000012 0 NNY00000308500000021400000020800181000006.0320250930000001399 NNN +007570 KR7007570005Ͼǰ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000130500000100001YNN00NNN000000100N0900000000000000000000025001974082800000000001908500000000004771416000012 0 NNY00000193500000004400000015000128000006.8920250930000002490 NNN +007575 KR7007571003Ͼǰ ST0002700090000 YN0NNN NNNNNNNNN0NNNNNNNN0000129800000100001YNN00NNN000000100N0900000000000000000000025001989122100000000000044500000000000111270000012 1 NNN00000000000000000000000000000000000000.00 000000057 NNN +007590 KR7007590003Ʊ׷ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000058000000100001NNN00NNN000000100N0900000000169870000000005001977062900000000001361700000000000680878850012 0 NNY00000163900000015100000015300115000003.9820250930000000789 NNN +007610 KR7007610009 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000030000000100001YNN00NNN000000100N0900000000000000000000005001989113000000000001800000000000000900000000012 0 NNY000000193-0000001100000002900029000010.5620250930000000540 NNN +007660 KR7007660004̼Ÿý ST1002700130000 NN5NNY NNNNNNNNN0NNNNNNNN0001254000000100001NNN00NNN000000050Y0900000022075120000000010002003100700000000007340900000000007340921900012 0 NYY00000790000000148200000147401169000026.6820250930000092055 NNY +007690 KR7007690001ȭ ST3002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000378000000100001NNN00NNN000000060Y0900000000684390000000050001989080500000000000926000000000004630416000012 0 NNY00001022300000040500000031500203000003.0220250930000003500 NNN +007700 KR7007700008F&FȦ ST2002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000197600000100001NNN00NNN000000050Y0900000000233000000000005001984100400000000003911400000000001955718350012 0 NNY00001358600000309900000307502261000004.9820250930000007728 NNN +007810 KR7007810005ڸƽŰƮ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000680000000100001NNN00NNN000000100N0900000004012750000000005001985090900000000002362000000000001181037550012 0 NNY00001061600000017800000023900155-00020.9820250930000016062632NNN +007815 KR7007811003ڸƽ ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000187800000100001NNN00NNN000000100N0900000000149290000000005001989070400000000000296400000000000148234500012 1 NNN00000000000000000000000000000000000000.00 000000556 NNN +00781K KR700781K015ڸƽŰƮ2B ST0002700130000 YN0NNN NNNNNNNNN0NNNNNNNN0000139400000100001NNN00NNN000000100N0900000000061020000000005002013061700000000000078300000000000039184950012 9 NNN00000000000000000000000000000000000000.00 000000109 NNN +007860 KR7007860000 ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000103200000100001NNN00NNN000000060Y0900000002057950000000005001989090900000000002347900000000001173992200012 0 NNY00003683700000184400000138500974000012.6020250930000002423 NNY +0078V0 KR70078V0004PLUS ̱κý EF 000000000000NN 0NNN2NN N 0 Y 0000123650000100001NNN00NNN000000100N0900000000189840000000000002025072200000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000086 NNN +007980 KR7007980006TP ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000018550000100001NNN00NNN000000100N0900000002833310000000005001994122700000000005117500000000002646864250012 0 NNY00000818800000052100000046200376000012.5120250930000000949 NNN +0079X0 KR70079X0001ACE BYDüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000128550000100001NNN00NNN000000100N0900000001261540000000000002025071500000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000064 NNN +008040 KR7008040008ƿ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000010700000100001NNN00NNN000000060Y0900000004287940000000005001989062400000000014114400000000007057230000012 0 NNY00000678100000050000000034100243000009.4520241231000001510144NNY +008060 KR7008060006 ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000102400000100001NNN00NNN000000050Y0900000001292450000000005001989012600000000003389000000000001694507500012 0 NNY000009919-0000016400000003800028000001.9020250930000003470 NNN +00806K KR700806K0101 ST0002100000000 N 0NNN NN N 0 N 0000091400000100001NNN00NNN000000100N0900000000048940000000005002018121900000000000121200000000000060617850012 9 NNN00000000000000000000000000000000000000.00 000000110 NNN +0080G0 KR70080G0009KODEX KTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000131000000100001NNN00NNN000000100N0900000028540330000000000002025071500000000002430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003183 NNN +0080X0 KR70080X0008SOL ̱S&P500̱äȥ50 EF 000000000000NN 0NNN2NN N 0 Y 0000109650000100001NNN00NNN000000100N0900000002939340000000000002025071500000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000592 NNN +0080Y0 KR70080Y0007SOL TOP3÷ EF 000000000000NN 0NNN2NN N 0 N 0000214100000100001NNN00NNN000000100N0900000007522480000000000002025071500000000000790000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001691 NNN +008110 KR7008110009뵿 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000150400000100001YNY00NNN000000100N0900000000000000000000005001990060500000000001049000000000000524522350003 0 NNY000000105000000006-00000045-0059000000.0520250930000001577 NNN +008250 KR7008250003̰ǻ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000042400000100001NNN00NNN000000100N0900000000158070000000050001988102100000000001095200000000005476317500012 0 NNY000002301000000024-00000041-0043-00003.1520250930000000464 NNN +008260 KR7008260002NIƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000034700000100001NNN00NNN000000100N0900000001894590000000005001975062800000000002860000000000001430005850012 0 NNY00000275300000037100000033100257000010.5320241231000000992 NNN +0082F0 KR70082F0008HANARO EF 000000000000NN 0NNN2NN N 0 Y 0000119900000100001NNN00NNN030000100N0900000000086850000000000002025072900000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000108 NNN +0082V0 KR70082V0008KODEX TDF2060Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000110700000100001NNN00NNN030000100N0900000001943750000000000002025072200000000000950000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001057 NNN +008350 KR7008350001˹̴ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000012220000100001NNN00NNN000000100N0900000027722170000000005001978052200000000012907900000000006453954500012 0 NNY000001909-0000002600000012100117-00009.2720250930000001577LB8NNN +008355 KR7008351009˹̿ ST0002700110000 YN0NNN NNNNNNNNN0NNNNNNNN0000159000000100001NNN00NNN000000100N0900000000277180000000005001989122300000000000030700000000000015394500012 1 NNN00000000000000000000000000000000000000.00 000000048 NNN +0083S0 KR70083S00021Q ̱޵AI EF 000000000000NN 0NNN2NN N 0 Y 0000118150000100001NNN00NNN000000100N0900000002094030000000000002025072200000000000430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000508 NNN +008420 KR7008420002ö ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000020700000100001NNN00NNN000000100N0900000000301080000000005001994110500000000002050300000000001025175250012 0 NNY000001402-0000002100000005900066000003.5820241231000000424 NNN +008490 KR7008490005 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000213000000100001NNN00NNN000000050Y0900000000181710000000005001990032700000000001156900000000000608455650012 0 NNY00000555900000045400000047800410000008.5320250930000002464 NNN +0084D0 KR70084D0008KIWOOM ̱ũ100ǥƼ EF 000000000000NN 0NNN2NN N 0 Y 0000106150000100001NNN00NNN030000100N0900000000180840000000000002025072200000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +0084E0 KR70084E0007KIWOOM ̱500ǥƼ EF 000000000000NN 0NNN2NN N 0 Y 0000100050000100001NNN00NNN030000100N0900000000007530000000000002025102100000000000285000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000285 NNN +008500 KR7008500001Ǿ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000031050000100001NNN00NNN000000100N0900000001264550000000010001994081200000000000600000000000000600000000012 0 NNY00000027200000001300000001100114000100.8920250930000000186 NNN +0085N0 KR70085N0005ACE ̱10ⱹäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000100850000100001NNN00NNN030000100N0900000000556160000000000002025072200000000001110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001122 NNN +0085P0 KR70085P0003ACE ̱10ⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000104200000100001NNN00NNN030000100N0900000005069300000000000002025072200000000000760000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000794 NNN +008600 KR7008600009 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000003780000100001NNN00NNN000000100N0900000360934840000000010001989072800000000006723600000000007288217900012 0YNNY000001474-00000026-00000121-0114-00031.5020250930000000254 NNN +0086B0 KR70086B0008TIGER εTOP10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000106250000100001NNN00NNN000000100N0900000000541230000000000002025072900000000001000000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001062 NNN +0086C0 KR70086C0007TIGER ε10äȥվƼ EF 000000000000NN 0NNN2NN N 0 Y 0000102600000100001NNN00NNN000000100N0900000000461410000000000002025072900000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000153 NNN +008700 KR7008700007Ƴ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000013980000100001NNN00NNN000000100N0900000007926050000000005001984081100000000007712400000000003856241000012 0 NNY00000169700000004500000005800047000004.7820250930000001078 NNN +008730 KR7008730004ȭ ST2002700080000 NN3NNN NNNNNNNNN0NNNNNNNN0000277000000100001NNN00NNN000000100N0900000001088380000000005001988083000000000002480000000000001477638000012 0 NNY00000369300000009000000006000051-00006.6720250930000006869LC8NNN +008770 KR7008770000ȣڽŶ ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNN0000457000000100001NNN00NNN000000060Y0900000002083700000000050001991031200000000003924800000000019624060500012 0 NYY000030229000000176-00001893-1562-00025.2820250930000017936511NNY +008775 KR7008771008ȣڽŶ ST0001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000352000000100001NNN00NNN000000100N0900000000029460000000050001991080900000000000075100000000000375939500012 1 NNN00000000000000000000000000000000000000.00 000000264 NNN +0087F0 KR70087F0003ACE ̳AIũTOP2+Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000115100000100001NNN00NNN000000100N0900000000316780000000000002025072900000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000138 NNN +008870 KR7008870008ݺ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000492000000100001NNN00NNN000000100N0900000000007780000000050001990060800000000000100000000000000500000000009 0 NNY00000252400000003400000000900038000002.5820250930000000492 NNN +0088N0 KR70088N0002WON K-۷ι޻ EF 000000000000NN 0NNN2NN N 0 Y 0000123450000100001NNN00NNN000000100N0900000003898820000000000002025081200000000000320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000395 NNN +008930 KR7008930000ѹ̻̾ ST2002100000000 NNANNY NNNNYNNNN0NNNNNNNN0000406000000100001NNN00NNN000000050Y0900000003616020000000005001988062000000000006839100000000003497847000012 0 NYY00001071300000101000000095800847000008.5120250930000027766 NNY +008970 KR7008970006KBIö ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000019000000100001NNN00NNN000000060Y0900000017689590000000010001977030500000000010376600000000010376690700012 0 NNY000001457-00000009-00000010-0010-00000.7020250930000001971 NNY +0089B0 KR70089B0005PLUS ̱100̱äȥ50 EF 000000000000NN 0NNN2NN N 0 Y 0000108200000100001NNN00NNN030000100N0900000000431540000000000002025081900000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000248 NNN +0089C0 KR70089C0004KODEX ̱S&P500ȮĿ EF 000000000000NN 0NNN2NN N 0 Y 0000109450000100001NNN00NNN030000100N0900000000161560000000000002025081200000000000765000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000837 NNN +0089D0 KR70089D0003KODEX TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000116700000100001NNN00NNN000000100N0900000003637630000000000002025081200000000001950000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002275 NNN +009070 KR7009070004KCTC ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000061700000100001NNN00NNN000000060Y0900000005847770000000005001978092900000000003000000000000001500000000012 0 NNY00000742100000034400000026500221000007.3120250930000001851LD3NNY +0090B0 KR70090B0002PLUS KҺ EF 000000000000NN 0NNN2NN N 0 Y 0000107900000100001NNN00NNN000000100N0900000001502660000000000002025082600000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000151 NNN +009140 KR7009140005 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000205500000100001NNN00NNN000000100N0900000000033150000000050001989062000000000000157000000000000785398500012 0 NNY00000026900000000900000003800035000005.7120250930000000322 NNN +009150 KR7009150004Z ST1002700130000 NY5YYY YYNNNNNNN0NNNNNNNY0002800000000100001NNN00NNN000000050Y0900000006785130000000050001979022700000000007469300000000037346848000012 0 NYY00008412300000673800000626905037000007.8920250930000209142511NNN +009155 KR7009151002Z ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0001210000000100001NNN00NNN000000050Y0900000000328970000000050001989101000000000000290600000000001453492000012 1 NNN00000000000000000000000000000000000000.00 000003517 NNN +009160 KR7009160003SIMPAC ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000049550000100001NNN00NNN000000060Y0900000000663660000000005001989072900000000006537000000000003268548400012 0 NNY00000832600000022300000020200160000001.9320250930000003239 NNN +009180 KR7009180001Ѽַƽ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000028500000100001NNN00NNN000000100N0900000002282890000000005001989111300000000002815500000000001468014100012 0 NNY00000521700000018200000019600152000008.8820250930000000802924NNN +009190 KR7009190000ݼ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000013230000100001NNN00NNN000000100N0900000001355980000000005001994042900000000004319200000000002159631250012 0 NNY00000168600000003900000003900037000000.0020250930000000571 NNN +0091C0 KR70091C0000KODEX ̱10ⱹäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000099750000100001NNN00NNN000000100N0900000001973650000000000002025081900000000001640000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001635 NNN +0091M0 KR70091M0008HANARO 27-06 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000100400000100001NNN00NNN000000100N0900000000000040000000000002025082600000000001025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001029 NNN +0091P0 KR70091P0005TIGER ڸƿڷ EF 000000000000NN 0NNN2NN N 0 Y 0000145250000100001NNN00NNN000000100N0900000032616040000000000002025081900000000002000000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002905 NNN +009200 KR7009200007 ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000019110000100001NNN00NNN000000100N0900000000945430000000025001990060900000000004160900000000010402327500012 0 NNY000009274000000114-00000083-0018000000.6320250930000000795 NNN +009240 KR7009240003ѻ ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNN0000456000000100001NNN00NNN000000050Y0900000000878880000000010002002071600000000002353300000000002353392800012 0 NYY00001344300000015500000050600417000008.8320250930000010731 NNY +009270 KR7009270000ſ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000014050000100001NNN00NNN000000060Y0900000006246490000000005001988082400000000011477000000000005865219650012 0 NNY000008209000000087-00000072-0061-00001.0620250930000001612 NNY +009290 KR7009290008 ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000059700000100001NNN00NNN000000050Y0900000001274760000000010001989111700000000004979900000000005242085100012 0 NNY00001247400000018700000023400176000005.0120250930000002973 NNN +0092B0 KR70092B0000SOL ѱڷSMR EF 000000000000NN 0NNN2NN N 0 Y 0000144950000100001NNN00NNN000000100N0900000007252210000000000002025081900000000000645000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000934 NNN +0092C0 KR70092C0009SOL 27-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000497700000100001NNN00NNN000000100N0900000000000060000000000002025081900000000000388600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001934 NNN +009310 KR7009310004Ͼ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000011250000100001NNN00NNN000000100N0900000000544780000000005001987111200000000001697300000000000891174000012 0 NNY000000467-00000061-00000063-0105000000.0020250930000000190 NNN +009320 KR7009320003ںǰ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000010830000100001NNN00NNN000000100N0900000002720760000000005001989082500000000004929900000000002464988500012 0 NNY00000116000000005200000004900049000017.6720250930000000533 NNN +0093A0 KR70093A0000RISE AIݵüTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000225150000100001NNN00NNN000000100N0900000001991170000000000002025082600000000000245000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000551 NNN +0093B0 KR70093B0009RISE ưũ100 EF 000000000000NN 0NNN2NN N 0 Y 0000114650000100001NNN00NNN000000100N0900000000091620000000000002025082600000000000105000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000120 NNN +0093D0 KR70093D0007KoAct ȶƼüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000139700000100001NNN00NNN000000100N0900000000519350000000000002025082600000000000335000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000467 NNN +009410 KR7009410002¿Ǽ ST2001800000000 NN0NNY NNNNNNNNN0NYNNNNNN0000016080000100001NNN00NNN000000100N0900000004888450000000005001989111300000000029759000000000014879503900012 0 NNY00001707100000039600000000000005-00011.9320250930000004785844NNN +009415 KR7009411000¿Ǽ ST0001800000000 NN0NNN NNNNNNNNN2NNNNNNNN0000081000000100001NNN00NNN000000100N0900000000218100000000005001994112200000000000064900000000000032498700012 1 NNN00000000000000000000000000000000000000.00 000000052 NNN +009420 KR7009420001ѿù̿ĸ ST2002700090000 NNANNY NNNNYNNNN0NNNNNNNN0000525000000100001NNN00NNN000000050Y0900000007644000000000005001989121800000000005224000000000002612031900012 0 NYY00000117600000001100000001000007000001.4020250930000027426 NNY +009440 KR7009440009KC׸Ȧ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000007560000100001YNY00NNN000000100N0900000000000000000000005001994110500000000002323900000000001161957050012 0 NNY000000705000000015-0000004000007-00020.6320250930000000175 NNN +009450 KR7009450008浿 ST2002700130000 NN0NNY NNNNNNNNN0NYNNNNNN0000585000000100001NNN00NNN000000050Y0900000000642820000000010001993083100000000001456800000000001456859200012 0 NYY00001063500000098600000096400710000017.0320250930000008522 NNY +009460 KR7009460007â ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000005080000100001NNN00NNN000000100N0900000000838310000000005001987122300000000005966700000000002983374300012 0 NNY000002943000000011-0000006600026000002.8520241231000000303 NNN +009470 KR7009470006ȭ ST3002700130000 NN0NNN NNNNNNNNN1NNNNNNNN0000440500000100001NNN00NNN000000060Y0900000004372130000000010001986112400000000000661300000000000661382000012 0 NNY00000174900000009600000011000087000009.7920250930000002913 NNN +0094K0 KR70094K0007TIGER 28-04 ȸä(A+̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000995250000100001NNN00NNN000000100N0900000000071050000000000002025082600000000000289100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002877 NNN +0094L0 KR70094L0006RISE ̳ũTOP10ŬŸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000100350000100001NNN00NNN030000100N0900000000723630000000000002025090200000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +0094M0 KR70094M0005RISE ڸƹŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000153300000100001NNN00NNN000000100N0900000000639900000000000002025090200000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000206 NNN +0094X0 KR70094X00021Q ̹üξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000100550000100001NNN00NNN030000100N0900000001144300000000000002025090200000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000231 NNN +009540 KR7009540006HDѱؾ ST1002100000000 NN2YYY YYNNNNNNN0NNNNYNNY0004225000000100001NNN00NNN000000050Y0900000002072400000000050001999082400000000007077300000000035386558000012 0 NYY00021781600002866600002484219354000017.5320250930000299016IC5NNY +009580 KR7009580002P&P ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000023900000100001NNN00NNN000000100N0900000000566430000000025001989062000000000006236800000000015592081000012 0 NNY000005252-00000189-00000218-0159-00002.0120250930000001490 NNN +009680 KR7009680000 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000102500000100001NNN00NNN000000060Y0900000000332270000000005001994011400000000002805000000000001650000000012 0 NNY00000210400000012900000024000197000006.5120250930000002875 NNN +009770 KR7009770009 ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000329000000100001NNN00NNN000000100N0900000000058710000000050002006101700000000000249900000000001249985500012 0 NNY00000163900000004900000047300380000015.7620241231000000822 NNN +0097L0 KR70097L0003KIWOOM ѱ&̱AIũ EF 000000000000NN 0NNN2NN N 0 Y 0000119450000100001NNN00NNN030000100N0900000000355480000000000002025090200000000000235000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000281 NNN +009810 KR7009810003÷̱׷ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000002610000100001YNN00NNN000000100N0900000000000000000000001001988083100000000015188700000000001518875000012 0 NNY000001850-0000001700000000400008000018.0420250930000000396 NNN +009830 KR7009830001ȭַ ST1002700080000 NN4YNY YYNNNNNYN0NNNNNNNN0000283500000100001NNN00NNN000000050Y0900000011002620000000050001974061900000000017189200000000087569216500012 0 NYY000095761000001250-00002562-2041-00004.8320250930000048731913NNY +009835 KR7009831009ȭַǿ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000214000000100001NNN00NNN000000100N0900000000101750000000050001989112100000000000257500000000001287674500012 1 NNN00000000000000000000000000000000000000.00 000000551 NNN +0098F0 KR70098F0000KODEX KڷSMR EF 000000000000NN 0NNN2NN N 0 Y 0000148850000100001NNN00NNN000000100N0900000012164600000000000002025091600000000000945000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001406 NNN +0098N0 KR70098N0000PLUS ڻָ԰ EF 000000000000NN 0NNN2NN N 0 Y 0000117350000100001NNN00NNN000000100N0900000002995530000000000002025091600000000000740000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000868 NNN +0098Z0 KR70098Z0006FOCUS 200 EF 000000000000NN 0NNN2NN N 0 Y 0000651500000100001NNN00NNN000000100N0900000000001410000000000002025092300000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000456 NNN +009900 KR7009900002Ż ST3002700150000 N 0NNN NN N 0 N 0000092800000100001NNN00NNN000000050Y0900000002720750000000005002020120700000000005247000000000002623506650012 0 NNY00001201800000092100000085800635000014.4520250930000004869 NNY +009970 KR7009970005Ȧ ST2002100000000 NN8NNY NNNNNNNNN0NNNNNNNN0001969000000100001NNN00NNN000000050Y0900000000130010000000005001988110700000000001349900000000000681779600012 0 NYY00003446000000491700000526203949000012.3620250930000026579136NNN +0099L0 KR70099L0001ACE 췮ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000992650000100001NNN00NNN000000100N0900000000002580000000000002025090900000000000130100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001291 NNN +010040 KR7010040004ѱȭ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000020750000100001NNN00NNN000000100N0900000000448540000000005002000101600000000004106700000000002053353100012 0 NNY000003139-00000001-00000220-0187-00008.4220250930000000852 NNN +010060 KR7010060002OCIȦ ST2002100000000 NN4NNY NNNNNNNYN0NNNNNNNY0001175000000100001NNN00NNN000000060Y0900000001828820000000050001985070900000000001867000000000010685218000012 0 NYY000025695-00000850-00001711-1708-00004.8320250930000021937378NNY +0100K0 KR70100K0009KODEX KTOP10 EF 000000000000NN 0NNN2NN N 0 N 0000139300000100001NNN00NNN000000100N0900000008925470000000000002025091600000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000752 NNN +010100 KR7010100006ѱؽ ST3002700150000 NN0NNN NNNNNNNNN1NNNNNNNN0000060300000100001NNN00NNN000000060Y0900000011435910000000010001987100200000000003045000000000003045042000012 0 NNY00001277400000030500000025000186000007.8920250930000001836 NNN +010120 KR7010120004LS ELECTRIC ST1002700130000 NN9YNY YYNNNNNNN0NNNNYNNN0005720000000100001NNN00NNN000000050Y0900000004823330000000050001994071100000000003000000000000015000000000012 0 NYY00003441400000296700000279202005000014.0020250930000171600FN2NNY +010130 KR7010130003ƿ ST1002700110000 NN3YYY NYNNNNNNY0NNNNNNNY0018010000000100001NNN00NNN000000050Y0900000000538420000000050001990072800000000002087200000000011559152000012 0 NYY00011818000000803400000760405630000003.7420250930000375922632NNN +010140 KR7010140002Z߰ ST1002700150000 NN2YYY YYNNNNNNN0NNNNYNNY0000302000000100001NNN00NNN000000050Y0900000051866990000000010001994012800000000088000000000000088000000000012 0 NYY00007812100000566000000446604427000009.0620250930000265760511NNN +0101N0 KR70101N0005RISE AI EF 000000000000NN 0NNN2NN N 0 Y 0000147700000100001NNN00NNN000000100N0900000009964710000000000002025092300000000000615000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000908 NNN +0102A0 KR70102A0009TIGER ̱AIƮTOP4Plus EF 000000000000NN 0NNN2NN N 0 Y 0000092600000100001NNN00NNN000000100N0900000003596980000000000002025090900000000001130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001046 NNN +0102X0 KR70102X0002ACE TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000110300000100001NNN00NNN000000100N0900000000425670000000000002025092300000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000121 NNN +0103T0 KR70103T00071Q KҹAI EF 000000000000NN 0NNN2NN N 0 Y 0000109800000100001NNN00NNN030000100N0900000003415450000000000002025093000000000000255000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000281 NNN +010400 KR7010400000̿ ST3001800000000 N 0NNN NN N 0 N 0000040350000100001NNN00NNN000000100N0900000000279350000000005002018091400000000000762200000000000381100000012 0 NNY00000122600000006000000008900089-00008.9820250930000000307 NNN +0104G0 KR70104G0001PLUS K극 EF 000000000000NN 0NNN2NN N 0 N 0000139750000100001NNN00NNN000000100N0900000002823720000000000002025093000000000000175000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000244 NNN +0104H0 KR70104H0000KoAct ̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000110850000100001NNN00NNN000000100N0900000002759550000000000002025093000000000000410000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000454 NNN +0104N0 KR70104N0002TIGER 200ŸŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000153700000100001NNN00NNN000000100N0900000002395930000000000002025092300000000000870000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001337 NNN +0104P0 KR70104P0000TIGER ڸƹٿŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000109750000100001NNN00NNN030000100N0900000000369460000000000002025092300000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000365 NNN +010580 KR7010580009 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000025000000100001NNN00NNN000000060Y0900000005372910000000005001994122700000000011125100000000005562588000012 0 NNY00000172500000005200000001000011000001.6720241231000002781LB8NNY +0105D0 KR70105D0003SOL ѱAIƮ EF 000000000000NN 0NNN2NN N 0 Y 0000119100000100001NNN00NNN000000100N0900000003225210000000000002025092300000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000172 NNN +0105E0 KR70105E0002SOL ڸư EF 000000000000NN 0NNN2NN N 0 Y 0000119250000100001NNN00NNN000000100N0900000009370500000000000002025092300000000003120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003720 NNN +010600 KR7010600005̿ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000000000000100001NYY00NNN000000100N0900000000000000000000005001997071800000000009092300000000004546170350012 0 NNY000000612-00000009-00000046-0047-00069.5820250930000000000 NNN +010640 KR7010640001 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000029300000100001NNN00NNN000000100N0900000000217310000000005001989093000000000001000000000000000500000000012 0 NNY00000054000000004000000004000032000009.7420241231000000293 NNN +010660 KR7010660009ȭõ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000058200000100001NNN00NNN000000100N0900000012229390000000005001988121200000000002200000000000001100000000012 0 NNY00000232400000002000000006600059000004.2820241231000001280 NNN +010690 KR7010690006ȭ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000093100000100001NNN00NNN000000060Y0900000005097850000000005001994011400000000003492000000000001746020500012 0 NNY00001450100000068500000055000473000012.8820250930000003251 NNY +0106J0 KR70106J0006 KOSPI200ε XŬ PF 000000000000NN 0NNN5NN N 0 N 0000139250000100001NNN00NNN000000100N0900000000101850000000000002025102700000000000115000000000000000000000001 0 NNN00000000000000000000000000000000000000.00 000000160 NNN +010770 KR7010770006ȭȦ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000038300000100001NNN00NNN000000100N0900000000300620000000005001986033100000000001462500000000000731273300012 0 NNY00000667700000024800000024800252000017.6920250930000000560 NNN +010780 KR7010780005̿ ST2002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000231500000100001NNN00NNN000000060Y0900000000795480000000005001986012700000000003018600000000001544630300012 0 NNY00000905300000095200000016800069-00013.0320250930000006988LB1NNY +0107F0 KR70107F0009KIWOOM ̱&AIũ EF 000000000000NN 0NNN2NN N 0 Y 0000104150000100001NNN00NNN030000100N0900000000419760000000000002025092300000000000275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000287 NNN +010820 KR7010820009۽ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000043600000100001NNN00NNN000000060Y0900000008858410000000005001989051000000000004877100000000002438596900012 0 NNY00000207300000004300000007100109000017.3320241231000002126 NNY +010950 KR7010950004S-Oil ST1002700080000 NY4YNY NYNNNNNYN0NNNNNNNY0001005000000100001NNN00NNN000000050Y0900000002728920000000025001987052700000000011258200000000028145698000012 0 NYY000254544-00001363-00000922-0481-00002.0620250930000113145AU7NNY +010955 KR7010951002S-Oil ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000526000000100001NNN00NNN000000060Y0900000000315400000000025001992052800000000000402100000000001005481750012 1 NNN00000000000000000000000000000000000000.00 000002115 NNN +010960 KR7010960003ȣ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000037750000100001NNN00NNN000000100N0900000000550640000000005002005051200000000002412000000000001250000000012 0 NNY00000298400000012800000021300170000008.0520250930000000910 NNN +011000 KR7011000007 ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000019470000100001NNN00NNN000000100N0900000050083450000000010001987111600000000008540900000000008540993600012 0 NNY000000204-00000309-00000357-0357-00071.5220250930000001662 NNN +011070 KR7011070000LG̳ ST2002700130000 NN5YNY NNNNNNNNN0NNNNNNNY0002575000000100001NNN00NNN000000050Y0900000002744350000000050002008072400000000002366700000000011833553500012 0 NYY00014286800000340300000253002053000005.9620250930000060942282NNY +011090 KR7011090008ؽ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000005270000100001NNN00NNN000000100N0900000002228370000000005001995070800000000005999100000000002999582050012 0 NNY00000167200000002700000002000019000004.9320250930000000316 NNN +011150 KR7011150000CJǪ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000028700000100001NNN00NNN000000100N0900000004393030000000005001988112600000000003593000000000001796538650012 0 NNY000001444-0000003100000000600005000002.4420250930000001031720NNN +011155 KR7011151008CJǪ1 ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000160500000100001NNN00NNN000000100N0900000000014170000000005001990011300000000000020000000000000010000000012 1 NNN00000000000000000000000000000000000000.00 000000032 NNN +011170 KR7011170008ԵɹĮ ST2002700080000 NN4YNY NNNNNNNYN0NNNNNNNY0000864000000100001NNN00NNN000000100N0900000003322860000000050001991053000000000004277500000000021387709500012 0 NYY000137731-00005096-00009940-8811-00012.5120250930000036957283NNN +0111J0 KR70111J0009HANARO ǰTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000128600000100001NNN00NNN030000100N0900000002788570000000000002025102800000000000415000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000534 NNN +0111P0 KR70111P00011Q ̱100̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000104000000100001NNN00NNN030000100N0900000004753210000000000002025093000000000001890000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001970 NNN +011200 KR7011200003HMM ST1001900000000 NN9YYY YYNNNNNNN0NNNNNNNN0000200000000100001NNN00NNN000000050Y0900000020043030000000050001995100500000000094323700000000512519748000012 0 NYY00008183800001143900001640315149000009.7120250930000188647LA1NNY +011210 KR7011210002 ST2002700150000 NN8NNY NNYNNNNNN0NNNNNNNY0000856000000100001NNN00NNN000000050Y0900000002093290000000050002011022100000000002719500000000013597541500012 0 NYY00006392200000156700000173001078000004.1020250930000023278BH1NNY +011230 KR7011230000ȭ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000030000000100001NNN00NNN000000100N0900000001858010000000010001987052500000000001916500000000001916578500012 0 NNY000000230-00000050-00000059-0059-00053.6320250930000000574 NNN +011280 KR7011280005¸ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000020150000100001NNN00NNN000000100N0900000001642470000000005001988122000000000007080500000000003540297000012 0 NNY000005709000000008-00000028-0019-00004.6620250930000001426LD4NNN +0112X0 KR70112X0000Ƽ 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000285150000100001NNN00NNN000000100N0900000000245060000000000002025102800000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000370 NNN +011300 KR7011300001ȸƼ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000004030000100001NNN00NNN000000100N0900000007389900000000001001995111000000000015561700000000001556176750012 0 NNY000000172000000018-00000031-0031-00041.0620250930000000627 NNN +011330 KR7011330008 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000011770000100001NNN00NNN000000100N0900000007419810000000005001989121400000000009352500000000004929481400012 0 NNY00000086200000002100000002000016000000.0020250930000001100 NNN +011390 KR7011390002λ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000773000000100001NNN00NNN000000100N0900000000077680000000050001990091400000000000105600000000000528000000012 0 NNY000000776-00000016-00000061-0049-00003.7220250930000000816 NNN +0113D0 KR70113D0003TIME ۷ιžȾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000111250000100001NNN00NNN000000100N0900000001547010000000000002025102800000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000678 NNN +0113G0 KR70113G0000KoAct ̱̿コɾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000103600000100001NNN00NNN000000100N0900000000496570000000000002025111100000000000155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000160 NNN +0113P0 KR70113P0009HK ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001006750000100001NNN00NNN000000100N0900000000000120000000000002025093000000000000051800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000521 NNN +011420 KR7011420007þƿ ST3003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000020050000100001NNN00NNN000000100N0900000003023420000000005001989111400000000002754900000000001377482200012 0 NNY00000032500000003200000003800029000004.2120241231000000552971NNN +0114X0 KR70114X0008RISE ۷ιũTOP3Plus EF 000000000000NN 0NNN2NN N 0 Y 0000088000000100001NNN00NNN000000100N0900000000050170000000000002025102100000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000061 NNN +011500 KR7011500006ѳȭ ST3002700080000 NN0NNN NNNNNNNNN2NNNNNNNN0000253500000100001NNN00NNN000000100N0900000007259120000000005002003010900000000001563700000000000781852100012 0 NNY00000247500000006100000005200045000002.7420241231000003963 NNN +0115C0 KR70115C0002RISE ̱ٿTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000108350000100001NNN00NNN000000100N0900000000358440000000000002025102100000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +0115D0 KR70115D0001KODEX KTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000105000000100001NNN00NNN000000100N0900000011004090000000000002025102800000000001105000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001160 NNN +0115E0 KR70115E0000KODEX ڸƼҹAI EF 000000000000NN 0NNN2NN N 0 Y 0000127450000100001NNN00NNN000000100N0900000004756200000000000002025102100000000000895000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001140 NNN +011690 KR7011690005ַ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000054900000100001NNN00NNN000000060Y0900000051804750000000025001995122100000000003657400000000009143598500012 0 NNY000001168-00000014-00000053-0051000000.0020250930000002007 NNY +011700 KR7011700002ѽű ST3002700120000 NN0NNN NNNNNNNNN1NNNNNNNN0000041300000100001NNN00NNN000000100N0900000014603870000000005001987072400000000003244600000000001622307550012 0 NNY00000036200000000400000002700023-00000.2820250930000001340 NNN +011760 KR7011760006۷̼ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000225000000100001NNN00NNN000000060Y0900000000643390000000050001977120100000000001322800000000006614483000012 0 NNY00005665200000106900000074500605000010.9820250930000002976 NNY +011780 KR7011780004ȣȭ ST2002700080000 NN4YNY NNNNNNNYN0NNNNNNNN0001479000000100001NNN00NNN000000050Y0900000000811630000000050001988012200000000002603100000000015233845500012 0 NYY00005325400000270300000353202895000005.7520250930000038500KUPNNY +011785 KR7011781002ȣȭп ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000723000000100001NNN00NNN000000060Y0900000000146600000000050001988102000000000000302300000000001511743000012 1 NNN00000000000000000000000000000000000000.00 000002185 NNN +011790 KR7011790003SKC ST2002700080000 NN4YNY NYNNNNNYN0NNNNNNNY0001169000000100001NNN00NNN000000060Y0900000003957060000000050001997071800000000003786800000000018934149000012 0 NYY000014118-00001974-00004300-2208-00034.3520250930000044268535NNY +0117L0 KR70117L0009KODEX 26-12 ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000099950000100001NNN00NNN000000060Y0900000000359790000000000002025102800000000020787000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000020776 NNN +0117V0 KR70117V0007TIGER ڸAI±TOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000150050000100001NNN00NNN000000100N0900000030028060000000000002025102100000000002320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003481 NNN +011810 KR7011810009STX ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000035300000100001YNY00NNN020000100N0900000000000000000000025001990091200000000003101700000000007754481750012 0 NNY000005189-00000181-00000409-0406-00177.4220250930000001094 NNN +0118S0 KR70118S0001SOL ̱ؽƮũTOP10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000103750000100001NNN00NNN000000100N0900000002736020000000000002025102800000000000625000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000648 NNN +0118Z0 KR70118Z0002ACE ̱AIũٽɻƼ EF 000000000000NN 0NNN2NN N 0 Y 0000093150000100001NNN00NNN000000100N0900000005331260000000000002025102800000000001510000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001406 NNN +011930 KR7011930005ż̿ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000017100000100001NNN00NNN000000060Y0900000023880030000000005001996073100000000020584800000000010303407550012 0 NNY000004149-00000016-00000088-0104-00004.9320250930000003520 NNY +0119H0 KR70119H0003KODEX 28-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000099400000100001NNN00NNN000000100N0900000000960670000000000002025110400000000001845000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001833 NNN +012030 KR7012030003DB ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000016240000100001NNN00NNN000000050Y0900000012692040000000005001993010600000000020117300000000010058696650012 0 NNY00000451300000039200000070800628000016.8120250930000003267LB9NNY +0120G0 KR70120G0001̿ ST0002700090000 N 0NNN NN N 0 N 0001071000000100001NNN01NNN000000100N0900000001497140000000005002025112400000000000743500000000000371793500012 0 NNY00000000000000000000000000000000000000.00 000007963 NNN +0120J0 KR70120J0008BNK īī׷Ŀ EF 000000000000NN 0NNN2NN N 0 Y 0000112450000100001NNN00NNN000000100N0900000002036950000000000002025120200000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000112 NNN +0120X0 KR70120X0000 èǾߴܱũ XŬ PF 000000000000NN 0NNN5NN N 0 N 0000100000000100001NNN00NNN000000100N0900000000000000000000000002025102700000000000106000000000000000000000010 0 NNN00000000000000000000000000000000000000.00 000000106 NNN +012160 KR7012160008 ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000004830000100001NNN00NNN000000100N0900000000765910000000005002010012500000000010131000000000005065518600012 0 NNY000003372-00000109-00000408-0420-00028.5620250930000000489 NNN +012170 KR7012170007Ƽ ST3003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000018720000100001NNN00NNN000000100N0900000003212760000000005001989122000000000001087300000000000543687150012 0 NNY000000046-00000032-00000086-0092-00087.9720250930000000203 NNN +012200 KR7012200002 ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000086900000100001NNN02NNN000000100N0900000019124090000000005001988070600000000002722200000000001361141450012 0 NNY000002984-00000123-00000058-0058-00072.9020250930000002365 NNN +012205 KR7012201000 ST0002700120000 YN0NNN NNNNNNNNN0NNNNNNNN0000082400000100001NNN00NNN000000100N0900000001908310000000005001989080200000000000116900000000000058453950012 1 NNN00000000000000000000000000000000000000.00 000000096 NNN +012280 KR7012280004ȭݼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000009340000100001NNN00NNN000000100N0900000003201180000000005001990012500000000005166400000000002756908250012 0 NNY00000301700000009900000008700087000012.3220241231000000482 NNN +0122W0 KR70122W0009RISE 26-11 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000501800000100001NNN00NNN000000100N0900000000033150000000000002025111800000000000610200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003061 NNN +012320 KR7012320008浿κƮ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000672000000100001NNN00NNN000000060Y0900000004658690000000050001997030700000000000236500000000001182511500012 0 NNY000001793-0000002000000000600019000004.9820250930000001589 NNN +012330 KR7012330007 ST1002700150000 NN8YYY YYYNNNNNN0NNNNNNNN0004470000000100001NNN00NNN000000050Y0900000005867750000000050001989090500000000009073200000000049096931500012 0 NYY00045720200002427000004077328967000009.1620250930000405574BH1NNY +0123G0 KR70123G0008TIGER ̱AISMR EF 000000000000NN 0NNN2NN N 0 Y 0000081800000100001NNN00NNN000000100N0900000009008480000000000002025110400000000002440000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001995 NNN +0123S0 KR70123S0004HANARO 26-12 ä(AA+̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000100350000100001NNN00NNN000000100N0900000000069580000000000002025121600000000000615000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000617 NNN +012450 KR7012450003ȭν̽ ST1002700150000 NN9YYY YYNNNNNNN0NNNNNNNN0012880000000100001NNN00NNN000000050Y0900000001809050000000050001987052700000000005156300000000027031700500012 0 NYY00018281700002281700001542512080000043.4920250930000664136913NNY +012510 KR7012510004 ST2002900000000 NN0NNY NNNNNNNNN0NNNNNNNN0000900000000100001NNN00NNN000000100N0900000002611400000000005001988102800000000003038200000000001519139200012 0 NYY00000319200000081600000070300530000013.4120250930000027344 NNN +012610 KR7012610002ξ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000048350000100001NNN00NNN000000060Y0900000035237890000000005001995100500000000004161600000000002080818250012 0 NNY00000290500000012000000003400021000003.2320250930000002012 NNY +012630 KR7012630000HDC ST2002100000000 NN0NNY NNNNNNNNN0NYNNNNNN0000188200000100001NNN00NNN000000050Y0900000001890880000000050001996101600000000005974100000000029870860500012 0 NYY00005206600000517400000435503241000009.1920250930000011243HDCNNY +012690 KR7012690004𳪸 ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000022500000100001NNN00NNN000000100N0900000003121230000000005001988101400000000003657100000000001888562750012 0 NNY00000126300000001000000001100012000001.5320241231000000822 NNN +0126Z0 KR70126Z0002ZǽȦ ST0002100000000 N AYYY NY N 0 N 0006280000000100001NNN00NNN000000060Y0900000001783840000000025002025112400000000002488300000000006220762250012 0 NYY00000000000000000000000000000000000000.00 000156265511NNY +012750 KR7012750006 ST2002600000000 NN9NNY NNNNNNNNN0NNNNNNNN0000761000000100001NNN00NNN000000050Y0900000000428400000000005001996013000000000003799900000000001899958900012 0 NYY00002105500000178700000188601424000010.7820250930000028917511NNN +0127M0 KR70127M0006ACE ̱ġ־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000106500000100001NNN00NNN030000100N0900000002325700000000000002025111100000000001655000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001765 NNN +0127P0 KR70127P0003ACE ̱־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000100550000100001NNN00NNN000000060Y0900000000959090000000000002025111100000000006255000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006289 NNN +0127R0 KR70127R0001RISE ̱AIŬ EF 000000000000NN 0NNN2NN N 0 Y 0000124550000100001NNN00NNN000000100N0900000000328920000000000002025112500000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000124 NNN +0127T0 KR70127T0009KIWOOM ̱S&P500&ٿȯ EF 000000000000NN 0NNN2NN N 0 Y 0000102750000100001NNN00NNN030000100N0900000000790190000000000002025111100000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000123 NNN +0127V0 KR70127V0005KIWOOM ̱S&P500 TOP10&ٿȯEF 000000000000NN 0NNN2NN N 0 Y 0000101600000100001NNN00NNN030000100N0900000000374990000000000002025111100000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000132 NNN +012800 KR7012800009â ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000013830000100001NNN00NNN000000060Y0900000010865210000000005001989120500000000009114000000000004557024950012 0 NNY00001069400000021400000001000008000000.7720250930000001260 NNN +0128D0 KR70128D0006PLUS ̳׼ũŬŸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000095250000100001NNN00NNN030000100N0900000000083900000000000002025111800000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000072 NNN +013000 KR7013000005۷ι ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000011680000100001NNN00NNN000000100N0900000000841410000000005001989090500000000002870500000000001435251550012 0 NNY00000035900000002500000004400035000006.9020241231000000335 NNN +0131A0 KR70131A0004SOL ̳ҺƮ EF 000000000000NN 0NNN2NN N 0 Y 0000100300000100001NNN00NNN000000100N0900000000023890000000000002025112500000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +0131V0 KR70131V00091Q ̱װũ EF 000000000000NN 0NNN2NN N 0 Y 0000139550000100001NNN00NNN000000100N0900000021033860000000000002025112500000000003230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004507 NNN +0131W0 KR70131W00081Q ܱƯäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001005100000100001NNN00NNN000000100N0900000000280450000000000002025112500000000000109800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001103 NNN +0132D0 KR70132D0000KoAct ۷ιKóüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000105400000100001NNN00NNN000000100N0900000000105860000000000002025112500000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +0132H0 KR70132H0006KODEX ̱ڷSMR EF 000000000000NN 0NNN2NN N 0 Y 0000125900000100001NNN00NNN030000100N0900000002843460000000000002025112500000000000880000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001107 NNN +0132K0 KR70132K0001PLUS ׽ŬĿäȥ EF 000000000000NN 0NNN2NN N 0 Y 0000096700000100001NNN00NNN000000100N0900000002784400000000000002025120900000000000655000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000633 NNN +013360 KR7013360003ϼǼ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000020900000100001NNN00NNN000000100N0900000011185260000000005001989120200000000005402400000000002701244000012 0 NNY00000340100000008500000001000008-00060.6020250930000001129 NNN +013520 KR7013520002ȭ۷̼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000023200000100001NNN00NNN000000060Y0900000001564720000000005001991022200000000005005100000000002502562600012 0 NNY00001340200000079500000066300513000016.0720250930000001161 NNN +013570 KR7013570007 ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000051400000100001NNN00NNN000000060Y0900000001432220000000005001989053000000000002631900000000001315981650012 0 NNY00000929900000044100000035300299000007.2720250930000001352 NNN +013580 KR7013580006Ǽ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000218000000100001NNN00NNN000000060Y0900000001316980000000050001996013000000000000893000000000004465453500012 0 NNY00002064400000118800000084100633000008.7420250930000001946 NNY +0135Y0 KR70135Y0002ITF ߱ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001002700000100001NNN00NNN000000100N0900000000000010000000000002025121600000000000107000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001072 NNN +013700 KR7013700000̾ؾ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000012300000100001NNN00NNN000000100N0900000001411920000000005001989113000000000005975000000000002987541500012 0 NNY00000181900000017600000015400115-00004.4520250930000000734 NNN +0137V0 KR70137V0003KIWOOM ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000096050000100001NNN00NNN030000100N0900000002513470000000000002025120900000000000375000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000360 NNN +0137W0 KR70137W0002KIWOOM ̱S&P500&GOLD EF 000000000000NN 0NNN2NN N 0 Y 0000100400000100001NNN00NNN030000100N0900000002536070000000000002025120900000000000280000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000281 NNN +013870 KR7013870001ڸ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000045950000100001NNN00NNN000000100N0900000000591480000000005002012112000000000001907200000000000953614000012 0 NNY00000583800000015900000012300083000006.6220250930000000876 NNN +013890 KR7013890009 ST3002700000000 N 0NNN NN N 0 N 0000124300000100001NNN00NNN000000060Y0900000000315700000000005002019103000000000002225400000000001136447400012 0 NNY00000721100000049000000023600163000005.6820250930000002766Z35NNN +0138D0 KR70138D0004RISE а EF 000000000000NN 0NNN2NN N 0 Y 0000132550000100001NNN00NNN000000100N0900000002446810000000000002025121600000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000106 NNN +0138T0 KR70138T0006RISE ̱S&P500ϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000097250000100001NNN00NNN030000100N0900000003614080000000000002025122300000000000300000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +0138Y0 KR70138Y0009PLUS äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000108950000100001NNN00NNN000000100N0900000013601330000000000002025121600000000000850000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000926 NNN +0139F0 KR70139F0001TIGER 12ڵä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001004450000100001NNN00NNN000000100N0900000000001830000000000002025120900000000001328600000000000000000000011 0 NNN00000000000000000000000000000000000000.00 000013345 NNN +0139P0 KR70139P0009ACE EF 000000000000NN 0NNN2NN N 0 Y 0000125700000100001NNN00NNN030000100N0900000001171590000000000002025121600000000000355000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000447 NNN +014130 KR7014130009ͽ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000028600000100001NNN00NNN000000100N0900000000422620000000005001989072500000000001200000000000000600000000012 0 NNY000004788-00000004-00000116-0106000013.5920250930000000343 NNN +014160 KR7014160006뿵 ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000010650000100001NNN00NNN000000060Y0900000003648490000000005001990030600000000010839400000000005419727450012 0 NNY00000280800000000900000000000000-00000.0220241231000001154 NNY +0141S0 KR70141S0002SOL EF 000000000000NN 0NNN2NN N 0 Y 0000110500000100001NNN00NNN000000100N0900000004017620000000000002025121600000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000254 NNN +0141T0 KR70141T0001SOL ߱ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000501450000100001NNN00NNN000000100N0900000000000050000000000002025121600000000000072600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000364 NNN +014280 KR7014280002ݰ ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000061500000100001NNN00NNN000000060Y0900000003372180000000010001988091000000000002932900000000002932935700012 0 NNY000006150000000111-00000031-0065-00004.2520250930000001803 NNY +014285 KR7014281000ݰ ST0002700110000 YN0NNN NNNNNNNNN0NNNNNNNN0000081100000100001NNN00NNN000000100N0900000000092430000000010001989073100000000000058900000000000058987500012 1 NNN00000000000000000000000000000000000000.00 000000047 NNN +0142D0 KR70142D0008TIGER ̱AIͼTOP4Plus EF 000000000000NN 0NNN2NN N 0 Y 0000108450000100001NNN00NNN000000100N0900000006414330000000000002025120900000000000625000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000677 NNN +014440 KR7014440002ȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000046700000100001NNN00NNN000000100N0900000000870610000000005001997082700000000002000000000000001000000000012 0 NNY00000086200000013000000013700106000010.3020250930000000934 NNN +0144L0 KR70144L0006KODEX ̱ĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000096900000100001NNN00NNN030000100N0900000013043460000000000002025122300000000002940000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002876 NNN +0144M0 KR70144M0005KODEX ̱UAM TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000106400000100001NNN00NNN000000100N0900000003765960000000000002025122300000000000370000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000393 NNN +014530 KR7014530000صȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000034550000100001NNN00NNN000000060Y0900000000824360000000005001991013100000000003486900000000001743471000012 0 NNY00000748300000012800000005300024000001.2320250930000001204 NNN +014580 KR7014580005° ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000046450000100001NNN00NNN000000060Y0900000001118280000000005001991030700000000002758300000000001379155000012 0 NNY00000283700000031400000032700265000012.7720250930000001281 NNY +014680 KR7014680003ѼɹĮ ST2002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0002730000000100001NNN00NNN000000050Y0900000000778900000000050001989052000000000001133500000000005667597500012 0 NYY00000661500000139400000157201306000015.0620250930000030945924NNY +014710 KR7014710008Ǫ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000091300000100001NNN00NNN000000060Y0900000000971320000000010002012062900000000001721800000000001721854300012 0 NNY00000173500000010800000015300130000006.0120250930000001572144NNN +014790 KR7014790000HL D&I ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000028000000100001NNN00NNN000000060Y0900000001855690000000050001994081200000000003785800000000019437471000012 0 NNY00001208700000059500000019300150000002.6120250930000001060920NNN +014820 KR7014820005ý ST2002700080000 NN3NNN NNNNNNNNN0NNNNNNNN0000278500000100001NNN00NNN000000050Y0900000000543810000000050001994032900000000002899100000000014495641000012 0 NNY00001059500000058700000050300417000007.0720250930000008074359NNN +014825 KR7014821003ý ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000172700000100001NNN00NNN000000100N0900000000007150000000050001995012100000000000026400000000000132055500012 1 NNN00000000000000000000000000000000000000.00 000000045 NNN +014830 KR7014830004ϵ ST2002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000815000000100001NNN00NNN000000050Y0900000000526100000000050002004120300000000000676700000000003383800000012 0 NNY00000992400000080300000085400629000006.9420250930000005515378NNY +0148J0 KR70148J0006TIGER ڸ޸ӳ̵κ EF 000000000000NN 0NNN2NN N 0 Y 0000150600000100001NNN00NNN000000100N0900000154865050000000000002026010600000000004310000000000000000000000010 0 NNN00000000000000000000000000000000000000.00 000006490 NNN +014910 KR7014910004 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000020950000100001NNN00NNN000000100N0900000010768420000000005001990032400000000002246000000000001123049250012 0 NNY00000039500000001300000001900016000007.4820250930000000470 NNN +014915 KR7014911002ڿ ST0002700130000 YN0NNN NNNNNNNNN3NNNNNNNN0000048100000100001NNN00NNN000000100N0900000000044270000000005001990032400000000000060000000000000030000000012 1 NNN00000000000000000000000000000000000000.00 000000028 NNN +014990 KR7014990006ε ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000008010000100001NNN00NNN000000100N0900000002131660000000005001989062000000000007511200000000003755649750012 0 NNY000000742-00000017-00000036-0036000003.2520250930000000601LD4NNN +015020 KR7015020001̽Ÿ ST3002800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000005680000100001NNN00NNN000000100N0900000001939460000000005001988122300000000004285100000000002142580000012 0 NNY000000115-00000033-00000049-0049-00012.3920241231000000243 NNN +0150K0 KR70150K0008KoAct ESSƼ EF 000000000000NN 0NNN2NN N 0 Y 0000128400000100001NNN00NNN000000100N0900000006797840000000000002026011300000000000195000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000250 NNN +0151P0 KR70151P0002RISE ڸƼ EF 000000000000NN 0NNN2NN N 0 Y 0000120300000100001NNN00NNN000000100N0900000011549350000000000002026012000000000000390000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000469 NNN +0151S0 KR70151S0009KODEX ̱AIݵüTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000106450000100001NNN00NNN000000100N0900000018820310000000000002026011300000000001155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001229 NNN +015230 KR7015230006â ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000064300000100001NNN00NNN000000060Y0900000004146470000000005001989072500000000002857200000000001428611500012 0 NNY00000258700000030600000030000212000010.6120250930000001837 NNN +015260 KR7015260003̿ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000004260000100001NNN00NNN000000100N0900000001366790000000005001988011800000000004511600000000002255844700012 0 NNY000000931-00000051-00000075-0075-00047.6920250930000000192 NNN +0152E0 KR70152E0004SOL 缺žȾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000107400000100001NNN00NNN000000100N0900000002469240000000000002026011300000000000280000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000300 NNN +015360 KR7015360001INVENI ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000792000000100001NNN00NNN000000050Y0900000001131620000000050001996122400000000000570000000000003000000000012 0 NNY00000930000000090400000087500798000013.1720250930000004514FN2NNN +0153K0 KR70153K0005KODEX ȯ EF 000000000000NN 0NNN2NN N 0 Y 0000106650000100001NNN00NNN000000100N0900000013321600000000000002026012000000000000670000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000714 NNN +0153P0 KR70153P0000ACE εƼ EF 000000000000NN 0NNN2NN N 0 N 0000102000000100001NNN00NNN000000100N0900000006149040000000000002026012000000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000086 NNN +0153X0 KR70153X0000PLUS ̱־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000098900000100001NNN00NNN000000100N0900000002442860000000000002026012700000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000098 NNN +0154F0 KR70154F0001WON ʴIB& EF 000000000000NN 0NNN2NN N 0 Y 0000111800000100001NNN00NNN000000100N0900000002658170000000000002026012000000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000106 NNN +0154H0 KR70154H0009KoAct ̳̿コɾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000095200000100001NNN00NNN000000100N0900000000658710000000000002026012700000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000076 NNN +015590 KR7015590003DKME ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000005150000100001YNN00NYN000000100N0900000000000000000000005001989052700000000023698100000000011849077200012 0 NNY00000106100000009700000003700031000007.9820250930000001220 NNN +015760 KR7015760002ѱ ST1001700000000 NN7YYY YYNNNNNNN0NNNNNNNY0000594000000100001NNN00NNN000000050Y0900000035608720000000050001989081000000000064196400000000320982038500012 0 NYY00073746500011541400010246273281000019.4320250930000381326 NNY +015860 KR7015860000Ȧ ST3002100000000 NN0NNY NNNNNNNNN0NNNNYNNN0000073800000100001NNN00NNN000000050Y0900000001593190000000010001990032200000000004934700000000004985261500012 0 NNY00001602900000101300000103500776000008.7520250930000003641 NNN +015890 KR7015890007° ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000047200000100001NNN00NNN000000060Y0900000001175660000000005001996013000000000002922800000000001461437500012 0 NNY00000577400000042400000038100305000006.9720250930000001379 NNN +016090 KR7016090003 ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000016300000100001NNN00NNN000000100N0900000001115990000000005001990092000000000004428200000000002690615500012 0 NNY00000259300000014400000020100159000005.9920241231000000721 NNN +016360 KR7016360000Z ST1002100240000 NY6YNY NYNNNNNNN0NNNYNNNY0000883000000100001NNN00NNN000000050Y0900000007129840000000050001988032800000000008930000000000045847808000012 0 NYY00010562900001045100001060307922000012.5420250930000078851511NNN +016380 KR7016380008KGƿ ST2002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000055300000100001NNN00NNN000000050Y0900000008169270000000050001986020300000000010000800000000050004448500012 0 NNY00002448200000155900000132201033000007.4720250930000005530LC4NNY +016450 KR7016450009Ѽ24Ȧ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000040750000100001NNN00NYN000000060Y0900000000212270000000005002000010600000000004000000000000002000000000012 0 NNY000025365000000451000000054-0077-00008.2920250930000001630 NNN +016580 KR7016580003ȯ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000107200000100001NNN00NNN000000050Y0900000000431830000000005001996070300000000001860000000000000970003500012 0 NNY00000190100000011500000013200116000003.9520250930000001993 NNN +016590 KR7016590002Ŵ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000118500000100001NNN00NNN000000100N0900000000211430000000005001995122100000000004029700000000002014891000012 0 NNY00000481300000021700000028400225000005.3620250930000004775 NNN +016610 KR7016610008DB ST3002100240000 NN0NNN NNNNNNNNN0NNNNNNNN0000122900000100001NNN00NNN000000060Y0900000002254560000000050001988062700000000004244600000000021223194500012 0 NNY00001332200000101000000102200829000007.4520250930000005216LB9NNN +016710 KR7016710006뼺Ȧ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000086000000100001NNN00NNN000000060Y0900000000260070000000010001999122200000000001608900000000001608945900012 0 NNY00000873600000021400000022100162000005.6820250930000001383 NNN +016740 KR7016740003ο ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000040750000100001NNN00NNN000000060Y0900000003133920000000025002016072900000000002867400000000008122901750012 0 NNY00000602500000045700000046300322000013.5320250930000001168 NNN +016800 KR7016800005۽ý ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000427000000100001NNN00NNN000000100N0900000000030360000000010001996122400000000001150000000000001430000000012 0 NNY00000266100000003300000035000273000006.1420250930000004910 NNN +016880 KR7016880007 ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000024700000100001NNN00NNN000000100N0900000008892270000000005001994110500000000007992700000000004221354000012 0 NNY00000837700000054900000104000950000072.8920250930000001974 NNN +017040 KR7017040007 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000014250000100001NNN00NNN000000100N0900000005955470000000005001990091400000000004333700000000002166880750012 0 NNY000001424-00000088-00000378-0432-00044.3020241231000000617 NNN +017180 KR7017180001 ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000018250000100001NNN00NNN000000100N0900000001380500000000005002008071000000000003395300000000001697672700012 0 NNY00000144500000005200000002200006000001.6520250930000000619 NNN +017370 KR7017370008Žý ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000063600000100001NNN00NNN000000060Y0900000001423850000000005002002052800000000001831400000000000915702700012 0 NNY00000297800000014800000010300095000019.8820250930000001164 NNN +017390 KR7017390006ﰡ ST3001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000644000000100001NNN00NNN000000060Y0900000000083470000000050001995081800000000000500000000000003500000000012 0 NNY00001284300000013900000033500253000002.7320250930000003220 NNN +017550 KR7017550005꼼ƽ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000017150000100001NNN00NNN000000060Y0900000003888380000000005001991083000000000006239900000000003119956500012 0 NNY00000157500000012800000011700095000006.5120250930000001070 NNN +017670 KR7017670001SKڷ ST1002000000000 NYBYYY YYNNNNNNN0YNNNNNNY0000690000000100001NNN00NNN000000050Y0900000023810650000000001001989110700000000021479000000000003049271590012 0 NYY00012770500000954100000584402781000005.0120250930000148205535NNY +017800 KR7017800004뿤 ST2002700120000 NN2NNY NNNNNNNNN0NNNNYNNN0000910000000100001NNN00NNN000000050Y0900000002186060000000050001996070300000000003909200000000021223595500012 0 NYY00001832700000154900000298402367000026.0420250930000035574 NNY +017810 KR7017810003Ǯ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000131700000100001NNN00NNN000000060Y0900000000698980000000005001995100500000000003812000000000001906027100012 0 NNY00002521000000068900000022800105000009.2820250930000005020 NNY +017860 KR7017860008DSܼ ST3002700080000 N 0NNN NN N 0 N 0000197500000100001NNN00NNN000000060Y0900000001160560000000005002023122200000000001758400000000000879210600012 0 NNY000007247000000090-00000001-0005-00004.3620250930000003472 NNY +017900 KR7017900002 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000018950000100001NNN00NNN000000100N0900000001418030000000005001996101600000000005794300000000002897188150012 0 NNY00000103100000003000000003200026000003.2020250930000001098 NNN +017940 KR7017940008E1 ST2001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000855000000100001NNN00NNN000000060Y0900000000258790000000050001997082700000000000686000000000003430000000012 0 NNY00007449000000296800000201801428000000.0020250930000005865FN2NNN +017960 KR7017960006ѱī ST2002700110000 NN4NNY NNNNNNNNN0NNNNNNNN0000348500000100001NNN00NNN000000050Y0900000004203260000000005001995070800000000005190800000000002595422600012 0 NYY00000677000000092600000086500669000013.1120250930000018090 NNY +018250 KR7018250001ְ ST3002700080000 N 0NNN NN N 0 N 0000124900000100001NNN00NNN000000050Y0900000000740180000000010002018032200000000002640900000000002640993500012 0 NNY00000491600000024500000025100205000007.7320250930000003298615NNY +018260 KR7018260000Z𿡽 ST1002900000000 NN5YYY NYNNNNNNN0NNNNNNNN0001765000000100001NNN00NNN000000050Y0900000002785220000000005002014111400000000007737700000000003868890000012 0 NYY00010393100000731000000816405948000008.2220250930000136571511NNN +018470 KR7018470005Ͼ˹̴ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000012750000100001NNN00NNN000000060Y0900000009182670000000005001988112200000000012663100000000006331586050012 0 NNY00000498400000020100000012300110000005.6220241231000001614 NNY +018500 KR7018500009ݼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000016070000100001NNN00NNN000000100N0900000007325620000000005001995111000000000004675400000000002337746650003 0 NNY00000323600000021500000015500153000022.0220250930000000751 NNN +018670 KR7018670000SK ST2001600000000 NN0NNY NNNNNNNYN0NNNNNNNN0002275000000100001NNN00NNN000000050Y0900000000161270000000050001997082700000000000924500000000004622622000012 0 NYY00005657600000407000000312802508000010.6820250930000021032535NNN +018880 KR7018880005ѿ½ý ST2002700120000 NN8NNY NNYNNNNNN0NNNNNNNN0000033950000100001NNN00NNN000000050Y0900000118367210000000001001996073100000000102626200000000010262625520012 0 NYY00008181200000180700000048100176-00011.3520250930000034841912NNY +019170 KR7019170000dz ST2002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000132400000100001NNN00NNN000000100N0900000003162180000000005001990012000000000005298400000000002649249500012 0 NNY00000176600000010400000008100079-00001.6120250930000007015 NNN +019175 KR7019171008dz ST0002700090000 NN0NNN NNNNNNNNN3NNNNNNNN0000213500000100001NNN00NNN000000100N0900000000141350000000005001990012000000000000220000000000000110000000012 1 NNN00000000000000000000000000000000000000.00 000000469 NNN +019180 KR7019180009Ƽġ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000070900000100001NNN00NNN000000060Y0900000004468110000000005001996073100000000001800000000000000900000000012 0 NNY00000699900000045800000051700449000030.8520250930000001276 NNY +019440 KR7019440007Ư ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000188700000100001YNN00NNN000000060Y0900000000000000000000050002011060100000000000857000000000004285000000012 0 NNY00000728100000027300000020000162000005.8320250930000001617474NNN +019490 KR7019490002ťƮ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000005410000100001YNN00NNN000000100N0900000000000000000000005001998110400000000007643200000000003821613500012 0 NNY000000049-00000146-00000228-0266000000.0020250930000000413 NNN +019680 KR7019680008뱳 ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000017800000100001NNN00NNN000000100N0900000000405210000000005002004020300000000008470200000000004235142500012 0 NNY000004888000000009-00000042-0032-00003.8120250930000001507 NNN +019685 KR7019681006뱳B ST0002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000011850000100001NNN00NNN000000100N0900000000187140000000005002004020300000000001942600000000000971349500012 2 NNN00000000000000000000000000000000000000.00 000000230 NNN +020000 KR7020000006Ѽ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000171000000100001NNN00NNN000000050Y0900000006901780000000005001996070300000000002243700000000001231500000012 0 NNY00001028000000025000000029000226000002.5420250930000003836Z35NNN +020120 KR7020120002ŰٸƩ ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000032750000100001NNN00NNN000000100N0900000000886640000000005001996070300000000003706300000000001853188300012 0 NNY00000152800000006000000008700057000000.1320250930000001213DKGNNN +020150 KR7020150009ԵƼ ST2002700130000 NN0NNY NNNNNNNNN0NNNNNNNN0000428000000100001NNN00NNN000000060Y0900000008363320000000005002011030400000000005236500000000002618273150012 0 NYY000005066-00001114-00001635-1307-00008.1120250930000022412283NNY +020560 KR7020560009ƽþƳװ ST2001900000000 NN0NNY NNNNNNNNN0NNNNNNYN0000077800000100001NNN00NNN000000100N0900000002348540000000050002008032800000000020599000000000102995355500012 0 NNY000056426-00001492-00000174-0130-00049.2920250930000016026926NNN +020760 KR7020760005 ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000009020000100001YNN00NNN000000100N0900000000000000000000005002002010900000000005151300000000002575687050012 0 NNY000000540-00000043-00000063-0070-00019.9620250930000000464 NNN +021050 KR7021050000 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000012310000100001NNN00NNN000000100N0900000006401600000000005001996013000000000004747400000000002373729500012 0 NNY000012481000000223-00000031-0025-00007.0620250930000000584 NNN +021240 KR7021240007ڿ ST1002600000000 NN8YNY NYNNNNNNN0NNNNNNNY0000796000000100001NNN00NNN000000050Y0900000004103400000000005002001080700000000007190900000000004033509200012 0 NYY00003688200000697000000646604703000017.6720250930000057239LB6NNY +021820 KR7021820006 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000127400000100001NNN00NNN000000100N0900000000189040000000005001996070300000000001000000000000000500000000006 0 NNY00000039200000007900000014800139000007.7220250930000001274 NNN +022100 KR7022100002DX ST2002600000000 NN5YNY NNNNNNNNN1NNNNNNNN0000408500000100001NNN00NNN000000050Y0900000028984630000000005002024010200000000015203400000000007601736450012 0 NYY00000814400000061600000069600536000013.7420250930000062106853NNY +023000 KR7023000003 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000023600000100001NNN00NNN000000100N0900000000272910000000005002011072200000000004000000000000002000000000012 0 NNY00000343600000011800000015200132000005.3720241231000000944Z35NNN +023150 KR7023150006MHź ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000045400000100001NNN00NNN000000100N0900000000127350000000005001996122400000000000737800000000000459676300012 0 NNY00000071300000008400000007400065-00001.9820250930000000334 NNN +023350 KR7023350002ѱձ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000046350000100001NNN00NNN000000100N0900000000260690000000005002011042800000000001095000000000000547500000012 0 NNY00000290400000001800000004800028000000.0020250930000000507 NNN +023450 KR7023450000ռ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000316500000100001NNN00NNN000000100N0900000000015320000000005001996122400000000000350000000000000312556400012 0 NNY00000186400000008900000008200067000012.7220241231000001107 NNN +023530 KR7023530009Ե ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNN0000766000000100001NNN00NNN000000060Y0900000001101420000000050002006020900000000002828800000000014144377500012 0 NYY000102165000003194000000057-0409-00008.5020250930000021669283NNY +023590 KR7023590003ٿ ST2002900000000 NN0NNY NNNNNNNNN0NNNNNNNN0000514000000100001NNN00NNN000000050Y0900000003611740000000005001997082700000000004486600000000002243330850012 0 NYY00011808400001200800001230708951000000.0020250930000023061DKGNNY +023800 KR7023800006Ʈѽ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000071400000100001NNN00NNN000000100N0900000001192530000000005001997062300000000001580900000000000790459850012 0 NNY00000539000000034200000034000268000007.5420250930000001128 NNN +023810 KR7023810005 ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000093300000100001NNN00NNN000000100N0900000001333950000000005002004092100000000001000000000000000500000000012 0 NNY00000443200000024400000016500137000003.9920250930000000933 NNN +023960 KR7023960008Ͼ ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000015640000100001NNN00NNN000000100N0900000004850980000000005001997062300000000003803500000000001901798750012 0 NNY000001276-00000059-00000049-0060-00014.3520250930000000594 NNN +024070 KR7024070005WISCOM ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000018640000100001NNN00NNN000000100N0900000000333810000000005001996112200000000001532600000000000766321900012 0 NNY000000792-0000001800000000100000-00020.8720250930000000285 NNN +024090 KR7024090003𾾿 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000118600000100001NNN00NNN000000100N0900000000050410000000005001999081800000000001140000000000000600000000012 0 NNY00000240900000017000000023000189000007.5420241231000001352 NNN +024110 KR7024110009 ST1002100000000 NY6YYY NYNNNYNNN0NNNNNNNY0000217500000100001NNN00NNN000000050Y0900000014102000000000050002003122400000000079742500000000398712934500012 0 NYY00021760000002928200002991622597000007.8520250930000173440 NNN +024720 KR7024720005ݸȦ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000100200000100001NNN00NNN000000050Y0900000000690620000000005002002040900000000003429600000000001848073950012 0 NNY00000493600000016600000055700457000007.5020250930000003436 NNY +024890 KR7024890006ȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000008800000100001NNN00NNN000000100N0900000000563670000000005001997102800000000004124900000000002062457600012 0 NNY000000953000000016-00000027-0031-00020.6120250930000000362 NNN +024900 KR7024900003̴ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000022450000100001NNN00NNN000000100N0900000001991950000000005001997062300000000003256400000000001628249000012 0 NNY000012992-00000012-00000011-0007000008.2520250930000000731 NNN +025000 KR7025000001KPXɹĮ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000484000000100001NNN00NNN000000050Y0900000000066710000000050001994122700000000000437800000000002189354500012 0 NNY00000648100000032000000056300421000008.7220250930000002119 NNN +025530 KR7025530007SJMȦ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000036950000100001NNN00NNN000000100N0900000000150900000000005001997021200000000001493400000000000746700400012 0 NNY00000155400000011500000018300141000006.2920250930000000551 NNN +025540 KR7025540006ѱ ST2002700130000 NN0NNY NNNNNNNNN0NNNNYNNN0000745000000100001NNN00NNN000000050Y0900000000869080000000005001996101600000000001011500000000000520750000012 0 NNY00001105900000106100000109600832000010.1320250930000007535 NNY +025560 KR7025560004̷ ST3002700140000 NN0NNN NNNNNNNNN0NNNNNNNN0000132700000100001NNN00NNN000000100N0900000000560500000000005001996112200000000000448200000000000224132700012 0 NNY00000034200000007300000007800078000010.0920250930000000594 NNN +025620 KR7025620006AIコɾ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000106800000100001NNN00NNN000000100N0900000000566880000000005001995070800000000001820300000000000910198650012 0 NNY000000053-00000055-00000032-0032-00019.4620250930000001944 NNN +025750 KR7025750001ѼȨ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000006080000100001NNN00NNN000000100N0900000002500660000000010002003110400000000008056500000000008376514900012 0 NNY00000214900000002200000002200010-00012.1620250930000000489924NNN +025820 KR7025820002̱ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000058900000100001NNN00NNN000000060Y0900000008552470000000005001995081800000000003344200000000001672100000012 0 NNY00000472300000025200000016000126000009.6120241231000001969 NNY +025860 KR7025860008ȭ ST3002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000066700000100001NNN00NNN000000050Y0900000003134030000000010001995111000000000004967800000000004967884300012 0 NNY00001224200000050500000044300327000006.5220250930000003313E56NNN +025890 KR7025890005ѱְ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000017930000100001NNN00NNN000000100N0900000001858540000000005001997071800000000001130900000000000565462950012 0 NNY00000047300000001100000000800008000002.2720241231000000202 NNN +026890 KR7026890004ƽκƮƮ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000111500000100001NNN00NNN000000060Y0900000001043860000000005001997112500000000004167800000000002083908750012 0 NNY00000061300000003100000003100023000000.2820250930000004647 NNN +026940 KR7026940007αö ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000020500000100001NNN00NNN000000100N0900000000649480000000005002008101400000000002000000000000001000000000012 0 NNY00000181800000000100000003000023000001.7720241231000000410 NNN +026960 KR7026960005 ST2001600000000 NN7NNY NNNNNNNNN0NNNNNNNN0000259000000100001NNN00NNN000000050Y0900000001166600000000005002016071500000000009970000000000004985000000012 0 NYY00000403000000037000000131401193000008.5720250930000025822 NNY +027410 KR7027410000BGF ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000039950000100001NNN00NNN000000060Y0900000001299840000000010002014051900000000009571600000000009571679100012 0 NNY00000357400000049300000048600448000003.3020250930000003823LD7NNN +027740 KR7027740000Ŀ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000007680000100001NNN00NNN000000100N0900000001829690000000005002002102900000000006351100000000003175561400012 0 NNY000002669000000000-00000016-0016-00017.5620250930000000487 NNN +027970 KR7027970003ѱ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000007860000100001NNN00NNN000000100N0900000001576790000000010001996070300000000019017800000000019017823700012 0 NNY00000572700000006400000003800056-00000.4520250930000001494 NNN +028050 KR7028050003ZE&A ST1002600000000 NN1YNY NYNNNNNNN0NYNNNNNY0000321500000100001NNN00NNN000000050Y0900000020844960000000050001996122400000000019600000000000098000000000012 0 NYY00006271600000514700000595004563000012.6620250930000063014511NNN +028100 KR7028100006 ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000173000000100001NNN00NNN000000100N0900000000173470000000005002009061200000000001338900000000000702632300012 0 NNY00000340300000013000000015100121000007.0220250930000002316 NNN +028260 KR7028260008Z ST1001600000000 NN1YYY YYNNNNNNN0NNNNNNNN0003020000000100001NNN00NNN000000050Y0900000003700550000000001002014121800000000016997600000000001837027810012 0 NYY00029909800002470500003161623484000005.7720250930000513329511NNN +02826K KR702826K016ZB ST0001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0001884000000100001NNN00NNN000000050Y0900000000075370000000001002015091500000000000146700000000000014675900012 9 NNN00000000000000000000000000000000000000.00 000002764 NNN +028670 KR7028670008ҿ ST2001900000000 NN9NNY NNNNNNNNN0NNNNNNYN0000046900000100001NNN00NNN000000050Y0900000051668010000000010002007092100000000053456900000000053456951200012 0 NYY00003956600000361500000261702527000004.1420250930000025071HRMNNY +029460 KR7029460003̾ ST3002700140000 NN0NNY NNNYNNNNN0NNNNNNNN0000327000000100001NNN00NNN000000050Y0900000001104020000000005001997112500000000001323100000000000677702200012 0 NNY00000621200000042900000055700465000009.1720250930000004326 NNN +029530 KR7029530003ŵ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000478000000100001NNN00NNN000000050Y0900000000071370000000050001996122400000000001008000000000005040014500012 0 NNY00000230700000003100000014300120000004.1720250930000004818 NNN +029780 KR7029780004Zī ST1002100000000 NY6YNY NNNNNNNNN0NNNNNNNY0000564000000100001NNN00NNN000000050Y0900000001051000000000050002007062700000000011585800000000061479445500012 0 NYY00003332500000659000000664404973000007.3820250930000065344511NNN +030000 KR7030000004ϱȹ ST2002600000000 NNBNNY NNNNNNNNN0NNNNNNNN0000209000000100001NNN00NNN000000050Y0900000003885930000000002001998030300000000011504100000000002300824500012 0 NYY00003347200000246500000215301442000012.8320250930000024043511NNN +030190 KR7030190003NICE ST2002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000170100000100001NNN00NNN000000050Y0900000000743870000000005002023080800000000005891100000000003035741000012 0 NNY00000444600000079500000082600649000020.1420250930000010020 NNN +030200 KR7030200000KT ST1002000000000 NYBYYY NYNNNNNNN0YNNNNNNY0000559000000100001NNN00NNN000000050Y0900000005164440000000050001998122300000000025202100000000156449883500012 0 NYY00021399200002241800002280217453000005.5520250930000140880905NNY +030210 KR7030210009ٿ ST3002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000038150000100001NNN00NNN000000100N0900000001896660000000050001996111900000000006091100000000030455553000012 0 NNY00001241300000037100000053200416000002.0720250930000002323 NNN +030610 KR7030610000 ST2002100240000 NN0NNY NNNNNNNNN0NNNYNNNN0000115300000100001NNN00NNN000000050Y0900000001533790000000050002002071800000000011396200000000056981480500012 0 NYY00003196500000178300000189701369000005.9020250930000013139KYBNNN +030720 KR7030720007 ST3000000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000058400000100001NNN00NNN000000100N0900000000188330000000050001996112200000000000465300000000002326902500012 0 NNY00000133600000007600000007400063000014.2020250930000000271 NNN +031210 KR7031210008ﺸ ST2002100250000 N 0NNY NN N 0 N 0000490500000100001NNN00NNN000000050Y0900000000623640000000025002025031400000000006982100000000017455399500012 0 NYY00002082400000192800000191801466000004.4620250930000034247 NNN +031430 KR7031430002żͳų ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000117200000100001NNN00NNN000000050Y0900000001473380000000010002011071400000000003534300000000003570000000012 0 NNY00000923200000000300000004200025000000.2720250930000004142577NNY +031440 KR7031440001żǪ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000475000000100001NNN00NNN000000060Y0900000000064580000000050002010042900000000000387200000000001936240000012 0 NNY00000919500000011000000010000264000007.7120250930000001839577NNN +031820 KR7031820004ƼƼ ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000006020000100001NNN00NNN000000100N0900000006040040000000005001997021200000000012105100000000006052573300012 0 NNY00000718600000004200000029500212000009.4820250930000000728 NNN +032350 KR7032350001Ե ST2002600000000 NN0NNY NNNNNNNNN0NNNNNNNN0000219000000100001NNN00NNN000000100N0900000005437780000000005002006060800000000007953900000000003976974200012 0 NYY000004663000000991-00000123-0113-00016.1820250930000017419 NNN +032560 KR7032560005ȲݿƼ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000058500000100001NNN00NNN000000100N0900000000544510000000005002009102900000000001700000000000000850000000012 0 NNY00000231200000013300000021900165000004.6220250930000000994 NNN +032640 KR7032640005LG÷ ST1002000000000 NNBYNY NYNNNNNNN0YNNNNNNY0000160200000100001NNN00NNN000000050Y0900000008319870000000050002008042100000000042982800000000257396917500012 0 NYY00011603300000721600000577704287000004.3420250930000068858282NNY +032830 KR7032830002Z ST1002100250000 NY6YYY YYNNNNNNN0NNNNNYNY0001922000000100001NNN00NNN000000050Y0900000004078990000000005002010051200000000020000000000000010000000000012 0 NYY00026807500002485200002805822320000006.4520250930000384400511NNN +033240 KR7033240003ȭ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000228500000100001NNN00NNN000000050Y0900000002010480000000005001999010600000000002175600000000001107793500012 0 NNY00000584900000015300000014700129000004.3320250930000004971 NNY +033250 KR7033250002üý ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000010270000100001NNN00NNN000000100N0900000002415680000000005001999081100000000003200000000000001600000000012 0 NNY00000069400000005400000003900039000022.7620250930000000328 NNN +033270 KR7033270000Ƽ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000189000000100001NNN00NNN000000050Y0900000000373220000000005002007102300000000001633300000000000816691100012 0 NNY00000288700000056300000046100325000008.2720241231000003087 NNN +033530 KR7033530007SJG ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000110600000100001NNN00NNN000000050Y0900000009746160000000005002002092500000000002782000000000001391048050012 0 NNY00001403800000084100000085000705000013.9220250930000003076 NNN +033780 KR7033780008KT&G ST1002700050000 NY7YYY YYNNNNNNN0NNNNNNNN0001435000000100001NNN00NNN000000050Y0900000002816180000000050001999100800000000011797600000000095495948500012 0 NYY00004865900001100700001070608202000012.5320250930000169296KTGNNN +033920 KR7033920000 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000089000000100001NNN00NNN000000050Y0900000000320830000000002002010072000000000002850000000000000570000000012 0 NNY00000109000000008100000052200408000008.8720250930000002536 NNN +034020 KR7034020008λ꿡ʺƼ ST1002700120000 NN2YYY YYNNNNNNN0NNNNYNNY0000920000000100001NNN00NNN000000050Y0900000069376940000000050002000102500000000064056100000000320280573000012 0 NYY00012197900000550600000322801526-00001.3520250930000589316391NNY +034120 KR7034120006SBS ST3003000000000 NN0NNY NNNNNNNNN0YNNNNNNN0000188100000100001NNN00NNN000000050Y0900000000630960000000050002003062500000000001855100000000009275619000012 0 NNY00000713700000013200000012100092000004.9020250930000003489844NNY +034220 KR7034220004LG÷ ST1002700130000 NN5YNY NYNNNNNNN0NNNNNNNY0000121300000100001NNN00NNN000000060Y0900000043848510000000050002004072300000000050000000000000250000000000012 0 NYY00018609200000348500000873306550-00004.8920250930000060650282NNY +034230 KR7034230003Ķ̽ ST2003000000000 NN8NNY NNNNNNNNN0NNNNNNNN0000169600000100001NNN00NNN000000050Y0900000007129090000000005002024062400000000009240500000000004803436350012 0 NYY00000856000000139600000125001089000006.3420250930000015671141NNY +034310 KR7034310003NICE ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000132700000100001NNN00NNN000000050Y0900000000404510000000005002004020400000000003675700000000001894115000012 0 NNY00002378300000160500000118600790000007.6920250930000004877 NNN +034590 KR7034590000õð ST3001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000255500000100001NNN00NNN000000100N0900000000030670000000050002006110700000000000437400000000002187377000012 0 NNY00000943600000019400000024400193000008.8520241231000001117 NNN +034730 KR7034730002SK ST1002100000000 NY4YYY YYNNNNNNN0NNNNNNNY0003055000000100001NNN00NNN000000050Y0900000002898140000000002002009111100000000007250200000000001602986580012 0 NYY00092413300000809500005354172475000006.9420250930000221495535NNY +03473K KR703473K016SK ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0002230000000100001NNN00NNN000000060Y0900000000065300000000002002015081700000000000056600000000000011322700012 9 NNN00000000000000000000000000000000000000.00 000001262 NNN +034830 KR7034830000ѱŹ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000012000000100001NNN00NNN000000100N0900000006604880000000010002016071100000000025248900000000025248923000012 0 NNY000001247-00000156-00000004-0023-00000.0520250930000003029 NNN +035000 KR7035000009HSֵ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000082200000100001NNN00NNN000000060Y0900000000401420000000010001999081100000000001620700000000001757149300012 0 NNY000002720-00000038-00000039-0050000007.0120250930000001332282NNN +035150 KR7035150002 ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000125000000100001NNN00NNN000000060Y0900000000477170000000005001999081100000000002055800000000001415500000012 0 NNY00000390700000046200000041000287000018.5520250930000002569 NNN +035250 KR7035250000 ST1003000000000 NY8YNY NYNNNNNNN0NNNNNNNN0000174300000100001NNN00NNN000000050Y0900000008439050000000005002003090400000000021394000000000010697025000012 0 NYY00001111300000205500000323502505000009.4020250930000037289 NNY +035420 KR7035420009NAVER ST1002900000000 NNBYYY YYNNNNNNN0NNNNNNNN0002775000000100001NNN00NNN000000050Y0900000028225310000000001002008112800000000015685200000000001648133950012 0 NYY00008839900001597500002120616557000008.4620250930000435266LB4NNY +035510 KR7035510007ż I&C ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000180300000100001NNN00NNN000000050Y0900000001769090000000005002006051800000000001398000000000000699045000012 0 NNY00000517100000036700000041000337000011.0320250930000002520577NNY +035720 KR7035720002īī ST1002900000000 NNBYYY YYNNNNNNN0NNNNNNNN0000618000000100001NNN00NNN000000050Y0900000034960090000000001002017071000000000044249500000000004429952200012 0 NYY00005978600000499400000642505650000000.0020250930000273462KAONNN +036420 KR7036420008Ʈ߾ ST3003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000074700000100001NNN00NNN000000100N0900000001473270000000050002019101800000000001926200000000009631154000012 0 NNY000008194000000009-00001009-0828-00253.3420250930000001438LB2NNN +036460 KR7036460004ѱ ST2001700000000 NN7YNY NNNNNNNNN0NNNNNNNY0000399000000100001NNN00NNN000000060Y0900000003864790000000050001999121500000000009231300000000046156500000012 0 NYY00026735000001627600000730405391000008.0620250930000036832 NNY +036530 KR7036530004SNTȦ ST2002100000000 NN0NNY NNYNNNNNN0NNNNNNNN0000563000000100001NNN00NNN000000050Y0900000000222040000000005002002102200000000001630300000000000835194300012 0 NNY00001544700000203300000228101652000010.9020250930000009179 NNN +036570 KR7036570000Ʈ ST1002900000000 NNBYNY NYNNNNNNN0NNNNNNNN0002325000000100001NNN00NNN000000050Y0900000001119340000000005002003052200000000002154400000000001097701100012 0 NYY00001102700000012800000433103489000010.4620250930000050089 NNY +036580 KR7036580009ʽ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000029150000100001NNN00NNN000000100N0900000001901100000000005001999102500000000003672700000000001836397150012 0 NNY00001149800000064500000062700479-00015.3420250930000001070HRMNNN +037270 KR7037270006YG PLUS ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000071700000100001NNN00NNN000000050Y0900000015679310000000005002003080100000000006366300000000003245655500012 0 NNY00000177200000014300000028000220000012.3620250930000004564 NNY +037560 KR7037560000LGκ ST3003000000000 NN0NNY NNNNNNNNN0YNNNNNNN0000023050000100001NNN00NNN000000060Y0900000001184040000000025002012110900000000007744600000000019361716250012 0 NNY00000966100000026600000017600122-00020.1420250930000001785282NNN +037710 KR7037710001ֽż ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000310500000100001NNN00NNN000000060Y0900000000197260000000010002002020700000000000795700000000000795719000012 0 NNY00000183600000052300000061300462000005.5820241231000002470577NNN +039130 KR7039130000ϳ ST2002600000000 NN0NNY NNNNNNNNN0NNNNNNNN0000456500000100001NNN00NNN000000100N0900000000913560000000005002011110100000000001548900000000000801959250012 0 NYY00000411700000030200000038700347000045.1120250930000007071 NNN +039490 KR7039490008Ű ST1002100240000 NN6NNY NNNNNNNNN0NNNYNNNN0003950000000100001NNN00NNN000000050Y0900000001809950000000050002009080300000000002702500000000014387861000012 0 NYY00011535500001142600001181708681000017.0920250930000106751DKGNNY +039570 KR7039570007HDC ST3001800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000081700000100001NNN00NNN000000100N0900000000328150000000005002015092400000000002595700000000001297880050012 0 NNY00000487300000008800000013000093000008.2220250930000002120HDCNNN +041650 KR7041650003ź극ũ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000027700000100001NNN00NNN000000100N0900000000482080000000005002004102700000000002147100000000001073572500012 0 NNY000004224-00000042-00000159-0171-00003.5520250930000000594 NNN +042660 KR7042660001ȭ ST1002700150000 NN2YYY YYNNNNNNN0NNNNYNNY0001434000000100001NNN00NNN000000050Y0900000019914920000000050002001020200000000030641300000000153706697000012 0 NYY00009460600000920100000640506336000025.1520250930000439396913NNY +042670 KR7042670000HDھ ST2002700120000 NY0NNY NNNNNNNNN0NNNNYNNY0000000000000100001YNN00NNN000000050Y0900000000000000000000010002001020200000000018885100000000019953861800012 0 NNY00003333200000254600000190001345000007.1320250930000000000IC5NNN +042700 KR7042700005ѹ̹ݵü ST1002700120000 NN5YYY YYNYNNNNN0NNNNNNNN0001820000000100001NNN00NNN000000050Y0900000022207920000000001002005072200000000009531200000000001271642050012 0 NYY00000493700000223800000243301851000040.0120250930000173468 NNY +044380 KR7044380004ֿũ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000004090000100001NNN00NNN000000100N0900000001332890000000002002006111500000000006448100000000001328077040012 0 NNY000000489-00000014-00000014-0014-00007.8620250930000000263 NNN +044450 KR7044450005KSSؿ ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000088800000100001NNN00NNN000000060Y0900000001956130000000005002007102600000000002308500000000001159294000012 0 NNY00000414000000080600000024200230000011.3120250930000002050 NNN +044820 KR7044820009ڽƽƼ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000130400000100001NNN00NNN000000060Y0900000000387620000000005002006111300000000000960300000000000480196050012 0 NNY000004715000000196000000039-0018000005.0120250930000001252 NNN +047040 KR7047040001Ǽ ST2001800000000 NN1NNY NNNNNNNNN0NYNNNNNN0000051900000100001NNN00NNN000000050Y0900000111368620000000050002001032300000000041562200000000207811319000012 0 NYY000063406000002901-00000111-0379-00000.6720250930000021570123NNN +047050 KR7047050000ͳų ST1001600000000 NN9YNY NYNNNNNNN0NNNNNNNN0000639000000100001NNN00NNN000000050Y0900000009863300000000050002001032300000000017592200000000087961394000012 0 NYY00024546100000899700000657705040000006.1320250930000112414853NNY +047400 KR7047400007Ͽ¸Ƽ ST3002700100000 NN0NNN NNNNNNNNN0NNNNNNNN0000015240000100001NNN00NNN000000100N0900000004632410000000005002009092900000000004200000000000002100000000012 0 NNY000000783000000018-00000016-0026-00117.1320250930000000640 NNN +047810 KR7047810007ѱװ ST1002700150000 NN9YNY YYNNNNNNN0NNNNNNNN0001668000000100001NNN00NNN000000050Y0900000008860280000000050002011063000000000009747500000000048737553500012 0 NYY00002229700000192200000150001252000007.8520250930000162588LA9NNY +049800 KR7049800006ö ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000020300000100001NNN00NNN000000100N0900000000485910000000005002006052400000000002000000000000001000000000012 0 NNY000001469000000004-00000020-0017000003.7220250930000000406 NNN +051600 KR7051600005KPS ST2001800000000 NN9NNY NNNNNNNNN0NNNNNNNY0000578000000100001NNN00NNN000000050Y0900000003107070000000002002007121400000000004500000000000000900000000012 0 NYY00001135700000120900000131901048000010.7620250930000026010 NNY +051630 KR7051630002ȭ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000024350000100001NNN00NNN000000100N0900000001356700000000005002001012900000000002120000000000001060000000012 0 NNY000000245-00000041-00000045-0045-00012.5820241231000000516 NNN +051900 KR7051900009LGȰǰ ST1002700080000 NN7YNY NYNNNNNNN0NNNNNNNY0002750000000100001NNN00NNN000000050Y0900000000693860000000050002001042500000000001530200000000007809098500012 0 NYY00004882700000243400000221901654000001.1620250930000042081282NNN +051905 KR7051901007LGȰǰ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0001156000000100001NNN00NNN000000050Y0900000000229920000000050002001042500000000000209900000000001049848500012 1 NNN00000000000000000000000000000000000000.00 000002427 NNN +051910 KR7051910008LGȭ ST1002700080000 NN4YYY YYNNNNNYN0NNNNNNNY0003540000000100001NNN00NNN000000050Y0900000004566930000000050002001042500000000007059200000000035296171500012 0 NYY00034735000000280200000709105958-00004.5420250930000249896282NNY +051915 KR7051911006LGȭп ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0001782000000100001NNN00NNN000000050Y0900000000659350000000050002001042500000000000768800000000003844400000012 1 NNN00000000000000000000000000000000000000.00 000013701 NNY +052690 KR7052690005 ST2002600000000 NN1NNY YNNNNNNNN0NYNNNNNN0001339000000100001NNN00NNN000000050Y0900000005969720000000002002009121400000000003822000000000000764400000012 0 NYY00000313300000009000000100200775000017.8420250930000051176 NNY +053210 KR7053210001ī̶ ST3003000000000 NN0NNY NNNNNNNNN0YNNNNNNN0000048700000100001NNN00NNN000000060Y0900000001017280000000025002011060300000000004752200000000011955491500012 0 NNY00000737000000034600000033800248-00018.7220250930000002314905NNN +053690 KR7053690004ѹ̱۷ι ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000189700000100001NNN00NNN000000060Y0900000000934730000000005002009062300000000001095700000000000547877500012 0 NNY00000336200000024000000025800188000011.8620250930000002078 NNY +055490 KR7055490007ѽ ST3002700080000 N 0NNN NN N 0 N 0000153900000100001NNN00NNN000000100N0900000000564280000000005002017103100000000000476900000000000379782500012 0 NNY000001043000000013-0000001200001000001.2120250930000000734924NNN +055550 KR7055550008 ST1002100000000 NY6YYY YYNNNYNNN0NNNNNNNY0000838000000100001NNN00NNN000000050Y0900000013832110000000050002001091000000000048549400000000269558606000012 0 NYY00034117700005913100006028345465000008.5520250930000406844 NNY +057050 KR7057050007Ȩ ST2001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000553000000100001NNN00NNN000000050Y0900000000110360000000050002010091300000000001200000000000006000000000012 0 NNY00002757600000103000000126100871000003.6820250930000006636Z35NNN +058430 KR7058430000ڽƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000426000000100001NNN00NNN000000060Y0900000000719600000000050002002081600000000000600000000000003000000000012 0 NNY00000843900000022300000022400180000007.1920250930000002556853NNN +058650 KR7058650003Ȧ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0001603000000100001NNN00NNN000000100N0900000000063300000000050002001073000000000000400000000000002000000000012 0 NNY00004894300000134400000112900834000001.1720250930000006412474NNN +058730 KR7058730003ٽ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000031750000100001NNN00NNN000000100N0900000000817130000000005002004080200000000001888800000000001004447050012 0 NNY000001775-00000047-00000083-0071-00003.3220250930000000599 NNN +058850 KR7058850009KTcs ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000027750000100001NNN00NNN000000060Y0900000002442810000000005002010091600000000004268500000000002384250000012 0 NNY00000752200000028600000029000226000012.5020250930000001184905NNY +058860 KR7058860008KTis ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000027650000100001NNN00NNN000000100N0900000000875790000000005002010121700000000003480200000000001740100000012 0 NNY00000436400000020700000021400341000000.0020250930000000962905NNN +060980 KR7060980000HLȦ ST3002100000000 NN0NNY NNYNNNNNN0NNNNNNNN0000457000000100001NNN00NNN000000050Y0900000000343800000000050002010051900000000000921300000000005508618000012 0 NNY00000994900000053500000023000181000001.0420250930000004210920NNN +062040 KR7062040001 ST2002700130000 N 2NNY NN N 0 N 0001504000000100001NNN00NNN000000050Y0900000005100070000000005002024072900000000003054500000000001527260000012 0 NYY00000359800000126300000133701059000000.0020250930000045939 NNY +063160 KR7063160006ٴ̿ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000217500000100001NNN00NNN000000100N0900000000591320000000025002001121100000000000548500000000001371490500012 0 NNY00000171800000011000000009200087000006.8520241231000001193 NNN +064350 KR7064350002 ST1002700150000 NN2YYY YYNNNNNNN0NNNNYNNN0002230000000100001NNN00NNN000000050Y0900000014002140000000050002013103000000000010914200000000054571146500012 0 NYY00004213400000738200000716605451000028.7720250930000243387BH1NNY +064400 KR7064400005LG ST1002900000000 N 5NNY NY N 0 N 0000692000000100001NNN00NNN000000050Y0900000119860140000000005002025020500000000009688500000000005204270850012 0 NYY00004193900000339900000360802615000016.6420250930000067045282NNY +064960 KR7064960008SNTƼ ST2002700150000 NN0NNY NNYNNNNNN0NNNNNNNN0000366500000100001NNN00NNN000000050Y0900000000892740000000050002002031100000000002654000000000013270136000012 0 NNY00000714800000071700000075400567000009.1920250930000009727 NNY +066570 KR7066570003LG ST1002700130000 NN5YYY YYNNNNNNN0NNNNNNNY0000999000000100001NNN00NNN000000050Y0900000012733830000000050002002042200000000016288600000000081823907000012 0 NYY00065348700002587400002447019463000004.9920250930000162723282NNY +066575 KR7066571001LGڿ ST0002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000506000000100001NNN00NNN000000050Y0900000001496980000000050002002042200000000001718500000000008592996000012 1 NNN00000000000000000000000000000000000000.00 000008696 NNY +066970 KR7066970005ؿ ST2002700130000 NN9NNY NNNNNNNNN0NNNNNNNN0001367000000100001NNN00NNN000000100N0900000015745090000000005002024012900000000004023900000000002011986700012 0 NYY000015372-00002393-00003922-3421-00075.8620250930000055007 NNN +067830 KR7067830000̺I&C ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000029550000100001NNN00NNN000000060Y0900000002917970000000010002002072500000000004104000000000004104089500012 0 NNY00000117200000007800000016100126000002.6420241231000001212 NNN +068270 KR7068270008Ʈ ST1002700090000 NNAYYY YYNNYNNNN0NNNNNNNN0002185000000100001NNN00NNN000000050Y0900000012967330000000010002018020900000000023096000000000023936165600012 0 NYY00002832300000693300000625905036000004.3920250930000504649LB3NNY +068290 KR7068290006Zǻ ST3003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000108900000100001NNN00NNN000000100N0900000000280500000000005002002080500000000001000000000000000500000000012 0 NNY000000406-0000000200000012600109000006.3420241231000001089 NNN +069260 KR7069260008TKGͽ ST2002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0000196600000100001NNN00NNN000000100N0900000002153990000000010002002100700000000004087800000000004087858800012 0 NNY00000851200000061000000078700603000007.8320250930000008036 NNN +069460 KR7069460004ȣ̿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000014170000100001NNN00NNN000000060Y0900000004884710000000005002002111100000000008707100000000004353597600012 0 NNY00000161300000005500000003300039000000.0020250930000001233 NNN +069500 KR7069500007KODEX 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000760950000100001NNN00NNN030000050Y0900000139789660000000000002002101400000000019130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000145722 NNY +069620 KR7069620003 ST2002700090000 NNANNY NNNNYNNNN0NNNNNNNN0001705000000100001NNN00NNN000000050Y0900000000442770000000025002002110100000000001158600000000002896643750012 0 NYY00001173800000153400000122901072000010.9820250930000019755 NNY +069640 KR7069640001Ѽ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000006400000100001NNN00NNN000000100N0900000000682000000000005002011062100000000004480600000000002240325100012 0 NNY000001733-00000202-00000281-0297-00106.5320250930000000286 NNN +069660 KR7069660009KIWOOM 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000759200000100001NNN00NNN030000050Y0900000004389160000000000002002101400000000000920000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007001 NNN +069730 KR7069730000DSR ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000037900000100001NNN00NNN000000100N0900000000291910000000005002003012800000000001440000000000000720000000012 0 NNY00000169300000022200000023000181000000.0020250930000000545 NNN +069960 KR7069960003ȭ ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNY0000885000000100001NNN00NNN000000050Y0900000002054040000000050002002112500000000002262800000000011701220500012 0 NYY00003188600000272000000264301905000004.0220250930000020026Z35NNN +070960 KR7070960000𳪿 ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000032000000100001NNN00NNN000000060Y0900000000937490000000050002016052700000000004813300000000024066666500012 0 NNY00000208000000023800000011800093000001.8620250930000001540 NNN +071050 KR7071050009ѱ ST1002100000000 NN6YNY NYNNNNNNN0NNNYNNNN0002025000000100001NNN00NNN000000050Y0900000002742380000000050002003072100000000005572500000000027862996000012 0 NYY00015942200001964300002270616745000017.0220250930000112845 NNY +071055 KR7071051007ѱֿ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0001458000000100001NNN00NNN000000050Y0900000000237910000000050002003072100000000000585800000000002929125500012 1 NNN00000000000000000000000000000000000000.00 000008541 NNN +071090 KR7071090005̽ƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000036800000100001NNN00NNN000000100N0900000002631940000000005002003021700000000002019100000000001009573550012 0 NNY000001834-00000012-00000032-0026000000.2620250930000000743 NNN +071320 KR7071320006 ST2001700000000 NN7NNY NNNNNNNNN0NNNNNNNN0001011000000100001NNN00NNN000000060Y0900000000291410000000050002010012900000000001157800000000005789372000012 0 NYY00002958100000403600000336002609000014.7720250930000011706 NNN +071840 KR7071840003Ե̸Ʈ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000072500000100001NNN00NNN000000060Y0900000000382620000000050002011062900000000002360700000000011803856000012 0 NNY000023567000000017-00002869-3054-00028.0520241231000001711283NNN +071950 KR7071950000ھƽ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000047500000100001NNY00NNN000000100N0900000001255210000000005002005080400000000001181300000000000590655050012 0 NNY000000432-00000047-00000302-0306-00179.3120250930000000561 NNN +071970 KR7071970008HD븶 ST2002700120000 NN2NNY NNNNNNNNN0NNNNNNNN0000903000000100001NNN00NNN020000050Y0900000004270940000000025002009051500000000003392100000000008480373750012 0 NYY00000291400000048000000057600530000030.8620250930000030631IC5NNY +072130 KR7072130008 ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000046550000100001NNN00NNN000000100N0900000006695040000000005002003070100000000001289500000000000659772700012 0 NNY00000046600000003100000004600039000009.1320250930000000600 NNN +072710 KR7072710007Ȧ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000880000000100001NNN00NNN000000050Y0900000000204100000000050002003073000000000000463700000000002318895000012 0 NNY00000631500000066500000108201038000008.5020250930000004081LC8NNY +073240 KR7073240004ȣŸ̾ ST2002700080000 NN8NNY NNYNNNNNN0NNNNNNNN0000060300000100001NNN00NNN000000050Y0900000004530680000000050002005021700000000028726000000000143630143500012 0 NYY00003541200000430200000234602001000015.1020250930000017321 NNN +074610 KR7074610007̿÷ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000051100000100001YNY00NNN000000100N0900000000000000000000005002003122300000000000733700000000000366873600012 0 NNY000000164-00000037-0000005700096-00097.9120250930000000374 NNN +075180 KR7075180000пƼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000031200000100001NNN00NNN000000100N0900000000055050000000005002005102100000000001920000000000000960000000012 0 NNY000001025-00000006-00000003-0006000001.6120250930000000599 NNN +075580 KR7075580001߰ ST2002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000195700000100001NNN00NNN000000050Y0900000003005930000000005002015113000000000005684900000000003122472800012 0 NNY00000287000000038700000037000281000020.8820250930000011125 NNY +077500 KR7077500007Ʈ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000065600000100001NNN00NNN000000060Y0900000004455310000000005002004080500000000002160000000000001149102600012 0 NNY00000518000000027000000024000174000003.1620250930000001416 NNY +077970 KR7077970002STX ST2002700120000 NN0NNY NNNNNNNNN0NNNNNNNN0000360500000100001NNN00NNN000000060Y0900000005251220000000025002004051000000000004014800000000010037015750012 0 NYY00000544900000064200000054600543000020.2020250930000014473 NNN +078000 KR7078000007ڿ ST3002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000157900000100001NNN00NNN000000060Y0900000000143420000000005002004072000000000000924000000000000502635300012 0 NNY000000196-00000032-00000010-0008000005.2520250930000001459 NNN +078520 KR7078520004̺ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000103000000100001NNN00NNN000000060Y0900000001599780000000005002011090700000000002601400000000001351672950012 0 NNY00000187400000011500000011100082000012.3420250930000002679 NNY +078930 KR7078930005GS ST1002100000000 NN4YNY NYNNNNNYN0NNNNNNNN0000641000000100001NNN00NNN000000050Y0900000002568400000000050002004080500000000009291500000000046457689000012 0 NYY00018696800002159900002042707876000004.0420250930000059558FN4NNY +078935 KR7078931003GS ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000530000000100001NNN00NNN000000100N0900000000048740000000050002004080500000000000178400000000000892413000012 1 NNN00000000000000000000000000000000000000.00 000000945 NNN +079160 KR7079160008CJ CGV ST2003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000061000000100001NNN00NNN000000100N0900000004158240000000005002004122400000000016558100000000008279077800012 0 NNY000016083000000283-00000925-1050-00029.5920250930000010100720NNN +079430 KR7079430005븮Ʈ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000066800000100001NNN00NNN000000060Y0900000000968710000000010002005112200000000002053500000000002053528200012 0 NNY00001188300000018300000013000102000002.5620250930000001371Z35NNN +079550 KR7079550000LIGؽ ST1002700110000 NN9YNY YYNNNNNNN0NNNNNNNN0005270000000100001NNN00NNN000000050Y0900000001026520000000050002015100200000000002200000000000011000000000012 0 NYY00002902200000280800000294502376000025.1120250930000115940142NNY +079900 KR7079900007Ǽκ ST2002700120000 N 0NNN NN N 0 N 0000518000000100001NNN00NNN000000050Y0900000001180670000000005002024081900000000001459200000000000877454300012 0 NNY00000145300000023100000030600239000022.4220250930000007558 NNN +079980 KR7079980009޺ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000025000000100001NNN00NNN000000100N0900000001423040000000050002012022300000000003450000000000017250000000012 0 NNY00000674800000009800000012300091-00030.7220250930000000862 NNN +081000 KR7081000002̾ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000137600000100001NNN00NNN000000100N0900000007943430000000010002004122200000000001420200000000001420297500012 0 NNY000001166-0000007800000003400042000002.6520250930000001954 NNN +081660 KR7081660003̽Ȧ ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNN0000457000000100001NNN00NNN000000050Y0900000000873710000000010002010092800000000005309100000000006167442000012 0 NYY00003553400000476400000484403926000008.6320250930000024262 NNN +082640 KR7082640004 ST2002100250000 NN0NNY NNNNNNNNN0NNNNNYNN0000068000000100001NNN00NNN000000050Y0900000001104280000000050002009100800000000016135800000000080679292500012 0 NNY00002635900000147800000126601099000010.5220250930000010972 NNN +082740 KR7082740002ȭ ST2002700120000 NN2NNY NNNNNNNNN0NNNNYNNY0000576000000100001NNN00NNN000000060Y0900000013654680000000010002011010400000000008344700000000008344714200012 0 NYY00000000000000000000000000000000000000.0020250930000048065913NNY +083420 KR7083420000׸ɹĮ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000062800000100001NNN00NNN000000060Y0900000000633020000000005002005102000000000002400000000000001200000000012 0 NNY00000330300000010700000009900082000006.7520241231000001507 NNY +084010 KR7084010008 ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000105300000100001NNN00NNN000000060Y0900000001174250000000010002005103100000000003437100000000003610393300012 0 NNY00000958500000017800000035400314000003.7020250930000003619 NNN +084670 KR7084670009 ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000517000000100001NNN00NNN000000100N0900000001475320000000050002005072500000000000289500000000001695929500012 0 NNY00000090200000001600000000900014-00020.2820250930000001497 NNN +084680 KR7084680008̿ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000015960000100001NNN00NNN000000100N0900000003136060000000010002005072600000000014180600000000014180619300012 0 NNY000001085-00000004-00000227-0206-00008.7820241231000002263652NNN +084690 KR7084690007Ȧ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000096300000100001NNN00NNN000000050Y0900000000957510000000010002005081700000000003621200000000003621253800012 0 NNY00004277600000171900000108300759000003.0020250930000003487 NNY +084695 KR7084691005Ȧ ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000134700000100001NNN00NNN000000100N0900000000113920000000010002005081700000000000091300000000000091348200012 1 NNN00000000000000000000000000000000000000.00 000000123 NNN +084870 KR7084870005TBH۷ι ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000011990000100001NNN00NNN000000100N0900000000168550000000005002005121900000000002085600000000001042840950012 0 NNY000001238-00000005-00000014-0015-00000.9120250930000000250 NNN +085310 KR7085310001 ST3002700110000 NN0NNY NNNNNNNNN0NNNNYNNN0000011900000100001NNN00NNN000000100N0900000007256050000000005002008012400000000007888000000000003999167600012 0 NNY000000811-00000056-00000049-0049-00001.4020250930000000938 NNN +085620 KR7085620003̷» ST2002100250000 NN0NNY NNNNNNNNN0NNNNNYNN0000093000000100001NNN00NNN000000050Y0900000001258110000000050002015070800000000017701600000000088508094500012 0 NNY00003950600000166200000163801252000008.4220250930000016462FB2NNN +086280 KR7086280005۷κ ST1001900000000 NN9YYY NYNNNNNNN0NNNNNNYN0002405000000100001NNN00NNN000000050Y0900000004729240000000005002005122600000000007500000000000003750000000012 0 NYY00022094400001564800001609112943000015.1620250930000180375BH1NNY +086790 KR7086790003ϳ ST1002100000000 NY6YYY YYNNNYNNN0NNNNNNNY0001027000000100001NNN00NNN000000050Y0900000007923250000000050002005121200000000027832500000000150121031000012 0 NYY00051794900004460500004613234590000009.2120250930000285840 NNY +088260 KR7088260005̸ũ RT3002800000000 N 0NNN NN N 0 Y 0000047500000100001NNN00NNN000000100N09000000006731500000000050020180627000000000063341000000000031670795000 0 NNY00000000000000000000000000000000000000.00 000003008652NNN +088350 KR7088350004ȭ ST2002100250000 NY6NNY NNNNNNNNN0NNNNNYNY0000033900000100001NNN00NNN000000050Y0900000046306530000000050002010031700000000086853000000000434265000000012 0 NYY00020092200000967000000978407689000007.4220250930000029443913NNN +088790 KR7088790001 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000019740000100001NNN00NNN000000100N0900000000319910000000005002006032800000000001244700000000000622387200012 0 NNY00000044200000001100000001100009000000.8420241231000000245 NNN +088980 KR7088980008 IF1002100000000 NN0NNN NNNNNNNNN0NNYNNNNN0000111900000100001NNN00NNN000000050Y09000000273646000000000000020060315000000000478921000000003297209055534 0 NNY00000000000000000000000000000000000000.00 000053591 NNN +089470 KR7089470009HDCEP ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000047000000100001NNN00NNN000000060Y0900000001129310000000005002006092500000000003190000000000001720000000012 0 NNY00000760000000040400000038600248000009.3820250930000001499HDCNNN +089590 KR7089590004װ ST2001900000000 NN0NNY NNNNNNNNN0NNNNNNYN0000055300000100001NNN00NNN000000100N0900000004702910000000010002015110600000000008064000000000008064098500012 0 NNY000011053-00001295-00001213-1028-00047.9120250930000004459615NNN +089860 KR7089860001ԵŻ ST2002600000000 N 0NNN NN N 0 N 0000298000000100001NNN00NNN000000060Y0900000001538470000000050002021081900000000003630900000000018317031500012 0 NNY00002192400000233200000126600986000008.5020250930000010820283NNN +090080 KR7090080003ȭ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000009810000100001NNN00NNN000000100N0900000002063300000000005002006060200000000005490200000000002745112950012 0 NNY00000475300000006900000006900066000017.3220250930000000538 NNN +090350 KR7090350000Ʈ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000082600000100001NNN00NNN000000060Y0900000000536030000000005002006070300000000002000000000000001000000000012 0 NNY00000591600000027600000027400171000004.8420250930000001652 NNN +090355 KR7090351008Ʈ ST0002700080000 YN0NNN NNNNNNNNN0NNNNNNNN0000125000000100001NNN00NNN000000100N0900000000012280000000005002006070300000000000046300000000000023156300012 1 NNN00000000000000000000000000000000000000.00 000000057 NNN +090370 KR7090370008Ÿ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000016500000100001NNN00NNN000000100N0900000001434870000000025002006122600000000002490400000000006226172250012 0 NNY000000502-00000062-00000063-0063-00014.7820250930000000410 NNN +090430 KR7090430000Ƹ۽ ST1002700080000 NN7YNY YYNNNNNNN0NNNNNNNY0001339000000100001NNN00NNN000000050Y0900000003032780000000005002006062900000000005849200000000002924637950012 0 NYY00003089400000283300000292202248000002.9620250930000078321842NNY +090435 KR7090431008Ƹ۽ȿ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000497500000100001NNN00NNN000000050Y0900000000370460000000005002006062900000000001055700000000000527891500012 1 NNN00000000000000000000000000000000000000.00 000005252 NNN +090460 KR7090460007ġ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000178400000100001NNN00NNN000000050Y0900000005108440000000005002023062000000000003371100000000001723218950012 0 NNY00001284600000025200000026400183000000.9520250930000006014 NNY +091160 KR7091160002KODEX ݵü EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000829500000100001NNN00NNN000000050Y0900000041763060000000000002006062700000000003085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000025590 NNY +091170 KR7091170001KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000136200000100001NNN00NNN030000050Y0900000022969660000000000002006062700000000003850000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005261 NNN +091180 KR7091180000KODEX ڵ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000314450000100001NNN00NNN030000050Y0900000025746480000000000002006062700000000001850000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005829 NNN +091220 KR7091220004TIGER EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000141600000100001NNN00NNN030000100N0900000000617750000000000002006062700000000000118000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +091230 KR7091230003TIGER ݵü EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000869900000100001NNN00NNN030000050Y0900000007307990000000000002006062700000000000748000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006510 NNN +091810 KR7091810002Ƽװ ST3001900000000 N 0NNN NN N 0 N 0000014250000100001NNN00NNN000000100N0900000010646350000000001002018080100000000033598400000000003359840350012 0 NNY000012742-00002093-00002336-2476-00320.1620250930000004787139NNN +092200 KR7092200005̾ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000109700000100001NNN00NNN000000100N0900000017233650000000005002007101800000000003888800000000001944428450012 0 NNY00000588500000021300000008100046000003.1620250930000004266 NNN +092220 KR7092220003KEC ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000007790000100001NNN00NNN000000100N0900000018225420000000005002006101600000000020076300000000010038157050012 0 NNY000001759-00000156-00000133-0134-00005.7020250930000001563 NNN +092230 KR7092230002KPXȦ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000752000000100001NNN00NNN000000050Y0900000000026800000000050002006101200000000000422400000000002112323000012 0 NNY00000877900000040200000113200878000009.0820250930000003176 NNN +092440 KR7092440007 ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000023550000100001NNN00NNN000000100N0900000000288680000000005002007103000000000002920000000000001460000000003 0 NNY000000596-00000021-00000008-0009-00000.0120250930000000687 NNN +092780 KR7092780006DYP ST3002700150000 N 0NNN NN N 1 N 0000062000000100001NNN02NNN000000100N0900000005208330000000005002017120800000000001316800000000000658423000012 0 NNY00000332600000010400000004600036000005.6520250930000000816 NNN +092790 KR7092790005ؽƿ ST3002700110000 N 0NNN NN N 0 N 0000113000000100001NNN00NNN000000060Y0900000003034500000000005002023082100000000002600200000000001300100000012 0 NNY00000456700000043000000050500393000008.9220250930000002938 NNY +093050 KR7093050003LF ST2002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000187900000100001NNN00NNN000000050Y0900000000934130000000050002006120100000000002924000000000014620000000012 0 NNY00001284600000090500000103500804000005.1820250930000005494 NNN +093240 KR7093240000Ʈ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000013750000100001NNN00NNN000000100N0900000015471930000000005002009092800000000003839000000000001919512950006 0 NNY00000044600000007500000007800062000004.2820250930000000527 NNN +093370 KR7093370005ļ ST3002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0000084500000100001NNN00NNN000000060Y0900000025779330000000005002006122200000000010725500000000005362766500012 0 NNY000003523000000205-00000015-0056-00023.0020250930000009063 NNY +094280 KR7094280005ȿITX ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000126100000100001NNN00NNN000000100N0900000000333130000000005002007102500000000001155800000000000577910000012 0 NNY00000373300000012400000012300097000017.2820250930000001457971NNN +094800 KR7094800000ʽƼ MF 000000000000NNN0NNN NNNNNNNNN0NNNNNNNN0000058400000100001NNN00NNN000000060Y09000000026010400000000000020070409000000000092834000000000464171655000 0 NNN00000000000000000000000000000000000000.00 000005421 NNN +095570 KR7095570008AJƮ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000047350000100001NNN00NNN000000060Y0900000001624600000000010002015082100000000004525200000000004682229500012 0 NNY00000797700000046300000004500235000005.8820250930000002142 NNN +095720 KR7095720009ũ ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000011980000100001NNN00NNN000000060Y0900000001658280000000005002007053100000000011550500000000005870079600012 0 NNY000006025-00000081-00000169-0138-00010.9320250930000001383 NNN +096760 KR7096760004JWȦ ST3002100000000 NN0NNY NNNNYNNNN0NNNNNNNN0000038150000100001NNN00NNN000000050Y0900000002063020000000005002007073100000000007392400000000003696247100012 0 NNY00000712000000129900000107300800000020.9420250930000002820 NNN +096770 KR7096770003SK̳뺣̼ ST1002700080000 NN4YYY YYNNNNNYN0NNNNNNNY0001082000000100001NNN00NNN000000050Y0900000010657810000000050002007072500000000016905200000000086986381000012 0 NYY000609864-00005060-00015242-1252-00009.0720250930000182915535NNY +096775 KR7096771001SK̳뺣̼ǿ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000709000000100001NNN00NNN000000100N0900000000107710000000050002007072500000000000124800000000000624213000012 1 NNN00000000000000000000000000000000000000.00 000000885 NNN +097230 KR7097230007HJ߰ ST2001800000000 NN0NNY NNNNNNNNN0NNNNYNNN0000262000000100001NNN00NNN000000100N0900000020513500000000050002007083100000000009029500000000045147672000012 0 NNY00001370100000016600000003000029-00004.6720250930000023657 NNN +097520 KR7097520001ؽ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000297000000100001NNN00NNN000000050Y0900000000775540000000005002021070600000000001740100000000000912218800012 0 NNY00000977900000043800000049700427000019.3420250930000005168 NNY +097950 KR7097950000CJ ST2002700050000 NN7YNY NNNNNNNNN0NNNNNNNY0002130000000100001NNN00NNN000000050Y0900000000602030000000050002007092800000000001505400000000007527093000012 0 NYY00021885100001028800000612503818000000.8320250930000032065720NNY +097955 KR7097951008CJ ST0002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0001400000000100001NNN00NNN000000060Y0900000000101270000000050002007092800000000000132700000000000663716500012 1 NNN00000000000000000000000000000000000000.00 000001858 NNN +099140 KR7099140006KODEX ̳H EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000247800000100001NNN00NNN030000050Y0900000000113140000000000002007101000000000000190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000473 NNN +100090 KR7100090000SK÷Ʈ ST2002700110000 NN0NNY NNNNNNNNN0NNNNNNNN0000187800000100001NNN00NNN000000050Y0900000005662590000000005002023041900000000006247800000000003123906450012 0 NYY00000790900000045800000033200238000003.2920250930000011733535NNY +100220 KR7100220003 ST3003000000000 NN0NNN NNNNNNNNN0NNNNNNNN0000048350000100001NNN00NNN000000100N0900000000270470000000005002008063000000000001299600000000000649837050012 0 NNY000001744-00000048000000007-0006000003.2320250930000000628 NNN +100250 KR7100250000Ȧ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000029350000100001NNN00NNN000000060Y0900000000518550000000005002008021500000000005589500000000002794764600012 0 NNY00000214800000006500000022000169000006.9620250930000001640 NNN +100840 KR7100840008SNT ST2002700120000 NN0NNY NNNNNNNNN0NNNNNNNN0000400500000100001NNN00NNN000000050Y0900000001600470000000005002008022200000000002068000000000001034039150012 0 NYY00000404200000064600000059400442000020.9620250930000008282 NNY +100910 KR7100910009KIWOOM KRX100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000120000000100001NNN00NNN030000100N0900000000222670000000000002008012300000000000210000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000252 NNN +101140 KR7101140002ι̿ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000118100000100001NNN00NNN000000100N0900000000210560000000005002008040200000000001004400000000000502210800012 0 NNY000000070-0000006100000016100161000010.6420241231000001186 NNN +101280 KR7101280006KODEX ϺTOPIX100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000278350000100001NNN00NNN030000050Y0900000000169580000000000002008022000000000000202000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000562 NNN +101530 KR7101530004ǰ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000068100000100001NNN00NNN000000060Y0900000000496100000000005002016051100000000002911600000000001455841100012 0 NNY00000483100000032100000023200171000008.1820250930000001982 NNN +102110 KR7102110004TIGER 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000760650000100001NNN00NNN030000050Y0900000059893350000000000002008040300000000007705000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000058762 NNN +102260 KR7102260007ɹ ST3002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000041850000100001NNN00NNN000000050Y0900000002058140000000010002008062300000000005017600000000005017679100012 0 NNY00000913700000082000000078300570000008.7920250930000002099 NNN +102460 KR7102460003̿ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000116500000100001NNN00NNN000000060Y0900000000848820000000005002010061000000000001858600000000000929340550012 0 NNY000001120-00000225-00000148-0168-00005.9320250930000002165 NNY +102780 KR7102780004KODEX Z׷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000170550000100001NNN00NNN000000050Y0900000008477920000000000002008052100000000013450000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000022938 NNN +102960 KR7102960002KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000164850000100001NNN00NNN000000100N0900000002972630000000000002008052900000000000156000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000257 NNN +102970 KR7102970001KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000196450000100001NNN00NNN000000050Y0900000055455090000000000002008052900000000002575000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005058 NNN +103140 KR7103140000dz ST2002700110000 NN3NNY NNNNNNNNY0NNNNNNNN0001246000000100001NNN00NNN000000050Y0900000002617130000000050002008073000000000002802400000000014012139000012 0 NYY00003624100000205900000176001383000008.1120250930000034918 NNY +103590 KR7103590006 ST2002700130000 NN0NNY NNNNNNNNN0NNNNNNNN0000660000000100001NNN00NNN000000050Y0900000008895890000000010002008080100000000004768500000000004768539000012 0 NYY00001430400000107000000102600767000016.2920250930000031472 NNY +104520 KR7104520002KIWOOM Ĩ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000137550000100001NNN00NNN030000100N0900000000008230000000000002008072900000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000165 NNN +104530 KR7104530001KIWOOM EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000174750000100001NNN00NNN000000100N0900000000646050000000000002008072900000000000260000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000454 NNN +104700 KR7104700000ѱö ST3002700110000 NN0NNY NNNNNNNNY0NNNNNNNN0000096400000100001NNN00NNN000000060Y0900000000490530000000010002008092900000000003645000000000004605000000012 0 NNY00000000000000000000000000000000000000.0020250930000003513 NNN +105010 KR7105010003TIGER ƾ35 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000066350000100001NNN00NNN030000100N0900000000677280000000000002008082700000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +105190 KR7105190003ACE 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000765700000100001NNN00NNN030000050Y0900000006765170000000000002008092500000000001375000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010542 NNN +105560 KR7105560007KB ST1002100000000 NY6YYY YYNNNYNNN0NNNNNNNY0001379000000100001NNN00NNN000000050Y0900000015914280000000050002008101000000000038146200000000209055768500012 0 NYY00058811800006761000006911251019000009.8820250930000526036 NNY +105630 KR7105630008ѼǾ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000141000000100001NNN00NYN000000050Y0900000002070470000000005002009032000000000004000000000000002000000000012 0 NNY00001485700000069600000065000509000004.6220250930000005640 NNY +105780 KR7105780001RISE 5׷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000120600000100001NNN00NNN000000100N0900000000270280000000000002008102200000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000265 NNN +105840 KR7105840003 ST3002700140000 NN0NNN NNNNNNNNN0NNNNNNNN0000261500000100001NNN00NNN000000060Y0900000008008300000000005002010072600000000002019700000000001016180700012 0 NNY00000109600000013000000012500112000006.6720250930000005281 NNN +107590 KR7107590002̿Ȧ ST3002100000000 YN0NNN NNNNNNNNN0NNNNNNNN0000680000000100001NNN00NNN000000100N0900000000009560000000005002009030200000000000232000000000000131588700012 0 NNY00000374700000018100000030400271000008.8820250930000001577 NNN +108320 KR7108320003LX ST2002700130000 NN0NNY NNNYNNNNN0NNNNNNNN0000547000000100001NNN00NNN000000050Y0900000001947770000000005002022110300000000001626400000000000813215000012 0 NYY00001249200000084000000082100638000007.8220250930000008896LD1NNY +108450 KR7108450008ACE Z׷켽Ͱ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000283650000100001NNN00NNN000000100N0900000000167940000000000002009020300000000000280000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000794 NNN +108590 KR7108590001TREX 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000759900000100001NNN00NNN030000100N0900000000005110000000000002009012300000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +108670 KR7108670001LXϿý ST3002700080000 NN0NNY NNNNNNNNN0NYNNNNNN0000287000000100001NNN00NNN000000050Y0900000000198330000000050002009042000000000000896700000000004483835000012 0 NNY00002413500000042000000017900108-00000.5020250930000002573LD1NNN +108675 KR7108671009LXϿý ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000165900000100001NNN00NNN000000100N0900000000028090000000050002009042000000000000103200000000000516165000012 1 NNN00000000000000000000000000000000000000.00 000000171 NNN +109070 KR7109070003ּ۷̼ ST3002700130000 NN0NNN NNNNNNNNN0NNNNNNNN0000008510000100001NNN00NNN000000100N0900000003174050000000005002009031700000000005281000000000002640511500012 0 NNY00000059000000001900000001800018000010.3720250930000000449 NNN +111110 KR7111110003ȣǾ ST3002700060000 N 0NNN NN N 0 N 0000077400000100001NNN00NNN000000100N0900000000314950000000005002017020200000000000937600000000000553287200012 0 NNY00000383100000019000000010000049000010.4820250930000000725 NNN +111380 KR7111380002α⿬ ST3002700060000 N 0NNN NN N 0 N 0000144900000100001NNN00NNN000000100N0900000000160790000000001002023112100000000000612800000000000061280000012 0 NNY00000174400000014100000007000044000009.8020250930000000887 NNN +111770 KR7111770004 ST2001600000000 NN8NNY NNNNNNNNN0NNNNNNNN0000832000000100001NNN00NNN000000050Y0900000000563890000000005002009073000000000004431100000000002215573400012 0 NYY00003054300000409200000441903234000012.4720250930000036867136NNN +112610 KR7112610001 ST2002700110000 NN2NNY NNNNNNNNN0NNNNYNNN0000400500000100001NNN00NNN000000060Y0900000002547430000000005002014112700000000004217100000000002108570150012 0 NYY00002148900000250200000214001923000016.8220250930000016889 NNY +114090 KR7114090004GKL ST2003000000000 NN8NNY NNNNNNNNN0NNNNNNNN0000128400000100001NNN00NNN000000100N0900000001596820000000005002009111900000000006185500000000003092783500012 0 NYY00000320200000053400000062200477000012.4120250930000007942 NNN +114100 KR7114100001RISE ä3 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001080650000100001NNN00NNN000000050Y0900000000057500000000000002009072900000000000140300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001516 NNN +114260 KR7114260003KODEX ä3 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000617350000100001NNN00NNN000000100N0900000000760540000000000002009072900000000000708000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004370 NNN +114460 KR7114460009ACE ä3 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001019600000100001NNN00NNN000000100N0900000000020540000000000002009073100000000000012000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000122 NNN +114470 KR7114470008KIWOOM ä3 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001091250000100001NNN00NNN000000100N0900000000011120000000000002009073100000000000039000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000425 NNN +114800 KR7114800006KODEX ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000019410000100001NNN00NNN000000060Y0900001825538880000000000002009091600000000044920000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008718 NNN +114820 KR7114820004TIGER ä3 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001050450000100001NNN00NNN000000100N0900000000165910000000000002009082700000000000104700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001099 NNN +117460 KR7117460006KODEX ȭ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000148650000100001NNN00NNN000000100N0900000001295730000000000002009101200000000000224000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000332 NNN +117580 KR7117580001뼺 ST3001700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000080400000100001NNN00NNN000000060Y0900000001347100000000010002010122400000000002750000000000002750000000012 0 NNY00000723500000023100000024300196000008.1820250930000002211 NNY +117680 KR7117680009KODEX ö EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000155050000100001NNN00NNN030000100N0900000001030940000000000002009103000000000000182000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000282 NNN +117690 KR7117690008TIGER ̳׼30 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000231750000100001NNN00NNN000000100N0900000000104920000000000002009102100000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +117700 KR7117700005KODEX Ǽ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000052650000100001NNN00NNN000000050Y0900000005958160000000000002009103000000000000730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000384 NNN +118000 KR7118000009Ÿɾ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000002930000100001NNN00NNN000000100N0900000004244310000000005002009123000000000017177700000000008588868200012 0 NNY00000022500000001500000003900040000000.9320250930000000503 NNN +119650 KR7119650000KCƮ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000009180000100001YNY00NNN000000100N0900000000000000000000005002010012900000000010978500000000005489265450012 0 NNY000001532-00000023-00000124-0128000113.8020250930000001007 NNN +120030 KR7120030002 ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000996000000100001NNN00NNN000000060Y0900000000025090000000005002010021900000000000125700000000000062882550012 0 NNY00000050900000008700000020500163000010.7320241231000001252 NNN +120110 KR7120110002ڿδ ST2002700080000 NN4NNY NNNNNNNYN0NNNNNNNN0000493000000100001NNN00NNN000000050Y0900000004048670000000050002010020100000000002751900000000013759545500012 0 NYY00003670700000099100000070000591000002.7720250930000013566KOLNNY +120115 KR7120111000ڿδ ST0002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000261000000100001NNN00NNN000000100N0900000000104790000000050002010020100000000000276700000000001383930000012 1 NNN00000000000000000000000000000000000000.00 000000722 NNN +122090 KR7122090004PLUS ڽ50 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000555000000100001NNN00NNN030000100N0900000000334870000000000002010010700000000000111000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000617 NNN +122260 KR7122260003KIWOOM ä1 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001028350000100001NNN00NNN000000100N0900000000001830000000000002010011400000000000041000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000421 NNN +122630 KR7122630007KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000742100000100001NNN00NNN000000100N0900000235227520000000000002010022200000000006550000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000048607 NNN +122900 KR7122900004̸ڸ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000078200000100001NNN00NNN000000050Y0900000000426300000000005002010073000000000003342800000000001816667000012 0 NNY00002247000000024400000035500228000006.9720250930000002614 NNN +123310 KR7123310005TIGER ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000021650000100001NNN00NNN000000060Y0900000028793850000000000002010032900000000001970000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000426 NNN +123320 KR7123320004TIGER EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000735600000100001NNN00NNN000000100N0900000010105010000000000002010040900000000000250000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001839 NNN +123690 KR7123690000ѱȭǰ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000104600000100001NNN00NNN000000060Y0900000003901940000000005002010060100000000001606800000000000803400000012 0 NNY00000066400000002200000002500028000014.6820250930000001680 NNN +123700 KR7123700007SJM ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000037500000100001NNN00NNN000000100N0900000000572070000000005002010053100000000001560400000000000780244900012 0 NNY00000151900000011500000015800120000010.0220250930000000585 NNN +123890 KR7123890006ѱڻŹ ST3002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000025250000100001NNN00NNN000000060Y0900000003500160000000005002016071300000000012237300000000006198887600012 0 NNY00000150900000039800000070300546000005.5620250930000003089LB0NNN +126560 KR7126560002ǻó ST3002000000000 NN0NNY NNNNNNNNN0YNNNNNNN0000032100000100001NNN00NNN000000100N0900000001107730000000005002010122300000000011020200000000005510147250012 0 NNY00000199000000011900000024800110000001.1320250930000003537Z35NNN +126720 KR7126720002δƮ ST3001800000000 N 0NNN NN N 0 N 0000258500000100001NNN00NNN000000050Y0900000000604940000000002002022080100000000001428600000000000285720000012 0 NNY00000246500000030900000034200274000007.0120250930000003692 NNY +128820 KR7128820008뼺 ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000065000000100001NNN00NNN000000100N0900000016213460000000010002010073000000000004523500000000004523547800012 0 NNY000011391000000173-00000151-0123-00001.4920250930000002940 NNN +128940 KR7128940004ѹ̾ǰ ST2002700090000 NNAYNY NYNNYNNNN0NNNNNNNN0005190000000100001NNN00NNN000000050Y0900000004558230000000025002010073000000000001281000000000003202747750012 0 NYY00001114600000174500000155001331000010.2920250930000066489 NNY +129260 KR7129260006 ST3001900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000024100000100001NNN00NNN000000100N0900000001080530000000005002011121600000000002974700000000001487393700012 0 NNY00000533800000021200000020000160000005.3120250930000000716364NNN +130660 KR7130660004 ST3002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000143000000100001NNN00NNN000000060Y0900000016496390000000005002010121600000000003260000000000001630000000012 0 NNY00000290200000004900000004700035-00002.4320250930000004661 NNY +130680 KR7130680002TIGER Enhanced(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000041650000100001NNN00NNN000000100N0900000002956190000000000002010080200000000000490000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000204 NNN +130730 KR7130730005KIWOOM ܱڱ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001014800000100001NNN00NNN000000100N0900000000021820000000000002010072900000000000144000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001461 NNN +131890 KR7131890006ACE Z׷쵿ϰ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000311150000100001NNN00NNN000000100N0900000000023160000000000002010091700000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000155 NNN +132030 KR7132030008KODEX 弱(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000302400000100001NNN00NNN000000060Y0900000005443490000000000002010100100000000001690000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005110 NNN +133690 KR7133690008TIGER ̱100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001648100000100001NNN00NNN030000050Y0900000007987860000000000002010101800000000004886000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000080636 NNN +133820 KR7133820001ȭκƿ ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000017920000100001NNN00NNN000000100N0900000001749310000000005002014072200000000003711400000000001983225100012 0 NNY000001328-00000038-00000019-0044-00032.6320250930000000665 NNN +134380 KR7134380005̿ȭ ST3002700080000 YN0NNN NNNNNNNNN0NNNNNNNN0000979000000100001NNN00NNN000000100N0900000000010940000000010002011021500000000000219900000000000240408000012 0 NNY00000256100000028600000034100269000017.5520241231000002153 NNN +134790 KR7134790005õ ST3002700000000 NN0NNN NNNNNNNNN0NNNNNNNN0000198300000100001NNN00NNN000000100N0900000000015200000000005002011012500000000000200000000000000100000000012 0 NNY000001472-00000061-00000037-0030-00007.0520250930000000396 NNN +136340 KR7136340007RISE ߱췮ȸä EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001057750000100001NNN00NNN030000100N0900000000028530000000000002011041500000000000123500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001309 NNN +136490 KR7136490000 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000107500000100001NNN00NNN000000050Y0900000002210920000000005002011021600000000002377900000000001188980200012 0 NNY00001392400000138700000132601107000013.8520250930000002556HRMNNN +137310 KR7137310009̿ ST2002700140000 N ANNY NN N 0 N 0000088900000100001NNN00NNN000000100N0900000001729970000000005002021071600000000012174900000000006223908750012 0 NYY000005160-00000491-0000102102464000003.8020250930000010823 NNN +137610 KR7137610002TIGER 깰Enhanced(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000050350000100001NNN00NNN000000100N0900000000187970000000000002011011100000000000250000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000125 NNN +138040 KR7138040001޸ ST1002100000000 NN6YYY NYNNNNNNN0NNNNNNNN0001108000000100001NNN00NNN000000050Y0900000002525620000000005002011051300000000017522100000000011309392700012 0 NYY00024952200002533800002730420268000022.9120250930000194145 NNY +138230 KR7138230008KIWOOM ̱޷ EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000163650000100001NNN00NNN000000100N0900000000146020000000000002011022400000000000163000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000266 NNN +138490 KR7138490008ڿENP ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000092400000100001NNN00NNN000000060Y0900000001405400000000010002011061500000000003800000000000003800000000012 0 NNY00000365800000038300000046000368000013.2220250930000003511KOLNNN +138520 KR7138520002TIGER Z׷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000233550000100001NNN00NNN000000100N0900000001076420000000000002011030700000000000282000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000658 NNN +138530 KR7138530001TIGER LG׷÷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000092350000100001NNN00NNN000000100N0900000001193380000000000002011031000000000000172000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +138540 KR7138540000TIGER ׷÷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000560100000100001NNN00NNN000000050Y0900000015089880000000000002011031000000000000768000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004301 NNN +138910 KR7138910005KODEX (H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000094750000100001NNN00NNN000000100N0900000005435180000000000002011031500000000000650000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000615 NNN +138920 KR7138920004KODEX ἱ(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000111300000100001NNN00NNN000000100N0900000000007980000000000002011031500000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000055 NNN +138930 KR7138930003BNK ST1002100000000 NY6NNY NNNNNYNNN0NNNNNNNY0000163900000100001NNN00NNN000000050Y0900000022028260000000050002011033000000000031032700000000162967623000012 0 NYY00007546400000842100001026407859000007.4220250930000050862 NNN +139130 KR7139130009iM ST2002100000000 NY6NNY NNNNNYNNN0NNNNNNNY0000149300000100001NNN00NNN000000050Y0900000005394860000000050002011060700000000016062400000000084572916500012 0 NYY00005785700000563400000565304431000006.4520250930000023981 NNN +139220 KR7139220008TIGER 200 Ǽ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000060250000100001NNN00NNN000000100N0900000004891600000000000002011040600000000000560000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000337 NNN +139230 KR7139230007TIGER 200 ߰ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000158000000100001NNN00NNN000000050Y0900000009376190000000000002011040600000000003100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004898 NNN +139240 KR7139240006TIGER 200 ö EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000149100000100001NNN00NNN000000100N0900000000302470000000000002011040600000000000054000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000080 NNN +139250 KR7139250005TIGER 200 ȭ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000158550000100001NNN00NNN000000100N0900000000630440000000000002011040600000000000182000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000288 NNN +139260 KR7139260004TIGER 200 IT EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000724350000100001NNN00NNN030000050Y0900000004326810000000000002011040600000000000916000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006638 NNN +139270 KR7139270003TIGER 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000141600000100001NNN00NNN030000100N0900000001394020000000000002011040600000000000212000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000301 NNN +139280 KR7139280002TIGER EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000135850000100001NNN00NNN000000100N0900000000400770000000000002011040600000000000466000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000633 NNN +139290 KR7139290001TIGER 200 Һ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000263450000100001NNN00NNN000000100N0900000001004630000000000002011040600000000000028000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000073 NNN +139320 KR7139320006TIGER (H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000236850000100001NNN00NNN000000100N0900000003256050000000000002011040800000000000280000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000663 NNN +139480 KR7139480008̸Ʈ ST2001600000000 NN7NNY NNNNNNNNN0NNNNNNNN0000886000000100001NNN00NNN000000060Y0900000001492500000000050002011061000000000002759500000000013937909500012 0 NYY00021658700000332400000436903626-00002.8220250930000024449577NNY +139660 KR7139660005KIWOOM ̱޷ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000081950000100001NNN00NNN000000060Y0900000000026430000000000002011040100000000000725000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000594 NNN +139990 KR7139990006ֽƿ ST3002700110000 N 0NNN NN N 0 N 0000031800000100001NNN00NNN000000100N0900000000579030000000005002021082000000000003875500000000001937770700012 0 NNY000008032-00000057-00000200-0199-00062.9720250930000001232364NNN +140570 KR7140570003RISE EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000214950000100001NNN00NNN000000100N0900000000057000000000000002011041500000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000085 NNN +140580 KR7140580002RISE 췮ǥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000214050000100001NNN00NNN000000100N0900000000009530000000000002011041500000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000128 NNN +140700 KR7140700006KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000134750000100001NNN00NNN000000100N0900000013041130000000000002011042600000000000460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000619 NNN +140710 KR7140710005KODEX EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000065700000100001NNN00NNN000000100N0900000000530150000000000002011042600000000000210000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +140910 KR7140910001̸ RT3002800000000 NN0NNN NNNNNNNNN0NNYNNNNN0000031300000100001YNN00NNN000000100N09000000000000000000000500020110714000000000004463000000000022315160000 0 NNY00000000000000000000000000000000000000.00 000000139 NNN +140950 KR7140950007Ŀ ڽ100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000589950000100001NNN00NNN000000100N0900000000021240000000000002011050300000000000056000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000330 NNN +143210 KR7143210003۷̼ ST3002700150000 N 0NNN NN N 0 N 0000011760000100001NNN00NNN000000100N0900000000292840000000005002016120200000000002187500000000001093787350012 0 NNY000005996-00000283-00000329-0335-00050.2720250930000000257 NNN +143850 KR7143850006TIGER ̱S&P500(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000721000000100001NNN00NNN000000050Y0900000000060750000000000002011071800000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001045 NNN +143860 KR7143860005TIGER コɾ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000542400000100001NNN00NNN000000050Y0900000005352900000000000002011071800000000000470000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002549 NNN +144600 KR7144600004KODEX (H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000193500000100001NNN00NNN000000060Y0900000158621590000000000002011071800000000007900000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000015286 NNN +145210 KR7145210001̳͵ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000004990000100001NNY01NNN000000100N0900000023930970000000005002015031900000000004223600000000002111833400012 0 NNY000000577-00000002-00000057-0056-00034.0620250930000000210 NNN +145270 KR7145270005ž RT3002800000000 NN0NNN NNNNNNNNN0NNYNNNNN0000009190000100001NNN00NNN000000100N09000000018199400000000100020120131000000000048060000000000048060774000 0 NNY00000000000000000000000000000000000000.00 000000441 NNN +145670 KR7145670006ACE ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000024300000100001NNN00NNN000000100N0900000000784580000000000002011090800000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000034 NNN +145720 KR7145720009Ƽ ST2002700140000 N 0NNN NN N 0 N 0000489000000100001NNN00NNN000000050Y0900000000373710000000005002017031500000000001106800000000000618441500012 0 NNY00000237300000037600000019200214000007.8120250930000005412 NNY +145850 KR7145850004TREX ݴŻ 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000812250000100001NNN00NNN030000100N0900000000003090000000000002011092300000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000203 NNN +145990 KR7145990008 ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000480000000100001NNN00NNN000000050Y0900000000181270000000050002011120500000000001031300000000005156724500012 0 NNY00001959600000101000000127201021000006.0420250930000004950512NNN +145995 KR7145991006 ST0002700050000 YN0NNN NNNNNNNNN0NNNNNNNN0000374500000100001NNN00NNN000000100N0900000000008000000000050002011120500000000000037000000000000185035000012 1 NNN00000000000000000000000000000000000000.00 000000138 NNN +147970 KR7147970008TIGER EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000614100000100001NNN00NNN000000100N0900000000092750000000000002011102600000000000048000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +148020 KR7148020001RISE 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000766900000100001NNN00NNN030000050Y0900000054021710000000000002011102000000000003545000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000027239 NNN +148070 KR7148070006KIWOOM ä10 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001083150000100001NNN00NNN000000050Y0900000000516440000000000002011102000000000000495300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005364 NNN +150460 KR7150460004TIGER ߱Һ׸ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000079350000100001NNN00NNN000000100N0900000000800950000000000002011121600000000000993000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000787 NNN +152100 KR7152100004PLUS 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000772600000100001NNN00NNN030000050Y0900000022869830000000000002012011000000000001635000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012661 NNN +152380 KR7152380002KODEX ä10 EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000672300000100001NNN00NNN000000050Y0900000000060590000000000002012012000000000000118200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000794 NNN +152500 KR7152500005ACE EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000301500000100001NNN00NNN000000100N0900000000888090000000000002012012700000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000361 NNN +152550 KR7152550000ѱANKOR MF 000000000000NNN0NNN NNNNNNNNN0NNNNNNNN0000002040000100001NNN00NNN000000100N09000000073936200000000000020120308000000000070020000000000350100000000 0 NNN00000000000000000000000000000000000000.00 000000142 NNN +152870 KR7152870002Ŀ 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000771000000100001NNN00NNN000000100N0900000000232130000000000002012021300000000000155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001195 NNN +153130 KR7153130000KODEX ܱä EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001133950000100001NNN00NNN000000050Y0900000000137780000000000002012022200000000000646400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007329 NNN +153270 KR7153270004KIWOOM ڽ100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000580400000100001NNN00NNN030000100N0900000000207520000000000002012022800000000000038000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000221 NNN +155660 KR7155660004DSR ST3002700110000 NN0NNN NNNNNNNNN0NNNNNNNN0000039200000100001NNN00NNN000000100N0900000000494220000000005002013051500000000001600000000000000800000000012 0 NNY00000225400000014200000014000114000005.8620250930000000627 NNN +156080 KR7156080004KODEX MSCI Korea EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000358500000100001NNN00NNN000000100N0900000000198940000000000002012043000000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000250 NNN +157450 KR7157450008TIGER ܱä EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001109700000100001NNN00NNN000000050Y0900000000170940000000000002012051600000000000944700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010483 NNN +157490 KR7157490004TIGER Ʈ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000104550000100001NNN00NNN000000050Y0900000009510410000000000002012051600000000001658000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001733 NNN +157500 KR7157500000TIGER EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000134350000100001NNN00NNN000000100N0900000022875380000000000002012051600000000001488000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001999 NNN +159800 KR7159800002Ƽ ڽ100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000600600000100001NNN00NNN000000100N0900000000018080000000000002012070500000000000028000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +160580 KR7160580007TIGER ǹ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000156800000100001NNN00NNN000000060Y0900000011394650000000000002012121700000000001272500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001995 NNN +161000 KR7161000005ְɹĮ ST2002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000095900000100001NNN00NNN000000060Y0900000003324210000000005002012091700000000004864800000000002432435450012 0 NNY000011039-0000004700000015300056000001.4920250930000004665615NNY +161390 KR7161390000ѱŸ̾ũ ST1002700080000 NN8YNY NYYNNNNNN0NNNNNNNY0000650000000100001NNN00NNN000000050Y0900000002062640000000005002012100400000000012387500000000006193753450012 0 NYY00015746100001294200001181708805000008.6220250930000080518912NNY +161510 KR7161510003PLUS EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000236100000100001NNN00NNN030000050Y0900000019911490000000000002012082900000000008343000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000019768 NNN +161890 KR7161890009ѱݸ ST2002700080000 NN7NNY NNNNNNNNN0NNNNNNNN0000681000000100001NNN00NNN000000050Y0900000002872520000000005002012101900000000002360500000000001180253850012 0 NYY00002066900000191700000140601074000013.9120250930000016075 NNY +163560 KR7163560006ϰƮ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000069000000100001NNN00NNN000000100N0900000000277130000000005002012101900000000001390000000000000695000000012 0 NNY00000265200000011500000007200055000005.4420250930000000959 NNN +166400 KR7166400002TIGER 200ĿOTM EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000185700000100001NNN00NNN030000100N0900000000022960000000000002012102500000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000093 NNN +167860 KR7167860006KIWOOM ä10ⷹ EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0001002700000100001NNN00NNN000000100N0900000000006370000000000002012103000000000000029000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000290 NNN +168580 KR7168580009ACE ߱CSI300 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000349600000100001NNN00NNN000000100N0900000000136480000000000002012112900000000000360000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001258 NNN +169950 KR7169950003KODEX ̳A50 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000252750000100001NNN00NNN000000100N0900000000067930000000000002013012100000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000227 NNN +170900 KR7170900005ƿƼ ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000554000000100001NNN00NNN000000060Y0900000000360980000000050002013040800000000000935200000000004676325500012 0 NNY000005920000000034-00000247-0257-00000.0820250930000005181 NNY +174350 KR7174350009TIGER ο캼 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000187100000100001NNN00NNN000000100N0900000000012270000000000002013062000000000000028000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000052 NNN +174360 KR7174360008RISE ߱CSI100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000240450000100001NNN00NNN000000100N0900000000327000000000000002013060400000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000528 NNN +175330 KR7175330000JB ST1002100000000 NN6NNY NNNNNYNNN0NNNNNNNN0000239500000100001NNN00NNN000000050Y0900000006324260000000050002013071800000000018988400000000098491447000012 0 NYY00003434000000765400000777905938000012.3520250930000045477 NNN +176950 KR7176950004KODEX ä10ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000570900000100001NNN00NNN000000100N0900000000003840000000000002013053100000000000029400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000167 NNN +178920 KR7178920005PI÷ܼ ST3002700080000 NN0NNY NNNNNNNYN0NNNNNNNN0000165000000100001NNN00NNN000000060Y0900000001050360000000005002021080900000000002936600000000001468316100012 0 NNY00000251300000034900000030100234000007.1620241231000004845 NNY +180640 KR7180640005Į ST1002100000000 NN8YNY NYNNNNNNN0NNNNNNYN0001166000000100001NNN00NNN000000060Y0900000001084630000000025002013091600000000006676200000000016690569750012 0 NYY000002187-0000019900000113901096000005.4920250930000077844926NNY +18064K KR718064K016Į ST0002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000388500000100001NNN00NNN000000100N0900000000112960000000025002013091600000000000053600000000000134191500012 9 NNN00000000000000000000000000000000000000.00 000000208 NNN +181480 KR7181480005ACE ̱ε긮(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000808650000100001NNN00NNN030000100N0900000000002000000000000002013080100000000000012000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +181710 KR7181710005NHN ST2002900000000 NN0NNN NNNNNNNNN0NNNNNNNN0000319500000100001NNN00NNN000000050Y0900000000830540000000005002013082900000000003275300000000001875895750012 0 NNY00001830600000077200000086900290-00003.0620250930000010464 NNY +182480 KR7182480004TIGER ̱MSCI(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000124000000100001NNN00NNN030000060Y0900000002242850000000000002013101000000000001275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001586 NNN +182490 KR7182490003TIGER ܱ⼱ϵ(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000138100000100001NNN00NNN000000100N0900000000024270000000000002014032400000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000082 NNN +183190 KR7183190008ƼƽøƮ ST3002700100000 NN0NNY NNNNNNNNN0NYNNNNNN0000124700000100001NNN00NNN000000050Y0900000001693030000000005002013110600000000003692700000000001947904500012 0 NNY00000748600000069600000044000332000004.0920250930000004604 NNN +183700 KR7183700004RISE äȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000816850000100001NNN00NNN000000100N0900000000139250000000000002013101700000000000024000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000196 NNN +183710 KR7183710003RISE ֽȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000699500000100001NNN00NNN000000100N0900000000004490000000000002013101700000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000139 NNN +185680 KR7185680006KODEX ̱S&P̿(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000393600000100001NNN00NNN000000100N0900000000036990000000000002013103100000000000052700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000207 NNN +185750 KR7185750007ٴ ST2002700090000 NNANNY NNNNYNNNN0NNNNNNNN0000869000000100001NNN00NNN000000050Y0900000000388780000000025002013120600000000001380200000000003450695000012 0 NYY00001265600000057100000056800515000006.4520250930000011994 NNY +189400 KR7189400005PLUS ۷ιMSCI(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000241500000100001NNN00NNN000000100N0900000000001970000000000002013121000000000000030000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000072 NNN +190620 KR7190620005ACE ܱä EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001005350000100001NNN00NNN000000100N0900000000065400000000000002013122300000000000275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002764 NNN +192080 KR7192080000 ST2002900000000 NN8NNY NNNNNNNNN0NNNNNNNN0000525000000100001NNN00NNN000000050Y0900000000408070000000005002019031200000000002117300000000001083982550012 0 NYY00000520100000168200000177401352000014.9420250930000011116 NNY +192090 KR7192090009TIGER ̳CSI300 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000126950000100001NNN00NNN000000050Y0900000004173030000000000002014021700000000001445000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001834 NNN +192400 KR7192400000Ȧ ST2002100000000 NN0NNN NNNNNNNNN0NNNNNNNN0000268000000100001NNN00NNN000000100N0900000001322940000000001002014080600000000003556200000000000355621850012 0 NNY00000673800000078200000113400912000011.5920250930000009530 NNN +192650 KR7192650000帲 ST3002700130000 N 0NNN NN N 0 N 0000080600000100001NNN00NNN000000050Y0900000015844330000000001002019031400000000006889000000000000717835850012 0 NNY00000955100000029300000018400089-00001.9520250930000005552 NNY +192720 KR7192720001Ŀ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000525600000100001NNN00NNN000000100N0900000000109860000000000002014022000000000000027000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000141 NNN +192820 KR7192820009ڽƽ ST2002700080000 NN7NNY NNNNNNNNN0NNNNNNNN0001950000000100001NNN00NNN000000060Y0900000000912080000000005002014040700000000001134900000000000567475450012 0 NYY00001797800000154900000091600431000011.0920250930000022131 NNN +194370 KR7194370003̿۷̼ ST3002700060000 NN0NNN NNNNNNNNN0NNNNNNNN0000112400000100001NNN00NNN000000050Y0900000000912340000000001002016020400000000002901600000000000290167580012 0 NNY00000967800000097600000080600629000015.9320250930000003261 NNY +195870 KR7195870001ؼ𿡽 ST3002700130000 NN0NNY NNNYNNNNN0NNNNNNNN0000637000000100001NNN00NNN000000050Y0900000007524340000000050002016062400000000001700000000000008500000000012 0 NNY00000473400000024700000018000142000004.8020250930000010829 NNY +195920 KR7195920004TIGER ϺTOPIX(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000300550000100001NNN00NNN000000100N0900000000019500000000000002014043000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000150 NNN +195930 KR7195930003TIGER νŹ50(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000217850000100001NNN00NNN000000100N0900000000094330000000000002014043000000000000180000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000392 NNN +195970 KR7195970009PLUS MSCI(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000158700000100001NNN00NNN000000100N0900000000163330000000000002014051300000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000238 NNN +195980 KR7195980008PLUS ﱹMSCI(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000138050000100001NNN00NNN000000060Y0900000000422150000000000002014051300000000000696000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000960 NNN +196030 KR7196030001ACE ϺTOPIX(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000688250000100001NNN00NNN000000100N0900000000010380000000000002014061600000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000344 NNN +196230 KR7196230007RISE ܱä EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001153450000100001NNN00NNN000000100N0900000000046140000000000002014051900000000000179100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002065 NNN +200030 KR7200030005KODEX ̱S&P500(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000405250000100001NNN00NNN000000100N0900000000292880000000000002014061200000000000113900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000461 NNN +200250 KR7200250009KIWOOM εNifty50(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000244300000100001NNN00NNN000000060Y0900000002030150000000000002014062600000000000900000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002198 NNN +200880 KR7200880003ȭ ST3002700150000 NN0NNY NNYNNNNNN0NNNNNNNN0000149500000100001NNN00NNN000000050Y0900000002161760000000005002014080800000000002702800000000001351421850012 0 NNY00003362400000140600000088600616000010.2120250930000004040 NNY +203780 KR7203780002TIGER ̱ڹ̿ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000311100000100001NNN00NNN000000100N0900000000735430000000000002014082700000000000354000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001101 NNN +204210 KR7204210009Ÿ RT3002800000000 N 0NNN NN N 0 Y 0000020350000100001YNY00NNN000000100N09000000000000000000000500020160922000000000007826000000000039134075000 0 NNY00000000000000000000000000000000000000.00 000000159 NNN +204320 KR7204320006HL ST2002700150000 NN8NNY NNYNNNNNN0NNNNNNNN0000643000000100001NNN00NNN000000060Y0900000009367180000000010002014100600000000004695700000000004695712000012 0 NYY00006993200000277400000161300938000004.9720250930000030193920NNY +204450 KR7204450001KODEX ̳H(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000031150000100001NNN00NNN000000100N0900000004342640000000000002014091200000000001450000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000451 NNN +204480 KR7204480008TIGER ̳CSI300(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000275450000100001NNN00NNN000000100N0900000000656020000000000002014090100000000000408000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001123 NNN +205720 KR7205720006ACE ϺTOPIXι(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000017510000100001NNN00NNN000000100N0900000000109660000000000002014092900000000000380000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +207940 KR7207940008Z̿ ST1002700090000 N AYYY NY N 0 N 0017910000000100001NNN00NNN000000050Y0900000000598830000000025002016111000000000004629000000000011572737750012 0 NYY00004248400001691100001675312744000014.0220250930000829070511NNN +210540 KR7210540001Ŀ ST3002700120000 NN0NNN NNNNNNNNN0NNNNNNNN0000130800000100001NNN00NNN000000060Y0900000000818000000000005002015011500000000001104100000000000552085400012 0 NNY00000296400000025600000026600220000009.0620250930000001444 NNN +210780 KR7210780003TIGER ڽǰ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000227500000100001NNN00NNN030000050Y0900000000418770000000000002014120500000000000315000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000718 NNN +210980 KR7210980009SKص ST3002800000000 NN0NNN NNNNNNNNN0NNNNNNNN0000126400000100001NNN00NNN000000060Y0900000000274290000000010002015062300000000001861700000000001861738200012 0 NNY00000330800000049600000036900290000011.0620250930000002353535NNN +211560 KR7211560008TIGER 缺 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000316200000100001NNN00NNN000000100N0900000000231880000000000002014121700000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000711 NNN +211900 KR7211900006KODEX ڸƹ缺 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000252650000100001NNN00NNN030000100N0900000000962230000000000002014121700000000000275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000695 NNN +213500 KR7213500002Ѽ ST3002700070000 NN0NNN NNNNNNNNN0NNNNNNNN0000083700000100001NNN00NNN000000060Y0900000000824140000000050002015012600000000002380000000000011900288000012 0 NNY00001695500000042200000008100061-00003.7220250930000001992924NNN +213610 KR7213610009KODEX Z׷ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000158350000100001NNN00NNN000000050Y0900000000719970000000000002015010800000000001190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001884 NNN +213630 KR7213630007PLUS ̱ٿ(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000194750000100001NNN00NNN000000100N0900000000155950000000000002015012600000000000092000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000179 NNN +214320 KR7214320004̳ ST2002600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000187400000100001NNN00NNN000000050Y0900000001306470000000005002015071700000000004000000000000002000000000012 0 NNY00001514000000117600000114600742000008.5720250930000007496BH1NNN +214330 KR7214330003ȣġƼ ST3002700150000 NN0NNN NNNNNNNNN0NNNNNNNN0000005300000100001NNN00NNN000000060Y0900000003755580000000005002015111100000000021804600000000011152325500012 0 NNY000002902000000042-00000013-0022-00004.3820250930000001155 NNN +214390 KR7214390007溸 ST3002700090000 NN0NNY NNNNYNNNN0NNNNNNNN0000060200000100001NNN00NNN000000100N0900000000612440000000005002015062900000000002390600000000001195343000012 0 NNY00000238600000010500000004900046000003.1920241231000001439 NNN +214420 KR7214420002ϸ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000088400000100001NNN00NNN000000100N0900000001768250000000002002015071000000000002405400000000000481095980012 0 NNY00000167700000013600000010300080000017.2520250930000002126 NNN +214980 KR7214980005KODEX ܱäPLUS EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001148350000100001NNN00NNN000000050Y0900000000675890000000000002015030300000000001686900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000019371 NNN +215620 KR7215620006HK S&PڸƷο캼 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000170700000100001NNN00NNN000000100N0900000000000010000000000002015032500000000000063000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000107 NNN +217590 KR7217590009Ƽ ST0002700130000 N 0NNN NN N 0 N 0000152600000100001NNN00NNN000000100N0900000002816220000000001002025121500000000002409400000000000240942250012 0 NNY00000265000000008500000005300025000000.0020250930000003676 NNN +217770 KR7217770007TIGER ι(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000025150000100001NNN00NNN000000100N0900000002165670000000000002015042900000000000235000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000059 NNN +217780 KR7217780006TIGER ̳CSI300ι(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000055050000100001NNN00NNN000000100N0900000000027750000000000002015061000000000000155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000085 NNN +218420 KR7218420008KODEX ̱S&P500(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000165700000100001NNN00NNN000000100N0900000000446710000000000002015042800000000000177900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +219390 KR7219390002RISE ̱S&P(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000059600000100001NNN00NNN000000100N0900000000537770000000000002015060200000000000275000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000163 NNN +219480 KR7219480001KODEX ̱S&P500(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000305450000100001NNN00NNN000000100N0900000000420320000000000002015052900000000000490000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001496 NNN +219900 KR7219900008ACE ߱CSI300(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000046550000100001NNN00NNN000000100N0900000000142690000000000002015052800000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000074 NNN +220130 KR7220130009SOL ̳ұCSI500(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000071000000100001NNN00NNN000000100N0900000000003220000000000002015060800000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +223190 KR7223190000KODEX 200ġ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000221100000100001NNN00NNN000000100N0900000000050860000000000002015062600000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000221 NNN +225030 KR7225030006TIGER ̱S&P500ι(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000024500000100001NNN00NNN000000100N0900000000273320000000000002015072900000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000055 NNN +225040 KR7225040005TIGER ̱S&P500(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000583900000100001NNN00NNN000000100N0900000000111980000000000002015072900000000000116000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000677 NNN +225050 KR7225050004TIGER νŹ(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000150850000100001NNN00NNN000000100N0900000000002580000000000002015072900000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000075 NNN +225060 KR7225060003TIGER ̸¡MSCI(ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000141750000100001NNN00NNN000000100N0900000000018440000000000002015072900000000000106000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000150 NNN +225130 KR7225130004ACE 弱 (ռ H) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000791350000100001NNN00NNN000000100N0900000000315580000000000002015072800000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000395 NNN +225800 KR7225800002KIWOOM ̱޷ EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000157500000100001NNN00NNN000000100N0900000000089140000000000002015081000000000000064000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +226320 KR7226320000Ѻ ST3002700080000 NN0NNN NNNNNNNNN0NNNNNNNN0000114100000100001NNN00NNN000000050Y0900000000265750000000005002015122800000000002192900000000001096465750012 0 NNY00000111400000014300000024000223000004.3020250930000002502 NNN +226380 KR7226380004ACE FnҺֵ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000070350000100001NNN00NNN000000100N0900000000026900000000000002015081900000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000049 NNN +226490 KR7226490001KODEX ڽ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000531650000100001NNN00NNN000000050Y0900000004303450000000000002015082400000000001460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007762 NNN +226980 KR7226980001KODEX 200 ߼ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000224100000100001NNN00NNN000000100N0900000000285700000000000002015090100000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000179 NNN +227540 KR7227540002TIGER 200 コɾ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000238750000100001NNN00NNN000000100N0900000000731200000000000002015092300000000000156000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000372 NNN +227550 KR7227550001TIGER 200 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000129450000100001NNN00NNN000000100N0900000000166050000000000002015092300000000000028000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000036 NNN +227560 KR7227560000TIGER 200 ȰҺ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000132100000100001NNN00NNN000000100N0900000000086680000000000002015092300000000000032000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000042 NNN +227570 KR7227570009TIGER 췮ġ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000175600000100001NNN00NNN000000100N0900000000143290000000000002015092300000000000036000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000063 NNN +227830 KR7227830007PLUS ڽ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000533400000100001NNN00NNN030000100N0900000000007470000000000002015092300000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +227840 KR7227840006۷̼Ȧ ST3001600000000 NN0NNN NNNNNNNNN0NNNNNNNN0000122900000100001NNN00NNN000000060Y0900000000167060000000050002015102300000000000910000000000004550418000012 0 NNY00000188300000015200000030400263000011.2820250930000001118 NNN +228790 KR7228790002TIGER ȭǰ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000037800000100001NNN00NNN000000050Y0900000100505480000000000002015100700000000010938000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004134 NNN +228800 KR7228800009TIGER ෹ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000033800000100001NNN00NNN000000050Y0900000009036770000000000002015100700000000002949000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000996 NNN +228810 KR7228810008TIGER ̵ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000061250000100001NNN00NNN000000050Y0900000014004920000000000002015100700000000002532000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001550 NNN +228820 KR7228820007TIGER KTOP30 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000143550000100001NNN00NNN000000100N0900000000316280000000000002015101400000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +229200 KR7229200001KODEX ڽ150 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000203200000100001NNN00NNN000000050Y0900001198880400000000000002015100100000000015675000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000031851 NNY +229640 KR7229640008LSڿ ST2002100000000 N 0NNY NN N 0 N 0000420000000100001NNN00NNN000000050Y0900000002717410000000005002016092200000000003062400000000001531243950012 0 NYY00000711400000053700000051900421000022.8520250930000012862FN2NNY +229720 KR7229720008KODEX KTOP30 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000286500000100001NNN00NNN000000100N0900000000076360000000000002015101400000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000143 NNN +230480 KR7230480006KIWOOM ̱޷ι2X EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000044850000100001NNN00NNN000000100N0900000000234550000000000002015111600000000000238000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000106 NNN +232080 KR7232080002TIGER ڽ150 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000207500000100001NNN00NNN000000050Y0900000285069480000000000002015111200000000003298000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006843 NNN +233160 KR7233160001TIGER ڽ150 EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000216700000100001NNN00NNN000000100N0900000038642790000000000002015121700000000000795000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001722 NNN +233740 KR7233740000KODEX ڽ150 EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000194450000100001NNN00NNN000000100N0900001236447680000000000002015121700000000016920000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000032900 NNN +234080 KR7234080000JW ST3002700090000 N 0NNN NN N 0 N 0000127100000100001NNN00NNN000000060Y0900000000528890000000025002016102700000000001583400000000003958638500012 0 NNY00000193500000025700000024300222000024.7220250930000002012 NNN +234310 KR7234310001RISE V&SƮ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000246150000100001NNN00NNN000000100N0900000000051560000000000002016020200000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000123 NNN +236350 KR7236350005TIGER εƼ50(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000376900000100001NNN00NNN000000100N0900000000045560000000000002016051300000000000064000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000241 NNN +237350 KR7237350004KODEX ڽ100 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000604000000100001NNN00NNN000000050Y0900000005509710000000000002016012700000000000630000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003805 NNN +237370 KR7237370002KODEX ڸƹ缺äȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000152900000100001NNN00NNN000000100N0900000002944750000000000002016012700000000000740000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001131 NNN +237440 KR7237440003TIGER äȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000104100000100001NNN00NNN000000100N0900000000349200000000000002016012700000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000083 NNN +238670 KR7238670004PLUS ƮŸQualityäȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000126550000100001NNN00NNN000000100N0900000000033210000000000002016022400000000000030000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000037 NNN +238720 KR7238720007ACE ϺNikkei225(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000383050000100001NNN00NNN000000100N0900000000110440000000000002016030300000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000306 NNN +239660 KR7239660004PLUS 췮ȸä50 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0001204050000100001NNN00NNN000000100N0900000000015900000000000002016032200000000000014000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +241180 KR7241180009TIGER Ϻ225 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000299750000100001NNN00NNN000000050Y0900000001320660000000000002016033100000000001260000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003776 NNN +241390 KR7241390004RISE V&SƮäȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000151200000100001NNN00NNN000000100N0900000000818590000000000002016041200000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000211 NNN +241560 KR7241560002λĹ ST1002700120000 N 2YNY NY N 0 N 0000597000000100001NNN00NNN000000050Y0900000003546520000000005002016111800000000009585600000000005012458300012 0 NYY00006414700000537800000450603170000006.6920250930000057226391NNY +241590 KR7241590009ȭ¿ ST3002700060000 N 0NNN NN N 0 N 0000050000000100001NNN00NNN000000060Y0900000001622060000000005002016100400000000006058900000000003029463800012 0 NNY000011662000000229-00000115-0140000001.1420250930000003029 NNN +243880 KR7243880002TIGER 200IT EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0001530000000100001NNN00NNN000000100N0900000000345830000000000002016051300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000918 NNN +243890 KR7243890001TIGER 200ȭз EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000086500000100001NNN00NNN000000100N0900000000471880000000000002016051300000000000072500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000062 NNN +244580 KR7244580007KODEX ̿ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000135550000100001NNN00NNN000000050Y0900000038987370000000000002016051300000000002472000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003350 NNN +244620 KR7244620001KODEX Plus EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000183200000100001NNN00NNN030000100N0900000000065760000000000002016051300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000109 NNN +244660 KR7244660007KODEX ƼPlus EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000095950000100001NNN00NNN000000100N0900000000001120000000000002016051300000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000047 NNN +244670 KR7244670006KODEX Plus EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000110800000100001NNN00NNN030000100N0900000000029960000000000002016051300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +244920 KR7244920005÷ ST3002100000000 N 0NNN NN N 0 N 0000109000000100001NNN00NNN000000060Y0900000000849110000000005002020112000000000002260700000000001130384650012 0 NNY00000501700000022500000021300178000013.0620250930000002464 NNN +245340 KR7245340005TIGER ̱ٿ30 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000340300000100001NNN00NNN030000050Y0900000001228830000000000002016070100000000000404000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001375 NNN +245350 KR7245350004TIGER νŹ30 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000187400000100001NNN00NNN030000100N0900000000134910000000000002016070100000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000300 NNN +245360 KR7245360003TIGER ̳HSCEI EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000142200000100001NNN00NNN030000100N0900000000228120000000000002016061600000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000471 NNN +245710 KR7245710009ACE ƮVN30(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000307200000100001NNN00NNN000000060Y0900000001481970000000000002016070100000000001030000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003164 NNN +248070 KR7248070005ַ翥 ST2002700130000 N 0NNY NN N 0 N 0000161500000100001NNN00NNN000000050Y0900000001605200000000005002021020200000000004781600000000002500277550012 0 NYY00001272600000038400000036000191000004.2120250930000007722 NNY +248170 KR7248170003ǥǰ ST3002700050000 NN0NNN NNNNNNNNN0NNNNNNNN0000298000000100001NNN00NNN000000060Y0900000000186000000000005002016080900000000000456800000000000228414300012 0 NNY00000308400000021500000020500180000009.2020250930000001361 NNY +248270 KR7248270001TIGER S&P۷ιコɾ(ռ) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000258400000100001NNN00NNN000000060Y0900000000235040000000000002016070100000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000310 NNN +249420 KR7249420001ϵ ST3002700090000 NN0NNN NNNNNNNNN0NNNNNNNN0000399000000100001NNN00NNN000000100N0900000010214520000000010002016083100000000003163800000000003163825200012 0 NNY00000419900000011600000025700181000014.3620250930000012623 NNN +250730 KR7250730009RISE ̳HSCEI(H) EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000110950000100001NNN00NNN000000100N0900000000112000000000000002016081000000000000190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +250780 KR7250780004TIGER ڽ150ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000022000000100001NNN00NNN000000100N0900000015833350000000000002016081000000000000575000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000126 NNN +251270 KR7251270005ݸ ST1002900000000 N BYNY NY N 0 N 0000528000000100001NNN00NNN000000050Y0900000001787780000000001002017051200000000008595300000000000859535020012 0 NYY00002037500000241700000343402810000002.0320250930000045383LB6NNY +251340 KR7251340006KODEX ڽ150ι EF 000000000000NNN0NNN2NNNNNNNNN0NNNNNNNN0000021650000100001NNN00NNN000000060Y0900000868623280000000000002016081000000000008180000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001770 NNN +251350 KR7251350005KODEX MSCI EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000371350000100001NNN00NNN030000050Y0900000000848140000000000002016081700000000001340000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004988 NNN +251590 KR7251590006PLUS 50 EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000165250000100001NNN00NNN030000100N0900000000034120000000000002016081100000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000107 NNN +251600 KR7251600003PLUS äȥ EF 000000000000NNN0NNN2NNNNNNNNN0NNYNNNNN0000151050000100001NNN00NNN030000100N0900000013220730000000000002016081100000000003020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004575 NNN +252000 KR7252000005TIGER 200ϰ EF 000000000000NN 0NNN2NN N 0 Y 0000184800000100001NNN00NNN000000100N0900000000002350000000000002016092000000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000036 NNN +252400 KR7252400007RISE 200 EF 000000000000NN 0NNN2NN N 0 N 0000680200000100001NNN00NNN000000100N0900000000435560000000000002016091200000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000680 NNN +252410 KR7252410006RISE 200ι EF 000000000000NN 0NNN2NN N 0 N 0000024800000100001NNN00NNN000000100N0900000001440970000000000002016091200000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000022 NNN +252420 KR7252420005RISE 200ι2X EF 000000000000NN 0NNN2NN N 0 N 0000003910000100001NNN00NNN000000100N0900000012312300000000000002016092200000000001730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +252650 KR7252650007KODEX 200ϰ EF 000000000000NN 0NNN2NN N 0 Y 0000174700000100001NNN00NNN030000100N0900000000072110000000000002016092000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +252670 KR7252670005KODEX 200ι2X EF 000000000000NN 0NNN2NN N 0 N 0000003870000100001NNN00NNN000000100N090-019505548800000000000002016092200000000342190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000013242 NNN +252710 KR7252710009TIGER 200ι2X EF 000000000000NN 0NNN2NN N 0 N 0000004100000100001NNN00NNN000000100N0900000242486000000000000002016092200000000012540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000514 NNN +253150 KR7253150007PLUS 200 EF 000000000000NN 0NNN2NN N 0 N 0001365250000100001NNN00NNN000000100N0900000000188890000000000002016092900000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000341 NNN +253160 KR7253160006PLUS 200ι2X EF 000000000000NN 0NNN2NN N 0 N 0000007960000100001NNN00NNN000000100N0900000002484070000000000002016092200000000000265000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000021 NNN +253230 KR7253230007KIWOOM 200ι2X EF 000000000000NN 0NNN2NN N 0 N 0000003950000100001NNN00NNN000000100N0900000004388910000000000002016092200000000000726000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000028 NNN +253240 KR7253240006KIWOOM 200ι EF 000000000000NN 0NNN2NN N 0 N 0000025000000100001NNN00NNN000000100N0900000000706000000000000002016091200000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000022 NNN +253250 KR7253250005KIWOOM 200 EF 000000000000NN 0NNN2NN N 0 N 0000669650000100001NNN00NNN000000100N0900000001033860000000000002016091200000000000051000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000341 NNN +253280 KR7253280002RISE コɾ EF 000000000000NN 0NNN2NN N 0 Y 0000194350000100001NNN00NNN000000100N0900000000731920000000000002016092300000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000136 NNN +253290 KR7253290001RISE コɾäȥ EF 000000000000NN 0NNN2NN N 0 Y 0000135550000100001NNN00NNN000000100N0900000001962760000000000002016092300000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000216 NNN +256440 KR7256440009ACE MSCIε׽þ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000080350000100001NNN00NNN000000060Y0900000003618560000000000002016110100000000000440000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000353 NNN +256450 KR7256450008PLUS õ̳ؽƮ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000146000000100001NNN00NNN000000100N0900000000004320000000000002016110800000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000073 NNN +256750 KR7256750001KODEX ̳õChiNext(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000151200000100001NNN00NNN000000100N0900000000269490000000000002016110800000000000305100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000461 NNN +259960 KR7259960003ũ ST1002900000000 N BYYY YY N 0 N 0002630000000100001NNN00NNN000000050Y0900000001632120000000001002021081000000000004740300000000000492867910012 0 NYY00002406900001051900001009507564000018.7220250930000124672LC2NNY +261060 KR7261060008TIGER ڽ150IT EF 000000000000NN 0NNN2NN N 0 Y 0000225050000100001NNN00NNN000000100N0900000004464860000000000002016121500000000000042000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +261070 KR7261070007TIGER ڽ150̿ũ EF 000000000000NN 0NNN2NN N 0 Y 0000218250000100001NNN00NNN000000050Y0900000014652760000000000002016121500000000000410000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000894 NNN +261110 KR7261110001TIGER ̱޷ EF 000000000000NN 0NNN2NN N 0 N 0000166700000100001NNN00NNN000000100N0900000000044750000000000002016122700000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000116 NNN +261120 KR7261120000TIGER ̱޷ι2X EF 000000000000NN 0NNN2NN N 0 N 0000050950000100001NNN00NNN000000100N0900000000560890000000000002016122700000000000670000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000341 NNN +261140 KR7261140008TIGER 켱 EF 000000000000NN 0NNN2NN N 0 Y 0000215750000100001NNN00NNN000000100N0900000000321290000000000002017010600000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000323 NNN +261220 KR7261220008KODEX WTI(H) EF 000000000000NN 0NNN2NN N 0 N 0000146250000100001NNN00NNN000000100N0900000004039000000000000002016122700000000000502500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000734 NNN +261240 KR7261240006KODEX ̱޷ EF 000000000000NN 0NNN2NN N 0 N 0000144400000100001NNN00NNN000000050Y0900000002192700000000000002016122700000000000501000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000723 NNN +261250 KR7261250005KODEX ̱޷ EF 000000000000NN 0NNN2NN N 0 N 0000166650000100001NNN00NNN000000100N0900000001489630000000000002016122700000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000374 NNN +261260 KR7261260004KODEX ̱޷ι2X EF 000000000000NN 0NNN2NN N 0 N 0000051550000100001NNN00NNN000000100N0900000009819580000000000002016122700000000005092000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002624 NNN +261270 KR7261270003KODEX ̱޷ι EF 000000000000NN 0NNN2NN N 0 N 0000078750000100001NNN00NNN000000060Y0900000001805660000000000002016122700000000000922000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000726 NNN +261920 KR7261920003ACE MSCIʸ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000137500000100001NNN00NNN000000100N0900000000016280000000000002016122800000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000055 NNN +264900 KR7264900002ũ ST3002700050000 N 0NNN NN N 0 N 0000085900000100001NNN00NNN000000060Y0900000000145100000000002002017041100000000001252300000000000250477000012 0 NNY00000438100000021000000021400168000007.9920241231000001075 NNN +26490K KR726490K013ũ ST0002700050000 N 0NNN NN N 0 N 0000092900000100001NNN00NNN000000100N0900000000076060000000002002017041100000000000077300000000000015471200012 2 NNN00000000000000000000000000000000000000.00 000000071 NNN +265690 KR7265690008ACE þMSCI(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000085350000100001YNN00NNN000000100N0900000000000000000000000002017032100000000000185000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +266160 KR7266160001RISE EF 000000000000NN 0NNN2NN N 0 Y 0000258550000100001NNN00NNN030000050Y0900000001748660000000000002017041400000000000575000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001491 NNN +266360 KR7266360007KODEX K EF 000000000000NN 0NNN2NN N 0 Y 0000143850000100001NNN00NNN000000050Y0900000002707380000000000002017032800000000000430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000618 NNN +266370 KR7266370006KODEX IT EF 000000000000NN 0NNN2NN N 0 Y 0000388600000100001NNN00NNN000000100N0900000000288860000000000002017032800000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000466 NNN +266390 KR7266390004KODEX Һ EF 000000000000NN 0NNN2NN N 0 Y 0000106350000100001NNN00NNN000000100N0900000000176250000000000002017032800000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +266410 KR7266410000KODEX ʼҺ EF 000000000000NN 0NNN2NN N 0 Y 0000086050000100001NNN00NNN000000100N0900000004254840000000000002017032800000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +266420 KR7266420009KODEX コɾ EF 000000000000NN 0NNN2NN N 0 Y 0000246650000100001NNN00NNN000000050Y0900000011005110000000000002017032800000000000520000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001282 NNN +266550 KR7266550003PLUS 50 EF 000000000000NN 0NNN2NN N 0 Y 0000161650000100001NNN00NNN000000100N0900000000000020000000000002017032800000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000040 NNN +267250 KR7267250009HD ST1002100000000 N 4YNY NY N 0 N 0002375000000100001NNN00NNN000000050Y0900000001771090000000010002017051000000000007899300000000008143308500012 0 NYY00052522300004127700003030522523000007.9220250930000187608IC5NNY +267260 KR7267260008HDϷƮ ST1002700130000 N 2YYY YY N 0 N 0009020000000100001NNN00NNN000000050Y0900000002032580000000050002017051000000000003604700000000018023567500012 0 NYY00002916300000674400000640304865000038.9520250930000325145IC5NNN +267270 KR7267270007HDǼ ST2002700120000 N 0NNY NN N 0 N 0001073000000100001NNN00NNN000000050Y0900000010651440000000050002017051000000000004797400000000024705902000012 0 NYY00002829300000137500000097800685000005.2820250930000051476IC5NNY +267290 KR7267290005浿ð ST3001700000000 N 0NNN NN N 0 N 0000214000000100001NNN00NNN000000060Y0900000000125350000000025002017051200000000000589500000000001473851500012 0 NNY00001313000000024300000032000248000006.8220250930000001261 NNN +267440 KR7267440006RISE ̱ⱹä(H) EF 000000000000NN 0NNN2NN N 0 N 0000083900000100001NNN00NNN000000100N0900000000035410000000000002017042000000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +267450 KR7267450005RISE ̱ⱹäι(H) EF 000000000000NN 0NNN2NN N 0 N 0000107400000100001NNN00NNN000000100N0900000000000020000000000002017042000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000053 NNN +267490 KR7267490001RISE ̱ⱹä(ռ H) EF 000000000000NN 0NNN2NN N 0 N 0000056000000100001NNN00NNN000000100N0900000000017630000000000002017042000000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000053 NNN +267770 KR7267770006TIGER 200 EF 000000000000NN 0NNN2NN N 0 N 0000564500000100001NNN00NNN000000100N0900000005934500000000000002017042500000000000280000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001580 NNN +267850 KR7267850006ƽþƳIDT ST3002900000000 N 0NNN NN N 0 N 0000111300000100001NNN00NNN000000100N0900000000100820000000005002018112300000000001110000000000000555000000012 0 NNY00000194000000009200000013400118000007.0620241231000001235926NNN +268280 KR7268280005̿ ST2002700080000 N 4NNN NN N 0 N 0001352000000100001NNN00NNN000000100N0900000000026270000000005002017052200000000000500000000000000263394550012 0 NNY00000406000000055400000058000461000014.3620250930000006760 NNN +269370 KR7269370003TIGER S&P۷ι(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000174800000100001NNN00NNN030000100N0900000000013050000000000002017051600000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000123 NNN +269420 KR7269420006KODEX S&P۷ι(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000223650000100001NNN00NNN000000100N0900000000371420000000000002017051600000000000101600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000227 NNN +269530 KR7269530002PLUS S&P۷ι EF 000000000000NN 0NNN2NN N 0 Y 0000203100000100001NNN00NNN030000100N0900000000049720000000000002017051600000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000112 NNN +269540 KR7269540001PLUS ̱S&P500(H) EF 000000000000NN 0NNN2NN N 0 Y 0000278100000100001NNN00NNN000000100N0900000002049350000000000002017051600000000000340000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000945 NNN +270800 KR7270800006RISE KQ EF 000000000000NN 0NNN2NN N 0 Y 0000153450000100001NNN00NNN030000100N0900000000208880000000000002017070700000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +270810 KR7270810005RISE ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000201600000100001NNN00NNN000000050Y0900000053740540000000000002017061600000000000956000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001927 NNN +271050 KR7271050007KODEX WTIι(H) EF 000000000000NN 0NNN2NN N 0 N 0000039300000100001NNN00NNN000000100N0900000008611750000000000002017061300000000000452500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000177 NNN +271060 KR7271060006KODEX 3깰(H) EF 000000000000NN 0NNN2NN N 0 N 0000077700000100001NNN00NNN000000050Y0900000000811460000000000002017061300000000000318000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000247 NNN +271560 KR7271560005 ST1002700050000 N 7YNY NY N 0 N 0001170000000100001NNN00NNN000000050Y0900000004004740000000005002017070700000000003953600000000001976806600012 0 NYY00002407900000390700000392602828000015.6620250930000046257 NNN +271940 KR7271940009ַ̼罺 ST2002700150000 N 0NNN NN N 0 N 0000147400000100001NNN00NNN000000100N0900000001870300000000005002021090100000000003631300000000001815659500012 0 NNY000000574-00000102-00000038-0030000000.0020250930000005352 NNN +271980 KR7271980005Ͼǰ ST3002700090000 N 0NNN NN N 0 N 0000148100000100001NNN00NNN000000100N0900000000303860000000005002017071700000000001470400000000000735243600012 0 NNY00000435400000020200000026200225000010.5220250930000002177 NNN +272210 KR7272210006ȭý ST1002700130000 N 9YNY YY N 0 N 0000890000000100001NNN00NNN000000050Y0900000012663370000000050002019111300000000018891900000000094459694500012 0 NYY00002266000000114100000214802398000017.1620250930000168138913NNY +272450 KR7272450008 ST3001900000000 N 0NNN NN N 0 N 0000068800000100001NNN00NNN000000100N0900000001774650000000010002017120800000000005220000000000005220000000012 0 NNY00001461300000163100000122700957000051.1520241231000003591926NNN +272550 KR7272550005Ű¡ ST3002700080000 N 0NNN NN N 0 N 0000124500000100001NNN00NNN000000060Y0900000000230190000000050002017112900000000001506800000000007894335500012 0 NNY00000337400000028200000027600222000004.4420250930000001876512NNN +272560 KR7272560004RISE ܱⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001132950000100001NNN00NNN000000060Y0900000000035300000000000002017062900000000000158800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001799 NNN +272570 KR7272570003RISE ⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001088600000100001NNN00NNN000000100N0900000000000580000000000002017062900000000000022500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000244 NNN +272580 KR7272580002TIGER ܱäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000561800000100001NNN00NNN000000060Y0900000000284920000000000002017062900000000001329200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007467 NNN +272910 KR7272910001ACE ⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001066700000100001NNN00NNN000000100N0900000000000800000000000002017062900000000000059900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000638 NNN +273130 KR7273130005KODEX ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001139100000100001NNN00NNN000000060Y0900000000482670000000000002017062900000000003281900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000037384 NNN +273140 KR7273140004KODEX ܱ⺯ݸäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001147450000100001NNN00NNN000000100N0900000000152520000000000002017062900000000000282400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003240 NNN +275280 KR7275280006KODEX EF 000000000000NN 0NNN2NN N 0 Y 0000301100000100001NNN00NNN000000100N0900000000153390000000000002017071100000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +275290 KR7275290005KODEX ġ EF 000000000000NN 0NNN2NN N 0 Y 0000221900000100001NNN00NNN000000100N0900000000087100000000000002017071100000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000199 NNN +275300 KR7275300002KODEX 췮 EF 000000000000NN 0NNN2NN N 0 Y 0000201750000100001NNN00NNN000000100N0900000000276530000000000002017071100000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000282 NNN +275750 KR7275750008RISE ڽ150ι EF 000000000000NN 0NNN2NN N 0 N 0000021850000100001NNN00NNN000000100N0900000000840240000000000002017080100000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000017 NNN +275980 KR7275980001TIGER ۷ι4ű(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000221000000100001NNN00NNN000000100N0900000000174780000000000002017080100000000000320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000707 NNN +276000 KR7276000007TIGER ۷ιڿ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000197550000100001NNN00NNN000000100N0900000000083790000000000002017080100000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000167 NNN +276650 KR7276650009RISE ۷ιũ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000402200000100001NNN00NNN000000100N0900000000003930000000000002017081700000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000301 NNN +276970 KR7276970001KODEX ̱S&P500Ŀ(ռ H)EF 000000000000NN 0NNN2NN N 0 Y 0000078800000100001NNN00NNN000000100N0900000000185970000000000002017081000000000000470000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000370 NNN +276990 KR7276990009KODEX ۷ικ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000246400000100001NNN00NNN000000060Y0900000000259340000000000002017081700000000000175500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000432 NNN +277540 KR7277540001ACE ƽþTOP50 EF 000000000000NN 0NNN2NN N 0 Y 0000267900000100001NNN00NNN000000100N0900000000033930000000000002017082300000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000214 NNN +277630 KR7277630000TIGER ڽ EF 000000000000NN 0NNN2NN N 0 Y 0000537300000100001NNN00NNN030000050Y0900000001193170000000000002017083100000000000665000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003576 NNN +277640 KR7277640009TIGER ڽǴ EF 000000000000NN 0NNN2NN N 0 Y 0000273900000100001NNN00NNN000000100N0900000000535430000000000002017083100000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000342 NNN +277650 KR7277650008TIGER ڽ EF 000000000000NN 0NNN2NN N 0 Y 0000211300000100001NNN00NNN000000100N0900000000029350000000000002017083100000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000042 NNN +278240 KR7278240007RISE ڽ150 EF 000000000000NN 0NNN2NN N 0 N 0000219450000100001NNN00NNN000000100N0900000003942000000000000002017083100000000000806000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001768 NNN +278470 KR7278470000Ǿ ST1002700080000 N 7NNY YY N 0 N 0002710000000100001NNN00NNN000000050Y0900000004680140000000001002024022700000000003743000000000000389283900012 0 NYY00000979700000235200000233501909000074.3520250930000101437 NNY +278530 KR7278530001KODEX 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000273850000100001NNN00NNN000000050Y0900000016914690000000000002017112100000000018675000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000051141 NNN +278540 KR7278540000KODEX MSCI Korea TR EF 000000000000NN 0NNN2NN N 0 Y 0000266150000100001NNN00NNN000000050Y0900000000270940000000000002017110900000000008010000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000021318 NNN +278620 KR7278620000PLUS ܱäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001175700000100001NNN00NNN000000100N0900000000003080000000000002017092600000000000043200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000507 NNN +279530 KR7279530000KODEX EF 000000000000NN 0NNN2NN N 0 Y 0000152550000100001NNN00NNN030000050Y0900000005508190000000000002017101700000000001790000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002738 NNN +279540 KR7279540009KODEX ּҺ EF 000000000000NN 0NNN2NN N 0 Y 0000177350000100001NNN00NNN000000100N0900000000000380000000000002017101700000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000088 NNN +280320 KR7280320003ACE ̱ITͳ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000203500000100001NNN00NNN000000100N0900000000000240000000000002017101700000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000162 NNN +280360 KR7280360009ԵǪ ST2002700050000 N 7NNY NN N 0 N 0001129000000100001NNN00NNN000000050Y0900000000139470000000005002017103000000000000930400000000000465228700012 0 NYY00003196200000120000000118000884000003.0420250930000010504283NNN +280920 KR7280920000PLUS ֵ EF 000000000000NN 0NNN2NN N 0 Y 0000202250000100001NNN00NNN000000100N0900000000146900000000000002017101700000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000111 NNN +280930 KR7280930009KODEX ̱2000(H) EF 000000000000NN 0NNN2NN N 0 N 0000154350000100001NNN00NNN000000050Y0900000000397140000000000002017110900000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000347 NNN +280940 KR7280940008KODEX 弱ι(H) EF 000000000000NN 0NNN2NN N 0 N 0000029150000100001NNN00NNN000000100N0900000000486450000000000002017110900000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000027 NNN +281820 KR7281820001̾ ST2002700140000 N 0NNN NN N 0 N 0000446500000100001NNN00NYN000000050Y0900000003382780000000005002017120500000000002069000000000001043077800012 0 NNY00000271200000038300000042000338000000.0020250930000009238 NNY +281990 KR7281990002RISE ߼ EF 000000000000NN 0NNN2NN N 0 Y 0000170350000100001NNN00NNN030000100N0900000000032650000000000002017110200000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000111 NNN +282000 KR7282000009RISE ä3⼱ι EF 000000000000NN 0NNN2NN N 0 N 0001124500000100001NNN00NNN000000100N0900000000000140000000000002017110900000000000010300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000115 NNN +282330 KR7282330000BGF ST2001600000000 N 7NNY NN N 0 N 0001169000000100001NNN00NNN000000060Y0900000000363020000000010002017120800000000001728300000000001728390600012 0 NYY00006768900000189700000183301455000015.6820250930000020204LD7NNN +283580 KR7283580009KODEX ̳CSI300 EF 000000000000NN 0NNN2NN N 0 Y 0000156400000100001NNN00NNN030000100N0900000007067840000000000002017121300000000001700000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002668 NNN +284430 KR7284430006KODEX 200̱äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000183900000100001NNN00NNN000000050Y0900000019590140000000000002017113000000000005192000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000009548 NNN +284740 KR7284740008Ȩý ST2002600000000 N 0NNN NN N 0 N 0000232500000100001NNN00NNN000000100N0900000000171860000000001002018011100000000002243700000000000224373300012 0 NNY00000856800000125100000122100903000011.9120250930000005216 NNN +284980 KR7284980000RISE 200 EF 000000000000NN 0NNN2NN N 0 Y 0000187700000100001NNN00NNN030000100N0900000000184620000000000002017120800000000000092000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000173 NNN +285130 KR7285130001SKɹĮ ST2002700080000 N 4NNY NN N 0 N 0000689000000100001NNN00NNN000000050Y0900000000795780000000050002018010500000000001729800000000008844127500012 0 NYY00001743400000038900000035200772000003.8420250930000011918535NNY +28513K KR728513K010SKɹĮ ST0002700080000 N 0NNN NN N 0 N 0000281000000100001NNN00NNN000000100N0900000000182000000000050002018010500000000000211500000000001057714500012 9 NNN00000000000000000000000000000000000000.00 000000594 NNN +285690 KR7285690004FOCUS ESG EF 000000000000NN 0NNN2NN N 0 Y 0000180350000100001NNN00NNN000000100N0900000000005130000000000002017121300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000108 NNN +286940 KR7286940002Ե̳뺣Ʈ ST3002900000000 N 0NNN NN N 0 N 0000211500000100001NNN00NNN000000050Y0900000000216890000000050002018072700000000001512900000000007564683500012 0 NNY00000843100000021600000016300101000002.5620250930000003199283NNN +287180 KR7287180004PLUS ̱ũ EF 000000000000NN 0NNN2NN N 0 Y 0000444900000100001NNN00NNN000000050Y0900000000018210000000000002017121300000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000333 NNN +289040 KR7289040008KODEX MSCI KOREA ESGϹ EF 000000000000NN 0NNN2NN N 0 Y 0000224950000100001NNN00NNN000000100N0900000000133710000000000002018020700000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +289250 KR7289250003TIGER MSCI KOREA ESGϹ EF 000000000000NN 0NNN2NN N 0 Y 0000226350000100001NNN00NNN000000100N0900000000101900000000000002018020700000000000066000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000149 NNN +289260 KR7289260002TIGER MSCI KOREA ESG EF 000000000000NN 0NNN2NN N 0 Y 0000192950000100001NNN00NNN000000100N0900000000020950000000000002018020700000000000078000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000150 NNN +289480 KR7289480006TIGER 200Ŀ EF 000000000000NN 0NNN2NN N 0 Y 0000098550000100001NNN00NNN030000060Y0900000000774700000000000002018020900000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000228 NNN +289670 KR7289670002PLUS ä10 EF 000000000000NN 0NNN2NN N 0 N 0000539350000100001NNN00NNN000000100N0900000000005410000000000002018020700000000000010400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +290080 KR7290080001RISE 200ĿATM EF 000000000000NN 0NNN2NN N 0 N 0000081200000100001NNN00NNN030000100N0900000000175200000000000002018022700000000000195000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000159 NNN +290130 KR7290130004RISE ESGȸå EF 000000000000NN 0NNN2NN N 0 Y 0000302750000100001NNN00NNN000000100N0900000003591730000000000002018022700000000000440000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001332 NNN +291130 KR7291130003ACE MSCI߽(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000194000000100001NNN00NNN000000100N0900000000031470000000000002018030900000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000174 NNN +291620 KR7291620003KIWOOM ڽ150ι EF 000000000000NN 0NNN2NN N 0 N 0000038900000100001NNN00NNN000000100N0900000000617470000000000002018031600000000000052000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000020 NNN +291630 KR7291630002KIWOOM ڽ150 EF 000000000000NN 0NNN2NN N 0 N 0000097500000100001NNN00NNN000000100N0900000002929690000000000002018031600000000000052000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000050 NNN +291680 KR7291680007RISE ̳Hι(H) EF 000000000000NN 0NNN2NN N 0 N 0000071600000100001NNN00NNN000000100N0900000000000700000000000002018032300000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000035 NNN +291890 KR7291890002KODEX MSCI EM(H) EF 000000000000NN 0NNN2NN N 0 N 0000114450000100001NNN00NNN000000100N0900000000021180000000000002018032300000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000074 NNN +292050 KR7292050002RISE KRX300 EF 000000000000NN 0NNN2NN N 0 Y 0000361000000100001NNN00NNN000000100N0900000000086890000000000002018032600000000000035000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000126 NNN +292150 KR7292150000TIGER ڸTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000274650000100001NNN00NNN030000050Y0900000035389530000000000002018033000000000006485000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000017843 NNN +292160 KR7292160009TIGER KRX300 EF 000000000000NN 0NNN2NN N 0 Y 0000352550000100001NNN00NNN030000100N0900000000075220000000000002018032600000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000176 NNN +292190 KR7292190006KODEX KRX300 EF 000000000000NN 0NNN2NN N 0 Y 0000352850000100001NNN00NNN000000100N0900000000446450000000000002018032600000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000458 NNN +292500 KR7292500006SOL KRX300 EF 000000000000NN 0NNN2NN N 0 Y 0000357250000100001NNN00NNN030000100N0900000000073610000000000002018032600000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000179 NNN +292560 KR7292560000TIGER Ϻ EF 000000000000NN 0NNN2NN N 0 N 0000086500000100001NNN00NNN000000050Y0900000001259720000000000002018041700000000000730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000631 NNN +292770 KR7292770005KODEX ä3ι EF 000000000000NN 0NNN2NN N 0 N 0000565250000100001NNN00NNN000000100N0900000000000000000000000002018041300000000000022800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000128 NNN +293180 KR7293180006HANARO 200 EF 000000000000NN 0NNN2NN N 0 Y 0000763550000100001NNN00NNN030000100N0900000002601010000000000002018033000000000000890000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006804 NNN +293480 KR7293480000ϳ ST3002700090000 N 0NNN NN N 0 N 0000102700000100001NNN00NNN000000060Y0900000001299060000000005002018100200000000001777200000000000888647300012 0 NNY00000225300000025200000025400213000007.2420241231000001825 NNN +293940 KR7293940003Ѿĸ RT2002800000000 N 0NNN NN N 0 Y 0000057400000100001NNN00NNN000000060Y09000000028577100000000100020180808000000000120940000000000120940123000 0 NNY00000000000000000000000000000000000000.00 000006941 NNN +294400 KR7294400007KIWOOM 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000991450000100001NNN00NNN000000050Y0900000002763800000000000002018042300000000001600000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000015863 NNN +294870 KR7294870001HDC ST2001800000000 N 0NNY NN N 0 N 0000213500000100001NNN00NNN000000050Y0900000005770510000000050002018061200000000006590700000000032953665000012 0 NYY00003122000000207300000190801467000006.1120250930000014071HDCNNY +295000 KR7295000004RISE ä10 EF 000000000000NN 0NNN2NN N 0 N 0000532050000100001NNN00NNN000000100N0900000000018930000000000002018051100000000000021400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +295020 KR7295020002RISE ä10ι EF 000000000000NN 0NNN2NN N 0 N 0000572750000100001NNN00NNN000000100N0900000000000080000000000002018051100000000000023800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000136 NNN +295040 KR7295040000SOL 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000283950000100001NNN00NNN000000100N0900000001073900000000000002018042300000000001110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003151 NNN +298000 KR7298000001ȿȭ ST3002700080000 N 0NNN NN N 0 N 0000389000000100001YNN00NNN000000100N0900000000000000000000050002018071300000000000379100000000001895905500012 0 NNY000017702-00000872-0000219604359000199.3620250930000001475971NNN +298020 KR7298020009ȿƼؾ ST2002700080000 N 4NNY NN N 0 N 0003865000000100001NNN00NNN000000100N0900000000605460000000050002018071300000000000432700000000002163841000012 0 NYY00005851700000206800000105900615000004.3920250930000016726971NNN +298040 KR7298040007ȿ߰ ST1002700130000 N 2YNY YY N 0 N 0025180000000100001NNN00NNN000000050Y0900000000743400000000050002018071300000000000932400000000004662274000012 0 NYY00004225600000486500000433103427000025.9020250930000234792971NNY +298050 KR7298050006HSȿ÷ܼ ST2002700080000 N 4NNY NN N 0 N 0002665000000100001NNN00NNN000000060Y0900000000759980000000050002018071300000000000447900000000002239974000012 0 NYY00002497600000127200000054900080-00000.8020250930000011939971NNN +298340 KR7298340001PLUS ä3 EF 000000000000NN 0NNN2NN N 0 N 0000562100000100001NNN00NNN000000100N0900000000750250000000000002018060800000000000089200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000501 NNN +298690 KR7298690009λ ST3001900000000 N 0NNN NN N 0 N 0000018110000100001NNN00NNN000000100N0900000003178220000000010002018122700000000011664000000000011664000000012 0 NNY00001006800000146300000003500024000001.4820241231000002112926NNN +298770 KR7298770009KODEX ѱ븸IT̾ EF 000000000000NN 0NNN2NN N 0 Y 0000504200000100001NNN00NNN030000100N0900000000603730000000000002018061100000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000555 NNN +300610 KR7300610003TIGER K EF 000000000000NN 0NNN2NN N 0 Y 0000073300000100001NNN00NNN000000100N0900000002052640000000000002018072400000000000270000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000197 NNN +300640 KR7300640000RISE ׸ EF 000000000000NN 0NNN2NN N 0 Y 0000086250000100001NNN00NNN000000050Y0900000001767870000000000002018072400000000000420000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000362 NNN +300720 KR7300720000ϽøƮ ST2002700100000 N 1NNY NN N 0 N 0000166500000100001NNN00NNN000000050Y0900000001795670000000005002018080600000000007354500000000003677260450012 0 NYY00001063600000115100000100700709000004.5420250930000012245 NNY +300950 KR7300950003KODEX ӻ EF 000000000000NN 0NNN2NN N 0 Y 0000069200000100001NNN00NNN000000050Y0900000004948250000000000002018072400000000000630000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000435 NNN +301400 KR7301400008PLUS ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000204950000100001NNN00NNN000000100N0900000002698980000000000002018070500000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000102 NNN +301410 KR7301410007PLUS ڽ150ι EF 000000000000NN 0NNN2NN N 0 N 0000032800000100001NNN00NNN000000100N0900000000375360000000000002018071100000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000008 NNN +302190 KR7302190004TIGER ⱹä EF 000000000000NN 0NNN2NN N 0 Y 0000509700000100001NNN00NNN000000100N0900000000168110000000000002018072000000000000622000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003170 NNN +302440 KR7302440003SK̿̾ ST2002700090000 N AYNY NN N 0 N 0000515000000100001NNN00NNN000000060Y0900000001666570000000005002021031800000000007843400000000003921735050012 0 NYY000004672-00000719-0000064500002-00000.3320250930000040393535NNN +302450 KR7302450002RISE ڽ EF 000000000000NN 0NNN2NN N 0 Y 0000537000000100001NNN00NNN030000100N0900000001852380000000000002018072400000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002905 NNN +304660 KR7304660004KODEX ̱30ⱹäƮ󼱹(H) EF 000000000000NN 0NNN2NN N 0 N 0000076050000100001NNN00NNN000000060Y0900000003534870000000000002018091200000000002920000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002220 NNN +304670 KR7304670003KODEX ̱30ⱹäƮ󼱹ι(H) EF 000000000000NN 0NNN2NN N 0 N 0000116800000100001NNN00NNN000000100N0900000000000170000000000002018091200000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000070 NNN +304760 KR7304760002HANARO KRX300 EF 000000000000NN 0NNN2NN N 0 Y 0000343950000100001NNN00NNN030000100N0900000000047590000000000002018081400000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +304770 KR7304770001HANARO ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000202700000100001NNN00NNN000000100N0900000003279860000000000002018081400000000000114000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000231 NNN +304780 KR7304780000HANARO 200 EF 000000000000NN 0NNN2NN N 0 N 0000830650000100001NNN00NNN000000100N0900000000016660000000000002018081400000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000913 NNN +304940 KR7304940000KODEX ̱100(H) EF 000000000000NN 0NNN2NN N 0 N 0000292500000100001NNN00NNN000000050Y0900000000589580000000000002018083000000000000395000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001155 NNN +305050 KR7305050007ACE ڽ EF 000000000000NN 0NNN2NN N 0 Y 0000539300000100001NNN00NNN000000100N0900000000098990000000000002018100500000000000045000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000242 NNN +305080 KR7305080004TIGER ̱ä10⼱ EF 000000000000NN 0NNN2NN N 0 N 0000128950000100001NNN00NNN000000050Y0900000002911060000000000002018083000000000001810000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002333 NNN +305540 KR7305540007TIGER 2׸ EF 000000000000NN 0NNN2NN N 0 Y 0000221950000100001NNN00NNN000000050Y0900000048156910000000000002018091200000000006690000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000014848 NNN +305720 KR7305720005KODEX 2 EF 000000000000NN 0NNN2NN N 0 Y 0000182750000100001NNN00NNN000000050Y0900000168543460000000000002018091200000000011110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000020303 NNY +306200 KR7306200007 ST3002700110000 N 0NNN NN N 0 N 0001186000000100001NNN00NNN000000060Y0900000000085490000000050002018100500000000000283600000000001418150000012 0 NNY00001125500000041300000032800185000000.0020250930000003363474NNN +306520 KR7306520008HANARO 200ι EF 000000000000NN 0NNN2NN N 0 N 0000044850000100001NNN00NNN000000100N0900000000063260000000000002018091800000000000035000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000015 NNN +306530 KR7306530007HANARO ڽ150 EF 000000000000NN 0NNN2NN N 0 N 0000195050000100001NNN00NNN000000100N0900000001859910000000000002018091800000000000034000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +306950 KR7306950007KODEX KRX300 EF 000000000000NN 0NNN2NN N 0 N 0000563000000100001NNN00NNN000000100N0900000000095120000000000002018101600000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000563 NNN +307510 KR7307510008TIGER Ƿ EF 000000000000NN 0NNN2NN N 0 Y 0000211500000100001NNN00NNN000000100N0900000000197310000000000002018110800000000000035000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000074 NNN +307520 KR7307520007TIGER ȸ EF 000000000000NN 0NNN2NN N 0 Y 0000185500000100001NNN00NNN000000100N0900000007448320000000000002018110800000000001630000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003023 NNN +307950 KR7307950006信 ST1002900000000 N 5NNY NY N 0 N 0004410000000100001NNN00NNN000000050Y0900000001619420000000005002019032800000000002742300000000001371199100012 0 NYY00002929300000178800000180301324000010.4020250930000120939BH1NNY +308170 KR7308170000Ƽ˸Ƽ ST3002700150000 N 0NNN NN N 0 N 0000070500000100001NNN00NNN000000100N0900000001997870000000005002019112500000000000861000000000000430500000012 0 NNY000003534000000045-00000024-0025-00021.7020250930000000607 NNN +308620 KR7308620004KODEX ̱10ⱹä EF 000000000000NN 0NNN2NN N 0 N 0000120500000100001NNN00NNN000000050Y0900000001717120000000000002018101900000000000870000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001048 NNN +309230 KR7309230001ACE ̱WideMoatϰ EF 000000000000NN 0NNN2NN N 0 Y 0000310050000100001NNN00NNN030000100N0900000000346670000000000002018102500000000000460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001430 NNN +310080 KR7310080007RISE ߱MSCI China(H) EF 000000000000NN 0NNN2NN N 0 Y 0000111600000100001NNN00NNN000000100N0900000000058820000000000002018112800000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000139 NNN +310960 KR7310960000TIGER 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000443300000100001NNN00NNN000000100N0900000001128720000000000002018112000000000000480000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002127 NNN +310970 KR7310970009TIGER MSCI Korea TR EF 000000000000NN 0NNN2NN N 0 Y 0000334850000100001NNN00NNN000000050Y0900000000448750000000000002018112000000000011510000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000038541 NNN +314250 KR7314250002KODEX ̱ũ10(H) EF 000000000000NN 0NNN2NN N 0 Y 0000541400000100001NNN00NNN030000050Y0900000001381990000000000002019011000000000001295000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007025 NNN +314700 KR7314700006HANARO ջ EF 000000000000NN 0NNN2NN N 0 Y 0000112350000100001NNN00NNN000000100N0900000000059910000000000002018122100000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000061 NNN +315270 KR7315270009TIGER 200Ŀ´̼Ǽ EF 000000000000NN 0NNN2NN N 0 Y 0000239350000100001NNN00NNN000000100N0900000000276740000000000002019011500000000000022000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000052 NNN +315930 KR7315930008KODEX Top5PlusTR EF 000000000000NN 0NNN2NN N 0 Y 0000554150000100001NNN00NNN000000050Y0900000004763190000000000002019012200000000002730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000015128 NNN +315960 KR7315960005RISE 10TR EF 000000000000NN 0NNN2NN N 0 Y 0000513700000100001NNN00NNN000000050Y0900000005304320000000000002019012200000000000495000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002542 NNN +316140 KR7316140003츮 ST1002100000000 N 6YYY YY N 0 N 0000302000000100001NNN00NNN000000050Y0900000016611750000000050002019021300000000073407600000000380267630000012 0 NYY00031092300002965700003580128858000009.3320250930000221691 NNY +316300 KR7316300003ACE ̰ EF 000000000000NN 0NNN2NN N 0 N 0000149500000100001NNN00NNN030000100N0900000000030410000000000002019012900000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000075 NNN +316670 KR7316670009KIWOOM ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000101500000100001NNN00NNN000000100N0900000010883700000000000002019012200000000000422000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000428 NNN +317400 KR7317400000̿ص ST3002800000000 N 0NNN NN N 0 N 0000040400000100001NNN00NNN000000060Y0900000004389610000000010002019110600000000003878200000000003878252000012 0 NNY00001052600000015000000049100337000006.4620250930000001566FN4NNN +317450 KR7317450005 ST0002700090000 N 0NNN NN N 0 N 0000652000000100001NNN00NNN000000060Y0900000000591400000000005002025100100000000001460000000000000730000000012 0 NNY00000215200000068800000075300582000000.0020250930000009519 NNY +319640 KR7319640009TIGER 弱(H) EF 000000000000NN 0NNN2NN N 0 N 0000318200000100001NNN00NNN000000060Y0900000001117560000000000002019040900000000000500000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001591 NNN +321410 KR7321410003KODEX Ƽ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000107250000100001NNN00NNN030000100N0900000000004110000000000002019060500000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000054 NNN +322000 KR7322000001HD뿡ַ ST3002700130000 N 0NNN NN N 0 N 0000540000000100001NNN00NNN000000050Y0900000001553840000000050002019111900000000001120000000000005600000000012 0 NNY00000340000000026700000029300223000008.0620250930000006048IC5NNY +322400 KR7322400003HANARO eĿӽ EF 000000000000NN 0NNN2NN N 0 Y 0000133350000100001NNN00NNN000000050Y0900000000592360000000000002019042300000000000430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000573 NNN +322410 KR7322410002HANARO K EF 000000000000NN 0NNN2NN N 0 Y 0000207450000100001NNN00NNN030000100N0900000000256550000000000002019042300000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000301 NNN +323410 KR7323410001īīũ ST1002100000000 N 6YYY NY N 0 N 0000235000000100001NNN00NNN000000050Y0900000019318760000000050002021080600000000047701100000000238505718500012 0 NYY00002945600000606900000588904401000006.9520241231000112097KAONNY +325010 KR7325010007KODEX EF 000000000000NN 0NNN2NN N 0 Y 0000308650000100001NNN00NNN000000100N0900000000634310000000000002019053100000000000500000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001543 NNN +325020 KR7325020006KODEX 簡ġ EF 000000000000NN 0NNN2NN N 0 Y 0000235100000100001NNN00NNN030000100N0900000000586070000000000002019053100000000000650000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001540 NNN +326030 KR7326030004SK̿ ST1002600000000 N AYNY NY N 0 N 0001194000000100001NNN00NNN000000050Y0900000002872900000000005002020070200000000007831300000000003915662500012 0 NYY00000512400000157700000117101205000063.4220250930000093506535NNY +326230 KR7326230000RISE ÷ EF 000000000000NN 0NNN2NN N 0 Y 0000118200000100001NNN00NNN000000100N0900000000453100000000000002019062000000000000132000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000156 NNN +326240 KR7326240009RISE IT÷ EF 000000000000NN 0NNN2NN N 0 Y 0000314800000100001NNN00NNN000000100N0900000000668590000000000002019062000000000000288000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000906 NNN +328370 KR7328370002PLUS ڽTR EF 000000000000NN 0NNN2NN N 0 Y 0000287600000100001NNN00NNN000000050Y0900000000090370000000000002019062500000000000380000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001092 NNN +329180 KR7329180004HD߰ ST1002700150000 N 2YYY YY N 0 N 0005860000000100001NNN00NNN000000050Y0900000002663790000000050002021091700000000010496100000000052480612500012 0 NYY00012387500001462500001227309259000021.6820250930000615072IC5NNY +329200 KR7329200000TIGER ε EF 000000000000NN 0NNN2NN N 0 Y 0000045450000100001NNN00NNN030000050Y0900000051149260000000000002019071900000000026605000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012171 NNN +329650 KR7329650006KODEX TRF3070 EF 000000000000NN 0NNN2NN N 0 Y 0000143350000100001NNN00NNN000000100N0900000001142020000000000002019070400000000001820000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002608 NNN +329660 KR7329660005KODEX TRF5050 EF 000000000000NN 0NNN2NN N 0 Y 0000176650000100001NNN00NNN000000100N0900000000623890000000000002019070400000000000600000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001059 NNN +329670 KR7329670004KODEX TRF7030 EF 000000000000NN 0NNN2NN N 0 Y 0000214300000100001NNN00NNN000000100N0900000000448990000000000002019070400000000000390000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000835 NNN +329750 KR7329750004TIGER ̱޷ܱäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000131800000100001NNN00NNN000000100N0900000005160790000000000002019072400000000003592000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004734 NNN +330590 KR7330590001Ե RT2002800000000 N 0NNN NN N 0 Y 0000043750000100001NNN00NNN000000060Y09000000056068300000000050020191030000000000288968000000000144484442000 0 NNY00000000000000000000000000000000000000.00 000012642283NNN +332500 KR7332500008ACE 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000509600000100001NNN00NNN000000100N0900000001033360000000000002019082800000000000210000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001070 NNN +332610 KR7332610005PLUS ̱ܱȸä(AAA~A) EF 000000000000NN 0NNN2NN N 0 Y 0001299600000100001NNN00NNN030000100N0900000000014640000000000002019082000000000000011600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000151 NNN +332620 KR7332620004PLUS ̱췮ȸä EF 000000000000NN 0NNN2NN N 0 Y 0000965900000100001NNN00NNN030000100N0900000000022490000000000002019082000000000000022700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000220 NNN +332930 KR7332930007HANARO 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000992200000100001NNN00NNN000000100N0900000000407490000000000002019082800000000000175000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001736 NNN +332940 KR7332940006HANARO MSCI Korea TR EF 000000000000NN 0NNN2NN N 0 Y 0000331900000100001NNN00NNN000000100N0900000000103760000000000002019082800000000000240000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000796 NNN +334690 KR7334690005RISE ȶ㼱(H) EF 000000000000NN 0NNN2NN N 0 N 0000092900000100001NNN00NNN000000100N0900000001476140000000000002019092400000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000074 NNN +334700 KR7334700002RISE ȶ㼱ι(H) EF 000000000000NN 0NNN2NN N 0 N 0000025450000100001NNN00NNN000000100N0900000000065560000000000002019092400000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000015 NNN +334890 KR7334890001÷ RT3002800000000 N 0NNN NN N 0 Y 0000042100000100001NNN00NNN000000060Y09000000029276100000000100020200716000000000069448000000000069448683000 0 NNY00000000000000000000000000000000000000.00 000002923 NNN +336160 KR7336160007RISE äƼ EF 000000000000NN 0NNN2NN N 0 Y 0001019350000100001NNN00NNN030000100N0900000000003830000000000002019102900000000000042000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000429 NNN +336260 KR7336260005λǻ ST2002700130000 N 0NNY NN N 0 N 0000347500000100001NNN00NNN000000060Y0900000009293080000000001002019101800000000006549300000000000654937260012 0 NYY000003190-00000291-00000408-0302-00007.4620250930000022759391NNY +33626K KR733626K013λǻ1 ST0002700130000 N 0NNN NN N 0 N 0000072400000100001NNN00NNN000000100N0900000000395970000000001002019101800000000001336400000000000133642000012 1 NNN00000000000000000000000000000000000000.00 000000967 NNN +33626L KR733626K021λǻ2B ST0002700130000 N 0NNN NN N 0 N 0000101700000100001NNN00NNN000000100N0900000000075330000000001002019101800000000000298600000000000029863000012 2 NNN00000000000000000000000000000000000000.00 000000303 NNN +336370 KR7336370002ַ罺÷ܼ ST2002700130000 N 0NNN NN N 0 N 0000083000000100001NNN00NNN000000100N0900000006502950000000001002019101800000000007021700000000000702173440012 0 NNY000004466-00000514-00001101-1134-00006.0220250930000005828 NNN +33637K KR733637K010ַ罺÷ܼ1 ST0002700130000 N 0NNN NN N 0 N 0000021800000100001NNN00NNN000000100N0900000000301270000000001002019101800000000001690800000000000169087660012 1 NNN00000000000000000000000000000000000000.00 000000368 NNN +33637L KR733637K028ַ罺÷ܼ2B ST0002700130000 N 0NNN NN N 0 N 0000036300000100001NNN00NNN000000100N0900000000121760000000001002019101800000000000377800000000000037782960012 2 NNN00000000000000000000000000000000000000.00 000000137 NNN +337120 KR7337120000KODEX Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000254700000100001NNN00NNN000000100N0900000000001490000000000002019111400000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +337140 KR7337140008KODEX ڽǴ EF 000000000000NN 0NNN2NN N 0 Y 0000266000000100001NNN00NNN000000100N0900000000614520000000000002019111400000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000372 NNN +337150 KR7337150007KODEX 200exTOP EF 000000000000NN 0NNN2NN N 0 Y 0000234450000100001NNN00NNN000000100N0900000000024710000000000002019111400000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000164 NNN +337160 KR7337160006KODEX 200ESG EF 000000000000NN 0NNN2NN N 0 Y 0000310450000100001NNN00NNN030000100N0900000000429760000000000002019111400000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000714 NNN +338100 KR7338100001NHӸ RT3002800000000 N 0NNN NN N 0 Y 0000044200000100001NNN00NNN000000100N09000000006277100000000050020191205000000000018660000000000009330000000 0 NNY00000000000000000000000000000000000000.00 000000824 NNN +339770 KR7339770000̿غ ST3001600000000 N 0NNN NN N 0 N 0000043400000100001NNN00NNN000000060Y0900000001214420000000005002020111200000000004996500000000002507042000012 0 NNY00000385900000031300000025900187000008.7720250930000002168 NNN +341850 KR7341850006TIGER εä EF 000000000000NN 0NNN2NN N 0 Y 0000049250000100001NNN00NNN030000100N0900000000129250000000000002020052200000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000098 NNN +344820 KR7344820006KCC۶ ST3002700100000 N 0NNN NN N 0 N 0000269000000100001NNN00NNN000000050Y0900000000442900000000010002020012100000000001597000000000001597051200012 0 NNY000014428-00000553-00000638-0622-00004.8120250930000004296KCCNNN +348950 KR7348950007̾˱۷ι RT3002800000000 N 0NNN NN N 0 Y 0000023150000100001NNN00NNN000000060Y09000000203424600000000100020200807000000000197376000000000197376000000 0 NNY00000000000000000000000000000000000000.00 000004569 NNN +350520 KR7350520003 RT3002800000000 N 0NNN NN N 0 Y 0000038100000100001NNN00NNN000000060Y09000000027973300000000100020200805000000000036866000000000036866202000 0 NNY00000000000000000000000000000000000000.00 000001404 NNN +352540 KR7352540009KODEX Ϻε긮(H) EF 000000000000NN 0NNN2NN N 0 Y 0000125400000100001NNN00NNN030000050Y0900000000970920000000000002020051300000000000450000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000567 NNN +352560 KR7352560007KODEX ̱ε긮(H) EF 000000000000NN 0NNN2NN N 0 Y 0000116900000100001NNN00NNN030000050Y0900000000130170000000000002020051300000000000260000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000304 NNN +352820 KR7352820005̺ ST1003000000000 N BYYY YY N 0 N 0003795000000100001NNN00NNN000000050Y0900000003650300000000005002020101500000000004273200000000002136630450012 0 NYY00001933400000045300000081600178-00000.0320250930000162170138NNY +353200 KR7353200009 ST2002700130000 N 0NNY NN N 0 N 0000545000000100001NNN00NNN000000050Y0900000021784720000000005002020052100000000004941600000000002470846250012 0 NYY00000747400000020100000020700220000003.0220250930000026932 NNY +35320K KR735320K0111 ST0002700130000 N 0NNN NN N 0 N 0000158100000100001NNN00NNN000000100N0900000000430310000000005002020052100000000000209500000000000104775950012 9 NNN00000000000000000000000000000000000000.00 000000331 NNN +354240 KR7354240004RISE ̱켱 EF 000000000000NN 0NNN2NN N 0 Y 0000115000000100001NNN00NNN000000100N0900000000071990000000000002020051900000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000143 NNN +354350 KR7354350001HANARO ۷ιŸS&P(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000214950000100001NNN00NNN000000100N0900000000028350000000000002020051200000000000077000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000165 NNN +354500 KR7354500001ACE ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000204450000100001NNN00NNN000000100N0900000022128330000000000002020050700000000000430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000879 NNN +356540 KR7356540005ACE ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001045700000100001NNN00NNN000000060Y0900000000032430000000000002020072100000000001029900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010769 NNN +357120 KR7357120005ڶڶ RT3002800000000 N 0NNN NN N 0 Y 0000045350000100001NNN00NNN000000060Y09000000017405700000000050020200831000000000097335000000000048667677000 0 NNY00000000000000000000000000000000000000.00 000004414 NNN +357250 KR7357250000̷¸ʽ RT3002800000000 N 0NNN NN N 0 Y 0000025400000100001NNN00NNN000000100N09000000007665300000000100020200805000000000024995000000000024995105000 0 NNY00000000000000000000000000000000000000.00 000000634 NNN +357430 KR7357430008̾ RT3002800000000 N 0NNN NN N 0 Y 0000015800000100001NNN00NNN000000100N09000000007010400000000100020220531000000000030505000000000030505307000 0 NNY00000000000000000000000000000000000000.00 000000481 NNN +357870 KR7357870005TIGER CDݸKIS(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000570250000100001NNN00NNN000000060Y0900000003110430000000000002020070700000000008467400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000048285 NNN +359210 KR7359210002KODEX ڽTR EF 000000000000NN 0NNN2NN N 0 Y 0000266550000100001NNN00NNN000000100N0900000000287020000000000002020072100000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000879 NNN +360140 KR7360140008KODEX 200ڽ150 EF 000000000000NN 0NNN2NN N 0 N 0000117450000100001NNN00NNN000000100N0900000000379710000000000002020082100000000000290000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000340 NNN +360150 KR7360150007KODEX ڽ150ڽ200 EF 000000000000NN 0NNN2NN N 0 N 0000070400000100001NNN00NNN000000100N0900000003171460000000000002020082100000000000270000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000190 NNN +360200 KR7360200000ACE ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000249650000100001NNN00NNN030000050Y0900000009100940000000000002020080700000000013130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000032864 NNN +360750 KR7360750004TIGER ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000247050000100001NNN00NNN030000050Y0900000101778170000000000002020080700000000058560000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000145053 NNN +361580 KR7361580004RISE 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000430000000100001NNN00NNN000000100N0900000004022620000000000002020082100000000000950000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004085 NNN +361610 KR7361610009SKũ ST2002700130000 N 9NNY NN N 0 N 0000275000000100001NNN00NNN000000100N0900000003207750000000010002021051100000000008178700000000008178710000012 0 NYY000002200-00001706-00001414-0807-00007.2320250930000022491535NNN +363280 KR7363280009ƼȦ ST3002100000000 N 0NNN NN N 0 N 0000025900000100001NNN00NNN000000100N0900000001541390000000005002020092200000000005042900000000002521463400012 0 NNY000000556-00000033-00000460-0516-00006.3320250930000001306844NNN +36328K KR736328K013ƼȦ ST0002100000000 N 0NNN NN N 3 N 0000042250000100001NNN00NNN000000100N0900000000008290000000005002020092200000000000124300000000000062150700012 9 NNN00000000000000000000000000000000000000.00 000000052 NNN +363510 KR7363510009SOL KISܱä EF 000000000000NN 0NNN2NN N 0 Y 0001105900000100001NNN00NNN000000100N0900000000000520000000000002020090900000000000032300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000357 NNN +363570 KR7363570003KODEX ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000943900000100001NNN00NNN000000100N0900000000013160000000000002020092500000000000350300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003306 NNN +363580 KR7363580002KODEX 200IT TR EF 000000000000NN 0NNN2NN N 0 Y 0000286850000100001NNN00NNN000000100N0900000000528160000000000002020092500000000000340000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000975 NNN +364690 KR7364690008KODEX ű׸Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000281750000100001NNN00NNN000000100N0900000000032190000000000002020092900000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000169 NNN +364960 KR7364960005TIGER BBIG EF 000000000000NN 0NNN2NN N 0 Y 0000075850000100001NNN00NNN000000050Y0900000001803330000000000002020100700000000001645000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001247 NNN +364970 KR7364970004TIGER ̿TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000095000000100001NNN00NNN000000050Y0900000033880970000000000002020100700000000003830000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003638 NNN +364980 KR7364980003TIGER 2TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000108550000100001NNN00NNN000000050Y0900000090340690000000000002020100700000000005895000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006399 NNN +364990 KR7364990002TIGER TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000057000000100001NNN00NNN000000050Y0900000006208210000000000002020100700000000001100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000627 NNN +365000 KR7365000009TIGER ͳTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000050750000100001NNN00NNN000000050Y0900000009451260000000000002020100700000000001500000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000761 NNN +365040 KR7365040005TIGER AIڸƱ׷νƼ EF 000000000000NN 0NNN2NN N 0 Y 0000260600000100001NNN00NNN000000100N0900000000165940000000000002020092900000000000170000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000443 NNN +365550 KR7365550003ESR˴޽ RT2002800000000 N 0NNN NN N 0 Y 0000043900000100001NNN00NNN000000060Y09000000046265000000000100020201223000000000246089000000000246089000000 0 NNY00000000000000000000000000000000000000.00 000010803 NNN +365780 KR7365780006ACE ä10 EF 000000000000NN 0NNN2NN N 0 Y 0000854350000100001NNN00NNN000000050Y0900000000221080000000000002020101500000000000549200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004692 NNN +367380 KR7367380003ACE ̱100 EF 000000000000NN 0NNN2NN N 0 Y 0000283550000100001NNN00NNN030000050Y0900000009253510000000000002020102900000000009420000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000026743 NNN +367740 KR7367740008HANARO Fn5G EF 000000000000NN 0NNN2NN N 0 Y 0000255200000100001NNN00NNN000000100N0900000000032410000000000002020102900000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000140 NNN +367760 KR7367760006RISE Ʈũ EF 000000000000NN 0NNN2NN N 0 Y 0000275250000100001NNN00NNN000000050Y0900000007606240000000000002020102900000000000445000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001224 NNN +367770 KR7367770005RISE Ұ׸ EF 000000000000NN 0NNN2NN N 0 Y 0000234300000100001NNN00NNN000000050Y0900000001862600000000000002020102900000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001429 NNN +368190 KR7368190005HANARO Fn K-÷ EF 000000000000NN 0NNN2NN N 0 Y 0000094850000100001NNN00NNN000000050Y0900000000174980000000000002020111000000000000430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000407 NNN +368590 KR7368590006RISE ̱100 EF 000000000000NN 0NNN2NN N 0 Y 0000274600000100001NNN00NNN000000050Y0900000006259140000000000002020110600000000004750000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000013043 NNN +368680 KR7368680005KODEX K-÷ EF 000000000000NN 0NNN2NN N 0 Y 0000095350000100001NNN00NNN000000100N0900000000071370000000000002020111000000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +371150 KR7371150004RISE ̳׼ũ EF 000000000000NN 0NNN2NN N 0 Y 0000090000000100001NNN00NNN000000100N0900000000053470000000000002020121600000000000245000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000220 NNN +371160 KR7371160003TIGER ̳׼ũ EF 000000000000NN 0NNN2NN N 0 Y 0000092100000100001NNN00NNN030000050Y0900000022467390000000000002020121600000000011955000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000011022 NNN +371450 KR7371450008TIGER ۷ιŬǻINDXX EF 000000000000NN 0NNN2NN N 0 Y 0000112150000100001NNN00NNN000000100N0900000000073920000000000002020120800000000000212000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000237 NNN +371460 KR7371460007TIGER ̳SOLACTIVE EF 000000000000NN 0NNN2NN N 0 Y 0000122900000100001NNN00NNN000000050Y0900000021302730000000000002020120800000000011848000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000014561 NNN +371470 KR7371470006TIGER ̳̿ũSOLACTIVE EF 000000000000NN 0NNN2NN N 0 Y 0000086100000100001NNN00NNN000000050Y0900000001306400000000000002020120800000000000760000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000654 NNN +371870 KR7371870007ACE ̳׼ũ EF 000000000000NN 0NNN2NN N 0 Y 0000088900000100001NNN00NNN000000100N0900000000462030000000000002020121600000000000190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +372330 KR7372330001KODEX ̳׼ũ EF 000000000000NN 0NNN2NN N 0 Y 0000092000000100001NNN00NNN030000050Y0900000003438930000000000002020121600000000002140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001969 NNN +372910 KR7372910000Ķɾ ST3002700140000 N 0NNN NN N 0 N 0000030350000100001NNN00NNN000000100N0900000009780670000000002002021081700000000002767400000000000553488120012 0 NNY000000573000000024-00000002-0004000001.7020250930000000839 NNN +373220 KR7373220003LGַ ST1002700130000 N 9YYY YY N 0 N 0004310000000100001NNN00NNN000000050Y0900000014627940000000005002022012700000000023400000000000011700000000012 0 NYY00017530300000154200000890208533-00004.3020250930001008540282NNY +373490 KR7373490002KODEX ڸżƼ EF 000000000000NN 0NNN2NN N 0 Y 0000226650000100001NNN00NNN000000100N0900000000053180000000000002020122400000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +373790 KR7373790005KIWOOM ̱缺峪 EF 000000000000NN 0NNN2NN N 0 Y 0000157550000100001NNN00NNN030000100N0900000000027640000000000002020122400000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +375270 KR7375270006RISE ۷ιͼ͸(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000139200000100001NNN00NNN000000100N0900000000033160000000000002021011400000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +375500 KR7375500006DL̾ؾ ST2001800000000 N 1NNY NN N 0 N 0000450000000100001NNN00NNN000000050Y0900000003975700000000050002021012500000000003869300000000020816350000012 0 NYY00005706600000323900000217501649000005.7020250930000017412321NNY +37550K KR737550K011DL̾ؾ ST0001800000000 N 0NNN NN N 0 N 0000229000000100001NNN00NNN000000100N0900000000140670000000050002021012500000000000211300000000001056942500012 9 NNN00000000000000000000000000000000000000.00 000000484 NNN +37550L KR737550K029DL̾ؾ2(ȯ) ST0001800000000 N 0NNN NN N 0 N 0000340000000100001NNN00NNN000000100N0900000000017870000000050002022042800000000000211100000000001055975500012 2 NNN00000000000000000000000000000000000000.00 000000718 NNN +375760 KR7375760006HANARO źȿ׸ EF 000000000000NN 0NNN2NN N 0 Y 0000178350000100001NNN00NNN030000100N0900000000146720000000000002021020500000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000160 NNN +375770 KR7375770005KODEX źȿ׸ EF 000000000000NN 0NNN2NN N 0 Y 0000182750000100001NNN00NNN030000100N0900000000006990000000000002021020500000000000240000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000438 NNN +376410 KR7376410007TIGER źȿ׸ EF 000000000000NN 0NNN2NN N 0 Y 0000180300000100001NNN00NNN030000100N0900000000036600000000000002021020500000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000180 NNN +377190 KR7377190004ص÷ RT3002800000000 N 0NNN NN N 0 Y 0000034250000100001NNN00NNN000000060Y09000000026207800000000100020210827000000000088400000000000088400000000 0 NNY00000000000000000000000000000000000000.00 000003027 NNN +377300 KR7377300009īī ST1002100000000 N 6YNY YY N 1 N 0000654000000100001NNN00NNN000000060Y0900000035367180000000005002021110300000000013514500000000006757257500012 0 NYY00000688500000029500000063900476000000.0020250930000088384KAONNY +377740 KR7377740006̿Ʈ ST3002700090000 N 0NNN NN N 0 N 0000054700000100001NNN00NNN000000050Y0900000001018500000000005002022122200000000010205600000000005102802400012 0 NNY00000090400000015900000113701065000007.1520250930000005582 NNN +377990 KR7377990007TIGER Fn EF 000000000000NN 0NNN2NN N 0 Y 0000204400000100001NNN00NNN000000100N0900000001755050000000000002021030500000000000385000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000786 NNN +378850 KR7378850002ȭ¾˾ؿ ST3002700150000 N 0NNN NN N 0 N 0000034900000100001NNN00NNN000000100N0900000001087180000000005002021031500000000001899300000000000949681150012 0 NNY00000529500000023400000017600121000018.3920250930000000662 NNN +379780 KR7379780000RISE ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000215650000100001NNN00NNN000000050Y0900000005213270000000000002021040900000000006630000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000014297 NNN +379790 KR7379790009RISE νŹ50(H) EF 000000000000NN 0NNN2NN N 0 Y 0000162600000100001NNN00NNN000000100N0900000000468050000000000002021040900000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000121 NNN +379800 KR7379800006KODEX ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000225800000100001NNN00NNN030000050Y0900000127968690000000000002021040900000000035730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000081089 NNN +379810 KR7379810005KODEX ̱100 EF 000000000000NN 0NNN2NN N 0 Y 0000246900000100001NNN00NNN030000050Y0900000040081270000000000002021040900000000021945000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000054324 NNN +380340 KR7380340000ACE ڸAIũٽɻ EF 000000000000NN 0NNN2NN N 0 Y 0000177150000100001NNN00NNN000000100N0900000000084230000000000002021040200000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000088 NNN +381170 KR7381170000TIGER ̱ũTOP10 INDXX EF 000000000000NN 0NNN2NN N 0 Y 0000304000000100001NNN00NNN000000050Y0900000019530180000000000002021040900000000013590000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000041313 NNN +381180 KR7381180009TIGER ̱ʶǾƹݵü EF 000000000000NN 0NNN2NN N 0 Y 0000310800000100001NNN00NNN030000050Y0900000014250750000000000002021040900000000012340000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000038395 NNN +381560 KR7381560002HANARO Fn& EF 000000000000NN 0NNN2NN N 0 Y 0000124700000100001NNN00NNN000000100N0900000000190870000000000002021040200000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000162 NNN +381570 KR7381570001HANARO Fnģȯ濡 EF 000000000000NN 0NNN2NN N 0 Y 0000097900000100001NNN00NNN000000100N0900000000408900000000000002021040200000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +381970 KR7381970003ī ST2001600000000 N 0NNN NN N 0 N 0000150300000100001NNN00NNN000000050Y0900000001264780000000005002021101300000000004882000000000002441042400012 0 NNY00002301500000068100000057100440000019.0920241231000007337 NNN +383220 KR7383220001F&F ST2002700060000 N 8NNY NN N 0 N 0000695000000100001NNN00NNN000000050Y0900000001350540000000001002021052100000000003830700000000000383070750012 0 NYY00001358700000335700000332002459000021.9920250930000026623 NNY +383800 KR7383800000LXȦ ST2002100000000 N 0NNN NN N 0 N 0000086200000100001NNN00NNN000000100N0900000002122820000000010002021052700000000007628000000000007628069000012 0 NNY00000186000000151100000157601517000007.7820250930000006575LD1NNN +38380K KR738380K012LXȦ1 ST0002100000000 N 0NNN NN N 0 N 0000088200000100001NNN00NNN000000100N0900000000075560000000010002021052700000000000146500000000000146528500012 9 NNN00000000000000000000000000000000000000.00 000000129 NNN +385510 KR7385510003KODEX Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000345750000100001NNN00NNN000000060Y0900000011557080000000000002021052500000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002109 NNN +385520 KR7385520002KODEX Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000146500000100001NNN00NNN000000100N0900000000887770000000000002021052500000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000336 NNN +385540 KR7385540000RISE ä(A-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001063350000100001NNN00NNN000000060Y0900000000063120000000000002021052600000000001616900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000017193 NNN +385550 KR7385550009RISE ܱäǾľƼ EF 000000000000NN 0NNN2NN N 0 Y 0001123450000100001NNN00NNN000000100N0900000000027770000000000002021052600000000000229700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002580 NNN +385560 KR7385560008RISE KISä30Enhanced EF 000000000000NN 0NNN2NN N 0 Y 0000678350000100001NNN00NNN000000050Y0900000000578380000000000002021052600000000000794200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005387 NNN +385590 KR7385590005ACE ESGƼ EF 000000000000NN 0NNN2NN N 0 Y 0000163100000100001NNN00NNN000000100N0900000000006230000000000002021052500000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000358 NNN +385600 KR7385600002ACE 2&ģȯƼ EF 000000000000NN 0NNN2NN N 0 Y 0000100050000100001NNN00NNN000000100N0900000000787730000000000002021052500000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000200 NNN +385710 KR7385710009TIME K̳뺣̼ǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000126400000100001NNN00NNN000000100N0900000000606920000000000002021052500000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +385720 KR7385720008TIME ڽǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000191350000100001NNN00NNN000000100N0900000006314900000000000002021052500000000001150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002200 NNN +387270 KR7387270002TIGER ۷ι̳뺣̼ǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000216500000100001NNN00NNN000000100N0900000000026980000000000002021052500000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000259 NNN +387280 KR7387280001TIGER ǻóƼƼ EF 000000000000NN 0NNN2NN N 0 Y 0000119400000100001NNN00NNN000000100N0900000000532220000000000002021052500000000000169000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000201 NNN +388280 KR7388280000RISE K&෹ EF 000000000000NN 0NNN2NN N 0 Y 0000081250000100001NNN00NNN000000050Y0900000000385500000000000002021061000000000000438000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000355 NNN +388420 KR7388420002RISE ޸𸮹ݵüƼ EF 000000000000NN 0NNN2NN N 0 Y 0000191200000100001NNN00NNN000000060Y0900000009378970000000000002021061000000000001174000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002244 NNN +390390 KR7390390003KODEX ̱ݵü EF 000000000000NN 0NNN2NN N 0 Y 0000406750000100001NNN00NNN030000050Y0900000005929740000000000002021063000000000002165000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008819 NNN +390400 KR7390400000KODEX ̱ƮƼS&P EF 000000000000NN 0NNN2NN N 0 Y 0000074700000100001NNN00NNN030000100N0900000000037940000000000002021063000000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000089 NNN +391600 KR7391600004ACE ̱ģȯ׸׸ EF 000000000000NN 0NNN2NN N 0 Y 0000116000000100001NNN00NNN000000100N0900000000084030000000000002021080500000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000098 NNN +391670 KR7391670007HK ƮϷƼ EF 000000000000NN 0NNN2NN N 0 Y 0000200500000100001NNN00NNN000000100N0900000000018210000000000002021070600000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000190 NNN +394350 KR7394350003KIWOOM ۷ιǻóƼ EF 000000000000NN 0NNN2NN N 0 Y 0000156900000100001NNN00NNN000000100N0900000000103060000000000002021072000000000000030000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000047 NNN +394660 KR7394660005TIGER ۷ι&SOLACTIVE EF 000000000000NN 0NNN2NN N 0 Y 0000158650000100001NNN00NNN000000050Y0900000000413930000000000002021072000000000001484000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002354 NNN +394670 KR7394670004TIGER ۷ιƬ&2SOLACTIVE(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000117250000100001NNN00NNN000000060Y0900000002777630000000000002021072000000000002648000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003104 NNN +395150 KR7395150006KODEX & EF 000000000000NN 0NNN2NN N 0 Y 0000031550000100001NNN00NNN000000100N0900000001483580000000000002021073000000000000400000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000126 NNN +395160 KR7395160005KODEX AIݵü EF 000000000000NN 0NNN2NN N 0 Y 0000237700000100001NNN00NNN000000050Y0900000078397840000000000002021073000000000009160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000021773 NNN +395170 KR7395170004KODEX Top10ϰ EF 000000000000NN 0NNN2NN N 0 Y 0000140050000100001NNN00NNN030000100N0900000000327080000000000002021073000000000000500000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000701 NNN +395270 KR7395270002HANARO Fn K-ݵü EF 000000000000NN 0NNN2NN N 0 Y 0000276050000100001NNN00NNN000000050Y0900000085076850000000000002021073000000000004025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000011111 NNN +395280 KR7395280001HANARO Fn K- EF 000000000000NN 0NNN2NN N 0 Y 0000042500000100001NNN00NNN000000100N0900000000691190000000000002021073000000000000305000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000129 NNN +395290 KR7395290000HANARO Fn K-POP&̵ EF 000000000000NN 0NNN2NN N 0 Y 0000093400000100001NNN00NNN000000050Y0900000002255940000000000002021073000000000000910000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000849 NNN +395400 KR7395400005SK RT2002800000000 N 0NNN NN N 0 Y 0000055600000100001NNN00NNN000000060Y09000000067094500000000050020210914000000000300487000000000150243885000 0 NNY00000000000000000000000000000000000000.00 000016707535NNN +395750 KR7395750003PLUS ESGġ־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000154000000100001NNN00NNN000000100N0900000000005690000000000002021073000000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000061 NNN +395760 KR7395760002PLUS ESG־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000165800000100001NNN00NNN000000100N0900000000098100000000000002021073000000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000116 NNN +396500 KR7396500001TIGER ݵüTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000275600000100001NNN00NNN000000050Y0900000262435160000000000002021081000000000015260000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000042056 NNY +396510 KR7396510000TIGER ̳ŬSOLACTIVE EF 000000000000NN 0NNN2NN N 0 Y 0000085750000100001NNN00NNN000000100N0900000000161800000000000002021081000000000000248000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000212 NNN +396520 KR7396520009TIGER ̳ݵüFACTSET EF 000000000000NN 0NNN2NN N 0 Y 0000116900000100001NNN00NNN000000050Y0900000005815700000000000002021081000000000002008000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002347 NNN +396690 KR7396690000̷±۷ι RT3002800000000 N 0NNN NN N 0 Y 0000025750000100001NNN00NNN000000060Y09000000018964100000000100020211203000000000039605000000000039605940000 0 NNY00000000000000000000000000000000000000.00 000001019 NNN +397420 KR7397420001RISE ä5 EF 000000000000NN 0NNN2NN N 0 N 0000509950000100001NNN00NNN000000100N0900000000000340000000000002021083100000000000010200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000052 NNN +399110 KR7399110006SOL ̱S&P500ESG EF 000000000000NN 0NNN2NN N 0 Y 0000196400000100001NNN00NNN030000100N0900000000474890000000000002021091400000000000570000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001122 NNN +399580 KR7399580000RISE ۷ιŬ EF 000000000000NN 0NNN2NN N 0 Y 0000098550000100001NNN00NNN000000100N0900000000117810000000000002021102100000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000098 NNN +400570 KR7400570008KODEX źҹǼICE(H) EF 000000000000NN 0NNN2NN N 0 N 0000121100000100001NNN00NNN000000100N0900000000095640000000000002021093000000000000182000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000220 NNN +400580 KR7400580007SOL źҹǼS&P(H) EF 000000000000NN 0NNN2NN N 0 N 0000125100000100001NNN00NNN000000100N0900000000024580000000000002021093000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000062 NNN +400590 KR7400590006SOL ۷ιźҹǼICE(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000151800000100001NNN00NNN000000100N0900000000029260000000000002021093000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000075 NNN +400760 KR7400760005NHÿ RT3002800000000 N 0NNN NN N 0 Y 0000033400000100001NNN00NNN000000060Y09000000028203600000000050020211118000000000054929000000000027464637500 0 NNY00000000000000000000000000000000000000.00 000001834 NNN +400970 KR7400970000TIGER FnŸ EF 000000000000NN 0NNN2NN N 0 Y 0000084350000100001NNN00NNN000000050Y0900000001105580000000000002021101300000000000855000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000721 NNN +401170 KR7401170006RISE Ÿ EF 000000000000NN 0NNN2NN N 0 Y 0000081600000100001NNN00NNN000000100N0900000001476730000000000002021101300000000001334000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001088 NNN +401470 KR7401470000KODEX ŸƼ EF 000000000000NN 0NNN2NN N 0 Y 0000090000000100001NNN00NNN000000060Y0900000001689680000000000002021101300000000001065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000958 NNN +401590 KR7401590005HANARO ۷ιźҹǼICE(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000121900000100001NNN00NNN000000100N0900000000004800000000000002021093000000000000051000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000062 NNN +402340 KR7402340004SK ST1002100000000 N 5YYY YY N 0 N 0005040000000100001NNN00NNN000000050Y0900000005360540000000001002021112900000000013208700000000001414675710012 0 NYY00007080800005698900005757655418000033.6720250930000665719535NNY +402460 KR7402460000HANARO Fn K-ŸMZ EF 000000000000NN 0NNN2NN N 0 Y 0000094750000100001NNN00NNN000000100N0900000000055520000000000002021101300000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +402970 KR7402970008ACE ̱ٿ EF 000000000000NN 0NNN2NN N 0 Y 0000134600000100001NNN00NNN000000050Y0900000005011230000000000002021102100000000005080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006837 NNN +403550 KR7403550007ī ST3002600000000 N 0NNN NN N 0 N 0000121600000100001NNN00NNN000000100N0900000000100440000000001002022082200000000003284100000000000328419020012 0 NNY000003420000000101-00000038-0037-00004.1220250930000003993 NNN +403790 KR7403790009̴ٽ ڽǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000428100000100001NNN00NNN000000100N0900000002351060000000000002021101300000000000360000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001541 NNN +404120 KR7404120008TIME KƼ EF 000000000000NN 0NNN2NN N 0 Y 0000223350000100001NNN00NNN000000100N0900000000066400000000000002021102900000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +404260 KR7404260002KODEX ĺȭַ EF 000000000000NN 0NNN2NN N 0 Y 0000200950000100001NNN00NNN000000100N0900000000020940000000000002021102900000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000180 NNN +404540 KR7404540007TIGER KRXĺȭַ EF 000000000000NN 0NNN2NN N 0 Y 0000201700000100001NNN00NNN030000100N0900000000012030000000000002021102900000000000035000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000070 NNN +404650 KR7404650004SOL KRXĺȭַ EF 000000000000NN 0NNN2NN N 0 Y 0000199650000100001NNN00NNN030000100N0900000000007820000000000002021102900000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000120 NNN +404990 KR7404990004ѼƼ RT3002800000000 N 0NNN NN N 0 Y 0000038900000100001NNN00NNN000000060Y09000000015891700000000100020211210000000000059104000000000059104308000 0 NNY00000000000000000000000000000000000000.00 000002299 NNN +407300 KR7407300003HANARO Fn׸ EF 000000000000NN 0NNN2NN N 0 Y 0000110450000100001NNN00NNN030000100N0900000000021730000000000002021112400000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000060 NNN +407310 KR7407310002HANARO 200 TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000149950000100001NNN00NNN030000100N0900000000166720000000000002021112400000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +407820 KR7407820000÷ ڸ÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000085600000100001NNN00NNN000000100N0900000000040180000000000002021111600000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000171 NNN +407830 KR7407830009÷ ۷ι÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000162850000100001NNN00NNN000000100N0900000000128000000000000002021111600000000000350000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000569 NNN +409810 KR7409810009KODEX ̱100ι(H) EF 000000000000NN 0NNN2NN N 0 N 0000062100000100001NNN00NNN000000100N0900000002040310000000000002021120900000000000295000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000183 NNN +409820 KR7409820008KODEX ̱100(ռ H) EF 000000000000NN 0NNN2NN N 0 N 0000166500000100001NNN00NNN000000100N0900000002327040000000000002021120900000000001355000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002256 NNN +410870 KR7410870000TIME KóƼ EF 000000000000NN 0NNN2NN N 0 Y 0000128100000100001NNN00NNN000000100N0900000000943510000000000002021121500000000000450000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000576 NNN +411060 KR7411060007ACE KRX EF 000000000000NN 0NNN2NN N 0 Y 0000353150000100001NNN00NNN000000060Y0900000072919760000000000002021121500000000014220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000050217 NNN +411420 KR7411420003KODEX ̱AIũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000214600000100001NNN00NNN030000060Y0900000001299000000000000002021122200000000000505000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001084 NNN +411540 KR7411540008SOL 200 Top10 EF 000000000000NN 0NNN2NN N 0 Y 0000152500000100001NNN00NNN030000100N0900000000666450000000000002021120900000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000503 NNN +411860 KR7411860000KIWOOM DAX EF 000000000000NN 0NNN2NN N 0 Y 0000181350000100001NNN00NNN030000100N0900000000064910000000000002021122200000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000181 NNN +412560 KR7412560005TIGER BBIG EF 000000000000NN 0NNN2NN N 0 N 0000026900000100001NNN00NNN000000100N0900000000215900000000000002021121500000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000022 NNN +412570 KR7412570004TIGER 2TOP10 EF 000000000000NN 0NNN2NN N 0 N 0000018330000100001NNN00NNN000000100N0900000249119660000000000002021121500000000010630000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001948 NNN +412770 KR7412770000TIGER ۷ιAI÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000130500000100001NNN00NNN000000060Y0900000000569000000000000002021122200000000000884000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001153 NNN +413220 KR7413220005SOL ̳¾籤CSI(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000061250000100001NNN00NNN000000100N0900000000371540000000000002021122200000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000073 NNN +413930 KR7413930009WON AI ESGƼ EF 000000000000NN 0NNN2NN N 0 Y 0000202350000100001NNN00NNN000000100N0900000000076500000000000002022010500000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000131 NNN +414270 KR7414270009ACE ۷ιƼ EF 000000000000NN 0NNN2NN N 0 Y 0000130900000100001NNN00NNN000000100N0900000000914800000000000002022021500000000000360000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000471 NNN +414780 KR7414780007TIGER ̳âSTAR50(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000130550000100001NNN00NNN000000060Y0900000002986890000000000002022011300000000001645000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002147 NNN +415340 KR7415340009KODEX ̳âSTAR50(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000133000000100001NNN00NNN000000100N0900000000342320000000000002022011300000000000201000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000267 NNN +415640 KR7415640002KB IF2002100000000 N 0NNN NN N 0 Y 0000100000000100001NNN00NNN000000060Y09000000017571400000000000020241129000000000122545000000000825615834098 0 NNY00000000000000000000000000000000000000.00 000012254 NNN +415760 KR7415760008SOL ̳Ƽ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000124100000100001NNN00NNN000000100N0900000001103970000000000002022011300000000000222000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000275 NNN +415920 KR7415920008PLUS ۷ι&ڿ EF 000000000000NN 0NNN2NN N 0 Y 0000095200000100001NNN00NNN000000100N0900000007838370000000000002022011800000000000795000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000756 NNN +416090 KR7416090009ACE ߱âSTAR50 EF 000000000000NN 0NNN2NN N 0 Y 0000123000000100001NNN00NNN000000100N0900000000420190000000000002022011300000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000159 NNN +417310 KR7417310000ڶڴ RT3002800000000 N 0NNN NN N 0 Y 0000088800000100001NNN00NNN000000060Y09000000010299100000000050020220328000000000040400000000000020200000000 0 NNY00000000000000000000000000000000000000.00 000003587 NNN +417450 KR7417450004RISE ۷ιҰ EF 000000000000NN 0NNN2NN N 0 Y 0000131250000100001NNN00NNN000000100N0900000000245660000000000002022021500000000000155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000203 NNN +417630 KR7417630001TIGER KEDIűESG30 EF 000000000000NN 0NNN2NN N 0 Y 0000165300000100001NNN00NNN000000100N0900000000175880000000000002022020800000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000190 NNN +418660 KR7418660007TIGER ̱100(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000352450000100001NNN00NNN000000100N0900000002117030000000000002022022200000000000820000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002890 NNN +418670 KR7418670006TIGER ۷ιAI̹ EF 000000000000NN 0NNN2NN N 0 Y 0000132400000100001NNN00NNN000000050Y0900000000573280000000000002022022200000000000268000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000354 NNN +419420 KR7419420005KODEX ̱Ŭ EF 000000000000NN 0NNN2NN N 0 Y 0000095200000100001NNN00NNN030000100N0900000000124740000000000002022032200000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000152 NNN +419430 KR7419430004KODEX ̳2MSCI(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000114500000100001NNN00NNN000000100N0900000000160080000000000002022032200000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000377 NNN +419650 KR7419650007PLUS ۷ι&뿬 EF 000000000000NN 0NNN2NN N 0 Y 0000048550000100001NNN00NNN000000100N0900000000920920000000000002022021500000000000440000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000213 NNN +419890 KR7419890009KIWOOM ܱäESGƼ EF 000000000000NN 0NNN2NN N 0 Y 0001064450000100001NNN00NNN000000100N0900000000004800000000000002022030300000000000063000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000670 NNN +421320 KR7421320003PLUS װ&UAM EF 000000000000NN 0NNN2NN N 0 Y 0000391600000100001NNN00NNN000000050Y0900000007782980000000000002022032900000000000575000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002251 NNN +422260 KR7422260000VITA MZҺƼ EF 000000000000NN 0NNN2NN N 0 Y 0000104900000100001NNN00NNN000000100N0900000000104700000000000002022032900000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +422420 KR7422420000RISE 2Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000090800000100001NNN00NNN000000060Y0900000065269200000000000002022040800000000003014000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002736 NNN +423160 KR7423160001KODEX KOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001106250000100001NNN00NNN030000060Y0900000000768680000000000002022042600000000004022800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000044602 NNN +423170 KR7423170000SOL ѱ۷ιݵüƼ EF 000000000000NN 0NNN2NN N 0 Y 0000383550000100001NNN00NNN000000100N0900000000955990000000000002022041200000000000266000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001020 NNN +423920 KR7423920008TIGER ̱ʶǾƹݵü(ռ)EF 000000000000NN 0NNN2NN N 0 N 0000527550000100001NNN00NNN030000100N0900000001918280000000000002022041900000000000814000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004300 NNN +424460 KR7424460004HANARO ۷ιMSCI(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000160000000100001NNN00NNN000000100N0900000000004840000000000002022041900000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000096 NNN +426020 KR7426020004TIME ̱S&P500Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000283350000100001NNN00NNN000000060Y0900000002153040000000000002022051100000000000542000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001535 NNN +426030 KR7426030003TIME ̱100Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000373550000100001NNN00NNN000000060Y0900000006259050000000000002022051100000000002888000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010788 NNN +426150 KR7426150009WON ѹαäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000547450000100001NNN00NNN000000100N0900000000032680000000000002022051100000000000111200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000608 NNN +426330 KR7426330007KIWOOM ̱ETFSTOXX EF 000000000000NN 0NNN2NN N 0 Y 0000163000000100001NNY00NNN000000100N0900000000010500000000000002022042600000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000032 NNN +427120 KR7427120001RISE AI÷ EF 000000000000NN 0NNN2NN N 0 Y 0000079900000100001NNN00NNN000000100N0900000001019810000000000002022051700000000000098000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +428510 KR7428510002KODEX ̳AIũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000190200000100001NNN00NNN030000100N0900000000773750000000000002022051700000000000205000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000389 NNN +428560 KR7428560007KODEX ̱ETFTop10 Indxx EF 000000000000NN 0NNN2NN N 0 Y 0000172050000100001NNN00NNN030000100N0900000000108250000000000002022051700000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +429000 KR7429000003TIGER ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000131950000100001NNN00NNN030000100N0900000001373560000000000002022051700000000001015000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001340 NNN +429010 KR7429010002TIGER ̱ڳؽƮ100 EF 000000000000NN 0NNN2NN N 0 Y 0000176800000100001NNN00NNN000000100N0900000000013850000000000002022051700000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000088 NNN +429740 KR7429740004PLUS K EF 000000000000NN 0NNN2NN N 0 Y 0000071100000100001NNN00NNN030000100N0900000000378410000000000002022052400000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000096 NNN +429760 KR7429760002PLUS ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000184100000100001NNN00NNN030000100N0900000000089000000000000002022053100000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000424 NNN +429980 KR7429980006SOL ѱ۷ι&2Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000160350000100001NNN00NNN000000100N0900000000037160000000000002022061400000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000080 NNN +430500 KR7430500009KIWOOM äKIS EF 000000000000NN 0NNN2NN N 0 Y 0001130050000100001NNN00NNN000000100N0900000000004460000000000002022053100000000000010000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +432320 KR7432320000KBŸ RT3002800000000 N 0NNN NN N 0 Y 0000035700000100001NNN00NNN000000060Y09000000023622300000000050020221006000000000101414000000000050707142500 0 NNY00000000000000000000000000000000000000.00 000003620 NNN +432600 KR7432600005RISE ä3 EF 000000000000NN 0NNN2NN N 0 N 0000550900000100001NNN00NNN000000100N0900000000000040000000000002022061400000000000055600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000306 NNN +432840 KR7432840007HANARO ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000185900000100001NNN00NNN030000100N0900000000057400000000000002022060800000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000148 NNN +433220 KR7433220001÷ ۷ι̾Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000272200000100001NNN00NNN000000100N0900000000029930000000000002022062800000000000062000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +433250 KR7433250008UNICORN R&D Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000208400000100001NNN00NNN000000100N0900000000001840000000000002022070600000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000083 NNN +433330 KR7433330008SOL ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000206600000100001NNN00NNN030000050Y0900000000996400000000000002022062100000000001050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002170 NNN +433500 KR7433500006ACE ڷTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000534950000100001NNN00NNN000000050Y0900000002099760000000000002022062800000000000360000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001925 NNN +433880 KR7433880002PLUS TDF2060Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000176600000100001NNN00NNN030000100N0900000000596720000000000002022063000000000000252000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000445 NNN +433970 KR7433970001KODEX TDF2030Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000136600000100001NNN00NNN030000100N0900000000922030000000000002022063000000000000590000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000810 NNN +433980 KR7433980000KODEX TDF2040Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000152400000100001NNN00NNN030000100N0900000001077430000000000002022063000000000000740000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001134 NNN +434060 KR7434060000KODEX TDF2050Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000164900000100001NNN00NNN030000100N0900000003602140000000000002022063000000000002835000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004700 NNN +434730 KR7434730008HANARO ڷiSelect EF 000000000000NN 0NNN2NN N 0 Y 0000602300000100001NNN00NNN000000050Y0900000006004910000000000002022062800000000001060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006384 NNN +434960 KR7434960001DAISHIN343 K200 EF 000000000000NN 0NNN2NN N 0 Y 0000767800000100001NNN00NNN030000100N0900000000326570000000000002022062800000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000538 NNN +435040 KR7435040001ACE ۷ι귣TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000192700000100001NNN00NNN030000100N0900000000057870000000000002022062800000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000125 NNN +435420 KR7435420005TIGER ̱100äȥFn EF 000000000000NN 0NNN2NN N 0 Y 0000135700000100001NNN00NNN030000100N0900000002204560000000000002022070600000000002270000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003092 NNN +435530 KR7435530001KIWOOM TDF2030Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000148150000100001NNN00NNN000000100N0900000000097020000000000002022063000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000074 NNN +435540 KR7435540000KIWOOM TDF2040Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000164800000100001NNN00NNN000000100N0900000000149690000000000002022063000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000082 NNN +435550 KR7435550009KIWOOM TDF2050Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000169000000100001NNN00NNN000000100N0900000000152000000000000002022063000000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +436140 KR7436140008SOL ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001097900000100001NNN00NNN000000060Y0900000000212690000000000002022080900000000000986500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010830 NNN +437070 KR7437070006KODEX ƽþƴ޷äESG÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000626050000100001NNN00NNN030000100N0900000000020180000000000002022080900000000000063200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000397 NNN +437080 KR7437080005KODEX ̱äESGƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0001008100000100001NNN00NNN030000100N0900000000315590000000000002022080900000000000387000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003915 NNN +437350 KR7437350002RISE ̱ܱڵȸäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000124700000100001NNN00NNN000000100N0900000000742120000000000002022072900000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000286 NNN +437370 KR7437370000RISE ۷ι EF 000000000000NN 0NNN2NN N 0 Y 0000105400000100001NNN00NNN000000100N0900000000018770000000000002022072900000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000063 NNN +438080 KR7438080004ACE ̱S&P500̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000136750000100001NNN00NNN000000060Y0900000010572050000000000002022082600000000006380000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008724 NNN +438100 KR7438100000ACE ̱100̱äȥ50Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000147750000100001NNN00NNN000000100N0900000006079830000000000002022082600000000004100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006057 NNN +438320 KR7438320004TIGER ̳׼ũ(ռ H) EF 000000000000NN 0NNN2NN N 0 N 0000093750000100001NNN00NNN000000100N0900000001907100000000000002022082300000000000404000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000378 NNN +438330 KR7438330003TIGER 췮ȸäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001156950000100001NNN00NNN000000060Y0900000000497010000000000002022082300000000000650100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007521 NNN +438560 KR7438560005SOL ä3 EF 000000000000NN 0NNN2NN N 0 Y 0001002850000100001NNN00NNN000000100N0900000000003370000000000002022090600000000000038200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000383 NNN +438570 KR7438570004SOL ä10 EF 000000000000NN 0NNN2NN N 0 Y 0001018750000100001NNN00NNN000000100N0900000000018190000000000002022090600000000000135600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001381 NNN +438740 KR7438740003̴ٽ ߼Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000350250000100001NNN00NNN000000100N0900000000014570000000000002022081700000000000022500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +438900 KR7438900003HANARO Fn K-Ǫ EF 000000000000NN 0NNN2NN N 0 Y 0000117600000100001NNN00NNN000000100N0900000000754850000000000002022081700000000000175000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000205 NNN +439260 KR7439260001 ST0002700150000 N 0NNN NN N 0 N 0000712000000100001NNN00NNN000000050Y0900000003287520000000050002025080100000000003852600000000019263156000012 0 NNY00000877700000198800000206401701000000.0020250930000027430 NNY +439860 KR7439860008KODEX ESGä(A-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001139150000100001NNN00NNN000000100N0900000000005760000000000002022082300000000000410100000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004671 NNN +439870 KR7439870007KODEX ä30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001054600000100001NNN00NNN000000060Y0900000000268460000000000002022082300000000000548200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005781 NNN +440340 KR7440340008TIGER ۷ιƼTIFƼ EF 000000000000NN 0NNN2NN N 0 Y 0000119200000100001NNN00NNN030000100N0900000000132540000000000002022083000000000000155000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000185 NNN +440640 KR7440640001ACE ܱäǾľƼ EF 000000000000NN 0NNN2NN N 0 Y 0001106750000100001NNN00NNN000000060Y0900000000023240000000000002022082300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000664 NNN +440650 KR7440650000ACE ̱޷ܱäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000117250000100001NNN00NNN000000100N0900000000872320000000000002022082300000000000370000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000433 NNN +440910 KR7440910008WON ̱װ EF 000000000000NN 0NNN2NN N 0 Y 0000278250000100001NNN00NNN000000050Y0900000001010980000000000002022082600000000000290000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000806 NNN +441330 KR7441330008KIWOOM ̳A50ĿƮMSCI EF 000000000000NN 0NNN2NN N 0 Y 0000126600000100001NNN00NNN000000100N0900000000001500000000000002022092000000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000025 NNN +441540 KR7441540002HANARO Fnؿ EF 000000000000NN 0NNN2NN N 0 Y 0000328700000100001NNN00NNN000000050Y0900000000620140000000000002022091500000000000355000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001166 NNN +441640 KR7441640000KODEX ̱ĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000125800000100001NNN00NNN000000060Y0900000025888430000000000002022092700000000010115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012724 NNN +441680 KR7441680006TIGER ̱100Ŀ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000109850000100001NNN00NNN030000060Y0900000002107360000000000002022092200000000003485000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003866 NNN +441800 KR7441800000TIME Korea÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000237650000100001NNN00NNN030000060Y0900000005440010000000000002022092700000000001592000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003801 NNN +442090 KR7442090007÷ ڸƴ̾Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000231200000100001NNN00NNN000000100N0900000000009010000000000002022092000000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000208 NNN +442260 KR7442260006Ƽ ̳ƮƼ EF 000000000000NN 0NNN2NN N 0 Y 0000264200000100001NNN00NNN000000100N0900000000053950000000000002022102500000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000317 NNN +442320 KR7442320008RISE ۷ιڷ EF 000000000000NN 0NNN2NN N 0 Y 0000432850000100001NNN00NNN000000050Y0900000001846210000000000002022101300000000000960000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004155 NNN +442550 KR7442550000RISE TDF2030Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000141200000100001NNN00NNN000000100N0900000000270720000000000002022092200000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +442560 KR7442560009RISE TDF2040Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000153600000100001NNN00NNN000000100N0900000000332610000000000002022092200000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000215 NNN +442570 KR7442570008RISE TDF2050Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000161150000100001NNN00NNN000000100N0900000002302670000000000002022092200000000000685000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001103 NNN +442580 KR7442580007PLUS ۷ιHBMݵü EF 000000000000NN 0NNN2NN N 0 Y 0000581100000100001NNN00NNN000000100N0900000004353770000000000002022092200000000000435000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002527 NNN +443060 KR7443060009HD븶ַ ST1002600000000 N 2YNY NY N 0 N 0001854000000100001NNN00NNN000000050Y0900000001789690000000005002024050800000000004483100000000002241566750012 0 NYY00001466500000259600000257101961000036.5120250930000083117IC5NNY +444200 KR7444200000SOL ڸƸްũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000404300000100001NNN00NNN000000100N0900000021078400000000000002022101800000000001530000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006185 NNN +444490 KR7444490007WON ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000188750000100001NNN00NNN000000100N0900000000459890000000000002022100600000000000345000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000651 NNN +445150 KR7445150006KODEX ģȯؿƼ EF 000000000000NN 0NNN2NN N 0 Y 0000343600000100001NNN00NNN000000060Y0900000000471910000000000002022111500000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000755 NNN +445290 KR7445290000KODEX κƼ EF 000000000000NN 0NNN2NN N 0 Y 0000358000000100001NNN00NNN000000060Y0900000048604930000000000002022111500000000002925000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010471 NNN +445690 KR7445690001BNK ְġƼ EF 000000000000NN 0NNN2NN N 0 Y 0000264050000100001NNN00NNN000000100N0900000000037090000000000002022102700000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000237 NNN +445910 KR7445910003TIGER MKF EF 000000000000NN 0NNN2NN N 0 Y 0000194750000100001NNN00NNN030000100N0900000000028420000000000002022101800000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000126 NNN +446070 KR7446070005ϵƼ÷ ST3002700070000 N 0NNN NN N 0 N 0000031300000100001NNN00NNN000000100N0900000000570790000000010002022112800000000001061100000000001061121500012 0 NNY00000194900000003100000008200064000003.3120241231000000332378NNN +446690 KR7446690000KODEX ƽþAIݵüexChinaƼ EF 000000000000NN 0NNN2NN N 0 Y 0000376850000100001NNN00NNN030000100N0900000000209350000000000002023020100000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000188 NNN +446700 KR7446700007RISE ͸ Ŭ EF 000000000000NN 0NNN2NN N 0 Y 0000138600000100001NNN00NNN000000100N0900000000381200000000000002022110100000000000132000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000182 NNN +446720 KR7446720005SOL ̱ٿ EF 000000000000NN 0NNN2NN N 0 Y 0000121800000100001NNN00NNN030000050Y0900000005907770000000000002022111500000000006770000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008266 NNN +446770 KR7446770000ACE ۷ιݵüTOP4 Plus EF 000000000000NN 0NNN2NN N 0 Y 0000566450000100001NNN00NNN030000050Y0900000009576720000000000002022111500000000001695000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000009614 NNN +447430 KR7447430000ACE ȯġ־Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000154550000100001NNN00NNN030000060Y0900000000637460000000000002022111500000000000425000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000662 NNN +447620 KR7447620006SOL ̱TOP5äȥ40 Solactive EF 000000000000NN 0NNN2NN N 0 Y 0000149850000100001NNN00NNN000000100N0900000000858170000000000002022112900000000000740000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001108 NNN +447660 KR7447660002PLUS äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000129650000100001NNN00NNN030000100N0900000000159690000000000002022112900000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000168 NNN +447770 KR7447770009TIGER ׽äȥFn EF 000000000000NN 0NNN2NN N 0 Y 0000148350000100001NNN00NNN030000050Y0900000007030910000000000002022112900000000004530000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006749 NNN +448100 KR7448100008WON 200 EF 000000000000NN 0NNN2NN N 0 Y 0000783850000100001NNN00NNN030000100N0900000000189130000000000002022121600000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000902 NNN +448290 KR7448290007TIGER ̱S&P500(H) EF 000000000000NN 0NNN2NN N 0 Y 0000164200000100001NNN00NNN030000100N0900000001914500000000000002022112500000000002830000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004658 NNN +448300 KR7448300004TIGER ̱100(H) EF 000000000000NN 0NNN2NN N 0 Y 0000206300000100001NNN00NNN030000100N0900000002116080000000000002022112500000000001585000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003273 NNN +448330 KR7448330001KODEX Zäȥ EF 000000000000NN 0NNN2NN N 0 Y 0000146200000100001NNN00NNN000000100N0900000033577790000000000002022112900000000003400000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004970 NNN +448490 KR7448490003HANARO 32-10 äƼ EF 000000000000NN 0NNN2NN N 0 Y 0000550500000100001NNN00NNN000000100N0900000000115890000000000002022112200000000000041800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000230 NNN +448540 KR7448540005ACE äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000251700000100001NNN00NNN000000050Y0900000001930830000000000002022112900000000001130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002844 NNN +448570 KR7448570002FOCUS AIڸƾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000246050000100001NNN00NNN000000100N0900000000103600000000000002022111500000000000205000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000504 NNN +448630 KR7448630004RISE Z׷Top3äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000132450000100001NNN00NNN000000100N0900000008749180000000000002022112900000000000990000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001311 NNN +448730 KR7448730002ZFN RT3002800000000 N 0NNN NN N 0 Y 0000049750000100001NNN00NNN020000060Y09000000024540700000000050020230410000000000091050000000000045525000000 0 NNY00000000000000000000000000000000000000.00 000004529511NNN +449170 KR7449170000TIGER KOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001100650000100001NNN00NNN000000060Y0900000000995210000000000002022113000000000002254800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000024817 NNN +449180 KR7449180009KODEX ̱S&P500(H) EF 000000000000NN 0NNN2NN N 0 Y 0000158200000100001NNN00NNN030000050Y0900000003947870000000000002022120200000000004685000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007430 NNN +449190 KR7449190008KODEX ̱100(H) EF 000000000000NN 0NNN2NN N 0 Y 0000199900000100001NNN00NNN030000050Y0900000004080380000000000002022120200000000002595000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005195 NNN +449450 KR7449450006PLUS K EF 000000000000NN 0NNN2NN N 0 Y 0000686200000100001NNN00NNN000000050Y0900000021525320000000000002023010500000000002310000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000015851 NNN +449580 KR7449580000RISE ׽þƸäȥ EF 000000000000NN 0NNN2NN N 0 Y 0000163600000100001NNN00NNN000000100N0900000000221270000000000002022122000000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000179 NNN +449680 KR7449680008TIGER (ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000127350000100001NNN00NNN000000100N0900000000006250000000000002022122200000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000108 NNN +449690 KR7449690007TIGER ߹ݵü(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000346000000100001NNN00NNN000000100N0900000000012260000000000002022122200000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000259 NNN +449770 KR7449770007KIWOOM ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000198300000100001NNN00NNN030000100N0900000000183330000000000002022122000000000000310000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000616 NNN +449780 KR7449780006KIWOOM ̱S&P500(H) EF 000000000000NN 0NNN2NN N 0 Y 0000172600000100001NNN00NNN030000100N0900000000454060000000000002022122000000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000346 NNN +450080 KR7450080007θƼ ST2002700130000 N 9YNY NN N 0 N 0000746000000100001NNN00NNN000000060Y0900000058906500000000005002023111700000000007055800000000003590737700012 0 NYY000002998-00000647-00000633-0427-00005.5620241231000052636LD2NNY +450180 KR7450180005KODEX (ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000131500000100001NNN00NNN000000100N0900000000000470000000000002022122200000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000085 NNN +450190 KR7450190004KODEX ߹ݵü(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000350000000100001NNN00NNN000000100N0900000000013200000000000002022122200000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +450910 KR7450910005SOL ڽ150 EF 000000000000NN 0NNN2NN N 0 Y 0000199150000100001NNN00NNN000000050Y0900000003497930000000000002023013100000000000194000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000386 NNN +451000 KR7451000004PLUS ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001111750000100001NNN00NNN000000100N0900000000000210000000000002023011000000000000448600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004987 NNN +451060 KR74510600081Q 200Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000245950000100001NNN00NNN030000100N0900000001525090000000000002023013100000000000765000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001897 NNN +451150 KR7451150007÷ ۷ιƼ EF 000000000000NN 0NNN2NN N 0 Y 0000191350000100001NNN00NNN000000100N0900000000002960000000000002023013100000000000062000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000118 NNN +451530 KR7451530000TIGER ä30⽺ƮƼ EF 000000000000NN 0NNN2NN N 0 Y 0000491600000100001NNN00NNN000000100N0900000000388970000000000002023020100000000000237000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001165 NNN +451540 KR7451540009TIGER ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000547450000100001NNN00NNN000000060Y0900000000162880000000000002023020100000000001845600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010103 NNN +451600 KR7451600001PLUS ä30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001013500000100001NNN00NNN000000100N0900000000009080000000000002023020700000000000013700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000138 NNN +451670 KR7451670004RISE ä30ⷹ(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000187450000100001NNN00NNN000000100N0900000000021400000000000002023021400000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000093 NNN +451800 KR7451800007ȭ RT2002800000000 N 0NNN NN N 0 Y 0000045300000100001NNN00NNN000000060Y09000000035849800000000050020230327000000000179600000000000089800000000 0 NNY00000000000000000000000000000000000000.00 000008135913NNN +452250 KR7452250004ACE ̱30ⱹä(ռ H) EF 000000000000NN 0NNN2NN N 0 N 0000053450000100001NNN00NNN000000100N0900000001171280000000000002023020700000000001255000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000670 NNN +452260 KR7452260003ȭ ST3001600000000 N 0NNN NN N 0 N 0000018450000100001NNN02NNN000000100N0900000035618100000000005002023033100000000019385900000000009692980500012 0 NNY000003817000000003-00000203-0217-00004.3920250930000003576913NNN +45226K KR745226K018ȭƿ ST0001600000000 N 0NNN NN N 0 N 0000100100000100001NNN03NNN000000100N0900000006454670000000005002023033100000000000290400000000000145223500012 9 NNN00000000000000000000000000000000000000.00 000000290 NNN +452360 KR7452360001SOL ̱ٿ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000116450000100001NNN00NNN030000100N0900000002766700000000000002023032100000000001730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002018 NNN +452440 KR7452440001VITA ľƼ EF 000000000000NN 0NNN2NN N 0 Y 0000181700000100001NNN00NNN000000100N0900000000000080000000000002023022100000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +453010 KR7453010001PLUS KOFRݸ EF 000000000000NN 0NNN2NN N 0 Y 0001082450000100001NNN00NNN000000100N0900000000026930000000000002023031400000000000014900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000161 NNN +453060 KR7453060006HANARO KOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001096950000100001NNN00NNN000000100N0900000000002960000000000002023031400000000000011000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000120 NNN +453080 KR7453080004KIWOOM ̱100(H) EF 000000000000NN 0NNN2NN N 0 Y 0000206600000100001NNN00NNN030000100N0900000000652100000000000002023031400000000000350000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000723 NNN +453330 KR7453330003RISE ̱S&P500(H) EF 000000000000NN 0NNN2NN N 0 Y 0000166750000100001NNN00NNN030000100N0900000000838850000000000002023032100000000000580000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000968 NNN +453340 KR7453340002׸Ǫ ST2001600000000 N 0NNN NN N 0 N 0000152000000100001NNN00NNN000000050Y0900000000455280000000005002023041000000000003281900000000001694045700012 0 NNY00001739800000107600000113300874000011.8620250930000004988Z35NNN +453630 KR7453630006KODEX ̱S&P500ʼҺ EF 000000000000NN 0NNN2NN N 0 Y 0000125150000100001NNN00NNN030000100N0900000000279630000000000002023032100000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +453640 KR7453640005KODEX ̱S&P500コɾ EF 000000000000NN 0NNN2NN N 0 Y 0000134100000100001NNN00NNN030000050Y0900000001698180000000000002023032100000000000485000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000652 NNN +453650 KR7453650004KODEX ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000185300000100001NNN00NNN030000100N0900000000336240000000000002023032100000000000235000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000436 NNN +453660 KR7453660003KODEX ̱S&P500Һ EF 000000000000NN 0NNN2NN N 0 Y 0000188450000100001NNN00NNN030000100N0900000000065100000000000002023032100000000000075000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000141 NNN +453810 KR7453810004KODEX εNifty50 EF 000000000000NN 0NNN2NN N 0 Y 0000133500000100001NNN00NNN030000050Y0900000003041220000000000002023042100000000003065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004099 NNN +453820 KR7453820003KODEX εNifty50(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000151700000100001NNN00NNN000000100N0900000000201160000000000002023042100000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000197 NNN +453850 KR7453850000ACE ̱30ⱹäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000076300000100001NNN00NNN030000060Y0900000032634760000000000002023031400000000027210000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000020815 NNN +453870 KR7453870008TIGER εƼ50 EF 000000000000NN 0NNN2NN N 0 Y 0000130700000100001NNN00NNN030000060Y0900000007890670000000000002023041400000000003160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004142 NNN +453950 KR7453950008TIGER TSMCĿ帮ü EF 000000000000NN 0NNN2NN N 0 Y 0000273300000100001NNN00NNN000000100N0900000000219350000000000002023040400000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000327 NNN +454180 KR7454180001KIWOOM ̳ҺTOP CSI EF 000000000000NN 0NNN2NN N 0 Y 0000090400000100001NNN00NNN030000100N0900000000021590000000000002023040400000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000036 NNN +454320 KR7454320003HANARO CAPEXiSelect EF 000000000000NN 0NNN2NN N 0 Y 0000384500000100001NNN00NNN000000100N0900000000219990000000000002023041800000000000250000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000961 NNN +454780 KR7454780008KIWOOM ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001033700000100001NNN00NNN000000100N0900000000000730000000000002023041100000000000490500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005070 NNN +454910 KR7454910001λκƽ ST1002700120000 N 2YNY NN N 1 N 0001204000000100001NNN00NNN000000060Y0900000008824170000000005002023100500000000006481900000000003240999000012 0 NYY000000200-00000430-00000388-0388-00015.6820250930000078043391NNN +455030 KR7455030007KODEX ̱޷SOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000122100000100001NNN00NNN030000060Y0900000003226000000000000002023040400000000005094000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006242 NNN +455660 KR7455660001ACE ̱ϵƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000098000000100001NNN00NNN030000100N0900000000585230000000000002023041800000000000470000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000462 NNN +455850 KR7455850008SOL AIݵüҺ EF 000000000000NN 0NNN2NN N 0 Y 0000219750000100001NNN00NNN000000050Y0900000069683730000000000002023042500000000002765000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006076 NNN +455860 KR7455860007SOL 2ҺFn EF 000000000000NN 0NNN2NN N 0 Y 0000067400000100001NNN00NNN000000050Y0900000031606330000000000002023042500000000002865000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001931 NNN +455890 KR7455890004RISE ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000544500000100001NNN00NNN000000060Y0900000003705680000000000002023050900000000004233000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000023048 NNN +455960 KR7455960005RISE ̱޷SOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000122000000100001NNN00NNN000000100N0900000000054540000000000002023051600000000000467000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000569 NNN +456040 KR7456040005OCI ST3002700080000 N 0NNN NN N 0 N 0000712000000100001NNN00NNN000000060Y0900000000487200000000050002023053000000000000895200000000004476247500012 0 NNY000015421-00000024-00000623-0720-00004.3420250930000006374378NNY +456200 KR7456200005PLUS ̱޷SOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000604450000100001NNN00NNN000000100N0900000000000950000000000002023050900000000000011000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +456250 KR7456250000KODEX ǰTOP10 STOXX EF 000000000000NN 0NNN2NN N 0 Y 0000104950000100001NNN00NNN030000100N0900000000061360000000000002023042500000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000131 NNN +456600 KR7456600006TIME ۷ιAIΰɾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000409000000100001NNN00NNN000000060Y0900000005608710000000000002023051600000000002956000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012090 NNN +456610 KR7456610005TIGER ̱޷SOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000604300000100001NNN00NNN000000060Y0900000000879980000000000002023050900000000000926000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005595 NNN +456680 KR7456680008TIGER ̳(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000094300000100001NNN00NNN000000100N0900000000593940000000000002023050900000000000694000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000654 NNN +456880 KR7456880004ACE ̱޷SOFRݸ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000122400000100001NNN00NNN000000060Y0900000002170800000000000002023042500000000002844000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003481 NNN +457190 KR7457190007̼Ƽɹ ST2002700080000 N 4NNY NN N 0 N 0001063000000100001NNN00NNN000000100N0900000007979690000000010002023053100000000003020800000000003020828000012 0 NYY000003026000000000-00000025-0021000000.0020250930000032111 NNN +457480 KR7457480002ACE ׽üξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000215400000100001NNN00NNN000000060Y0900000015412880000000000002023051600000000005965000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012848 NNN +457690 KR7457690006KODEX 33-06 äƼ EF 000000000000NN 0NNN2NN N 0 Y 0000107250000100001NNN00NNN000000100N0900000000120880000000000002023053100000000000191000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000204 NNN +457700 KR7457700003KODEX 53-09 äƼ EF 000000000000NN 0NNN2NN N 0 Y 0000107850000100001NNN00NNN000000100N0900000000041790000000000002023053100000000000134000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000144 NNN +457930 KR7457930006BNK ̷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000257450000100001NNN00NNN000000100N0900000000012740000000000002023062000000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000154 NNN +457990 KR7457990000PLUS ¾籤&ESS EF 000000000000NN 0NNN2NN N 0 Y 0000243050000100001NNN00NNN000000100N0900000001229540000000000002023062000000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000352 NNN +458030 KR7458030004WON äӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000541400000100001NNN00NNN000000100N0900000000031160000000000002023053100000000000107600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000582 NNN +458210 KR7458210002KIWOOM CDݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001087850000100001NNN00NNN000000100N0900000000005610000000000002023052300000000000088500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000962 NNN +458250 KR7458250008TIGER ̱30ⱹäƮƼ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000378950000100001NNN00NNN000000060Y0900000003004540000000000002023053100000000001923200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007287 NNN +458260 KR7458260007TIGER ̱ڵȸäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000486700000100001NNN00NNN030000100N0900000000344570000000000002023053100000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002979 NNN +458730 KR7458730009TIGER ̱ٿ EF 000000000000NN 0NNN2NN N 0 Y 0000132900000100001NNN00NNN030000050Y0900000025555900000000000002023062000000000019020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000025334 NNN +458750 KR7458750007TIGER ̱ٿŸĿ1ȣ EF 000000000000NN 0NNN2NN N 0 Y 0000117900000100001NNN00NNN000000060Y0900000000234970000000000002023062000000000000520000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000613 NNN +458760 KR7458760006TIGER ̱ٿŸĿ2ȣ EF 000000000000NN 0NNN2NN N 0 Y 0000101900000100001NNN00NNN030000060Y0900000004927040000000000002023062000000000007955000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008173 NNN +459560 KR7459560009KODEX ׽üFactSet EF 000000000000NN 0NNN2NN N 0 Y 0000201400000100001NNN00NNN030000100N0900000000304430000000000002023060800000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000302 NNN +459580 KR7459580007KODEX CDݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0010732800000100001NNN00NNN030000060Y0900000003821130000000000002023060800000000000783700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000084322 NNN +459750 KR7459750006RISE ۷ιֽĺлƼ EF 000000000000NN 0NNN2NN N 0 Y 0000170650000100001NNN00NNN000000100N0900000000390460000000000002023062700000000000170000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000290 NNN +459790 KR7459790002KIWOOM ̱30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000194550000100001NNN00NNN000000100N0900000000008340000000000002023062700000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000262 NNN +460270 KR7460270002KIWOOM ̱޷SOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000126450000100001NNN00NNN000000100N0900000000032240000000000002023062000000000000081000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000102 NNN +460280 KR7460280001KIWOOM Fnű EF 000000000000NN 0NNN2NN N 0 Y 0000131400000100001NNN00NNN000000100N0900000000044930000000000002023062700000000000045000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000059 NNN +460660 KR7460660004RISE ̱S&Pŷ EF 000000000000NN 0NNN2NN N 0 Y 0000114450000100001NNN00NNN030000100N0900000000145710000000000002023062700000000000150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000172 NNN +460850 KR7460850001 ST3002700110000 N 0NNN NN N 0 N 0000051500000100001NNN00NNN000000060Y0900000001296550000000050002023061600000000002989800000000014949328000012 0 NNY000021048-00000135-00000505-0429000000.0020250930000001539364NNN +460860 KR7460860000 ST3002700110000 N 0NNN NN N 0 N 0000080500000100001NNN00NNN000000060Y0900000001459400000000050002023061600000000004960800000000024804008500012 0 NNY00003527500000102500000044900348000002.0420241231000003993364NNY +460960 KR7460960008ACE ۷ιTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000116250000100001NNN00NNN030000100N0900000000733970000000000002023071100000000000730000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000853 NNN +461270 KR7461270001ACE 26-06 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000110950000100001NNN00NNN000000100N0900000000188280000000000002023062000000000001643000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001822 NNN +461340 KR7461340002HANARO ۷ιAIƼ EF 000000000000NN 0NNN2NN N 0 Y 0000298800000100001NNN00NNN030000100N0900000000086020000000000002023071100000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000478 NNN +461450 KR7461450009KODEX ڽڱ۷ι EF 000000000000NN 0NNN2NN N 0 Y 0000192500000100001NNN00NNN000000100N0900000002246210000000000002023062900000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000211 NNN +461460 KR7461460008PLUS ä10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000533200000100001NNN00NNN000000100N0900000000042090000000000002023071800000000000102600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000547 NNN +461490 KR7461490005RISE ۷ιڻоƼ EF 000000000000NN 0NNN2NN N 0 Y 0000151550000100001NNN00NNN000000100N0900000005620160000000000002023062700000000002600000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003940 NNN +461500 KR7461500001HANARO ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001083350000100001NNN00NNN000000100N0900000000000680000000000002023102600000000000077400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000838 NNN +461580 KR7461580003TIGER ڽڱ۷ι EF 000000000000NN 0NNN2NN N 0 Y 0000194750000100001NNN00NNN000000100N0900000007559000000000000002023062900000000000035000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000068 NNN +461600 KR7461600009SOL ̱30ⱹäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000087350000100001NNN00NNN000000060Y0900000000595910000000000002023071100000000000545000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000476 NNN +461900 KR7461900003PLUS ̱ũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000219900000100001NNN00NNN000000100N0900000000135850000000000002023071800000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000175 NNN +461910 KR7461910002PLUS ̱ũTOP10(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000370950000100001NNN00NNN000000100N0900000000046890000000000002023071800000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000185 NNN +461950 KR7461950008KODEX 2ٽɼ10 EF 000000000000NN 0NNN2NN N 0 Y 0000072400000100001NNN00NNN000000050Y0900000071522750000000000002023070400000000003885000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002812 NNN +462010 KR7462010000TIGER 2Fn EF 000000000000NN 0NNN2NN N 0 Y 0000074550000100001NNN00NNN000000050Y0900000190534800000000000002023071300000000012350000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000009206 NNY +462330 KR7462330002KODEX 2 EF 000000000000NN 0NNN2NN N 0 N 0000021550000100001NNN00NNN000000100N0900000812323920000000000002023070400000000041080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008852 NNN +462340 KR7462340001÷ ۷ι̳ͽôϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000170550000100001NNN00NNN000000100N0900000000001830000000000002023072500000000000052000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000088 NNN +462520 KR7462520008ȭ ST3002700100000 N 0NNN NN N 0 N 0000142100000100001NNN00NNN000000060Y0900000000123710000000005002023072800000000001185500000000000592758400012 0 NNY00000402700000021600000005900020-00003.6220250930000001684 NNN +462870 KR7462870007Ʈ ST2002900000000 N 0NNY NN N 0 N 0000364500000100001NNN00NNN000000050Y0900000001264870000000002002024071100000000005896100000000001179228800012 0 NYY00000224100000152700000178801480000031.3020241231000021491 NNN +462900 KR7462900002KoAct ̿コɾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000251600000100001NNN00NNN000000050Y0900000037923190000000000002023080300000000002925000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007359 NNN +463050 KR7463050005TIME K̿Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000203500000100001NNN00NNN000000060Y0900000035860390000000000002023081700000000002705000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005504 NNN +463250 KR7463250001TIGER K& EF 000000000000NN 0NNN2NN N 0 Y 0000408800000100001NNN00NNN000000050Y0900000013931620000000000002023072500000000001385000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005661 NNN +463290 KR74632900071Q ܱäƼ EF 000000000000NN 0NNN2NN N 0 Y 0001074600000100001NNN00NNN000000100N0900000000017110000000000002023080300000000000197600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002123 NNN +463300 KR7463300004RISE ߱CSI300 EF 000000000000NN 0NNN2NN N 0 Y 0000135000000100001NNN00NNN000000100N0900000000075350000000000002023080800000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000216 NNN +463640 KR7463640003KODEX ̱S&P500ƿƼ EF 000000000000NN 0NNN2NN N 0 Y 0000143400000100001NNN00NNN030000100N0900000000152250000000000002023080100000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000144 NNN +463680 KR7463680009KODEX ̱S&P500ũ EF 000000000000NN 0NNN2NN N 0 Y 0000185250000100001NNN00NNN030000100N0900000000332050000000000002023080100000000000375000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000695 NNN +463690 KR7463690008KODEX ̱S&P500Ŀ´̼ EF 000000000000NN 0NNN2NN N 0 Y 0000191500000100001NNN00NNN030000100N0900000000155880000000000002023080100000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000124 NNN +464240 KR7464240001KIWOOM 26-09ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000524550000100001NNN00NNN000000100N0900000000032330000000000002023081700000000000522000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002738 NNN +464310 KR7464310002TIGER ۷ιAI&κƽ INDXX EF 000000000000NN 0NNN2NN N 0 Y 0000155400000100001NNN00NNN000000050Y0900000001475280000000000002023081700000000000850000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001320 NNN +464470 KR7464470004PLUS ̱ä30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000522200000100001NNN00NNN030000100N0900000000212510000000000002023082200000000000099400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000520 NNN +464600 KR7464600006SOL ڵҺFn EF 000000000000NN 0NNN2NN N 0 Y 0000158300000100001NNN00NNN000000100N0900000000300610000000000002023082200000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +464610 KR7464610005SOL ǷҺFn EF 000000000000NN 0NNN2NN N 0 Y 0000115800000100001NNN00NNN000000100N0900000002678660000000000002023082200000000000165000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000191 NNN +464920 KR7464920008PLUS ϺݵüҺ EF 000000000000NN 0NNN2NN N 0 Y 0000217100000100001NNN00NNN000000100N0900000000289690000000000002023083100000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000151 NNN +464930 KR7464930007TIGER ۷ιźĨTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000198900000100001NNN00NNN000000100N0900000000444140000000000002023082900000000000735000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001461 NNN +465330 KR7465330009RISE 2TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000135300000100001NNN00NNN000000050Y0900000011256460000000000002023091200000000000610000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000825 NNN +465350 KR7465350007RISE 2TOP10ι(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000179000000100001NNN00NNN000000060Y0900000008740650000000000002023091200000000000270000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000483 NNN +465580 KR7465580009ACE ̱ũTOP7 Plus EF 000000000000NN 0NNN2NN N 0 Y 0000227500000100001NNN00NNN000000050Y0900000011163770000000000002023091200000000004765000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010840 NNN +465610 KR7465610004ACE ̱ũTOP7 Plus(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000394200000100001NNN00NNN000000100N0900000000316060000000000002023091200000000000320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001261 NNN +465620 KR7465620003ACE ̱ũTOP7 Plusι(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000071350000100001NNN00NNN000000100N0900000000018020000000000002023091200000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000017 NNN +465660 KR7465660009TIGER ϺݵüFACTSET EF 000000000000NN 0NNN2NN N 0 Y 0000211750000100001NNN00NNN030000100N0900000000344160000000000002023091900000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000191 NNN +465670 KR7465670008TIGER ̱ijī100 EF 000000000000NN 0NNN2NN N 0 Y 0000144850000100001NNN00NNN030000100N0900000000113390000000000002023091900000000000090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000130 NNN +465770 KR7465770006STX׸ ST3001900000000 N 0NNN NN N 0 N 0000062500000100001NNN00NNN000000100N0900000000604030000000025002023091500000000000717100000000001792758000012 0 NNY000001413-00000125-00000163-0164-00032.8020250930000000448 NNN +465780 KR7465780005Ƽ 26-09 Ưä(AAA)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001047200000100001NNN00NNN000000100N0900000000000060000000000002023092100000000000166300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001741 NNN +466810 KR7466810009BNK 2 EF 000000000000NN 0NNN2NN N 0 Y 0000076100000100001NNN00NNN000000100N0900000003376490000000000002023101900000000000170000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000129 NNN +466920 KR7466920006SOL TOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000381500000100001NNN00NNN000000050Y0900000029283030000000000002023100500000000005245000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000020009 NNY +466930 KR7466930005SOL ڵTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000199300000100001NNN00NNN000000050Y0900000015306090000000000002023100500000000001130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002252 NNN +466940 KR7466940004TIGER ÷TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000228000000100001NNN00NNN030000050Y0900000006606920000000000002023101700000000003070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007021 NNN +466950 KR7466950003TIGER ۷ιAIƼ EF 000000000000NN 0NNN2NN N 0 Y 0000250550000100001NNN00NNN000000060Y0900000001186830000000000002023101100000000001534000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003843 NNN +468370 KR7468370002KODEX iShares̱÷̼DZäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000112550000100001NNN00NNN030000100N0900000000218320000000000002023101900000000000154000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000173 NNN +468380 KR7468380001KODEX iShares̱ϵƼ EF 000000000000NN 0NNN2NN N 0 Y 0000115250000100001NNN00NNN030000100N0900000002775860000000000002023101900000000000996000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001154 NNN +468630 KR7468630009KODEX iShares̱ڵȸäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000116250000100001NNN00NNN030000100N0900000000549240000000000002023101900000000000301000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000351 NNN +469050 KR7469050009RISE ̱ݵüNYSE(H) EF 000000000000NN 0NNN2NN N 0 Y 0000221550000100001NNN00NNN030000100N0900000000517810000000000002023102400000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000221 NNN +469060 KR7469060008RISE ̱ݵüNYSE EF 000000000000NN 0NNN2NN N 0 Y 0000247250000100001NNN00NNN030000100N0900000000205460000000000002023102400000000000140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000346 NNN +469070 KR7469070007RISE AI&κ EF 000000000000NN 0NNN2NN N 0 Y 0000186950000100001NNN00NNN000000050Y0900000059856260000000000002023102400000000002745000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005131 NNN +469150 KR7469150007ACE AIݵüĿ EF 000000000000NN 0NNN2NN N 0 Y 0000361850000100001NNN00NNN000000050Y0900000015789670000000000002023101700000000000895000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003238 NNN +469160 KR7469160006ACE Ϻݵü EF 000000000000NN 0NNN2NN N 0 Y 0000208350000100001NNN00NNN000000100N0900000000091120000000000002023101700000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000104 NNN +469170 KR7469170005ACE ڱ׷Ŀ EF 000000000000NN 0NNN2NN N 0 Y 0000074050000100001NNN00NNN030000050Y0900000021095600000000000002023101700000000001595000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001182 NNN +469530 KR7469530000RISE ̱޷ι EF 000000000000NN 0NNN2NN N 0 N 0000091450000100001NNN00NNN000000100N0900000000026050000000000002023110900000000000064000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000058 NNN +469790 KR7469790000KIWOOM K-ũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000250100000100001NNN00NNN030000100N0900000000071530000000000002023103100000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000175 NNN +469830 KR7469830004SOL ʴܱäǾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000533350000100001NNN00NNN000000060Y0900000007543520000000000002023110700000000001670200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008908 NNN +470310 KR7470310004UNICORN AIұƼ EF 000000000000NN 0NNN2NN N 0 Y 0000135200000100001NNN00NNN000000100N0900000000016000000000000002023112100000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000033 NNN +471040 KR7471040006KoAct ۷ιAI&κƼ EF 000000000000NN 0NNN2NN N 0 Y 0000240250000100001NNN00NNN000000060Y0900000002677040000000000002023112100000000000815000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001958 NNN +471230 KR7471230003KODEX ä10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001079050000100001NNN00NNN000000060Y0900000000333850000000000002023111400000000000532700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005748 NNN +471460 KR7471460006KIWOOM ä30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000556200000100001NNN00NNN030000100N0900000000043310000000000002023110700000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000334 NNN +471760 KR7471760009TIGER AIݵüٽɰ EF 000000000000NN 0NNN2NN N 0 Y 0000157100000100001NNN00NNN000000050Y0900000023058430000000000002023112100000000000810000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001272 NNN +471780 KR7471780007TIGER ڸũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000215000000100001NNN00NNN000000100N0900000000849400000000000002023112800000000000165000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000354 NNN +471990 KR7471990002KODEX AIݵüٽ EF 000000000000NN 0NNN2NN N 0 Y 0000193500000100001NNN00NNN000000050Y0900000014334790000000000002023112100000000001355000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002621 NNN +472150 KR7472150002TIGER ĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000162450000100001NNN00NNN030000060Y0900000022845930000000000002023121200000000002534000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004197 NNN +472160 KR7472160001TIGER ̱ũTOP10 INDXX(H) EF 000000000000NN 0NNN2NN N 0 Y 0000182300000100001NNN00NNN000000050Y0900000007775690000000000002023120500000000001685000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003071 NNN +472170 KR7472170000TIGER ̱ũTOP10äȥ EF 000000000000NN 0NNN2NN N 0 Y 0000138150000100001NNN00NNN000000100N0900000003870990000000000002023120500000000002565000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003543 NNN +472350 KR74723500081Q ̳H(H) EF 000000000000NN 0NNN2NN N 0 Y 0000170500000100001NNN00NNN000000100N0900000000020500000000000002023121200000000000010000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000017 NNN +472720 KR7472720002TRUSTON ְġƼ EF 000000000000NN 0NNN2NN N 0 Y 0000210400000100001NNN00NNN000000100N0900000000056250000000000002023121400000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000126 NNN +472830 KR7472830009RISE ̱30ⱹäĿ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000089000000100001NNN00NNN030000060Y0900000001689210000000000002023121400000000000650000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000583 NNN +472840 KR7472840008ITF 200 EF 000000000000NN 0NNN2NN N 0 Y 0000759350000100001NNN00NNN030000100N0900000000005410000000000002023122100000000000027500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000209 NNN +472870 KR7472870005RISE ̱30ⱹäȭ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000080350000100001NNN00NNN030000060Y0900000005439520000000000002023122700000000004540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003656 NNN +472920 KR7472920008HK ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001014150000100001NNN00NNN000000100N0900000000000710000000000002023112800000000000186500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001891 NNN +473290 KR7473290005KODEX 26-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000107300000100001NNN00NNN000000060Y0900000000799600000000000002023121200000000005527000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005930 NNN +473330 KR7473330009SOL ̱30ⱹäĿ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000089800000100001NNN00NNN030000060Y0900000014562820000000000002023122700000000004200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003803 NNN +473440 KR7473440006ACE 11ڵȸäAA-̻Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000106650000100001NNN00NNN000000100N0900000000018050000000000002023121900000000000874000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000932 NNN +473460 KR7473460004KODEX ̱а EF 000000000000NN 0NNN2NN N 0 Y 0000234550000100001NNN00NNN030000050Y0900000003378730000000000002023122700000000001420000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003332 NNN +473490 KR7473490001KIWOOM ۷ιAIݵü EF 000000000000NN 0NNN2NN N 0 Y 0000235800000100001NNN00NNN030000100N0900000000169060000000000002023122100000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000318 NNN +473590 KR7473590008ACE ֽ̱ĺƮ EF 000000000000NN 0NNN2NN N 0 Y 0000213550000100001NNN00NNN000000050Y0900000000825970000000000002023122700000000000320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000683 NNN +473640 KR7473640001HANARO ۷ιä EF 000000000000NN 0NNN2NN N 0 Y 0000405700000100001NNN00NNN030000100N0900000001955280000000000002024011800000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001341 NNN +474220 KR7474220001TIGER ̱ũTOP10ŸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000156000000100001NNN00NNN000000060Y0900000004771680000000000002024011600000000003430000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005350 NNN +474390 KR7474390002SOL ä30Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000490200000100001NNN00NNN000000100N0900000000002910000000000002024011600000000000013400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000065 NNN +474590 KR7474590007WON ݵüüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000250000000100001NNN00NNN000000100N0900000000824760000000000002024011600000000000485000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001212 NNN +474800 KR7474800000KIWOOM ̱ EF 000000000000NN 0NNN2NN N 0 Y 0000129550000100001NNN00NNN030000100N0900000000568950000000000002024011600000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000155 NNN +474920 KR7474920006÷ ̳ϵĿ10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000175250000100001NNN00NNN000000100N0900000000038800000000000002024011600000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000192 NNN +475050 KR7475050001ACE KPOPĿ EF 000000000000NN 0NNN2NN N 0 Y 0000124200000100001NNN00NNN000000050Y0900000015875750000000000002024013000000000001930000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002397 NNN +475070 KR7475070009KoAct ۷ιģȯƼ EF 000000000000NN 0NNN2NN N 0 Y 0000292000000100001NNN00NNN000000100N0900000000250720000000000002024011800000000000105000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000306 NNN +475080 KR7475080008KODEX ׽ĿäȥվƼ EF 000000000000NN 0NNN2NN N 0 Y 0000088550000100001NNN00NNN030000100N0900000006768030000000000002024012300000000003900000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003496 NNN +475150 KR7475150009SKʹн ST2001800000000 N 0NNN NN N 0 N 0000198100000100001NNN00NNN000000100N0900000002450770000000002002024032900000000003375400000000000675080840012 0 NNY00000137700000011800000009800102000012.6620250930000006686535NNN +475260 KR7475260006ACE 2ڵȸäAA-̻Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000105700000100001NNN00NNN000000100N0900000000043450000000000002024012300000000000471000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000497 NNN +475270 KR7475270005ACE 5ڵȸäAA-̻Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000105500000100001NNN00NNN000000100N0900000000000070000000000002024012300000000000418000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000440 NNN +475280 KR7475280004ACE 8ڵȸäAA-̻Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000105500000100001NNN00NNN000000100N0900000000000590000000000002024012300000000000758000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000799 NNN +475300 KR7475300000SOL ݵü EF 000000000000NN 0NNN2NN N 0 Y 0000158300000100001NNN00NNN000000100N0900000017399990000000000002024021400000000000320000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000506 NNN +475310 KR7475310009SOL ݵüİ EF 000000000000NN 0NNN2NN N 0 Y 0000226800000100001NNN00NNN000000100N0900000003195780000000000002024021400000000000145000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000328 NNN +475350 KR7475350005RISE ũƮTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000136400000100001NNN00NNN000000100N0900000000639020000000000002024022700000000000525000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000716 NNN +475380 KR7475380002RISE ۷ιƼ EF 000000000000NN 0NNN2NN N 0 Y 0000104200000100001NNN00NNN030000100N0900000000379290000000000002024022000000000000290000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000303 NNN +475560 KR7475560009ڸ ST3001600000000 N 0NNN NN N 0 N 0000244000000100001NNN00NNN000000100N0900000000251640000000005002024110600000000001477600000000000752704000012 0 NNY000002723-00000206-00000190-0201000000.0020250930000003605 NNN +475630 KR7475630000TIGER CD1ݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0010575550000100001NNN00NNN000000060Y0900000000323050000000000002024020600000000000157000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000016606 NNN +475720 KR7475720009RISE 200ŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000123450000100001NNN00NNN030000060Y0900000039112140000000000002024030500000000006420000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008041 NNN +476000 KR7476000005UNICORN ƮIPOƼ EF 000000000000NN 0NNN2NN N 0 Y 0000126850000100001NNN00NNN000000100N0900000000009040000000000002024022700000000000045000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000057 NNN +476030 KR7476030002SOL ̱100 EF 000000000000NN 0NNN2NN N 0 Y 0000156050000100001NNN00NNN030000050Y0900000000810530000000000002024031200000000000515000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000804 NNN +476070 KR7476070008KODEX ۷ιġTOP2 Plus EF 000000000000NN 0NNN2NN N 0 Y 0000119800000100001NNN00NNN030000050Y0900000001003920000000000002024021400000000000485000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000581 NNN +476260 KR7476260005HANARO ݵüٽɰֵ EF 000000000000NN 0NNN2NN N 0 Y 0000117300000100001NNN00NNN000000100N0900000012614160000000000002024022700000000000135000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +476310 KR7476310008RISE ۷ι񸸻TOP2+ EF 000000000000NN 0NNN2NN N 0 Y 0000103300000100001NNN00NNN000000100N0900000000171340000000000002024022700000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +476450 KR7476450002KIWOOM ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000518300000100001NNN00NNN000000100N0900000000007770000000000002024022900000000000486000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002518 NNN +476550 KR7476550009TIGER ̱30ⱹäĿݾƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000075750000100001NNN00NNN030000060Y0900000024672150000000000002024022700000000016425000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012565 NNN +476690 KR7476690003TIGER ۷ιġTOP2Plus EF 000000000000NN 0NNN2NN N 0 Y 0000110600000100001NNN00NNN030000050Y0900000002006350000000000002024022900000000000540000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000597 NNN +476750 KR7476750005ACE ̱30ⱹäȭƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000086150000100001NNN00NNN030000060Y0900000002584580000000000002024031200000000001240000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001070 NNN +476760 KR7476760004ACE ̱30ⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000097550000100001NNN00NNN030000100N0900000010068800000000000002024031200000000003700000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003620 NNN +476800 KR7476800008KODEX ѱε긮 EF 000000000000NN 0NNN2NN N 0 Y 0000048750000100001NNN00NNN000000050Y0900000021059920000000000002024030500000000011830000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005767 NNN +476850 KR7476850003KoAct 缺Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000166800000100001NNN00NNN030000100N0900000004665520000000000002024022700000000000300000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000512 NNN +477050 KR7477050009PLUS ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000525050000100001NNN00NNN000000100N0900000000380240000000000002024032600000000000870800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004572 NNN +477080 KR7477080006RISE CDݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001057000000100001NNN00NNN000000060Y0900000000076160000000000002024032600000000001221700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000012913 NNN +477490 KR7477490007÷ ۷ιϵĿ10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000188400000100001NNN00NNN000000100N0900000000148110000000000002024031900000000000106000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000199 NNN +477730 KR7477730006KODEX εŸŸ׷ EF 000000000000NN 0NNN2NN N 0 Y 0000084000000100001NNN00NNN030000050Y0900000000238570000000000002024050800000000000355000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000298 NNN +478150 KR7478150006TIME ۷ιũ&Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000227050000100001NNN00NNN000000060Y0900000004675090000000000002024042300000000001710000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003882 NNN +479080 KR74790800041Q ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000527500000100001NNN00NNN000000060Y0900000000597550000000000002024040200000000001896400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010003 NNN +479520 KR7479520009RISE KOFRݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001047550000100001NNN00NNN000000060Y0900000000045720000000000002024043000000000000651000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006819 NNN +479620 KR7479620007SOL ̱AIݵüĨĿ EF 000000000000NN 0NNN2NN N 0 Y 0000165600000100001NNN00NNN000000050Y0900000000707460000000000002024041600000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000380 NNN +479730 KR7479730004TIGER ε EF 000000000000NN 0NNN2NN N 0 Y 0000101850000100001NNN00NNN030000100N0900000001032460000000000002024051400000000001140000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001162 NNN +479850 KR7479850000HANARO K-Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000163300000100001NNN00NNN000000100N0900000002395380000000000002024041600000000000370000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000604 NNN +480020 KR7480020007ACE ̱ũ7+ϸŸĿ(ռ)EF 000000000000NN 0NNN2NN N 0 Y 0000127200000100001NNN00NNN000000060Y0900000002216070000000000002024042300000000001530000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001946 NNN +480030 KR7480030006ACE ̱500ϸŸĿ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000106600000100001NNN00NNN000000060Y0900000001121500000000000002024042300000000001460000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001556 NNN +480040 KR7480040005ACE ̱ݵüϸŸĿ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000139450000100001NNN00NNN000000060Y0900000000748570000000000002024042300000000000760000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001059 NNN +480260 KR7480260009TIGER 27-04ȸä(A+̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000532950000100001NNN00NNN000000060Y0900000000173110000000000002024042300000000000908200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004840 NNN +480310 KR7480310002TIGER ۷ιµ̽AI EF 000000000000NN 0NNN2NN N 0 Y 0000138450000100001NNN00NNN030000050Y0900000000264380000000000002024041600000000000400000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000554 NNN +480370 KR7480370006ַ̼ ST3001800000000 N 0NNN NN N 0 N 0000089300000100001NNN00NNN000000100N0900000000951550000000001002025031700000000001093400000000000109348610012 0 NNY000002045-00000264-00000315-0249000000.0020250930000000976 NNN +480460 KR7480460005WON ѱεTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000102250000100001NNN00NNN030000100N0900000000041540000000000002024043000000000000100000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000102 NNN +481050 KR7481050003KODEX CD1ݸ÷Ƽ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0010213900000100001NNN00NNN030000060Y0900000000143930000000000002024042300000000000294800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000030185 NNN +481060 KR7481060002KODEX ̱30ⱹäŸĿ(ռ H) EF 000000000000NN 0NNN2NN N 0 Y 0000082850000100001NNN00NNN000000060Y0900000012429850000000000002024043000000000011090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000009188 NNN +481180 KR7481180008SOL ̱AIƮ EF 000000000000NN 0NNN2NN N 0 Y 0000138600000100001NNN00NNN000000050Y0900000002508390000000000002024051400000000001405000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001947 NNN +481190 KR7481190007SOL ̱ũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000164800000100001NNN00NNN000000100N0900000003386630000000000002024052100000000001905000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003139 NNN +481200 KR7481200004SOL ̱ũTOP10ι(ռ) EF 000000000000NN 0NNN2NN N 0 N 0000058500000100001NNY00NNN000000100N0900000000013080000000000002024052100000000000040000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000023 NNN +481340 KR7481340008RISE ̱30ⱹäƼ EF 000000000000NN 0NNN2NN N 0 Y 0000096100000100001NNN00NNN030000100N0900000000976420000000000002024052800000000000305000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +481430 KR7481430007RISE ä10Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0001019350000100001NNN00NNN000000100N0900000000011690000000000002024052100000000000146300000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001491 NNN +481850 KR7481850006ѱ۷ιƼ긮 RT3002100000000 N 0NNN NN N 0 Y 0000012800000100001NNN00NNN000000100N09000000018694800000000100020240701000000000043477000000000043477664000 0 NNY00000000000000000000000000000000000000.00 000000556 NNN +482030 KR7482030004KoAct ݵü&2ٽɼƼ EF 000000000000NN 0NNN2NN N 0 Y 0000122200000100001NNN00NNN000000100N0900000001129880000000000002024051400000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +482730 KR7482730009TIGER ̱S&P500ŸٵϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000117150000100001NNN00NNN030000060Y0900000007852840000000000002024052100000000004350000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005139 NNN +483020 KR7483020004KIWOOM ǷAI EF 000000000000NN 0NNN2NN N 0 Y 0000138650000100001NNN00NNN000000100N0900000000318220000000000002024052800000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000090 NNN +483030 KR7483030003KIWOOM ̱Ϲ͹̿ũǾǰ+ EF 000000000000NN 0NNN2NN N 0 Y 0000112750000100001NNN00NNN030000100N0900000000363570000000000002024052800000000000050000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +483240 KR7483240008TIGER ̱100ETF EF 000000000000NN 0NNN2NN N 0 N 0000125450000100001NNN00NNN000000100N0900000000096070000000000002024111900000000000200000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000250 NNN +483280 KR7483280004KODEX ̱AIũTOP10ŸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000125950000100001NNN00NNN030000060Y0900000008628200000000000002024052800000000004810000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006132 NNN +483290 KR7483290003KODEX ̱ٿŸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000097000000100001NNN00NNN030000100N0900000002106490000000000002024052800000000001500000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001469 NNN +483320 KR7483320008ACE ƹüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000168600000100001NNN00NNN000000060Y0900000010336460000000000002024061100000000001220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002056 NNN +483330 KR7483330007ACE ũμƮüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000127850000100001NNN00NNN000000100N0900000001951600000000000002024061100000000000105000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +483340 KR7483340006ACE ۹üξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000171600000100001NNN00NNN000000060Y0900000009130750000000000002024061100000000001005000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001724 NNN +483420 KR7483420006ACE ùüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000159100000100001NNN00NNN000000100N0900000000523810000000000002024061100000000000125000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000198 NNN +483570 KR7483570008KCGI ̱S&P500 TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000152800000100001NNN00NNN000000100N0900000000077120000000000002024052800000000000160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000244 NNN +483650 KR7483650008޹ٱ۷ι ST2002700080000 N 0NNN NN N 0 N 0001600000000100001NNN00NNN000000050Y0900000002007520000000001002025052200000000001239200000000000123926650012 0 NNY00000359500000075900000077000586000048.8820250930000019828 NNN +484790 KR7484790001KODEX ̱30ⱹäƼ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000088400000100001NNN00NNN030000060Y0900000007811460000000000002024061800000000007700000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006833 NNN +484870 KR7484870001ؾַ ST2002700120000 N 0NNY NN N 0 N 0001416000000100001NNN00NNN000000050Y0900000000246560000000001002024121600000000000915300000000000091539000012 0 NYY00000282800000034800000034400270000021.8220241231000012961 NNY +484880 KR7484880000SOL ÷ EF 000000000000NN 0NNN2NN N 0 Y 0000188200000100001NNN00NNN030000050Y0900000007891660000000000002024062500000000001530000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002886 NNN +484890 KR7484890009SOL ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000517200000100001NNN00NNN000000100N0900000000143360000000000002024062500000000000025400000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000131 NNN +485540 KR7485540009KODEX ̱AIũTOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000149500000100001NNN00NNN030000050Y0900000007419600000000000002024062500000000002150000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003216 NNN +485690 KR7485690002RISE ̱AIüTOP3Plus EF 000000000000NN 0NNN2NN N 0 Y 0000177950000100001NNN00NNN000000100N0900000000416510000000000002024072300000000000480000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000854 NNN +485810 KR7485810006TIME ۷ι̿Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000108350000100001NNN00NNN000000100N0900000000353100000000000002024070200000000000130000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000140 NNN +486240 KR7486240005DAISHIN343 AIݵü&Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000194000000100001NNN00NNN000000100N0900000000093770000000000002024061800000000000300000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000582 NNN +486290 KR7486290000TIGER ̱100ŸٵϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000105600000100001NNN00NNN030000060Y0900000021132040000000000002024062500000000010910000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000011662 NNN +486450 KR7486450000SOL ̱AI EF 000000000000NN 0NNN2NN N 0 Y 0000204750000100001NNN00NNN000000050Y0900000002069160000000000002024071600000000001380000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002825 NNN +486830 KR7486830003HANARO ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000523150000100001NNN00NNN000000100N0900000000036890000000000002024071600000000000096000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000502 NNN +487130 KR7487130007KoAct AIƼ EF 000000000000NN 0NNN2NN N 0 Y 0000200600000100001NNN00NNN000000100N0900000000435750000000000002024070900000000000170000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000341 NNN +487230 KR7487230005KODEX ̱AIٽ EF 000000000000NN 0NNN2NN N 0 Y 0000181450000100001NNN00NNN030000050Y0900000018414780000000000002024070900000000008520000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000015468 NNN +487240 KR7487240004KODEX AIٽɼ EF 000000000000NN 0NNN2NN N 0 Y 0000278600000100001NNN00NNN000000050Y0900000056574210000000000002024070900000000004830000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000013456 NNY +487340 KR7487340002ACE ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001037450000100001NNN00NNN000000060Y0900000000115100000000000002024070900000000000514500000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005337 NNN +487570 KR7487570004HSȿ ST3002100000000 N 0NNN NN N 0 N 0000649000000100001NNN00NNN000000060Y0900000000435800000000050002024072900000000000372500000000001862963500012 0 NNY00001216200000034200000021400111000002.4320250930000002418971NNN +487750 KR7487750002BNK µ̽AI EF 000000000000NN 0NNN2NN N 0 Y 0000188000000100001NNN00NNN000000100N0900000006412420000000000002024072300000000000225000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000423 NNN +487910 KR7487910002ACE εĿƼ EF 000000000000NN 0NNN2NN N 0 Y 0000084450000100001NNN00NNN000000100N0900000000638940000000000002024091000000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +487920 KR7487920001ACE εǥBIG5׷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000082750000100001NNN00NNN000000100N0900000000138460000000000002024091000000000000110000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000091 NNN +487950 KR7487950008KODEX 븸ũٿ EF 000000000000NN 0NNN2NN N 0 Y 0000106900000100001NNN00NNN030000100N0900000000129890000000000002024072300000000000120000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000129 NNN +488080 KR7488080003TIGER ݵüTOP10 EF 000000000000NN 0NNN2NN N 0 N 0000330000000100001NNN00NNN000000100N0900000053602570000000000002024072300000000001530000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005049 NNN +488200 KR7488200007KIWOOM K-2Ϲ̰޸ EF 000000000000NN 0NNN2NN N 0 Y 0000134050000100001NNN00NNN000000100N0900000000351500000000000002024072300000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000073 NNN +488210 KR7488210006KIWOOM K-ݵüϹ̰޸ EF 000000000000NN 0NNN2NN N 0 Y 0000174700000100001NNY00NNN000000100N0900000000123020000000000002024072300000000000020000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000034 NNN +488290 KR7488290008̴ٽ ϺũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000338050000100001NNN00NNN000000100N0900000000004880000000000002024080600000000000025000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +488480 KR7488480005RISE ϺTOP4Plus EF 000000000000NN 0NNN2NN N 0 Y 0000126200000100001NNN00NNN000000100N0900000000024670000000000002024082000000000000065000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000082 NNN +488500 KR7488500000TIGER ̱S&P500ϰ EF 000000000000NN 0NNN2NN N 0 Y 0000120300000100001NNN00NNN030000100N0900000000986260000000000002024072300000000001015000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001225 NNN +488720 KR7488720004WON ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000501800000100001NNN00NNN000000100N0900000000026000000000000002024080600000000000133800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000671 NNN +488770 KR7488770009KODEX ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0001034100000100001NNN00NNN000000060Y0900000005751390000000000002024080600000000007200600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000074461 NNN +488980 KR7488980004SOL 26-12 ȸä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000512600000100001NNN00NNN000000100N0900000000014890000000000002024100800000000000405600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002079 NNN +489000 KR7489000000PLUS Ϻȭʴܱⱹä(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0000098550000100001NNN00NNN000000100N0900000001892250000000000002024081300000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000216 NNN +489010 KR7489010009PLUS ۷ιAI EF 000000000000NN 0NNN2NN N 0 Y 0000165450000100001NNN00NNN000000100N0900000000011740000000000002024081300000000000015000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000024 NNN +489030 KR7489030007PLUS ŬĿ EF 000000000000NN 0NNN2NN N 0 N 0000088350000100001NNN00NNN030000060Y0900000007538120000000000002024081300000000002440000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002188 NNN +489250 KR7489250001KODEX ̱ٿ EF 000000000000NN 0NNN2NN N 0 Y 0000114000000100001NNN00NNN000000050Y0900000005801270000000000002024081300000000003340000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003807 NNN +489290 KR7489290007WON ̱׾ EF 000000000000NN 0NNN2NN N 0 Y 0000153950000100001NNN00NNN000000100N0900000000185480000000000002024090300000000000285000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000438 NNN +489790 KR7489790006ȭ ST2002700130000 N 0NNY NN N 0 N 0000557000000100001NNN00NNN000000060Y0900000010084340000000005002024092700000000005048800000000002524419500012 0 NYY000013317000001317-00000410-0202000000.5420250930000028122913NNY +489860 KR7489860007KIWOOM ۷ιGRID EF 000000000000NN 0NNN2NN N 0 Y 0000141300000100001NNN00NNN030000100N0900000000152800000000000002024082700000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000077 NNN +490090 KR7490090008TIGER ̱AIũ10 EF 000000000000NN 0NNN2NN N 0 Y 0000151050000100001NNN00NNN000000050Y0900000004040750000000000002024082700000000001520000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002295 NNN +490330 KR7490330008KoAct ̱ġ&ȯġƼ EF 000000000000NN 0NNN2NN N 0 Y 0000120900000100001NNN00NNN000000100N0900000000079340000000000002024090300000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000072 NNN +490480 KR7490480001SOL K EF 000000000000NN 0NNN2NN N 0 Y 0000345300000100001NNN00NNN000000050Y0900000001678560000000000002024100200000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001139 NNN +490490 KR7490490000SOL ̱̱äȥ50 EF 000000000000NN 0NNN2NN N 0 Y 0000107000000100001NNN00NNN000000100N0900000004828650000000000002024092400000000003090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003306 NNN +490590 KR7490590007RISE ̱AIüεϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000131850000100001NNN00NNN030000060Y0900000008908670000000000002024100200000000004090000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005460 NNN +490600 KR7490600004RISE ̱100ϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000088450000100001NNN00NNN030000060Y0900000004540290000000000002024092400000000001290000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001153 NNN +491010 KR7491010005TIGER ۷ιAIƼ EF 000000000000NN 0NNN2NN N 0 Y 0000216400000100001NNN00NNN000000060Y0900000002976030000000000002024091000000000002046000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004427 NNN +491090 KR7491090007KODEX ̱ũTOP3÷ EF 000000000000NN 0NNN2NN N 0 Y 0000165150000100001NNN00NNN030000100N0900000000195720000000000002024091000000000000190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000313 NNN +491220 KR7491220000PLUS 200TR EF 000000000000NN 0NNN2NN N 0 Y 0000898750000100001NNN00NNN000000100N0900000000232940000000000002024091000000000000055000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000494 NNN +491230 KR7491230009PLUS äӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000516000000100001NNN00NNN000000100N0900000000025950000000000002024091000000000000284800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001469 NNN +491510 KR7491510004Ŀ K-ְġƼ EF 000000000000NN 0NNN2NN N 0 Y 0000159700000100001NNN00NNN000000100N0900000000010890000000000002024092400000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000183 NNN +491610 KR74916100021Q CDݸƼ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0001031550000100001NNN00NNN000000100N0900000000049860000000000002024092400000000000203700000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002101 NNN +491620 KR7491620001RISE ̱ũ100ϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000109000000100001NNN00NNN030000060Y0900000009122460000000000002024100200000000003230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000003564 NNN +491630 KR7491630000RISE ̱ݵüι(ռ H) EF 000000000000NN 0NNN2NN N 0 N 0000096050000100001NNN00NNN000000100N0900000000018080000000000002024102200000000000045000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000043 NNN +491700 KR7491700001HK 200 EF 000000000000NN 0NNN2NN N 0 Y 0000767450000100001NNN00NNN000000100N0900000000017230000000000002024091000000000000095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000729 NNN +491820 KR7491820007HANARO ¼ EF 000000000000NN 0NNN2NN N 0 Y 0000335550000100001NNN00NNN000000100N0900000001871830000000000002024092400000000000265000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000889 NNN +491830 KR7491830006TIGER ̱AIݵüո EF 000000000000NN 0NNN2NN N 0 Y 0000148750000100001NNN00NNN030000100N0900000000686720000000000002024092400000000000190000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000282 NNN +492500 KR74925000041Q ׷ä(A+̻)& EF 000000000000NN 0NNN2NN N 0 Y 0000511200000100001NNN00NNN000000100N0900000000041020000000000002024100200000000000207800000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001062 NNN +493420 KR7493420004SOL ̱ٿ2ȣ EF 000000000000NN 0NNN2NN N 0 Y 0000112350000100001NNN00NNN000000100N0900000000106900000000000002024100800000000000260000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000292 NNN +493810 KR7493810006TIGER ̱AIũ10ŸٵϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000119600000100001NNN00NNN000000060Y0900000003447500000000000002024101500000000002385000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002852 NNN +494180 KR7494180003TIME ۷ιҺƮƼ EF 000000000000NN 0NNN2NN N 0 Y 0000137450000100001NNN00NNN000000100N0900000000047610000000000002024102900000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +494210 KR7494210008SOL ̱500ŸٵϸĿݾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000108550000100001NNN00NNN030000100N0900000000876510000000000002024101500000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +494220 KR7494220007UNICORN SK̴нüξƼ EF 000000000000NN 0NNN2NN N 0 Y 0000284100000100001NNN00NNN000000100N0900000005050980000000000002024110700000000000300000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000852 NNN +494300 KR7494300007KODEX ̱100ϸĿOTM EF 000000000000NN 0NNN2NN N 0 Y 0000099600000100001NNN00NNN030000060Y0900000017088430000000000002024102200000000005790000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000005862 NNN +494310 KR7494310006KODEX ݵü EF 000000000000NN 0NNN2NN N 0 N 0000526600000100001NNN00NNN000000100N0900000038546320000000000002024102200000000001595000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000008399 NNN +494330 KR7494330004ACE ڻְġƼ EF 000000000000NN 0NNN2NN N 0 Y 0000188500000100001NNN00NNN030000100N0900000000523090000000000002024101500000000000305000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000577 NNN +494340 KR7494340003ACE ۷ιAIݵü EF 000000000000NN 0NNN2NN N 0 Y 0000129500000100001NNN00NNN000000100N0900000000180430000000000002024102200000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +494410 KR7494410004PLUS ̱S&P500 EF 000000000000NN 0NNN2NN N 0 Y 0000132550000100001NNN00NNN030000100N0900000000095230000000000002024102200000000000230000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000305 NNN +494420 KR7494420003PLUS ֵ̱ϸĿ EF 000000000000NN 0NNN2NN N 0 Y 0000095400000100001NNN00NNN000000100N0900000000529690000000000002024102200000000000180000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000171 NNN +494670 KR7494670003TIGER TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000303400000100001NNN00NNN000000050Y0900000017523150000000000002024102200000000003415000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010361 NNN +494840 KR7494840002TIGER ̱TOP10 EF 000000000000NN 0NNN2NN N 0 Y 0000145500000100001NNN00NNN030000100N0900000001799450000000000002024102900000000000435000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000634 NNN +494890 KR7494890007KODEX 200Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000219700000100001NNN00NNN030000060Y0900000010234200000000000002024102900000000003560000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000007833 NNN +495040 KR7495040008PLUS ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000221000000100001NNN00NNN000000100N0900000000075780000000000002024110400000000000250000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000552 NNN +495050 KR7495050007RISE ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000223500000100001NNN00NNN000000100N0900000043259040000000000002024110400000000001820000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004067 NNN +495060 KR7495060006TIME ڸƹƼ EF 000000000000NN 0NNN2NN N 0 Y 0000203450000100001NNN00NNN000000100N0900000001984760000000000002024110400000000000310000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000630 NNN +495230 KR7495230005KoAct ڸƹƼ EF 000000000000NN 0NNN2NN N 0 Y 0000227400000100001NNN00NNN030000060Y0900000004792200000000000002024110400000000000520000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001184 NNN +495330 KR74953300031Q ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000221900000100001NNN00NNN030000100N0900000000743910000000000002024110400000000000330000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000732 NNN +495550 KR7495550006SOL ڸƹTR EF 000000000000NN 0NNN2NN N 0 Y 0000227150000100001NNN00NNN000000100N0900000000512970000000000002024110400000000000370000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000840 NNN +495710 KR7495710006BNK 26-06 Ưä(AAA̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000512700000100001NNN00NNN000000100N0900000000000010000000000002024120300000000000210600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001079 NNN +495750 KR7495750002HANARO ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000221000000100001NNN00NNN030000100N0900000000032040000000000002024110400000000000215000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000475 NNN +495850 KR7495850000KODEX ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000222450000100001NNN00NNN030000100N0900000007919090000000000002024110400000000002160000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004822 NNN +495940 KR7495940009RISE ̱AIũƼ EF 000000000000NN 0NNN2NN N 0 Y 0000145000000100001NNN00NNN000000100N0900000000433670000000000002024112600000000000250000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000362 NNN +496020 KR7496020009WON ä÷Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000514200000100001NNN00NNN000000100N0900000000026570000000000002024111900000000000349600000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001797 NNN +496080 KR7496080003TIGER ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000222650000100001NNN00NNN030000100N0900000007007960000000000002024110400000000000975000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002172 NNN +496090 KR7496090002KIWOOM ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000222100000100001NNN00NNN030000100N0900000000731440000000000002024110400000000000420000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000935 NNN +496120 KR7496120007ACE ڸƹ EF 000000000000NN 0NNN2NN N 0 Y 0000225100000100001NNN00NNN030000100N0900000000078820000000000002024110400000000000085000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000191 NNN +496130 KR7496130006TRUSTON ڸƹƼ EF 000000000000NN 0NNN2NN N 0 Y 0000194800000100001NNN00NNN000000100N0900000000010500000000000002024110400000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000116 NNN +496770 KR7496770009PLUS ۷ι EF 000000000000NN 0NNN2NN N 0 Y 0000208000000100001NNN00NNN000000050Y0900000000939250000000000002024111200000000000315000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000655 NNN +497510 KR7497510008ACE ۷ιĸ EF 000000000000NN 0NNN2NN N 0 Y 0000125000000100001NNN00NNN030000100N0900000000046910000000000002024111900000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +497520 KR7497520007ACE ϶̸ü EF 000000000000NN 0NNN2NN N 0 Y 0000131050000100001NNN00NNN000000100N0900000000075370000000000002024111900000000000070000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000091 NNN +497570 KR7497570002TIGER ̱ʶǾAIݵü EF 000000000000NN 0NNN2NN N 0 Y 0000173350000100001NNN00NNN030000050Y0900000012454420000000000002024112600000000006095000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000010574 NNN +497780 KR7497780007KoAct ̱õƼ EF 000000000000NN 0NNN2NN N 0 Y 0000099600000100001NNN00NNN030000100N0900000000649590000000000002024121000000000000220000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000220 NNN +497880 KR7497880005SOL CDݸ&ӴϸϾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000500000000100001NNN00NNN030000100N0900000001422110000000000002024112600000000000292000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001464 NNN +498050 KR7498050004HANARO ̿ڸƾƼ EF 000000000000NN 0NNN2NN N 0 Y 0000177300000100001NNN00NNN000000100N0900000001345860000000000002024112600000000000115000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000203 NNN +498180 KR7498180009Ŀ ä(AA-̻)Ƽ EF 000000000000NN 0NNN2NN N 0 Y 0000966300000100001NNN00NNN000000100N0900000000002020000000000002024112600000000000117200000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000001132 NNN +498270 KR7498270008KIWOOM ̱ǻ EF 000000000000NN 0NNN2NN N 0 Y 0000135950000100001NNN00NNN030000050Y0900000004677170000000000002024121700000000001955000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000002661 NNN +498400 KR7498400001KODEX 200ŸŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000165050000100001NNN00NNN000000060Y0900000063833260000000000002024120300000000015400000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000025417 NNN +498410 KR7498410000KODEX TOP10ŸŬĿ EF 000000000000NN 0NNN2NN N 0 Y 0000122750000100001NNN00NNN030000060Y0900000022873000000000000002024121700000000005030000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000006252 NNN +498610 KR7498610005RISE εм EF 000000000000NN 0NNN2NN N 0 Y 0000094800000100001NNN00NNN000000100N0900000000028520000000000002025040100000000000060000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +498860 KR7498860006RISE ڸƱ EF 000000000000NN 0NNN2NN N 0 Y 0000168500000100001NNN00NNN000000100N0900000001028950000000000002024121000000000000195000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000328 NNN +499150 KR7499150001SOL ̱S&P500ȭ(H) EF 000000000000NN 0NNN2NN N 0 Y 0000108800000100001NNN00NNN030000100N0900000000031690000000000002024120300000000000080000000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +499660 KR7499660009TIGER CDݸ÷Ƽ(ռ) EF 000000000000NN 0NNN2NN N 0 Y 0010000050000100001NNN00NNN030000100N0900000000182900000000000002024121700000000000042900000000000000000000012 0 NNN00000000000000000000000000000000000000.00 000004301 NNN +499790 KR7499790004GSǾؿ ST2002100000000 N 0NNN NN N 0 N 0000443000000100001NNN00NNN000000060Y0900000001520400000000010002024122300000000001983000000000001983084100012 0 NNY00000328600000046700000035300271000000.0020250930000008785FN4NNY +950210 KR8702070002Ƽ̿ĸ DR 000000000000NN 0NNN NN N 0 N 0000116500000100001NNN00NNN000000100N0900000001594030000000000002021020500000000006009600000000000000000000006 0 NNN000000023-00000243-00000203-0202000004.1120250930000007001 NNN +J0036221DKRA0036221D6KGƼ 122WR SW 000000000000NN 0NNN NN N 0 N 0000008070000100000NNN00NNN000000100N09000000041379300000000000020231219000000000017892000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000144 NNN +J0113321FKRA0113321F5 41WR SW 000000000000NN 0NNN NN N 0 N 0000001680000100000NNN00NNN000000100N09000000001299900000000000020251121000000000022950000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000038 NNN +J0180021DKRA0180021D4Ͻ 15WR SW 000000000000NN 0NNN NN N 0 N 0000004480000100000NNN00NNN000000100N09000000002715900000000000020230627000000000013107000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000058 NNN +J0669721FKRA0669721F4ؿ 7WR SW 000000000000NN 0NNN NN N 0 N 0000867000000100000NNN00NNN000000100N09000000003894500000000000020250922000000000002086000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001808 NNN +J0671721GKRA0671721G8 13WR SW 000000000000NN 0NNN NN N 0 N 0000003410000100000NNN00NNN000000100N09000000013804400000000000020260126000000000008248000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000028 NNN +J0799501GKRA0799501G1κϾ 10R SR 000000000000NN 0NNN NN N 0 N 0000000000000100000NNN00NNN000000100N09000000000000000000000000020260119000000000007997000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000000 NNN +J1099621DKRA1099621D9ũ 6WR SW 000000000000NN 0NNN NN N 0 N 0000000270000100000NNN00NNN000000100N09000000008764800000000000020230808000000000017021000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000004 NNN +J1432121DKRA1432121D6۷̼ 2WR SW 000000000000NN 0NNN NN N 0 N 0000000890000100000NNN00NNN000000100N09000000004205000000000000020230629000000000004271000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000003 NNN +J2552221DKRA2552221D6SG 17WR SW 000000000000NN 0NNN NN N 0 N 0000016210000100000NNN00NNN000000100N09000000002680600000000000020230420000000000000999000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000016 NNN +J2901221DKRA2901221D4DH丮 9WR SW 000000000000NN 0NNN NN N 0 N 0000001960000100000NNN00NNN000000100N09000000002038100000000000020230621000000000003095000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000006 NNN +J3001201GKRA3001201G6 19R SR 000000000000NN 0NNN NN N 0 N 0000003800000100000NNN00NNN000000100N09000000268118200000000000020260128000000000014493000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000055 NNN +J3686001GKRA3686001G2̾ġ 5R SR 000000000000NN 0NNN NN N 0 N 0000000000000100000NNN00NNN000000100N09000000000000000000000000020260115000000000007996000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000000 NNN +Q500061 KRG500000614 ι ڽ 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000048500000100001NNN00NNN000000100N09000000000575600000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +Q500063 KRG500000630 ι ڽ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000049000000100001NNN00NNN000000100N09000000031607200000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000098 NNN +Q500067 KRG500000671 10 ä ETN EN 000000000000NN 0NNN3NN N 0 N 0000104050000100001NNN00NNN000000100N09000000000000200000000000020220613000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000072 NNN +Q500068 KRG500000689 ι 2X 10 ä ETN EN 000000000000NN 0NNN3NN N 0 N 0000110650000100001NNN00NNN000000100N09000000000000200000000000020220613000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000077 NNN +Q500069 KRG500000697 ڽ 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0001221550000100001NNN00NNN000000100N09000000002960200000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001221 NNN +Q500070 KRG500000705 ι 2X ڽ 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000022050000100001NNN00NNN000000100N09000000005443000000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000022 NNN +Q500071 KRG500000713 ڽ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000661200000100001NNN00NNN000000100N09000000003467300000000000020221017000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001653 NNN +Q500072 KRG500000721 ι 2X ڽ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018970000100001NNN00NNN000000100N09000000027476900000000000020221017000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000189 NNN +Q500077 KRG500000770 ι0.5X S&P500 VIX S/T ETN EN 000000000000NN 0NNN3NN N 0 N 0000371750000100001NNN00NNN000000100N09000000000004100000000000020230330000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002230 NNN +Q500078 KRG500000788 S&P ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000119200000100001NNN00NNN000000100N09000000000000000000000000020230602000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000119 NNN +Q500079 KRG500000796 S&P ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000104250000100001NNN00NNN000000100N09000000000040200000000000020230602000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000104 NNN +Q500080 KRG500000804 S&P ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000124400000100001NNN00NNN000000100N09000000000005300000000000020230602000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000124 NNN +Q500081 KRG500000812 S&P ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000094950000100001NNN00NNN000000100N09000000000011500000000000020230602000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +Q500082 KRG500000820 2X õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000042000000100001NNN00NNN000000100N09000000014187100000000000020230623000000000015000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000630 NNN +Q500085 KRG500000853 ڽ 200 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000235450000100001NNN00NNN000000100N09000000001033800000000000020231205000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000235 NNN +Q500086 KRG500000861 ڽ 150 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000157800000100001NNN00NNN000000100N09000000000511300000000000020231205000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +Q500087 KRG500000879 26-05 ä(AAA) ETN EN 000000000000NN 0NNN3NN N 0 N 0000106000000100001NNN00NNN000000100N09000000000000100000000000020240605000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000212 NNN +Q500088 KRG500000887 2X 26-05 ä(AAA) ETN EN 000000000000NN 0NNN3NN N 0 N 0000106300000100001NNN00NNN000000100N09000000000000000000000000020240605000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000212 NNN +Q500089 KRG500000895 26-05 ä(AAA) ETN EN 000000000000NN 0NNN3NN N 0 N 0000106000000100001NNN00NNN000000100N09000000000000000000000000020240605000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000212 NNN +Q500090 KRG500000903 2X 26-05 ä(AAA) ETN EN 000000000000NN 0NNN3NN N 0 N 0000106550000100001NNN00NNN000000100N09000000000000000000000000020240605000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000213 NNN +Q500091 KRG500000911 33-12 ä ÷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000105650000100001NNN00NNN000000100N09000000000000000000000000020240605000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000211 NNN +Q500093 KRG500000937 WTI ETN BEN 000000000000NN 0NNN3NN N 0 N 0000224050000100001NNN00NNN000000100N09000000000170600000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000224 NNN +Q500094 KRG500000945 ι2X WTI ETN BEN 000000000000NN 0NNN3NN N 0 N 0000133800000100001NNN00NNN000000100N09000000002340900000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +Q500095 KRG500000952 S&P500 VIX S/T ETN E EN 000000000000NN 0NNN3NN N 0 N 0000107450000100001NNN00NNN000000100N09000000000297900000000000020250619000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000644 NNN +Q500096 KRG500000960 ι2X õ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000129650000100001NNN00NNN000000100N09000000003772600000000000020250619000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000648 NNN +Q500097 KRG500000978 Russell 2000 ETN B EN 000000000000NN 0NNN3NN N 0 N 0000123700000100001NNN00NNN000000100N09000000000053900000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000123 NNN +Q500098 KRG500000986 ι 2X Russell 2000 ETN B EN 000000000000NN 0NNN3NN N 0 N 0000081750000100001NNN00NNN000000100N09000000000000000000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000081 NNN +Q500099 KRG500000994 WTI ETN EN 000000000000NN 0NNN3NN N 0 N 0000106850000100001NNN00NNN000000100N09000000000099400000000000020250916000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001068 NNN +Q500100 KRG500001000 ETN EN 000000000000NN 0NNN3NN N 0 N 0000147250000100001NNN00NNN000000100N09000000010377500000000000020250916000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +Q500035 KRG501500356 ̱޷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000160650000100001NNN00NNN000000100N09000000000056400000000000020180530000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000321 NNN +Q500036 KRG501500364 ι 2X ̱޷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000039150000100001NNN00NNN000000100N09000000000718800000000000020180530000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000078 NNN +Q500020 KRG502100206 ٿ ETN(H) EN 000000000000NNN0NNN3NNNNNNNNN0NNNNNNNN0000584400000100001NNN00NNN000000100N09000000000024200000000000020160706000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000584 NNN +Q500028 KRG502100289 ι 2X ٿ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000011330000100001NNN00NNN000000100N09000000003989700000000000020170807000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +Q500050 KRG502100503 S&P500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000465600000100001NNN00NNN000000100N09000000001014500000000000020190725000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000931 NNN +Q500051 KRG502100511 ι 2X S&P500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000014160000100001NNN00NNN000000100N09000000000282600000000000020190725000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000028 NNN +Q500018 KRG502400184 ETN(H) EN 000000000000NNN0NNN3NNNNNNNNN0NNNNNNNN0000263350000100001NNN00NNN000000100N09000000001563500000000000020160225000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000526 NNN +Q500019 KRG502400192 WTI ETN(H) EN 000000000000NNN0NNN3NNNNNNNNN0NNNNNNNN0000008530000100001NNN00NNN000000100N09000000170784800000000000020160225000000000500000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000004265 NNN +Q500023 KRG502400234 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000122300000100001NNN00NNN000000100N09000000000000000000000000020161027000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000244 NNN +Q500024 KRG502400242 ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000079250000100001NNN00NNN000000100N09000000000000000000000000020161027000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +Q500027 KRG502400275 ι 2X WTI ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000000610000100001NNN00NNN000000100N09000001656310500000000000020170807000000000633000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000386 NNN +Q500029 KRG502400291 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001034600000100001NNN00NNN000000100N09000000020181000000000000020170915000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000010346 NNN +Q500030 KRG502400309 ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000000410000100001NNN00NNN000000100N09000000341403700000000000020170915000000000034000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000013 NNN +Q500037 KRG502400374 ETN EN 000000000000NN 0NNN3NN N 0 N 0001159550000100001NNN00NNN000000100N09000000000686400000000000020180614000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002319 NNN +Q500038 KRG502400382 ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000008810000100001NNN00NNN000000100N09000000002055600000000000020180614000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000008 NNN +Q500040 KRG502400408 ETN EN 000000000000NN 0NNN3NN N 0 N 0000310450000100001NNN00NNN000000100N09000000002092500000000000020180920000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000310 NNN +Q500041 KRG502400416 ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000009970000100001NNN00NNN000000100N09000000000942500000000000020180920000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000049 NNN +Q510015 KRG510000158 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000051550000100001NNN00NNN000000100N09000000000156800000000000020210308000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q510016 KRG510000166 õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000043700000100001NNN00NNN000000100N09000000000893900000000000020210603000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000131 NNN +Q510027 KRG510000273 ι 2X ڽ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018890000100001NNN00NNN000000100N09000000004223000000000000020221017000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +Q510043 KRG510000430 ι õ ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000057800000100001NNN00NNN000000100N09000000009581300000000000020241031000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000057 NNN +Q520037 KRG520000370̷ ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000191750000100001NNN00NNN000000100N09000000000765200000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000383 NNN +Q520038 KRG520000388̷ ι ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000048650000100001NNN00NNN000000100N09000000003341400000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +Q520039 KRG520000396̷ ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000147350000100001NNN00NNN000000100N09000000001062600000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +Q520040 KRG520000404̷ ι ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000048950000100001NNN00NNN000000100N09000000010397000000000000020211021000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +Q520046 KRG520000461̷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000103200000100001NNN00NNN000000100N09000000000799200000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q520047 KRG520000479̷ ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000319850000100001NNN00NNN000000100N09000000000000000000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000319 NNN +Q520050 KRG520000503̷ ι 2X ȥ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000096650000100001NNN00NNN000000100N09000000011735300000000000020220427000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000241 NNN +Q520054 KRG520000545̷ ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0001216850000100001NNN00NNN000000100N09000000001553700000000000020221017000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002433 NNN +Q520055 KRG520000552̷ ι 2X ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000022100000100001NNN00NNN000000100N09000000100207100000000000020221017000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000221 NNN +Q520056 KRG520000560̷ ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000655550000100001NNN00NNN000000100N09000000002743300000000000020221017000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001311 NNN +Q520057 KRG520000578̷ ι 2X ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018790000100001NNN00NNN000000100N09000001709869000000000000020221017000000000015000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000281 NNN +Q520064 KRG520000644̷ 2X ̱äƮ30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000070950000100001NNN00NNN000000100N09000000000007500000000000020230705000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000141 NNN +Q520065 KRG520000651̷ -2X ̱äƮ30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000135650000100001NNN00NNN000000100N09000000000000000000000000020230705000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000271 NNN +Q520066 KRG520000669̷ KRX Auto-KO-C 2810-01 ETNEN 000000000000NN 0NNN4NN N 0 N 0000293550000100001NNN00NNN000000100N09000000002188800000000000020231026000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001761 NNN +Q520068 KRG520000685̷ 2X ȫH ETN EN 000000000000NN 0NNN3NN N 0 N 0000445300000100001NNN00NNN000000100N09000000000024000000000000020231115000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000445 NNN +Q520069 KRG520000693̷ -2X ȫH ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000054900000100001NNN00NNN000000100N09000000000010400000000000020231115000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000054 NNN +Q520072 KRG520000727̷ ̱ AI TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000159800000100001NNN00NNN000000100N09000000000044600000000000020240423000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000479 NNN +Q520073 KRG520000735̷ ̱ AI TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000395400000100001NNN00NNN000000100N09000000000092100000000000020240423000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000395 NNN +Q520074 KRG520000743̷ ̱ TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000167300000100001NNN00NNN000000100N09000000000064700000000000020240423000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000501 NNN +Q520075 KRG520000750̷ ̱ TOP3 ETNEN 000000000000NN 0NNN3NN N 0 N 0000472500000100001NNN00NNN000000100N09000000000013800000000000020240423000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000472 NNN +Q520076 KRG520000768̷ 1.5X õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000110250000100001NNN00NNN000000100N09000000006786000000000000020240530000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000275 NNN +Q520077 KRG520000776̷ -1.5X õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000112500000100001NNN00NNN000000100N09000000015811900000000000020240530000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000281 NNN +Q520078 KRG520000784̷ ̱ TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000122700000100001NNN00NNN000000100N09000000000015100000000000020240920000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000368 NNN +Q520079 KRG520000792̷ ̱ TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000250200000100001NNN00NNN000000100N09000000000026600000000000020240920000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000250 NNN +Q520080 KRG520000800̷ ̱ ũ&ݵü TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000186250000100001NNN00NNN000000100N09000000000062000000000000020240920000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000558 NNN +Q520081 KRG520000818̷ 2X ̱ ũ&ݵü TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000518950000100001NNN00NNN000000100N09000000000049400000000000020240920000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000518 NNN +Q520082 KRG520000826̷ ̱ ǥ ETN EN 000000000000NN 0NNN3NN N 0 N 0000135950000100001NNN00NNN000000100N09000000000003800000000000020241211000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000407 NNN +Q520083 KRG520000834̷ 2X ̱ ǥ ETN EN 000000000000NN 0NNN3NN N 0 N 0000303350000100001NNN00NNN000000100N09000000000000900000000000020241211000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000303 NNN +Q520084 KRG520000842̷ -2X ̱ ǥ ETN EN 000000000000NN 0NNN3NN N 0 N 0000082050000100001NNN00NNN000000100N09000000000065100000000000020241211000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000082 NNN +Q520085 KRG520000859̷ -2X ̱ AI TOP3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000111700000100001NNN00NNN000000100N09000000000082300000000000020241211000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000111 NNN +Q520086 KRG520000867̷-0.5X S&P500 VIX S/T ETN(H)BEN 000000000000NN 0NNN3NN N 0 N 0000212600000100001NNN00NNN000000100N09000000000077600000000000020250210000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000531 NNN +Q520087 KRG520000875̷ KRX ETN EN 000000000000NN 0NNN3NN N 0 N 0000585950000100001NNN00NNN000000100N09000000005713300000000000020250522000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001171 NNN +Q520088 KRG520000883̷ S&P500 VIX S/T ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000097950000100001NNN00NNN000000100N09000000002032600000000000020250522000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000195 NNN +Q520089 KRG520000891̷ CAPE Ƿ US Core Sector ETN EN 000000000000NN 0NNN3NN N 0 N 0000114000000100001NNN00NNN000000100N09000000000058400000000000020250709000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000570 NNN +Q520090 KRG520000909̷ õ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000104100000100001NNN00NNN000000100N09000000009729000000000000020250709000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000416 NNN +Q520091 KRG520000917̷ ι õ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000090200000100001NNN00NNN000000100N09000000023875100000000000020250709000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000360 NNN +Q520092 KRG520000925̷ ETN B EN 000000000000NN 0NNN3NN N 0 N 0001539750000100001NNN00NNN000000100N09000000006738600000000000020250828000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001539 NNN +Q520093 KRG520000933̷ ι 2X ETN B EN 000000000000NN 0NNN3NN N 0 N 0000014310000100001NNN00NNN000000100N09000000820919200000000000020250828000000000012000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000171 NNN +Q520094 KRG520000941̷ CDݸ ÷ ETN EN 000000000000NN 0NNN3NN N 0 N 0001005100000100001NNN00NNN000000100N09000000000012000000000000020251202000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002010 NNN +Q520009 KRG522100095̷ ȥ ETN(H) EN 000000000000NNN0NNN3NNNNNNNNN0NNNNNNNN0000067600000100001NNN00NNN000000100N09000000011183000000000000020160421000000000041000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002771 NNN +Q530083 KRG530000832Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000274950000100001NNN00NNN000000100N09000000001607900000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000274 NNN +Q530084 KRG530000840Z ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000042550000100001NNN00NNN000000100N09000000000075500000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000042 NNN +Q530089 KRG530000899Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000439500000100001NNN00NNN000000100N09000000002502200000000000020210913000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000439 NNN +Q530090 KRG530000907Z ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000018600000100001NNN00NNN000000100N09000000020376800000000000020210913000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000018 NNN +Q530092 KRG530000923Z ι ڽ 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000048150000100001NNN00NNN000000100N09000000003668700000000000020211021000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000048 NNN +Q530094 KRG530000949Z ι ڽ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000048850000100001NNN00NNN000000100N09000000002801600000000000020211021000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000048 NNN +Q530095 KRG530000956Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000138850000100001NNN00NNN000000100N09000000000362400000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000138 NNN +Q530096 KRG530000964Z ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000069300000100001NNN00NNN000000100N09000000000359800000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000069 NNN +Q530104 KRG530001046Z ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0001222450000100001NNN00NNN000000100N09000000001540900000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001222 NNN +Q530105 KRG530001053Z ι 2X ڽ200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000022200000100001NNN00NNN000000100N09000000208448100000000000020221017000000000015000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000333 NNN +Q530106 KRG530001061Z ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000653650000100001NNN00NNN000000100N09000000002567800000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000653 NNN +Q530107 KRG530001079Z ι 2X ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018700000100001NNN00NNN000000100N09000002975925600000000000020221017000000000040000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000748 NNN +Q530111 KRG530001111Z õ ETN C EN 000000000000NN 0NNN3NN N 0 N 0000031300000100001NNN00NNN000000100N09000000229399800000000000020230428000000000050000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001565 NNN +Q530112 KRG530001129Z S&P500 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000182200000100001NNN00NNN000000100N09000000000181500000000000020230628000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000182 NNN +Q530113 KRG530001137Z S&P500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000471200000100001NNN00NNN000000100N09000000000032500000000000020230628000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000471 NNN +Q530114 KRG530001145Z ι 2X S&P500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000100200000100001NNN00NNN000000100N09000000000123800000000000020230628000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +Q530115 KRG530001152Z 100 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000566800000100001NNN00NNN000000100N09000000000308100000000000020231108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000566 NNN +Q530116 KRG530001160Z ι 2X 100 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000061600000100001NNN00NNN000000100N09000000008373800000000000020231108000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000308 NNN +Q530117 KRG530001178Z ڽ 200 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000234250000100001NNN00NNN000000100N09000000008575100000000000020231219000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000234 NNN +Q530118 KRG530001186Z ڽ 150 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000153100000100001NNN00NNN000000100N09000000017243500000000000020231219000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000459 NNN +Q530119 KRG530001194Z ׼ũ TR ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000411100000100001NNN00NNN000000100N09000000000069200000000000020240326000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000411 NNN +Q530120 KRG530001202Z 100 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000144850000100001NNN00NNN000000100N09000000000129700000000000020240603000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000144 NNN +Q530121 KRG530001210Z ׼ũ TR ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000158850000100001NNN00NNN000000100N09000000000000000000000000020240625000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +Q530122 KRG530001228Z ι 2X ׼ũ TR ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000044950000100001NNN00NNN000000100N09000000002421300000000000020240625000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000044 NNN +Q530123 KRG530001236Z Ϻ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000139550000100001NNN00NNN000000100N09000000001000400000000000020240910000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000139 NNN +Q530124 KRG530001244Z Ϻ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000362900000100001NNN00NNN000000100N09000000005042200000000000020240910000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000362 NNN +Q530125 KRG530001251Z ι 2X Ϻ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000080050000100001NNN00NNN000000100N09000000000463300000000000020240910000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000080 NNN +Q530126 KRG530001269Z ڸ TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000229500000100001NNN00NNN000000100N09000000000395300000000000020241104000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000459 NNN +Q530127 KRG530001277Z ̱ٿ TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000113850000100001NNN00NNN000000100N09000000000000200000000000020241224000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +Q530128 KRG530001285Z ̱ٿ ETN EN 000000000000NN 0NNN3NN N 0 N 0000231400000100001NNN00NNN000000100N09000000000002800000000000020241224000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000231 NNN +Q530129 KRG530001293Z ι 2X ̱ٿ ETN EN 000000000000NN 0NNN3NN N 0 N 0000161550000100001NNN00NNN000000100N09000000000236700000000000020241224000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000161 NNN +Q530130 KRG530001301Z S&P500 VIX S/T ETN B EN 000000000000NN 0NNN3NN N 0 N 0000112000000100001NNN00NNN000000100N09000000005251500000000000020250210000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000336 NNN +Q530131 KRG530001319Z ι0.5X S&P500 VIX S/T ETN BEN 000000000000NN 0NNN3NN N 0 N 0000205800000100001NNN00NNN000000100N09000000000042500000000000020250210000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000617 NNN +Q530132 KRG530001327Z WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000110200000100001NNN00NNN000000100N09000000000248100000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000110 NNN +Q530133 KRG530001335Z WTI ETN BEN 000000000000NN 0NNN3NN N 0 N 0000223800000100001NNN00NNN000000100N09000000007859700000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000223 NNN +Q530134 KRG530001343Z ι2X WTI ETN BEN 000000000000NN 0NNN3NN N 0 N 0000133800000100001NNN00NNN000000100N09000000016977100000000000020250417000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000535 NNN +Q530135 KRG530001350Z ι China A50 ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000087000000100001NNN00NNN000000100N09000000000065600000000000020250509000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +Q530136 KRG530001368Z ι 2X õ ETN D EN 000000000000NN 0NNN3NN N 0 N 0000117050000100001NNN00NNN000000100N09000000104698400000000000020250509000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001170 NNN +Q530137 KRG530001376Z KRX 2 TOP10 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000135200000100001NNN00NNN000000100N09000000000057200000000000020250721000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000135 NNN +Q530138 KRG530001384Z KRX 2 TOP10 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000329900000100001NNN00NNN000000100N09000000001260900000000000020250721000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000329 NNN +Q530139 KRG530001392Z iSelect TOP10 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000158100000100001NNN00NNN000000100N09000000000040700000000000020250721000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000158 NNN +Q530140 KRG530001400Z iSelect TOP10 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000453800000100001NNN00NNN000000100N09000000000421700000000000020250721000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000453 NNN +Q530141 KRG530001418Z ߱ ڵ TOP5 TR ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000092750000100001NNN00NNN000000100N09000000000013600000000000020250909000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000092 NNN +Q530142 KRG530001426Z ߱ AI ũ TOP5 TR ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000101200000100001NNN00NNN000000100N09000000000420600000000000020250909000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +Q530067 KRG531400676Z KRX ETN EN 000000000000NN 0NNN3NN N 0 N 0000430400000100001NNN00NNN000000100N09000000002460300000000000020191105000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000860 NNN +Q530060 KRG531800602Z ڽ ŵ 5% OTM ETN EN 000000000000NN 0NNN3NN N 0 N 0000066150000100001NNN00NNN000000100N09000000000511200000000000020181107000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000066 NNN +Q530031 KRG532400311Z WTI ETN EN 000000000000NN 0NNN3NN N 0 N 0000012850000100001NNN00NNN000000100N09000000285817300000000000020170703000000000404000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000005191 NNN +Q530036 KRG532400360Z ι 2X WTI ETN EN 000000000000NN 0NNN3NN N 0 N 0000000760000100001NNN00NNN000000100N09000010433408000000000000020170920000000001497000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001137 NNN +Q530055 KRG532400550Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001743000000100001NNN00NNN000000100N09000000000973400000000000020180614000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001743 NNN +Q530056 KRG532400568Z ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000013330000100001NNN00NNN000000100N09000000010581200000000000020180614000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000053 NNN +Q530061 KRG532400618Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001724650000100001NNN00NNN000000100N09000000006638200000000000020181113000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000005173 NNN +Q530062 KRG532400626Z ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000000290000100001NNN00NNN000000100N09000001251084700000000000020181113000000000100000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000029 NNN +Q530063 KRG532400634Z ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000232400000100001NNN00NNN000000100N09000000003925800000000000020181113000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000232 NNN +Q530064 KRG532400642Z ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000008470000100001NNN00NNN000000100N09000000010334200000000000020181113000000000015000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +Q530023 KRG536100230Z China A50 ETN(H) EN 000000000000NNN0NNN3NNNNNNNNN0NNNNNNNN0000445650000100001NNN00NNN000000100N09000000000000100000000000020160316000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000445 NNN +Q550062 KRG550000621N2 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001159850000100001NNN00NNN000000100N09000000000105900000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001159 NNN +Q550063 KRG550000639N2 ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000027850000100001NNN00NNN000000100N09000000000042500000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000027 NNN +Q550064 KRG550000647N2 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0002028100000100001NNN00NNN000000100N09000000000766200000000000020210913000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002028 NNN +Q550069 KRG550000696N2 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000233350000100001NNN00NNN000000100N09000000000053600000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000233 NNN +Q550070 KRG550000704N2 ι ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000060750000100001NNN00NNN000000100N09000000000816900000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000060 NNN +Q550082 KRG550000829N2 KIS CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0000548200000100001NNN00NNN000000100N09000000000000000000000000020230406000000000014000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000007674 NNN +Q550084 KRG550000845N2 ڽ 200 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000229350000100001NNN00NNN000000100N09000000000402000000000000020231227000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000458 NNN +Q550085 KRG550000852N2 ڽ 150 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000145300000100001NNN00NNN000000100N09000000000114800000000000020231227000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000290 NNN +Q550087 KRG550000878N2 1 ETN EN 000000000000NN 0NNN3NN N 0 N 0000120350000100001NNN00NNN000000100N09000000000000000000000000020240430000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000240 NNN +Q550088 KRG550000886N2 1 ETN EN 000000000000NN 0NNN3NN N 0 N 0000253900000100001NNN00NNN000000100N09000000002000000000000000020240430000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000253 NNN +Q550089 KRG550000894N2 ڽ 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000799550000100001NNN00NNN000000100N09000000000005000000000000020240430000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000799 NNN +Q550091 KRG550000910N2 Top5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000399450000100001NNN00NNN000000100N09000000000013400000000000020240801000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000798 NNN +Q550092 KRG550000928N2 Top5 ETN EN 000000000000NN 0NNN3NN N 0 N 0001782050000100001NNN00NNN000000100N09000000000035800000000000020240801000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001782 NNN +Q550093 KRG550000936N2 Top5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000310100000100001NNN00NNN000000100N09000000000084200000000000020240801000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000620 NNN +Q550095 KRG550000951N2 ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000186650000100001NNN00NNN000000100N09000000000000000000000000020241031000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000093 NNN +Q550096 KRG550000969N2 ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000166450000100001NNN00NNN000000100N09000000000000000000000000020241031000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000083 NNN +Q550097 KRG550000977N2 ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000475650000100001NNN00NNN000000100N09000000003949400000000000020250619000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000475 NNN +Q550098 KRG550000985N2 ι 2X ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000068200000100001NNN00NNN000000100N09000000002093900000000000020250619000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000068 NNN +Q550099 KRG550000993N2 õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000245550000100001NNN00NNN000000100N09000000003742400000000000020250926000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000245 NNN +Q550100 KRG550001009N2 ι 2X õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000091000000100001NNN00NNN000000100N09000000004193700000000000020250926000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000091 NNN +Q550041 KRG552100411N2 ̱ IT TOP5 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000527800000100001NNN00NNN000000100N09000000000001300000000000020170731000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000369 NNN +Q550043 KRG552400431N2 ι WTI ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000000560000100001NNN00NNN000000100N09000000275095200000000000020170830000000000150000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000084 NNN +Q570047 KRG570000478 FTSE100 ETN EN 000000000000NN 0NNN3NN N 0 N 0000272550000100001NNN00NNN000000100N09000000000000600000000000020200522000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000272 NNN +Q570050 KRG570000502 S&P500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000252200000100001NNN00NNN000000100N09000000000000200000000000020200821000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001261 NNN +Q570051 KRG570000510 100 ETN EN 000000000000NN 0NNN3NN N 0 N 0000280250000100001NNN00NNN000000100N09000000000100500000000000020200821000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001401 NNN +Q570052 KRG570000528 ÷Ƽ ETN EN 000000000000NN 0NNN3NN N 0 N 0000255350000100001NNN00NNN000000100N09000000000775400000000000020210225000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000255 NNN +Q570053 KRG570000536 ι ÷Ƽ ETN EN 000000000000NN 0NNN3NN N 0 N 0000043050000100001NNN00NNN000000100N09000000000035800000000000020210225000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000043 NNN +Q570054 KRG570000544 νŹ50 ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000245300000100001NNN00NNN000000100N09000000000006200000000000020210322000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000245 NNN +Q570055 KRG570000551 ETN EN 000000000000NN 0NNN3NN N 0 N 0000340800000100001NNN00NNN000000100N09000000000551400000000000020210524000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000340 NNN +Q570056 KRG570000569 ι ETN EN 000000000000NN 0NNN3NN N 0 N 0000054050000100001NNN00NNN000000100N09000000000055800000000000020210524000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000054 NNN +Q570057 KRG570000577 ETN EN 000000000000NN 0NNN3NN N 0 N 0000501150000100001NNN00NNN000000100N09000000003842000000000000020210524000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000501 NNN +Q570058 KRG570000585 ι ETN EN 000000000000NN 0NNN3NN N 0 N 0000024650000100001NNN00NNN000000100N09000000005447400000000000020210524000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000024 NNN +Q570059 KRG570000593 ETN EN 000000000000NN 0NNN3NN N 0 N 0001441750000100001NNN00NNN000000100N09000000000661700000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001441 NNN +Q570060 KRG570000601 ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000034650000100001NNN00NNN000000100N09000000000456900000000000020210805000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000034 NNN +Q570061 KRG570000619 ETN EN 000000000000NN 0NNN3NN N 0 N 0002506550000100001NNN00NNN000000100N09000000001022800000000000020210913000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002506 NNN +Q570063 KRG570000635 Ʈ VN30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000153650000100001NNN00NNN000000100N09000000000051400000000000020211001000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000153 NNN +Q570064 KRG570000643 ι Ʈ VN30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000060900000100001NNN00NNN000000100N09000000000000400000000000020211001000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000060 NNN +Q570065 KRG570000650 Ʈ VN30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000355900000100001NNN00NNN000000100N09000000000290200000000000020211001000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000355 NNN +Q570066 KRG570000668 ι 2X Ʈ VN30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000053950000100001NNN00NNN000000100N09000000000216800000000000020211001000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000053 NNN +Q570069 KRG570000692 ÷Ƽ ETN EN 000000000000NN 0NNN3NN N 0 N 0000911400000100001NNN00NNN000000100N09000000000729700000000000020220411000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000911 NNN +Q570070 KRG570000700 ι 2X ÷Ƽ ETN EN 000000000000NN 0NNN3NN N 0 N 0000011630000100001NNN00NNN000000100N09000000006529200000000000020220411000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000011 NNN +Q570071 KRG570000718 ETN EN 000000000000NN 0NNN3NN N 0 N 0000167600000100001NNN00NNN000000100N09000000000157800000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000167 NNN +Q570072 KRG570000726 ETN EN 000000000000NN 0NNN3NN N 0 N 0000282150000100001NNN00NNN000000100N09000000000088000000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000282 NNN +Q570073 KRG570000734 ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000073200000100001NNN00NNN000000100N09000000000000600000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000073 NNN +Q570074 KRG570000742 S&P źҹ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000128500000100001NNN00NNN000000100N09000000000000100000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000128 NNN +Q570081 KRG570000817 ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000663750000100001NNN00NNN000000100N09000000000118500000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000663 NNN +Q570082 KRG570000825 ι 2X ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000019020000100001NNN00NNN000000100N09000000464675400000000000020221017000000000020000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000380 NNN +Q570085 KRG570000858 ε׽þ ǥ ETN EN 000000000000NN 0NNN3NN N 0 N 0000146600000100001NNN00NNN000000100N09000000000416700000000000020221128000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000146 NNN +Q570090 KRG570000908 KIS CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0000548200000100001NNN00NNN000000100N09000000000000100000000000020230406000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000003289 NNN +Q570091 KRG570000916 ι νŹ50 ETN(H) C EN 000000000000NN 0NNN3NN N 0 N 0000067400000100001NNN00NNN000000100N09000000000000000000000000020230321000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +Q570092 KRG570000924 ι 2X νŹ50 ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000079300000100001NNN00NNN000000100N09000000000018500000000000020230321000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000079 NNN +Q570093 KRG570000932 õ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000042200000100001NNN00NNN000000100N09000000052990200000000000020230621000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000422 NNN +Q570094 KRG570000940 Ϻ ETN C EN 000000000000NN 0NNN3NN N 0 N 0000094550000100001NNN00NNN000000100N09000000000001000000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +Q570095 KRG570000957 Ϻ ETN C EN 000000000000NN 0NNN3NN N 0 N 0000079700000100001NNN00NNN000000100N09000000000182700000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000079 NNN +Q570096 KRG570000965 ι 2X Ϻ ETN EN 000000000000NN 0NNN3NN N 0 N 0000105300000100001NNN00NNN000000100N09000000000000200000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000105 NNN +Q570097 KRG570000973 S&P ޷ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000083000000100001NNN00NNN000000100N09000000000062500000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000083 NNN +Q570098 KRG570000981 S&P ޷ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000067100000100001NNN00NNN000000100N09000000003520900000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000067 NNN +Q570099 KRG570000999 S&P ι 2X ޷ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000134500000100001NNN00NNN000000100N09000000000025100000000000020230810000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +Q570100 KRG570001005 ϺջTOP5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000212400000100001NNN00NNN000000100N09000000002281100000000000020240104000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000212 NNN +Q570101 KRG570001013 ι 100 ETN B EN 000000000000NN 0NNN3NN N 0 N 0000080400000100001NNN00NNN000000100N09000000000033500000000000020240628000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000080 NNN +Q570102 KRG570001021 100 ETN B EN 000000000000NN 0NNN3NN N 0 N 0000153600000100001NNN00NNN000000100N09000000001476300000000000020240628000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000307 NNN +Q570103 KRG570001039 ι2X 100 ETN B EN 000000000000NN 0NNN3NN N 0 N 0000054450000100001NNN00NNN000000100N09000000005193700000000000020240628000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000544 NNN +Q570104 KRG570001047 Ϻ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000140000000100001NNN00NNN000000100N09000000000000400000000000020240806000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000420 NNN +Q570105 KRG570001054 ιϺ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000063100000100001NNN00NNN000000100N09000000000026200000000000020240806000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000189 NNN +Q570106 KRG570001062 Ϻ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000347750000100001NNN00NNN000000100N09000000000010100000000000020240806000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000869 NNN +Q570107 KRG570001070 ι2XϺ225 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000070800000100001NNN00NNN000000100N09000000000339100000000000020240806000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000177 NNN +Q570108 KRG570001088 ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000161700000100001NNN00NNN000000100N09000000000000600000000000020241008000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000080 NNN +Q570109 KRG570001096 ̱ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000175200000100001NNN00NNN000000100N09000000000000000000000000020241008000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +Q570110 KRG570001104 3Xä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000317600000100001NNN00NNN000000100N09000000000000400000000000020241224000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000063 NNN +Q570111 KRG570001112 3X̱ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000437850000100001NNN00NNN000000100N09000000000003300000000000020241224000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +Q570114 KRG570001146 S&P500 VIX S/T ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000116700000100001NNN00NNN000000100N09000000000223400000000000020250307000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000116 NNN +Q570115 KRG570001153 ι0.5X S&P500 VIX S/T ETN BEN 000000000000NN 0NNN3NN N 0 N 0000210550000100001NNN00NNN000000100N09000000000084000000000000020250307000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +Q570116 KRG570001161 ׷WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000224750000100001NNN00NNN000000100N09000000000483100000000000020250417000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000449 NNN +Q570117 KRG570001179 ι2XWTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000134600000100001NNN00NNN000000100N09000000003035700000000000020250417000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000269 NNN +Q570118 KRG570001187 ι2Xõ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000085100000100001NNN00NNN000000100N09000000018287600000000000020250904000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000340 NNN +Q570019 KRG571100194 ڽ ŵ 5% OTM ETN EN 000000000000NN 0NNN3NN N 0 N 0000068100000100001NNN00NNN000000100N09000000000280500000000000020170529000000000015000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001021 NNN +Q570029 KRG571100293 ڽ ŵ 3% OTM ETN EN 000000000000NN 0NNN3NN N 0 N 0000061700000100001NNN00NNN000000100N09000000000000000000000000020180828000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000308 NNN +Q570022 KRG572100227 S&P500 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000500150000100001NNN00NNN000000100N09000000000001400000000000020171103000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002500 NNN +Q570023 KRG572100235 ι 2X S&P500 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000007960000100001NNN00NNN000000100N09000000000344400000000000020171103000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000039 NNN +Q580016 KRG580000161KB S&P 500 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000227950000100001NNN00NNN000000100N09000000000047200000000000020210422000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000911 NNN +Q580017 KRG580000179KB ι 2X S&P 500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000043000000100001NNN00NNN000000100N09000000000064000000000000020210422000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000043 NNN +Q580019 KRG580000195KB ι 2X ׼ũ ETN EN 000000000000NN 0NNN3NN N 0 N 0000029000000100001NNN00NNN000000100N09000000001735200000000000020210602000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000087 NNN +Q580020 KRG580000203KB õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000044400000100001NNN00NNN000000100N09000000007996500000000000020210603000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000444 NNN +Q580021 KRG580000211KB ι õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000102400000100001NNN00NNN000000100N09000000010960800000000000020210603000000000004500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000460 NNN +Q580022 KRG580000229KB ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001165800000100001NNN00NNN000000100N09000000001296000000000000020210805000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000582 NNN +Q580023 KRG580000237KB ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000028000000100001NNN00NNN000000100N09000000001760900000000000020210805000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000014 NNN +Q580026 KRG580000260KB ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0002040100000100001NNN00NNN000000100N09000000002319200000000000020210913000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001020 NNN +Q580032 KRG580000328KB ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000234200000100001NNN00NNN000000100N09000000002740100000000000020211109000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000117 NNN +Q580033 KRG580000336KB ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000061350000100001NNN00NNN000000100N09000000001178300000000000020211109000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000030 NNN +Q580034 KRG580000344KB FANG ÷ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000773600000100001NNN00NNN000000100N09000000000001000000000000020220419000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000386 NNN +Q580035 KRG580000351KB S&P źҹ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000095700000100001NNN00NNN000000100N09000000000000000000000000020220407000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +Q580039 KRG580000393KB KOSPI 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0001209750000100001NNN00NNN000000100N09000000000169200000000000020221017000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000604 NNN +Q580040 KRG580000401KB ι 2X KOSPI 200 ETN EN 000000000000NN 0NNN3NN N 0 N 0000022050000100001NNN00NNN000000100N09000000041968700000000000020221017000000000001500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000033 NNN +Q580043 KRG580000435KB KOSDAQ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000656450000100001NNN00NNN000000100N09000000000789800000000000020221017000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000328 NNN +Q580044 KRG580000443KB ι 2X KOSDAQ 150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018850000100001NNN00NNN000000100N09000000173406700000000000020221017000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000056 NNN +Q580047 KRG580000476KB ׼ũ ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000213450000100001NNN00NNN000000100N09000000000046400000000000020221215000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000213 NNN +Q580048 KRG580000484KB ̳ CSI 300 ETN EN 000000000000NN 0NNN3NN N 0 N 0000131950000100001NNN00NNN000000100N09000000000000100000000000020230425000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000263 NNN +Q580049 KRG580000492KB ̳ CSI 500 ETN EN 000000000000NN 0NNN3NN N 0 N 0000150050000100001NNN00NNN000000100N09000000000000200000000000020230425000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000300 NNN +Q580050 KRG580000500KB ̳ â STAR 50 ETN EN 000000000000NN 0NNN3NN N 0 N 0000148700000100001NNN00NNN000000100N09000000000000200000000000020230425000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000148 NNN +Q580051 KRG580000518KB ETN EN 000000000000NN 0NNN3NN N 0 N 0000061250000100001NNN00NNN000000100N09000000001283600000000000020230707000000000001500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000091 NNN +Q580052 KRG580000526KB ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000456200000100001NNN00NNN000000100N09000000000000200000000000020230707000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000228 NNN +Q580053 KRG580000534KB ETN EN 000000000000NN 0NNN3NN N 0 N 0000137350000100001NNN00NNN000000100N09000000000048300000000000020230707000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000068 NNN +Q580054 KRG580000542KB ι 2X ETN EN 000000000000NN 0NNN3NN N 0 N 0000307600000100001NNN00NNN000000100N09000000000000000000000000020230707000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000153 NNN +Q580055 KRG580000559KB õ ETN EN 000000000000NN 0NNN3NN N 0 N 0000036250000100001NNN00NNN000000100N09000000040167700000000000020230623000000000004500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000163 NNN +Q580056 KRG580000567KB Ϻ κƽ TOP 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000234100000100001NNN00NNN000000100N09000000000174700000000000020231215000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000468 NNN +Q580057 KRG580000575KB Ϻ TOP 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000129000000100001NNN00NNN000000100N09000000000008900000000000020231215000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000258 NNN +Q580058 KRG580000583KB KIS CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0000529150000100001NNN00NNN000000100N09000000000000000000000000020240320000000000013000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000006878 NNN +Q580059 KRG580000591KB ̱ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000111100000100001NNN00NNN000000100N09000000000011200000000000020240702000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000111 NNN +Q580060 KRG580000609KB ̱ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000218200000100001NNN00NNN000000100N09000000000000300000000000020240702000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000109 NNN +Q580061 KRG580000617KB ̱ä 30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000101850000100001NNN00NNN000000100N09000000000001000000000000020240702000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +Q580062 KRG580000625KB ̱ä 30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000181850000100001NNN00NNN000000100N09000000000002700000000000020240702000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000090 NNN +Q580063 KRG580000633KB ̱ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000206150000100001NNN00NNN000000100N09000000000000000000000000020240702000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q580064 KRG580000641KB ι 2X ̱ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000201250000100001NNN00NNN000000100N09000000000000000000000000020240702000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000100 NNN +Q580065 KRG580000658KB ڽ 150 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000155850000100001NNN00NNN000000100N09000000022186700000000000020241022000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000155 NNN +Q580066 KRG580000666KB ε Select 5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000103400000100001NNN00NNN000000100N09000000000003000000000000020250411000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000206 NNN +Q580067 KRG580000674KB ε Select 5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000103750000100001NNN00NNN000000100N09000000000005300000000000020250411000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000207 NNN +Q580068 KRG580000682KB S&P WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000224950000100001NNN00NNN000000100N09000000004547100000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000224 NNN +Q580069 KRG580000690KB S&P ι 2X WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000134600000100001NNN00NNN000000100N09000000011903700000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +Q580070 KRG580000708KB 2 TOP 10 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000331250000100001NNN00NNN000000100N09000000000245100000000000020250721000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000331 NNN +Q580071 KRG580000716KB ι 2X õ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000085000000100001NNN00NNN000000100N09000000036402600000000000020250904000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000170 NNN +Q580072 KRG580000724KB ȭ ü ETN EN 000000000000NN 0NNN3NN N 0 N 0000123400000100001NNN00NNN000000100N09000000000037500000000000020251027000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000246 NNN +Q580073 KRG580000732KB ȭ ü ETN EN 000000000000NN 0NNN3NN N 0 N 0000288650000100001NNN00NNN000000100N09000000000000400000000000020251027000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000288 NNN +Q580074 KRG580000740KB BYD ü ETN EN 000000000000NN 0NNN3NN N 0 N 0000106700000100001NNN00NNN000000100N09000000000000600000000000020251201000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000213 NNN +Q580075 KRG580000757KB BYD ü ETN EN 000000000000NN 0NNN3NN N 0 N 0000226100000100001NNN00NNN000000100N09000000000062400000000000020251201000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000226 NNN +Q580076 KRG580000765KB ̱ 100 TR ETN B EN 000000000000NN 0NNN3NN N 0 N 0000221900000100001NNN00NNN000000100N09000000000169600000000000020251201000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000443 NNN +Q580077 KRG580000773KB ι 2X ̱ 100 TR ETN B EN 000000000000NN 0NNN3NN N 0 N 0000166350000100001NNN00NNN000000100N09000000000229700000000000020251201000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000499 NNN +Q580010 KRG581100101KB Wise ҸŸ ETN EN 000000000000NN 0NNN3NN N 0 N 0000121350000100001NNN00NNN000000100N09000000000001200000000000020190927000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000728 NNN +Q610001 KRG610000017޸ ÷̼ ä ETN EN 000000000000NN 0NNN3NN N 0 N 0000121000000100001NNN00NNN000000100N09000000000000300000000000020210617000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000242 NNN +Q610003 KRG610000033޸ ̱ ÷̼ ä ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000092300000100001NNN00NNN000000100N09000000000000000000000000020210617000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000184 NNN +Q610007 KRG610000074޸ ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000081800000100001NNN00NNN000000100N09000000000013700000000000020210909000000000005000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000409 NNN +Q610008 KRG610000082޸ ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000054550000100001NNN00NNN000000100N09000000000435300000000000020210909000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000218 NNN +Q610009 KRG610000090޸ ι ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000133750000100001NNN00NNN000000100N09000000000000000000000000020210909000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +Q610012 KRG610000124޸ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001157950000100001NNN00NNN000000100N09000000000685200000000000020210909000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001157 NNN +Q610013 KRG610000132޸ ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000028600000100001NNN00NNN000000100N09000000000367700000000000020210909000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000028 NNN +Q610016 KRG610000165޸ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0002054900000100001NNN00NNN000000100N09000000000451700000000000020210913000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002054 NNN +Q610018 KRG610000181޸ ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000103650000100001NNN00NNN000000100N09000000000000000000000000020211108000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000207 NNN +Q610020 KRG610000207޸ ι ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000113050000100001NNN00NNN000000100N09000000000000000000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +Q610022 KRG610000223޸ ̱ä10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000085750000100001NNN00NNN000000100N09000000000148000000000000020211108000000000003000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000257 NNN +Q610023 KRG610000231޸ ̱ä10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000063050000100001NNN00NNN000000100N09000000000035400000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000063 NNN +Q610024 KRG610000249޸ ι ̱ä10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000131150000100001NNN00NNN000000100N09000000000002000000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000131 NNN +Q610025 KRG610000256޸ ι 2X ̱ä10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000151950000100001NNN00NNN000000100N09000000000000000000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000151 NNN +Q610028 KRG610000280޸ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000233800000100001NNN00NNN000000100N09000000000820300000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000233 NNN +Q610029 KRG610000298޸ ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000061550000100001NNN00NNN000000100N09000000000209700000000000020211109000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000061 NNN +Q610030 KRG610000306޸ S&P źҹ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000127700000100001NNN00NNN000000100N09000000000000000000000000020211108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000127 NNN +Q610034 KRG610000348޸ ǥ 깰 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000081250000100001NNN00NNN000000100N09000000000000100000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000081 NNN +Q610035 KRG610000355޸ ǥ 깰 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000095850000100001NNN00NNN000000100N09000000000221800000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +Q610036 KRG610000363޸ ι 2X ǥ 깰 ETN(H)EN 000000000000NN 0NNN3NN N 0 N 0000280750000100001NNN00NNN000000100N09000000000000200000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000280 NNN +Q610037 KRG610000371޸ ̱ä30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000075750000100001NNN00NNN000000100N09000000000075400000000000020220613000000000014000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001060 NNN +Q610038 KRG610000389޸ ̱ä30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000046650000100001NNN00NNN000000100N09000000007444100000000000020220613000000000010000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000466 NNN +Q610039 KRG610000397޸ ι ̱ä30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000139400000100001NNN00NNN000000100N09000000000000100000000000020220613000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000139 NNN +Q610040 KRG610000405޸ ι 2X ̱ä30 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000162500000100001NNN00NNN000000100N09000000000026800000000000020220613000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000162 NNN +Q610045 KRG610000454޸ ä3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000113350000100001NNN00NNN000000100N09000000000000000000000000020221031000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +Q610047 KRG610000470޸ ι ä3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000105200000100001NNN00NNN000000100N09000000000000000000000000020221031000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000210 NNN +Q610049 KRG610000496޸ ä5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000115400000100001NNN00NNN000000100N09000000000000000000000000020221031000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000115 NNN +Q610051 KRG610000512޸ ι ä5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000103100000100001NNN00NNN000000100N09000000000000000000000000020221031000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q610055 KRG610000553޸ 3X ä3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000221700000100001NNN00NNN000000100N09000000000000100000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000110 NNN +Q610056 KRG610000561޸ ι 3X ä3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000198800000100001NNN00NNN000000100N09000000000000000000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000099 NNN +Q610057 KRG610000579޸ 3X ä5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000217950000100001NNN00NNN000000100N09000000000000000000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000108 NNN +Q610058 KRG610000587޸ ι 3X ä5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000199050000100001NNN00NNN000000100N09000000000000000000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000099 NNN +Q610059 KRG610000595޸ 3X ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000202150000100001NNN00NNN000000100N09000000000000100000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +Q610060 KRG610000603޸ ι 3X ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000194250000100001NNN00NNN000000100N09000000000000000000000000020221221000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000097 NNN +Q610061 KRG610000611޸ 3X ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000448600000100001NNN00NNN000000100N09000000000458400000000000020221221000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000897 NNN +Q610062 KRG610000629޸ ι 3X ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000399250000100001NNN00NNN000000100N09000000000000000000000000020221221000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000079 NNN +Q610063 KRG610000637޸ KIS CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0000548150000100001NNN00NNN000000100N09000000091214900000000000020230406000000000023850000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000013073 NNN +Q610064 KRG610000645޸ KAP ä 6 ETN EN 000000000000NN 0NNN3NN N 0 N 0000542950000100001NNN00NNN000000100N09000000000000000000000000020230517000000000000600000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000325 NNN +Q610066 KRG610000660޸ KAP ä 3 ETN EN 000000000000NN 0NNN3NN N 0 N 0000543000000100001NNN00NNN000000100N09000000000000000000000000020230517000000000001200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000651 NNN +Q610067 KRG610000678޸ 2X õ ETN(H) BEN 000000000000NN 0NNN3NN N 0 N 0000032900000100001NNN00NNN000000100N09000000017159100000000000020230623000000000003500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000115 NNN +Q610068 KRG610000686޸ KAP Ϻ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000104050000100001NNN00NNN000000100N09000000000060700000000000020231020000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000104 NNN +Q610069 KRG610000694޸ KAP Ϻ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000196150000100001NNN00NNN000000100N09000000003060600000000000020231020000000000001500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000294 NNN +Q610070 KRG610000702޸ KAP ι 2X Ϻ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000207950000100001NNN00NNN000000100N09000000000496200000000000020231020000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q610071 KRG610000710޸ KAP ߱ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000121000000100001NNN00NNN000000100N09000000000007800000000000020231020000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000121 NNN +Q610072 KRG610000728޸ KAP ߱ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000269450000100001NNN00NNN000000100N09000000000003400000000000020231020000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000134 NNN +Q610073 KRG610000736޸ KAP ι 2X ߱ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000159150000100001NNN00NNN000000100N09000000000023200000000000020231020000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000079 NNN +Q610074 KRG610000744޸ ̱ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000115650000100001NNN00NNN000000100N09000000000005900000000000020240425000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000115 NNN +Q610075 KRG610000751޸ 3X ̱ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000576150000100001NNN00NNN000000100N09000000000062800000000000020240425000000000000600000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000345 NNN +Q610076 KRG610000769޸ ι 3X ̱ä10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000464600000100001NNN00NNN000000100N09000000000010400000000000020240425000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000092 NNN +Q610077 KRG610000777޸ ̱ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000108900000100001NNN00NNN000000100N09000000000000000000000000020240425000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000108 NNN +Q610078 KRG610000785޸ 3X ̱ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000456050000100001NNN00NNN000000100N09000000001997900000000000020240425000000000001200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000547 NNN +Q610079 KRG610000793޸ ι 3X ̱ä30 ETN EN 000000000000NN 0NNN3NN N 0 N 0000474100000100001NNN00NNN000000100N09000000000005300000000000020240425000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +Q610080 KRG610000801޸ ߽ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000133150000100001NNN00NNN000000100N09000000000000200000000000020240814000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +Q610081 KRG610000819޸ ߽ ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000328050000100001NNN00NNN000000100N09000000000000000000000000020240814000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000164 NNN +Q610082 KRG610000827޸ ε ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000103650000100001NNN00NNN000000100N09000000000003800000000000020240814000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q610083 KRG610000835޸ ε ȭ ETN EN 000000000000NN 0NNN3NN N 0 N 0000203450000100001NNN00NNN000000100N09000000000000200000000000020240814000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000101 NNN +Q610084 KRG610000843޸ ̱ä30 Ʈ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000094400000100001NNN00NNN000000100N09000000000050000000000000020250227000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +Q610085 KRG610000850޸ ̱ä30 Ʈ ETN(H)EN 000000000000NN 0NNN3NN N 0 N 0000403650000100001NNN00NNN000000100N09000000000526400000000000020250227000000000000600000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000242 NNN +Q610086 KRG610000868޸ ι2X ̱ä30 Ʈ ETN(H)EN 000000000000NN 0NNN3NN N 0 N 0000513300000100001NNN00NNN000000100N09000000000002400000000000020250227000000000000200000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000102 NNN +Q610087 KRG610000876޸ ַƼ WTI ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000110250000100001NNN00NNN000000100N09000000000001800000000000020250507000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000110 NNN +Q610088 KRG610000884޸ ַƼ 2X WTI ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000222000000100001NNN00NNN000000100N09000000000435500000000000020250507000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000222 NNN +Q610089 KRG610000892޸ ַƼ -2X WTI ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000141650000100001NNN00NNN000000100N09000000000619100000000000020250507000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000141 NNN +Q610090 KRG610000900޸ Ϻ ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000095350000100001NNN00NNN000000100N09000000000001200000000000020250730000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +Q610091 KRG610000918޸ 3X Ϻ ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000173600000100001NNN00NNN000000100N09000000000038100000000000020250730000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000086 NNN +Q610092 KRG610000926޸ ι Ϻ ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000103600000100001NNN00NNN000000100N09000000000003400000000000020250730000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000103 NNN +Q610093 KRG610000934޸ ι 3X Ϻ ä 10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000224300000100001NNN00NNN000000100N09000000000026900000000000020250730000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000112 NNN +Q610094 KRG610000942޸ õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000113550000100001NNN00NNN000000100N09000000001016300000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000113 NNN +Q610095 KRG610000959޸ 2X õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000221250000100001NNN00NNN000000100N09000000004476800000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000221 NNN +Q610096 KRG610000967޸ -2X õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000094750000100001NNN00NNN000000100N09000000016638900000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000094 NNN +Q700011 KRG700000117ϳ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000085150000100001NNN00NNN000000100N09000000000024600000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000085 NNN +Q700012 KRG700000125ϳ ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000264700000100001NNN00NNN000000100N09000000000000800000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000264 NNN +Q700013 KRG700000133ϳ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000200900000100001NNN00NNN000000100N09000000000011200000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000200 NNN +Q700014 KRG700000141ϳ ι 2X ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000137800000100001NNN00NNN000000100N09000000000000100000000000020211216000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000137 NNN +Q700017 KRG700000174ϳ ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000925450000100001NNN00NNN000000100N09000000000408000000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000925 NNN +Q700018 KRG700000182ϳ ι 2X ڽ150 ETN EN 000000000000NN 0NNN3NN N 0 N 0000018990000100001NNN00NNN000000100N09000000040652400000000000020221017000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000018 NNN +Q700022 KRG700000224ϳ Solactive US Tech Top 10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000300000000100001NNN00NNN000000100N09000000000000000000000000020221222000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000600 NNN +Q700023 KRG700000232ϳ Solactive 2X US Tech Top 10 ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0001344750000100001NNN00NNN000000100N09000000000000000000000000020221222000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001344 NNN +Q700025 KRG700000257ϳ 2X õ ETN(H) B EN 000000000000NN 0NNN3NN N 0 N 0000034800000100001NNN00NNN000000100N09000000007048300000000000020230623000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000069 NNN +Q700026 KRG700000265ϳ CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0001058450000100001NNN00NNN000000100N09000000000000000000000000020240320000000000012000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000012701 NNN +Q700027 KRG700000273ϳ ݵü ETN EN 000000000000NN 0NNN3NN N 0 N 0000263500000100001NNN00NNN000000100N09000000001178700000000000020250312000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000263 NNN +Q700028 KRG700000281ϳ ݵü ETN EN 000000000000NN 0NNN3NN N 0 N 0001200050000100001NNN00NNN000000100N09000000014618800000000000020250312000000000002500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000003000 NNN +Q700029 KRG700000299ϳ S&P WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000225850000100001NNN00NNN000000100N09000000000009900000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000225 NNN +Q700030 KRG700000307ϳ S&P ι 2X WTI ETN B EN 000000000000NN 0NNN3NN N 0 N 0000133350000100001NNN00NNN000000100N09000000000128700000000000020250417000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +Q700031 KRG700000315ϳ õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000220100000100001NNN00NNN000000100N09000000002793500000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000220 NNN +Q700032 KRG700000323ϳ ι 2X õ ETN(H) EN 000000000000NN 0NNN3NN N 0 N 0000095300000100001NNN00NNN000000100N09000000001155200000000000020250916000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000095 NNN +Q700033 KRG700000331ϳ KTOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000116400000100001NNN00NNN000000100N09000000000002600000000000020250926000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000116 NNN +Q700034 KRG700000349ϳ KTOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000255400000100001NNN00NNN000000100N09000000000611200000000000020250926000000000001500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000383 NNN +Q700035 KRG700000356ϳ ι 2X KTOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000118250000100001NNN00NNN000000100N09000000004561500000000000020250926000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000118 NNN +Q760004 KRG760000049Ű ι ̱޷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000094350000100001NNN00NNN000000100N09000000000000200000000000020221213000000000002700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000254 NNN +Q760005 KRG760000056Ű INDXX ̱ũž10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000337550000100001NNN00NNN000000100N09000000000001000000000000020221222000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000337 NNN +Q760006 KRG760000064Ű KPOP ETN EN 000000000000NN 0NNN3NN N 0 N 0000124700000100001NNN00NNN000000100N09000000000084000000000000020231018000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000124 NNN +Q760007 KRG760000072Ű ڽ 200 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000230900000100001NNN00NNN000000100N09000000000729800000000000020231227000000000004000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000923 NNN +Q760008 KRG760000080Ű ڽ 150 TR ETN EN 000000000000NN 0NNN3NN N 0 N 0000147700000100001NNN00NNN000000100N09000000000721300000000000020231227000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000295 NNN +Q760009 KRG760000098Ű CDݸ ETN EN 000000000000NN 0NNN3NN N 0 N 0001055300000100001NNN00NNN000000100N09000000001502000000000000020240419000000000009220000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000009729 NNN +Q760010 KRG760000106Ű 2 ETN EN 000000000000NN 0NNN3NN N 0 N 0000109600000100001NNN00NNN000000100N09000000007970000000000000020240808000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000076 NNN +Q760011 KRG760000114Ű 2 ETN EN 000000000000NN 0NNN3NN N 0 N 0000173100000100001NNN00NNN000000100N09000000010416500000000000020240808000000000012000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000002077 NNN +Q760012 KRG760000122Ű ݵüTOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000225250000100001NNN00NNN000000100N09000000000066000000000000020240808000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000157 NNN +Q760013 KRG760000130Ű ݵüTOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000768300000100001NNN00NNN000000100N09000000004209400000000000020240808000000000004500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000003457 NNN +Q760014 KRG760000148Ű ̿TOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000126000000100001NNN00NNN000000100N09000000001623300000000000020241108000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000088 NNN +Q760015 KRG760000155Ű ̿TOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000267300000100001NNN00NNN000000100N09000000008249800000000000020241108000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000133 NNN +Q760016 KRG760000163Ű TOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0001373850000100001NNN00NNN000000100N09000000000309700000000000020241108000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000001373 NNN +Q760017 KRG760000171Ű TOP10 ETN EN 000000000000NN 0NNN3NN N 0 N 0000296350000100001NNN00NNN000000100N09000000000003500000000000020241108000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000207 NNN +Q760018 KRG760000189Ű ̱޷ ETN B EN 000000000000NN 0NNN3NN N 0 N 0000102050000100001NNN00NNN000000100N09000000000003900000000000020250411000000000006000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000612 NNN +Q760019 KRG760000197Ű ε ETN EN 000000000000NN 0NNN3NN N 0 N 0000112050000100001NNN00NNN000000100N09000000000000300000000000020250509000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000112 NNN +Q760020 KRG760000205Ű ε ETN EN 000000000000NN 0NNN3NN N 0 N 0000245450000100001NNN00NNN000000100N09000000000000300000000000020250509000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000122 NNN +Q760021 KRG760000213Ű ڽ200 ޷ ETN EN 000000000000NN 0NNN3NN N 0 N 0000194850000100001NNN00NNN000000100N09000000000000300000000000020250703000000000000700000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000136 NNN +Q760022 KRG760000221Ű K TOP5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000128950000100001NNN00NNN000000100N09000000000292200000000000020251027000000000002000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000257 NNN +Q760023 KRG760000239Ű K TOP5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000313200000100001NNN00NNN000000100N09000000000587800000000000020251027000000000001000000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000313 NNN +Q760024 KRG760000247Ű ι 2X K TOP5 ETN EN 000000000000NN 0NNN3NN N 0 N 0000100700000100001NNN00NNN000000100N09000000000794300000000000020251027000000000000500000000000000000000000 0 NNN00000000000000000000000000000000000000.00 000000050 NNN +900140 KYG5307W1015̿Ȧ FS 000000000000NNN0NNN NNNNNNNNN0NNNNNNNN0000015390000100001NNN00NNN000000060Y0900000008561020000000000002010113000000000019324000000000000004831010812 0 NNN00000286200000019900000011800107000003.5520250930000002973 NNN diff --git a/backend/trader.py b/backend/trader.py new file mode 100644 index 0000000..261be6d --- /dev/null +++ b/backend/trader.py @@ -0,0 +1,214 @@ +import time +import threading +import logging +from sqlalchemy.orm import Session +from database import SessionLocal, TradeSetting, Order, Stock, AccountBalance, Holding +import datetime +from kis_api import kis +from telegram_notifier import notifier + + +logger = logging.getLogger("TRADER") + +class TradingBot: + def __init__(self): + self.is_running = False + self.thread = None + self.holdings = {} # Local cache for holdings: {code: {qty: int, price: float}} + + self.last_chart_update = 0 + + def refresh_assets(self): + """ + Fetch Balance and Holdings from KIS and save to DB + """ + logger.info("Syncing Assets to Database...") + db = SessionLocal() + try: + # 1. Domestic Balance + balance = kis.get_balance(source="Automated_Sync") + if balance and 'output2' in balance and balance['output2']: + summary = balance['output2'][0] + # Upsert AccountBalance + fn_status = db.query(AccountBalance).first() + if not fn_status: + fn_status = AccountBalance() + db.add(fn_status) + + fn_status.total_eval = float(summary['tot_evlu_amt']) + fn_status.deposit = float(summary['dnca_tot_amt']) + fn_status.total_profit = float(summary['evlu_pfls_smtl_amt']) + fn_status.updated_at = datetime.datetime.now() + + # 2. Holdings (Domestic) + # Clear existing DOMESTIC + db.query(Holding).filter(Holding.market == 'DOMESTIC').delete() + + if balance and 'output1' in balance: + self.holdings = {} # Keep memory cache for trading logic + for item in balance['output1']: + code = item['pdno'] + qty = int(item['hldg_qty']) + if qty > 0: + buy_price = float(item['pchs_avg_pric']) + current_price = float(item['prpr']) + profit_rate = float(item['evlu_pfls_rt']) + + # Save to DB + db.add(Holding( + code=code, + name=item['prdt_name'], + quantity=qty, + price=buy_price, + current_price=current_price, + profit_rate=profit_rate, + market="DOMESTIC" + )) + + # Memory Cache for Trade Logic + self.holdings[code] = {'qty': qty, 'price': buy_price} + + # 3. Overseas Balance (NASD default) + # TODO: Multi-market support if needed + overseas = kis.get_overseas_balance(exchange="NASD") + + # Clear existing NASD + db.query(Holding).filter(Holding.market == 'NASD').delete() + + if overseas and 'output1' in overseas: + for item in overseas['output1']: + qty = float(item['ovrs_cblc_qty']) # Overseas can be fractional? KIS is usually int but check. + if qty > 0: + code = item['ovrs_pdno'] + # name = item.get('ovrs_item_name') or item.get('prdt_name') + # KIS overseas output keys vary. + + db.add(Holding( + code=code, + name=item.get('ovrs_item_name', code), + quantity=int(qty), + price=float(item.get('frcr_pchs_amt1', 0)), # Avg Price? Check API + current_price=float(item.get('now_pric2', 0)), + profit_rate=float(item.get('evlu_pfls_rt', 0)), + market="NASD" + )) + + db.commit() + logger.info("Assets Synced Successfully.") + + except Exception as e: + logger.error(f"Failed to sync assets: {e}") + db.rollback() + finally: + db.close() + + def start(self): + if self.is_running: + return + self.is_running = True + self.refresh_assets() # Fetch on start + self.thread = threading.Thread(target=self._run_loop, daemon=True) + self.thread.start() + logger.info("Trading Bot Started") + + def stop(self): + self.is_running = False + if self.thread: + self.thread.join() + logger.info("Trading Bot Stopped") + + def _run_loop(self): + while self.is_running: + try: + self._process_cycle() + except Exception as e: + logger.error(f"Error in trading loop: {e}") + + # Sleep 1 second to avoid hammering + time.sleep(1) + + def _process_cycle(self): + db = SessionLocal() + try: + # Get active trade settings + settings = db.query(TradeSetting).filter(TradeSetting.is_active == True).all() + + for setting in settings: + self._check_and_trade(db, setting) + + finally: + db.close() + + def _check_and_trade(self, db: Session, setting: TradeSetting): + code = setting.code + + # Get Current Price + # Optimization: Ideally read from a shared cache from WebSocket + # For now, we still poll price or should use WS logic? + # User said "Websocket... automatic decision". + # But trader.py is isolated. + # For simplicity in this step (removing balance poll), we keep price fetch but remove balance poll. + price_data = kis.get_current_price(code) + if not price_data: + return + + current_price = float(price_data.get('stck_prpr', 0)) + if current_price == 0: + return + + # Check holdings from Cache + if code not in self.holdings: + return # No holdings, nothing to sell (if logic is Sell) + + holding = self.holdings[code] + holding_qty = holding['qty'] + + # SELL Logic + if holding_qty > 0: + # Stop Loss + if setting.stop_loss_price and current_price <= setting.stop_loss_price: + logger.info(f"Stop Loss Triggered for {code}. Price: {current_price}, SL: {setting.stop_loss_price}") + self._place_order(db, code, 'sell', holding_qty, 0) # 0 means Market Price + return + + # Target Profit + if setting.target_price and current_price >= setting.target_price: + logger.info(f"Target Price Triggered for {code}. Price: {current_price}, TP: {setting.target_price}") + self._place_order(db, code, 'sell', holding_qty, 0) + return + + def _place_order(self, db: Session, code: str, type: str, qty: int, price: int): + logger.info(f"Placing Order: {code} {type} {qty} @ {price}") + res = kis.place_order(code, type, qty, price) + + status = "FAILED" + order_id = "" + if res and res.get('rt_cd') == '0': + status = "PENDING" + order_id = res.get('output', {}).get('ODNO', '') + logger.info(f"Order Success: {order_id}") + notifier.send_message(f"🔔 주문 전송 완료\n[{type.upper()}] {code}\n수량: {qty}\n가격: {price if price > 0 else '시장가'}") + + # Optimistic Update or Refresh? + # User said "If execution happens, update list". + # We should schedule a refresh. + time.sleep(1) # Wait for execution + self.refresh_assets() + + else: + logger.error(f"Order Failed: {res}") + notifier.send_message(f"⚠️ 주문 실패\n[{type.upper()}] {code}\n이유: {res}") + + # Record to DB + new_order = Order( + code=code, + order_id=order_id, + type=type.upper(), + price=price, + quantity=qty, + status=status + ) + db.add(new_order) + db.commit() + +trader = TradingBot() diff --git a/backend/websocket_manager.py b/backend/websocket_manager.py new file mode 100644 index 0000000..a129884 --- /dev/null +++ b/backend/websocket_manager.py @@ -0,0 +1,182 @@ + +import asyncio +import websockets +import json +import logging +import datetime +from typing import List, Set +from database import SessionLocal, Stock, StockPrice +from kis_api import kis + +logger = logging.getLogger("WEBSOCKET") + +class KisWebSocketManager: + def __init__(self): + self.active_frontend_connections: List[any] = [] + self.subscribed_codes: Set[str] = set() + self.running = False + self.approval_key = None + self.msg_queue = asyncio.Queue() # For outgoing subscription requests + + # KIS Environment + if kis.is_paper: + self.url = "ws://ops.koreainvestment.com:31000" + else: + self.url = "ws://ops.koreainvestment.com:21000" + + # ... (connect/disconnect/broadcast remains same) + + # ... (connect/disconnect/broadcast remains same) + + # ... (_handle_realtime_data remains same) + + async def subscribe_stock(self, code): + if code in self.subscribed_codes: + return + self.subscribed_codes.add(code) + await self.msg_queue.put(code) + logger.info(f"Queued Subscription for {code}") + + async def connect_frontend(self, websocket): + await websocket.accept() + self.active_frontend_connections.append(websocket) + logger.info(f"Frontend Client Connected. Total: {len(self.active_frontend_connections)}") + + def disconnect_frontend(self, websocket): + if websocket in self.active_frontend_connections: + self.active_frontend_connections.remove(websocket) + logger.info("Frontend Client Disconnected") + + async def broadcast_to_frontend(self, message: dict): + # Broadcast to all connected frontend clients + for connection in self.active_frontend_connections: + try: + await connection.send_json(message) + except Exception as e: + logger.error(f"Broadcast error: {e}") + self.disconnect_frontend(connection) + + async def start_kis_socket(self): + self.running = True + logger.info(f"Starting KIS WebSocket Service... Target: {self.url}") + + while self.running: + # 1. Ensure Approval Key + if not self.approval_key: + self.approval_key = kis.get_websocket_key() + if not self.approval_key: + logger.error("Failed to get WebSocket Approval Key. Retrying in 10s...") + await asyncio.sleep(10) + continue + logger.info(f"Got WS Key: {self.approval_key[:10]}...") + + # 2. Connect + try: + # KIS doesn't use standard ping frames often, handle manually or disable auto-ping + async with websockets.connect(self.url, ping_interval=None, open_timeout=20) as ws: + logger.info("Connected to KIS WebSocket Server") + + # Process initial subscriptions + for code in self.subscribed_codes: + await self._send_subscription(ws, code) + + while self.running: + try: + # 1. Check for incoming data + msg = await asyncio.wait_for(ws.recv(), timeout=0.1) + + # PING/PONG (String starting with 0 or 1 usually means data) + if msg[0] in ['0', '1']: + await self._handle_realtime_data(msg) + else: + # JSON Message (System, PINGPONG) + try: + data = json.loads(msg) + if data.get('header', {}).get('tr_id') == 'PINGPONG': + await ws.send(msg) # Echo back + continue + except: + pass + + except asyncio.TimeoutError: + pass + + except websockets.ConnectionClosed: + logger.warning("KIS WS Closed. Reconnecting...") + break + + except Exception as e: + logger.error(f"WS Connection Error: {e}") + # If auth failed (maybe expired key?), clear key to force refresh + # simplified check: if "Approval key" error in exception message? + # For now just retry. + await asyncio.sleep(5) + + async def _handle_realtime_data(self, msg: str): + # Format: 0|TR_ID|DATA_CNT|Code^Time^Price... + try: + parts = msg.split('|') + if len(parts) < 4: return + + tr_id = parts[1] + data_part = parts[3] + + if tr_id == "H0STCNT0": # Domestic Stock Price + # Data format: Code^Time^CurrentPrice^Sign^Change... + # Actually, data_part is delimiter separated. + values = data_part.split('^') + code = values[0] + price = values[2] + change = values[4] + rate = values[5] + + # Broadcast + payload = { + "type": "PRICE", + "code": code, + "price": price, + "change": change, + "rate": rate, + "timestamp": datetime.datetime.now().isoformat() + } + await self.broadcast_to_frontend(payload) + + # Update DB (Optional? Too frequent writes maybe bad) + # Let's save only significant updates or throttle? + # For now just log/broadcast. + + except Exception as e: + logger.error(f"Data Parse Error: {e} | Msg: {msg[:50]}") + + async def subscribe_stock(self, code): + if code in self.subscribed_codes: + return + self.subscribed_codes.add(code) + # If socket is active, send subscription (Implementation complexity: need access to active 'ws' object) + # Will handle by restarting connection or using a queue? + # Better: just set it in set, and the main loop will pick it up on reconnect, + # BUT for immediate sub, we need a way to signal the running loop. + # For MVP, let's assume we subscribe on startup or bulk. + # Real-time dynamic sub needs a queue. + logger.info(f"Subscribed to {code} (Pending next reconnect/sweep)") + + async def _send_subscription(self, ws, code): + # Domestic Stock Realtime Price: H0STCNT0 + body = { + "header": { + "approval_key": self.approval_key, + "custtype": "P", + "tr_type": "1", # 1: Register, 2: Unregister + "content-type": "utf-8" + }, + "body": { + "input": { + "tr_id": "H0STCNT0", + "tr_key": code + } + } + } + await ws.send(json.dumps(body)) + logger.info(f"Sent Subscription Request for {code}") + +ws_manager = KisWebSocketManager() diff --git a/frontend/css/style.css b/frontend/css/style.css new file mode 100644 index 0000000..76155e3 --- /dev/null +++ b/frontend/css/style.css @@ -0,0 +1,228 @@ +:root { + --bg-color: #0f172a; + --card-bg: rgba(30, 41, 59, 0.7); + --card-border: 1px solid rgba(255, 255, 255, 0.1); + --text-primary: #f8fafc; + --text-secondary: #94a3b8; + --accent-color: #3b82f6; + --accent-glow: 0 0 20px rgba(59, 130, 246, 0.5); + --success-color: #10b981; + --danger-color: #ef4444; + --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; + font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; +} + +body { + background-color: var(--bg-color); + background-image: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 20%), + radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 20%); + color: var(--text-primary); + min-height: 100vh; + display: flex; + flex-direction: column; +} + +/* Navigation */ +nav { + display: flex; + justify-content: space-between; + align-items: center; + padding: 1rem 2rem; + background: rgba(15, 23, 42, 0.8); + backdrop-filter: blur(10px); + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + position: sticky; + top: 0; + z-index: 100; +} + +.logo { + font-size: 1.5rem; + font-weight: 700; + background: linear-gradient(45deg, #3b82f6, #10b981); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +.nav-links { + display: flex; + gap: 1.5rem; +} + +.nav-links a { + color: var(--text-secondary); + text-decoration: none; + font-weight: 500; + transition: color 0.3s; +} + +.nav-links a:hover, .nav-links a.active { + color: var(--text-primary); + text-shadow: 0 0 10px rgba(255,255,255,0.3); +} + +/* Layout */ +.container { + padding: 2rem; + max-width: 1200px; + margin: 0 auto; + width: 100%; + flex: 1; +} + +/* Cards */ +.card { + background: var(--card-bg); + border: var(--card-border); + border-radius: 16px; + padding: 1.5rem; + margin-bottom: 1.5rem; + box-shadow: var(--glass-shadow); + backdrop-filter: blur(4px); + -webkit-backdrop-filter: blur(4px); + transition: transform 0.2s; +} + +.card:hover { + transform: translateY(-2px); +} + +.card h2 { + margin-bottom: 1rem; + font-size: 1.25rem; + color: var(--text-primary); + border-bottom: 1px solid rgba(255,255,255,0.05); + padding-bottom: 0.5rem; +} + +/* Grid */ +.grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 1.5rem; +} + +/* Table */ +table { + width: 100%; + border-collapse: collapse; + margin-top: 1rem; +} + +th, td { + padding: 1rem; + text-align: left; + border-bottom: 1px solid rgba(255,255,255,0.05); +} + +th { + color: var(--text-secondary); + font-weight: 600; + font-size: 0.9rem; +} + +td { + color: var(--text-primary); +} + +/* Buttons */ +.btn { + padding: 0.75rem 1.5rem; + border-radius: 8px; + border: none; + cursor: pointer; + font-weight: 600; + transition: all 0.3s; +} + +.btn-primary { + background: linear-gradient(135deg, #3b82f6, #2563eb); + color: white; + box-shadow: var(--accent-glow); +} + +.btn-primary:hover { + filter: brightness(1.1); +} + +.btn-danger { + background: linear-gradient(135deg, #ef4444, #dc2626); + color: white; +} + +.btn-success { + background: linear-gradient(135deg, #10b981, #059669); + color: white; +} + +/* Form */ +.form-group { + margin-bottom: 1.5rem; +} + +label { + display: block; + margin-bottom: 0.5rem; + color: var(--text-secondary); +} + +input, select, textarea { + width: 100%; + padding: 0.8rem; + border-radius: 8px; + background: rgba(15, 23, 42, 0.5); + border: 1px solid rgba(255,255,255,0.1); + color: white; + font-size: 1rem; +} + +input:focus { + outline: none; + border-color: var(--accent-color); + box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); +} + +/* Utilities */ +.text-success { color: var(--success-color); } +.text-danger { color: var(--danger-color); } +.text-muted { color: var(--text-secondary); } + +/* Badge */ +.badge { + padding: 0.25rem 0.75rem; + border-radius: 20px; + font-size: 0.8rem; + font-weight: 600; +} +.badge-success { background: rgba(16, 185, 129, 0.2); color: #10b981; } +.badge-secondary { background: rgba(148, 163, 184, 0.2); color: #94a3b8; } + +/* Mobile */ +@media (max-width: 768px) { + .grid { grid-template-columns: 1fr; } + .nav-links { gap: 1rem; font-size: 0.9rem; } +} + +/* Loading */ +.loading { + display: inline-block; + width: 20px; + height: 20px; + border: 3px solid rgba(255,255,255,.3); + border-radius: 50%; + border-top-color: #fff; + animation: spin 1s ease-in-out infinite; + -webkit-animation: spin 1s ease-in-out infinite; +} +@keyframes spin { + to { transform: rotate(360deg); } +} +@-webkit-keyframes spin { + to { -webkit-transform: rotate(360deg); } +} diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..9a2094c --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,446 @@ + + + + + + KisStock AI Dashboard + + + + + +
+ +
+

💰 나의 자산

+
+
+
+
총 평가금액
+
Loading...
+
+
+
예수금
+
Loading...
+
+
+
손익
+
Loading...
+
+
+
+
+ +
+ +
+
+

⭐ 관심 종목

+ 종목 추가 +
+
+ Loading... +
+
+ + +
+
+

📊 보유 종목

+
+ + + +
+
+ +
+ + + + + + + + + + + + +
종목명잔고현재가손익률
+
+
+
+ + +
+

📝 최근 주문 내역

+
+ + + + + + + + + + + + +
시간종목구분가격수량상태
+
+
+ +
+ + + + diff --git a/frontend/news.html b/frontend/news.html new file mode 100644 index 0000000..fe87a8b --- /dev/null +++ b/frontend/news.html @@ -0,0 +1,66 @@ + + + + + + AI 뉴스 - KisStock AI + + + + + +
+
+

📰 실시간 AI 뉴스 분석

+
+ Loading... +
+
+
+ + + + diff --git a/frontend/settings.html b/frontend/settings.html new file mode 100644 index 0000000..d6ad5fa --- /dev/null +++ b/frontend/settings.html @@ -0,0 +1,188 @@ + + + + + + 설정 - KisStock AI + + + + + +
+
+

⚙️ 시스템 설정

+
+ +
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+ +
+ +
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+ +
+ +
+ +
+
+ + +
+
+ + +
+ + +
+ +
+
+
+ +
+

🤖 자동매매 설정 (DB)

+
+

종목별 자동매매 감시 조건은 매매 페이지에서 설정할 수 있습니다.

+
+
+
+ + + + diff --git a/frontend/stocks.html b/frontend/stocks.html new file mode 100644 index 0000000..c82bd06 --- /dev/null +++ b/frontend/stocks.html @@ -0,0 +1,180 @@ + + + + + + 종목 정보 - KisStock AI + + + + + +
+
+
+

📦 전체 종목 DB

+
+ +
+
+ +
+ + + +
+ +
+ + + + + + + + + + +
시장코드종목명관리
+
+ +
+
+ + + + diff --git a/frontend/trade.html b/frontend/trade.html new file mode 100644 index 0000000..5a4ab8f --- /dev/null +++ b/frontend/trade.html @@ -0,0 +1,377 @@ + + + + + + 매매 - KisStock AI + + + + + + +
+ +
+
+ + + +
+ + +
+

⚡ 간편 매매

+
+
+ + + + +
+ +
+ +

🤖 자동매매 감시

+
+ + +
+
+ + +
+
+ +
+ + +
+
+ + + + + + +
+ + +
+
+
+
+ + +
+

♻ 미체결/취소 가능 주문

+ +
+ + + + + + + + + + + + +
주문번호종목구분수량/잔량가격관리
+
+
+ + +
+

📜 금일 체결 내역

+ +
+ + + + + + + + + + + + +
시간주문번호종목구분체결수량체결단가
+
+
+
+
+ + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9f18ef9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +fastapi +uvicorn +sqlalchemy +requests +pandas +pyyaml +jinja2 +python-multipart +websockets +python-telegram-bot +watchfiles +google-generativeai diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..44efee1 --- /dev/null +++ b/run.bat @@ -0,0 +1,26 @@ +@echo off +chcp 65001 > nul +cd /d "%~dp0" + +echo ======================================================== +echo KisStock AI 주식 자동매매 시스템을 시작합니다. +echo ======================================================== + +:: Check Python +python --version > nul 2>&1 +if %errorlevel% neq 0 ( + echo [ERROR] Python이 설치되어 있지 않거나 PATH에 설정되지 않았습니다. + pause + exit /b +) + +echo. +echo [INFO] 브라우저를 실행합니다... +:: Start browser after 2 seconds (waiting for server to start) +start /b "" cmd /c "timeout /t 2 > nul & start http://localhost:8000" + +echo [INFO] 서버를 시작합니다... (종료하려면 Ctrl+C를 누르세요) +echo. +python backend/main.py + +pause diff --git a/test_migration.py b/test_migration.py new file mode 100644 index 0000000..7c6dff5 --- /dev/null +++ b/test_migration.py @@ -0,0 +1,48 @@ +from backend.database import init_db, SessionLocal, AccountBalance, Holding, engine +from backend.trader import trader +import logging + +logging.basicConfig(level=logging.INFO) + +def test_db_migration(): + print("Initializing DB...") + init_db() + + # Check tables + from sqlalchemy import inspect + inspector = inspect(engine) + tables = inspector.get_table_names() + print(f"Tables: {tables}") + + if "account_balance" in tables and "holdings" in tables: + print("PASS: New tables created.") + else: + print("FAIL: Tables missing.") + +def test_sync(): + print("Testing Asset Sync (Mocking KIS)...") + # Note: KIS API might fail if credentials are invalid or market is closed/paper env issues. + # We will try running it and catch errors. + try: + trader.refresh_assets() + print("Sync function executed.") + + db = SessionLocal() + acc = db.query(AccountBalance).first() + holdings = db.query(Holding).all() + + if acc: + print(f"Account Balance: Eval={acc.total_eval}, Deposit={acc.deposit}") + else: + print("Account Balance: None (Sync might have failed or empty)") + + print(f"Holdings Count: {len(holdings)}") + db.close() + + except Exception as e: + print(f"Sync Logic Error: {e}") + +if __name__ == "__main__": + test_db_migration() + # test_sync() # Skip actual sync test to avoid making real API calls during verification step unless user wants. + # Actually user wants "Proceed", so let's try to verify DB schema at least. diff --git a/목표.md b/목표.md new file mode 100644 index 0000000..e86624b --- /dev/null +++ b/목표.md @@ -0,0 +1,14 @@ +한국투자증권 api 소스파일을 넣어뒀어 그거 참고해서.. +백엔드와 프론트를 만들어줘, 주식 자동매매 사이트이고.. 프론트말고 백엔드만으로도 주식 매매는 진행되어야하고. 프론트는 셋팅을 하는 그런용도야. +api 키와 비밀키는 셋팅파일을 읽어서 처리해주고. 셋팅만들어주면 내가 키입력을 할게. +관심종목도 등록할 수 있어야하고,, 당연히 계좌정보 조회 및 현재 체결 미체결 재고모두 보이고. +매도, 매수기능 있어야하고 +종목클릭해서 호가 및 차트 정보도 나와야해. (물론 그 화면에서 매도 매수 가능해야지) +매도예약기능도 있어야하고, 특정 조건에 맞으면 매도가 되는거지.. TS 매도,, +매수예약기능도 마찬가지야. TS조건포함해서. +모바일에서 잘 표시되도록 해주고. +업종목록을 보는것도 있어야하고, 업종에 대한 health 체크도 해야하니. 업종을 분석한 결과를 저장할 수도 있어야해. 업종 분석은 ai를 사용할건데. 구글 api를 기본 연결해서 진행하게 해줘. +뉴스도 가져와서 업종별로 보여주고, 뉴스에 대한 분석도 ai를 사용해서 보여주면 좋겠어.(뉴스는 네이버 API를 제공해줄게) +뉴스는 기본 10분간격으로 최신 뉴스를 가져오고, 최신 뉴스에서 주식과 관련이 있는지를 우선 빠르게 판단하고 그 이후에 추가분석을 해서 관련 업종 및 테마를 분류해서 영향력을 계산해야. 뉴스 분석 등은 별도의 쓰레드에서 해야해 +데이터베이슨은 SQLLITE 를 사용하고 다중접속에 덜 취약한 셋팅을 해줘. +업종에는 해당 업종의 health 정보도 저장되어있어야하고 어떤테마에 속해있는지도 저장되어있어야해. diff --git a/한국투자증권(API)/.gitignore b/한국투자증권(API)/.gitignore new file mode 100644 index 0000000..f6a6b0f --- /dev/null +++ b/한국투자증권(API)/.gitignore @@ -0,0 +1,167 @@ +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ + +*.lock + +*_logs/ \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/.dockerignore b/한국투자증권(API)/MCP/Kis Trading MCP/.dockerignore new file mode 100644 index 0000000..2f513b5 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/.dockerignore @@ -0,0 +1,77 @@ +# Git 관련 +.git +.gitignore + +# Python 관련 +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env +pip-log.txt +pip-delete-this-directory.txt +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.log +.git +.mypy_cache +.pytest_cache +.hypothesis + +# 개발 환경 +.venv +venv/ +ENV/ +env/ +.env +.env.* +!.env.live + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS 관련 +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# 프로젝트 특정 +tmp/ +logs/ +*.tmp +*.log + +# Docker 관련 +Dockerfile +.dockerignore +docker-compose*.yml + +# 문서 +*.md +!README.md + +# 테스트 +test_*.py +*_test.py +tests/ + +# 기타 +.env.example +env.example + +*.csv +*.tmp \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/.env.live b/한국투자증권(API)/MCP/Kis Trading MCP/.env.live new file mode 100644 index 0000000..c4bea82 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/.env.live @@ -0,0 +1,4 @@ +MCP_TYPE=sse +MCP_HOST=0.0.0.0 +MCP_PORT=3000 +MCP_PATH=/sse diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/.gitignore b/한국투자증권(API)/MCP/Kis Trading MCP/.gitignore new file mode 100644 index 0000000..d00b6ee --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/.gitignore @@ -0,0 +1,23 @@ +# Python-generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +# Virtual environments +.venv + +.idea +.vscode + +*.log +*_log/ +*_logs/ +tmp/ + +*.csv +!standalone_util/*.csv +*.tmp +*.db \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/.python-version b/한국투자증권(API)/MCP/Kis Trading MCP/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/Dockerfile b/한국투자증권(API)/MCP/Kis Trading MCP/Dockerfile new file mode 100644 index 0000000..613d73c --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/Dockerfile @@ -0,0 +1,63 @@ +# Python 3.13 slim 이미지 사용 +FROM python:3.13-slim + +# 작업 디렉토리 설정 +WORKDIR /app + +# 시스템 패키지 업데이트 및 필요한 패키지 설치 +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && rm -rf /var/lib/apt/lists/* + +# Python 의존성 설치를 위한 uv 설치 +RUN pip install uv + +# pyproject.toml 복사 (uv.lock이 없을 수 있으므로) +COPY pyproject.toml ./ + +# uv.lock이 있으면 복사, 없으면 의존성만 설치 +COPY uv.lock* ./ + +# 의존성 설치 (uv.lock이 있으면 frozen, 없으면 일반 설치) +RUN if [ -f uv.lock ]; then uv sync --frozen; else uv sync; fi + +# 애플리케이션 코드 복사 +COPY . . + +# 환경변수 설정 +ENV ENV=live +ENV PYTHONPATH=/app + +# 포트 노출 (HTTP 서버용) +EXPOSE 3000 + +# 환경변수 정의 (런타임에 설정됨) +ENV KIS_APP_KEY="" +ENV KIS_APP_SECRET="" +ENV KIS_PAPER_APP_KEY="" +ENV KIS_PAPER_APP_SECRET="" +ENV KIS_HTS_ID="" +ENV KIS_ACCT_STOCK="" +ENV KIS_ACCT_FUTURE="" +ENV KIS_PAPER_STOCK="" +ENV KIS_PAPER_FUTURE="" +ENV KIS_PROD_TYPE="" +ENV KIS_URL_REST="" +ENV KIS_URL_REST_PAPER="" +ENV KIS_URL_WS="" +ENV KIS_URL_WS_PAPER="" + +# 시작 스크립트 생성 +RUN echo '#!/bin/bash\n\ +set -e\n\ +\n\ +echo "Starting KIS Trade MCP Server..."\n\ +echo "Environment: $ENV"\n\ +\n\ +# MCP 서버 시작 (HTTP 모드)\n\ +exec uv run python server.py\n\ +' > /app/start.sh && chmod +x /app/start.sh + +# 시작 스크립트 실행 +CMD ["/app/start.sh"] diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/Readme.md b/한국투자증권(API)/MCP/Kis Trading MCP/Readme.md new file mode 100644 index 0000000..16c1c04 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/Readme.md @@ -0,0 +1,391 @@ +# 중요 : MCP에 대한 내용을 완전히 숙지하신 뒤 사용해 주십시오. +# 이 프로그램을 실행하여 발생한 모든 책임은 사용자 본인에게 있습니다. + +# 한국투자증권 OPEN API MCP 서버 - Docker 설치 가이드 + +한국투자증권의 다양한 금융 API를 Docker를 통해 Claude Desktop에서 쉽게 사용할 수 있도록 하는 설치 가이드입니다. + +## 🚀 주요 기능 + +### 지원하는 API 카테고리 + +| 카테고리 | 개수 | 주요 기능 | +|---------|------|----------| +| 국내주식 | 74개 | 현재가, 호가, 차트, 잔고, 주문, 순위분석, 시세분석, 종목정보, 실시간시세 등 | +| 해외주식 | 34개 | 미국/아시아 주식 시세, 잔고, 주문, 체결내역, 거래량순위, 권리종합 등 | +| 국내선물옵션 | 20개 | 선물옵션 시세, 호가, 차트, 잔고, 주문, 야간거래, 실시간체결 등 | +| 해외선물옵션 | 19개 | 해외선물 시세, 주문내역, 증거금, 체결추이, 옵션호가 등 | +| 국내채권 | 14개 | 채권 시세, 호가, 발행정보, 잔고조회, 주문체결내역 등 | +| ETF/ETN | 2개 | NAV 비교추이, 현재가 등 | +| ELW | 1개 | ELW 거래량순위 | + +**전체 API 총합계: 166개** + +### 핵심 특징 +- 🐳 **Docker 컨테이너화**: 완전 격리된 환경에서 안전한 실행 +- ⚡ **동적 코드 실행**: GitHub에서 실시간으로 API 코드를 다운로드하여 실행 +- 🔧 **설정 기반**: JSON 파일로 API 설정 및 파라미터 관리 +- 🛡️ **안전한 실행**: 격리된 임시 환경에서 코드 실행 +- 🔍 **검증 기능**: API 상세 정보 조회로 파라미터 확인 +- 🌍 **환경 지원**: 실전/모의 환경 구분 지원 +- 🔐 **자동 설정**: 서버 시작 시 KIS 인증 설정 자동 생성 +- 🖥️ **크로스 플랫폼**: Windows, macOS, Linux 모두 지원 + +## 📦 Docker 설치 및 설정 + +### 📋 Docker 설치 + +#### 🚀 빠른 설치 (권장) +**공식 Docker Desktop을 사용하세요:** +- [Docker Desktop for Mac](https://www.docker.com/products/docker-desktop/) +- [Docker Desktop for Windows](https://www.docker.com/products/docker-desktop/) +- [Docker Engine for Linux](https://docs.docker.com/engine/install/) + +#### 📋 OS별 간단 가이드 + +##### 🍎 **macOS** +```bash +# Homebrew 사용 (권장) +brew install --cask docker + +# 또는 공식 인스톨러 다운로드 +# https://www.docker.com/products/docker-desktop/ +``` + +##### 🐧 **Linux (Ubuntu/Debian)** +```bash +# 공식 스크립트 사용 (권장) +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh + +# 사용자를 docker 그룹에 추가 +sudo usermod -aG docker $USER +``` + +##### 🪟 **Windows** +**⚠️ Windows는 추가 설정이 필요합니다:** + +1. **시스템 요구사항 확인** + - Windows 10/11 Pro, Enterprise, Education + - WSL2 또는 Hyper-V 지원 + +2. **Docker Desktop 설치** + - [공식 사이트](https://www.docker.com/products/docker-desktop/)에서 다운로드 + - 설치 중 "Use WSL 2" 옵션 선택 권장 + +3. **설치 후 확인** + ```cmd + docker --version + docker run hello-world + ``` + +**Windows 상세 설치 가이드**: [Docker 공식 문서](https://docs.docker.com/desktop/install/windows-install/) 참조 + +### 요구사항 +- Docker 20.10+ +- 한국투자증권 OPEN API 계정 + +### 📋 설치 및 설정 단계 + +#### **1단계: 프로젝트 클론** +```bash +# 프로젝트 클론 +git clone https://github.com/koreainvestment/open-trading-api.git +cd "open-trading-api/MCP/Kis Trading MCP" +``` + +#### **2단계: 한국투자증권 API 정보 준비** +한국투자증권 개발자 센터에서 발급받은 정보를 준비하세요: + +**필수 정보:** +- App Key (실전용) +- App Secret (실전용) +- 계좌 정보들 + +**선택 정보:** +- App Key (모의용) +- App Secret (모의용) + +#### **3단계: Docker 이미지 빌드** +```bash +# Docker 이미지 빌드 +docker build -t kis-trade-mcp . + +# 또는 태그와 함께 빌드 +docker build -t kis-trade-mcp:latest . +``` + +#### **4단계: Docker 컨테이너 실행** + +**기본 실행:** +```bash +docker run -d \ + --name kis-trade-mcp \ + -p 3000:3000 \ + -e KIS_APP_KEY="your_app_key" \ + -e KIS_APP_SECRET="your_app_secret" \ + -e KIS_PAPER_APP_KEY="your_paper_app_key" \ + -e KIS_PAPER_APP_SECRET="your_paper_app_secret" \ + -e KIS_HTS_ID="your_hts_id" \ + -e KIS_ACCT_STOCK="12345678" \ + -e KIS_ACCT_FUTURE="87654321" \ + -e KIS_PAPER_STOCK="11111111" \ + -e KIS_PAPER_FUTURE="22222222" \ + -e KIS_PROD_TYPE="01" \ + kis-trade-mcp +``` + +#### **5단계: 컨테이너 상태 확인** +```bash +# 컨테이너 상태 확인 +docker ps + +# 컨테이너 로그 확인 +docker logs kis-trade-mcp + +# 실시간 로그 확인 +docker logs -f kis-trade-mcp + +# HTTP 서버 접근 확인 +curl http://localhost:3000/sse +``` + +#### **6단계: HTTP 서버 접근 확인** +컨테이너가 정상적으로 실행되면 HTTP 서버에 접근할 수 있습니다: + +```bash +# 서버 상태 확인 +curl http://localhost:3000/sse + +# 또는 브라우저에서 접근 +# http://localhost:3000/sse +``` + +### 🔗 Claude Desktop 연동 및 설정 + +#### 📝 Claude Desktop 설정 +Claude Desktop 설정 파일에 MCP 서버를 등록하세요. + +**설정 파일 위치:** +- **Linux/Mac**: `~/.claude_desktop_config.json` +- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` + +#### 🐧 Linux/Mac 설정 +```json +{ + "mcpServers": { + "kis-trade-mcp": { + "command": "npx", + "args": ["-y", "mcp-remote", "http://localhost:3000/sse"] + } + } +} +``` + +#### 🪟 Windows 설정 +```json +{ + "mcpServers": { + "kis-trade-mcp": { + "command": "npx", + "args": ["-y", "mcp-remote", "http://localhost:3000/sse"] + } + } +} +``` + +## 💬 사용법 및 질문 예시 + +### 기본 사용 패턴 + +1. **종목 검색**: 먼저 종목 코드를 찾습니다 +2. **API 확인**: 사용할 API의 파라미터를 확인합니다 +3. **API 호출**: 필요한 파라미터와 함께 API를 호출합니다 + +### 질문 예시 + +**주식 시세 조회:** +- "삼성전자(005930) 현재가 시세 조회해줘" +- "애플(AAPL) 해외주식 현재 체결가 알려줘" +- "삼성전자 종목코드 찾아줘" + +**잔고 및 계좌:** +- "국내주식 잔고 조회해줘" +- "해외주식 잔고 확인해줘" + +**채권 및 기타:** +- "국고채 3년물 호가 정보 조회하는 방법" +- "KODEX 200 ETF(069500) NAV 비교추이 확인해줘" + +**모의투자:** +- "모의투자로 삼성전자 현재가 조회해줘" +- "데모 환경에서 애플 주식 시세 알려줘" + +## 🔧 컨테이너 관리 + +### 컨테이너 제어 +```bash +# 컨테이너 시작 +docker start kis-trade-mcp + +# 컨테이너 중지 +docker stop kis-trade-mcp + +# 컨테이너 재시작 +docker restart kis-trade-mcp + +# 컨테이너 제거 +docker stop kis-trade-mcp +docker rm kis-trade-mcp +``` + +### 컨테이너 내부 접근 +```bash +# 컨테이너 내부 bash 실행 +docker exec -it kis-trade-mcp /bin/bash + +# 환경변수 확인 +docker exec kis-trade-mcp env | grep KIS + +# 로그 실시간 확인 +docker logs -f kis-trade-mcp +``` + +## 💡 사용 팁 + +1. **환경변수 관리**: 민감한 정보는 환경변수로 안전하게 관리 +2. **로그 모니터링**: `docker logs -f`로 실시간 로그 확인 +3. **리소스 모니터링**: `docker stats`로 컨테이너 리소스 사용량 확인 +4. **백업 전략**: 중요한 설정 파일은 정기적으로 백업 +5. **보안 관리**: 컨테이너 내부에서만 민감한 정보 처리 + +## 📝 로깅 및 모니터링 + +### 로그 확인 +```bash +# 전체 로그 +docker logs kis-trade-mcp + +# 최근 100줄 +docker logs --tail 100 kis-trade-mcp + +# 실시간 로그 +docker logs -f kis-trade-mcp + +# 특정 시간대 로그 +docker logs --since "2024-01-01T00:00:00" kis-trade-mcp +``` + +### 성능 모니터링 +```bash +# 컨테이너 리소스 사용량 +docker stats kis-trade-mcp + +# 컨테이너 상세 정보 +docker inspect kis-trade-mcp + +# 프로세스 확인 +docker exec kis-trade-mcp ps aux +``` + +## 🛠️ 문제 해결 + +### 일반적인 문제들 + +**1. 컨테이너가 시작되지 않는 경우** +```bash +# 로그 확인 +docker logs kis-trade-mcp + +# 환경변수 확인 +docker exec kis-trade-mcp env | grep KIS +``` + +**2. 환경변수 누락** +```bash +# 컨테이너 재시작 +docker restart kis-trade-mcp + +# 환경변수 다시 설정하여 실행 +docker run -d --name kis-trade-mcp -e KIS_APP_KEY="..." ... +``` + +**3. 메모리 부족** +```bash +# 메모리 사용량 확인 +docker stats kis-trade-mcp + +# 컨테이너 리소스 제한 설정 +docker run -d --name kis-trade-mcp --memory="2g" --cpus="2" ... +``` + +**4. 네트워크 연결 문제** +```bash +# 포트 확인 +docker port kis-trade-mcp + +# 네트워크 연결 테스트 +curl http://localhost:3000/sse +``` + +### 디버깅 명령어 +```bash +# 컨테이너 내부 bash 접근 +docker exec -it kis-trade-mcp /bin/bash + +# Python 환경 확인 +docker exec kis-trade-mcp uv run python -c "import sys; print(sys.path)" + +# 의존성 확인 +docker exec kis-trade-mcp uv pip list + +# 네트워크 연결 확인 +docker exec kis-trade-mcp ping github.com +``` + +## 🔒 보안 고려사항 + +- **컨테이너 격리**: 호스트 시스템과 완전히 분리된 환경에서 실행 +- **환경변수 보안**: 민감한 정보는 환경변수로 전달, 코드에 하드코딩 금지 +- **임시 파일 정리**: 각 API 호출 후 임시 파일 자동 삭제 +- **네트워크 격리**: 필요한 경우 Docker 네트워크를 통한 추가 격리 + +## ⚠️ 제한사항 및 성능 + +### API 호출 제한 +- 한국투자증권 API의 호출 제한을 준수해야 합니다 +- 분당 호출 횟수 제한이 있을 수 있습니다 +- 실전 환경에서는 더욱 신중한 사용이 필요합니다 + +### Docker 성능 고려사항 +- **컨테이너 오버헤드**: Docker 컨테이너 실행으로 인한 약간의 성능 오버헤드 +- **메모리 사용량**: SQLAlchemy와 pandas가 메모리를 많이 사용할 수 있음 +- **네트워크 지연**: GitHub 다운로드 시 네트워크 지연 발생 + +### 다단계 타임아웃 설정 +- 파일 다운로드: 30초 (GitHub 응답 대기) +- 코드 실행: 15초 (API 호출 및 결과 처리) +- 컨테이너 시작: 60초 (의존성 설치 및 초기화) + +## 🔗 관련 링크 + +- [한국투자증권 개발자 센터](https://apiportal.koreainvestment.com/) +- [한국투자증권 OPEN API GitHub](https://github.com/koreainvestment/open-trading-api) +- [MCP (Model Context Protocol) 공식 문서](https://modelcontextprotocol.io/) +- [Docker 공식 문서](https://docs.docker.com/) + +--- + +**주의**: 이 프로젝트는 한국투자증권 OPEN API를 사용합니다. 사용 전 반드시 [한국투자증권 개발자 센터](https://apiportal.koreainvestment.com/)에서 API 이용약관을 확인하시기 바랍니다. + +## ⚠️ 투자 책임 고지 + +**본 MCP 서버는 한국투자증권 OPEN API를 활용한 도구일 뿐이며, 투자 조언이나 권유를 제공하지 않습니다.** + +- 📈 **투자 결정 책임**: 모든 투자 결정과 그에 따른 손익은 전적으로 투자자 본인의 책임입니다 +- 💰 **손실 위험**: 주식, 선물, 옵션 등 모든 금융상품 투자에는 원금 손실 위험이 있습니다 +- 🔍 **정보 검증**: API를 통해 제공되는 정보의 정확성은 한국투자증권에 의존하며, 투자 전 반드시 정보를 검증하시기 바랍니다 +- 🧠 **신중한 판단**: 충분한 조사와 신중한 판단 없이 투자하지 마시기 바랍니다 +- 🎯 **모의투자 권장**: 실전 투자 전 반드시 모의투자를 통해 충분히 연습하시기 바랍니다 + +**투자는 본인의 판단과 책임 하에 이루어져야 하며, 본 도구 사용으로 인한 어떠한 손실에 대해서도 개발자는 책임지지 않습니다.** diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/auth.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/auth.json new file mode 100644 index 0000000..e15d6c6 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/auth.json @@ -0,0 +1,105 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 auth OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "auth_token", + "params": { + "grant_type": "client_credentials", + "env_dv": "real" + } + }, + { + "api_type": "auth_ws_token", + "params": { + "grant_type": "client_credentials", + "env_dv": "real" + } + } + ] + }, + "apis": { + "auth_token": { + "category": "OAuth인증", + "name": "접근토큰발급(P)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/auth/auth_token", + "method": "auth_token", + "api_path": "/oauth2/tokenP", + "params": { + "grant_type": { + "name": "grant_type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 권한부여 Type (client_credentials)" + }, + "appkey": { + "name": "appkey", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 앱키 (한국투자증권 홈페이지에서 발급받은 appkey)" + }, + "appsecret": { + "name": "appsecret", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 앱시크릿키 (한국투자증권 홈페이지에서 발급받은 appsecret)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 환경구분 (real: 실전, demo: 모의)" + } + } + }, + "auth_ws_token": { + "category": "OAuth인증", + "name": "실시간 (웹소켓) 접속키 발급", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/auth/auth_ws_token", + "method": "auth_ws_token", + "api_path": "/oauth2/Approval", + "params": { + "grant_type": { + "name": "grant_type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 권한부여 Type (client_credentials)" + }, + "appkey": { + "name": "appkey", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 고객 앱Key (한국투자증권 홈페이지에서 발급받은 appkey)" + }, + "appsecret": { + "name": "appsecret", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 고객 앱Secret (한국투자증권 홈페이지에서 발급받은 appsecret)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 환경구분 (real: 실전, demo: 모의)" + }, + "token": { + "name": "token", + "type": "str", + "required": false, + "default_value": "", + "description": "접근토큰 (OAuth 토큰이 필요한 API 경우 발급한 Access token)" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_bond.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_bond.json new file mode 100644 index 0000000..2f04dc1 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_bond.json @@ -0,0 +1,1022 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 장내채권 OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "inquire_asking_price", + "params": { + "fid_cond_mrkt_div_code": "B", + "fid_input_iscd": "KR2033022D33" + } + }, + { + "api_type": "issue_info", + "params": { + "pdno": "KR6449111CB8", + "prdt_type_cd": "302" + } + } + ] + }, + "apis": { + "inquire_asking_price": { + "category": "[장내채권] 기본시세", + "name": "장내채권현재가(호가)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_asking_price", + "method": "inquire_asking_price", + "api_path": "/uapi/domestic-bond/v1/quotations/inquire-asking-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "시장 분류 코드 (B 입력)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "채권종목코드 (ex KR2033022D33)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (기본값: None)" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이 (기본값: 0)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "issue_info": { + "category": "[장내채권] 기본시세", + "name": "장내채권 발행정보", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/issue_info", + "method": "issue_info", + "api_path": "/uapi/domestic-bond/v1/quotations/issue-info", + "params": { + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "채권 종목번호(ex. KR6449111CB8)" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "Unique key(302)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_price": { + "category": "[장내채권] 기본시세", + "name": "장내채권현재가(시세)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_price", + "method": "inquire_price", + "api_path": "/uapi/domestic-bond/v1/quotations/inquire-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건시장분류코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력종목코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (기본값: None)" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이 (기본값: 0)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "search_bond_info": { + "category": "[장내채권] 기본시세", + "name": "장내채권 기본조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/search_bond_info", + "method": "search_bond_info", + "api_path": "/uapi/domestic-bond/v1/quotations/search-bond-info", + "params": { + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호 (필수)" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "상품유형코드 (필수)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_ccnl": { + "category": "[장내채권] 기본시세", + "name": "장내채권현재가(체결)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_ccnl", + "method": "inquire_ccnl", + "api_path": "/uapi/domestic-bond/v1/quotations/inquire-ccnl", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건시장분류코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력종목코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (기본값: None)" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이 (기본값: 0)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_daily_price": { + "category": "[장내채권] 기본시세", + "name": "장내채권현재가(일별)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_daily_price", + "method": "inquire_daily_price", + "api_path": "/uapi/domestic-bond/v1/quotations/inquire-daily-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건시장분류코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력종목코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (기본값: None)" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이 (기본값: 0)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "avg_unit": { + "category": "[장내채권] 기본시세", + "name": "장내채권 평균단가조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/avg_unit", + "method": "avg_unit", + "api_path": "/uapi/domestic-bond/v1/quotations/avg-unit", + "params": { + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회 시작 일자" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회 종료 일자" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호, 공백: 전체, 특정종목 조회시 : 종목코드" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "상품유형코드" + }, + "vrfc_kind_cd": { + "name": "vrfc_kind_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "검증종류코드" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_daily_ccld": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 주문체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_daily_ccld", + "method": "inquire_daily_ccld", + "api_path": "/uapi/domestic-bond/v1/trading/inquire-daily-ccld", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회시작일자 (1주일 이내)" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회종료일자 (조회 당일)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "매도매수구분코드 (%(전체), 01(매도), 02(매수))" + }, + "sort_sqn_dvsn": { + "name": "sort_sqn_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "정렬순서구분 (01(주문순서), 02(주문역순))" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호" + }, + "nccs_yn": { + "name": "nccs_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "미체결여부 (N(전체), C(체결), Y(미체결))" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_psbl_order": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 매수가능조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_psbl_order", + "method": "inquire_psbl_order", + "api_path": "/uapi/domestic-bond/v1/trading/inquire-psbl-order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "채권종목코드(ex KR2033022D33)" + }, + "bond_ord_unpr": { + "name": "bond_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "채권주문단가 (필수)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_balance": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 잔고조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_balance", + "method": "inquire_balance", + "api_path": "/uapi/domestic-bond/v1/trading/inquire-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_cndt": { + "name": "inqr_cndt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회조건 (00: 전체, 01: 상품번호단위)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호 (공백 허용)" + }, + "buy_dt": { + "name": "buy_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "매수일자 (공백 허용)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order_rvsecncl": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 정정취소주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/order_rvsecncl", + "method": "order_rvsecncl", + "api_path": "/uapi/domestic-bond/v1/trading/order-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "원주문번호" + }, + "ord_qty2": { + "name": "ord_qty2", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량2" + }, + "bond_ord_unpr": { + "name": "bond_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "채권주문단가" + }, + "qty_all_ord_yn": { + "name": "qty_all_ord_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "잔량전부주문여부" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "정정취소구분코드" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "운용사지정주문번호. Defaults to \"\"." + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": "0", + "description": "주문서버구분코드. Defaults to \"0\"." + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": "", + "description": "연락전화번호. Defaults to \"\"." + } + } + }, + "buy": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 매수주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/buy", + "method": "buy", + "api_path": "/uapi/domestic-bond/v1/trading/buy", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호 (12자리)" + }, + "ord_qty2": { + "name": "ord_qty2", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량2 (19자리)" + }, + "bond_ord_unpr": { + "name": "bond_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "채권주문단가 (182자리)" + }, + "samt_mket_ptci_yn": { + "name": "samt_mket_ptci_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "소액시장참여여부 ('Y' or 'N')" + }, + "bond_rtl_mket_yn": { + "name": "bond_rtl_mket_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "채권소매시장여부 ('Y' or 'N')" + }, + "idcr_stfno": { + "name": "idcr_stfno", + "type": "str", + "required": true, + "default_value": "", + "description": "유치자직원번호 (6자리). Defaults to \"\"." + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "운용사지정주문번호 (12자리). Defaults to \"\"." + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "주문서버구분코드. Defaults to \"\"." + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": "", + "description": "연락전화번호. Defaults to \"\"." + } + } + }, + "inquire_psbl_rvsecncl": { + "category": "[장내채권] 주문/계좌", + "name": "채권정정취소가능주문조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/inquire_psbl_rvsecncl", + "method": "inquire_psbl_rvsecncl", + "api_path": "/uapi/domestic-bond/v1/trading/inquire-psbl-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ord_dt": { + "name": "ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "주문일자" + }, + "odno": { + "name": "odno", + "type": "str", + "required": true, + "default_value": null, + "description": "주문번호" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "sell": { + "category": "[장내채권] 주문/계좌", + "name": "장내채권 매도주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_bond/sell", + "method": "sell", + "api_path": "/uapi/domestic-bond/v1/trading/sell", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "주문구분" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호" + }, + "ord_qty2": { + "name": "ord_qty2", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량2" + }, + "bond_ord_unpr": { + "name": "bond_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "채권주문단가" + }, + "sprx_yn": { + "name": "sprx_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "분리과세여부" + }, + "samt_mket_ptci_yn": { + "name": "samt_mket_ptci_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "소액시장참여여부" + }, + "sll_agco_opps_sll_yn": { + "name": "sll_agco_opps_sll_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "매도대행사반대매도여부" + }, + "bond_rtl_mket_yn": { + "name": "bond_rtl_mket_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "채권소매시장여부" + }, + "buy_dt": { + "name": "buy_dt", + "type": "str", + "required": true, + "default_value": "", + "description": "매수일자. Defaults to \"\"." + }, + "buy_seq": { + "name": "buy_seq", + "type": "str", + "required": true, + "default_value": "", + "description": "매수순번. Defaults to \"\"." + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "운용사지정주문번호. Defaults to \"\"." + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": "0", + "description": "주문서버구분코드. Defaults to \"0\"." + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": "", + "description": "연락전화번호. Defaults to \"\"." + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_futureoption.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_futureoption.json new file mode 100644 index 0000000..4ea82f3 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_futureoption.json @@ -0,0 +1,1311 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 국내선물옵션 OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "inquire_asking_price", + "params": { + "fid_cond_mrkt_div_code": "F", + "fid_input_iscd": "101W09", + "env_dv": "real" + } + }, + { + "api_type": "inquire_time_fuopchartprice", + "params": { + "fid_cond_mrkt_div_code": "F", + "fid_input_iscd": "101T12", + "fid_hour_cls_code": "60", + "fid_pw_data_incu_yn": "Y", + "fid_fake_tick_incu_yn": "N", + "fid_input_date_1": "20230901", + "fid_input_hour_1": "100000" + } + } + ] + }, + "apis": { + "inquire_asking_price": { + "category": "[국내선물옵션] 기본시세", + "name": "선물옵션 시세호가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_asking_price", + "method": "inquire_asking_price", + "api_path": "/uapi/domestic-futureoption/v1/quotations/inquire-asking-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, JF: 주식선물)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 종목코드 (ex. 101W09)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + } + } + }, + "inquire_time_fuopchartprice": { + "category": "[국내선물옵션] 기본시세", + "name": "선물옵션 분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_time_fuopchartprice", + "method": "inquire_time_fuopchartprice", + "api_path": "/uapi/domestic-futureoption/v1/quotations/inquire-time-fuopchartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 종목코드 (ex. 101T12)" + }, + "fid_hour_cls_code": { + "name": "fid_hour_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 시간 구분 코드 (ex. 30: 30초, 60: 1분)" + }, + "fid_pw_data_incu_yn": { + "name": "fid_pw_data_incu_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 과거 데이터 포함 여부 (ex. Y:과거, N: 당일)" + }, + "fid_fake_tick_incu_yn": { + "name": "fid_fake_tick_incu_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 허봉 포함 여부 (ex. N)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 날짜1 (ex. 20230901)" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 시간1 (ex. 100000)" + } + } + }, + "inquire_price": { + "category": "[국내선물옵션] 기본시세", + "name": "선물옵션 시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_price", + "method": "inquire_price", + "api_path": "/uapi/domestic-futureoption/v1/quotations/inquire-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 종목코드 (ex. 101W09)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + } + } + }, + "inquire_daily_fuopchartprice": { + "category": "[국내선물옵션] 기본시세", + "name": "선물옵션기간별시세(일/주/월/년)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice", + "method": "inquire_daily_fuopchartprice", + "api_path": "/uapi/domestic-futureoption/v1/quotations/inquire-daily-fuopchartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 101W09)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회 시작일자 (ex. 20220301)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회 종료일자 (ex. 20220810)" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기간분류코드 (ex. D: 일봉, W: 주봉)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + } + } + }, + "exp_price_trend": { + "category": "[국내선물옵션] 기본시세", + "name": "선물옵션 일중예상체결추이", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/exp_price_trend", + "method": "exp_price_trend", + "api_path": "/uapi/domestic-futureoption/v1/quotations/exp-price-trend", + "params": { + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 101V06)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. F)" + } + } + }, + "display_board_top": { + "category": "[국내선물옵션] 기본시세", + "name": "국내선물 기초자산 시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/display_board_top", + "method": "display_board_top", + "api_path": "/uapi/domestic-futureoption/v1/quotations/display-board-top", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. F)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 101V06)" + }, + "fid_cond_mrkt_div_code1": { + "name": "fid_cond_mrkt_div_code1", + "type": "str", + "required": true, + "default_value": "", + "description": "조건 시장 분류 코드" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": "", + "description": "조건 화면 분류 코드" + }, + "fid_mtrt_cnt": { + "name": "fid_mtrt_cnt", + "type": "str", + "required": true, + "default_value": "", + "description": "만기 수" + }, + "fid_cond_mrkt_cls_code": { + "name": "fid_cond_mrkt_cls_code", + "type": "str", + "required": true, + "default_value": "", + "description": "조건 시장 구분 코드" + } + } + }, + "inquire_balance": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 잔고현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_balance", + "method": "inquire_balance", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-balance", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "mgna_dvsn": { + "name": "mgna_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 증거금 구분 (ex. 01:게시,02:유지)" + }, + "excc_stat_cd": { + "name": "excc_stat_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정산상태코드 (ex. 1:정산,2:본정산)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_ngt_balance": { + "category": "[국내선물옵션] 주문/계좌", + "name": "(야간)선물옵션 잔고현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_ngt_balance", + "method": "inquire_ngt_balance", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "mgna_dvsn": { + "name": "mgna_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 증거금구분 (ex. 01:개시, 02:유지)" + }, + "excc_stat_cd": { + "name": "excc_stat_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정산상태코드 (ex. 1:정산, 2:본정산)" + }, + "acnt_pwd": { + "name": "acnt_pwd", + "type": "str", + "required": true, + "default_value": "", + "description": "계좌비밀번호" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_ccnl": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 주문체결내역조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_ccnl", + "method": "inquire_ccnl", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-ccnl", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "strt_ord_dt": { + "name": "strt_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시작주문일자 (ex. 주문내역 조회 시작 일자, YYYYMMDD)" + }, + "end_ord_dt": { + "name": "end_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종료주문일자 (ex. 주문내역 조회 마지막 일자, YYYYMMDD)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 00:전체, 01:매도, 02:매수)" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결)" + }, + "sort_sqn": { + "name": "sort_sqn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정렬순서 (ex. AS:정순, DS:역순)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호. Defaults to \"\"." + }, + "strt_odno": { + "name": "strt_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "시작주문번호. Defaults to \"\"." + }, + "mket_id_cd": { + "name": "mket_id_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "시장ID코드. Defaults to \"\"." + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_ngt_ccnl": { + "category": "[국내선물옵션] 주문/계좌", + "name": "(야간)선물옵션 주문체결 내역조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_ngt_ccnl", + "method": "inquire_ngt_ccnl", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "strt_ord_dt": { + "name": "strt_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시작주문일자" + }, + "end_ord_dt": { + "name": "end_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종료주문일자 (ex. 조회하려는 마지막 일자 다음일자로 조회 (ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정))" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 공란:default, 00:전체, 01:매도, 02:매수)" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결)" + }, + "sort_sqn": { + "name": "sort_sqn", + "type": "str", + "required": true, + "default_value": "", + "description": "정렬순서 (ex. 공란:default(DS:정순, 그외:역순))" + }, + "strt_odno": { + "name": "strt_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "시작주문번호 (ex. 공란:default)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호 (ex. 공란:default)" + }, + "mket_id_cd": { + "name": "mket_id_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "시장ID코드 (ex. 공란:default)" + }, + "fuop_dvsn_cd": { + "name": "fuop_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "선물옵션구분코드 (ex. 공란:전체, 01:선물, 02:옵션)" + }, + "scrn_dvsn": { + "name": "scrn_dvsn", + "type": "str", + "required": true, + "default_value": "", + "description": "화면구분 (ex. 02(Default))" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/order", + "method": "order", + "api_path": "/uapi/domestic-futureoption/v1/trading/order", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분 (ex. day:주간, night:야간)" + }, + "ord_prcs_dvsn_cd": { + "name": "ord_prcs_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문처리구분코드 (ex. 02:주문전송)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 01:매도, 02:매수)" + }, + "shtn_pdno": { + "name": "shtn_pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 단축상품번호 (ex. 종목번호, 선물 6자리 (예: 101W09), 옵션 9자리 (예: 201S03370))" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량" + }, + "unit_price": { + "name": "unit_price", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문가격1 (ex. 시장가나 최유리 지정가인 경우 0으로 입력)" + }, + "nmpr_type_cd": { + "name": "nmpr_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리)" + }, + "krx_nmpr_cndt_cd": { + "name": "krx_nmpr_cndt_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 한국거래소호가조건코드 (ex. 0:없음, 3:IOC, 4:FOK)" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK))" + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": "", + "description": "연락전화번호 (ex. 고객의 연락 가능한 전화번호)" + }, + "fuop_item_dvsn_cd": { + "name": "fuop_item_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "선물옵션종목구분코드 (ex. 공란(Default))" + } + } + }, + "inquire_psbl_order": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 주문가능", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_psbl_order", + "method": "inquire_psbl_order", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-psbl-order", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (ex. 선물 6자리, 옵션 9자리)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 01:매도,02:매수)" + }, + "unit_price": { + "name": "unit_price", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문가격1" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분코드" + } + } + }, + "inquire_ccnl_bstime": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 기준일체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_ccnl_bstime", + "method": "inquire_ccnl_bstime", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-ccnl-bstime", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ord_dt": { + "name": "ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문일자 (ex. 20250101)" + }, + "fuop_tr_strt_tmd": { + "name": "fuop_tr_strt_tmd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 선물옵션거래시작시각 (ex. HHMMSS)" + }, + "fuop_tr_end_tmd": { + "name": "fuop_tr_end_tmd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 선물옵션거래종료시각 (ex. HHMMSS)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order_rvsecncl": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 정정취소주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/order_rvsecncl", + "method": "order_rvsecncl", + "api_path": "/uapi/domestic-futureoption/v1/trading/order-rvsecncl", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "day_dv": { + "name": "day_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주야간구분 (ex. day:주간, night:야간)" + }, + "ord_prcs_dvsn_cd": { + "name": "ord_prcs_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문처리구분코드 (ex. 02)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정정취소구분코드 (ex. 01:정정, 02:취소)" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 원주문번호" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량 (ex. 0:전량, 그 외는 수량)" + }, + "unit_price": { + "name": "unit_price", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문가격1 (ex 0:시장가/최유리, 그 외 가격)" + }, + "nmpr_type_cd": { + "name": "nmpr_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리)" + }, + "krx_nmpr_cndt_cd": { + "name": "krx_nmpr_cndt_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 한국거래소호가조건코드 (ex. 0:취소/없음, 3:IOC, 4:FOK)" + }, + "rmn_qty_yn": { + "name": "rmn_qty_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 잔여수량여부 (ex. Y:전량, N:일부)" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분코드" + }, + "fuop_item_dvsn_cd": { + "name": "fuop_item_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "선물옵션종목구분코드" + } + } + }, + "inquire_balance_valuation_pl": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 잔고평가손익내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_balance_valuation_pl", + "method": "inquire_balance_valuation_pl", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-balance-valuation-pl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "mgna_dvsn": { + "name": "mgna_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 증거금구분 (ex. 01:개시, 02:유지)" + }, + "excc_stat_cd": { + "name": "excc_stat_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정산상태코드 (ex. 1:정산, 2:본정산)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_deposit": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 총자산현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_deposit", + "method": "inquire_deposit", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-deposit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + } + } + }, + "inquire_balance_settlement_pl": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션 잔고정산손익내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_balance_settlement_pl", + "method": "inquire_balance_settlement_pl", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-balance-settlement-pl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_dt": { + "name": "inqr_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회일자" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_psbl_ngt_order": { + "category": "[국내선물옵션] 주문/계좌", + "name": "(야간)선물옵션 주문가능 조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_psbl_ngt_order", + "method": "inquire_psbl_ngt_order", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-psbl-ngt-order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품유형코드 (ex. 301:선물옵션)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 01:매도, 02:매수)" + }, + "unit_price": { + "name": "unit_price", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문가격1" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK))" + } + } + }, + "inquire_daily_amount_fee": { + "category": "[국내선물옵션] 주문/계좌", + "name": "선물옵션기간약정수수료일별", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/inquire_daily_amount_fee", + "method": "inquire_daily_amount_fee", + "api_path": "/uapi/domestic-futureoption/v1/trading/inquire-daily-amount-fee", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_day": { + "name": "inqr_strt_day", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일 (ex. 20240401)" + }, + "inqr_end_day": { + "name": "inqr_end_day", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일 (ex. 20240625)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "ngt_margin_detail": { + "category": "[국내선물옵션] 주문/계좌", + "name": "(야간)선물옵션 증거금 상세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_futureoption/ngt_margin_detail", + "method": "ngt_margin_detail", + "api_path": "/uapi/domestic-futureoption/v1/trading/ngt-margin-detail", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "mgna_dvsn_cd": { + "name": "mgna_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 증거금 구분코드 (ex. 01:위탁, 02:유지)" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_stock.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_stock.json new file mode 100644 index 0000000..b02c74c --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/domestic_stock.json @@ -0,0 +1,4881 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 국내주식 OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "inquire_elw_price", + "params": { + "env_dv": "real" + } + }, + { + "api_type": "inquire_price", + "params": { + "env_dv": "real", + "fid_cond_mrkt_div_code": "J", + "fid_input_iscd": "005930" + } + } + ] + }, + "apis": { + "inquire_elw_price": { + "category": "[국내주식] ELW시세", + "name": "ELW 현재가 시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_elw_price", + "method": "inquire_elw_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-elw-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 조건 시장 분류 코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 입력 종목코드" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "[추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real')" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: '')" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (기본값: None)" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이 (기본값: 0)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_price": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_price", + "method": "inquire_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-price", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수)" + } + } + }, + "inquire_asking_price_exp_ccn": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 호가/예상체결", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_asking_price_exp_ccn", + "method": "inquire_asking_price_exp_ccn", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + } + } + }, + "inquire_time_itemchartprice": { + "category": "[국내주식] 기본시세", + "name": "주식당일분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_time_itemchartprice", + "method": "inquire_time_itemchartprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 시간1 (ex. 입력시간)" + }, + "fid_pw_data_incu_yn": { + "name": "fid_pw_data_incu_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 과거 데이터 포함 여부" + }, + "fid_etc_cls_code": { + "name": "fid_etc_cls_code", + "type": "str", + "required": true, + "default_value": "", + "description": "[필수] 기타 구분 코드" + } + } + }, + "inquire_daily_itemchartprice": { + "category": "[국내주식] 기본시세", + "name": "국내주식기간별시세(일/주/월/년)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_itemchartprice", + "method": "inquire_daily_itemchartprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자))" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 날짜 1 (ex. 조회 시작일자)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 날짜 2 (ex. 조회 종료일자 (최대 100개))" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기간분류코드 (ex. D:일봉 W:주봉, M:월봉, Y:년봉)" + }, + "fid_org_adj_prc": { + "name": "fid_org_adj_prc", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 수정주가 원주가 가격 여부 (ex. 0:수정주가 1:원주가)" + } + } + }, + "inquire_time_dailychartprice": { + "category": "[국내주식] 기본시세", + "name": "주식일별분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_time_dailychartprice", + "method": "inquire_time_dailychartprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-time-dailychartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장 분류 코드 (ex. J:주식,NX:NXT,UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 시간1 (ex. 130000)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 날짜1 (ex. 20241023)" + }, + "fid_pw_data_incu_yn": { + "name": "fid_pw_data_incu_yn", + "type": "str", + "required": true, + "default_value": "N", + "description": "과거 데이터 포함 여부 (기본값: \"N\")" + }, + "fid_fake_tick_incu_yn": { + "name": "fid_fake_tick_incu_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "허봉 포함 여부 (기본값: \"\")" + } + } + }, + "inquire_ccnl": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 체결", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_ccnl", + "method": "inquire_ccnl", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-ccnl", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + } + } + }, + "inquire_time_itemconclusion": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 당일시간대별체결", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_time_itemconclusion", + "method": "inquire_time_itemconclusion", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 시간1" + } + } + }, + "inquire_daily_price": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 일자별", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_price", + "method": "inquire_daily_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-daily-price", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자))" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기간 분류 코드 (ex. D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월)" + }, + "fid_org_adj_prc": { + "name": "fid_org_adj_prc", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 수정주가 원주가 가격 (ex. 0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격)" + } + } + }, + "inquire_investor": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 투자자", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_investor", + "method": "inquire_investor", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-investor", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (J:KRX, NX:NXT)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + } + } + }, + "inquire_overtime_price": { + "category": "[국내주식] 기본시세", + "name": "국내주식 시간외현재가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_overtime_price", + "method": "inquire_overtime_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-overtime-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장 분류 코드 (ex. J: 주식)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 005930)" + } + } + }, + "inquire_price_2": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 시세2", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_price_2", + "method": "inquire_price_2", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-price-2", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드" + } + } + }, + "inquire_daily_overtimeprice": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 시간외일자별주가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_overtimeprice", + "method": "inquire_daily_overtimeprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드" + } + } + }, + "inquire_time_overtimeconclusion": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 시간외시간별체결", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_time_overtimeconclusion", + "method": "inquire_time_overtimeconclusion", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-time-overtimeconclusion", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건시장분류코드 (ex. J:주식/ETF/ETN)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력종목코드 (ex. 123456(ETN의 경우 Q로 시작 Q500001))" + }, + "fid_hour_cls_code": { + "name": "fid_hour_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 적립금구분코드 (ex. 1: 시간외)" + } + } + }, + "inquire_member": { + "category": "[국내주식] 기본시세", + "name": "주식현재가 회원사", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_member", + "method": "inquire_member", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-member", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (J:KRX, NX:NXT)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + } + } + }, + "inquire_overtime_asking_price": { + "category": "[국내주식] 기본시세", + "name": "국내주식 시간외호가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_overtime_asking_price", + "method": "inquire_overtime_asking_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-overtime-asking-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장 분류 코드 (ex. J:주식)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + } + } + }, + "fluctuation": { + "category": "[국내주식] 순위분석", + "name": "국내주식 등락률 순위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/fluctuation", + "method": "fluctuation", + "api_path": "/uapi/domestic-stock/v1/ranking/fluctuation", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건 시장 분류 코드 (J:KRX, NX:NXT)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건 화면 분류 코드 (20170: 등락률)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 종목코드 (0000: 전체)" + }, + "fid_rank_sort_cls_code": { + "name": "fid_rank_sort_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "순위 정렬 구분 코드 (0000: 등락률순)" + }, + "fid_input_cnt_1": { + "name": "fid_input_cnt_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 수1 (조회할 종목 수)" + }, + "fid_prc_cls_code": { + "name": "fid_prc_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "가격 구분 코드 (0: 전체)" + }, + "fid_input_price_1": { + "name": "fid_input_price_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 가격1 (하한가)" + }, + "fid_input_price_2": { + "name": "fid_input_price_2", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 가격2 (상한가)" + }, + "fid_vol_cnt": { + "name": "fid_vol_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "거래량 수 (최소 거래량)" + }, + "fid_trgt_cls_code": { + "name": "fid_trgt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 구분 코드 (9자리, \"1\" or \"0\", 증거금30% 40% 50% 60% 100% 신용보증금30% 40% 50% 60%)" + }, + "fid_trgt_exls_cls_code": { + "name": "fid_trgt_exls_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 제외 구분 코드 (10자리, \"1\" or \"0\", 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC)" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "분류 구분 코드 (0: 전체)" + }, + "fid_rsfl_rate1": { + "name": "fid_rsfl_rate1", + "type": "str", + "required": true, + "default_value": null, + "description": "등락 비율1 (하락률 하한)" + }, + "fid_rsfl_rate2": { + "name": "fid_rsfl_rate2", + "type": "str", + "required": true, + "default_value": null, + "description": "등락 비율2 (상승률 상한)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + } + } + }, + "volume_rank": { + "category": "[국내주식] 순위분석", + "name": "거래량순위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/volume_rank", + "method": "volume_rank", + "api_path": "/uapi/domestic-stock/v1/quotations/volume-rank", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건 시장 분류 코드 (\"J\": KRX, \"NX\": NXT, \"UN\": 통합, \"W\": ELW)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건 화면 분류 코드 (\"20171\")" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 종목코드 (\"0000\": 전체, 기타: 업종코드)" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "분류 구분 코드 (\"0\": 전체, \"1\": 보통주, \"2\": 우선주)" + }, + "fid_blng_cls_code": { + "name": "fid_blng_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "소속 구분 코드 (\"0\": 평균거래량, \"1\": 거래증가율, \"2\": 평균거래회전율, \"3\": 거래금액순, \"4\": 평균거래금액회전율)" + }, + "fid_trgt_cls_code": { + "name": "fid_trgt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 구분 코드 (9자리, \"1\" or \"0\", 차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%)" + }, + "fid_trgt_exls_cls_code": { + "name": "fid_trgt_exls_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 제외 구분 코드 (10자리, \"1\" or \"0\", 차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC)" + }, + "fid_input_price_1": { + "name": "fid_input_price_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 가격1 (가격 ~, 전체 가격 대상 조회 시 공란)" + }, + "fid_input_price_2": { + "name": "fid_input_price_2", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 가격2 (~ 가격, 전체 가격 대상 조회 시 공란)" + }, + "fid_vol_cnt": { + "name": "fid_vol_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "거래량 수 (거래량 ~, 전체 거래량 대상 조회 시 공란)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 날짜1 (공란)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + } + } + }, + "market_cap": { + "category": "[국내주식] 순위분석", + "name": "국내주식 시가총액 상위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/market_cap", + "method": "market_cap", + "api_path": "/uapi/domestic-stock/v1/ranking/market-cap", + "params": { + "fid_input_price_2": { + "name": "fid_input_price_2", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (~ 가격)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "시장구분코드 (J:KRX, NX:NXT)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "Unique key( 20174 )" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0: 전체, 1:보통주, 2:우선주" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200" + }, + "fid_trgt_cls_code": { + "name": "fid_trgt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0 : 전체" + }, + "fid_trgt_exls_cls_code": { + "name": "fid_trgt_exls_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0 : 전체" + }, + "fid_input_price_1": { + "name": "fid_input_price_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (가격 ~)" + }, + "fid_vol_cnt": { + "name": "fid_vol_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (거래량 ~)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + } + } + }, + "volume_power": { + "category": "[국내주식] 순위분석", + "name": "국내주식 체결강도 상위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/volume_power", + "method": "volume_power", + "api_path": "/uapi/domestic-stock/v1/ranking/volume-power", + "params": { + "fid_trgt_exls_cls_code": { + "name": "fid_trgt_exls_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0 : 전체" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "시장구분코드 (J:KRX, NX:NXT)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "Unique key( 20168 )" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0: 전체, 1: 보통주 2: 우선주" + }, + "fid_input_price_1": { + "name": "fid_input_price_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (가격 ~)" + }, + "fid_input_price_2": { + "name": "fid_input_price_2", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (~ 가격)" + }, + "fid_vol_cnt": { + "name": "fid_vol_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "입력값 없을때 전체 (거래량 ~)" + }, + "fid_trgt_cls_code": { + "name": "fid_trgt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0 : 전체" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "intstock_multprice": { + "category": "[국내주식] 시세분석", + "name": "관심종목(멀티종목) 시세조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/intstock_multprice", + "method": "intstock_multprice", + "api_path": "/uapi/domestic-stock/v1/quotations/intstock-multprice", + "params": { + "fid_cond_mrkt_div_code_1": { + "name": "fid_cond_mrkt_div_code_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드1 (J:KRX, NX:NXT)" + }, + "fid_input_iscd_1": { + "name": "fid_input_iscd_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드1 (ex. 123456)" + }, + "fid_cond_mrkt_div_code_2": { + "name": "fid_cond_mrkt_div_code_2", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드2" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드2" + }, + "fid_cond_mrkt_div_code_3": { + "name": "fid_cond_mrkt_div_code_3", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드3" + }, + "fid_input_iscd_3": { + "name": "fid_input_iscd_3", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드3" + }, + "fid_cond_mrkt_div_code_4": { + "name": "fid_cond_mrkt_div_code_4", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드4" + }, + "fid_input_iscd_4": { + "name": "fid_input_iscd_4", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드4" + }, + "fid_cond_mrkt_div_code_5": { + "name": "fid_cond_mrkt_div_code_5", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드5" + }, + "fid_input_iscd_5": { + "name": "fid_input_iscd_5", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드5" + }, + "fid_cond_mrkt_div_code_6": { + "name": "fid_cond_mrkt_div_code_6", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드6" + }, + "fid_input_iscd_6": { + "name": "fid_input_iscd_6", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드6" + }, + "fid_cond_mrkt_div_code_7": { + "name": "fid_cond_mrkt_div_code_7", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드7" + }, + "fid_input_iscd_7": { + "name": "fid_input_iscd_7", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드7" + }, + "fid_cond_mrkt_div_code_8": { + "name": "fid_cond_mrkt_div_code_8", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드8" + }, + "fid_input_iscd_8": { + "name": "fid_input_iscd_8", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드8" + }, + "fid_cond_mrkt_div_code_9": { + "name": "fid_cond_mrkt_div_code_9", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드9" + }, + "fid_input_iscd_9": { + "name": "fid_input_iscd_9", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드9" + }, + "fid_cond_mrkt_div_code_10": { + "name": "fid_cond_mrkt_div_code_10", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드10" + }, + "fid_input_iscd_10": { + "name": "fid_input_iscd_10", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드10" + }, + "fid_cond_mrkt_div_code_11": { + "name": "fid_cond_mrkt_div_code_11", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드11" + }, + "fid_input_iscd_11": { + "name": "fid_input_iscd_11", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드11" + }, + "fid_cond_mrkt_div_code_12": { + "name": "fid_cond_mrkt_div_code_12", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드12" + }, + "fid_input_iscd_12": { + "name": "fid_input_iscd_12", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드12" + }, + "fid_cond_mrkt_div_code_13": { + "name": "fid_cond_mrkt_div_code_13", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드13" + }, + "fid_input_iscd_13": { + "name": "fid_input_iscd_13", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드13" + }, + "fid_cond_mrkt_div_code_14": { + "name": "fid_cond_mrkt_div_code_14", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드14" + }, + "fid_input_iscd_14": { + "name": "fid_input_iscd_14", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드14" + }, + "fid_cond_mrkt_div_code_15": { + "name": "fid_cond_mrkt_div_code_15", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드15" + }, + "fid_input_iscd_15": { + "name": "fid_input_iscd_15", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드15" + }, + "fid_cond_mrkt_div_code_16": { + "name": "fid_cond_mrkt_div_code_16", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드16" + }, + "fid_input_iscd_16": { + "name": "fid_input_iscd_16", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드16" + }, + "fid_cond_mrkt_div_code_17": { + "name": "fid_cond_mrkt_div_code_17", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드17" + }, + "fid_input_iscd_17": { + "name": "fid_input_iscd_17", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드17" + }, + "fid_cond_mrkt_div_code_18": { + "name": "fid_cond_mrkt_div_code_18", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드18" + }, + "fid_input_iscd_18": { + "name": "fid_input_iscd_18", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드18" + }, + "fid_cond_mrkt_div_code_19": { + "name": "fid_cond_mrkt_div_code_19", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드19" + }, + "fid_input_iscd_19": { + "name": "fid_input_iscd_19", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드19" + }, + "fid_cond_mrkt_div_code_20": { + "name": "fid_cond_mrkt_div_code_20", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드20" + }, + "fid_input_iscd_20": { + "name": "fid_input_iscd_20", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드20" + }, + "fid_cond_mrkt_div_code_21": { + "name": "fid_cond_mrkt_div_code_21", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드21" + }, + "fid_input_iscd_21": { + "name": "fid_input_iscd_21", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드21" + }, + "fid_cond_mrkt_div_code_22": { + "name": "fid_cond_mrkt_div_code_22", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드22" + }, + "fid_input_iscd_22": { + "name": "fid_input_iscd_22", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드22" + }, + "fid_cond_mrkt_div_code_23": { + "name": "fid_cond_mrkt_div_code_23", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드23" + }, + "fid_input_iscd_23": { + "name": "fid_input_iscd_23", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드23" + }, + "fid_cond_mrkt_div_code_24": { + "name": "fid_cond_mrkt_div_code_24", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드24" + }, + "fid_input_iscd_24": { + "name": "fid_input_iscd_24", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드24" + }, + "fid_cond_mrkt_div_code_25": { + "name": "fid_cond_mrkt_div_code_25", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드25" + }, + "fid_input_iscd_25": { + "name": "fid_input_iscd_25", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드25" + }, + "fid_cond_mrkt_div_code_26": { + "name": "fid_cond_mrkt_div_code_26", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드26" + }, + "fid_input_iscd_26": { + "name": "fid_input_iscd_26", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드26" + }, + "fid_cond_mrkt_div_code_27": { + "name": "fid_cond_mrkt_div_code_27", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드27" + }, + "fid_input_iscd_27": { + "name": "fid_input_iscd_27", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드27" + }, + "fid_cond_mrkt_div_code_28": { + "name": "fid_cond_mrkt_div_code_28", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드28" + }, + "fid_input_iscd_28": { + "name": "fid_input_iscd_28", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드28" + }, + "fid_cond_mrkt_div_code_29": { + "name": "fid_cond_mrkt_div_code_29", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드29" + }, + "fid_input_iscd_29": { + "name": "fid_input_iscd_29", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드29" + }, + "fid_cond_mrkt_div_code_30": { + "name": "fid_cond_mrkt_div_code_30", + "type": "str", + "required": false, + "default_value": null, + "description": "조건 시장 분류 코드30" + }, + "fid_input_iscd_30": { + "name": "fid_input_iscd_30", + "type": "str", + "required": false, + "default_value": null, + "description": "입력 종목코드30" + } + } + }, + "psearch_result": { + "category": "[국내주식] 시세분석", + "name": "종목조건검색조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/psearch_result", + "method": "psearch_result", + "api_path": "/uapi/domestic-stock/v1/quotations/psearch-result", + "params": { + "user_id": { + "name": "user_id", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 사용자 HTS ID" + } + } + }, + "inquire_member_daily": { + "category": "[국내주식] 시세분석", + "name": "주식현재가 회원사 종목매매동향", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_member_daily", + "method": "inquire_member_daily", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-member-daily", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건시장분류코드 (J:KRX, NX:NXT)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력종목코드 (ex. 123456)" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 회원사코드 (ex. 회원사코드 FAQ 종목정보 다운로드(국내) > 회원사 참조)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력날짜1" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력날짜2" + }, + "fid_sctn_cls_code": { + "name": "fid_sctn_cls_code", + "type": "str", + "required": true, + "default_value": "", + "description": "데이터 순위 (초기값: \"\")" + } + } + }, + "psearch_title": { + "category": "[국내주식] 시세분석", + "name": "종목조건검색 목록조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/psearch_title", + "method": "psearch_title", + "api_path": "/uapi/domestic-stock/v1/quotations/psearch-title", + "params": { + "user_id": { + "name": "user_id", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 사용자 HTS ID (ex. U:업종)" + } + } + }, + "investor_trend_estimate": { + "category": "[국내주식] 시세분석", + "name": "종목별 외인기관 추정가집계", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/investor_trend_estimate", + "method": "investor_trend_estimate", + "api_path": "/uapi/domestic-stock/v1/quotations/investor-trend-estimate", + "params": { + "mksc_shrn_iscd": { + "name": "mksc_shrn_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + } + } + }, + "comp_program_trade_daily": { + "category": "[국내주식] 시세분석", + "name": "프로그램매매 종합현황(일별)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/comp_program_trade_daily", + "method": "comp_program_trade_daily", + "api_path": "/uapi/domestic-stock/v1/quotations/comp-program-trade-daily", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건시장분류코드 (ex. J:주식,NX:NXT,UN:통합)" + }, + "fid_mrkt_cls_code": { + "name": "fid_mrkt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장구분코드 (ex. K:코스피,Q:코스닥)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": "", + "description": "검색시작일" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": "", + "description": "검색종료일" + } + } + }, + "inquire_daily_trade_volume": { + "category": "[국내주식] 시세분석", + "name": "종목별일별매수매도체결량", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_trade_volume", + "method": "inquire_daily_trade_volume", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-daily-trade-volume", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 조건 시장 분류 코드 (J:KRX, NX:NXT)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 입력 종목코드 (ex. 123456)" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FID 기간 분류 코드 (ex. D)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": "", + "description": "FID 입력 날짜1" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": "", + "description": "FID 입력 날짜2" + } + } + }, + "intstock_stocklist_by_group": { + "category": "[국내주식] 시세분석", + "name": "관심종목 그룹별 종목조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/intstock_stocklist_by_group", + "method": "intstock_stocklist_by_group", + "api_path": "/uapi/domestic-stock/v1/quotations/intstock-stocklist-by-group", + "params": { + "type": { + "name": "type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 관심종목구분코드 (ex. 1)" + }, + "user_id": { + "name": "user_id", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 사용자 ID" + }, + "inter_grp_code": { + "name": "inter_grp_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 관심 그룹 코드 (ex. 001)" + }, + "fid_etc_cls_code": { + "name": "fid_etc_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기타 구분 코드 (ex. 4)" + }, + "data_rank": { + "name": "data_rank", + "type": "str", + "required": true, + "default_value": "", + "description": "데이터 순위" + }, + "inter_grp_name": { + "name": "inter_grp_name", + "type": "str", + "required": true, + "default_value": "", + "description": "관심 그룹 명" + }, + "hts_kor_isnm": { + "name": "hts_kor_isnm", + "type": "str", + "required": true, + "default_value": "", + "description": "HTS 한글 종목명" + }, + "cntg_cls_code": { + "name": "cntg_cls_code", + "type": "str", + "required": true, + "default_value": "", + "description": "체결 구분 코드" + } + } + }, + "inquire_investor_time_by_market": { + "category": "[국내주식] 시세분석", + "name": "시장별 투자자매매동향(시세)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_investor_time_by_market", + "method": "inquire_investor_time_by_market", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-investor-time-by-market", + "params": { + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장구분" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 업종구분" + } + } + }, + "program_trade_by_stock_daily": { + "category": "[국내주식] 시세분석", + "name": "종목별 프로그램매매추이(일별)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/program_trade_by_stock_daily", + "method": "program_trade_by_stock_daily", + "api_path": "/uapi/domestic-stock/v1/quotations/program-trade-by-stock-daily", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": "", + "description": "[필수] 입력날짜 (초기값: \"\")" + } + } + }, + "program_trade_by_stock": { + "category": "[국내주식] 시세분석", + "name": "종목별 프로그램매매추이(체결)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/program_trade_by_stock", + "method": "program_trade_by_stock", + "api_path": "/uapi/domestic-stock/v1/quotations/program-trade-by-stock", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + } + } + }, + "daily_short_sale": { + "category": "[국내주식] 시세분석", + "name": "국내주식 공매도 일별추이", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/daily_short_sale", + "method": "daily_short_sale", + "api_path": "/uapi/domestic-stock/v1/quotations/daily-short-sale", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장분류코드 (ex. J:주식)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": "", + "description": "시작일자" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": "", + "description": "종료일자" + } + } + }, + "frgnmem_trade_trend": { + "category": "[국내주식] 시세분석", + "name": "회원사 실시간 매매동향(틱)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/frgnmem_trade_trend", + "method": "frgnmem_trade_trend", + "api_path": "/uapi/domestic-stock/v1/quotations/frgnmem-trade-trend", + "params": { + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "20432(primary key)" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "J 고정입력" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "ex. 005930(삼성전자) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "ex. 99999(전체) ※ 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조)" + }, + "fid_mrkt_cls_code": { + "name": "fid_mrkt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "A(전체),K(코스피), Q(코스닥), K2(코스피200), W(ELW) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력" + }, + "fid_vol_cnt": { + "name": "fid_vol_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "거래량 ~" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "frgnmem_pchs_trend": { + "category": "[국내주식] 시세분석", + "name": "종목별 외국계 순매수추이", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/frgnmem_pchs_trend", + "method": "frgnmem_pchs_trend", + "api_path": "/uapi/domestic-stock/v1/quotations/frgnmem-pchs-trend", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 99999)" + } + } + }, + "foreign_institution_total": { + "category": "[국내주식] 시세분석", + "name": "국내기관_외국인 매매종목가집계", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/foreign_institution_total", + "method": "foreign_institution_total", + "api_path": "/uapi/domestic-stock/v1/quotations/foreign-institution-total", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. V)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건화면분류코드 (ex. 16449)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 0000:전체,0001:코스피,1001:코스닥,...,FAQ 종목정보 다운로드(국내) - 업종코드 참조 )" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 분류구분코드 (ex. 0:수량정열, 1:금액정열)" + }, + "fid_rank_sort_cls_code": { + "name": "fid_rank_sort_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 순위정렬구분코드 (ex. 0:순매수상위,1:순매도상위)" + }, + "fid_etc_cls_code": { + "name": "fid_etc_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기타구분정렬 (ex. 0:전체,1:외국인,2:기관계,3:기타)" + } + } + }, + "daily_loan_trans": { + "category": "[국내주식] 시세분석", + "name": "종목별 일별 대차거래추이", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/daily_loan_trans", + "method": "daily_loan_trans", + "api_path": "/uapi/domestic-stock/v1/quotations/daily-loan-trans", + "params": { + "mrkt_div_cls_code": { + "name": "mrkt_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (ex. 1:코스피,2:코스닥,3:종목)" + }, + "mksc_shrn_iscd": { + "name": "mksc_shrn_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 123456)" + }, + "start_date": { + "name": "start_date", + "type": "str", + "required": true, + "default_value": "", + "description": "시작일자" + }, + "end_date": { + "name": "end_date", + "type": "str", + "required": true, + "default_value": "", + "description": "종료일자" + } + } + }, + "inquire_investor_daily_by_market": { + "category": "[국내주식] 시세분석", + "name": "시장별 투자자매매동향(일별)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_investor_daily_by_market", + "method": "inquire_investor_daily_by_market", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-investor-daily-by-market", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. U:업종)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 0001)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 날짜1 (ex. 20250701)" + }, + "fid_input_iscd_1": { + "name": "fid_input_iscd_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. KSP:코스피, KSQ:코스닥)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 날짜1과 동일날짜 입력" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 업종분류코드)" + } + } + }, + "investor_program_trade_today": { + "category": "[국내주식] 시세분석", + "name": "프로그램매매 투자자매매동향(당일)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/investor_program_trade_today", + "method": "investor_program_trade_today", + "api_path": "/uapi/domestic-stock/v1/quotations/investor-program-trade-today", + "params": { + "mrkt_div_cls_code": { + "name": "mrkt_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시장 구분 코드 (ex. 1:코스피, 4:코스닥)" + } + } + }, + "news_title": { + "category": "[국내주식] 업종/기타", + "name": "종합 시황/공시(제목)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/news_title", + "method": "news_title", + "api_path": "/uapi/domestic-stock/v1/quotations/news-title", + "params": { + "fid_news_ofer_entp_code": { + "name": "fid_news_ofer_entp_code", + "type": "str", + "required": true, + "default_value": null, + "description": "뉴스 제공 업체 코드" + }, + "fid_cond_mrkt_cls_code": { + "name": "fid_cond_mrkt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건 시장 구분 코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 종목코드" + }, + "fid_titl_cntt": { + "name": "fid_titl_cntt", + "type": "str", + "required": true, + "default_value": null, + "description": "제목 내용" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 날짜" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 시간" + }, + "fid_rank_sort_cls_code": { + "name": "fid_rank_sort_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "순위 정렬 구분 코드" + }, + "fid_input_srno": { + "name": "fid_input_srno", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 일련번호" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_index_price": { + "category": "[국내주식] 업종/기타", + "name": "국내업종 현재지수", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_index_price", + "method": "inquire_index_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-index-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "업종(U)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "chk_holiday": { + "category": "[국내주식] 업종/기타", + "name": "국내휴장일조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/chk_holiday", + "method": "chk_holiday", + "api_path": "/uapi/domestic-stock/v1/quotations/chk-holiday", + "params": { + "bass_dt": { + "name": "bass_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 기준일자 (ex. YYYYMMDD)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_daily_indexchartprice": { + "category": "[국내주식] 업종/기타", + "name": "국내주식업종기간별시세(일/주/월/년)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_indexchartprice", + "method": "inquire_daily_indexchartprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "업종 : U" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "0001 : 종합 0002 : 대형주 ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "조회 시작일자 (ex. 20220501)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "조회 종료일자 (ex. 20220530)" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "D:일봉 W:주봉, M:월봉, Y:년봉" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "[추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real')" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_time_indexchartprice": { + "category": "[국내주식] 업종/기타", + "name": "업종 분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_time_indexchartprice", + "method": "inquire_time_indexchartprice", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-time-indexchartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 조건 시장 분류 코드" + }, + "fid_etc_cls_code": { + "name": "fid_etc_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 기타 구분 코드 (예: '0' 기본, '1' 장마감, 시간외 제외)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 입력 종목코드 (예: '0001' 종합, '0002' 대형주)" + }, + "fid_input_hour_1": { + "name": "fid_input_hour_1", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 입력 시간1 (예: '30', '60', '600', '3600')" + }, + "fid_pw_data_incu_yn": { + "name": "fid_pw_data_incu_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "FID 과거 데이터 포함 여부 (예: 'Y' 과거, 'N' 당일)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_vi_status": { + "category": "[국내주식] 업종/기타", + "name": "변동성완화장치(VI) 현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_vi_status", + "method": "inquire_vi_status", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-vi-status", + "params": { + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0:전체 1:상승 2:하락" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "20139" + }, + "fid_mrkt_cls_code": { + "name": "fid_mrkt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0:전체 K:거래소 Q:코스닥" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "fid_rank_sort_cls_code": { + "name": "fid_rank_sort_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0:전체 1:정적 2:동적 3:정적&동적" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "영업일" + }, + "fid_trgt_cls_code": { + "name": "fid_trgt_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 구분 코드" + }, + "fid_trgt_exls_cls_code": { + "name": "fid_trgt_exls_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "대상 제외 구분 코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_index_daily_price": { + "category": "[국내주식] 업종/기타", + "name": "국내업종 일자별지수", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_index_daily_price", + "method": "inquire_index_daily_price", + "api_path": "/uapi/domestic-stock/v1/quotations/inquire-index-daily-price", + "params": { + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "일/주/월 구분코드 ( D:일별 , W:주별, M:월별 )" + }, + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "시장구분코드 (업종 U)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 날짜(ex. 20240223)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "search_info": { + "category": "[국내주식] 종목정보", + "name": "상품기본조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/search_info", + "method": "search_info", + "api_path": "/uapi/domestic-stock/v1/quotations/search-info", + "params": { + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호 (예: '000660', 'KR4101SC0009', 'AAPL')" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "상품유형코드 (예: '300', '301', '512')" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: 공백)" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "search_stock_info": { + "category": "[국내주식] 종목정보", + "name": "주식기본조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/search_stock_info", + "method": "search_stock_info", + "api_path": "/uapi/domestic-stock/v1/quotations/search-stock-info", + "params": { + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "300: 주식, ETF, ETN, ELW 301 : 선물옵션 302 : 채권 306 : ELS'" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_balance": { + "category": "[국내주식] 주문/계좌", + "name": "주식잔고조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_balance", + "method": "inquire_balance", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-balance", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "afhr_flpr_yn": { + "name": "afhr_flpr_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시간외단일가·거래소여부 (ex. N:기본값, Y:시간외단일가, X:NXT)" + }, + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (ex. 01 – 대출일별 | 02 – 종목별)" + }, + "unpr_dvsn": { + "name": "unpr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 단가구분 (ex. 01)" + }, + "fund_sttl_icld_yn": { + "name": "fund_sttl_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 펀드결제분포함여부 (ex. N, Y)" + }, + "fncg_amt_auto_rdpt_yn": { + "name": "fncg_amt_auto_rdpt_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 융자금액자동상환여부 (ex. N)" + }, + "prcs_dvsn": { + "name": "prcs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 처리구분 (ex. 00: 전일매매포함, 01:전일매매미포함)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_daily_ccld": { + "category": "[국내주식] 주문/계좌", + "name": "주식일별주문체결조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_daily_ccld", + "method": "inquire_daily_ccld", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-daily-ccld", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "pd_dv": { + "name": "pd_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 3개월이전이내구분 (ex. before:이전, inner:이내)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 00 : 전체 / 01 : 매도 / 02 : 매수)" + }, + "ccld_dvsn": { + "name": "ccld_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 체결구분 (ex. 00 전체 / 01 체결 / 02 미체결)" + }, + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (ex. 00 역순 / 01 정순)" + }, + "inqr_dvsn_3": { + "name": "inqr_dvsn_3", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분3 (ex. 00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호" + }, + "ord_gno_brno": { + "name": "ord_gno_brno", + "type": "str", + "required": true, + "default_value": "", + "description": "주문채번지점번호" + }, + "odno": { + "name": "odno", + "type": "str", + "required": true, + "default_value": "", + "description": "주문번호 (ex. 주문시 한국투자증권 시스템에서 채번된 주문번호)" + }, + "inqr_dvsn_1": { + "name": "inqr_dvsn_1", + "type": "str", + "required": true, + "default_value": "", + "description": "조회구분1 (ex. 없음: 전체 / 1: ELW / 2: 프리보드)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "excg_id_dvsn_cd": { + "name": "excg_id_dvsn_cd", + "type": "str", + "required": false, + "default_value": "KRX" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_psbl_rvsecncl": { + "category": "[국내주식] 주문/계좌", + "name": "주식정정취소가능주문조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_psbl_rvsecncl", + "method": "inquire_psbl_rvsecncl", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_dvsn_1": { + "name": "inqr_dvsn_1", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분1 (ex. 0: 주문, 1: 종목)" + }, + "inqr_dvsn_2": { + "name": "inqr_dvsn_2", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분2 (ex. 0: 전체, 1: 매도, 2: 매수)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_psbl_order": { + "category": "[국내주식] 주문/계좌", + "name": "매수가능조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_psbl_order", + "method": "inquire_psbl_order", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-psbl-order", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (ex. 종목번호(6자리))" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가 (ex. 1주당 가격)" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분 (ex. 01 : 시장가)" + }, + "cma_evlu_amt_icld_yn": { + "name": "cma_evlu_amt_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] CMA평가금액포함여부 (ex. Y)" + }, + "ovrs_icld_yn": { + "name": "ovrs_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외포함여부 (ex. N)" + } + } + }, + "inquire_period_profit": { + "category": "[국내주식] 주문/계좌", + "name": "기간별손익일별합산조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_period_profit", + "method": "inquire_period_profit", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-period-profit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자" + }, + "sort_dvsn": { + "name": "sort_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정렬구분 (00: 최근 순, 01: 과거 순, 02: 최근 순)" + }, + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (00)" + }, + "cblc_dvsn": { + "name": "cblc_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 잔고구분 (00: 전체)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_balance_rlz_pl": { + "category": "[국내주식] 주문/계좌", + "name": "주식잔고조회_실현손익", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_balance_rlz_pl", + "method": "inquire_balance_rlz_pl", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "afhr_flpr_yn": { + "name": "afhr_flpr_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 시간외단일가여부 (N:기본값, Y:시간외단일가)" + }, + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (00:전체)" + }, + "unpr_dvsn": { + "name": "unpr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 단가구분 (01:기본값)" + }, + "fund_sttl_icld_yn": { + "name": "fund_sttl_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 펀드결제포함여부 (N:포함하지 않음, Y:포함)" + }, + "fncg_amt_auto_rdpt_yn": { + "name": "fncg_amt_auto_rdpt_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 융자금액자동상환여부 (N:기본값)" + }, + "prcs_dvsn": { + "name": "prcs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] PRCS_DVSN (00:전일매매포함, 01:전일매매미포함)" + }, + "ofl_yn": { + "name": "ofl_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "오프라인여부" + }, + "cost_icld_yn": { + "name": "cost_icld_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "비용포함여부" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_psbl_sell": { + "category": "[국내주식] 주문/계좌", + "name": "매도가능수량조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_psbl_sell", + "method": "inquire_psbl_sell", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-psbl-sell", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "보유종목 코드 ex)000660" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "order_rvsecncl": { + "category": "[국내주식] 주문/계좌", + "name": "주식주문(정정취소)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_rvsecncl", + "method": "order_rvsecncl", + "api_path": "/uapi/domestic-stock/v1/trading/order-rvsecncl", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "krx_fwdg_ord_orgno": { + "name": "krx_fwdg_ord_orgno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 한국거래소전송주문조직번호" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 원주문번호" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정정취소구분코드 (ex. 01:정정,02:취소)" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가" + }, + "qty_all_ord_yn": { + "name": "qty_all_ord_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 잔량전부주문여부 (ex. Y:전량, N:일부)" + }, + "excg_id_dvsn_cd": { + "name": "excg_id_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소ID구분코드 (ex. KRX: 한국거래소, NXT:대체거래소,SOR:SOR)" + }, + "cndt_pric": { + "name": "cndt_pric", + "type": "str", + "required": false, + "default_value": "", + "description": "조건가격" + } + } + }, + "order_cash": { + "category": "[국내주식] 주문/계좌", + "name": "주식주문(현금)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_cash", + "method": "order_cash", + "api_path": "/uapi/domestic-stock/v1/trading/order-cash", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (real:실전, demo:모의)" + }, + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분 (buy:매수, sell:매도)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (종목코드(6자리) , ETN의 경우 7자리 입력)" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가" + }, + "excg_id_dvsn_cd": { + "name": "excg_id_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소ID구분코드 (KRX)" + }, + "sll_type": { + "name": "sll_type", + "type": "str", + "required": true, + "default_value": "", + "description": "매도유형 (매도주문 시) (01:일반매도,02:임의매매,05:대차매도)" + }, + "cndt_pric": { + "name": "cndt_pric", + "type": "str", + "required": true, + "default_value": "", + "description": "조건가격 (스탑지정가호가 주문 시 사용)" + } + } + }, + "intgr_margin": { + "category": "[국내주식] 주문/계좌", + "name": "주식통합증거금 현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/intgr_margin", + "method": "intgr_margin", + "api_path": "/uapi/domestic-stock/v1/trading/intgr-margin", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "cma_evlu_amt_icld_yn": { + "name": "cma_evlu_amt_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] CMA평가금액포함여부 (ex. Y: 포함, N: 미포함)" + }, + "wcrc_frcr_dvsn_cd": { + "name": "wcrc_frcr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 원화외화구분코드 (ex. 01: 외화기준, 02: 원화기준)" + }, + "fwex_ctrt_frcr_dvsn_cd": { + "name": "fwex_ctrt_frcr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 선도환계약외화구분코드 (ex. 01: 외화기준, 02: 원화기준)" + } + } + }, + "inquire_period_trade_profit": { + "category": "[국내주식] 주문/계좌", + "name": "기간별매매손익현황조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_period_trade_profit", + "method": "inquire_period_trade_profit", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-period-trade-profit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "sort_dvsn": { + "name": "sort_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 정렬구분 (ex. 00: 최근, 01:과거, 02:최근)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자" + }, + "cblc_dvsn": { + "name": "cblc_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 잔고구분 (ex. 00: 전체)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_account_balance": { + "category": "[국내주식] 주문/계좌", + "name": "투자계좌자산현황조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_account_balance", + "method": "inquire_account_balance", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-account-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_dvsn_1": { + "name": "inqr_dvsn_1", + "type": "str", + "required": true, + "default_value": "", + "description": "조회구분1" + }, + "bspr_bf_dt_aply_yn": { + "name": "bspr_bf_dt_aply_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "기준가이전일자적용여부" + } + } + }, + "pension_inquire_balance": { + "category": "[국내주식] 주문/계좌", + "name": "퇴직연금 잔고조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/pension_inquire_balance", + "method": "pension_inquire_balance", + "api_path": "/uapi/domestic-stock/v1/trading/pension/inquire-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "acca_dvsn_cd": { + "name": "acca_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 적립금구분코드 (ex. 00)" + }, + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (ex. 00)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "pension_inquire_psbl_order": { + "category": "[국내주식] 주문/계좌", + "name": "퇴직연금 매수가능조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/pension_inquire_psbl_order", + "method": "pension_inquire_psbl_order", + "api_path": "/uapi/domestic-stock/v1/trading/pension/inquire-psbl-order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (ex. 123456)" + }, + "acca_dvsn_cd": { + "name": "acca_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 적립금구분코드 (ex. 00)" + }, + "cma_evlu_amt_icld_yn": { + "name": "cma_evlu_amt_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] CMA평가금액포함여부 (ex. Y:포함, N:미포함)" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분 (ex. 00: 지정가, 01: 시장가)" + } + } + }, + "order_credit": { + "category": "[국내주식] 주문/계좌", + "name": "주식주문(신용)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_credit", + "method": "order_credit", + "api_path": "/uapi/domestic-stock/v1/trading/order-credit", + "params": { + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매수매도구분 (ex. buy:매수, sell:매도)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (ex. 123456)" + }, + "crdt_type": { + "name": "crdt_type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 신용유형 (ex. [매도] 22:유통대주신규, 24:자기대주신규, 25:자기융자상환, 27:유통융자상환 / [매수] 21:자기융자신규, 23:유통융자신규 , 26:유통대주상환, 28:자기대주상환)" + }, + "loan_dt": { + "name": "loan_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 대출일자 (ex. [신용매수] 오늘날짜(yyyyMMdd), [신용매도] 매도할 종목의 대출일자(yyyyMMdd))" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가" + }, + "excg_id_dvsn_cd": { + "name": "excg_id_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "거래소ID구분코드 (ex. KRX:한국거래소, NXT:넥스트레이드, SOR:SOR)" + }, + "sll_type": { + "name": "sll_type", + "type": "str", + "required": true, + "default_value": "", + "description": "매도유형" + }, + "rsvn_ord_yn": { + "name": "rsvn_ord_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "예약주문여부 (ex. Y: 예약주문, N: 신용주문)" + }, + "emgc_ord_yn": { + "name": "emgc_ord_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "비상주문여부" + }, + "pgtr_dvsn": { + "name": "pgtr_dvsn", + "type": "str", + "required": true, + "default_value": "", + "description": "프로그램매매구분" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "운용사지정주문번호" + }, + "lqty_tr_ngtn_dtl_no": { + "name": "lqty_tr_ngtn_dtl_no", + "type": "str", + "required": true, + "default_value": "", + "description": "대량거래협상상세번호" + }, + "lqty_tr_agmt_no": { + "name": "lqty_tr_agmt_no", + "type": "str", + "required": true, + "default_value": "", + "description": "대량거래협정번호" + }, + "lqty_tr_ngtn_id": { + "name": "lqty_tr_ngtn_id", + "type": "str", + "required": true, + "default_value": "", + "description": "대량거래협상자Id" + }, + "lp_ord_yn": { + "name": "lp_ord_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "LP주문여부" + }, + "mdia_odno": { + "name": "mdia_odno", + "type": "str", + "required": true, + "default_value": "", + "description": "매체주문번호" + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "주문서버구분코드" + }, + "pgm_nmpr_stmt_dvsn_cd": { + "name": "pgm_nmpr_stmt_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "프로그램호가신고구분코드" + }, + "cvrg_slct_rson_cd": { + "name": "cvrg_slct_rson_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "반대매매선정사유코드" + }, + "cvrg_seq": { + "name": "cvrg_seq", + "type": "str", + "required": true, + "default_value": "", + "description": "반대매매순번" + }, + "cndt_pric": { + "name": "cndt_pric", + "type": "str", + "required": true, + "default_value": "", + "description": "조건가격" + } + } + }, + "inquire_credit_psamount": { + "category": "[국내주식] 주문/계좌", + "name": "신용매수가능조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/inquire_credit_psamount", + "method": "inquire_credit_psamount", + "api_path": "/uapi/domestic-stock/v1/trading/inquire-credit-psamount", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분 (ex. 00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 03 : 최유리지정가, 04 : 최우선지정가, 05 : 장전 시간외, 06 : 장후 시간외, 07 : 시간외 단일가 등)" + }, + "crdt_type": { + "name": "crdt_type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 신용유형 (ex. 21 : 자기융자신규, 23 : 유통융자신규, 26 : 유통대주상환, 28 : 자기대주상환, 25 : 자기융자상환, 27 : 유통융자상환, 22 : 유통대주신규, 24 : 자기대주신규)" + }, + "cma_evlu_amt_icld_yn": { + "name": "cma_evlu_amt_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] CMA평가금액포함여부" + }, + "ovrs_icld_yn": { + "name": "ovrs_icld_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외포함여부" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": "", + "description": "주문단가 (ex. 1주당 가격. 장전/장후 시간외, 시장가의 경우 \"0\" 입력 권고)" + } + } + }, + "order_resv": { + "category": "[국내주식] 주문/계좌", + "name": "주식예약주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_resv", + "method": "order_resv", + "api_path": "/uapi/domestic-stock/v1/trading/order-resv", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드(6자리)" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문수량 (주0문주식수)" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문단가 (1주당 가격, 시장가/장전 시간외는 0 입력)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (01 : 매도, 02 : 매수)" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분코드 (00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외)" + }, + "ord_objt_cblc_dvsn_cd": { + "name": "ord_objt_cblc_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문대상잔고구분코드 (10: 현금, 12~28: 각종 대출/상환코드)" + }, + "loan_dt": { + "name": "loan_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "대출일자" + }, + "rsvn_ord_end_dt": { + "name": "rsvn_ord_end_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "예약주문종료일자 (YYYYMMDD, 익영업일부터 최대 30일 이내)" + }, + "ldng_dt": { + "name": "ldng_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "대여일자" + } + } + }, + "pension_inquire_daily_ccld": { + "category": "[국내주식] 주문/계좌", + "name": "퇴직연금 미체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/pension_inquire_daily_ccld", + "method": "pension_inquire_daily_ccld", + "api_path": "/uapi/domestic-stock/v1/trading/pension/inquire-daily-ccld", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "user_dvsn_cd": { + "name": "user_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 사용자구분코드 (ex. %%)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분코드 (ex. 00: 전체, 01: 매도, 02: 매수)" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 체결미체결구분 (ex. %%: 전체, 01: 체결, 02: 미체결)" + }, + "inqr_dvsn_3": { + "name": "inqr_dvsn_3", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분3 (ex. 00: 전체)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order_resv_ccnl": { + "category": "[국내주식] 주문/계좌", + "name": "주식예약주문조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_resv_ccnl", + "method": "order_resv_ccnl", + "api_path": "/uapi/domestic-stock/v1/trading/order-resv-ccnl", + "params": { + "rsvn_ord_ord_dt": { + "name": "rsvn_ord_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 예약주문시작일자" + }, + "rsvn_ord_end_dt": { + "name": "rsvn_ord_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 예약주문종료일자" + }, + "tmnl_mdia_kind_cd": { + "name": "tmnl_mdia_kind_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 단말매체종류코드 (ex. 00)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "prcs_dvsn_cd": { + "name": "prcs_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 처리구분코드 (ex. 0)" + }, + "cncl_yn": { + "name": "cncl_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 취소여부 (ex. Y)" + }, + "rsvn_ord_seq": { + "name": "rsvn_ord_seq", + "type": "str", + "required": true, + "default_value": "", + "description": "예약주문순번" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호 (ex. 005930)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "매도매수구분코드 (ex. 01)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "period_rights": { + "category": "[국내주식] 주문/계좌", + "name": "기간별계좌권리현황조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/period_rights", + "method": "period_rights", + "api_path": "/uapi/domestic-stock/v1/trading/period-rights", + "params": { + "inqr_dvsn": { + "name": "inqr_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분 (ex. 03)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자 (ex. 20250101)" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자 (ex. 20250103)" + }, + "cust_rncno25": { + "name": "cust_rncno25", + "type": "str", + "required": true, + "default_value": "", + "description": "고객실명확인번호25" + }, + "hmid": { + "name": "hmid", + "type": "str", + "required": true, + "default_value": "", + "description": "홈넷ID" + }, + "rght_type_cd": { + "name": "rght_type_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "권리유형코드" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "상품유형코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "pension_inquire_deposit": { + "category": "[국내주식] 주문/계좌", + "name": "퇴직연금 예수금조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/pension_inquire_deposit", + "method": "pension_inquire_deposit", + "api_path": "/uapi/domestic-stock/v1/trading/pension/inquire-deposit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "acca_dvsn_cd": { + "name": "acca_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 적립금구분코드 (ex. 00)" + } + } + }, + "pension_inquire_present_balance": { + "category": "[국내주식] 주문/계좌", + "name": "퇴직연금 체결기준잔고", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/pension_inquire_present_balance", + "method": "pension_inquire_present_balance", + "api_path": "/uapi/domestic-stock/v1/trading/pension/inquire-present-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "user_dvsn_cd": { + "name": "user_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호 (ex. '00')" + } + } + }, + "order_resv_rvsecncl": { + "category": "[국내주식] 주문/계좌", + "name": "주식예약주문정정취소", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/order_resv_rvsecncl", + "method": "order_resv_rvsecncl", + "api_path": "/uapi/domestic-stock/v1/trading/order-resv-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "rsvn_ord_seq": { + "name": "rsvn_ord_seq", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 예약주문순번" + }, + "rsvn_ord_orgno": { + "name": "rsvn_ord_orgno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 예약주문조직번호" + }, + "rsvn_ord_ord_dt": { + "name": "rsvn_ord_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 예약주문주문일자" + }, + "ord_type": { + "name": "ord_type", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 주문구분 (ex. cancel:취소, modify:정정)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": false, + "default_value": "", + "description": "주문수량" + }, + "ord_unpr": { + "name": "ord_unpr", + "type": "str", + "required": false, + "default_value": "", + "description": "주문단가" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "매도매수구분코드 (ex. 01:매도, 02:매수)" + }, + "ord_dvsn_cd": { + "name": "ord_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "주문구분코드 (ex. 00:지정가, 01:시장가, 02:조건부지정가, 05:장전 시간외)" + }, + "ord_objt_cblc_dvsn_cd": { + "name": "ord_objt_cblc_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "주문대상잔고구분코드 (ex. 10 : 현금, 12 : 주식담보대출, ... 28 : 자기대주상환)" + }, + "loan_dt": { + "name": "loan_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "대출일자" + }, + "rsvn_ord_end_dt": { + "name": "rsvn_ord_end_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "예약주문종료일자" + }, + "ctal_tlno": { + "name": "ctal_tlno", + "type": "str", + "required": false, + "default_value": "", + "description": "연락전화번호" + } + } + }, + "invest_opbysec": { + "category": "[국내주식] 종목정보", + "name": "국내주식 증권사별 투자의견", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/invest_opbysec", + "method": "invest_opbysec", + "api_path": "/uapi/domestic-stock/v1/quotations/invest-opbysec", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "J(시장 구분 코드)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "16634(Primary key)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조)" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "전체(0) 매수(1) 중립(2) 매도(3)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "이후 ~" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "~ 이전" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "invest_opinion": { + "category": "[국내주식] 종목정보", + "name": "국내주식 종목투자의견", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/invest_opinion", + "method": "invest_opinion", + "api_path": "/uapi/domestic-stock/v1/quotations/invest-opinion", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "J(시장 구분 코드)" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "16633(Primary key)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드(ex) 005930(삼성전자))" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "이후 ~(ex) 0020231113)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "~ 이전(ex) 0020240513)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "estimate_perform": { + "category": "[국내주식] 종목정보", + "name": "국내주식 종목추정실적", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/estimate_perform", + "method": "estimate_perform", + "api_path": "/uapi/domestic-stock/v1/quotations/estimate-perform", + "params": { + "sht_cd": { + "name": "sht_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드 (예: 265520)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output3)" + }, + "dataframe4": { + "name": "dataframe4", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output4)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "investor_trade_by_stock_daily": { + "category": "[국내주식] 시세분석", + "name": "종목별 투자자매매동향(일별)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/domestic_stock/investor_trade_by_stock_daily", + "method": "investor_trade_by_stock_daily", + "api_path": "/uapi/domestic-stock/v1/quotations/investor-trade-by-stock-daily", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "J:KRX, NX:NXT, UN:통합" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목번호 (6자리)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력 날짜(20250812)" + }, + "fid_org_adj_prc": { + "name": "fid_org_adj_prc", + "type": "str", + "required": true, + "default_value": "", + "description": "공란 입력" + }, + "fid_etc_cls_code": { + "name": "fid_etc_cls_code", + "type": "str", + "required": true, + "default_value": "", + "description": "공란 입력" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/elw.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/elw.json new file mode 100644 index 0000000..d17a7d0 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/elw.json @@ -0,0 +1,172 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 ELW OPEN API를 활용합니다.", + "introduce_append": "이 도구는 ELW 관련 시세 정보를 제공합니다.", + "examples": [ + { + "api_type": "volume_rank", + "params": { + "fid_cond_mrkt_div_code": "W", + "fid_cond_scr_div_code": "20278", + "fid_unas_input_iscd": "000000", + "fid_input_iscd": "00000", + "fid_input_rmnn_dynu_1": "", + "fid_div_cls_code": "0", + "fid_input_price_1": "1000", + "fid_input_price_2": "5000", + "fid_input_vol_1": "100", + "fid_input_vol_2": "1000", + "fid_input_date_1": "20230101", + "fid_rank_sort_cls_code": "0", + "fid_blng_cls_code": "0", + "fid_input_iscd_2": "0000", + "fid_input_date_2": "" + } + } + ] + }, + "apis": { + "volume_rank": { + "category": "[국내주식] ELW시세", + "name": "ELW 거래량순위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/elw/volume_rank", + "method": "volume_rank", + "api_path": "/uapi/elw/v1/ranking/volume-rank", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건시장분류코드" + }, + "fid_cond_scr_div_code": { + "name": "fid_cond_scr_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "조건화면분류코드" + }, + "fid_unas_input_iscd": { + "name": "fid_unas_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "기초자산입력종목코드" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "발행사" + }, + "fid_input_rmnn_dynu_1": { + "name": "fid_input_rmnn_dynu_1", + "type": "str", + "required": true, + "default_value": null, + "description": "입력잔존일수" + }, + "fid_div_cls_code": { + "name": "fid_div_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "콜풋구분코드" + }, + "fid_input_price_1": { + "name": "fid_input_price_1", + "type": "str", + "required": true, + "default_value": null, + "description": "가격(이상)" + }, + "fid_input_price_2": { + "name": "fid_input_price_2", + "type": "str", + "required": true, + "default_value": null, + "description": "가격(이하)" + }, + "fid_input_vol_1": { + "name": "fid_input_vol_1", + "type": "str", + "required": true, + "default_value": null, + "description": "거래량(이상)" + }, + "fid_input_vol_2": { + "name": "fid_input_vol_2", + "type": "str", + "required": true, + "default_value": null, + "description": "거래량(이하)" + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기준일" + }, + "fid_rank_sort_cls_code": { + "name": "fid_rank_sort_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "순위정렬구분코드" + }, + "fid_blng_cls_code": { + "name": "fid_blng_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "소속구분코드" + }, + "fid_input_iscd_2": { + "name": "fid_input_iscd_2", + "type": "str", + "required": true, + "default_value": null, + "description": "LP발행사" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "만기일-최종거래일조회" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/etfetn.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/etfetn.json new file mode 100644 index 0000000..f7e6ccc --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/etfetn.json @@ -0,0 +1,70 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 ETF/ETN OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "inquire_price", + "params": { + "fid_cond_mrkt_div_code": "J", + "fid_input_iscd": "123456" + } + }, + { + "api_type": "nav_comparison_trend", + "params": { + "fid_cond_mrkt_div_code": "J", + "fid_input_iscd": "069500" + } + } + ] + }, + "apis": { + "inquire_price": { + "category": "[국내주식] 기본시세", + "name": "ETF/ETN 현재가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/etfetn/inquire_price", + "method": "inquire_price", + "api_path": "/uapi/etfetn/v1/quotations/inquire-price", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드 (ex. 123456)" + } + } + }, + "nav_comparison_trend": { + "category": "[국내주식] 기본시세", + "name": "NAV 비교추이(종목)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/etfetn/nav_comparison_trend", + "method": "nav_comparison_trend", + "api_path": "/uapi/etfetn/v1/quotations/nav-comparison-trend", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조건 시장 분류 코드 (ex. J)" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 입력 종목코드" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_futureoption.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_futureoption.json new file mode 100644 index 0000000..4920923 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_futureoption.json @@ -0,0 +1,1670 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 해외선물옵션 OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "inquire_time_futurechartprice", + "params": { + "srs_cd": "BONU25", + "exch_cd": "EUREX", + "start_date_time": "20250101", + "close_date_time": "20250702", + "qry_tp": "Q", + "qry_cnt": "120", + "qry_gap": "1", + "index_key": "" + } + }, + { + "api_type": "inquire_price", + "params": { + "srs_cd": "CNHU24" + } + } + ] + }, + "apis": { + "inquire_time_futurechartprice": { + "category": "[해외선물옵션] 기본시세", + "name": "해외선물 분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_time_futurechartprice", + "method": "inquire_time_futurechartprice", + "api_path": "/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "ex) CNHU24 ※ 종목코드 \"포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물\" 참고" + }, + "exch_cd": { + "name": "exch_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "CME" + }, + "start_date_time": { + "name": "start_date_time", + "type": "str", + "required": true, + "default_value": null, + "description": "공백" + }, + "close_date_time": { + "name": "close_date_time", + "type": "str", + "required": true, + "default_value": null, + "description": "ex) 20230823" + }, + "qry_tp": { + "name": "qry_tp", + "type": "str", + "required": true, + "default_value": null, + "description": "Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시" + }, + "qry_cnt": { + "name": "qry_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "120 (조회갯수)" + }, + "qry_gap": { + "name": "qry_gap", + "type": "str", + "required": true, + "default_value": null, + "description": "5 (분간격)" + }, + "index_key": { + "name": "index_key", + "type": "str", + "required": true, + "default_value": null, + "description": "다음조회(QRY_TP를 P로 입력) 시, 이전 호출의 \"output1 > index_key\" 기입하여 조회" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_price": { + "category": "[해외선물옵션] 기본시세", + "name": "해외선물종목현재가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_price", + "method": "inquire_price", + "api_path": "/uapi/overseas-futureoption/v1/quotations/inquire-price", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드 (예: CNHU24)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "opt_asking_price": { + "category": "[해외선물옵션] 기본시세", + "name": "해외옵션 호가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/opt_asking_price", + "method": "opt_asking_price", + "api_path": "/uapi/overseas-futureoption/v1/quotations/opt-asking-price", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목명" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "daily_ccnl": { + "category": "[해외선물옵션] 기본시세", + "name": "해외선물 체결추이(일간)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/daily_ccnl", + "method": "daily_ccnl", + "api_path": "/uapi/overseas-futureoption/v1/quotations/daily-ccnl", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드 (예: 6AM24)" + }, + "exch_cd": { + "name": "exch_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "거래소코드 (예: CME)" + }, + "start_date_time": { + "name": "start_date_time", + "type": "str", + "required": true, + "default_value": null, + "description": "조회시작일시 (공백)" + }, + "close_date_time": { + "name": "close_date_time", + "type": "str", + "required": true, + "default_value": null, + "description": "조회종료일시 (예: 20240402)" + }, + "qry_tp": { + "name": "qry_tp", + "type": "str", + "required": true, + "default_value": null, + "description": "조회구분 (Q: 최초조회시, P: 다음키(INDEX_KEY) 입력하여 조회시)" + }, + "qry_cnt": { + "name": "qry_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "요청개수 (예: 30, 최대 40)" + }, + "qry_gap": { + "name": "qry_gap", + "type": "str", + "required": true, + "default_value": null, + "description": "묶음개수 (공백, 분만 사용)" + }, + "index_key": { + "name": "index_key", + "type": "str", + "required": true, + "default_value": null, + "description": "이전조회KEY (공백)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "search_opt_detail": { + "category": "[해외선물옵션] 기본시세", + "name": "해외옵션 상품기본정보", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/search_opt_detail", + "method": "search_opt_detail", + "api_path": "/uapi/overseas-futureoption/v1/quotations/search-opt-detail", + "params": { + "qry_cnt": { + "name": "qry_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 요청개수 (ex. SRS_CD_N 개수)" + }, + "srs_cd_01": { + "name": "srs_cd_01", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드1" + }, + "srs_cd_02": { + "name": "srs_cd_02", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드2" + }, + "srs_cd_03": { + "name": "srs_cd_03", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드3" + }, + "srs_cd_04": { + "name": "srs_cd_04", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드4" + }, + "srs_cd_05": { + "name": "srs_cd_05", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드5" + }, + "srs_cd_06": { + "name": "srs_cd_06", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드6" + }, + "srs_cd_07": { + "name": "srs_cd_07", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드7" + }, + "srs_cd_08": { + "name": "srs_cd_08", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드8" + }, + "srs_cd_09": { + "name": "srs_cd_09", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드9" + }, + "srs_cd_10": { + "name": "srs_cd_10", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드10" + }, + "srs_cd_11": { + "name": "srs_cd_11", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드11" + }, + "srs_cd_12": { + "name": "srs_cd_12", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드12" + }, + "srs_cd_13": { + "name": "srs_cd_13", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드13" + }, + "srs_cd_14": { + "name": "srs_cd_14", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드14" + }, + "srs_cd_15": { + "name": "srs_cd_15", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드15" + }, + "srs_cd_16": { + "name": "srs_cd_16", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드16" + }, + "srs_cd_17": { + "name": "srs_cd_17", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드17" + }, + "srs_cd_18": { + "name": "srs_cd_18", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드18" + }, + "srs_cd_19": { + "name": "srs_cd_19", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드19" + }, + "srs_cd_20": { + "name": "srs_cd_20", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드20" + }, + "srs_cd_21": { + "name": "srs_cd_21", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드21" + }, + "srs_cd_22": { + "name": "srs_cd_22", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드22" + }, + "srs_cd_23": { + "name": "srs_cd_23", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드23" + }, + "srs_cd_24": { + "name": "srs_cd_24", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드24" + }, + "srs_cd_25": { + "name": "srs_cd_25", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드25" + }, + "srs_cd_26": { + "name": "srs_cd_26", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드26" + }, + "srs_cd_27": { + "name": "srs_cd_27", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드27" + }, + "srs_cd_28": { + "name": "srs_cd_28", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드28" + }, + "srs_cd_29": { + "name": "srs_cd_29", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드29" + }, + "srs_cd_30": { + "name": "srs_cd_30", + "type": "str", + "required": false, + "default_value": "", + "description": "종목코드30" + } + } + }, + "opt_price": { + "category": "[해외선물옵션] 기본시세", + "name": "해외옵션종목현재가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/opt_price", + "method": "opt_price", + "api_path": "/uapi/overseas-futureoption/v1/quotations/opt-price", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드" + } + } + }, + "inquire_asking_price": { + "category": "[해외선물옵션] 기본시세", + "name": "해외선물 호가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_asking_price", + "method": "inquire_asking_price", + "api_path": "/uapi/overseas-futureoption/v1/quotations/inquire-asking-price", + "params": { + "srs_cd": { + "name": "srs_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "search_contract_detail": { + "category": "[해외선물옵션] 기본시세", + "name": "해외선물 상품기본정보", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/search_contract_detail", + "method": "search_contract_detail", + "api_path": "/uapi/overseas-futureoption/v1/quotations/search-contract-detail", + "params": { + "qry_cnt": { + "name": "qry_cnt", + "type": "str", + "required": true, + "default_value": null, + "description": "입력한 코드 개수" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)\n **kwargs: srs_cd_01, srs_cd_02, ... srs_cd_32 품목종류 코드들" + } + } + }, + "inquire_ccld": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 당일주문내역조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_ccld", + "method": "inquire_ccld", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-ccld", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "01:전체 / 02:체결 / 03:미체결" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "%%:전체 / 01:매도 / 02:매수" + }, + "fuop_dvsn": { + "name": "fuop_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "00:전체 / 01:선물 / 02:옵션" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_unpd": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 미결제내역조회(잔고)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_unpd", + "method": "inquire_unpd", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-unpd", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "fuop_dvsn": { + "name": "fuop_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "00: 전체 / 01:선물 / 02: 옵션" + }, + "ctx_area_fk100": { + "name": "ctx_area_fk100", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건100" + }, + "ctx_area_nk100": { + "name": "ctx_area_nk100", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키100" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_deposit": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 예수금현황", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_deposit", + "method": "inquire_deposit", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-deposit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남" + }, + "inqr_dt": { + "name": "inqr_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회일자 (YYYYMMDD 형식)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_psamount": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 주문가능조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_psamount", + "method": "inquire_psamount", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-psamount", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_futr_fx_pdno": { + "name": "ovrs_futr_fx_pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "해외선물FX상품번호" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 매도 / 02 : 매수" + }, + "fm_ord_pric": { + "name": "fm_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "FM주문가격" + }, + "ecis_rsvn_ord_yn": { + "name": "ecis_rsvn_ord_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "행사예약주문여부" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_daily_order": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 일별 주문내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_daily_order", + "method": "inquire_daily_order", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-daily-order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "strt_dt": { + "name": "strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "시작일자 (YYYYMMDD)" + }, + "end_dt": { + "name": "end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "종료일자 (YYYYMMDD)" + }, + "fm_pdgr_cd": { + "name": "fm_pdgr_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "FM상품군코드" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "체결미체결구분 (01:전체 / 02:체결 / 03:미체결)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "매도매수구분코드 (%%전체 / 01:매도 / 02:매수)" + }, + "fuop_dvsn": { + "name": "fuop_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "선물옵션구분 (00:전체 / 01:선물 / 02:옵션)" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_daily_ccld": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 일별 체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_daily_ccld", + "method": "inquire_daily_ccld", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-daily-ccld", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "strt_dt": { + "name": "strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "시작일자(YYYYMMDD)" + }, + "end_dt": { + "name": "end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "종료일자(YYYYMMDD)" + }, + "fuop_dvsn_cd": { + "name": "fuop_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "00:전체 / 01:선물 / 02:옵션" + }, + "fm_pdgr_cd": { + "name": "fm_pdgr_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "공란(Default)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남" + }, + "fm_item_ftng_yn": { + "name": "fm_item_ftng_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "\"N\"(Default)" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "%%: 전체 / 01 : 매도 / 02 : 매수" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_period_ccld": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 기간계좌손익 일별", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_period_ccld", + "method": "inquire_period_ccld", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-period-ccld", + "params": { + "inqr_term_from_dt": { + "name": "inqr_term_from_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기간FROM일자" + }, + "inqr_term_to_dt": { + "name": "inqr_term_to_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기간TO일자" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "'%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본'" + }, + "whol_trsl_yn": { + "name": "whol_trsl_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "전체환산여부" + }, + "fuop_dvsn": { + "name": "fuop_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "00:전체 / 01:선물 / 02:옵션" + }, + "ctx_area_fk200": { + "name": "ctx_area_fk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건200" + }, + "ctx_area_nk200": { + "name": "ctx_area_nk200", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키200" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "order_rvsecncl": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 정정취소주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/order_rvsecncl", + "method": "order_rvsecncl", + "api_path": "/uapi/overseas-futureoption/v1/trading/order-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "주문구분 (0:정정, 1:취소)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "orgn_ord_dt": { + "name": "orgn_ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "원 주문 시 출력되는 ORD_DT 값을 입력 (현지거래일)" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "정정/취소시 주문번호(ODNO) 8자리를 문자열처럼 \"0\"을 포함해서 전송 (원 주문 시 출력된 ODNO 값 활용) (ex. ORGN_ODNO : 00360686)" + }, + "fm_limit_ord_pric": { + "name": "fm_limit_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "OTFM3002U(해외선물옵션주문정정)만 사용" + }, + "fm_stop_ord_pric": { + "name": "fm_stop_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "OTFM3002U(해외선물옵션주문정정)만 사용" + }, + "fm_lqd_lmt_ord_pric": { + "name": "fm_lqd_lmt_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "OTFM3002U(해외선물옵션주문정정)만 사용" + }, + "fm_lqd_stop_ord_pric": { + "name": "fm_lqd_stop_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "OTFM3002U(해외선물옵션주문정정)만 사용" + }, + "fm_hdge_ord_scrn_yn": { + "name": "fm_hdge_ord_scrn_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "N" + }, + "fm_mkpr_cvsn_yn": { + "name": "fm_mkpr_cvsn_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "OTFM3003U(해외선물옵션주문취소)만 사용 ※ FM_MKPR_CVSN_YN 항목에 'Y'로 설정하여 취소주문을 접수할 경우, 주문 취소확인이 들어오면 원장에서 시장가주문을 하나 또 내줌" + } + } + }, + "inquire_period_trans": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 기간계좌거래내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/inquire_period_trans", + "method": "inquire_period_trans", + "api_path": "/uapi/overseas-futureoption/v1/trading/inquire-period-trans", + "params": { + "inqr_term_from_dt": { + "name": "inqr_term_from_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기간FROM일자" + }, + "inqr_term_to_dt": { + "name": "inqr_term_to_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기간TO일자" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_tr_type_cd": { + "name": "acnt_tr_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "계좌거래유형코드 (1: 전체, 2:입출금 , 3: 결제)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "통화코드 ('%%%': 전체, 'TUS': TOT_USD, 'TKR': TOT_KRW, 'KRW': 한국, 'USD': 미국, 'EUR': EUR, 'HKD': 홍콩, 'CNY': 중국, 'JPY': 일본, 'VND': 베트남)" + }, + "ctx_area_fk100": { + "name": "ctx_area_fk100", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회검색조건100" + }, + "ctx_area_nk100": { + "name": "ctx_area_nk100", + "type": "str", + "required": true, + "default_value": null, + "description": "연속조회키100" + }, + "pwd_chk_yn": { + "name": "pwd_chk_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "비밀번호체크여부" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "margin_detail": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 증거금상세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/margin_detail", + "method": "margin_detail", + "api_path": "/uapi/overseas-futureoption/v1/trading/margin-detail", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "통화코드 ('TKR', 'TUS', 'USD', 'HKD', 'CNY', 'JPY', 'VND')" + }, + "inqr_dt": { + "name": "inqr_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "조회일자 (8자리, YYYYMMDD 형식)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "order": { + "category": "[해외선물옵션] 주문/계좌", + "name": "해외선물옵션 주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_futureoption/order", + "method": "order", + "api_path": "/uapi/overseas-futureoption/v1/trading/order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_futr_fx_pdno": { + "name": "ovrs_futr_fx_pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "해외선물FX상품번호" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 매도 02 : 매수" + }, + "fm_lqd_ustl_ccld_dt": { + "name": "fm_lqd_ustl_ccld_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "빈칸 (hedge청산만 이용)" + }, + "fm_lqd_ustl_ccno": { + "name": "fm_lqd_ustl_ccno", + "type": "str", + "required": true, + "default_value": null, + "description": "빈칸 (hedge청산만 이용)" + }, + "pric_dvsn_cd": { + "name": "pric_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "1.지정, 2. 시장, 3. STOP, 4 S/L" + }, + "fm_limit_ord_pric": { + "name": "fm_limit_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸(\"\") 입력" + }, + "fm_stop_ord_pric": { + "name": "fm_stop_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸(\"\") 입력" + }, + "fm_ord_qty": { + "name": "fm_ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "FM주문수량" + }, + "fm_lqd_lmt_ord_pric": { + "name": "fm_lqd_lmt_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "빈칸 (hedge청산만 이용)" + }, + "fm_lqd_stop_ord_pric": { + "name": "fm_lqd_stop_ord_pric", + "type": "str", + "required": true, + "default_value": null, + "description": "빈칸 (hedge청산만 이용)" + }, + "ccld_cndt_cd": { + "name": "ccld_cndt_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "일반적으로 6 (EOD, 지정가) GTD인 경우 5, 시장가인 경우만 2" + }, + "cplx_ord_dvsn_cd": { + "name": "cplx_ord_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "0 (hedge청산만 이용)" + }, + "ecis_rsvn_ord_yn": { + "name": "ecis_rsvn_ord_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "N" + }, + "fm_hdge_ord_scrn_yn": { + "name": "fm_hdge_ord_scrn_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "N" + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_stock.json b/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_stock.json new file mode 100644 index 0000000..b9752d6 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/configs/overseas_stock.json @@ -0,0 +1,2914 @@ +{ + "tool_info": { + "introduce": "한국투자증권의 해외주식 OPEN API를 활용합니다.", + "introduce_append": "", + "examples": [ + { + "api_type": "price", + "params": { + "auth": "", + "excd": "NAS", + "symb": "AAPL" + } + }, + { + "api_type": "inquire_daily_chartprice", + "params": { + "fid_cond_mrkt_div_code": "N", + "fid_input_iscd": ".DJI", + "fid_input_date_1": "20220401", + "fid_input_date_2": "20220613", + "fid_period_div_code": "D", + "env_dv": "real" + } + } + ] + }, + "apis": { + "price": { + "category": "[해외주식] 기본시세", + "name": "해외주식 현재체결가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/price", + "method": "price", + "api_path": "/uapi/overseas-price/v1/quotations/price", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "사용자권한정보" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "거래소코드" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_daily_chartprice": { + "category": "[해외주식] 기본시세", + "name": "해외주식 종목/지수/환율기간별시세(일/주/월/년)", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_daily_chartprice", + "method": "inquire_daily_chartprice", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-daily-chartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "N: 해외지수, X 환율, I: 국채, S:금선물" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드(해외) > 해외지수) ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다." + }, + "fid_input_date_1": { + "name": "fid_input_date_1", + "type": "str", + "required": true, + "default_value": null, + "description": "시작일자(YYYYMMDD)" + }, + "fid_input_date_2": { + "name": "fid_input_date_2", + "type": "str", + "required": true, + "default_value": null, + "description": "종료일자(YYYYMMDD)" + }, + "fid_period_div_code": { + "name": "fid_period_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "D:일, W:주, M:월, Y:년" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_time_itemchartprice": { + "category": "[해외주식] 기본시세", + "name": "해외주식분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_time_itemchartprice", + "method": "inquire_time_itemchartprice", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" 공백으로 입력" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 HKS : 홍콩 SHS : 상해 SZS : 심천 HSX : 호치민 HNX : 하노이 TSE : 도쿄 ※ 주간거래는 최대 1일치 분봉만 조회 가능 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간)" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드(ex. TSLA)" + }, + "nmin": { + "name": "nmin", + "type": "str", + "required": true, + "default_value": null, + "description": "분단위(1: 1분봉, 2: 2분봉, ...)" + }, + "pinc": { + "name": "pinc", + "type": "str", + "required": true, + "default_value": null, + "description": "0:당일 1:전일포함 ※ 다음조회 시 반드시 \"1\"로 입력" + }, + "next": { + "name": "next", + "type": "str", + "required": true, + "default_value": null, + "description": "처음조회 시, \"\" 공백 입력 다음조회 시, \"1\" 입력" + }, + "nrec": { + "name": "nrec", + "type": "str", + "required": true, + "default_value": null, + "description": "레코드요청갯수 (최대 120)" + }, + "fill": { + "name": "fill", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" 공백으로 입력" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": null, + "description": "처음 조회 시, \"\" 공백 입력 다음 조회 시, 이전 조회 결과의 마지막 분봉 데이터를 이용하여, 1분 전 혹은 n분 전의 시간을 입력 (형식: YYYYMMDDHHMMSS, ex. 20241014140100)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "dailyprice": { + "category": "[해외주식] 기본시세", + "name": "해외주식 기간별시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/dailyprice", + "method": "dailyprice", + "api_path": "/uapi/overseas-price/v1/quotations/dailyprice", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "사용자권한정보" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "거래소코드" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "gubn": { + "name": "gubn", + "type": "str", + "required": true, + "default_value": null, + "description": "일/주/월구분" + }, + "bymd": { + "name": "bymd", + "type": "str", + "required": true, + "default_value": null, + "description": "조회기준일자(YYYYMMDD)" + }, + "modp": { + "name": "modp", + "type": "str", + "required": true, + "default_value": null, + "description": "수정주가반영여부" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "price_detail": { + "category": "[해외주식] 기본시세", + "name": "해외주식 현재가상세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/price_detail", + "method": "price_detail", + "api_path": "/uapi/overseas-price/v1/quotations/price-detail", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "사용자권한정보" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "거래소명 (예: HKS, NYS, NAS, AMS, TSE, SHS, SZS, SHI, SZI, HSX, HNX, BAY, BAQ, BAA)" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_asking_price": { + "category": "[해외주식] 기본시세", + "name": "해외주식 현재가 1호가", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_asking_price", + "method": "inquire_asking_price", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-asking-price", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "사용자권한정보" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "거래소코드 (예: NYS, NAS, AMS, 등)" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드 (예: TSLA)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output3)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_search": { + "category": "[해외주식] 기본시세", + "name": "해외주식조건검색", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_search", + "method": "inquire_search", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-search", + "params": { + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" (Null 값 설정)" + }, + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "NYS : 뉴욕, NAS : 나스닥, AMS : 아멕스 HKS : 홍콩, SHS : 상해 , SZS : 심천 HSX : 호치민, HNX : 하노이 TSE : 도쿄" + }, + "co_yn_pricecur": { + "name": "co_yn_pricecur", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_pricecur": { + "name": "co_st_pricecur", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 각국통화(JPY, USD, HKD, CNY, VND)" + }, + "co_en_pricecur": { + "name": "co_en_pricecur", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 각국통화(JPY, USD, HKD, CNY, VND)" + }, + "co_yn_rate": { + "name": "co_yn_rate", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_rate": { + "name": "co_st_rate", + "type": "str", + "required": true, + "default_value": null, + "description": "%" + }, + "co_en_rate": { + "name": "co_en_rate", + "type": "str", + "required": true, + "default_value": null, + "description": "%" + }, + "co_yn_valx": { + "name": "co_yn_valx", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_valx": { + "name": "co_st_valx", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_en_valx": { + "name": "co_en_valx", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_yn_shar": { + "name": "co_yn_shar", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_shar": { + "name": "co_st_shar", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_en_shar": { + "name": "co_en_shar", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_yn_volume": { + "name": "co_yn_volume", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_volume": { + "name": "co_st_volume", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 주" + }, + "co_en_volume": { + "name": "co_en_volume", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 주" + }, + "co_yn_amt": { + "name": "co_yn_amt", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_amt": { + "name": "co_st_amt", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_en_amt": { + "name": "co_en_amt", + "type": "str", + "required": true, + "default_value": null, + "description": "단위: 천" + }, + "co_yn_eps": { + "name": "co_yn_eps", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_eps": { + "name": "co_st_eps", + "type": "str", + "required": true, + "default_value": null, + "description": "co_en_eps (str):" + }, + "co_en_eps": { + "name": "co_en_eps", + "type": "str", + "required": true, + "default_value": null + }, + "co_yn_per": { + "name": "co_yn_per", + "type": "str", + "required": true, + "default_value": null, + "description": "해당조건 사용시(1), 미사용시 필수항목아님" + }, + "co_st_per": { + "name": "co_st_per", + "type": "str", + "required": true, + "default_value": null, + "description": "co_en_per (str):" + }, + "co_en_per": { + "name": "co_en_per", + "type": "str", + "required": true, + "default_value": null + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" 공백 입력" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "quot_inquire_ccnl": { + "category": "[해외주식] 기본시세", + "name": "해외주식 체결추이", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/quot_inquire_ccnl", + "method": "quot_inquire_ccnl", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-ccnl", + "params": { + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄)" + }, + "tday": { + "name": "tday", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 당일전일구분 (ex. 0:전일, 1:당일)" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드 (ex. 해외종목코드)" + }, + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": "", + "description": "사용자권한정보" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": "", + "description": "NEXT KEY BUFF" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속거래여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "내부 재귀깊이 (자동관리)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 횟수 제한" + } + } + }, + "search_info": { + "category": "[해외주식] 기본시세", + "name": "해외주식 상품기본정보", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/search_info", + "method": "search_info", + "api_path": "/uapi/overseas-price/v1/quotations/search-info", + "params": { + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 515 일본 501 홍콩 / 543 홍콩CNY / 558 홍콩USD 507 베트남 하노이 / 508 베트남 호치민 551 중국 상해A / 552 중국 심천A" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "예) AAPL (애플)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "industry_theme": { + "category": "[해외주식] 기본시세", + "name": "해외주식 업종별시세", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/industry_theme", + "method": "industry_theme", + "api_path": "/uapi/overseas-price/v1/quotations/industry-theme", + "params": { + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄)" + }, + "icod": { + "name": "icod", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 업종코드" + }, + "vol_rang": { + "name": "vol_rang", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상)" + }, + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": "", + "description": "사용자권한정보" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": "", + "description": "NEXT KEY BUFF" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속거래여부" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임1" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임2" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "내부 재귀깊이 (자동관리)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 횟수 제한" + } + } + }, + "inquire_time_indexchartprice": { + "category": "[해외주식] 기본시세", + "name": "해외지수분봉조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_time_indexchartprice", + "method": "inquire_time_indexchartprice", + "api_path": "/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice", + "params": { + "fid_cond_mrkt_div_code": { + "name": "fid_cond_mrkt_div_code", + "type": "str", + "required": true, + "default_value": null, + "description": "N 해외지수 X 환율 KX 원화환율" + }, + "fid_input_iscd": { + "name": "fid_input_iscd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목번호(ex. TSLA)" + }, + "fid_hour_cls_code": { + "name": "fid_hour_cls_code", + "type": "str", + "required": true, + "default_value": null, + "description": "0: 정규장, 1: 시간외" + }, + "fid_pw_data_incu_yn": { + "name": "fid_pw_data_incu_yn", + "type": "str", + "required": true, + "default_value": null, + "description": "Y/N" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "updown_rate": { + "category": "[해외주식] 시세분석", + "name": "해외주식 상승율/하락율", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/updown_rate", + "method": "updown_rate", + "api_path": "/uapi/overseas-stock/v1/ranking/updown-rate", + "params": { + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄)" + }, + "nday": { + "name": "nday", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년)" + }, + "gubn": { + "name": "gubn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상승율/하락율 구분 (ex. 0:하락율, 1:상승율)" + }, + "vol_rang": { + "name": "vol_rang", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상)" + }, + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": "", + "description": "사용자권한정보" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": "", + "description": "NEXT KEY BUFF" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속거래여부" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임1" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임2" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "내부 재귀깊이 (자동관리)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 횟수 제한" + } + } + }, + "rights_by_ice": { + "category": "[해외주식] 시세분석", + "name": "해외주식 권리종합", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/rights_by_ice", + "method": "rights_by_ice", + "api_path": "/uapi/overseas-price/v1/quotations/rights-by-ice", + "params": { + "ncod": { + "name": "ncod", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 국가코드 (ex. CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남)" + }, + "symb": { + "name": "symb", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 종목코드" + }, + "st_ymd": { + "name": "st_ymd", + "type": "str", + "required": true, + "default_value": "", + "description": "일자시작일 (ex. 미입력시 3개월전)" + }, + "ed_ymd": { + "name": "ed_ymd", + "type": "str", + "required": true, + "default_value": "", + "description": "일자종료일 (ex. 미입력시 3개월후)" + } + } + }, + "price_fluct": { + "category": "[해외주식] 시세분석", + "name": "해외주식 가격급등락", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/price_fluct", + "method": "price_fluct", + "api_path": "/uapi/overseas-stock/v1/ranking/price-fluct", + "params": { + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄)" + }, + "gubn": { + "name": "gubn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 급등/급락구분 (ex. 0:급락, 1:급등)" + }, + "mixn": { + "name": "mixn", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전)" + }, + "vol_rang": { + "name": "vol_rang", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상)" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": "", + "description": "NEXT KEY BUFF" + }, + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": "", + "description": "사용자권한정보" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속거래여부" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임1" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임2" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "내부 재귀깊이 (자동관리)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 횟수 제한" + } + } + }, + "trade_vol": { + "category": "[해외주식] 시세분석", + "name": "해외주식 거래량순위", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/trade_vol", + "method": "trade_vol", + "api_path": "/uapi/overseas-stock/v1/ranking/trade-vol", + "params": { + "excd": { + "name": "excd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄)" + }, + "nday": { + "name": "nday", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] N분전콤보값 (ex. 0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전)" + }, + "vol_rang": { + "name": "vol_rang", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상)" + }, + "keyb": { + "name": "keyb", + "type": "str", + "required": true, + "default_value": "", + "description": "NEXT KEY BUFF (ex. \"\")" + }, + "auth": { + "name": "auth", + "type": "str", + "required": true, + "default_value": "", + "description": "사용자권한정보 (ex. \"\")" + }, + "prc1": { + "name": "prc1", + "type": "str", + "required": true, + "default_value": "", + "description": "가격 필터 시작 (ex. \"\")" + }, + "prc2": { + "name": "prc2", + "type": "str", + "required": true, + "default_value": "", + "description": "가격 필터 종료 (ex. \"\")" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속거래여부 (ex. \"\")" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임1" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임2" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "내부 재귀깊이 (자동관리)" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 횟수 제한" + } + } + }, + "period_rights": { + "category": "[해외주식] 시세분석", + "name": "해외주식 기간별권리조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/period_rights", + "method": "period_rights", + "api_path": "/uapi/overseas-price/v1/quotations/period-rights", + "params": { + "rght_type_cd": { + "name": "rght_type_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 권리유형코드 (%%:전체, 01:유상, 02:무상, 03:배당, 11:합병,14:액면분할, 15:액면병합, 17:감자, 54:WR청구,61:원리금상환, 71:WR소멸, 74:배당옵션, 75:특별배당, 76:ISINCODE변경, 77:실권주청약)" + }, + "inqr_dvsn_cd": { + "name": "inqr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분코드 (02:현지기준일, 03:청약시작일, 04:청약종료일)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자 (20250101)" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자 (20250131)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "상품번호" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "상품유형코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_present_balance": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 체결기준현재잔고", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_present_balance", + "method": "inquire_present_balance", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-present-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "wcrc_frcr_dvsn_cd": { + "name": "wcrc_frcr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 원화 02 : 외화" + }, + "natn_cd": { + "name": "natn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "000 전체 840 미국 344 홍콩 156 중국 392 일본 704 베트남" + }, + "tr_mket_cd": { + "name": "tr_mket_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[Request body NATN_CD 000 설정] 00 : 전체 [Request body NATN_CD 840 설정] 00 : 전체 01 : 나스닥(NASD) 02 : 뉴욕거래소(NYSE) 03 : 미국(PINK SHEETS) 04 : 미국(OTCBB) 05 : 아멕스(AMEX) [Request body NATN_CD 156 설정] 00 : 전체 01 : 상해B 02 : 심천B 03 : 상해A 04 : 심천A [Request body NATN_CD 392 설정] 01 : 일본 [Request body NATN_CD 704 설정] 01 : 하노이거래 02 : 호치민거래소 [Request body NATN_CD 344 설정] 01 : 홍콩 02 : 홍콩CNY 03 : 홍콩USD" + }, + "inqr_dvsn_cd": { + "name": "inqr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "00 : 전체 01 : 일반해외주식 02 : 미니스탁" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output3)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "inquire_balance": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 잔고", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_balance", + "method": "inquire_balance", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[모의] NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [실전] NASD : 미국전체 NAS : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [모의/실전 공통] SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민" + }, + "tr_crcy_cd": { + "name": "tr_crcy_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "USD : 미국달러 HKD : 홍콩달러 CNY : 중국위안화 JPY : 일본엔화 VND : 베트남동" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_nccs": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 미체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_nccs", + "method": "inquire_nccs", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-nccs", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 * NASD 인 경우만 미국전체로 조회되며 나머지 거래소 코드는 해당 거래소만 조회됨 * 공백 입력 시 다음조회가 불가능하므로, 반드시 거래소코드 입력해야 함" + }, + "sort_sqn": { + "name": "sort_sqn", + "type": "str", + "required": true, + "default_value": null, + "description": "DS : 정순 그외 : 역순 [header tr_id: TTTS3018R] \"\"(공란)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_ccnl": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 주문체결내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_ccnl", + "method": "inquire_ccnl", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-ccnl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "전종목일 경우 \"%\" 입력 ※ 모의투자계좌의 경우 \"\"(전체 조회)만 가능" + }, + "ord_strt_dt": { + "name": "ord_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "YYYYMMDD 형식 (현지시각 기준)" + }, + "ord_end_dt": { + "name": "ord_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "YYYYMMDD 형식 (현지시각 기준)" + }, + "sll_buy_dvsn": { + "name": "sll_buy_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "00 : 전체 01 : 매도 02 : 매수 ※ 모의투자계좌의 경우 \"00\"(전체 조회)만 가능" + }, + "ccld_nccs_dvsn": { + "name": "ccld_nccs_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "00 : 전체 01 : 체결 02 : 미체결 ※ 모의투자계좌의 경우 \"00\"(전체 조회)만 가능" + }, + "sort_sqn": { + "name": "sort_sqn", + "type": "str", + "required": true, + "default_value": null, + "description": "DS : 정순 AS : 역순 ※ 모의투자계좌의 경우 정렬순서 사용불가(Default : DS(정순))" + }, + "ord_dt": { + "name": "ord_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" (Null 값 설정)" + }, + "ord_gno_brno": { + "name": "ord_gno_brno", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" (Null 값 설정)" + }, + "odno": { + "name": "odno", + "type": "str", + "required": true, + "default_value": null, + "description": "\"\" (Null 값 설정) ※ 주문번호로 검색 불가능합니다. 반드시 \"\"(Null 값 설정) 바랍니다." + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "전종목일 경우 \"%\" 입력 NASD : 미국시장 전체(나스닥, 뉴욕, 아멕스) NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 ※ 모의투자계좌의 경우 \"\"(전체 조회)만 가능" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_psamount": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 매수가능금액조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_psamount", + "method": "inquire_psamount", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-psamount", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD : 나스닥 / NYSE : 뉴욕 / AMEX : 아멕스 SEHK : 홍콩 / SHAA : 중국상해 / SZAA : 중국심천 TKSE : 일본 / HASE : 하노이거래소 / VNSE : 호치민거래소" + }, + "ovrs_ord_unpr": { + "name": "ovrs_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "해외주문단가 (23.8) 정수부분 23자리, 소수부분 8자리" + }, + "item_cd": { + "name": "item_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "foreign_margin": { + "category": "[해외주식] 주문/계좌", + "name": "해외증거금 통화별조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/foreign_margin", + "method": "foreign_margin", + "api_path": "/uapi/overseas-stock/v1/trading/foreign-margin", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부 (기본값: \"\")" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "order": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/order", + "method": "order", + "api_path": "/uapi/overseas-stock/v1/trading/order", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량 (해외거래소 별 최소 주문수량 및 주문단위 확인 필요)" + }, + "ovrs_ord_unpr": { + "name": "ovrs_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 \"0\"으로 입력" + }, + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "주문구분 (buy: 매수, sell: 매도)" + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": null, + "description": "mgco_aptm_odno (str):" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": null + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "\"0\"(Default)" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[Header tr_id TTTT1002U(미국 매수 주문)] 00 : 지정가 32 : LOO(장개시지정가) 34 : LOC(장마감지정가) * 모의투자 VTTT1002U(미국 매수 주문)로는 00:지정가만 가능 [Header tr_id TTTT1006U(미국 매도 주문)] 00 : 지정가 31 : MOO(장개시시장가) 32 : LOO(장개시지정가) 33 : MOC(장마감시장가) 34 : LOC(장마감지정가) * 모의투자 VTTT1006U(미국 매도 주문)로는 00:지정가만 가능 [Header tr_id TTTS1001U(홍콩 매도 주문)] 00 : 지정가 50 : 단주지정가 * 모의투자 VTTS1001U(홍콩 매도 주문)로는 00:지정가만 가능 [그외 tr_id] 제거" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + } + } + }, + "order_rvsecncl": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 정정취소주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/order_rvsecncl", + "method": "order_rvsecncl", + "api_path": "/uapi/overseas-stock/v1/trading/order-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고)" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 정정 02 : 취소" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량" + }, + "ovrs_ord_unpr": { + "name": "ovrs_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "취소주문 시, \"0\" 입력" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "운용사지정주문번호" + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "\"0\"(Default)" + }, + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": "real", + "description": "실전모의구분 (real:실전, demo:모의)" + } + } + }, + "inquire_period_trans": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 일별거래내역", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_period_trans", + "method": "inquire_period_trans", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-period-trans", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "erlm_strt_dt": { + "name": "erlm_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "등록시작일자 (예: 20240420)" + }, + "erlm_end_dt": { + "name": "erlm_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "등록종료일자 (예: 20240520)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "해외거래소코드" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "상품번호" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "매도매수구분코드 (00: 전체, 01: 매도, 02: 매수)" + }, + "loan_dvsn_cd": { + "name": "loan_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "대출구분코드" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_paymt_stdr_balance": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 결제기준잔고", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_paymt_stdr_balance", + "method": "inquire_paymt_stdr_balance", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "bass_dt": { + "name": "bass_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "기준일자" + }, + "wcrc_frcr_dvsn_cd": { + "name": "wcrc_frcr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "원화외화구분코드 (01: 원화기준, 02: 외화기준)" + }, + "inqr_dvsn_cd": { + "name": "inqr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "조회구분코드 (00: 전체, 01: 일반, 02: 미니스탁)" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output1)" + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output2)" + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null, + "description": "누적 데이터프레임 (output3)" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "", + "description": "연속 거래 여부" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0, + "description": "현재 재귀 깊이" + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10, + "description": "최대 재귀 깊이 (기본값: 10)" + } + } + }, + "daytime_order": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 미국주간주문", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/daytime_order", + "method": "daytime_order", + "api_path": "/uapi/overseas-stock/v1/trading/daytime-order", + "params": { + "order_dv": { + "name": "order_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "주문구분 buy(매수) / sell(매도)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "해외거래소 별 최소 주문수량 및 주문단위 확인 필요" + }, + "ovrs_ord_unpr": { + "name": "ovrs_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "소수점 포함, 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 \"0\"으로 입력" + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": null, + "description": "\" \"" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "\" \"" + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "\"0\"" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": true, + "default_value": null, + "description": "[미국 매수/매도 주문] 00 : 지정가 * 주간거래는 지정가만 가능" + } + } + }, + "daytime_order_rvsecncl": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 미국주간정정취소", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/daytime_order_rvsecncl", + "method": "daytime_order_rvsecncl", + "api_path": "/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "종목코드" + }, + "orgn_odno": { + "name": "orgn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "정정 또는 취소할 원주문번호" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 정정, 02 : 취소" + }, + "ord_qty": { + "name": "ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "주문수량" + }, + "ovrs_ord_unpr": { + "name": "ovrs_ord_unpr", + "type": "str", + "required": true, + "default_value": null, + "description": "소수점 포함, 1주당 가격" + }, + "ctac_tlno": { + "name": "ctac_tlno", + "type": "str", + "required": true, + "default_value": null, + "description": "연락전화번호" + }, + "mgco_aptm_odno": { + "name": "mgco_aptm_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "운용사지정주문번호" + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "주문서버구분코드" + } + } + }, + "inquire_period_profit": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 기간손익", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_period_profit", + "method": "inquire_period_profit", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-period-profit", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "공란 : 전체, NASD : 미국, SEHK : 홍콩, SHAA : 중국, TKSE : 일본, HASE : 베트남" + }, + "natn_cd": { + "name": "natn_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "공란(Default)" + }, + "crcy_cd": { + "name": "crcy_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "공란 : 전체 USD : 미국달러, HKD : 홍콩달러, CNY : 중국위안화, JPY : 일본엔화, VND : 베트남동" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": "", + "description": "공란 : 전체" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "YYYYMMDD" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "YYYYMMDD" + }, + "wcrc_frcr_dvsn_cd": { + "name": "wcrc_frcr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "01 : 외화, 02 : 원화" + }, + "dataframe1": { + "name": "dataframe1", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe2": { + "name": "dataframe2", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order_resv": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 예약주문접수", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/order_resv", + "method": "order_resv", + "api_path": "/uapi/overseas-stock/v1/trading/order-resv", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "ord_dv": { + "name": "ord_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 매도매수구분 (ex. usBuy:미국매수, usSell:미국매도, asia:아시아)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "pdno": { + "name": "pdno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 상품번호" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민)" + }, + "ft_ord_qty": { + "name": "ft_ord_qty", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FT주문수량" + }, + "ft_ord_unpr3": { + "name": "ft_ord_unpr3", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] FT주문단가3" + }, + "sll_buy_dvsn_cd": { + "name": "sll_buy_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "매도매수구분코드 (ex. 아시아인경우만 사용, 01:매도,02:매수)" + }, + "rvse_cncl_dvsn_cd": { + "name": "rvse_cncl_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "정정취소구분코드 (ex. 아시아인경우만 사용, 00:매도/매수)" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "상품유형코드 (ex. 아시아인경우만 사용)" + }, + "ord_svr_dvsn_cd": { + "name": "ord_svr_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "주문서버구분코드 (ex. 0)" + }, + "rsvn_ord_rcit_dt": { + "name": "rsvn_ord_rcit_dt", + "type": "str", + "required": false, + "default_value": "", + "description": "예약주문접수일자 (ex. 아시아인경우만 사용)" + }, + "ord_dvsn": { + "name": "ord_dvsn", + "type": "str", + "required": false, + "default_value": "", + "description": "주문구분 (ex. 미국 매수/매도인 경우만 사용)" + }, + "ovrs_rsvn_odno": { + "name": "ovrs_rsvn_odno", + "type": "str", + "required": false, + "default_value": "", + "description": "해외예약주문번호 (ex. 아이사인 경우만 사용)" + }, + "algo_ord_tmd_dvsn_cd": { + "name": "algo_ord_tmd_dvsn_cd", + "type": "str", + "required": false, + "default_value": "", + "description": "알고리즘주문시간구분코드 (ex. TWAP, VWAP 주문에서만 사용, 02로 고정)" + } + } + }, + "order_resv_list": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 예약주문조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/order_resv_list", + "method": "order_resv_list", + "api_path": "/uapi/overseas-stock/v1/trading/order-resv-list", + "params": { + "nat_dv": { + "name": "nat_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 국가구분코드 (ex. us:미국, asia:아시아)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "inqr_strt_dt": { + "name": "inqr_strt_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회시작일자 (ex. 20250101)" + }, + "inqr_end_dt": { + "name": "inqr_end_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회종료일자 (ex. 20251231)" + }, + "inqr_dvsn_cd": { + "name": "inqr_dvsn_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 조회구분코드 (ex. 00:전체, 01:일반해외주식, 02:미니스탁)" + }, + "ovrs_excg_cd": { + "name": "ovrs_excg_cd", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민)" + }, + "prdt_type_cd": { + "name": "prdt_type_cd", + "type": "str", + "required": true, + "default_value": "", + "description": "상품유형코드" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "inquire_algo_ccnl": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 지정가체결내역조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/inquire_algo_ccnl", + "method": "inquire_algo_ccnl", + "api_path": "/uapi/overseas-stock/v1/trading/inquire-algo-ccnl", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "ord_dt": { + "name": "ord_dt", + "type": "str", + "required": true, + "default_value": "", + "description": "주문일자" + }, + "ord_gno_brno": { + "name": "ord_gno_brno", + "type": "str", + "required": true, + "default_value": "", + "description": "주문채번지점번호" + }, + "odno": { + "name": "odno", + "type": "str", + "required": true, + "default_value": "", + "description": "주문번호 (ex. 지정가주문번호 TTTC6058R에서 조회된 주문번호 입력)" + }, + "ttlz_icld_yn": { + "name": "ttlz_icld_yn", + "type": "str", + "required": true, + "default_value": "", + "description": "집계포함여부" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "dataframe3": { + "name": "dataframe3", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + }, + "order_resv_ccnl": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 예약주문접수취소", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/order_resv_ccnl", + "method": "order_resv_ccnl", + "api_path": "/uapi/overseas-stock/v1/trading/order-resv-ccnl", + "params": { + "env_dv": { + "name": "env_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 실전모의구분 (ex. real:실전, demo:모의)" + }, + "nat_dv": { + "name": "nat_dv", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 국가구분 (ex. us:미국)" + }, + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "rsvn_ord_rcit_dt": { + "name": "rsvn_ord_rcit_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외주문접수일자" + }, + "ovrs_rsvn_odno": { + "name": "ovrs_rsvn_odno", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 해외예약주문번호 (ex. 해외주식_예약주문접수 API Output ODNO(주문번호) 참고)" + } + } + }, + "algo_ordno": { + "category": "[해외주식] 주문/계좌", + "name": "해외주식 지정가주문번호조회", + "github_url": "https://github.com/koreainvestment/open-trading-api/tree/main/examples_llm/overseas_stock/algo_ordno", + "method": "algo_ordno", + "api_path": "/uapi/overseas-stock/v1/trading/algo-ordno", + "params": { + "cano": { + "name": "cano", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌번호 (시스템 자동 설정, 제공 불필요)" + }, + "acnt_prdt_cd": { + "name": "acnt_prdt_cd", + "type": "str", + "required": false, + "default_value": null, + "description": "계좌상품코드 (시스템 자동 설정, 제공 불필요)" + }, + "trad_dt": { + "name": "trad_dt", + "type": "str", + "required": true, + "default_value": null, + "description": "[필수] 거래일자" + }, + "tr_cont": { + "name": "tr_cont", + "type": "str", + "required": true, + "default_value": "" + }, + "dataframe": { + "name": "dataframe", + "type": "pd.DataFrame", + "required": false, + "default_value": null + }, + "depth": { + "name": "depth", + "type": "int", + "required": true, + "default_value": 0 + }, + "max_depth": { + "name": "max_depth", + "type": "int", + "required": true, + "default_value": 10 + } + } + } + } +} \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/__init__.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/__init__.py new file mode 100644 index 0000000..561227b --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/__init__.py @@ -0,0 +1,29 @@ +from .base import Base +from .updated import Updated + +# 툴별 마스터 모델들 +from .domestic_stock import DomesticStockMaster +from .overseas_stock import OverseasStockMaster +from .domestic_futureoption import DomesticFutureoptionMaster +from .overseas_futureoption import OverseasFutureoptionMaster +from .domestic_bond import DomesticBondMaster +from .etfetn import EtfetnMaster +from .elw import ElwMaster +from .auth import AuthMaster + + +# 모든 모델들을 리스트로 제공 +ALL_MODELS = [ + # 툴별 마스터 모델들 + DomesticStockMaster, + OverseasStockMaster, + DomesticFutureoptionMaster, + OverseasFutureoptionMaster, + DomesticBondMaster, + EtfetnMaster, + ElwMaster, + AuthMaster, + + # 업데이트 상태 추적 + Updated +] diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/auth.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/auth.py new file mode 100644 index 0000000..e9cf16e --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/auth.py @@ -0,0 +1,11 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class AuthMaster(Base): + """인증 마스터""" + __tablename__ = 'auth_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/base.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/base.py new file mode 100644 index 0000000..95ee79d --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/base.py @@ -0,0 +1,5 @@ +from sqlalchemy.orm import declarative_base + +# SQLAlchemy Base 클래스 +Base = declarative_base() + diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_bond.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_bond.py new file mode 100644 index 0000000..98aaeb1 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_bond.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class DomesticBondMaster(Base): + """국내채권 마스터""" + __tablename__ = 'domestic_bond_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_futureoption.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_futureoption.py new file mode 100644 index 0000000..6bb1a93 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_futureoption.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class DomesticFutureoptionMaster(Base): + """국내선물옵션 마스터""" + __tablename__ = 'domestic_futureoption_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_stock.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_stock.py new file mode 100644 index 0000000..b4b4419 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/domestic_stock.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class DomesticStockMaster(Base): + """국내주식 마스터""" + __tablename__ = 'domestic_stock_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/elw.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/elw.py new file mode 100644 index 0000000..5b89908 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/elw.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class ElwMaster(Base): + """ELW 마스터""" + __tablename__ = 'elw_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/etfetn.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/etfetn.py new file mode 100644 index 0000000..6e43c01 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/etfetn.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class EtfetnMaster(Base): + """ETF/ETN 마스터""" + __tablename__ = 'etfetn_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_futureoption.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_futureoption.py new file mode 100644 index 0000000..8e6a5fe --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_futureoption.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class OverseasFutureoptionMaster(Base): + """해외선물옵션 마스터""" + __tablename__ = 'overseas_futureoption_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_stock.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_stock.py new file mode 100644 index 0000000..2df076f --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/overseas_stock.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, Integer, String +from .base import Base + + +class OverseasStockMaster(Base): + """해외주식 마스터""" + __tablename__ = 'overseas_stock_master' + + id = Column(Integer, primary_key=True) + name = Column(String(50), index=True) # 종목명 + code = Column(String(50), index=True) # 종목코드 + ex = Column(String(30), index=True) # 거래소 코드 diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/model/updated.py b/한국투자증권(API)/MCP/Kis Trading MCP/model/updated.py new file mode 100644 index 0000000..b268982 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/model/updated.py @@ -0,0 +1,15 @@ +from sqlalchemy import Column, Integer, String, DateTime +from .base import Base + + +class Updated(Base): + """마스터파일 업데이트 상태 추적 테이블""" + __tablename__ = 'updated' + + id = Column(Integer, primary_key=True) + tool_name = Column(String(50), nullable=False, unique=True, index=True) # 툴명 (예: domestic_stock, overseas_stock) + updated_at = Column(DateTime, nullable=False) # 마지막 업데이트 시간 + + def __repr__(self): + return f"" + diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/__init__.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/__init__.py new file mode 100644 index 0000000..a1ea5e2 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/__init__.py @@ -0,0 +1,3 @@ +from .decorator import singleton +from .plugin import setup_environment, EnvironmentConfig, setup_kis_config, MasterFileManager +from .middleware import EnvironmentMiddleware \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/decorator.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/decorator.py new file mode 100644 index 0000000..4bbbd58 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/decorator.py @@ -0,0 +1,32 @@ +import threading + + +def singleton(cls): + """ + 클래스 형태를 유지하는 싱글톤 데코레이터. + - 여러 번 호출해도 동일 인스턴스 반환 + - __init__은 최초 1회만 실행 + - 스레드-세이프 + """ + cls.__singleton_lock__ = getattr(cls, "__singleton_lock__", threading.Lock()) + cls.__singleton_instance__ = getattr(cls, "__singleton_instance__", None) + + orig_init = cls.__init__ + + def __init__(self, *args, **kwargs): + # 최초 1회만 실제 __init__ 수행 + if getattr(self, "__initialized__", False): + return + orig_init(self, *args, **kwargs) + setattr(self, "__initialized__", True) + + def __new__(inner_cls, *args, **kwargs): + if inner_cls.__singleton_instance__ is None: + with inner_cls.__singleton_lock__: + if inner_cls.__singleton_instance__ is None: + inner_cls.__singleton_instance__ = object.__new__(inner_cls) + return inner_cls.__singleton_instance__ + + cls.__init__ = __init__ + cls.__new__ = staticmethod(__new__) + return cls diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/factory.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/factory.py new file mode 100644 index 0000000..9bd83a1 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/factory.py @@ -0,0 +1,6 @@ +# 기존 컨텍스트 상수들 +CONTEXT_REQUEST_ID = "context_request_id" +CONTEXT_ENVIRONMENT = "context_environment" +CONTEXT_STARTED_AT = "context_started_at" +CONTEXT_ENDED_AT = "context_ended_at" +CONTEXT_ELAPSED_SECONDS = "context_elapsed_seconds" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/middleware.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/middleware.py new file mode 100644 index 0000000..ab96cfc --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/middleware.py @@ -0,0 +1,46 @@ +import uuid +from datetime import datetime +import time + +from fastmcp.server.middleware import Middleware, MiddlewareContext + +import module.factory as factory + +# 기본 미들웨어 +class EnvironmentMiddleware(Middleware): + def __init__(self, environment): + self.environment = environment + + async def on_call_tool(self, context: MiddlewareContext, call_next): + ctx = context.fastmcp_context + + # time counter start + t0 = time.perf_counter() + + # started_at + started_dt = datetime.now() + ctx.set_state(factory.CONTEXT_STARTED_AT, started_dt.strftime("%Y-%m-%d %H:%M:%S")) + + # request id + request_id = uuid.uuid4().hex + ctx.set_state(factory.CONTEXT_REQUEST_ID, request_id) + + # context setup + ctx.set_state(factory.CONTEXT_ENVIRONMENT, self.environment) + + try: + result = await call_next(context) + return result + except Exception as e: + raise e + finally: + # ended at + ended_at = datetime.now() + ctx.set_state(factory.CONTEXT_ENDED_AT, ended_at.strftime("%Y-%m-%d %H:%M:%S")) + + # time counter end + elapsed_sec = time.perf_counter() - t0 + ctx.set_state(factory.CONTEXT_ELAPSED_SECONDS, round(elapsed_sec, 2)) + + + diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/__init__.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/__init__.py new file mode 100644 index 0000000..3d532c9 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/__init__.py @@ -0,0 +1,4 @@ +from .kis import setup_kis_config +from .environment import setup_environment, EnvironmentConfig +from .master_file import MasterFileManager +from .database import DatabaseEngine, Database \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/database.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/database.py new file mode 100644 index 0000000..175366b --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/database.py @@ -0,0 +1,540 @@ +from typing import Any, Dict, List, Optional, Type, Union +from sqlalchemy import create_engine, Engine +from sqlalchemy.orm import sessionmaker, Session +from sqlalchemy.exc import SQLAlchemyError +import logging +import os +from datetime import datetime + +logger = logging.getLogger(__name__) + + +class DatabaseEngine: + """1 SQLite 파일 : 1 엔진을 관리하는 클래스""" + + def __init__(self, db_path: str, models: List[Type]): + """ + Args: + db_path: SQLite 파일 경로 + models: 해당 데이터베이스에 포함될 모델 클래스들의 리스트 + """ + self.db_path = db_path + self.models = models + self.engine: Optional[Engine] = None + self.SessionLocal: Optional[sessionmaker] = None + self._initialize_engine() + + def _initialize_engine(self): + """데이터베이스 엔진 초기화""" + try: + # SQLite 연결 문자열 생성 + db_url = f"sqlite:///{self.db_path}" + + # 엔진 생성 + self.engine = create_engine( + db_url, + echo=False, # SQL 로그 출력 여부 + pool_pre_ping=True, # 연결 상태 확인 + connect_args={"check_same_thread": False} # SQLite 멀티스레드 지원 + ) + + # 세션 팩토리 생성 + self.SessionLocal = sessionmaker( + autocommit=False, + autoflush=False, + bind=self.engine + ) + + # 테이블 생성 + self._create_tables() + + logger.info(f"Database engine initialized: {self.db_path}") + + except Exception as e: + logger.error(f"Failed to initialize database engine {self.db_path}: {e}") + raise + + def _create_tables(self): + """모든 모델의 테이블 생성""" + try: + from model.base import Base + Base.metadata.create_all(bind=self.engine) + logger.info(f"Tables created for {self.db_path}") + except Exception as e: + logger.error(f"Failed to create tables for {self.db_path}: {e}") + raise + + def get_session(self) -> Session: + """새로운 데이터베이스 세션 반환""" + if not self.SessionLocal: + raise RuntimeError("Database engine not initialized") + return self.SessionLocal() + + def insert(self, model_instance: Any) -> Any: + """ + 모델 인스턴스를 데이터베이스에 삽입 + + Args: + model_instance: 삽입할 모델 인스턴스 + + Returns: + 삽입된 모델 인스턴스 (ID 포함) + """ + session = self.get_session() + try: + session.add(model_instance) + session.commit() + session.refresh(model_instance) + logger.info(f"Inserted record: {type(model_instance).__name__}") + return model_instance + except SQLAlchemyError as e: + session.rollback() + logger.error(f"Failed to insert record: {e}") + raise + finally: + session.close() + + def update(self, model_class: Type, record_id: int, update_data: Dict[str, Any]) -> Optional[Any]: + """ + ID로 레코드 업데이트 + + Args: + model_class: 업데이트할 모델 클래스 + record_id: 업데이트할 레코드의 ID + update_data: 업데이트할 필드와 값의 딕셔너리 + + Returns: + 업데이트된 모델 인스턴스 또는 None + """ + session = self.get_session() + try: + # 레코드 조회 + record = session.query(model_class).filter(model_class.id == record_id).first() + if not record: + logger.warning(f"Record not found: {model_class.__name__} ID {record_id}") + return None + + # 필드 업데이트 + for field, value in update_data.items(): + if hasattr(record, field): + setattr(record, field, value) + else: + logger.warning(f"Field '{field}' not found in {model_class.__name__}") + + session.commit() + session.refresh(record) + logger.info(f"Updated record: {model_class.__name__} ID {record_id}") + return record + + except SQLAlchemyError as e: + session.rollback() + logger.error(f"Failed to update record: {e}") + raise + finally: + session.close() + + def delete(self, model_class: Type, record_id: int) -> bool: + """ + ID로 레코드 삭제 + + Args: + model_class: 삭제할 모델 클래스 + record_id: 삭제할 레코드의 ID + + Returns: + 삭제 성공 여부 + """ + session = self.get_session() + try: + # 레코드 조회 + record = session.query(model_class).filter(model_class.id == record_id).first() + if not record: + logger.warning(f"Record not found: {model_class.__name__} ID {record_id}") + return False + + session.delete(record) + session.commit() + logger.info(f"Deleted record: {model_class.__name__} ID {record_id}") + return True + + except SQLAlchemyError as e: + session.rollback() + logger.error(f"Failed to delete record: {e}") + raise + finally: + session.close() + + def list(self, model_class: Type, filters: Optional[Dict[str, Any]] = None, + limit: Optional[int] = None, offset: Optional[int] = None) -> List[Any]: + """ + 조건에 맞는 레코드 목록 조회 + + Args: + model_class: 조회할 모델 클래스 + filters: 필터 조건 딕셔너리 {field: value} + limit: 조회할 최대 개수 + offset: 건너뛸 개수 + + Returns: + 조회된 레코드 리스트 + """ + session = self.get_session() + try: + query = session.query(model_class) + + # 필터 적용 + if filters: + for field, value in filters.items(): + if hasattr(model_class, field): + query = query.filter(getattr(model_class, field) == value) + else: + logger.warning(f"Field '{field}' not found in {model_class.__name__}") + + # 페이징 적용 + if offset: + query = query.offset(offset) + if limit: + query = query.limit(limit) + + results = query.all() + logger.info(f"Listed {len(results)} records: {model_class.__name__}") + return results + + except SQLAlchemyError as e: + logger.error(f"Failed to list records: {e}") + raise + finally: + session.close() + + def get(self, model_class: Type, filters: Dict[str, Any]) -> Optional[Any]: + """ + 조건에 맞는 첫 번째 레코드 조회 + + Args: + model_class: 조회할 모델 클래스 + filters: 필터 조건 딕셔너리 {field: value} + + Returns: + 조회된 레코드 또는 None + """ + session = self.get_session() + try: + query = session.query(model_class) + + # 필터 적용 + for field, value in filters.items(): + if hasattr(model_class, field): + query = query.filter(getattr(model_class, field) == value) + else: + logger.warning(f"Field '{field}' not found in {model_class.__name__}") + + result = query.first() + if result: + logger.info(f"Found record: {model_class.__name__}") + else: + logger.info(f"No record found: {model_class.__name__}") + return result + + except SQLAlchemyError as e: + logger.error(f"Failed to get record: {e}") + raise + finally: + session.close() + + def count(self, model_class: Type, filters: Optional[Dict[str, Any]] = None) -> int: + """ + 조건에 맞는 레코드 개수 조회 + + Args: + model_class: 조회할 모델 클래스 + filters: 필터 조건 딕셔너리 {field: value} + + Returns: + 레코드 개수 + """ + session = self.get_session() + try: + query = session.query(model_class) + + # 필터 적용 + if filters: + for field, value in filters.items(): + if hasattr(model_class, field): + query = query.filter(getattr(model_class, field) == value) + else: + logger.warning(f"Field '{field}' not found in {model_class.__name__}") + + count = query.count() + logger.info(f"Counted {count} records: {model_class.__name__}") + return count + + except SQLAlchemyError as e: + logger.error(f"Failed to count records: {e}") + raise + finally: + session.close() + + def bulk_replace_master_data(self, model_class: Type, data_list: List[Dict], master_name: str) -> int: + """ + 마스터 데이터 추가 (INSERT만) - 카테고리 레벨에서 이미 삭제됨 + + Args: + model_class: 마스터 데이터 모델 클래스 + data_list: 삽입할 데이터 리스트 (딕셔너리 리스트) + master_name: 마스터파일명 (로깅용) + + Returns: + 삽입된 레코드 수 + """ + session = self.get_session() + try: + # 새 데이터 배치 삽입 (카테고리 레벨에서 이미 삭제되었으므로 INSERT만) + if data_list: + # 배치 크기 설정 (메모리 효율성을 위해 1000개씩) + batch_size = 1000 + total_inserted = 0 + + for i in range(0, len(data_list), batch_size): + batch = data_list[i:i + batch_size] + batch_objects = [] + + for data in batch: + # 모든 값을 문자열로 강제 변환 (SQLAlchemy 타입 추론 방지) + str_data = {key: str(value) if value is not None else None for key, value in data.items()} + + # 딕셔너리를 모델 인스턴스로 변환 + obj = model_class(**str_data) + batch_objects.append(obj) + + # 배치 삽입 + session.bulk_save_objects(batch_objects) + total_inserted += len(batch_objects) + + # 중간 커밋 (메모리 절약) + if i + batch_size < len(data_list): + session.commit() + logger.info(f"Inserted batch {i//batch_size + 1}: {len(batch_objects)} records") + + # 최종 커밋 + session.commit() + logger.info(f"Bulk replace completed: {total_inserted} records inserted into {model_class.__name__}") + return total_inserted + else: + logger.warning(f"No data to insert for {master_name}") + return 0 + + except SQLAlchemyError as e: + session.rollback() + logger.error(f"Failed to bulk replace master data for {master_name}: {e}") + raise + finally: + session.close() + + def update_master_timestamp(self, tool_name: str, record_count: int = None) -> bool: + """ + 마스터파일 업데이트 시간 기록 + + Args: + tool_name: 툴명 (예: domestic_stock, overseas_stock) + record_count: 레코드 수 (선택사항) + + Returns: + 업데이트 성공 여부 + """ + from model.updated import Updated + + session = self.get_session() + try: + # 기존 레코드 조회 + existing_record = session.query(Updated).filter(Updated.tool_name == tool_name).first() + + if existing_record: + # 기존 레코드 업데이트 + existing_record.updated_at = datetime.now() + logger.info(f"Updated timestamp for {tool_name}") + else: + # 새 레코드 생성 + new_record = Updated( + tool_name=tool_name, + updated_at=datetime.now() + ) + session.add(new_record) + logger.info(f"Created new timestamp record for {tool_name}") + + session.commit() + return True + + except SQLAlchemyError as e: + session.rollback() + logger.error(f"Failed to update master timestamp for {tool_name}: {e}") + return False + finally: + session.close() + + def get_master_update_time(self, tool_name: str) -> Optional[datetime]: + """ + 마스터파일 마지막 업데이트 시간 조회 + + Args: + tool_name: 툴명 (예: domestic_stock, overseas_stock) + + Returns: + 마지막 업데이트 시간 또는 None + """ + from model.updated import Updated + + session = self.get_session() + try: + record = session.query(Updated).filter(Updated.tool_name == tool_name).first() + if record: + logger.info(f"Found update time for {tool_name}: {record.updated_at}") + return record.updated_at + else: + logger.info(f"No update record found for {tool_name}") + return None + + except SQLAlchemyError as e: + logger.error(f"Failed to get master update time for {tool_name}: {e}") + return None + finally: + session.close() + + def is_master_data_available(self, model_class: Type) -> bool: + """ + 마스터 데이터 존재 여부 확인 + + Args: + model_class: 마스터 데이터 모델 클래스 + + Returns: + 데이터 존재 여부 + """ + session = self.get_session() + try: + count = session.query(model_class).count() + available = count > 0 + logger.info(f"Master data availability check for {model_class.__name__}: {available} ({count} records)") + return available + except SQLAlchemyError as e: + logger.error(f"Failed to check master data availability for {model_class.__name__}: {e}") + return False + finally: + session.close() + + def close(self): + """데이터베이스 연결 종료""" + if self.engine: + self.engine.dispose() + logger.info(f"Database engine closed: {self.db_path}") + + def __repr__(self): + return f"DatabaseEngine(db_path='{self.db_path}', models={len(self.models)})" + + +class Database: + """데이터베이스 엔진들을 관리하는 Singleton 클래스""" + + _instance: Optional['Database'] = None + _initialized: bool = False + + def __new__(cls) -> 'Database': + """Singleton 패턴 구현""" + if cls._instance is None: + cls._instance = super(Database, cls).__new__(cls) + return cls._instance + + def __init__(self): + """초기화 (한 번만 실행)""" + if not self._initialized: + self.dbs: Dict[str, DatabaseEngine] = {} + self._initialized = True + logger.info("Database singleton instance created") + + def new(self, db_dir: str = "configs/master") -> None: + """ + 마스터 데이터베이스 엔진 초기화 + + Args: + db_dir: 데이터베이스 파일이 저장될 디렉토리 + """ + try: + # 데이터베이스 디렉토리 생성 + os.makedirs(db_dir, exist_ok=True) + + # 하나의 통합 마스터 데이터베이스 엔진 생성 + self._create_master_engine(db_dir) + + logger.info(f"Master database engine initialized: '{db_dir}/master.db'") + logger.info(f"Available databases: {list(self.dbs.keys())}") + + except Exception as e: + logger.error(f"Failed to initialize master database: {e}") + raise + + def _create_master_engine(self, db_dir: str): + """통합 마스터 데이터베이스 엔진 생성""" + from model import ALL_MODELS + + db_path = os.path.join(db_dir, "master.db") + + self.dbs["master"] = DatabaseEngine(db_path, ALL_MODELS) + logger.info("Created master database engine with all models") + + def get_by_name(self, name: str) -> DatabaseEngine: + """ + 이름으로 데이터베이스 엔진 조회 + + Args: + name: 데이터베이스 이름 + + Returns: + DatabaseEngine 인스턴스 + + Raises: + KeyError: 해당 이름의 데이터베이스가 없는 경우 + """ + if name not in self.dbs: + available_dbs = list(self.dbs.keys()) + raise KeyError(f"Database '{name}' not found. Available databases: {available_dbs}") + + return self.dbs[name] + + def get_available_databases(self) -> List[str]: + """사용 가능한 데이터베이스 이름 목록 반환""" + return list(self.dbs.keys()) + + def is_initialized(self) -> bool: + """데이터베이스가 초기화되었는지 확인""" + return len(self.dbs) > 0 + + def ensure_initialized(self, db_dir: str = "configs/master") -> bool: + """데이터베이스가 초기화되지 않은 경우에만 초기화""" + if not self.is_initialized(): + try: + self.new(db_dir) + logger.info("Database initialized on demand") + return True + except Exception as e: + logger.error(f"Failed to initialize database on demand: {e}") + return False + return True + + def close_all(self): + """모든 데이터베이스 연결 종료""" + for name, engine in self.dbs.items(): + try: + engine.close() + logger.info(f"Closed database: {name}") + except Exception as e: + logger.error(f"Failed to close database {name}: {e}") + + self.dbs.clear() + logger.info("All database connections closed") + + def __repr__(self): + return f"Database(engines={len(self.dbs)}, names={list(self.dbs.keys())})" + + def __del__(self): + """소멸자 - 모든 연결 정리""" + if hasattr(self, 'dbs') and self.dbs: + self.close_all() diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/environment.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/environment.py new file mode 100644 index 0000000..7d94940 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/environment.py @@ -0,0 +1,43 @@ +import logging +import os +from collections import namedtuple + +from dotenv import load_dotenv + +# Environment 설정을 위한 namedtuple 정의 +EnvironmentConfig = namedtuple('EnvironmentConfig', [ + 'mcp_type', 'mcp_host', 'mcp_port', 'mcp_path' +]) + + +def setup_environment(env: str) -> EnvironmentConfig: + # get api env + if not env: + logging.error("Environment variable ENV not defined") + exit(1) + + # load .env + dotenv_path = os.path.join(os.getcwd(), f".env.{env}") + if not os.path.isfile(dotenv_path): + logging.error(f"Environment variable file .env.{env} not found") + exit(1) + + load_dotenv(dotenv_path=dotenv_path) + + # return environment + # MCP_TYPE 검증 및 기본값 설정 + mcp_type = os.getenv("MCP_TYPE", "stdio") + if mcp_type not in ['stdio', 'sse', 'streamable-http']: + logging.warning(f"Invalid MCP_TYPE: {mcp_type}, using default: stdio") + mcp_type = "stdio" + + # MCP_PORT가 빈 문자열이면 기본값 사용 + mcp_port_str = os.getenv("MCP_PORT", "8000") + mcp_port = int(mcp_port_str) if mcp_port_str.strip() else 8000 + + return EnvironmentConfig( + mcp_type=mcp_type, + mcp_host=os.getenv("MCP_HOST", "localhost"), + mcp_port=mcp_port, + mcp_path=os.getenv("MCP_PATH", "/mcp") + ) diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/kis.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/kis.py new file mode 100644 index 0000000..3e03047 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/kis.py @@ -0,0 +1,163 @@ +import logging +import os +import requests +import yaml + + +def setup_kis_config(force_update=False): + """KIS 설정 파일 자동 생성 (템플릿 다운로드 + 환경변수로 값 덮어쓰기) + + Args: + force_update (bool): True면 기존 파일이 있어도 강제로 덮어쓰기 + """ + + # kis_auth.py와 동일한 경로 생성 방식 사용 + kis_config_dir = os.path.join(os.path.expanduser("~"), "KIS", "config") + + # KIS 설정 디렉토리 생성 + os.makedirs(kis_config_dir, exist_ok=True) + + # 설정 파일 경로 + kis_config_path = os.path.join(kis_config_dir, "kis_devlp.yaml") + + # 기존 파일 존재 확인 + if os.path.exists(kis_config_path) and not force_update: + logging.info(f"✅ KIS 설정 파일이 이미 존재합니다: {kis_config_path}") + logging.info("기존 파일을 사용합니다. 강제 업데이트가 필요한 경우 force_update=True 옵션을 사용하세요.") + return True + + # 1. kis_devlp.yaml 템플릿 다운로드 + template_url = "https://raw.githubusercontent.com/koreainvestment/open-trading-api/refs/heads/main/kis_devlp.yaml" + + try: + logging.info("KIS 설정 템플릿을 다운로드 중...") + response = requests.get(template_url, timeout=30) + response.raise_for_status() + + # 원본 템플릿 텍스트 보존 + template_content = response.text + logging.info("✅ KIS 설정 템플릿 다운로드 완료") + + except Exception as e: + logging.error(f"❌ KIS 설정 템플릿 다운로드 실패: {e}") + return False + + # 2. 환경변수로 민감한 정보 덮어쓰기 + # 필수값 (누락 시 경고) + app_key = os.getenv("KIS_APP_KEY") + app_secret = os.getenv("KIS_APP_SECRET") + + if not app_key or not app_secret: + logging.warning("⚠️ 필수 환경변수가 설정되지 않았습니다:") + if not app_key: + logging.warning(" - KIS_APP_KEY") + if not app_secret: + logging.warning(" - KIS_APP_SECRET") + logging.warning("실제 거래 API 사용이 불가능할 수 있습니다.") + + # 선택적 값들 (누락 시 빈값 또는 기본값) + paper_app_key = os.getenv("KIS_PAPER_APP_KEY", "") + paper_app_secret = os.getenv("KIS_PAPER_APP_SECRET", "") + hts_id = os.getenv("KIS_HTS_ID", "") + acct_stock = os.getenv("KIS_ACCT_STOCK", "") + acct_future = os.getenv("KIS_ACCT_FUTURE", "") + paper_stock = os.getenv("KIS_PAPER_STOCK", "") + paper_future = os.getenv("KIS_PAPER_FUTURE", "") + prod_type = os.getenv("KIS_PROD_TYPE", "01") # 기본값: 종합계좌 + url_rest = os.getenv("KIS_URL_REST", "") + url_rest_paper = os.getenv("KIS_URL_REST_PAPER", "") + url_ws = os.getenv("KIS_URL_WS", "") + url_ws_paper = os.getenv("KIS_URL_WS_PAPER", "") + + # 3. YAML 파싱하여 값 업데이트 + try: + # YAML 파싱 (주석 보존을 위해 ruamel.yaml 사용하거나, 간단히 pyyaml 사용) + config = yaml.safe_load(template_content) + + # 환경변수 값이 있으면 해당 필드만 업데이트 + if app_key: + config['my_app'] = app_key + logging.info(f"✅ 실전 App Key 설정 완료") + if app_secret: + config['my_sec'] = app_secret + logging.info(f"✅ 실전 App Secret 설정 완료") + + if paper_app_key: + config['paper_app'] = paper_app_key + logging.info(f"✅ 모의 App Key 설정 완료") + if paper_app_secret: + config['paper_sec'] = paper_app_secret + logging.info(f"✅ 모의 App Secret 설정 완료") + + if hts_id: + config['my_htsid'] = hts_id + logging.info(f"✅ HTS ID 설정 완료: {hts_id}") + else: + logging.warning("⚠️ KIS_HTS_ID 환경변수가 설정되지 않았습니다.") + + if acct_stock: + config['my_acct_stock'] = acct_stock + logging.info(f"✅ 증권계좌 설정 완료") + if acct_future: + config['my_acct_future'] = acct_future + logging.info(f"✅ 선물옵션계좌 설정 완료") + if paper_stock: + config['my_paper_stock'] = paper_stock + logging.info(f"✅ 모의 증권계좌 설정 완료") + if paper_future: + config['my_paper_future'] = paper_future + logging.info(f"✅ 모의 선물옵션계좌 설정 완료") + + if prod_type != "01": # 기본값이 아닌 경우만 업데이트 + config['my_prod'] = prod_type + logging.info(f"✅ 계좌상품코드 설정 완료: {prod_type}") + + # URL 설정 업데이트 (직접 필드) + if url_rest: + config['prod'] = url_rest + logging.info(f"✅ 실전 REST URL 설정 완료") + if url_rest_paper: + config['vps'] = url_rest_paper + logging.info(f"✅ 모의 REST URL 설정 완료") + if url_ws: + config['ops'] = url_ws + logging.info(f"✅ 실전 WebSocket URL 설정 완료") + if url_ws_paper: + config['vops'] = url_ws_paper + logging.info(f"✅ 모의 WebSocket URL 설정 완료") + + # YAML로 다시 변환 + updated_content = yaml.dump(config, default_flow_style=False, allow_unicode=True, sort_keys=False) + + except yaml.YAMLError as e: + logging.error(f"❌ YAML 파싱 오류: {e}") + logging.info("문자열 치환 방식으로 대체합니다...") + # 실패 시 기존 문자열 치환 방식 사용 + updated_content = template_content + if app_key: + updated_content = updated_content.replace('my_app: "앱키"', f'my_app: "{app_key}"') + if app_secret: + updated_content = updated_content.replace('my_sec: "앱키 시크릿"', f'my_sec: "{app_secret}"') + if hts_id: + updated_content = updated_content.replace('my_htsid: "사용자 HTS ID"', f'my_htsid: "{hts_id}"') + # ... 나머지 기존 로직 + + # 4. 수정된 설정을 파일로 저장 (원본 구조 보존) + try: + with open(kis_config_path, 'w', encoding='utf-8') as f: + f.write(updated_content) + + logging.info(f"✅ KIS 설정 파일이 생성되었습니다: {kis_config_path}") + + # 설정 요약 출력 + logging.info("📋 KIS 설정 요약:") + logging.info(f" - 실제 거래: {'✅' if app_key and app_secret else '❌'}") + logging.info(f" - 모의 거래: {'✅' if paper_app_key and paper_app_secret else '❌'}") + logging.info(f" - 계좌번호: {'✅' if any([acct_stock, acct_future, paper_stock, paper_future]) else '❌'}") + logging.info(f" - URL 설정: {'✅' if any([url_rest, url_rest_paper, url_ws, url_ws_paper]) else '❌'}") + + return True + + except Exception as e: + logging.error(f"❌ KIS 설정 파일 생성 실패: {e}") + return False diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/master_file.py b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/master_file.py new file mode 100644 index 0000000..a45f2bf --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/module/plugin/master_file.py @@ -0,0 +1,1593 @@ +import logging +import os +import shutil +import requests +from datetime import datetime +from typing import List +from module.plugin.database import Database +from typing import Dict +import pandas as pd + +class MasterFileManager: + """도구별 마스터파일 관리 클래스 (1:N 매핑 지원)""" + + # 툴별 필요한 마스터파일 매핑 (기존 마스터파일들을 툴별로 그룹화) + TOOL_MASTER_MAPPING = { + "domestic_stock": [ + "domestic_stock_master", # 코스닥 + "domestic_stock_kospi_master", # 코스피 + "domestic_stock_konex_master" # 코넥스 + ], + "overseas_stock": [ + "overseas_stock_master", # 나스닥 + "overseas_stock_nys_master", # 뉴욕 + "overseas_stock_ams_master", # 아멕스 + "overseas_stock_shs_master", # 상해 + "overseas_stock_shi_master", # 상해지수 + "overseas_stock_szs_master", # 심천 + "overseas_stock_szi_master", # 심천지수 + "overseas_stock_tse_master", # 도쿄 + "overseas_stock_hks_master", # 홍콩 + "overseas_stock_hnx_master", # 하노이 + "overseas_stock_hsx_master" # 호치민 + ], + "domestic_futureoption": [ + "domestic_future_master", + "domestic_index_future_master", + "domestic_cme_future_master", + "domestic_commodity_future_master", + "domestic_eurex_option_master" + ], + "overseas_futureoption": [ + "overseas_future_master", + "overseas_index_master" + ], + "domestic_bond": [ + "domestic_bond_master" + ], + "etfetn": [], # ETF/ETN 마스터파일 없음 + "elw": [ + "elw_master" + ], + "auth": [] # 인증은 마스터파일 불필요 + } + + # 마스터파일별 URL과 처리 함수 매핑 (한국투자증권 기준) + MASTER_FILE_PROCESS = { + # 국내주식 마스터파일 (코스닥) + "domestic_stock_master": { + "file": "https://new.real.download.dws.co.kr/common/master/kosdaq_code.mst.zip", + "process": "_MasterFileManager__process_domestic_stock", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "kosdaq" + }, + + # 국내주식 마스터파일 (코스피) + "domestic_stock_kospi_master": { + "file": "https://new.real.download.dws.co.kr/common/master/kospi_code.mst.zip", + "process": "_MasterFileManager__process_domestic_stock_kospi", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "kospi" + }, + + # 국내주식 마스터파일 (코넥스) + "domestic_stock_konex_master": { + "file": "https://new.real.download.dws.co.kr/common/master/konex_code.mst.zip", + "process": "_MasterFileManager__process_domestic_stock_konex", + "name_key": "stock_name", + "code_key": "short_code", + "ex_value": "konex" + }, + + # 해외주식 마스터파일 (나스닥 중심) - 실제 URL 확인됨 + "overseas_stock_master": { + "file": "https://new.real.download.dws.co.kr/common/master/nasmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "NAS" + }, + "overseas_stock_nys_master": { + "file": "https://new.real.download.dws.co.kr/common/master/nysmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "NYS" + }, + "overseas_stock_ams_master": { + "file": "https://new.real.download.dws.co.kr/common/master/amsmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "AMS" + }, + "overseas_stock_shs_master": { + "file": "https://new.real.download.dws.co.kr/common/master/shsmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "SHS" + }, + "overseas_stock_shi_master": { + "file": "https://new.real.download.dws.co.kr/common/master/shimst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "SHI" + }, + "overseas_stock_szs_master": { + "file": "https://new.real.download.dws.co.kr/common/master/szsmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "SZS" + }, + "overseas_stock_szi_master": { + "file": "https://new.real.download.dws.co.kr/common/master/szimst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "SZI" + }, + "overseas_stock_tse_master": { + "file": "https://new.real.download.dws.co.kr/common/master/tsemst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "TSE" + }, + "overseas_stock_hks_master": { + "file": "https://new.real.download.dws.co.kr/common/master/hksmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "HKS" + }, + "overseas_stock_hnx_master": { + "file": "https://new.real.download.dws.co.kr/common/master/hnxmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "HNX" + }, + "overseas_stock_hsx_master": { + "file": "https://new.real.download.dws.co.kr/common/master/hsxmst.cod.zip", + "process": "_MasterFileManager__process_overseas_stock", + "name_key": "korea_name", + "code_key": "symbol", + "ex_value": "HSX" + }, + + # 해외지수 마스터파일 (실제 URL 확인됨) + "overseas_index_master": { + "file": "https://new.real.download.dws.co.kr/common/master/frgn_code.mst.zip", + "process": "_MasterFileManager__process_overseas_index", + "name_key": "korean_name", + "code_key": "symbol", + "ex_value": "index" + }, + + # 국내선물 마스터파일 (주식선물옵션) + "domestic_future_master": { + "file": "https://new.real.download.dws.co.kr/common/master/fo_stk_code_mts.mst.zip", + "process": "_MasterFileManager__process_domestic_future", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "future" + }, + + # 국내선물 마스터파일 (지수선물옵션) + "domestic_index_future_master": { + "file": "https://new.real.download.dws.co.kr/common/master/fo_idx_code_mts.mst.zip", + "process": "_MasterFileManager__process_domestic_index_future", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "index" + }, + + # 국내선물 마스터파일 (CME연계 야간선물) + "domestic_cme_future_master": { + "file": "https://new.real.download.dws.co.kr/common/master/fo_cme_code.mst.zip", + "process": "_MasterFileManager__process_domestic_cme_future", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "cme" + }, + + # 국내선물 마스터파일 (상품선물옵션) + "domestic_commodity_future_master": { + "file": "https://new.real.download.dws.co.kr/common/master/fo_com_code.mst.zip", + "process": "_MasterFileManager__process_domestic_commodity_future", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "commodity" + }, + + # 국내옵션 마스터파일 (EUREX연계 야간옵션) + "domestic_eurex_option_master": { + "file": "https://new.real.download.dws.co.kr/common/master/fo_eurex_code.mst.zip", + "process": "_MasterFileManager__process_domestic_eurex_option", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "eurex" + }, + + # 해외선물 마스터파일 (실제 URL 확인됨) + "overseas_future_master": { + "file": "https://new.real.download.dws.co.kr/common/master/ffcode.mst.zip", + "process": "_MasterFileManager__process_overseas_future", + "name_key": "korean_name", + "code_key": "stock_code", + "ex_value": "future" + }, + + # 국내채권 마스터파일 (실제 URL 확인됨) + "domestic_bond_master": { + "file": "https://new.real.download.dws.co.kr/common/master/bond_code.mst.zip", + "process": "_MasterFileManager__process_domestic_bond", + "name_key": "bond_name", + "code_key": "standard_code", + "ex_value": "bond" + }, + + # ELW 마스터파일 (실제 URL 확인됨) + "elw_master": { + "file": "https://new.real.download.dws.co.kr/common/master/elw_code.mst.zip", + "process": "_MasterFileManager__process_elw", + "name_key": "korean_name", + "code_key": "short_code", + "ex_value": "elw" + } + } + + def __init__(self, tool_name: str): + self.tool_name = tool_name + self.master_dir = f"./configs/master/{tool_name}" + self.error_log_path = os.path.join(os.getcwd(), "configs", "master", "error.log") + + # 툴별 필요한 마스터파일 목록 가져오기 + self.required_masters = self.TOOL_MASTER_MAPPING.get(tool_name, []) + + # 마스터 디렉토리 생성 + os.makedirs(self.master_dir, exist_ok=True) + os.makedirs(os.path.dirname(self.error_log_path), exist_ok=True) + + # 데이터베이스 연결 (Singleton 패턴 활용) + self.db = Database() + # 필요시에만 초기화 (이미 초기화된 경우 스킵) + if not self.db.ensure_initialized(): + raise RuntimeError("데이터베이스 초기화에 실패했습니다.") + self.db_engine = self.db.get_by_name("master") + + # 오류 로그 설정 + self.error_logger = logging.getLogger(f"master_file_error_{self.tool_name}") + self.error_logger.setLevel(logging.ERROR) # ERROR 레벨부터 기록 + + # 기존 핸들러 제거 (중복 방지) + for handler in self.error_logger.handlers[:]: + self.error_logger.removeHandler(handler) + + # 파일 핸들러 추가 + file_handler = logging.FileHandler(self.error_log_path, encoding='utf-8') + file_handler.setLevel(logging.ERROR) # ERROR 레벨부터 기록 + + # 포맷터 설정 + formatter = logging.Formatter( + '%(asctime)s - %(name)s - %(levelname)s - %(message)s', + datefmt='%Y-%m-%d %H:%M:%S' + ) + file_handler.setFormatter(formatter) + + self.error_logger.addHandler(file_handler) + + def _log(self, level: str, master_file: str, operation: str, message: str): + """로그 기록 (통합)""" + log_msg = f"Tool: {self.tool_name}, Master: {master_file}, Operation: {operation}, {level}: {message}" + + + if level.lower() == "error": + self.error_logger.error(log_msg) + elif level.lower() == "warning": + self.error_logger.warning(log_msg) + else: + self.error_logger.info(log_msg) + + @staticmethod + def get_master_models_for_tool(tool_name: str) -> List: + """툴별 마스터 모델 목록 반환 (정적 메서드)""" + from model import ALL_MODELS + + # 툴명을 모델 클래스명으로 변환하는 매핑 + tool_to_model_mapping = { + "domestic_stock": "DomesticStockMaster", + "overseas_stock": "OverseasStockMaster", + "domestic_futureoption": "DomesticFutureoptionMaster", + "overseas_futureoption": "OverseasFutureoptionMaster", + "domestic_bond": "DomesticBondMaster", + "etfetn": "EtfetnMaster", + "elw": "ElwMaster", + "auth": "AuthMaster" + } + + model_name = tool_to_model_mapping.get(tool_name) + if not model_name: + return [] + + # ALL_MODELS에서 해당하는 모델 클래스 반환 + return [model for model in ALL_MODELS if model.__name__ == model_name] + + # ============================================== + + async def ensure_master_file_updated(self, ctx, force_update: bool = False): + """툴에 필요한 모든 마스터파일 체크 및 업데이트""" + try: + # 마스터파일이 필요 없는 툴인 경우 스킵 + if not self.required_masters: + await ctx.info(f"{self.tool_name} 툴은 마스터파일이 필요하지 않습니다.") + return + + # 1. 강제 업데이트가 아닌 경우 툴 전체 업데이트 시간 확인 + if not force_update: + last_update = self.db_engine.get_master_update_time(self.tool_name) + if last_update and not self.__should_update_from_db(last_update): + await ctx.info(f"{self.tool_name} 툴의 마스터파일들이 최신 상태입니다.") + return + + # 2. 카테고리 레벨에서 테이블 전체 삭제 (한 번만) + await self.__clear_category_tables(ctx) + + # 2-1. 해당 폴더의 CSV 파일들 삭제 + await self.__clear_category_csv_files(ctx) + + # 3. 각 마스터파일별로 업데이트 (삭제 없이 추가만) + total_record_count = 0 + for master_name in self.required_masters: + record_count = await self.__ensure_single_master_updated(ctx, master_name, force_update) + total_record_count += record_count + + # 4. 모든 마스터파일 처리 완료 후 툴 전체 업데이트 시간 기록 + if total_record_count > 0: + self.db_engine.update_master_timestamp(self.tool_name, total_record_count) + await ctx.info(f"{self.tool_name} 툴의 모든 마스터파일 업데이트 완료 (총 {total_record_count}개 레코드)") + + except Exception as e: + # 오류 로그 기록 + self._log("error", "all_masters", "check_update", str(e)) + await ctx.error(f"마스터파일 체크 실패: {str(e)}") + raise + + def is_master_file_available(self) -> bool: + """마스터파일들이 사용 가능한지 확인""" + try: + # 마스터파일이 필요 없는 툴인 경우 True 반환 + if not self.required_masters: + return True + + # 툴별 모델에서 데이터가 있는지 확인 (여러 마스터파일이 하나의 모델로 통합됨) + master_models = self.get_master_models_for_tool(self.tool_name) + + for model_class in master_models: + # 데이터베이스에서 레코드 수 확인 + record_count = self.db_engine.count(model_class) + if record_count == 0: + return False + + return True + + except Exception as e: + self._log("error", "all_masters", "check_availability", str(e)) + return False + + # def get_master_file_paths(self, master_name: str) -> str: + # """마스터파일 경로 반환""" + # return os.path.join(self.master_dir, f"{master_name}.tmp") + + async def __ensure_single_master_updated(self, ctx, master_name: str, force_update: bool = False) -> int: + """단일 마스터파일 체크 및 업데이트""" + # 마스터파일 다운로드 및 DB 저장 + await ctx.info(f"{master_name} 마스터파일 업데이트 중...") + + try: + # 1. URL 확인 + master_config = self.MASTER_FILE_PROCESS.get(master_name) + if not master_config: + raise Exception(f"{master_name}에 대한 마스터파일 설정이 없습니다.") + + master_url = master_config["file"] + + # 2. 임시 파일로 다운로드 + temp_file = os.path.join(self.master_dir, f"{master_name}.tmp") + await ctx.info(f"마스터파일 다운로드 중: {master_name}") + + success = await self.__download_file(master_url, temp_file) + if not success: + raise Exception(f"{master_name} 마스터파일 다운로드 실패") + + # 3. 파일 가공 (마스터파일별 특화 로직) - DataFrame 반환 + import pandas as pd + + # MASTER_FILE_PROCESS에서 처리 함수명 가져오기 + process_func_name = master_config.get("process") + if process_func_name: + try: + # 처리 함수 가져오기 + process_func = getattr(self, process_func_name) + # 가공 함수에서 DataFrame 반환받기 + df = await process_func(temp_file, ctx) + except Exception as e: + # 오류 로그 기록 + self._log("error", master_name, "process", str(e)) + await ctx.error(f"마스터파일 가공 실패: {master_name}, 오류: {str(e)}") + # 빈 DataFrame 반환 + df = pd.DataFrame() + else: + # 기본 처리 - 빈 DataFrame 반환 + await ctx.warning(f"지원하지 않는 마스터파일: {master_name}") + df = pd.DataFrame() + + # 4. CSV 파일 저장 + await ctx.info(f"CSV 파일 저장 중: {master_name} ({len(df)}개 레코드)") + csv_saved = await self.__save_csv_file(df, master_name, ctx) + + # 5. 모델에 저장 + await ctx.info(f"모델에 저장 중: {master_name} ({len(df)}개 레코드)") + + # 5-1. 모델용 데이터 변환 + model_data = self.__convert_to_model_data(df, master_name) + + # 5-2. 모델에 저장 + try: + model_class = self.__get_model_class(master_name) + if not model_class: + raise Exception(f"{master_name}에 대한 모델 클래스를 찾을 수 없습니다.") + + # bulk_replace_master_data 사용 (카테고리 레벨에서 이미 삭제되었으므로 INSERT만) + record_count = self.db_engine.bulk_replace_master_data( + model_class=model_class, + data_list=model_data, + master_name=master_name + ) + except Exception as e: + # 에러 로깅 시스템에 기록 + self._log("error", master_name, "bulk_replace_master_data", str(e)) + raise + + await ctx.info(f"데이터베이스 저장 완료: {master_name} ({record_count}개 레코드)") + + # 6. 임시 파일 정리 (보존) + # if os.path.exists(temp_file): + # os.remove(temp_file) + + await ctx.info(f"{master_name} 마스터파일 업데이트 완료") + return record_count + + except Exception as e: + # 오류 로그 기록 + self._log("error", master_name, "download_and_save", str(e)) + # 임시 파일 정리 (보존) + # temp_file = os.path.join(self.master_dir, f"{master_name}.tmp") + # if os.path.exists(temp_file): + # os.remove(temp_file) + raise + + def __should_update_from_db(self, last_update: datetime) -> bool: + """DB 기반 업데이트 필요 여부 확인""" + try: + return last_update.date() < datetime.now().date() + except (ValueError, AttributeError): + return True # 날짜 파싱 실패 시 업데이트 + + async def __clear_category_tables(self, ctx): + """카테고리 레벨에서 해당 툴의 모든 테이블 데이터 삭제""" + try: + # 툴별 모델 클래스들 가져오기 + master_models = self.get_master_models_for_tool(self.tool_name) + + if not master_models: + await ctx.info(f"{self.tool_name} 툴에 해당하는 모델이 없습니다.") + return + + # 각 모델의 테이블 데이터 삭제 + for model_class in master_models: + try: + # 기존 데이터 개수 확인 + before_count = self.db_engine.count(model_class) + + # 테이블 전체 삭제 + session = self.db_engine.get_session() + try: + deleted_count = session.query(model_class).delete() + session.commit() + await ctx.info(f"{model_class.__name__} 테이블 데이터 삭제 완료: {deleted_count}개 레코드") + finally: + session.close() + + except Exception as e: + self._log("error", model_class.__name__, "clear_table", str(e)) + await ctx.error(f"{model_class.__name__} 테이블 삭제 실패: {str(e)}") + raise + + except Exception as e: + self._log("error", "all_models", "clear_category_tables", str(e)) + await ctx.error(f"카테고리 테이블 삭제 실패: {str(e)}") + raise + + async def __clear_category_csv_files(self, ctx): + """카테고리 레벨에서 해당 툴의 모든 CSV 파일 및 임시 파일 삭제""" + try: + import glob + + # 해당 툴의 마스터 디렉토리 경로 + master_dir = self.master_dir + + if not os.path.exists(master_dir): + await ctx.info(f"마스터 디렉토리가 존재하지 않습니다: {master_dir}") + return + + # CSV 파일 패턴으로 검색 + csv_pattern = os.path.join(master_dir, "*.csv") + csv_files = glob.glob(csv_pattern) + + # 임시 파일 패턴으로 검색 (.tmp, .tmp.zip 등) + tmp_patterns = [ + os.path.join(master_dir, "*.tmp"), + os.path.join(master_dir, "*.tmp.*"), + os.path.join(master_dir, "*_part*.tmp"), + os.path.join(master_dir, "*_part*.tmp.*") + ] + + tmp_files = [] + for pattern in tmp_patterns: + tmp_files.extend(glob.glob(pattern)) + + all_files = csv_files + tmp_files + + if not all_files: + await ctx.info(f"삭제할 파일이 없습니다: {master_dir}") + return + + # 파일들 삭제 + deleted_count = 0 + for file_path in all_files: + try: + os.remove(file_path) + deleted_count += 1 + file_type = "CSV" if file_path.endswith('.csv') else "TMP" + await ctx.info(f"{file_type} 파일 삭제: {os.path.basename(file_path)}") + except Exception as e: + self._log("error", os.path.basename(file_path), "delete_file", str(e)) + await ctx.warning(f"파일 삭제 실패: {os.path.basename(file_path)} - {str(e)}") + + await ctx.info(f"파일 삭제 완료: {deleted_count}개 파일 (CSV + TMP)") + + except Exception as e: + self._log("error", "all_files", "clear_category_csv_files", str(e)) + await ctx.error(f"카테고리 파일 삭제 실패: {str(e)}") + raise + + def __get_model_class(self, master_name: str): + """마스터파일명에 해당하는 모델 클래스 반환 - TOOL_MASTER_MAPPING 활용""" + # TOOL_MASTER_MAPPING을 역방향으로 검색하여 마스터파일이 속한 툴 찾기 + for tool_name, master_files in self.TOOL_MASTER_MAPPING.items(): + if master_name in master_files: + # 해당 툴의 모델 클래스들 가져오기 + master_models = self.get_master_models_for_tool(tool_name) + if master_models: + # 첫 번째 모델 클래스 반환 (각 툴당 하나의 모델만 있음) + return master_models[0] + + # 마스터파일이 TOOL_MASTER_MAPPING에 없는 경우 None 반환 + return None + + async def __download_file(self, url: str, file_path: str) -> bool: + """파일 다운로드 (ZIP 파일 지원)""" + try: + import zipfile + import ssl + + # SSL 컨텍스트 설정 (한국투자증권 서버용) + ssl._create_default_https_context = ssl._create_unverified_context + + response = requests.get(url, timeout=60) # 대용량 파일을 위해 타임아웃 증가 + response.raise_for_status() + + # ZIP 파일인지 확인 + if url.endswith('.zip'): + # ZIP 파일로 저장 + zip_file_path = file_path + '.zip' + with open(zip_file_path, 'wb') as f: + f.write(response.content) + + # ZIP 파일 압축 해제 + with zipfile.ZipFile(zip_file_path, 'r') as zip_ref: + zip_ref.extractall(os.path.dirname(file_path)) + + # 압축 해제된 파일명 찾기 + extracted_files = zip_ref.namelist() + if extracted_files: + # .mst 파일 찾기 + mst_file = next((f for f in extracted_files if f.endswith('.mst')), extracted_files[0]) + extracted_path = os.path.join(os.path.dirname(file_path), mst_file) + + # 원본 파일명으로 이동 + if extracted_path != file_path: + shutil.move(extracted_path, file_path) + + # ZIP 파일 삭제 + os.remove(zip_file_path) + else: + # 일반 파일로 저장 + with open(file_path, 'wb') as f: + f.write(response.content) + + return True + except Exception as e: + # 오류 로그 기록 + master_file = os.path.basename(file_path) + self._log("error", master_file, "download", str(e)) + return False + + def __get_master_update_status(self, master_name: str = None): + """마스터파일 업데이트 상태 조회""" + if master_name: + last_update = self.db_engine.get_master_update_time(master_name) + model_class = self.__get_model_class(master_name) + record_count = 0 + if model_class: + record_count = self.db_engine.count(model_class) + + return { + "master_name": master_name, + "last_updated": last_update, + "record_count": record_count, + "needs_update": self.__should_update_from_db(last_update) if last_update else True + } + + # 툴 전체 상태 조회 + last_update = self.db_engine.get_master_update_time(self.tool_name) + total_record_count = 0 + + # 툴의 모든 마스터 모델에서 레코드 수 합계 + master_models = self.get_master_models_for_tool(self.tool_name) + for model_class in master_models: + total_record_count += self.db_engine.count(model_class) + + return { + "tool_name": self.tool_name, + "last_updated": last_update, + "total_record_count": total_record_count, + "needs_update": self.__should_update_from_db(last_update) if last_update else True, + "master_files": self.required_masters + } + + # ========== 공통 유틸리티 메서드들 ========== + + async def _read_file_with_encoding(self, file_path: str, ctx) -> str: + """여러 인코딩을 시도하여 파일 읽기""" + encodings = ['cp949', 'euc-kr', 'utf-8', 'utf-8-sig', 'iso-8859-1', 'latin1'] + + for encoding in encodings: + try: + with open(file_path, mode="r", encoding=encoding) as f: + content = f.read() + await ctx.info(f"파일을 {encoding} 인코딩으로 성공적으로 읽었습니다.") + return content + except UnicodeDecodeError: + continue + except Exception as e: + await ctx.warning(f"{encoding} 인코딩 시도 중 오류: {str(e)}") + continue + + raise Exception("모든 인코딩 시도 실패") + + def _create_dataframe(self, data, columns): + """DataFrame 생성 및 공통 처리""" + import pandas as pd + + df = pd.DataFrame(data, columns=columns) + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + return df + + def _read_csv_with_encoding(self, file_path: str, **kwargs): + """여러 인코딩을 시도하여 CSV 파일 읽기""" + import pandas as pd + + encodings = ['cp949', 'euc-kr', 'utf-8', 'utf-8-sig', 'iso-8859-1', 'latin1'] + + for encoding in encodings: + try: + df = pd.read_csv(file_path, encoding=encoding, **kwargs) + return df + except UnicodeDecodeError: + continue + except Exception as e: + continue + + raise Exception("모든 인코딩 시도 실패") + + def _read_fwf_with_encoding(self, file_path: str, **kwargs): + """여러 인코딩을 시도하여 고정폭 파일 읽기""" + import pandas as pd + + encodings = ['cp949', 'euc-kr', 'utf-8', 'utf-8-sig', 'iso-8859-1', 'latin1'] + + for encoding in encodings: + try: + df = pd.read_fwf(file_path, encoding=encoding, **kwargs) + return df + except UnicodeDecodeError: + continue + except Exception as e: + continue + + raise Exception("모든 인코딩 시도 실패") + + def __convert_to_model_data(self, df, master_name: str) -> List[Dict]: + """DataFrame을 모델용 데이터로 변환 - MASTER_FILE_PROCESS의 name_key, code_key, ex_value 사용""" + try: + model_data = [] + + # MASTER_FILE_PROCESS에서 name_key, code_key, ex_value 가져오기 + master_config = self.MASTER_FILE_PROCESS.get(master_name, {}) + name_key = master_config.get("name_key", "name") + code_key = master_config.get("code_key", "code") + ex_value = master_config.get("ex_value", "") + + for _, row in df.iterrows(): + # 지정된 키로 종목명과 종목코드 추출 + name = None + code = None + + # 종목명 추출 (띄어쓰기 제거) + if name_key in row and pd.notna(row[name_key]) and str(row[name_key]).strip(): + name_str = str(row[name_key]).strip() + if name_str not in ['nan', 'NaN', 'None', 'null', '']: + name = name_str.replace(" ", "") + + # 종목코드 추출 + if code_key in row and pd.notna(row[code_key]) and str(row[code_key]).strip(): + code_str = str(row[code_key]).strip() + if code_str not in ['nan', 'NaN', 'None', 'null', '']: + code = code_str + + # 유효한 데이터만 추가 + if name and code: + model_data.append({ + 'name': name, + 'code': code, + 'ex': ex_value + }) + + return model_data + + except Exception as e: + self._log("error", master_name, "convert_to_model_data", str(e)) + return [] + + async def __save_csv_file(self, df, master_name: str, ctx) -> bool: + """DataFrame을 CSV 파일로 저장""" + try: + if df.empty: + await ctx.warning(f"빈 DataFrame으로 CSV 파일을 생성하지 않습니다: {master_name}") + return False + + # CSV 저장 전 추가 nan 처리 + df_clean = df.copy() + df_clean = df_clean.replace(['nan', 'NaN', 'None', 'null'], '') + + # CSV 파일 경로 설정 + csv_file_path = os.path.join(self.master_dir, f"{master_name}.csv") + + # CSV 파일 저장 (UTF-8 BOM 인코딩으로 한글 지원) + df_clean.to_csv(csv_file_path, index=False, encoding='utf-8-sig') + + await ctx.info(f"CSV 파일 저장 완료: {csv_file_path} ({len(df_clean)}개 레코드)") + return True + + except Exception as e: + self._log("error", master_name, "save_csv", str(e)) + await ctx.error(f"CSV 파일 저장 실패: {master_name}, 오류: {str(e)}") + return False + + + + # ========== 마스터파일별 특화 가공 메서드들 ========== + + async def __process_domestic_stock(self, raw_file: str, ctx) -> pd.DataFrame: + """국내주식 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내주식 마스터파일 가공 중...") + + try: + import pandas as pd + import os + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 원본 코드와 정확히 동일한 파싱 + tmp_fil1 = raw_file.replace('.tmp', '_part1.tmp') + tmp_fil2 = raw_file.replace('.tmp', '_part2.tmp') + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + rf1 = row[0:len(row) - 222] + rf1_1 = rf1[0:9].rstrip() + rf1_2 = rf1[9:21].rstrip() + rf1_3 = rf1[21:].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + '\n') + rf2 = row[-222:] + wf2.write(rf2) + + wf1.close() + wf2.close() + + part1_columns = ['short_code', 'standard_code', 'korean_name'] + df1 = self._read_csv_with_encoding(tmp_fil1, header=None, names=part1_columns, dtype=str) + + field_specs = [2, 1, + 4, 4, 4, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 9, + 5, 5, 1, 1, 1, + 2, 1, 1, 1, 2, + 2, 2, 3, 1, 3, + 12, 12, 8, 15, 21, + 2, 7, 1, 1, 1, + 1, 9, 9, 9, 5, + 9, 8, 9, 3, 1, + 1, 1 + ] + + part2_columns = ['security_group_code', 'market_cap_scale_code', + 'industry_large_code', 'industry_medium_code', 'industry_small_code', 'venture_company_yn', + 'low_liquidity_yn', 'krx_stock_yn', 'etp_product_code', 'krx100_stock_yn', + 'krx_auto_yn', 'krx_semiconductor_yn', 'krx_bio_yn', 'krx_bank_yn', 'spac_yn', + 'krx_energy_chemical_yn', 'krx_steel_yn', 'short_term_overheat_code', 'krx_media_telecom_yn', + 'krx_construction_yn', 'kosdaq_investment_caution_yn', 'krx_security_division', 'krx_ship_division', + 'krx_sector_insurance_yn', 'krx_sector_transport_yn', 'kosdaq150_index_yn', 'stock_base_price', + 'regular_market_unit', 'after_hours_market_unit', 'trading_halt_yn', 'liquidation_yn', + 'management_stock_yn', 'market_warning_code', 'market_warning_risk_yn', 'dishonest_disclosure_yn', + 'bypass_listing_yn', 'lock_division_code', 'par_value_change_code', 'capital_increase_code', 'margin_rate', + 'credit_order_yn', 'credit_period', 'prev_day_volume', 'stock_par_value', 'stock_listing_date', 'listed_shares_thousand', + 'capital', 'settlement_month', 'public_offering_price', 'preferred_stock_code', 'short_sale_overheat_yn', 'unusual_rise_yn', + 'krx300_stock_yn', 'sales', 'operating_profit', 'ordinary_profit', 'net_income', 'roe', + 'base_year_month', 'prev_day_market_cap_billion', 'group_company_code', 'company_credit_limit_exceed_yn', 'collateral_loan_yn', 'securities_lending_yn' + ] + + df2 = self._read_fwf_with_encoding(tmp_fil2, widths=field_specs, names=part2_columns) + + df = pd.merge(df1, df2, how='outer', left_index=True, right_index=True) + + # 공통 DataFrame 처리 + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + + # clean temporary file and dataframe + del (df1) + del (df2) + os.remove(tmp_fil1) + os.remove(tmp_fil2) + + await ctx.info(f"국내주식 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_stock_master", "process", str(e)) + await ctx.error(f"국내주식 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_stock_kospi(self, raw_file: str, ctx) -> pd.DataFrame: + """국내주식 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내주식 마스터파일 가공 중...") + + try: + import pandas as pd + import os + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 원본 코드와 정확히 동일한 파싱 + tmp_fil1 = raw_file.replace('.tmp', '_part1.tmp') + tmp_fil2 = raw_file.replace('.tmp', '_part2.tmp') + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + rf1 = row[0:len(row) - 228] + rf1_1 = rf1[0:9].rstrip() + rf1_2 = rf1[9:21].rstrip() + rf1_3 = rf1[21:].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + '\n') + rf2 = row[-228:] + wf2.write(rf2) + + wf1.close() + wf2.close() + + part1_columns = ['short_code', 'standard_code', 'korean_name'] + df1 = self._read_csv_with_encoding(tmp_fil1, header=None, names=part1_columns, dtype=str) + + field_specs = [2, 1, 4, 4, 4, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 9, 5, 5, 1, + 1, 1, 2, 1, 1, + 1, 2, 2, 2, 3, + 1, 3, 12, 12, 8, + 15, 21, 2, 7, 1, + 1, 1, 1, 1, 9, + 9, 9, 5, 9, 8, + 9, 3, 1, 1, 1 + ] + + part2_columns = ['group_code', 'market_cap_scale', 'industry_large', 'industry_medium', 'industry_small', + 'manufacturing', 'low_liquidity', 'governance_index_stock', 'kospi200_sector_industry', 'kospi100', + 'kospi50', 'krx', 'etp', 'elw_issuance', 'krx100', + 'krx_auto', 'krx_semiconductor', 'krx_bio', 'krx_bank', 'spac', + 'krx_energy_chemical', 'krx_steel', 'short_term_overheat', 'krx_media_telecom', 'krx_construction', + 'non1', 'krx_security', 'krx_ship', 'krx_sector_insurance', 'krx_sector_transport', + 'sri', 'base_price', 'trading_unit', 'after_hours_unit', 'trading_halt', + 'liquidation', 'management_stock', 'market_warning', 'warning_forecast', 'dishonest_disclosure', + 'bypass_listing', 'lock_division', 'par_value_change', 'capital_increase', 'margin_rate', + 'credit_available', 'credit_period', 'prev_day_volume', 'par_value', 'listing_date', + 'listed_shares', 'capital', 'settlement_month', 'public_offering_price', 'preferred_stock', + 'short_sale_overheat', 'unusual_rise', 'krx300', 'kospi', 'sales', + 'operating_profit', 'ordinary_profit', 'net_income', 'roe', 'base_year_month', + 'market_cap', 'group_company_code', 'company_credit_limit_exceed', 'collateral_loan_available', 'securities_lending_available' + ] + + df2 = self._read_fwf_with_encoding(tmp_fil2, widths=field_specs, names=part2_columns) + + df = pd.merge(df1, df2, how='outer', left_index=True, right_index=True) + + # 공통 DataFrame 처리 + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + + # clean temporary file and dataframe + del (df1) + del (df2) + os.remove(tmp_fil1) + os.remove(tmp_fil2) + + await ctx.info(f"국내주식 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_stock_kospi_master", "process", str(e)) + await ctx.error(f"국내주식 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_stock_konex(self, raw_file: str, ctx) -> pd.DataFrame: + """국내주식 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내주식 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + await ctx.info("복잡한 고정폭 텍스트 파일 파싱 중...") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + lines = file_content.splitlines() + + data = [] + for row in lines: + row = row.strip() + mksc_shrn_iscd = row[0:9].strip() + stnd_iscd = row[9:21].strip() + scrt_grp_cls_code = row[-184:-182].strip() + stck_sdpr = row[-182:-173].strip() + frml_mrkt_deal_qty_unit = row[-173:-168].strip() + ovtm_mrkt_deal_qty_unit = row[-168:-163].strip() + trht_yn = row[-163:-162].strip() + sltr_yn = row[-162:-161].strip() + mang_issu_yn = row[-161:-160].strip() + mrkt_alrm_cls_code = row[-160:-158].strip() + mrkt_alrm_risk_adnt_yn = row[-158:-157].strip() + insn_pbnt_yn = row[-157:-156].strip() + byps_lstn_yn = row[-156:-155].strip() + flng_cls_code = row[-155:-153].strip() + fcam_mod_cls_code = row[-153:-151].strip() + icic_cls_code = row[-151:-149].strip() + marg_rate = row[-149:-146].strip() + crdt_able = row[-146:-145].strip() + crdt_days = row[-145:-142].strip() + prdy_vol = row[-142:-130].strip() + stck_fcam = row[-130:-118].strip() + stck_lstn_date = row[-118:-110].strip() + lstn_stcn = row[-110:-95].strip() + cpfn = row[-95:-74].strip() + stac_month = row[-74:-72].strip() + po_prc = row[-72:-65].strip() + prst_cls_code = row[-65:-64].strip() + ssts_hot_yn = row[-64:-63].strip() + stange_runup_yn = row[-63:-62].strip() + krx300_issu_yn = row[-62:-61].strip() + sale_account = row[-61:-52].strip() + bsop_prfi = row[-52:-43].strip() + op_prfi = row[-43:-34].strip() + thtr_ntin = row[-34:-29].strip() + roe = row[-29:-20].strip() + base_date = row[-20:-12].strip() + prdy_avls_scal = row[-12:-3].strip() + co_crdt_limt_over_yn = row[-3:-2].strip() + secu_lend_able_yn = row[-2:-1].strip() + stln_able_yn = row[-1:].strip() + hts_kor_isnm = row[21:-184].strip() + + data.append([mksc_shrn_iscd, stnd_iscd, hts_kor_isnm, scrt_grp_cls_code, + stck_sdpr, frml_mrkt_deal_qty_unit, ovtm_mrkt_deal_qty_unit, + trht_yn, sltr_yn, mang_issu_yn, mrkt_alrm_cls_code, + mrkt_alrm_risk_adnt_yn, insn_pbnt_yn, byps_lstn_yn, + flng_cls_code, fcam_mod_cls_code, icic_cls_code, marg_rate, + crdt_able, crdt_days, prdy_vol, stck_fcam, stck_lstn_date, + lstn_stcn, cpfn, stac_month, po_prc, prst_cls_code, ssts_hot_yn, + stange_runup_yn, krx300_issu_yn, sale_account, bsop_prfi, + op_prfi, thtr_ntin, roe, base_date, prdy_avls_scal, + co_crdt_limt_over_yn, secu_lend_able_yn, stln_able_yn]) + + columns = ['short_code', 'standard_code', 'stock_name', 'security_group_code', 'stock_base_price', + 'regular_market_unit', 'after_hours_market_unit', 'trading_halt_yn', + 'liquidation_yn', 'management_stock_yn', 'market_warning_code', 'market_warning_risk_yn', + 'dishonest_disclosure_yn', 'bypass_listing_yn', 'lock_division_code', 'par_value_change_code', + 'capital_increase_code', 'margin_rate', 'credit_order_yn', 'credit_period', 'prev_day_volume', + 'stock_par_value', 'stock_listing_date', 'listed_shares_thousand', 'capital', 'settlement_month', 'public_offering_price', + 'preferred_stock_code', 'short_sale_overheat_yn', 'unusual_rise_yn', 'krx300_stock_yn', + 'sales', 'operating_profit', 'ordinary_profit', 'net_income', 'roe', 'base_year_month', 'prev_day_market_cap_billion', + 'company_credit_limit_exceed_yn', 'collateral_loan_yn', 'securities_lending_yn'] + + # 공통 DataFrame 처리 + df = self._create_dataframe(data, columns) + + await ctx.info(f"국내주식 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_stock_konex_master", "process", str(e)) + await ctx.error(f"국내주식 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_overseas_stock(self, raw_file: str, ctx) -> pd.DataFrame: + """해외주식 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("해외주식 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + columns = ['national_code', 'exchange_id', 'exchange_code', 'exchange_name', 'symbol', 'realtime_symbol', + 'korea_name', 'english_name', 'security_type', 'currency', + 'float_position', 'data_type', 'base_price', 'bid_order_size', 'ask_order_size', + 'market_start_time', 'market_end_time', 'dr_yn', 'dr_country_code', 'industry_classification_code', + 'index_constituent_yn', 'tick_size_type', + 'classification_code', + 'tick_size_type_detail'] + + # 파일 읽기 (공통 로직) + df = self._read_csv_with_encoding(raw_file, sep='\t', dtype=str) + df.columns = columns + + # 공통 DataFrame 처리 + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + + await ctx.info(f"해외주식 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "overseas_stock_master", "process", str(e)) + await ctx.error(f"해외주식 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_overseas_index(self, raw_file: str, ctx) -> pd.DataFrame: + """해외지수 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("해외지수 마스터파일 가공 중...") + + try: + import pandas as pd + import os + + # 원본 코드와 정확히 동일한 파싱 + tmp_fil1 = raw_file.replace('.tmp', '_part1.tmp') + tmp_fil2 = raw_file.replace('.tmp', '_part2.tmp') + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + if row[0:1] == 'X': + rf1 = row[0:len(row) - 14] + rf_1 = rf1[0:1] + rf1_2 = rf1[1:11] + rf1_3 = rf1[11:40].replace(",", "") + rf1_4 = rf1[40:80].replace(",", "").strip() + wf1.write(rf_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + '\n') + rf2 = row[-15:] + wf2.write(rf2 + '\n') + continue + rf1 = row[0:len(row) - 14] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:11] + rf1_3 = rf1[11:50].replace(",", "") + rf1_4 = row[50:75].replace(",", "").strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + '\n') + rf2 = row[-15:] + wf2.write(rf2 + '\n') + + wf1.close() + wf2.close() + + part1_columns = ['division_code', 'symbol', 'english_name', 'korean_name'] + df1 = self._read_csv_with_encoding(tmp_fil1, header=None, names=part1_columns, dtype=str) + + field_specs = [4, 1, 1, 1, 4, 3] + part2_columns = ['industry_code', 'dow30_inclusion_yn', 'nasdaq100_inclusion_yn', 'sp500_inclusion_yn', 'exchange_code', 'country_division_code'] + df2 = self._read_fwf_with_encoding(tmp_fil2, widths=field_specs, names=part2_columns) + df2['industry_code'] = df2['industry_code'].str.replace(pat=r'[^A-Z]', repl=r'', regex=True) + df2['dow30_inclusion_yn'] = df2['dow30_inclusion_yn'].str.replace(pat=r'[^0-1]+', repl=r'', regex=True) + df2['nasdaq100_inclusion_yn'] = df2['nasdaq100_inclusion_yn'].str.replace(pat=r'[^0-1]+', repl=r'', regex=True) + df2['sp500_inclusion_yn'] = df2['sp500_inclusion_yn'].str.replace(pat=r'[^0-1]+', repl=r'', regex=True) + + DF = pd.concat([df1, df2], axis=1) + + # 공통 DataFrame 처리 + DF = DF.astype(str) + DF = DF.replace(['nan', 'NaN', 'None', 'null'], '') + + # 임시 파일들 정리 + os.remove(tmp_fil1) + os.remove(tmp_fil2) + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"해외지수 마스터파일 가공 완료: {len(DF)}개 종목") + return DF + + except Exception as e: + self._log("error", "overseas_index_master", "process", str(e)) + await ctx.error(f"해외지수 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_future(self, raw_file: str, ctx) -> pd.DataFrame: + """국내선물 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내선물 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + columns = ['product_type', 'short_code', 'standard_code', 'korean_name', 'atm_division', + 'strike_price', 'maturity_division_code', 'underlying_short_code', 'underlying_name'] + + # 파일 읽기 (공통 로직) + df = self._read_csv_with_encoding(raw_file, sep='|', header=None, dtype=str) + df.columns = columns + + # 공통 DataFrame 처리 + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"국내선물 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_future_master", "process", str(e)) + await ctx.error(f"국내선물 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_index_future(self, raw_file: str, ctx) -> pd.DataFrame: + """국내지수선물 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내지수선물 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + columns = ['product_type', 'short_code', 'standard_code', 'korean_name', 'atm_division', + 'strike_price', 'maturity_division_code', 'underlying_short_code', 'underlying_name'] + + # 파일 읽기 (공통 로직) + df = self._read_csv_with_encoding(raw_file, sep='|', header=None, dtype=str) + df.columns = columns + + # 공통 DataFrame 처리 + df = df.astype(str) + df = df.replace(['nan', 'NaN', 'None', 'null'], '') + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"국내지수선물 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_index_future_master", "process", str(e)) + await ctx.error(f"국내지수선물 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_cme_future(self, raw_file: str, ctx) -> pd.DataFrame: + """국내CME연계 야간선물 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내CME연계 야간선물 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + columns = ['product_type', 'short_code', 'standard_code', 'korean_name', 'strike_price', 'underlying_short_code', 'underlying_name'] + df = pd.DataFrame(columns=columns) + ridx = 1 + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + a = row[0:1] + b = row[1:10].strip() + c = row[10:22].strip() + d = row[22:63].strip() + e = row[63:72].strip() + f = row[72:81].strip() + g = row[81:].strip() + df.loc[ridx] = [a, b, c, d, e, f, g] + ridx += 1 + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"국내CME연계 야간선물 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_cme_future_master", "process", str(e)) + await ctx.error(f"국내CME연계 야간선물 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_commodity_future(self, raw_file: str, ctx) -> pd.DataFrame: + """국내상품선물 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내상품선물 마스터파일 가공 중...") + + try: + import pandas as pd + import os + + # 원본 코드와 정확히 동일한 파싱 + # df1 : '상품구분','상품종류','단축코드','표준코드','한글종목명' + tmp_fil1 = raw_file.replace('.tmp', '_part1.tmp') + tmp_fil2 = raw_file.replace('.tmp', '_part2.tmp') + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + rf1 = row[0:55] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:2] + rf1_3 = rf1[2:11].strip() + rf1_4 = rf1[11:23].strip() + rf1_5 = rf1[23:55].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + ',' + rf1_5 + '\n') + rf2 = row[55:].lstrip() + wf2.write(rf2) + + wf1.close() + wf2.close() + + part1_columns = ['product_division', 'product_type', 'short_code', 'standard_code', 'korean_name'] + df1 = self._read_csv_with_encoding(tmp_fil1, header=None, names=part1_columns) + + # df2 : '월물구분코드','기초자산 단축코드','기초자산 명' + tmp_fil3 = raw_file.replace('.tmp', '_part3.tmp') + wf3 = open(tmp_fil3, mode="w") + + # tmp_fil2 읽기 (공통 함수 사용) + tmp_fil2_content = await self._read_file_with_encoding(tmp_fil2, ctx) + for row in tmp_fil2_content.splitlines(): + rf2 = row[:] + rf2_1 = rf2[8:9] + rf2_2 = rf2[9:12] + rf2_3 = rf2[12:].strip() + wf3.write(rf2_1 + ',' + rf2_2 + ',' + rf2_3 + '\n') + + wf3.close() + + part2_columns = ['maturity_division_code', 'underlying_short_code', 'underlying_name'] + df2 = self._read_csv_with_encoding(tmp_fil3, header=None, names=part2_columns) + + # DF : df1 + df2 + df = pd.concat([df1, df2], axis=1) + + # 임시 파일들 정리 + for tmp_file in [tmp_fil1, tmp_fil2, tmp_fil3]: + if os.path.exists(tmp_file): + os.unlink(tmp_file) + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"국내상품선물 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_commodity_future_master", "process", str(e)) + await ctx.error(f"국내상품선물 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_eurex_option(self, raw_file: str, ctx) -> pd.DataFrame: + """국내EUREX연계 야간옵션 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내EUREX연계 야간옵션 마스터파일 가공 중...") + + try: + import pandas as pd + import os + + # 파일이 존재하지 않는 경우 빈 DataFrame 반환 + if not os.path.exists(raw_file): + await ctx.warning(f"파일이 존재하지 않습니다: {raw_file}") + return pd.DataFrame() + + # 원본 코드와 정확히 동일한 파싱 + # df1 : '상품종류','단축코드','표준코드','한글종목명' + tmp_fil1 = raw_file.replace('.tmp', '_part1.tmp') + tmp_fil2 = raw_file.replace('.tmp', '_part2.tmp') + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 파일 내용을 라인별로 처리 (참조 사이트와 정확히 동일) + for row in file_content.splitlines(): + rf1 = row[0:59] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:10] + rf1_3 = rf1[10:22].strip() + rf1_4 = rf1[22:59].strip() + # 마지막 필드에 콤마가 포함될 수 있으므로 따옴표로 감싸기 + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',"' + rf1_4 + '"' + '\n') + rf2 = row[59:].lstrip() + wf2.write(rf2 + '\n') + + wf1.close() + wf2.close() + + part1_columns = ['product_type', 'short_code', 'standard_code', 'korean_name'] + df1 = self._read_csv_with_encoding(tmp_fil1, header=None, names=part1_columns) + + + # df2 : 'ATM구분','행사가','기초자산 단축코드','기초자산 명' + tmp_fil3 = raw_file.replace('.tmp', '_part3.tmp') + wf3 = open(tmp_fil3, mode="w") + + # tmp_fil2 읽기 (참조 사이트와 동일하게 cp949 직접 사용) + with open(tmp_fil2, mode="r", encoding="cp949") as f: + for row in f: + rf2 = row[:] + rf2_1 = rf2[0:1] + rf2_2 = rf2[1:9] + rf2_3 = rf2[9:17] + rf2_4 = rf2[17:].strip() + wf3.write(rf2_1 + ',' + rf2_2 + ',' + rf2_3 + ',' + rf2_4 + '\n') + + wf3.close() + + part2_columns = ['atm_division', 'strike_price', 'underlying_short_code', 'underlying_name'] + df2 = self._read_csv_with_encoding(tmp_fil3, header=None, names=part2_columns) + + # DF : df1 + df2 + df = pd.concat([df1, df2], axis=1) + + # 임시 파일들 정리 + for tmp_file in [tmp_fil1, tmp_fil2, tmp_fil3]: + if os.path.exists(tmp_file): + os.unlink(tmp_file) + + # DataFrame 직접 반환 (CSV 저장 제거됨) + await ctx.info(f"국내EUREX연계 야간옵션 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_eurex_option_master", "process", str(e)) + await ctx.error(f"국내EUREX연계 야간옵션 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_overseas_future(self, raw_file: str, ctx) -> pd.DataFrame: + """해외선물 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("해외선물 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + columns = ['stock_code', 'server_auto_order_yn', 'server_auto_twap_yn', 'server_auto_economic_order_yn', + 'filler', 'korean_name', 'exchange_code', 'item_code', 'item_type', 'output_decimal', 'calculation_decimal', + 'tick_size', 'tick_value', 'contract_size', 'price_display_base', 'conversion_multiplier', 'most_active_month_yn', + 'nearest_month_yn', 'spread_yn', 'spread_leg1_yn', 'sub_exchange_code'] + df = pd.DataFrame(columns=columns) + ridx = 1 + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + + # 파일 내용을 라인별로 처리 + for row in file_content.splitlines(): + a = row[:32] # 종목코드 + b = row[32:33].rstrip() # 서버자동주문 가능 종목 여부 + c = row[33:34].rstrip() # 서버자동주문 TWAP 가능 종목 여부 + d = row[34:35] # 서버자동 경제지표 주문 가능 종목 여부 + e = row[35:82].rstrip() # 필러 + f = row[82:107].rstrip() # 종목한글명 + g = row[-92:-82] # 거래소코드 (ISAM KEY 1) + h = row[-82:-72].rstrip() # 품목코드 (ISAM KEY 2) + i = row[-72:-69].rstrip() # 품목종류 + j = row[-69:-64] # 출력 소수점 + k = row[-64:-59].rstrip() # 계산 소수점 + l = row[-59:-45].rstrip() # 틱사이즈 + m = row[-45:-31] # 틱가치 + n = row[-31:-21].rstrip() # 계약크기 + o = row[-21:-17].rstrip() # 가격표시진법 + p = row[-17:-7] # 환산승수 + q = row[-7:-6].rstrip() # 최다월물여부 0:원월물 1:최다월물 + r = row[-6:-5].rstrip() # 최근월물여부 0:원월물 1:최근월물 + s = row[-5:-4].rstrip() # 스프레드여부 + t = row[-4:-3].rstrip() # 스프레드기준종목 LEG1 여부 Y/N + u = row[-3:].rstrip() # 서브 거래소 코드 + + df.loc[ridx] = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u] + ridx += 1 + + # DataFrame 직접 반환 (CSV 저장 제거됨) + + await ctx.info(f"해외선물 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "overseas_future_master", "process", str(e)) + await ctx.error(f"해외선물 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_domestic_bond(self, raw_file: str, ctx) -> pd.DataFrame: + """국내채권 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("국내채권 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + await ctx.info("고정폭 텍스트 파일 파싱 중...") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + lines = file_content.splitlines() + + data = [] + for row in lines: + row = row.strip() + bond_type = row[0:2].strip() + bond_cls_code = row[2:4].strip() + stnd_iscd = row[4:16].strip() + rdmp_date = row[-8:].strip() + pblc_date = row[-16:-8].strip() + lstn_date = row[-24:-16].strip() + bond_int_cls_code = row[-26:-24].strip() + sname = row[16:-26].rstrip() # 종목명을 뒤에서부터 추출하여 남은 부분 + + data.append( + [bond_type, bond_cls_code, stnd_iscd, sname, bond_int_cls_code, lstn_date, pblc_date, rdmp_date]) + + columns = ['bond_type', 'bond_classification_code', 'standard_code', 'bond_name', 'bond_interest_classification_code', 'listing_date', 'issue_date', 'redemption_date'] + + # 공통 DataFrame 처리 + df = self._create_dataframe(data, columns) + + await ctx.info(f"국내채권 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "domestic_bond_master", "process", str(e)) + await ctx.error(f"국내채권 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + async def __process_elw(self, raw_file: str, ctx) -> pd.DataFrame: + """ELW 마스터파일 가공 (원본 코드와 동일)""" + await ctx.info("ELW 마스터파일 가공 중...") + + try: + import pandas as pd + + # 원본 코드와 정확히 동일한 파싱 + await ctx.info("복잡한 고정폭 텍스트 파일 파싱 중...") + + # 파일 읽기 (공통 로직) + file_content = await self._read_file_with_encoding(raw_file, ctx) + lines = file_content.splitlines() + + data = [] + for row in lines: + # print(row) + mksc_shrn_iscd = row[0:9].strip() # 단축코드 + stnd_iscd = row[9:21].strip() # 표준코드 + hts_kor_isnm = row[21:50].strip() # 한글 종목명 + + crow = row[50:].strip() + elw_nvlt_optn_cls_code = crow[:1].strip() # ELW권리형태 + elw_ko_barrier = crow[1:14].strip() # ELW조기종료발생기준가격 + bskt_yn = crow[14:15].strip() # 바스켓 여부 (Y/N) + unas_iscd1 = crow[15:24].strip() # 기초자산코드1 + unas_iscd2 = crow[24:33].strip() # 기초자산코드2 + unas_iscd3 = crow[33:42].strip() # 기초자산코드3 + unas_iscd4 = crow[42:51].strip() # 기초자산코드4 + unas_iscd5 = crow[51:60].strip() # 기초자산코드5 + + # Calculate positions from the end of the row + mrkt_prtt_no10 = row[-6:].strip() # 시장 참가자 번호10 + mrkt_prtt_no9 = row[-11:-6].strip() # 시장 참가자 번호9 + mrkt_prtt_no8 = row[-16:-11].strip() # 시장 참가자 번호8 + mrkt_prtt_no7 = row[-21:-16].strip() # 시장 참가자 번호7 + mrkt_prtt_no6 = row[-26:-21].strip() # 시장 참가자 번호6 + mrkt_prtt_no5 = row[-31:-26].strip() # 시장 참가자 번호5 + mrkt_prtt_no4 = row[-36:-31].strip() # 시장 참가자 번호4 + mrkt_prtt_no3 = row[-41:-36].strip() # 시장 참가자 번호3 + mrkt_prtt_no2 = row[-46:-41].strip() # 시장 참가자 번호2 + mrkt_prtt_no1 = row[-51:-46].strip() # 시장 참가자 번호1 + lstn_stcn = row[-66:-51].strip() # 상장주수(천) + prdy_avls = row[-75:-66].strip() # 전일시가총액(억) + paym_date = row[-83:-75].strip() # 지급일 + rght_type_cls_code = row[-84:-83].strip() # 권리 유형 구분 코드 + rmnn_dynu = row[-88:-84].strip() # 잔존 일수 + stck_last_tr_month = row[-96:-88].strip() # 최종거래일 + acpr = row[-105:-96].strip() # 행사가 + elw_pblc_mrkt_prtt_no = row[-110:-105].strip() # 발행사코드 + + elw_pblc_istu_name = row[-11:-110].strip() # 발행사 한글 종목명 + + data.append([mksc_shrn_iscd, stnd_iscd, hts_kor_isnm, + elw_nvlt_optn_cls_code, elw_ko_barrier, bskt_yn, + unas_iscd1, unas_iscd2, unas_iscd3, unas_iscd4, + unas_iscd5, elw_pblc_istu_name, elw_pblc_mrkt_prtt_no, + acpr, stck_last_tr_month, rmnn_dynu, rght_type_cls_code, + paym_date, prdy_avls, lstn_stcn, mrkt_prtt_no1, + mrkt_prtt_no2, mrkt_prtt_no3, mrkt_prtt_no4, + mrkt_prtt_no5, mrkt_prtt_no6, mrkt_prtt_no7, + mrkt_prtt_no8, mrkt_prtt_no9, mrkt_prtt_no10]) + + columns = ['short_code', 'standard_code', 'korean_name', 'elw_right_type', 'elw_early_termination_price', + 'basket_yn', 'underlying_code1', 'underlying_code2', 'underlying_code3', + 'underlying_code4', 'underlying_code5', 'issuer_korean_name', 'issuer_code', + 'strike_price', 'last_trading_date', 'remaining_days', 'right_type_division_code', 'payment_date', + 'prev_day_market_cap_billion', 'listed_shares_thousand', 'market_participant_no1', + 'market_participant_no2', 'market_participant_no3', 'market_participant_no4', + 'market_participant_no5', 'market_participant_no6', 'market_participant_no7', + 'market_participant_no8', 'market_participant_no9', 'market_participant_no10'] + + # 공통 DataFrame 처리 + df = self._create_dataframe(data, columns) + + await ctx.info(f"ELW 마스터파일 가공 완료: {len(df)}개 종목") + return df + + except Exception as e: + self._log("error", "elw_master", "process", str(e)) + await ctx.error(f"ELW 마스터파일 가공 실패: {str(e)}") + return pd.DataFrame() + + \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/pyproject.toml b/한국투자증권(API)/MCP/Kis Trading MCP/pyproject.toml new file mode 100644 index 0000000..2f7915e --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/pyproject.toml @@ -0,0 +1,17 @@ +[project] +name = "korea-investment-api-mcp" +version = "0.1.0" +description = "한국투자증권 OPEN API MCP 서버 - LLM이 쉽게 사용할 수 있는 금융 API 래퍼" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "fastmcp>=2.11.2", + "pandas>=2.3.1", + "pycryptodome>=3.23.0", + "pydantic>=2.11.7", + "python-dotenv>=1.1.1", + "requests>=2.32.4", + "websockets>=15.0.1", + "PyYAML>=6.0.1", + "sqlalchemy>=2.0.43", +] diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/server.py b/한국투자증권(API)/MCP/Kis Trading MCP/server.py new file mode 100644 index 0000000..2dbd9d2 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/server.py @@ -0,0 +1,105 @@ +import logging +import os +import platform +import sys + +from fastmcp import FastMCP + +from module import setup_environment, EnvironmentMiddleware, EnvironmentConfig, setup_kis_config +from module.plugin import Database +from tools import * + +logging.basicConfig( + level=logging.DEBUG, # DEBUG 이상 (DEBUG, INFO, WARNING...) 모두 출력 + format='%(asctime)s [%(levelname)s] %(message)s', + datefmt='%H:%M:%S' +) + + +def main(): + env = os.getenv("ENV", None) + + # 환경 설정 + logging.info("setup environment ...") + env_config = setup_environment(env=env) + + # KIS 설정 자동 생성 (템플릿 다운로드 + 값 덮어쓰기) + logging.info("setup KIS configuration ...") + if not setup_kis_config(force_update=env == "live"): + logging.warning("KIS 설정 파일 생성에 실패했습니다. 수동으로 설정해주세요.") + + # 데이터베이스 초기화 + logging.info("setup database ...") + db = None + db_exists = False + + try: + db = Database() + db_exists = os.path.exists(os.path.join("configs/master", "master.db")) + db.new(db_dir="configs/master") + logging.info(f"📁 Available databases: {db.get_available_databases()}") + except Exception as e: + logging.error(f"❌ Database initialization failed: {e}") + sys.exit(1) + + # MCP 서버 설정 + mcp_server = FastMCP( + name="My Awesome MCP Server", + instructions="This is a server for a specific project.", + version="1.0.0", + stateless_http=False, + ) + + # middleware + mcp_server.add_middleware(EnvironmentMiddleware(environment=env_config)) + + # tools 등록 + DomesticStockTool().register(mcp_server=mcp_server) + DomesticFutureOptionTool().register(mcp_server=mcp_server) + DomesticBondTool().register(mcp_server=mcp_server) + OverseasStockTool().register(mcp_server=mcp_server) + OverseasFutureOptionTool().register(mcp_server=mcp_server) + ElwTool().register(mcp_server=mcp_server) + EtfEtnTool().register(mcp_server=mcp_server) + AuthTool().register(mcp_server=mcp_server) + + + # MCP 서버 실행 방식 결정 + logging.info(f"🚀 MCP 서버를 {env_config.mcp_type} 모드로 시작합니다...") + + if env_config.mcp_type == "stdio": + # stdio 모드 (기본값) + logging.info("📝 stdio 모드로 MCP 서버를 시작합니다.") + mcp_server.run( + transport="stdio" + ) + + elif env_config.mcp_type == "sse": + # HTTP 모드로 실행 + logging.info(f"🌐 Server Sent Event 모드로 MCP 서버를 시작합니다: {env_config.mcp_host}:{env_config.mcp_port}") + mcp_server.run( + transport="sse", + host=env_config.mcp_host, + port=env_config.mcp_port, + path=env_config.mcp_path, + ) + + elif env_config.mcp_type == "streamable-http": + # HTTP 모드로 실행 + logging.info(f"🌐 HTTP 모드로 MCP 서버를 시작합니다: {env_config.mcp_host}:{env_config.mcp_port}") + mcp_server.run( + transport="streamable-http", + host=env_config.mcp_host, + port=env_config.mcp_port, + path=env_config.mcp_path, + ) + else: + logging.error(f"❌ 지원하지 않는 MCP_TYPE: {env_config.mcp_type}") + sys.exit(1) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + logging.info("🛑 Application interrupted by user (Ctrl+C)") diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/__init__.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/__init__.py new file mode 100644 index 0000000..c628df5 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/__init__.py @@ -0,0 +1,8 @@ +from .domestic_bond import DomesticBondTool +from .domestic_futureoption import DomesticFutureOptionTool +from .domestic_stock import DomesticStockTool +from .elw import ElwTool +from .etfetn import EtfEtnTool +from .overseas_futureoption import OverseasFutureOptionTool +from .overseas_stock import OverseasStockTool +from .auth import AuthTool \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/auth.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/auth.py new file mode 100644 index 0000000..61851e1 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/auth.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class AuthTool(BaseTool): + @property + def tool_name(self) -> str: + return "auth" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/base.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/base.py new file mode 100644 index 0000000..a61d643 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/base.py @@ -0,0 +1,818 @@ +from abc import ABC, abstractmethod +from typing import Dict, Any, List +import json +import os +import time +import shutil +import subprocess +import requests +from fastmcp import FastMCP, Context + +from module.plugin import MasterFileManager +from module.plugin.database import Database +import module.factory as factory + + +class ApiExecutor: + """API 실행 클래스 - GitHub에서 코드를 다운로드하고 실행""" + + def __init__(self, tool_name: str): + """초기화""" + self.tool_name = tool_name + self.temp_base_dir = "./tmp" + # 절대 경로로 venv python 설정 + self.venv_python = os.path.join(os.getcwd(), ".venv", "bin", "python") + + # temp 디렉토리 생성 + os.makedirs(self.temp_base_dir, exist_ok=True) + + def _create_temp_directory(self, request_id: str) -> str: + """임시 디렉토리 생성""" + timestamp = int(time.time() * 1_000_000) # 나노초 단위 + temp_dir = os.path.join(self.temp_base_dir, f"{timestamp}_{request_id}") + os.makedirs(temp_dir, exist_ok=True) + return temp_dir + + @classmethod + def _download_file(cls, url: str, file_path: str) -> bool: + """파일 다운로드""" + try: + response = requests.get(url, timeout=30) + response.raise_for_status() + + with open(file_path, 'w', encoding='utf-8') as f: + f.write(response.text) + return True + except Exception as e: + print(f"파일 다운로드 실패: {url}, 오류: {str(e)}") + return False + + def _download_kis_auth(self, temp_dir: str) -> bool: + """kis_auth.py 다운로드""" + kis_auth_url = "https://raw.githubusercontent.com/koreainvestment/open-trading-api/main/examples_llm/kis_auth.py" + kis_auth_path = os.path.join(temp_dir, "kis_auth.py") + return self._download_file(kis_auth_url, kis_auth_path) + + def _download_api_code(self, github_url: str, temp_dir: str, api_type: str) -> str: + """API 코드 다운로드""" + # GitHub URL을 raw URL로 변환하고 api_type/api_type.py를 붙여서 실제 파일 경로 생성 + raw_url = github_url.replace('/tree/', '/').replace('github.com', 'raw.githubusercontent.com') + full_url = f"{raw_url}/{api_type}.py" + api_code_path = os.path.join(temp_dir, "api_code.py") + + if self._download_file(full_url, api_code_path): + return api_code_path + else: + raise Exception(f"API 코드 다운로드 실패: {full_url}") + + @classmethod + def _extract_trenv_params_from_example(cls, api_code_content: str) -> Dict[str, str]: + """예제 파일에서 trenv 사용 패턴 완전 추출""" + import re + + # 🎯 완전 자동화: param_name=xxx.my_attr 패턴 찾기 (변수명 무관) + trenv_mapping_pattern = r'(\w+)=\w*\.(my_\w+)' + matches = re.findall(trenv_mapping_pattern, api_code_content) + + dynamic_mappings = {} + discovered_mappings = [] + + for param_name, trenv_attr in matches: + # 발견된 매핑을 그대로 사용 (완전 자동화!) + trenv_value = f'ka._TRENV.{trenv_attr}' + + # 소문자 버전 (함수 파라미터) + dynamic_mappings[param_name] = trenv_value + # 대문자 버전 (API 파라미터) + dynamic_mappings[param_name.upper()] = trenv_value + + discovered_mappings.append(f"{param_name}=xxx.{trenv_attr}") + + if discovered_mappings: + print(f"[🎯자동발견] {len(discovered_mappings)}개 매핑: {', '.join(discovered_mappings)}") + print(f"[🎯자동생성] {len(dynamic_mappings)}개 파라미터: {list(dynamic_mappings.keys())}") + else: + print("[🎯자동발견] .my_xxx 패턴 없음 - 조회성 API로 추정") + + + return dynamic_mappings + + @classmethod + def _modify_api_code(cls, api_code_path: str, params: Dict[str, Any], api_type: str) -> str: + """API 코드 수정 (파라미터 적용)""" + try: + import re + + with open(api_code_path, 'r', encoding='utf-8') as f: + code = f.read() + + # 1. sys.path.extend 관련 코드 제거 + code = re.sub(r"sys\.path\.extend\(\[.*?\]\)", "", code, flags=re.DOTALL) + code = re.sub(r"import sys\n", "", code) # import sys도 제거 + + # 2. 코드에서 함수명과 시그니처 추출 + function_match = re.search(r'def\s+(\w+)\s*\((.*?)\):', code, re.DOTALL) + if not function_match: + raise Exception("코드에서 함수를 찾을 수 없습니다.") + + function_name = function_match.group(1) + function_params = function_match.group(2) + + # 3. 함수가 max_depth 파라미터를 받는지 확인 + has_max_depth = 'max_depth' in function_params + + # 4. 파라미터 조정 + adjusted_params = params.copy() + + # max_depth 파라미터 처리 + if has_max_depth: + # 함수가 max_depth를 받는 경우에만 처리 + if 'max_depth' not in adjusted_params: + adjusted_params['max_depth'] = 1 + print(f"[기본값] {function_name} 함수에 max_depth=1 설정") + else: + print(f"[사용자 설정] {function_name} 함수에 max_depth={adjusted_params['max_depth']} 사용") + else: + # 함수가 max_depth를 받지 않는 경우 제거 + if 'max_depth' in adjusted_params: + del adjusted_params['max_depth'] + print(f"[제거] {function_name} 함수는 max_depth 파라미터를 지원하지 않아 제거함") + + # 🆕 동적으로 trenv 패턴 추출 + dynamic_mappings = cls._extract_trenv_params_from_example(code) + + # 기본 매핑과 동적 매핑 결합 + account_mappings = { + 'cano': 'ka._TRENV.my_acct', # 종합계좌번호 (변수 접근) + 'acnt_prdt_cd': 'ka._TRENV.my_prod', # 계좌상품코드 (변수 접근) + 'my_htsid': 'ka._TRENV.my_htsid', # HTS ID (변수 접근) + 'user_id': 'ka._TRENV.my_htsid', # domestic_stock에서 발견된 변형 + **dynamic_mappings # 동적으로 발견된 매핑 추가 + } + + for param_name, correct_value in account_mappings.items(): + if param_name in function_params: + if param_name in adjusted_params: + original_value = adjusted_params[param_name] + adjusted_params[param_name] = correct_value + print(f"[보안강제] {function_name} 함수의 {param_name}='{original_value}' → {correct_value} (LLM값 무시)") + else: + adjusted_params[param_name] = correct_value + print(f"[자동설정] {function_name} 함수에 {param_name}={correct_value} 설정") + + # 거래소ID구분코드 처리 (API 타입 기반 추론) + if 'excg_id_dvsn_cd' in function_params and 'excg_id_dvsn_cd' not in adjusted_params: + if api_type.startswith('domestic'): + adjusted_params['excg_id_dvsn_cd'] = '"KRX"' + print(f"[추론] 국내 API({api_type})로 판단하여 excg_id_dvsn_cd='KRX' 설정") + else: + print(f"[경고] {api_type} API에서 excg_id_dvsn_cd 파라미터가 필요합니다. (예: NASD, NYSE, KRX)") + # overseas_stock 등은 사용자가 명시적으로 제공해야 함 + + # 5. 함수 호출 코드 생성 (ka.auth() - env_dv에 따라 분기) + # env_dv 값에 따른 인증 방식 결정 + env_dv = params.get('env_dv', 'real') + if env_dv == 'demo': + auth_code = 'ka.auth("vps")' + print(f"[모의투자] {function_name} 함수에 ka.auth(\"vps\") 적용") + else: + auth_code = 'ka.auth()' + print(f"[실전투자] {function_name} 함수에 ka.auth() 적용") + + call_code = f""" +# API 함수 호출 +if __name__ == "__main__": + try: + # 인증 초기화 (env_dv={env_dv}) + {auth_code} + + result = {function_name}({", ".join([f"{k}={v if isinstance(v, str) and v.startswith('ka._TRENV.') else repr(v)}" for k, v in adjusted_params.items()])}) + except TypeError as e: + # 🚨 핵심 오류 메시지만 출력 + print(f"❌ TypeError: {{str(e)}}") + print() + + # 파라미터 오류 처리 - LLM 교육용 메시지 + if 'stock_name' in {repr(list(params.keys()))}: + print("💡 해결방법: find_stock_code로 종목을 검색하세요.") + else: + print("💡 해결방법: find_api_detail로 API 상세 정보를 확인하세요") + import sys + sys.exit(1) + + try: + + # N개 튜플 반환 함수 처리 (예: inquire_balance는 (df1, df2) 반환) + if isinstance(result, tuple): + # 튜플인 경우 - N개의 DataFrame 처리 + output = {{}} + for i, item in enumerate(result): + if hasattr(item, 'to_dict'): + # DataFrame인 경우 + output[f"output{{i+1}}"] = item.to_dict('records') if not item.empty else [] + else: + # 일반 객체인 경우 + output[f"output{{i+1}}"] = str(item) + + import json + print(json.dumps(output, ensure_ascii=False, indent=2)) + elif hasattr(result, 'empty') and not result.empty: + print(result.to_json(orient='records', force_ascii=False)) + elif isinstance(result, dict): + import json + print(json.dumps(result, ensure_ascii=False)) + elif isinstance(result, (list, tuple)): + import json + print(json.dumps(result, ensure_ascii=False)) + else: + print(str(result)) + except Exception as e: + print(f"오류 발생: {{str(e)}}") +""" + + # 6. 코드 끝에 함수 호출 추가 + modified_code = code + call_code + + # 7. 수정된 코드 저장 + with open(api_code_path, 'w', encoding='utf-8') as f: + f.write(modified_code) + + return api_code_path + except Exception as e: + raise Exception(f"코드 수정 실패: {str(e)}") + + def _execute_code(self, temp_dir: str, timeout: int = 15) -> Dict[str, Any]: + """코드 실행""" + try: + # 실행할 파일 경로 (상대 경로로 변경) + api_code_path = "api_code.py" + + # subprocess로 코드 실행 + result = subprocess.run( + [self.venv_python, api_code_path], + cwd=temp_dir, + capture_output=True, + text=True, + timeout=timeout + ) + + if result.returncode == 0: + # 성공 시 stdout을 결과로 반환 + return { + "success": True, + "output": result.stdout, + "error": result.stderr + } + else: + # 실패 시 stderr와 stdout 모두 확인 + error_message = result.stderr if result.stderr else result.stdout + return { + "success": False, + "output": result.stdout, + "error": error_message + } + + except subprocess.TimeoutExpired: + return { + "success": False, + "error": f"실행 시간 초과 ({timeout}초)" + } + except Exception as e: + return { + "success": False, + "error": f"실행 중 오류: {str(e)}" + } + + def _cleanup_temp_directory(self, temp_dir: str): + """임시 디렉토리 정리""" + try: + if os.path.exists(temp_dir): + shutil.rmtree(temp_dir, ignore_errors=True) + except Exception as e: + print(f"임시 디렉토리 정리 실패: {temp_dir}, 오류: {str(e)}") + + async def execute_api(self, ctx: Context, api_type: str, params: Dict[str, Any], github_url: str) -> Dict[str, Any]: + """API 실행 메인 함수""" + temp_dir = None + start_time = time.time() + + try: + await ctx.info(f"API 실행 시작: {api_type}") + + # 1. 임시 디렉토리 생성 + # FastMCP Context에서 request_id 안전하게 가져오기 + try: + request_id = ctx.get_state(factory.CONTEXT_REQUEST_ID) + except: + request_id = "unknown" + temp_dir = self._create_temp_directory(request_id) + + # 2. kis_auth.py 다운로드 + if not self._download_kis_auth(temp_dir): + raise Exception("kis_auth.py 다운로드 실패") + + # 3. API 코드 다운로드 + api_code_path = self._download_api_code(github_url, temp_dir, api_type) + + # 4. 코드 수정 + self._modify_api_code(api_code_path, params, api_type) + + # 5. 코드 실행 + execution_result = self._execute_code(temp_dir) + + # 6. 실행 시간 계산 + execution_time = time.time() - start_time + + # 7. 결과 반환 + result = { + "success": execution_result["success"], + "api_type": api_type, + "params": params, + "message": f"{self.tool_name} API 호출 완료", + "execution_time": f"{execution_time:.2f}s", + "temp_dir": temp_dir, + "venv_used": True, + "cleanup_success": True + } + + if execution_result["success"]: + result["data"] = execution_result["output"] + else: + result["error"] = execution_result["error"] + + return result + + except Exception as e: + await ctx.error(f"API 실행 중 오류: {str(e)}") + return { + "success": False, + "api_type": api_type, + "params": params, + "error": str(e), + "execution_time": f"{time.time() - start_time:.2f}s", + "temp_dir": temp_dir, + "venv_used": True, + "cleanup_success": False + } + finally: + # 8. 임시 디렉토리 정리 + if temp_dir: + self._cleanup_temp_directory(temp_dir) + + +class BaseTool(ABC): + """MCP 도구 기본 클래스""" + + def __init__(self): + """도구 초기화""" + self._load_config() + self.api_executor = ApiExecutor(self.tool_name) + self.master_file_manager = MasterFileManager(self.tool_name) + self.db = Database() + + # ========== Abstract Properties ========== + @property + @abstractmethod + def tool_name(self) -> str: + """도구 이름 (하위 클래스에서 구현 필수)""" + pass + + # ========== Public Properties ========== + @property + def description(self) -> str: + """도구 설명 (분류.json에서 동적 생성)""" + return self._generate_description() + + @property + def config_file(self) -> str: + """JSON 설정 파일 경로 (tool_name 기반 자동 생성)""" + return f"./configs/{self.tool_name}.json" + + # ========== Public Methods ========== + def register(self, mcp_server: FastMCP) -> None: + """MCP 서버에 도구 등록""" + mcp_server.tool( + self._run, + name=self.tool_name, + description=self.description, + ) + + # ========== Protected Methods ========== + def _load_config(self) -> None: + """JSON 설정 파일 로드""" + try: + with open(self.config_file, 'r', encoding='utf-8') as f: + self.config = json.load(f) + except FileNotFoundError: + # 임시로 빈 설정으로 초기화 + self.config = {"apis": {}} + + def _generate_description(self) -> str: + """분류.json에서 도구 설명 동적 생성""" + try: + config_json_path = f"./configs/{self.tool_name}.json" + with open(config_json_path, 'r', encoding='utf-8') as f: + config_data = json.load(f) + + tool_info = config_data.get("tool_info") + apis = config_data.get("apis", {}) + + if not tool_info: + return f"{self.tool_name} 도구의 tool_info가 없습니다." + + # description 문자열 구성 + lines = [tool_info.get("introduce", "")] + + # introduce_append가 있으면 추가 + introduce_append = tool_info.get("introduce_append", "").strip() + if introduce_append: + lines.append(introduce_append) + + lines.append("") # 빈 줄 + lines.append("[지원 기능]") + + # API 목록 추가 + for api_type, api_info in apis.items(): + lines.append(f"- {api_info['name']} (api_type: \"{api_type}\")") + + lines.append("") # 빈 줄 + + # 개선된 구조 적용 + lines.append("📋 사용 방법:") + lines.append("1. find_api_detail로 API 상세 정보를 확인하세요") + lines.append("2. api_type을 선택하고 params에 필요한 파라미터를 입력하세요") + lines.append("3. 종목명으로 검색할 경우: stock_name='종목명' 파라미터를 사용하세요") + lines.append("4. 모의투자 시에는 env_dv='demo'를 추가하세요") + lines.append("") + lines.append("🔧 특별한 api_type 및 예시:") + lines.append(f"- find_stock_code (종목번호 검색) : {self.tool_name}({{ \"api_type\": \"find_stock_code\", \"params\": {{ \"stock_name\": \"삼성전자\" }} }})") + lines.append(f"- find_api_detail (API 정보 조회) : {self.tool_name}({{ \"api_type\": \"find_api_detail\", \"params\": {{ \"api_type\": \"inquire_price\" }} }})") + lines.append("") + lines.append("🔍 종목명 사용: stock_name=\"삼성전자\" → 자동으로 종목번호 변환하여 실행") + lines.append(f"{self.tool_name}({{ \"api_type\": \"inquire_price\", \"params\": {{ \"stock_name\": \"삼성전자\" }} }})") + lines.append("") + lines.append("💡 주요 파라미터:") + if self.tool_name.startswith('domestic'): + lines.append("- 시장코드(fid_cond_mrkt_div_code)='J'(KRX)/'NX'(넥스트레이드)/'UN'(통합)") + lines.append("- 매매구분(ord_dv)='buy'(매수)/'sell'(매도)") + lines.append("- 실전모의구분(env_dv)='real'(실전)/'demo'(모의)") + lines.append("") + lines.append("⚠️ 중요: API 호출 시 필수 주의사항") + lines.append("**API 실행 전 반드시 API 상세 문서의 파라미터를 확인하세요. Request Query Params와 Request Body 입력 시 추측이나 과거 실행 값 사용 금지, 확인된 API 상세 문서의 값을 사용하세요.**") + lines.append("**파라미터 description에 '공란'이 있는 경우 기본적으로 빈값으로 처리하되, 아닌 경우에는 값을 넣어도 됩니다.**") + lines.append("**🎯 모의투자 관련: 사용자가 '모의', '모의투자', '데모', '테스트' 등의 용어를 언급하거나 모의투자 관련 요청을 할 경우, 반드시 env_dv 파라미터를 'demo'로 설정하여 API를 호출해야 합니다. env_dv 파라미터가 있는 모든 API에서 모의투자 시에는 env_dv='demo', 실전투자 시에는 env_dv='real'을 사용합니다. 기본값은 'real'이므로 모의투자 요청 시 반드시 env_dv='demo'를 명시적으로 설정해주세요.**") + lines.append("") + lines.append("🔒 자동 처리되는 파라미터 (제공하지 마세요):") + lines.append("• cano (계좌번호), acnt_prdt_cd (계좌상품코드), my_htsid (HTS ID) - 시스템 자동 설정") + if self.tool_name.startswith('domestic'): + lines.append("• excg_id_dvsn_cd (거래소구분) - 국내 API는 자동으로 KRX 설정") + lines.append("") + + # 예시 호출 추가 + examples = tool_info.get("examples", []) + if examples: + lines.append("💻 예시 호출:") + for example in examples: + params_str = json.dumps(example.get('params', {}), ensure_ascii=False) + lines.append( + f"{self.tool_name}({{ \"api_type\": \"{example['api_type']}\",\"params\": {params_str} }})") + + return "\n".join(lines) + + except Exception as e: + return f"{self.tool_name} 도구 설명 생성 중 오류: {str(e)}" + + async def _run(self, ctx: Context, api_type: str, params: dict) -> Dict[str, Any]: + """공통 실행 로직""" + try: + await ctx.info(f"{self.tool_name} running with api_type: {api_type}") + + # 1) 인자 구조 검증(가볍게) + if not api_type or not isinstance(params, dict): + return { + "ok": False, + "error": "MISSING_OR_INVALID_ARGS", + "missing": [k for k in ("api_type", "params") if + not (api_type if k == "api_type" else isinstance(params, dict))], + "invalid": [] if isinstance(params, dict) else [{"field": "params", "expected": "object"}], + } + + # 2. 특별한 api_type 처리 + if api_type == "find_stock_code": + return await self._handle_find_stock_code(ctx, params) + elif api_type == "find_api_detail": + return await self._handle_find_api_detail(ctx, params) + + # 3. API 설정 조회 + if api_type not in self.config['apis']: + return {"ok": False, "error": f"지원하지 않는 API 타입: {api_type}"} + + + # 4. 종목명 자동 처리 (stock_name이 있으면 자동으로 pdno 변환) + params = await self._process_stock_name(ctx, params) + + # 5. 실제 실행 (래핑 함수 선택 → OPEN API 호출) + data = await self._run_api(ctx, api_type, params) + return {"ok": True, "data": data} + + except Exception as e: + await ctx.error(f"실행 중 오류: {str(e)}") + return {"ok": False, "error": str(e)} + + + async def _run_api(self, ctx: Context, api_type: str, params: Dict[str, Any]) -> Any: + """API 실행 - ApiExecutor 사용""" + try: + api_info = self.config['apis'][api_type] + github_url = api_info.get('github_url') + + if not github_url: + return {"error": f"GitHub URL이 없습니다: {api_type}"} + + # ApiExecutor를 사용하여 API 실행 + result = await self.api_executor.execute_api( + ctx=ctx, + api_type=api_type, + params=params, + github_url=github_url + ) + + return result + + except Exception as e: + return {"error": f"API 실행 중 오류: {str(e)}"} + + async def _process_stock_name(self, ctx: Context, params: Dict[str, Any]) -> Dict[str, Any]: + """종목명/종목코드 자동 처리 (stock_name이 있으면 자동으로 pdno 변환)""" + try: + # 종목명으로 찾을 수 있는 파라미터들 + stock_name_params = ["stock_name", "stock_name_kr", "korean_name", "company_name"] + + # 파라미터에서 종목명/종목코드 찾기 + search_value = None + for param_name in stock_name_params: + if param_name in params and params[param_name]: + search_value = params[param_name] + break + + # 검색할 값이 없으면 그대로 반환 + if not search_value: + return params + + await ctx.info(f"검색값 발견: {search_value}, 자동 검색 시작") + + # 종목명 또는 종목코드로 검색 + result = await self._find_stock_by_name_or_code(ctx, search_value) + + if result["found"]: + params["pdno"] = result["code"] + await ctx.info(f"종목번호 자동 찾기 성공: {search_value} → {result['code']}") + # 원본 검색값 보존 + params["_original_search_value"] = search_value + params["_resolved_stock_code"] = result["code"] + else: + await ctx.warning(f"종목을 찾을 수 없음: {search_value}") + # 종목을 찾지 못해도 원본 파라미터 유지 + + return params + + except Exception as e: + await ctx.error(f"종목명 자동 처리 실패: {str(e)}") + return params + + async def _find_stock_by_name_or_code(self, ctx: Context, search_value: str) -> Dict[str, Any]: + """종목명 또는 종목코드로 종목번호 찾기""" + try: + # 검색어에서 띄어쓰기 제거 + search_term = search_value.replace(" ", "") + + # 데이터베이스 연결 확인 + if not self.db.ensure_initialized(): + return {"found": False, "message": "데이터베이스 초기화 실패"} + + # 마스터 파일 업데이트 확인 (force_update=False로 필요시에만 업데이트) + try: + from module.plugin import MasterFileManager + master_file_manager = MasterFileManager(self.tool_name) + await master_file_manager.ensure_master_file_updated(ctx, force_update=False) + except Exception as e: + await ctx.warning(f"마스터 파일 업데이트 확인 중 오류: {str(e)}") + + # DB 엔진 + db_engine = self.db.get_by_name("master") + master_models = MasterFileManager.get_master_models_for_tool(self.tool_name) + + if not master_models: + return {"found": False, "message": f"지원하지 않는 툴: {self.tool_name}"} + + # 각 모델에서 우선순위별 검색 + for model_class in master_models: + try: + # 1순위: 종목코드로 완전 매칭 + code_results = db_engine.list( + model_class, + filters={"code": search_term}, + limit=1 + ) + + if code_results: + result = code_results[0] + return { + "found": True, + "code": result.code, + "name": result.name, + "ex": result.ex if hasattr(result, 'ex') else None, + "match_type": "code_exact" + } + + # 2순위: 종목명으로 완전 매칭 + name_results = db_engine.list( + model_class, + filters={"name": search_term}, + limit=1 + ) + + if name_results: + result = name_results[0] + return { + "found": True, + "code": result.code, + "name": result.name, + "ex": result.ex if hasattr(result, 'ex') else None, + "match_type": "name_exact" + } + + # 3순위: 종목명으로 앞글자 매칭 + prefix_results = db_engine.list( + model_class, + filters={"name": f"{search_term}%"}, + limit=1 + ) + + if prefix_results: + result = prefix_results[0] + return { + "found": True, + "code": result.code, + "name": result.name, + "ex": result.ex if hasattr(result, 'ex') else None, + "match_type": "name_prefix" + } + + # 4순위: 종목명으로 중간 매칭 + contains_results = db_engine.list( + model_class, + filters={"name": f"%{search_term}%"}, + limit=1 + ) + + if contains_results: + result = contains_results[0] + return { + "found": True, + "code": result.code, + "name": result.name, + "ex": result.ex if hasattr(result, 'ex') else None, + "match_type": "name_contains" + } + + except Exception as e: + continue + + return {"found": False, "message": f"종목을 찾을 수 없음: {search_value}"} + + except Exception as e: + return {"found": False, "message": f"종목 검색 오류: {str(e)}"} + + def get_api_info(self, api_type: str) -> Dict[str, Any]: + """API 정보 조회 (리소스 기능 통합)""" + try: + # API 설정 조회 + if api_type not in self.config['apis']: + return { + "error": f"지원하지 않는 API 타입: {api_type}", + "available_apis": list(self.config['apis'].keys()), + "api_type": api_type + } + + # API 정보 반환 + api_info = self.config['apis'][api_type] + + # 파라미터 정보 정리 + params = api_info.get("params", {}) + param_details = {} + + for param_name, param_info in params.items(): + param_details[param_name] = { + "name": param_info.get("name", param_name), + "type": param_info.get("type", "str"), + "required": param_info.get("required", False), + "default_value": param_info.get("default_value"), + "description": param_info.get("description", "") + } + + result = { + "tool_name": self.tool_name, + "api_type": api_type, + "name": api_info.get("name", ""), + "category_detail": api_info.get("category", ""), + "method": api_info.get("method", ""), + "api_path": api_info.get("api_path", ""), + "github_url": api_info.get("github_url", ""), + "params": param_details + } + + return result + + except Exception as e: + return { + "error": f"API 정보 조회 중 오류 발생: {str(e)}", + "tool_name": self.tool_name, + "api_type": api_type + } + + async def _handle_find_stock_code(self, ctx: Context, params: Dict[str, Any]) -> Dict[str, Any]: + """종목 검색 처리""" + try: + await ctx.info(f"종목 검색 요청: {self.tool_name}") + + # stock_name 파라미터 확인 + search_value = params.get("stock_name") + if not search_value: + return { + "ok": False, + "error": "MISSING_OR_INVALID_ARGS", + "missing": ["stock_name"], + "message": "stock_name 파라미터가 필요합니다. (종목명 또는 종목코드 입력 가능)" + } + + # 종목 검색 실행 (종목명 또는 종목코드) + result = await self._find_stock_by_name_or_code(ctx, search_value) + + if result["found"]: + return { + "ok": True, + "data": { + "tool_name": self.tool_name, + "search_value": search_value, + "found": True, + "stock_code": result["code"], + "stock_name_found": result["name"], + "ex": result.get("ex"), + "match_type": result.get("match_type"), + "message": f"'{search_value}' 종목을 찾았습니다. 종목번호: {result['code']}", + "usage_guide": f"find_api_detail로 API상세정보를 확인하고 종목코드 '{result['code']}'를 해당 API의 종목코드 필드에 입력하여 실행하세요.", + "next_step": f"{self.tool_name} 툴에서 find_api_detail로 확인한 종목코드 필드에 '{result['code']}'를 입력하세요." + } + } + else: + return { + "ok": False, + "error": "STOCK_NOT_FOUND", + "message": f"'{search_value}' 종목을 찾을 수 없습니다.", + "suggestions": [ + "종목명의 철자가 정확한지 확인", + "종목코드가 정확한지 확인", + "띄어쓰기나 특수문자가 있는지 확인", + "다른 검색어로 시도 (예: '삼성전자' 대신 '삼성' 또는 '005930')" + ] + } + + except Exception as e: + await ctx.error(f"종목 검색 처리 중 오류: {str(e)}") + return {"ok": False, "error": str(e)} + + async def _handle_find_api_detail(self, ctx: Context, params: Dict[str, Any]) -> Dict[str, Any]: + """API 상세 정보 조회 처리""" + try: + await ctx.info(f"API 상세 정보 조회 요청: {self.tool_name}") + + # api_type 파라미터 확인 + target_api_type = params.get("api_type") + if not target_api_type: + return { + "ok": False, + "error": "MISSING_OR_INVALID_ARGS", + "missing": ["api_type"], + "message": "api_type 파라미터가 필요합니다.", + "available_apis": list(self.config['apis'].keys()) + } + + # API 정보 조회 + api_info = self.get_api_info(target_api_type) + + if "error" in api_info: + return { + "ok": False, + "error": api_info["error"], + "available_apis": api_info.get("available_apis", []) + } + + return { + "ok": True, + "data": api_info + } + + except Exception as e: + await ctx.error(f"API 상세 정보 조회 처리 중 오류: {str(e)}") + return {"ok": False, "error": str(e)} diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_bond.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_bond.py new file mode 100644 index 0000000..01e01da --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_bond.py @@ -0,0 +1,10 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class DomesticBondTool(BaseTool): + @property + def tool_name(self) -> str: + return "domestic_bond" + diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_futureoption.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_futureoption.py new file mode 100644 index 0000000..d99e8a0 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_futureoption.py @@ -0,0 +1,15 @@ +from .base import BaseTool +from module import singleton +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + + +@singleton +class DomesticFutureOptionTool(BaseTool): + @property + def tool_name(self) -> str: + return "domestic_futureoption" + \ No newline at end of file diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_stock.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_stock.py new file mode 100644 index 0000000..8fdf792 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/domestic_stock.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class DomesticStockTool(BaseTool): + @property + def tool_name(self) -> str: + return "domestic_stock" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/elw.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/elw.py new file mode 100644 index 0000000..2652138 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/elw.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class ElwTool(BaseTool): + @property + def tool_name(self) -> str: + return "elw" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/etfetn.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/etfetn.py new file mode 100644 index 0000000..0793a8e --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/etfetn.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class EtfEtnTool(BaseTool): + @property + def tool_name(self) -> str: + return "etfetn" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_futureoption.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_futureoption.py new file mode 100644 index 0000000..3b55eb2 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_futureoption.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class OverseasFutureOptionTool(BaseTool): + @property + def tool_name(self) -> str: + return "overseas_futureoption" diff --git a/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_stock.py b/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_stock.py new file mode 100644 index 0000000..2f25d00 --- /dev/null +++ b/한국투자증권(API)/MCP/Kis Trading MCP/tools/overseas_stock.py @@ -0,0 +1,9 @@ +from .base import BaseTool +from module import singleton + + +@singleton +class OverseasStockTool(BaseTool): + @property + def tool_name(self) -> str: + return "overseas_stock" diff --git a/한국투자증권(API)/MCP/MCP AI 도구 연결 방법.md b/한국투자증권(API)/MCP/MCP AI 도구 연결 방법.md new file mode 100644 index 0000000..c45b844 --- /dev/null +++ b/한국투자증권(API)/MCP/MCP AI 도구 연결 방법.md @@ -0,0 +1,383 @@ +# MCP를 AI 도구에 연결하는 방법 + +### 한국투자증권 Open API를 활용하는 KIS Trade MCP와 KIS Code Assistant MCP를 AI 도구(Claude Desktop | Cursor)에 연결하는 설정 방법을 단계별로 안내합니다. + +--- + +# 공통사항 + +한국투자증권 계좌와 한국투자증권 OpenAPI 홈페이지에서 인증정보(App Key, App Secret)를 준비해 주세요. + +개발 환경 : Python 3.13 이상 권장 + +Claude Desktop 또는 Cursor와 같은 한국투자증권 MCP를 연결할 AI 도구를 설치해 주세요. + +## **KIS Open API 신청 및 설정** + +1. 한국투자증권 **계좌 개설 및 ID 연결** +2. 한국투자증권 홈페이지 or 앱에서 **Open API 서비스 신청** +3. **앱키(App Key)**, **앱시크릿(App Secret)** 발급 +4. **모의투자** 및 **실전투자** 앱키 각각 준비 + +🍀 [서비스 신청 안내 바로가기](https://apiportal.koreainvestment.com/about-howto) + +# 🔗 MCP(Model Context Protocol)란? + +MCP는 Claude를 개발한 Anthropic에서 만든 프로토콜로, AI 모델이 외부 도구와 데이터에 안전하고 효율적으로 접근할 수 있게 해주는 표준화된 인터페이스입니다. +이제 한국투자증권이 만든 2개의 MCP를 통해 한국투자증권 Open API를 자연어로 쉽게 활용할 수 있습니다. + +# 한국투자증권 MCP 소개 + +## KIS Trade MCP + +### **특징 및 용도** + +국내/해외주식, 선물·옵션, 채권, ETF/ETN, 인증 등 한국투자증권의 다양한 Open API를 **MCP 서버의 "도구"**로 래핑하였습니다. LLM이 바로 사용할 수 있도록 *API 스키마·파라미터*를 리소스로 제공하고, *모의/실전 환경*을 구분하여 안전하게 실행합니다. + +### 설정 방법 + +(9월 중 공개 예정) + +## KIS Code Assistant MCP + +### 특징 및 용도 + +한국투자증권의 많은 Open API 중에서 **자연어 검색으로 관련 API를 찾고**, **호출 예제(파라미터 포함)까지 자동 구성**해주는 MCP 서버입니다. "무엇을 하고 싶은지"만 말하면, 관련 API를 추천하고 예시 호출 코드를 만들어 드립니다. + +### 설정 방법 + +1. Claude Desktop + + Link : [https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp](https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp) + + image + + image 1 + + **AUTO / Claude Desktop** 선택 → Terminal 명령어 Copy 클릭 + + image 2 + + 터미널에 명령어 붙여넣기하고 엔터 → 설치 완료 메시지 후 Claude 재시작 질문에는 Y 입력 후 엔터를 누르면 Claude Desktop 재시작 + + image 3 + + + 홈 화면 대화창 하단 **검색 및 도구** 버튼에서 설치 및 추가 확인 가능, `설정 → 개발자`에서도 확인 할 수 있습니다. + +2. Cursor + + Link : [https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp](https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp) + + image 4 + + image 5 + + + **AUTO / Cursor** 선택 → **One-Click Install** 클릭 + + image 6 + + Cursor에서 **Install** 클릭하면 완료 + + image 7 + + KIS Code Assistant MCP가 연결되었는지 확인 (경로 : `Settings` > `MCP Servers`) + + +# 🚀 MCP기반 트레이딩 시스템 개발을 위한 환경 설정 + +트레이딩 시스템 개발을 시작하기 전에 필요한 Python 환경 구성부터 API 연결 테스트까지 개발 환경 설정 과정을 안내합니다. + +### 1. 폴더 생성 및 파일 다운로드 + +트레이딩 시스템 개발을 위해 필요한 파일을 다운로드하고 폴더를 생성하고 경로를 지정하세요. + +### **1-1. 보안 폴더 생성** + +중요 정보를 저장하는 폴더와 실행 코드를 저장하는 폴더를 각각 생성합니다. + +**맥/리눅스**: + +```bash +mkdir -p ~/KIS/config +cd ~/KIS/config +``` + +**윈도우 PowerShell**: + +```powershell +mkdir "$HOME\KIS\config" +cd "$HOME\KIS\config" +``` + +### **1-2. 프로젝트 폴더 생성** + +**맥/리눅스**: + +```bash +mkdir -p ~/자동매매 +cd ~/자동매매 +``` + +**윈도우 PowerShell**: + +```powershell +mkdir "$HOME\자동매매" +cd "$HOME\자동매매" +``` + +### **1-3. GitHub에서 파일 다운로드** + +한국투자증권 GitHub에서 세개 파일을 다운로드 받으세요. + +**GitHub 링크**: https://github.com/koreainvestment/open-trading-api + +1. **kis_devlp.yaml** → `~/kis/config` 폴더에 저장 **(보안 정보로 별도 관리)** + + https://github.com/koreainvestment/open-trading-api/blob/main/kis_devlp.yaml + +2. **kis_auth.py** → `~/자동매매/` 폴더에 저장 + + https://github.com/koreainvestment/open-trading-api/blob/main/examples_llm/kis_auth.py + +3. **pyproject.toml** → `~/자동매매/` 폴더에 저장 + + https://github.com/koreainvestment/open-trading-api/blob/main/pyproject.toml + + +> 경로 표기 안내 +문서에서 `~`는 **내 사용자 폴더(홈)**를 뜻합니다. +`~/{폴더명}`은 그 안의 `{폴더명}` 폴더라는 의미이며, 실제 입력은 `~/kis/config`처럼 중괄호 없이 적습니다. +(Windows PowerShell: `~` → `C:\Users\내이름`) +> + +### **1-4. `중요`kis_devlp.yaml 설정** + +`~/KIS/kis_devlp.yaml` 파일에 발급받은 App key, App Secret, 계좌정보 (실전, 모의)를 입력하세요 + +```yaml +#홈페이지에서 API서비스 신청시 발급 AppKey, AppSecret 값 설정 +#실전투자 +my_app: "발급받은_실제_APP_KEY" # 한국투자증권에서 발급받은 APP KEY 입력 +my_sec: "발급받은_실제_APP_SECRET" # 한국투자증권에서 발급받은 APP SECRET 입력 + +#모의투자 +paper_app: "발급받은_실제_APP_KEY" # 모의투자용 APP KEY (실전과 동일) +paper_sec: "발급받은_실제_APP_SECRET" # 모의투자용 APP SECRET (실전과 동일) + +# HTS ID +my_htsid: "실제_HTS_ID" # 한국투자증권 HTS ID 입력 + +#계좌번호 및 8자리 +my_acct_stock: "실제_계좌번호" # 주식 계좌번호 (예: 50068418) +my_acct_future: "실제_계좌번호" # 선물옵션 계좌번호 (주식과 동일 가능) +my_paper_stock: "모의투자_계좌번호" # 모의투자 주식 계좌번호 +my_paper_future: "모의투자_계좌번호" # 모의투자 선물옵션 계좌번호 (주식과 동일 가능) + +#계좌번호 뒤 2자리 +my_prod: "01" # 01(종합계좌), 03(국내선물옵션), 08(해외선물옵션), 22(개인연금), 29(퇴직연금) +``` + +> **⚠️ 보안 주의사항:** +> +> - App Key/App Secret과 계좌번호는 절대 타인과 공유하지 마세요. +> - GitHub 공개 저장소와 같이 외부에 공개된 저장소에는 절대 업로드하지 마세요. +> - 트레이딩 시스템 폴더와 별도의 경로(~/KIS/config)에 보관하세요. +> - 정기적으로 API Key를 재발급하여 보안을 강화하세요 + +## 2. uv 설치 및 가상환경 설정 + +### **2-1. uv 설치** + +**맥/리눅스**: + +```bash +curl -LsSf https://astral.sh/uv/install.sh | sh +``` + +**윈도우**: + +```powershell +powershell -c "irm https://astral.sh/uv/install.ps1 | iex" +``` + +### **2-2. 가상환경 설정** + +프로젝트 폴더로 이동 후 가상환경 생성: + +```bash +cd ~/자동매매 +uv sync +``` + +### **2-3. 가상환경 활성화** + +**맥/리눅스**: + +```bash +source .venv/bin/activate +``` + +**윈도우**: + +```bash +.venv\Scripts\activate +``` + +## 3. 연결 테스트 (필수 검증) + +### 3-1. 기본 연결 테스트 + +`~/자동매매/test_connection.py` 파일을 생성하고 해당 코드를 복사/붙여넣기 합니다. + +(모의투자로 세팅되어 있습니다.) + +```python +# test_connection.py +# KIS Open API 연결 테스트 및 기본 정보 확인 스크립트 +import sys +import os + +try: + from kis_auth import auth, getTREnv, getEnv, read_token + import kis_auth + + # 설정 파일 확인 + print("설정 파일 확인 중...") + cfg = getEnv() + print(f"앱키: {cfg.get('my_app', 'None')[:10]}...") + print(f"서버 URL: {cfg.get('prod', 'None')}") + + # 인증 토큰 발급 테스트 + print("토큰 발급 시도 중...") + try: + # 디버그 모드 활성화 + kis_auth._DEBUG = True + + auth(svr="vps") # 모의투자 토큰 발급 및 저장 + print("토큰 발급 완료") + + # 토큰이 제대로 설정되지 않은 경우 수동으로 설정 + env = getTREnv() + if not env.my_token: + print("토큰이 환경에 설정되지 않음. 저장된 토큰을 확인합니다...") + saved_token = read_token() + if saved_token: + print("저장된 토큰을 찾았습니다. 환경에 설정합니다...") + # 토큰을 직접 설정 + kis_auth._TRENV = kis_auth._TRENV._replace(my_token=saved_token) + kis_auth._base_headers["authorization"] = f"Bearer {saved_token}" + print("토큰 설정 완료") + else: + print("저장된 토큰도 없습니다.") + + except Exception as auth_error: + print(f"토큰 발급 중 오류: {auth_error}") + import traceback + traceback.print_exc() + + # 환경 정보 확인 + env = getTREnv() + + if hasattr(env, 'my_token') and env.my_token: + print("✅ API 연결 성공!") + print(f"토큰 앞 10자리: {env.my_token[:10]}...") + print(f"계좌번호: {env.my_acct}") + print(f"서버: {'모의투자' if env.my_url.find('vts') > 0 else '실전투자'}") + else: + print("❌ API 연결 실패 - 토큰이 없습니다") + print(f"토큰 속성 존재: {hasattr(env, 'my_token')}") + if hasattr(env, 'my_token'): + print(f"토큰 값: {env.my_token}") + print(f"토큰 길이: {len(env.my_token) if env.my_token else 0}") + +except Exception as e: + print(f"❌ 오류 발생: {e}") + print("devlp.yaml 파일 경로와 설정을 확인해주세요") +``` + +### 3-2. 테스트 실행 + +테스트를 실행하고 결과를 확인하세요. + +```bash +# 실행 +cd ~/자동매매 +python test_connection.py + +# 결과 +✅ API 연결 성공! +토큰 앞 10자리: asdfasdfas... +계좌번호: 12345678 +서버: 모의투자 +``` + +### 🛠️ 자주 발생하는 문제와 해결방법 + +1. MCP 연결 실패 시 + - Claude Desktop/Cursor 재시작 + - MCP 서버 URL 확인 ([https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp](https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp)) + - 방화벽 설정 확인 + - 인터넷 연결 확인 +2. API 연결 오류 시 + - App Key와 Secret이 발급 받은 것과 동일한지 확인 + - kis_auth.py 의 내용이 다운로드 받은 파일과 동일한지 확인 + - kis_devlp.yaml 파일이 “~/KIS/config/” 혹은 “$HOME/KIS/config”에 있는지 확인 + - kis_devlp.yaml 파일에 작성한 개인정보가 정확한지 확인 (App Key/Secret, HTS ID, 계좌번호, 상품코드) + - kis_devlp.yaml 파일의 문법이 올바른지 확인 (YAML 문법, 들여쓰기 주의) +3. 가상환경 문제 시 + - uv 버전 확인: `uv --version` + - pyproject.toml 의 내용이 다운로드 받은 파일과 동일한지 확인 + - 프로그램 실행에 필요한 전체 패키지 재설치: `uv sync` + - 가상환경 재생성: `uv venv --force` +4. Python 모듈 import 오류 시 + - 가상환경 활성화 확인 + - 필요 패키지 설치: `uv add {패키지명}` + +--- + +## 4. 최종 폴더 구조 확인 + +설정이 성공적으로 완료되면 폴더 구조는 다음과 같습니다. + +``` +~/KIS/ +└── config/ + └── devlp.yaml (보안 정보) + +~/자동매매/ +├── kis_auth.py +├── pyproject.toml +├── test_connection.py +├── .venv/ (uv sync 후 자동 생성) +└── uv.lock (uv sync 후 자동 생성) +``` + +--- + +## Next Step + +설정이 완료되셨다면 이제 투자를 위한 전략를 구현하세요. + +1. 🎯 MCP를 활용하여 개발 시작하기 + - Cursor에서 KIS Code Assistant MCP를 활용하여 자동매매 시스템 개발 + - 자연어로 '주식 현재가 조회 코드 보여줘' 같은 질문하기 +2. 📊 모의투자 환경에서 충분한 테스트 진행 + - 실제 거래 전 반드시 모의투자로 검증 + - 손절/익절 로직 구현 및 테스트 +3. 🔒 실전 투자 적용 시 보안과 리스크 관리 강화 + - 포트폴리오 분산 투자 권장 + - 정기적인 API 키 교체 + +🚀 고급 활용 팁 + +- 백테스팅을 통한 전략 검증 +- 실시간 알림 시스템 구축 +- 리스크 관리 자동화 + +--- + +한국투자증권은 기술을 통해 투자의 진입장벽을 낮추고, 투자자들이 더 나은 투자 경험을 할 수 있도록 MCP를 통해 복잡한 API 연동 등 개발환경을 개선하여 투자 전략 본질에 집중할 수 있도록 지원합니다. + +AI와 함께하는 새로운 투자 시대, 여러분만의 성공 투자 스토리에 한국투자증권 MCP가 든든한 파트너가 되겠습니다. diff --git a/한국투자증권(API)/MCP/README.MD b/한국투자증권(API)/MCP/README.MD new file mode 100644 index 0000000..83628b9 --- /dev/null +++ b/한국투자증권(API)/MCP/README.MD @@ -0,0 +1,78 @@ +# 한국투자증권 MCP: 투자 코딩이 쉬워지는 순간 + +## 🚀 소개 + +한국투자증권에서 개발자들을 위한 혁신적인 도구를 공개합니다. **MCP(Model Context Protocol)**를 활용해 AI 모델이 증권 데이터에 직접 접근할 수 있는 두 가지 도구를 제공합니다: + +1. **KIS Code Assistant MCP**: 한국투자증권 OpenAPI 사용법과 샘플코드를 AI 도구가 검색/제공 +2. **KIS Trading MCP** : 한국투자증권 OpenAPI를 AI 도구에서 직접 호출 + +## 🔧 지원 기능 + +### KIS Code Assistant MCP + https://smithery.ai/server/@KISOpenAPI/kis-code-assistant-mcp +- **스마트 검색**: 자연어로 원하는 API 기능 검색 +- **샘플코드 제공**: GitHub에서 실제 구현 코드 자동 검색 +- **카테고리별 탐색**: 기능별 체계적인 API 분류 + +### KIS Trading MCP +- **시세 조회**: 국내/해외 주식, 선물/옵션, 채권, ETF/ELW +- **계좌 관리**: 잔고조회, 주문/체결내역, 손익현황 +- **매매 주문**: 현물/신용/선물옵션 주문 및 정정취소 +- **시장 분석**: 순위정보, 투자자별 매매동향, 프로그램매매 + +## 💡 활용 예시 + +### Claude와 함께 사용 + +``` +사용자: "삼성전자 현재가와 호가창 정보 알려줘" +Claude: [KIS OpenAPI] → 실시간 데이터 제공 + +사용자: "내 계좌 잔고에서 수익률 높은 종목 5개 보여줘" +Claude: [잔고 조회 + 데이터 분석] → 맞춤형 포트폴리오 분석 +``` + +### Cursor IDE에서 활용 + +```python +# AI가 자동으로 API 호출 코드 생성 및 실행 +def get_stock_info(code): + """삼성전자 주가 정보를 가져오는 함수를 만들어줘""" + # MCP를 통해 실제 API 호출 코드가 자동 생성됨 +``` + +## 🌟 특징 + +- **데이터**: 지연 없는 시세 정보 +- **완전한 API 커버리지**: 한투 OpenAPI의 모든 기능 지원 +- **자연어 인터페이스**: 복잡한 API 문서 없이 대화로 사용 +- **코드 자동 생성**: 샘플코드를 기반으로 한 맞춤형 구현 +- **보안**: OAuth 토큰 기반 안전한 인증 + +## 🎯 사용 시나리오 + +### 개인 투자자 + +- "오늘 상승률 상위 10개 종목의 PER, PBR 비교해줘" +- "내 포트폴리오에서 손절매가 필요한 종목 찾아줘" + +### 퀀트 개발자 + +- "볼린저밴드 돌파 전략으로 백테스팅 코드 만들어줘" +- "RSI와 MACD 조합 신호로 매매 로직 구현해줘" + +### 핀테크 개발사 + +- "고객별 맞춤 포트폴리오 추천 시스템 개발" +- "실시간 리스크 모니터링 대시보드 구축" + +## 📈 왜 MCP인가? + +기존 REST API의 한계를 뛰어넘어, AI가 상황에 맞는 최적의 API를 선택하고 호출합니다. 개발자는 복잡한 API 문서를 읽을 필요 없이 자연어로 원하는 기능을 요청하면 됩니다. + +--- + +*개발 지식이 있는 투자자라면 이제 아이디어만 있으면 됩니다. 복잡한 구현은 AI가, 실제 매매는 한투 API가 담당합니다. 더 스마트한 투자를 위한 새로운 도구를 경험해 보세요.* + +--- diff --git a/한국투자증권(API)/README.md b/한국투자증권(API)/README.md new file mode 100644 index 0000000..bcf6ddb --- /dev/null +++ b/한국투자증권(API)/README.md @@ -0,0 +1,314 @@ +**[당사에서 제공하는 샘플코드에 대한 유의사항]** + +- 샘플 코드는 한국투자증권 Open API(KIS Developers)를 연동하는 예시입니다. 고객님의 개발 부담을 줄이고자 참고용으로 제공되고 있습니다. +- 샘플 코드는 별도의 공지 없이 지속적으로 업데이트될 수 있습니다. +- 샘플 코드를 활용하여 제작한 고객님의 프로그램으로 인한 손해에 대해서는 당사에서 책임지지 않습니다. + +# KIS Open API 샘플 코드 저장소 (LLM 지원) + +## 1. 제작 의도 및 대상 + +### 🎯 제작 의도 + +이 저장소는 **ChatGPT, Claude 등 LLM(Large Language Model)** 기반 자동화 환경과 Python 개발자 모두가 +**한국투자증권(Korea Investment & Securities) Open API를 쉽게 이해하고 활용**할 수 있도록 구성된 샘플 코드 모음입니다. + +- `examples_llm/`: LLM이 단일 API 기능을 쉽게 탐색하고 호출할 수 있도록 구성된 기능 단위 샘플 코드 +- `examples_user/`: 사용자가 실제 투자 및 자동매매 구현에 활용할 수 있도록 상품별로 통합된 API 호출 예제 코드 + +> AI와 사람이 모두 활용하기 쉬운 구조를 지향합니다. + +[한국투자증권 Open API 포털 바로가기](https://apiportal.koreainvestment.com/) + +### 👤 대상 사용자 + +- 한국투자증권 Open API를 처음 사용하는 Python 개발자 +- 기존 Open API 사용자 중 코드 개선 및 구조 학습이 필요한 사용자 +- LLM 기반 코드 에이전트를 활용해 종목 검색, 시세 분석, 자동매매 등을 구현하고자 하는 사용자 + +## 2. 폴더 구조 및 주요 파일 설명 + +### 2.1. 폴더 구조 + +``` +# 프로젝트 구조 +. +├── README.md # 프로젝트 설명서 +├── docs/ +│ └── convention.md # 코딩 컨벤션 가이드 +├── examples_llm/ # LLM용 샘플 코드 +│ ├── kis_auth.py # 인증 공통 함수 +│ ├── domestic_bond # 국내채권 +│ │ └── inquire_price # API 단일 기능별 폴더 +│ │ ├── inquire_price.py # 한줄 호출 파일 (예: 채권 가격 조회) +│ │ └── chk_inquire_price.py # 테스트 파일 (예: 채권 가격 조회 결과 검증) +│ ├── domestic_futureoption # 국내선물옵션 +│ ├── domestic_stock # 국내주식 +│ ├── elw # ELW +│ ├── etfetn # ETF/ETN +│ ├── overseas_futureoption # 해외선물옵션 +│ ├── overseas_price # 해외시세 +│ └── overseas_stock # 해외주식 +├── examples_user/ # user용 실제 사용 예제 +│ ├── kis_auth.py # 인증 공통 함수 +│ ├── domestic_bond # 국내채권 +│ │ ├── domestic_bond_functions.py # (REST) 통합 함수 파일 (모든 API 함수 모음) +│ │ ├── domestic_bond_examples.py # (REST) 실행 예제 파일 (함수 사용법) +│ │ ├── domestic_bond_functions_ws.py # (Websocket) 통합 함수 파일 +│ │ └── domestic_bond_examples_ws.py # (Websocket) 실행 예제 파일 +│ ├── domestic_futureoption # 국내선물옵션 +│ ├── domestic_stock # 국내주식 +│ ├── elw # ELW +│ ├── etfetn # ETF/ETN +│ ├── overseas_futureoption # 해외선물옵션 +│ ├── overseas_price # 해외시세 +│ └── overseas_stock # 해외주식 +├── legacy/ # 구 샘플코드 보관 +├── stock_info/ # 종목정보파일 참고 데이터 +├── kis_devlp.yaml # API 설정 파일 (개인정보 입력 필요) +├── pyproject.toml # (uv)프로젝트 의존성 관리 +└── uv.lock # (uv)의존성 락 파일 +``` + +### 2.2. 지원되는 주요 API 카테고리 + +- 아래 카테고리 및 폴더 구조는 examples_llm/, examples_user/ 폴더 모두 동일하게 적용됩니다. + +| 카테고리 | 설명 | 폴더명 | +| --- | --- | --- | +| 국내주식 | 국내 주식 시세, 주문, 잔고 등 | `domestic_stock` | +| 국내채권 | 국내 채권 시세, 주문 등 | `domestic_bond` | +| 국내선물옵션 | 국내 파생상품 관련 | `domestic_futureoption` | +| 해외주식 | 해외 주식 시세, 주문 등 | `overseas_stock` | +| 해외선물옵션 | 해외 파생상품 관련 | `overseas_futureoption` | +| ELW | ELW 시세 API | `elw` | +| ETF/ETN | ETF, ETN 시세 API | `etfetn` | + +### 2.3. 주요 파일 설명 + +### `examples_llm/` - llm용 기능 단위 샘플 코드 + +**API별 개별 폴더 구조**: 단일 API 기능을 독립 폴더로 분리하여, LLM이 관련 코드를 쉽게 탐색할 수 있도록 구성 +- **한줄 호출 파일**: `[함수명].py` – 단일 기능을 호출하는 최소 단위 코드 (예: `inquire_price.py`) +- **테스트 파일**: `chk_[함수명].py` – 호출 결과를 검증하는 테스트 실행 코드 (예: `chk_inquire_price.py`) + +### `examples_user/` - 사용자용 통합 예제 코드 + +**카테고리별 개별 폴더 구조**: 카테고리(상품)별로 모든 기능을 통합하여, 사용자가 쉽게 샘플 코드를 탐색하고 실행할 수 있도록 구성 +- **통합 함수 파일**: `[카테고리]_functions.py` - 해당 카테고리의 모든 API 기능이 통합된 함수 모음 +- **실행 예제 파일**: `[카테고리]_examples.py` - 실제 사용 예제를 기반으로 한 실행 코드 +- **웹소켓 통합 함수 파일 및 실행 예제 파일**: `[카테고리]_functions_ws.py`, `[카테고리]_examples_ws.py` + +### `kis_auth.py` - 인증 및 공통 기능 + +- 접근토큰 발급 및 관리 +- API 호출 공통 함수 +- 실전투자/모의투자 환경 전환 지원 +- 웹소켓 연결 설정 기능 제공 + +## 3. 사전 환경설정 안내 + +### 3.1. Python 환경 요구사항 + +- **Python 3.9 이상** 필요 +- **uv** **패키지 매니저 사용** 권장 (빠르고 간편한 의존성 관리) + +### 3.2. uv 설치 방법 + +- 간편 설정을 위해 uv를 권장합니다 + +```bash +# Windows (PowerShell) +powershell -c "irm https://astral.sh/uv/install.ps1 | iex" + +# macOS/Linux +curl -LsSf https://astral.sh/uv/install.sh | sh + +# 설치 확인 +uv --version +# uv 0.x.x ... -> 설치 완료 +``` + +### 3.3. 프로젝트 클론 및 환경 설정 + +```bash +# 저장소 클론 +git clone https://github.com/koreainvestment/open-trading-api +cd open-trading-api/kis_github + +# uv를 사용한 의존성 설치 - 한줄로 끝 +uv sync +``` + +### 3.4. KIS Open API 신청 및 설정 + +🍀 [서비스 신청 안내 바로가기](https://apiportal.koreainvestment.com/about-howto) +1. 한국투자증권 **계좌 개설 및 ID 연결** +2. 한국투자증권 홈페이지 or 앱에서 **Open API 서비스 신청** +3. **앱키(App Key)**, **앱시크릿(App Secret)** 발급 +4. **모의투자** 및 **실전투자** 앱키 각각 준비 + +### 3.5. kis_devlp.yaml 설정 + +- 본인의 계정 설정을 위해 `kis_devlp.yaml` 파일을 열어 다음과 같이 수정합니다. +1. **프로젝트 루트에 위치한** `kis_devlp.yaml` 파일 열기 +2. **앱키와 앱시크릿** 정보 입력 +3. **HTS ID** 정보 입력 +4. **계좌번호** 정보 입력 (앞 8자리와 뒤 2자리 구분) +5. **저장** 후 닫기 + +```yaml +# 실전투자 +my_app: "여기에 실전투자 앱키 입력" +my_sec: "여기에 실전투자 앱시크릿 입력" + +# 모의투자 +paper_app: "여기에 모의투자 앱키 입력" +paper_sec: "여기에 모의투자 앱시크릿 입력" + +# HTS ID(KIS Developers 고객 ID) - 체결통보, 나의 조건 목록 확인 등에 사용됩니다. +my_htsid: "사용자 HTS ID" + +# 계좌번호 앞 8자리 +my_acct_stock: "증권계좌 8자리" +my_acct_future: "선물옵션계좌 8자리" +my_paper_stock: "모의투자 증권계좌 8자리" +my_paper_future: "모의투자 선물옵션계좌 8자리" + +# 계좌번호 뒤 2자리 +my_prod: "01" # 종합계좌 +# my_prod: "03" # 국내선물옵션 계좌 +# my_prod: "08" # 해외선물옵션 계좌 +# my_prod: "22" # 연금저축 계좌 +# my_prod: "29" # 퇴직연금 계좌 + +# User-Agent(기본값 사용 권장, 변경 불필요) +my_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" +``` + +### 3.6. kis_auth.py 설정 경로 수정 + +- `kis_auth.py`의 config_root 경로를 본인 환경에 맞게 수정해줍니다. 발급된 토큰 파일이 저장될 경로로, 제3자가 찾기 어렵도록 설정하는것을 권장합니다. + +```yaml +# kis_auth.py 39번째 줄 +# windows - C:\Users\사용자이름\KIS\config +# Linux/macOS - /home/사용자이름/KIS/config +# config_root = os.path.join(os.path.expanduser("~"), "KIS", "config") +config_root = os.path.join(os.path.expanduser("~"), "폴더 경로", "config") +``` +### 3.7. 실행파일 내 인증 설정 검토 + +- 실행하려는 파일에서 인증 관련 설정을 검토 혹은 변경해줍니다. 국내주식 기능 전체를 이용하시려면, `domestic_stock/domestic_stock_examples.py` 파일을 확인해주세요. +ka.auth() 함수의 svr, product 매개변수를 아래와 같이 수정하면 실전환경(prod)에서 위탁계좌(-01)로 매매 테스트가 가능합니다. + +```python +import kis_auth as ka + +# 실전투자 인증 +ka.auth(svr="prod", product="01") # 모의투자: svr="vps" +``` + +## 4. 샘플 코드 실행 + +### 4.1. 샘플 코드 실행 + +- **examples_user 기준** + +```bash +# 국내주식 샘플 코드 실행 (examples_user/domestic_stock/) +python domestic_stock_examples.py # REST 방식 +python domestic_stock_examples_ws.py # Websocket 방식 +``` + +domestic_stock_examples.py에는 여러 함수가 포함되어 있으므로, 사용하려는 함수만 남기고 나머지는 주석 처리한 후, 입력값을 수정하여 호출해 주세요. + +- **examples_llm 기준** + +```bash +# 국내주식 > 주식현재가 시세 샘플 코드 실행 (examples_llm/domestic_stock/inquire_price/) +python chk_inquire_price.py +``` + +examples_llm 은 각 기능별로 개별 실행 파일(chk_*.py)이 분리되어 있어, 특정 기능만 테스트하고자 할 때 유용합니다. + +### 4.2. 예제 코드 샘플 (examples_user) + +```python +# REST API 호출 예제 - domestic_stock_examples.py +import sys +import logging +import pandas as pd +sys.path.extend(['..', '.']) + +import kis_auth as ka +from domestic_stock_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +# 삼성전자 현재가 시세 조회 +result = inquire_price(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) +``` + +```python +# 웹소켓 호출 예제 - domestic_stock_examples_ws.py +import sys +import logging +import pandas as pd +sys.path.extend(['..', '.']) + +import kis_auth as ka +from domestic_stock_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +# 삼성전자, sk하이닉스 실시간 호가 구독 +kws.subscribe(request=asking_price_krx, data=["005930", "000660"]) +``` + +## 5. 문제 해결 가이드 + +### 토큰 오류 시 + +```python +import kis_auth as ka + +# 토큰 재발급 - 1분당 1회 발급됩니다. +ka.auth(svr="prod") # 또는 "vps" +``` + +### 설정 파일 오류 시 + +- `kis_devlp.yaml` 파일의 앱키, 앱시크릿이 올바른지 확인 +- 계좌번호 형식이 맞는지 확인 (앞 8자리 + 뒤 2자리) +- 실시간 시세(WebSocket) 이용 중 ‘No close frame received’ 오류가 발생하는 경우, `kis_devlp.yaml`에 입력하신 HTS ID가 정확한지 확인 + +### 의존성 오류 시 + +```bash +# 의존성 재설치 +uv sync --reinstall +``` + +--- + +# 📧 문의사항 + +- [💬 한국투자증권 Open API 챗봇](https://chatgpt.com/g/g-68b920ee7afc8191858d3dc05d429571-hangugtujajeunggweon-open-api-seobiseu-gpts)에 언제든 궁금한 점을 물어보세요. diff --git a/한국투자증권(API)/docs/convention.md b/한국투자증권(API)/docs/convention.md new file mode 100644 index 0000000..25c3c27 --- /dev/null +++ b/한국투자증권(API)/docs/convention.md @@ -0,0 +1,112 @@ +# 한국투자증권 OpenAPI 코드 컨벤션 + + +## 정의 +- 한줄호출함수: 사용자 코드에 import 해서 한줄로 API를 실행할 수 있도록 만들어 주는 함수들이 담긴 파일이다 +- 체크함수: 한줄호출함수 파일을 import하여, API를 실행한 후 결과 값을 출력하는 파일을 테스트 파일 + + +## 단어에 대한 정의 +- 1개의 용어에 대해서는 1개의 단어를 사용함으로써, 통일성을 유지하고, LLM이 혼란스럽지 않도록 사용한다. +- 동음이의어, 이음동의어와 같은 문맥상 파악이 필요한 단어를 최대한 지양한다. + + +## 네이밍 컨벤션 +- 네이밍 파이썬 기본 규칙에 벗어나지 않으며, 역할과 의미가 명확해야 한다. +- 널리 알려진 축약어( URL,ID 등) 외에는 축약어와 모호한 이름은 사용하지 않는다. +- 형식 + - 모듈 : snake_case + - 변수: snake_case + - 함수 : snake_case + - 클래스 : PascalCase + - 상수 : UPPER_SNAKE_CASE + + +## 폴더 명명 규칙 +- API 주소에서 차용하여 생성 +```text +url: /uapi/domestic-stock/v1/quotations/comp-program-trade-daily +폴더이름: domestic_stock +``` +- 웹소켓은 URL 이 없으므로, 홈페이의 분류명에 맞추어 적용 + + +## 파일 명명 규칙 +1. Rest API 한줄호출함수 파일 명명 규칙 +- 규칙 : API 주소에서 차용 +- 예시 +```text +url: /uapi/domestic-stock/v1/quotations/comp-program-trade-daily +폴더이름: comp_program_trade_daily +파일이름: comp_program_trade_daily.py +``` + +2. Websocket 한줄호출함수 파일 명명 규칙 +- 규칙 : 웹소켓 함수 직역과 함께, 유사한 이름의 RestAPI를 참고하여 생성 + +3. 테스트 파일 명명 규칙 +- 규칙 : "chk_한줄호출함수 파일이름.py" +- 예시 +```text +한줄호출함수 파일이름: comp_program_trade_daily.py + +체크함수 : chk_comp_program_trade_daily.py +``` + + +## Docstring 작성 +- 코드 블록의 목적, 인자, 반환 값, 예외등을 상세히 기술 +- Google, Sphinx, NumPy 등 널리 사용되는 Docstring 형식을 따라야 한다. +- 예제 코드를 포함해야 한다. + + +## 주석 +- 파일 상단에 모듈 전체의 목적과 주요 기능, 다른 모듈과의 관계, 주요 구성 요소와 그들간의 상호작용 방식을 설명하는 주석 필요 (인코딩, 작성 시각과 작성자) +- 자연어를 기반으로 학습되므로, 가급적 완전한 문장 형태의 자연스러운 설명을 사용 할것 (축약되거나 암호를 사용하지 말것) +- 코드 자체는 “무엇”을 하는지 자체로 명확해야하며, 주석은 “왜” 그렇게 작성했는지를 적어야함 (복잡한 로직, 비직관적인 해결 방법, 특정 디자인 결정의 배경 등) + - 함수/클래스 : 해당 코드 블록이 무엇을 하는지 설명 + - 매개변수 : 이름,타입, 역할, 필수 여부, 기본 값 등을 상세 기술 + - 반환 값 : 무엇을 반환하는지, 타입 + - 예외처리 : 어떤 상황에서 어떤 예외가 발생할 수 있는지 명시 + - 사용예시 : 실제 코드를 사용하여, 어떻게 사용하는지를 보여주는 예시 + - 사전/사후 조건 : 함수 실행 전후에 보장되어야 하는 조건을 명시 +- Input, Ouput 파라미터에 대체 가능한 옵션들에 대한 설명을 추가 + - 파라미터는 Request Header/Query/Body, Response Header/Body 총 5개로 구성되어 있음 + - 각각을 Class화하고 타입을 명시적으로 선언, 필수값은 일반 타입이지만, 선택 값은 Optional을 사용 +- 코드가 변경되면 주석을 변경 +- TODO, FIXME 와 같은 태그를 활용하여 개선 혹은 수정할 내용을 명시 + + +## 코드의 모듈화 및 단일 책임 원칙 +- 함수와 클래스는 가능한 한 작고, 하나의 명확한 기능만을 갖도록 설계 +- 재사용성을 함께 제공하면서, LLM이 독립적으로 이해하는 데 도움이 된다. +- 긴 함수/클래스는 지양한다. +- 추상화 계층이나, 복잡한 디자인 패턴은 LLM이 이해하기 어렵게 만들 수 있으므로, 직관적인 코드를 넣을 것 +- 장황하더라도 명확한 코드가 좋음 (한줄 마법은 지양) + + +## 설정 관리 +- API 키, 경로, 임계 값등 자주 변경되거나, 환경에 따라 달라지는 설정은 코드에서 분리 + - .env + - config.py + - etc.. + + +## import 정리 +- Wildcard는 지양하며, 필요한 것만 명시적으로 import 할 것 +- 라이브러리 from에 따라 그룹화하고, 알파벳순으로 정렬 +- 라이브러리 import 순서 + 1) 표준 라이브러리 + 2) 써드파티 + 3) 로컬 어플리케이션/Lib + + +## 변수 선언 +- 변수의 타입을 명시적으로 선언한다. +- 함수의 파라미터, 리턴값, 변수의 타입을 명시적으로 선언해야 한다. +- 복잡한 타입 (List, Dict, tuple, Optional, Union, Callable 등)을 활용하여 데이터 구조도를 명확하게 표현한다. + + +## 에러 처리 +- try-except 블록을 사용하되, 구체적인 예외 타입을 명시할 것 +- 중요한 이벤트, 에러, 상태 변경 등을 “logging” 을 사용하여 기록 할 것 diff --git a/한국투자증권(API)/examples_llm/auth/auth_token/auth_token.py b/한국투자증권(API)/examples_llm/auth/auth_token/auth_token.py new file mode 100644 index 0000000..21b0465 --- /dev/null +++ b/한국투자증권(API)/examples_llm/auth/auth_token/auth_token.py @@ -0,0 +1,120 @@ +# [인증] OAuth 접근토큰 발급 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import json +import logging +import sys + +import pandas as pd +import requests + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [인증] OAuth 접근토큰 발급 +############################################################################################## + +# 상수 정의 +API_URL = "/oauth2/tokenP" + +def auth_token( + grant_type: str, + appkey: str, + appsecret: str, + env_dv: str +) -> pd.DataFrame: + """ + OAuth 접근토큰 발급 API를 호출하여 DataFrame으로 반환합니다. + + Args: + grant_type (str): [필수] 권한부여 Type (client_credentials) + appkey (str): [필수] 앱키 (한국투자증권 홈페이지에서 발급받은 appkey) + appsecret (str): [필수] 앱시크릿키 (한국투자증권 홈페이지에서 발급받은 appsecret) + env_dv (str): [필수] 환경구분 (real: 실전, demo: 모의) + + Returns: + pd.DataFrame: OAuth 토큰 발급 결과 + + Example: + >>> df = auth_token( + ... grant_type="client_credentials", + ... appkey=trenv.my_app, + ... appsecret=trenv.my_sec, + ... env_dv="real" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not grant_type: + logger.error("grant_type is required. (e.g. 'client_credentials')") + raise ValueError("grant_type is required. (e.g. 'client_credentials')") + + if not appkey: + logger.error("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + raise ValueError("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + + if not appsecret: + logger.error("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + raise ValueError("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + + if not env_dv: + logger.error("env_dv is required. (real: 실전, demo: 모의)") + raise ValueError("env_dv is required. (real: 실전, demo: 모의)") + + # 환경 구분에 따른 서버 URL 설정 + config = ka.getEnv() + if env_dv == "real": + base_url = config.get("prod", "") + elif env_dv == "demo": + base_url = config.get("vps", "") + else: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + url = f"{base_url}{API_URL}" + + # 헤더 설정 + headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8" + } + + # 요청 데이터 + data = { + "grant_type": grant_type, + "appkey": appkey, + "appsecret": appsecret, + } + + try: + # POST 방식으로 직접 API 호출 + response = requests.post(url, data=json.dumps(data), headers=headers) + + if response.status_code == 200: + # 응답 데이터를 DataFrame으로 반환 (1개 row) + response_data = response.json() + current_data = pd.DataFrame([response_data]) + + logger.info("OAuth 토큰 발급 성공") + return current_data + else: + logger.error("API call failed: %s - %s", response.status_code, response.text) + return pd.DataFrame() + + except requests.RequestException as e: + logger.error("Request failed: %s", str(e)) + return pd.DataFrame() + except json.JSONDecodeError as e: + logger.error("JSON decode failed: %s", str(e)) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/auth/auth_token/chk_auth_token.py b/한국투자증권(API)/examples_llm/auth/auth_token/chk_auth_token.py new file mode 100644 index 0000000..52cda98 --- /dev/null +++ b/한국투자증권(API)/examples_llm/auth/auth_token/chk_auth_token.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from auth_token import auth_token + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [인증] OAuth 접근토큰 발급 테스트 +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'access_token': '접근토큰', + 'token_type': '접근토큰유형', + 'expires_in': '접근토큰유효기간_초', + 'access_token_token_expired': '접근토큰유효기간_일시표시' +} + +def main(): + """ + OAuth 접근토큰 발급 테스트 함수 + + Parameters: + - grant_type (str): 권한부여 Type (client_credentials) + - appkey (str): 앱키 (한국투자증권 홈페이지에서 발급받은 appkey) + - appsecret (str): 앱시크릿키 (한국투자증권 홈페이지에서 발급받은 appsecret) + - env_dv (str): 환경구분 (real: 실전, demo: 모의) + + Returns: + - pd.DataFrame: OAuth 토큰 발급 결과 + + Response Fields: + - access_token: 접근토큰 (OAuth 토큰이 필요한 API 경우 발급한 Access token) + - token_type: 접근토큰유형 ("Bearer") + - expires_in: 접근토큰 유효기간(초) + - access_token_token_expired: 접근토큰 유효기간(일시표시) + + Example: + >>> df = auth_token(grant_type="client_credentials", appkey=trenv.my_app, appsecret=trenv.my_sec, env_dv="real") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 환경 설정에서 앱키와 앱시크릿 가져오기 + config = ka.getEnv() + + # 실전투자용 앱키/앱시크릿 사용 (모의투자의 경우 paper_app, paper_sec 사용) + appkey = config.get("my_app", "") + appsecret = config.get("my_sec", "") + + # 앱키와 앱시크릿이 설정되어 있는지 확인 + if not appkey or not appsecret: + logger.error("앱키 또는 앱시크릿이 설정되지 않았습니다. kis_devlp.yaml 파일을 확인해주세요.") + logger.info("필요한 설정: my_app (앱키), my_sec (앱시크릿)") + return + + # API 호출 + logger.info("OAuth 접근토큰 발급 API 호출 시작") + result = auth_token( + grant_type="client_credentials", + appkey=appkey, + appsecret=appsecret, + env_dv="real" # 실전 환경으로 설정 (필요시 "demo"로 변경) + ) + + # 결과 확인 + if result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 결과 처리 + logger.info("=== OAuth 접근토큰 발급 결과 ===") + logger.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result = result.rename(columns=COLUMN_MAPPING) + + + logger.info("결과:") + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/auth/auth_ws_token/auth_ws_token.py b/한국투자증권(API)/examples_llm/auth/auth_ws_token/auth_ws_token.py new file mode 100644 index 0000000..543727d --- /dev/null +++ b/한국투자증권(API)/examples_llm/auth/auth_ws_token/auth_ws_token.py @@ -0,0 +1,127 @@ +# [인증] WebSocket 웹소켓 접속키 발급 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import json +import logging +import sys +from typing import Optional + +import pandas as pd +import requests + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [인증] WebSocket 웹소켓 접속키 발급 +############################################################################################## + +# 상수 정의 +API_URL = "/oauth2/Approval" + +def auth_ws_token( + grant_type: str, + appkey: str, + appsecret: str, + env_dv: str, + token: Optional[str] = "" +) -> pd.DataFrame: + """ + WebSocket 웹소켓 접속키 발급 API를 호출하여 DataFrame으로 반환합니다. + + Args: + grant_type (str): [필수] 권한부여 Type (client_credentials) + appkey (str): [필수] 고객 앱Key (한국투자증권 홈페이지에서 발급받은 appkey) + appsecret (str): [필수] 고객 앱Secret (한국투자증권 홈페이지에서 발급받은 appsecret) + env_dv (str): [필수] 환경구분 (real: 실전, demo: 모의) + token (Optional[str]): 접근토큰 (OAuth 토큰이 필요한 API 경우 발급한 Access token) + + Returns: + pd.DataFrame: WebSocket 접속키 발급 결과 + + Example: + >>> df = auth_ws_token( + ... grant_type="client_credentials", + ... appkey=trenv.my_app, + ... appsecret=trenv.my_sec, + ... env_dv="real" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not grant_type: + logger.error("grant_type is required. (e.g. 'client_credentials')") + raise ValueError("grant_type is required. (e.g. 'client_credentials')") + + if not appkey: + logger.error("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + raise ValueError("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + + if not appsecret: + logger.error("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + raise ValueError("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + + if not env_dv: + logger.error("env_dv is required. (real: 실전, demo: 모의)") + raise ValueError("env_dv is required. (real: 실전, demo: 모의)") + + # 환경 구분에 따른 서버 URL 설정 + config = ka.getEnv() + if env_dv == "real": + base_url = config.get("prod", "") + elif env_dv == "demo": + base_url = config.get("vps", "") + else: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + url = f"{base_url}{API_URL}" + + # 헤더 설정 + headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8" + } + + # 요청 데이터 + data = { + "grant_type": grant_type, + "appkey": appkey, + "secretkey": appsecret, + } + + # token이 있는 경우에만 data에 추가 + if token: + data["token"] = token + + try: + # POST 방식으로 직접 API 호출 + response = requests.post(url, data=json.dumps(data), headers=headers) + + if response.status_code == 200: + # 응답 데이터를 DataFrame으로 반환 (1개 row) + response_data = response.json() + current_data = pd.DataFrame([response_data]) + + logger.info("WebSocket 접속키 발급 성공") + return current_data + else: + logger.error("API call failed: %s - %s", response.status_code, response.text) + return pd.DataFrame() + + except requests.RequestException as e: + logger.error("Request failed: %s", str(e)) + return pd.DataFrame() + except json.JSONDecodeError as e: + logger.error("JSON decode failed: %s", str(e)) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/auth/auth_ws_token/chk_auth_ws_token.py b/한국투자증권(API)/examples_llm/auth/auth_ws_token/chk_auth_ws_token.py new file mode 100644 index 0000000..c8794ab --- /dev/null +++ b/한국투자증권(API)/examples_llm/auth/auth_ws_token/chk_auth_ws_token.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from auth_ws_token import auth_ws_token + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [인증] WebSocket 웹소켓 접속키 발급 테스트 +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'code': '응답코드', + 'message': '응답메세지', + 'approval_key': '웹소켓접속키' +} + +def main(): + """ + WebSocket 웹소켓 접속키 발급 테스트 함수 + + Parameters: + - grant_type (str): 권한부여 Type (client_credentials) + - appkey (str): 고객 앱Key (한국투자증권 홈페이지에서 발급받은 appkey) + - appsecret (str): 고객 앱Secret (한국투자증권 홈페이지에서 발급받은 appsecret) + - env_dv (str): 환경구분 (real: 실전, demo: 모의) + - token (str): 접근토큰 (OAuth 토큰이 필요한 API 경우 발급한 Access token) + + Returns: + - pd.DataFrame: WebSocket 접속키 발급 결과 + + Response Fields: + - code: 응답코드 (HTTP 응답코드) + - message: 응답메세지 + + Example: + >>> df = auth_ws_token(grant_type="client_credentials", appkey=trenv.my_app, appsecret=trenv.my_sec, env_dv="real") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # OAuth 토큰 발급 (WebSocket 접속키 발급에 필요) + logger.info("OAuth 토큰 발급 중...") + ka.auth() # 토큰 발급 + logger.info("OAuth 토큰 발급 완료") + + # 환경 설정에서 토큰, 앱키, 앱시크릿 가져오기 + trenv = ka.getTREnv() + appkey = trenv.my_app + appsecret = trenv.my_sec + + # 토큰 및 앱키가 설정되어 있는지 확인 + if not appkey or not appsecret: + logger.error("앱키 또는 앱시크릿이 설정되지 않았습니다.") + return + + # API 호출 + logger.info("WebSocket 웹소켓 접속키 발급 API 호출 시작") + result = auth_ws_token( + grant_type="client_credentials", + appkey=appkey, + appsecret=appsecret, + env_dv="real", # 실전 환경으로 설정 (필요시 "demo"로 변경) + ) + + # 결과 확인 + if result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 결과 처리 + logger.info("=== WebSocket 웹소켓 접속키 발급 결과 ===") + logger.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result = result.rename(columns=COLUMN_MAPPING) + + + logger.info("결과:") + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/avg_unit.py b/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/avg_unit.py new file mode 100644 index 0000000..b71e8e1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/avg_unit.py @@ -0,0 +1,171 @@ +# [장내채권] 기본시세 - 장내채권 평균단가조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 평균단가조회 [국내채권-158] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/avg-unit" + +def avg_unit( + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + vrfc_kind_cd: str, # 검증종류코드 + NK30: str = "", # 연속조회키30 + FK100: str = "", # 연속조회검색조건100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 평균단가조회[국내주식-158] + 장내채권 평균단가조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_strt_dt (str): 조회 시작 일자 (예: '20230101') + inqr_end_dt (str): 조회 종료 일자 (예: '20230131') + pdno (str): 상품번호, 공백: 전체, 특정종목 조회시 : 종목코드 + prdt_type_cd (str): 상품유형코드 (예: '302') + vrfc_kind_cd (str): 검증종류코드 (예: '00') + NK30 (str): 연속조회키30, 공백 허용 + FK100 (str): 연속조회검색조건100, 공백 허용 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 장내채권 평균단가조회 데이터 + + Example: + >>> df1, df2, df3 = avg_unit( + ... inqr_strt_dt='20230101', + ... inqr_end_dt='20230131', + ... pdno='KR2033022D33', + ... prdt_type_cd='302', + ... vrfc_kind_cd='00', + ... ) + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # 필수 파라미터 검증 + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20230131')") + raise ValueError("inqr_end_dt is required. (e.g. '20230131')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + if not vrfc_kind_cd: + logger.error("vrfc_kind_cd is required. (e.g. '00')") + raise ValueError("vrfc_kind_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame(), + dataframe3 if dataframe3 is not None else pd.DataFrame() + ) + + tr_id = "CTPF2005R" + + params = { + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "VRFC_KIND_CD": vrfc_kind_cd, + "CTX_AREA_NK30": NK30, + "CTX_AREA_FK100": FK100, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 연속조회 정보 업데이트 + tr_cont = res.getHeader().tr_cont + NK30 = res.getBody().ctx_area_nk30 + FK100 = res.getBody().ctx_area_fk100 + + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # output3 데이터 처리 + current_data3 = pd.DataFrame(res.getBody().output3) + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logger.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return avg_unit( + inqr_strt_dt, + inqr_end_dt, + pdno, + prdt_type_cd, + vrfc_kind_cd, + NK30, + FK100, + dataframe1, + dataframe2, + dataframe3, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/chk_avg_unit.py b/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/chk_avg_unit.py new file mode 100644 index 0000000..0a3ae30 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/avg_unit/chk_avg_unit.py @@ -0,0 +1,184 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from avg_unit import avg_unit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 평균단가조회 [국내채권-158] +############################################################################################## + + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'evlu_dt': '평가일자', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'kis_unpr': '한국신용평가단가', + 'kbp_unpr': '한국채권평가단가', + 'nice_evlu_unpr': '한국신용정보평가단가', + 'fnp_unpr': '에프앤자산평가단가', + 'avg_evlu_unpr': '평균평가단가', + 'kis_crdt_grad_text': '한국신용평가신용등급내용', + 'kbp_crdt_grad_text': '한국채권평가신용등급내용', + 'nice_crdt_grad_text': '한국신용정보신용등급내용', + 'fnp_crdt_grad_text': '에프앤자산평가신용등급내용', + 'chng_yn': '변경여부', + 'kis_erng_rt': '한국신용평가수익율', + 'kbp_erng_rt': '한국채권평가수익율', + 'nice_evlu_erng_rt': '한국신용정보평가수익율', + 'fnp_erng_rt': '에프앤자산평가수익율', + 'avg_evlu_erng_rt': '평균평가수익율', + 'kis_rf_unpr': '한국신용평가RF단가', + 'kbp_rf_unpr': '한국채권평가RF단가', + 'nice_evlu_rf_unpr': '한국신용정보평가RF단가', + 'avg_evlu_rf_unpr': '평균평가RF단가', + 'evlu_dt': '평가일자', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'kis_evlu_amt': '한국신용평가평가금액', + 'kbp_evlu_amt': '한국채권평가평가금액', + 'nice_evlu_amt': '한국신용정보평가금액', + 'fnp_evlu_amt': '에프앤자산평가평가금액', + 'avg_evlu_amt': '평균평가금액', + 'chng_yn': '변경여부', + 'output3': '응답상세', + 'evlu_dt': '평가일자', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'kis_crcy_cd': '한국신용평가통화코드', + 'kis_evlu_unit_pric': '한국신용평가평가단위가격', + 'kis_evlu_pric': '한국신용평가평가가격', + 'kbp_crcy_cd': '한국채권평가통화코드', + 'kbp_evlu_unit_pric': '한국채권평가평가단위가격', + 'kbp_evlu_pric': '한국채권평가평가가격', + 'nice_crcy_cd': '한국신용정보통화코드', + 'nice_evlu_unit_pric': '한국신용정보평가단위가격', + 'nice_evlu_pric': '한국신용정보평가가격', + 'avg_evlu_unit_pric': '평균평가단위가격', + 'avg_evlu_pric': '평균평가가격', + 'chng_yn': '변경여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [장내채권] 기본시세 + 장내채권 평균단가조회[국내주식-158] + + 장내채권 평균단가조회 테스트 함수` + + Parameters: + - inqr_strt_dt (str): 조회시작일자 (일자 ~) + - inqr_end_dt (str): 조회종료일자 (~ 일자) + - pdno (str): 상품번호 (공백: 전체, 특정종목 조회시 : 종목코드) + - prdt_type_cd (str): 상품유형코드 (Unique key(302)) + - vrfc_kind_cd (str): 검증종류코드 (Unique key(00)) + + Returns: + - Tuple[DataFrame, ...]: 장내채권 평균단가조회 결과 + + Example: + >>> df1, df2, df3 = avg_unit(inqr_strt_dt="20250101", inqr_end_dt="20250131", pdno="KR2033022D33", prdt_type_cd="302", vrfc_kind_cd="00") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권 평균단가조회") + result1, result2, result3 = avg_unit( + inqr_strt_dt="20240101", # 조회시작일자 + inqr_end_dt="20250630", # 조회종료일자 + pdno="KR103502GA34", # 상품번호 + prdt_type_cd="302", # 상품유형코드 + vrfc_kind_cd="00", # 검증종류코드 + ) + + # 결과 확인 + results = [result1, result2, result3] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + # output3 결과 처리 + logger.info("=== output3 조회 ===") + if not result3.empty: + logger.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result3 = result3.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logger.info("output3 결과:") + print(result3) + else: + logger.info("output3 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/bond_asking_price.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/bond_asking_price.py new file mode 100644 index 0000000..781ff12 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/bond_asking_price.py @@ -0,0 +1,97 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간호가 [실시간-053] +############################################################################################## + +def bond_asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 일반채권 실시간호가[H0BJASP0] + 일반채권 실시간호가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 메시지. + columns (list[str]): 응답 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = bond_asking_price("1", "005930") + >>> print(msg, columns) + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0BJASP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "stnd_iscd", + "stck_cntg_hour", + "askp_ert1", + "bidp_ert1", + "askp1", + "bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "askp_ert2", + "bidp_ert2", + "askp2", + "bidp2", + "askp_rsqn2", + "bidp_rsqn2", + "askp_ert3", + "bidp_ert3", + "askp3", + "bidp3", + "askp_rsqn3", + "bidp_rsqn3", + "askp_ert4", + "bidp_ert4", + "askp4", + "bidp4", + "askp_rsqn4", + "bidp_rsqn4", + "askp_ert5", + "bidp_ert5", + "askp5", + "bidp5", + "askp_rsqn52", + "bidp_rsqn53", + "total_askp_rsqn", + "total_bidp_rsqn", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/chk_bond_asking_price.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/chk_bond_asking_price.py new file mode 100644 index 0000000..0210e0e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_asking_price/chk_bond_asking_price.py @@ -0,0 +1,133 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from bond_asking_price import bond_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간호가 [실시간-053] +############################################################################################## + +COLUMN_MAPPING = { + "stnd_iscd": "표준종목코드", + "stck_cntg_hour": "주식체결시간", + "askp_ert1": "매도호가수익률1", + "bidp_ert1": "매수호가수익률1", + "askp1": "매도호가1", + "bidp1": "매수호가1", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "askp_ert2": "매도호가수익률2", + "bidp_ert2": "매수호가수익률2", + "askp2": "매도호가2", + "bidp2": "매수호가2", + "askp_rsqn2": "매도호가잔량2", + "bidp_rsqn2": "매수호가잔량2", + "askp_ert3": "매도호가수익률3", + "bidp_ert3": "매수호가수익률3", + "askp3": "매도호가3", + "bidp3": "매수호가3", + "askp_rsqn3": "매도호가잔량3", + "bidp_rsqn3": "매수호가잔량3", + "askp_ert4": "매도호가수익률4", + "bidp_ert4": "매수호가수익률4", + "askp4": "매도호가4", + "bidp4": "매수호가4", + "askp_rsqn4": "매도호가잔량4", + "bidp_rsqn4": "매수호가잔량4", + "askp_ert5": "매도호가수익률5", + "bidp_ert5": "매수호가수익률5", + "askp5": "매도호가5", + "bidp5": "매수호가5", + "askp_rsqn52": "매도호가잔량5", + "bidp_rsqn53": "매수호가잔량5", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량" +} + +NUMERIC_COLUMNS = [ + "매도호가수익률1", "매수호가수익률1", "매도호가1", "매수호가1", "매도호가잔량1", "매수호가잔량1", + "매도호가수익률2", "매수호가수익률2", "매도호가2", "매수호가2", "매도호가잔량2", "매수호가잔량2", + "매도호가수익률3", "매수호가수익률3", "매도호가3", "매수호가3", "매도호가잔량3", "매수호가잔량3", + "매도호가수익률4", "매수호가수익률4", "매도호가4", "매수호가4", "매도호가잔량4", "매수호가잔량4", + "매도호가수익률5", "매수호가수익률5", "매도호가5", "매수호가5", "매도호가잔량5", "매수호가잔량5", + "총매도호가잔량", "총매수호가잔량" +] + + +def main(): + """ + 일반채권 실시간호가 + + 일반채권 실시간호가 API입니다. + +[참고자료] +채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=bond_asking_price, data=["KR103502GA34", "KR6095572D81"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/bond_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/bond_ccnl.py new file mode 100644 index 0000000..3269441 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/bond_ccnl.py @@ -0,0 +1,85 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간체결가 [실시간-052] +############################################################################################## + + +def bond_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 일반채권 실시간체결가[H0BJCNT0] 구독 함수 + 한국투자증권 웹소켓 API를 통해 일반채권의 실시간 체결가 데이터를 구독합니다. + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 구독 결과 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = bond_ccnl("1", "005930") + >>> print(msg, columns) + + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0BJCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "stnd_iscd", # 표준종목코드 + "bond_isnm", # 채권종목명 + "stck_cntg_hour", # 주식체결시간 + "prdy_vrss_sign", # 전일대비부호 + "prdy_vrss", # 전일대비 + "prdy_ctrt", # 전일대비율 + "stck_prpr", # 현재가 + "cntg_vol", # 체결거래량 + "stck_oprc", # 시가 + "stck_hgpr", # 고가 + "stck_lwpr", # 저가 + "stck_prdy_clpr", # 전일종가 + "bond_cntg_ert", # 현재수익률 + "oprc_ert", # 시가수익률 + "hgpr_ert", # 고가수익률 + "lwpr_ert", # 저가수익률 + "acml_vol", # 누적거래량 + "prdy_vol", # 전일거래량 + "cntg_type_cls_code", # 체결유형코드 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/chk_bond_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/chk_bond_ccnl.py new file mode 100644 index 0000000..f9a84ac --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_ccnl/chk_bond_ccnl.py @@ -0,0 +1,112 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from bond_ccnl import bond_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간체결가 [실시간-052] +############################################################################################## + +COLUMN_MAPPING = { + "stnd_iscd": "표준종목코드", + "bond_isnm": "채권종목명", + "stck_cntg_hour": "주식체결시간", + "prdy_vrss_sign": "전일대비부호", + "prdy_vrss": "전일대비", + "prdy_ctrt": "전일대비율", + "stck_prpr": "현재가", + "cntg_vol": "체결거래량", + "stck_oprc": "시가", + "stck_hgpr": "고가", + "stck_lwpr": "저가", + "stck_prdy_clpr": "전일종가", + "bond_cntg_ert": "현재수익률", + "oprc_ert": "시가수익률", + "hgpr_ert": "고가수익률", + "lwpr_ert": "저가수익률", + "acml_vol": "누적거래량", + "prdy_vol": "전일거래량", + "cntg_type_cls_code": "체결유형코드" +} + +NUMERIC_COLUMNS = [ + "전일대비", "전일대비율", "현재가", "체결거래량", "시가", "고가", "저가", "전일종가", + "현재수익률", "시가수익률", "고가수익률", "저가수익률", "누적거래량", "전일거래량" +] + + +def main(): + """ + 일반채권 실시간체결가 + + 일반채권 실시간체결가 API입니다. + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + +[참고자료] +채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=bond_ccnl, data=["KR103502GA34", "KR6095572D81"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/bond_index_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/bond_index_ccnl.py new file mode 100644 index 0000000..eb0838b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/bond_index_ccnl.py @@ -0,0 +1,84 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 채권지수 실시간체결가 [실시간-060] +############################################################################################## + + +def bond_index_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 채권지수 실시간체결가[H0BICNT0] + 채권지수 실시간체결가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 구독할 종목코드. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 구독 요청에 대한 응답 메시지. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = bond_index_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0BICNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "nmix_id", # 지수ID + "stnd_date1", # 기준일자1 + "trnm_hour", # 전송시간 + "totl_ernn_nmix_oprc", # 총수익지수시가지수 + "totl_ernn_nmix_hgpr", # 총수익지수최고가 + "totl_ernn_nmix_lwpr", # 총수익지수최저가 + "totl_ernn_nmix", # 총수익지수 + "prdy_totl_ernn_nmix", # 전일총수익지수 + "totl_ernn_nmix_prdy_vrss", # 총수익지수전일대비 + "totl_ernn_nmix_prdy_vrss_sign", # 총수익지수전일대비부호 + "totl_ernn_nmix_prdy_ctrt", # 총수익지수전일대비율 + "clen_prc_nmix", # 순가격지수 + "mrkt_prc_nmix", # 시장가격지수 + "bond_call_rnvs_nmix", # Call재투자지수 + "bond_zero_rnvs_nmix", # Zero재투자지수 + "bond_futs_thpr", # 선물이론가격 + "bond_avrg_drtn_val", # 평균듀레이션 + "bond_avrg_cnvx_val", # 평균컨벡서티 + "bond_avrg_ytm_val", # 평균YTM + "bond_avrg_frdl_ytm_val", # 평균선도YTM + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/chk_bond_index_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/chk_bond_index_ccnl.py new file mode 100644 index 0000000..8b6449c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/bond_index_ccnl/chk_bond_index_ccnl.py @@ -0,0 +1,124 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from bond_index_ccnl import bond_index_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 채권지수 실시간체결가 [실시간-060] +############################################################################################## + +COLUMN_MAPPING = { + "nmix_id": "지수ID", + "stnd_date1": "기준일자1", + "trnm_hour": "전송시간", + "totl_ernn_nmix_oprc": "총수익지수시가지수", + "totl_ernn_nmix_hgpr": "총수익지수최고가", + "totl_ernn_nmix_lwpr": "총수익지수최저가", + "totl_ernn_nmix": "총수익지수", + "prdy_totl_ernn_nmix": "전일총수익지수", + "totl_ernn_nmix_prdy_vrss": "총수익지수전일대비", + "totl_ernn_nmix_prdy_vrss_sign": "총수익지수전일대비부호", + "totl_ernn_nmix_prdy_ctrt": "총수익지수전일대비율", + "clen_prc_nmix": "순가격지수", + "mrkt_prc_nmix": "시장가격지수", + "bond_call_rnvs_nmix": "Call재투자지수", + "bond_zero_rnvs_nmix": "Zero재투자지수", + "bond_futs_thpr": "선물이론가격", + "bond_avrg_drtn_val": "평균듀레이션", + "bond_avrg_cnvx_val": "평균컨벡서티", + "bond_avrg_ytm_val": "평균YTM", + "bond_avrg_frdl_ytm_val": "평균선도YTM" +} + +NUMERIC_COLUMNS = [ + "총수익지수시가지수", "총수익지수최고가", "총수익지수최저가", "총수익지수", + "전일총수익지수", "총수익지수전일대비", "총수익지수전일대비율", "순가격지수", + "시장가격지수", "Call재투자지수", "Zero재투자지수", "선물이론가격"] + + +def main(): + """ + 채권지수 실시간체결가 + + 채권지수 실시간체결가 API입니다. + +[참고자료] +채권 종목코드 마스터파일은 "KIS포털 - API문서 - 종목정보파일 - 장내채권 - 채권코드" 참고 부탁드립니다. + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + # 한경채권지수: KBPR01, KBPR02, KBPR03, KBPR04 + # KIS채권지수: KISR01, MSBI07, KTBL10, MSBI09, MSBI10, CDIX01 + # 매경채권지수: MKFR01, MSBI01, MSBI03, MSBI10, CORP01 + kws.subscribe(request=bond_index_ccnl, data=[ + # 한경채권지수 + "KBPR01", "KBPR02", "KBPR03", "KBPR04", + # KIS채권지수 + "KISR01", "MSBI07", "KTBL10", "MSBI09", "MSBI10", "CDIX01", + # 매경채권지수 + "MKFR01", "MSBI01", "MSBI03", "MSBI10", "CORP01" + ]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/buy/buy.py b/한국투자증권(API)/examples_llm/domestic_bond/buy/buy.py new file mode 100644 index 0000000..35adb36 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/buy/buy.py @@ -0,0 +1,112 @@ +# [장내채권] 주문/계좌 - 장내채권 매수주문 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수주문 [국내주식-124] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/buy" + +def buy( + cano: str, + acnt_prdt_cd: str, + pdno: str, + ord_qty2: str, + bond_ord_unpr: str, + samt_mket_ptci_yn: str, + bond_rtl_mket_yn: str, + idcr_stfno: str = "", + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매수주문[국내주식-124] + 장내채권 매수주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (8자리) + acnt_prdt_cd (str): 계좌상품코드 (2자리) + pdno (str): 상품번호 (12자리) + ord_qty2 (str): 주문수량2 (19자리) + bond_ord_unpr (str): 채권주문단가 (182자리) + samt_mket_ptci_yn (str): 소액시장참여여부 ('Y' or 'N') + bond_rtl_mket_yn (str): 채권소매시장여부 ('Y' or 'N') + idcr_stfno (str, optional): 유치자직원번호 (6자리). Defaults to "". + mgco_aptm_odno (str, optional): 운용사지정주문번호 (12자리). Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 매수주문 데이터 + + Example: + >>> df = buy( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="KR1234567890", + ... ord_qty2="10", + ... bond_ord_unpr="10000", + ... samt_mket_ptci_yn="N", + ... bond_rtl_mket_yn="Y" + ... ) + >>> print(df) + """ + tr_id = "TTTC0952U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "SAMT_MKET_PTCI_YN": samt_mket_ptci_yn, + "BOND_RTL_MKET_YN": bond_rtl_mket_yn, + "IDCR_STFNO": idcr_stfno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/buy/chk_buy.py b/한국투자증권(API)/examples_llm/domestic_bond/buy/chk_buy.py new file mode 100644 index 0000000..5191b09 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/buy/chk_buy.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from buy import buy + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수주문 [국내주식-124] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌` + 장내채권 매수주문[국내주식-124] + + 장내채권 매수주문 테스트 함수 + + Parameters: + cano (str): 종합계좌번호 (8자리) + acnt_prdt_cd (str): 계좌상품코드 (2자리) + pdno (str): 상품번호 (12자리) + ord_qty2 (str): 주문수량2 (19자리) + bond_ord_unpr (str): 채권주문단가 (182자리) + samt_mket_ptci_yn (str): 소액시장참여여부 ('Y' or 'N') + bond_rtl_mket_yn (str): 채권소매시장여부 ('Y' or 'N') + idcr_stfno (str, optional): 유치자직원번호 (6자리). Defaults to "". + mgco_aptm_odno (str, optional): 운용사지정주문번호 (12자리). Defaults to "". + + Returns: + - DataFrame: 장내채권 매수주문 결과 + + Example: + >>> df = main() + >>> print(df) + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 매수주문") + result = buy( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + pdno="KR6095572D81", # 상품번호 + ord_qty2="10", # 주문수량 + bond_ord_unpr="9900", # 채권주문단가 + samt_mket_ptci_yn="N", # 소액시장참여여부 + bond_rtl_mket_yn="N", # 채권소매시장여부 + idcr_stfno="", # 유치자직원번호 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ctac_tlno="", # 연락전화번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 매수주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/chk_inquire_asking_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/chk_inquire_asking_price.py new file mode 100644 index 0000000..c88de0c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/chk_inquire_asking_price.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_asking_price import inquire_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(호가) [국내주식-132] +############################################################################################## + +COLUMN_MAPPING = { + 'aspr_acpt_hour': '호가 접수 시간', + 'bond_askp1': '채권 매도호가1', + 'bond_askp2': '채권 매도호가2', + 'bond_askp3': '채권 매도호가3', + 'bond_askp4': '채권 매도호가4', + 'bond_askp5': '채권 매도호가5', + 'bond_bidp1': '채권 매수호가1', + 'bond_bidp2': '채권 매수호가2', + 'bond_bidp3': '채권 매수호가3', + 'bond_bidp4': '채권 매수호가4', + 'bond_bidp5': '채권 매수호가5', + 'askp_rsqn1': '매도호가 잔량1', + 'askp_rsqn2': '매도호가 잔량2', + 'askp_rsqn3': '매도호가 잔량3', + 'askp_rsqn4': '매도호가 잔량4', + 'askp_rsqn5': '매도호가 잔량5', + 'bidp_rsqn1': '매수호가 잔량1', + 'bidp_rsqn2': '매수호가 잔량2', + 'bidp_rsqn3': '매수호가 잔량3', + 'bidp_rsqn4': '매수호가 잔량4', + 'bidp_rsqn5': '매수호가 잔량5', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'ntby_aspr_rsqn': '순매수 호가 잔량', + 'seln_ernn_rate1': '매도 수익 비율1', + 'seln_ernn_rate2': '매도 수익 비율2', + 'seln_ernn_rate3': '매도 수익 비율3', + 'seln_ernn_rate4': '매도 수익 비율4', + 'seln_ernn_rate5': '매도 수익 비율5', + 'shnu_ernn_rate1': '매수2 수익 비율1', + 'shnu_ernn_rate2': '매수2 수익 비율2', + 'shnu_ernn_rate3': '매수2 수익 비율3', + 'shnu_ernn_rate4': '매수2 수익 비율4', + 'shnu_ernn_rate5': '매수2 수익 비율5' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권현재가(호가)[국내주식-132] + + 장내채권현재가(호가) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 시장 분류 코드 (B 입력) + - fid_input_iscd (str): 채권종목코드 + Returns: + - DataFrame: 장내채권현재가(호가) 결과 + + Example: + >>> df = inquire_asking_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권현재가(호가)") + result = inquire_asking_price( + fid_cond_mrkt_div_code="B", # 시장 분류 코드 + fid_input_iscd="KR2033022D33", # 채권종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권현재가(호가) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/inquire_asking_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/inquire_asking_price.py new file mode 100644 index 0000000..1f0749b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_asking_price/inquire_asking_price.py @@ -0,0 +1,116 @@ +# [장내채권] 기본시세 - 장내채권현재가(호가) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(호가) [국내주식-132] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/inquire-asking-price" + +def inquire_asking_price( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + fid_input_iscd: str, # 채권종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(호가)[국내주식-132] + 장내채권현재가(호가) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장 분류 코드 (B 입력) + fid_input_iscd (str): 채권종목코드 (ex KR2033022D33) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(호가) 데이터 + + Example: + >>> df = inquire_asking_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773401C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/chk_inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/chk_inquire_balance.py new file mode 100644 index 0000000..d481a02 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/chk_inquire_balance.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 + +import kis_auth as ka +from inquire_balance import inquire_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 잔고조회 [국내주식-198] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'buy_dt': '매수일자', + 'buy_sqno': '매수일련번호', + 'cblc_qty': '잔고수량', + 'agrx_qty': '종합과세수량', + 'sprx_qty': '분리과세수량', + 'exdt': '만기일', + 'buy_erng_rt': '매수수익율', + 'buy_unpr': '매수단가', + 'buy_amt': '매수금액', + 'ord_psbl_qty': '주문가능수량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 장내채권 잔고조회[국내주식-198] + + 장내채권 잔고조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + - inqr_cndt (str): 조회조건 (00: 전체, 01: 상품번호단위) + - pdno (str): 상품번호 (공백) + - buy_dt (str): 매수일자 (공백) + Returns: + - DataFrame: 장내채권 잔고조회 결과 + + Example: + >>> df = inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_cndt="00", pdno="", buy_dt="") + """ + + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 잔고조회") + result = inquire_balance( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + inqr_cndt="00", # 조회조건 + pdno="", # 상품번호 + buy_dt="", # 매수일자 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 잔고조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/inquire_balance.py new file mode 100644 index 0000000..822a5be --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_balance/inquire_balance.py @@ -0,0 +1,147 @@ +# [장내채권] 주문/계좌 - 장내채권 잔고조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 잔고조회 [국내주식-198] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/inquire-balance" + +def inquire_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_cndt: str, # 조회조건 + pdno: str, # 상품번호 + buy_dt: str, # 매수일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 잔고조회[국내주식-198] + 장내채권 잔고조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + inqr_cndt (str): 조회조건 (00: 전체, 01: 상품번호단위) + pdno (str): 상품번호 (공백 허용) + buy_dt (str): 매수일자 (공백 허용) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 잔고조회 데이터 + + Example: + >>> df = inquire_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... inqr_cndt='00', + ... pdno='', + ... buy_dt='', + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not inqr_cndt: + logger.error("inqr_cndt is required. (e.g. '00')") + raise ValueError("inqr_cndt is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTSC8407R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_CNDT": inqr_cndt, + "PDNO": pdno, + "BUY_DT": buy_dt, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + NK200 = res.getBody().ctx_area_nk200 + FK200 = res.getBody().ctx_area_fk200 + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_balance( + cano, + acnt_prdt_cd, + inqr_cndt, + pdno, + buy_dt, + FK200, + NK200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/chk_inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/chk_inquire_ccnl.py new file mode 100644 index 0000000..316e88b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/chk_inquire_ccnl.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 + +import kis_auth as ka +from inquire_ccnl import inquire_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(체결) [국내주식-201] +############################################################################################## + +COLUMN_MAPPING = { + 'output1': '응답상세', + 'stck_cntg_hour': '주식 체결 시간', + 'bond_prpr': '채권 현재가', + 'bond_prdy_vrss': '채권 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'cntg_vol': '체결 거래량', + 'acml_vol': '누적 거래량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [장내채권] 기본시세 + 장내채권현재가(체결)[국내주식-201] + + 장내채권현재가(체결) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (B (업종코드)) + - fid_input_iscd (str): 입력종목코드 (채권종목코드(ex KR2033022D33)) + Returns: + - DataFrame: 장내채권현재가(체결) 결과 + + Example: + >>> df = inquire_ccnl(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권현재가(체결)") + result = inquire_ccnl( + fid_cond_mrkt_div_code="B", # 조건시장분류코드 + fid_input_iscd="KR103502GA34", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환s + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권현재가(체결) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/inquire_ccnl.py new file mode 100644 index 0000000..9fe20e2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_ccnl/inquire_ccnl.py @@ -0,0 +1,117 @@ +# [장내채권] 기본시세 - 장내채권현재가(체결) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- + +""" +Created on 2025-06-19 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(체결) [국내주식-201] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/inquire-ccnl" + +def inquire_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(체결)[국내주식-201] + 장내채권현재가(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(체결) 데이터 + + Example: + >>> df = inquire_ccnl('B', 'KR2033022D33') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773403C0" + + # API 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/chk_inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/chk_inquire_daily_ccld.py new file mode 100644 index 0000000..d6b06f4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/chk_inquire_daily_ccld.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_daily_ccld import inquire_daily_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 일별체결조회 [국내주식-127] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'tot_ord_qty': '총주문수량', + 'tot_ccld_qty_smtl': '총체결수량합계', + 'tot_bond_ccld_avg_unpr': '총채권체결평균단가', + 'tot_ccld_amt_smtl': '총체결금액합계', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'ord_dvsn_name': '주문구분명', + 'sll_buy_dvsn_cd_name': '매도매수구분코드명', + 'shtn_pdno': '단축상품번호', + 'prdt_abrv_name': '상품약어명', + 'ord_qty': '주문수량', + 'bond_ord_unpr': '채권주문단가', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'bond_avg_unpr': '채권평균단가', + 'tot_ccld_amt': '총체결금액', + 'loan_dt': '대출일자', + 'buy_dt': '매수일자', + 'samt_mket_ptci_yn_name': '소액시장참여여부명', + 'sprx_psbl_yn_ifom': '분리과세가능여부알림', + 'ord_mdia_dvsn_name': '주문매체구분묭', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'nccs_qty': '미체결수량', + 'ord_gno_brno': '주문채번지점번호' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 장내채권 주문체결내역[국내주식-127] + + 장내채권 주문체결내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (종합계좌번호) + - acnt_prdt_cd (str): 계좌상품코드 (계좌상품코드) + - inqr_strt_dt (str): 조회시작일자 (일자 ~ (1주일 이내)) + - inqr_end_dt (str): 조회종료일자 (~ 일자 (조회 당일)) + - sll_buy_dvsn_cd (str): 매도매수구분코드 (%(전체), 01(매도), 02(매수)) + - sort_sqn_dvsn (str): 정렬순서구분 (01(주문순서), 02(주문역순)) + - pdno (str): 상품번호 () + - nccs_yn (str): 미체결여부 (N(전체), C(체결), Y(미체결)) + + Returns: + - Tuple[DataFrame, ...]: 장내채권 주문체결내역 결과 + + Example: + >>> df1, df2 = inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250601", inqr_end_dt="20250630", sll_buy_dvsn_cd="%", sort_sqn_dvsn="01", pdno="", nccs_yn="N", ctx_area_nk200="", ctx_area_fk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 주문체결내역") + result1, result2 = inquire_daily_ccld( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + inqr_strt_dt="20250601", # 조회시작일자 + inqr_end_dt="20250630", # 조회종료일자 + sll_buy_dvsn_cd="%", # 매도매수구분코드 + sort_sqn_dvsn="01", # 정렬순서구분 + pdno="", # 상품번호 + nccs_yn="N", # 미체결여부 + ctx_area_nk200="", # 연속조회키200 + ctx_area_fk200="", # 연속조회검색조건200 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환s + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce') + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환s + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce') + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/inquire_daily_ccld.py new file mode 100644 index 0000000..3f33d9a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_ccld/inquire_daily_ccld.py @@ -0,0 +1,202 @@ +# [장내채권] 주문/계좌 - 장내채권 주문체결내역 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 일별체결조회 [국내주식-127] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/inquire-daily-ccld" + +def inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + sort_sqn_dvsn: str, # 정렬순서구분 + pdno: str, # 상품번호 + nccs_yn: str, # 미체결여부 + ctx_area_nk200: str, # 연속조회키200 + ctx_area_fk200: str, # 연속조회검색조건200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 주문체결내역[국내주식-127] + 장내채권 주문체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + inqr_strt_dt (str): 조회시작일자 (1주일 이내) + inqr_end_dt (str): 조회종료일자 (조회 당일) + sll_buy_dvsn_cd (str): 매도매수구분코드 (%(전체), 01(매도), 02(매수)) + sort_sqn_dvsn (str): 정렬순서구분 (01(주문순서), 02(주문역순)) + pdno (str): 상품번호 + nccs_yn (str): 미체결여부 (N(전체), C(체결), Y(미체결)) + ctx_area_nk200 (str): 연속조회키200 + ctx_area_fk200 (str): 연속조회검색조건200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 장내채권 주문체결내역 데이터 + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... inqr_strt_dt='20230101', + ... inqr_end_dt='20230107', + ... sll_buy_dvsn_cd='01', + ... sort_sqn_dvsn='01', + ... pdno='000000000001', + ... nccs_yn='N', + ... ctx_area_nk200='', + ... ctx_area_fk200='' + ... ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20230107')") + raise ValueError("inqr_end_dt is required. (e.g. '20230107')") + if not sll_buy_dvsn_cd in ["%", "01", "02"]: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01')") + if not sort_sqn_dvsn in ["01", "02"]: + logger.error("sort_sqn_dvsn is required. (e.g. '01')") + raise ValueError("sort_sqn_dvsn is required. (e.g. '01')") + if not nccs_yn in ["N", "C", "Y"]: + logger.error("nccs_yn is required. (e.g. 'N')") + raise ValueError("nccs_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTSC8013R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "SORT_SQN_DVSN": sort_sqn_dvsn, + "PDNO": pdno, + "NCCS_YN": nccs_yn, + "CTX_AREA_NK200": ctx_area_nk200, + "CTX_AREA_FK200": ctx_area_fk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + ctx_area_nk200 = res.getBody().ctx_area_nk200 + ctx_area_fk200 = res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_ccld( + cano, + acnt_prdt_cd, + inqr_strt_dt, + inqr_end_dt, + sll_buy_dvsn_cd, + sort_sqn_dvsn, + pdno, + nccs_yn, + ctx_area_nk200, + ctx_area_fk200, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py new file mode 100644 index 0000000..218c69f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_daily_itemchartprice import inquire_daily_itemchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기간별시세(일) [국내주식-159] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'bond_oprc': '채권시가2', + 'bond_hgpr': '채권고가', + 'bond_lwpr': '채권저가', + 'bond_prpr': '채권현재가', + 'acml_vol': '누적거래량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권 기간별시세(일)[국내주식-159] + + 장내채권 기간별시세(일) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 구분 코드 (Unique key(B)) + - fid_input_iscd (str): 입력 종목코드 (채권종목코드) + Returns: + - DataFrame: 장내채권 기간별시세(일) 결과 + + Example: + >>> df = inquire_daily_itemchartprice(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권 기간별시세(일)") + result = inquire_daily_itemchartprice( + fid_cond_mrkt_div_code="B", # 조건 시장 구분 코드 + fid_input_iscd="KR103502GA34", # 입력 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 기간별시세(일) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py new file mode 100644 index 0000000..e41c14a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py @@ -0,0 +1,114 @@ +# [장내채권] 기본시세 - 장내채권 기간별시세(일) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기간별시세(일) [국내주식-159] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/inquire-daily-itemchartprice" + +def inquire_daily_itemchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 기간별시세(일)[국내주식-159] + 장내채권 기간별시세(일) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 구분 코드 (필수) + fid_input_iscd (str): 입력 종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 기간별시세(일) 데이터 + + Example: + >>> df = inquire_daily_itemchartprice("B", "KR2033022D33") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773701C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_itemchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/chk_inquire_daily_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/chk_inquire_daily_price.py new file mode 100644 index 0000000..f386f3a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/chk_inquire_daily_price.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka + +from inquire_daily_price import inquire_daily_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(일별) [국내주식-202] +############################################################################################## + +COLUMN_MAPPING = { + 'output1': '응답상세', + 'stck_bsop_date': '주식영업일자', + 'bond_prpr': '채권현재가', + 'bond_prdy_vrss': '채권전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'bond_oprc': '채권시가2', + 'bond_hgpr': '채권고가', + 'bond_lwpr': '채권저가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권현재가(일별)[국내주식-202] + + 장내채권현재가(일별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (B (업종코드)) + - fid_input_iscd (str): 입력종목코드 (채권종목코드(ex KR2033022D33)) + Returns: + - DataFrame: 장내채권현재가(일별) 결과 + + Example: + >>> df = inquire_daily_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권현재가(일별)") + result = inquire_daily_price( + fid_cond_mrkt_div_code="B", # 조건시장분류코드 + fid_input_iscd="KR6095572D81", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권현재가(일별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/inquire_daily_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/inquire_daily_price.py new file mode 100644 index 0000000..7b0a4e3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_daily_price/inquire_daily_price.py @@ -0,0 +1,119 @@ +# [장내채권] 기본시세 - 장내채권현재가(일별) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(일별) [국내주식-202] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/inquire-daily-price" + +def inquire_daily_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(일별)[국내주식-202] + 장내채권현재가(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(일별) 데이터 + + Example: + >>> df = inquire_daily_price('B', 'KR2033022D33') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773404C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/chk_inquire_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/chk_inquire_price.py new file mode 100644 index 0000000..7a0eacc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/chk_inquire_price.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_price import inquire_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(시세) [국내주식-200] +############################################################################################## + +COLUMN_MAPPING = { + 'stnd_iscd': '표준종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'bond_prpr': '채권현재가', + 'prdy_vrss_sign': '전일대비부호', + 'bond_prdy_vrss': '채권전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'bond_prdy_clpr': '채권전일종가', + 'bond_oprc': '채권시가2', + 'bond_hgpr': '채권고가', + 'bond_lwpr': '채권저가', + 'ernn_rate': '수익비율', + 'oprc_ert': '시가2수익률', + 'hgpr_ert': '최고가수익률', + 'lwpr_ert': '최저가수익률', + 'bond_mxpr': '채권상한가', + 'bond_llam': '채권하한가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권현재가(시세)[국내주식-200] + + 장내채권현재가(시세) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (B (업종코드)) + - fid_input_iscd (str): 입력종목코드 (채권종목코드(ex KR2033022D33)) + Returns: + - DataFrame: 장내채권현재가(시세) 결과 + + Example: + >>> df = inquire_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권현재가(시세)") + result = inquire_price( + fid_cond_mrkt_div_code="B", # 조건시장분류코드 + fid_input_iscd="KR2033022D33", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권현재가(시세) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/inquire_price.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/inquire_price.py new file mode 100644 index 0000000..6585e2b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_price/inquire_price.py @@ -0,0 +1,114 @@ +# [장내채권] 기본시세 - 장내채권현재가(시세) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(시세) [국내주식-200] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/inquire-price" + +def inquire_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(시세)[국내주식-200] + 장내채권현재가(시세) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(시세) 데이터 + + Example: + >>> df = inquire_price('B', 'KR2033022D33') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773400C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/chk_inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/chk_inquire_psbl_order.py new file mode 100644 index 0000000..158cee0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/chk_inquire_psbl_order.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_psbl_order import inquire_psbl_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수가능조회 [국내주식-199] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ruse_psbl_amt': '재사용가능금액', + 'bond_ord_unpr2': '채권주문단가2', + 'buy_psbl_amt': '매수가능금액', + 'buy_psbl_qty': '매수가능수량', + 'cma_evlu_amt': 'CMA평가금액' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 장내채권 매수가능조회[국내주식-199] + + 장내채권 매수가능조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 + - acnt_prdt_cd (str): 계좌상품코드 + - pdno (str): 채권종목코드(ex KR2033022D33) + - bond_ord_unpr (str): 채권주문단가 + Returns: + - DataFrame: 장내채권 매수가능조회 결과 + + Example: + >>> df = inquire_psbl_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="KR2033022D33", bond_ord_unpr="1000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 매수가능조회") + result = inquire_psbl_order( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + pdno="KR2033022D33", # 채권종목코드(ex KR2033022D33) + bond_ord_unpr="1000", # 채권주문단가 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 매수가능조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/inquire_psbl_order.py new file mode 100644 index 0000000..0e489e7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_order/inquire_psbl_order.py @@ -0,0 +1,132 @@ +# [장내채권] 주문/계좌 - 장내채권 매수가능조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수가능조회 [국내주식-199] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/inquire-psbl-order" + +def inquire_psbl_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + bond_ord_unpr: str, # 채권주문단가 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매수가능조회[국내주식-199] + 장내채권 매수가능조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (필수) + acnt_prdt_cd (str): 계좌상품코드 (필수) + pdno (str): 채권종목코드(ex KR2033022D33) + bond_ord_unpr (str): 채권주문단가 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 매수가능조회 데이터 + + Example: + >>> df = inquire_psbl_order("12345678", "01", "KR2033022D33", "1000") + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '1234567890')") + raise ValueError("cano is required. (e.g. '1234567890')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not pdno: + logger.error("pdno is required. (e.g. 'KR2033022D33')") + raise ValueError("pdno is required. (e.g. 'KR2033022D33')") + + if not bond_ord_unpr: + logger.error("bond_ord_unpr is required. (e.g. '1000')") + raise ValueError("bond_ord_unpr is required. (e.g. '1000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC8910R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "BOND_ORD_UNPR": bond_ord_unpr, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_order( + cano, + acnt_prdt_cd, + pdno, + bond_ord_unpr, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py new file mode 100644 index 0000000..16f1764 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_psbl_rvsecncl import inquire_psbl_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 채권정정취소가능주문조회 [국내주식-126] +############################################################################################## + +COLUMN_MAPPING = { + 'odno': '주문번호', + 'pdno': '상품번호', + 'rvse_cncl_dvsn_name': '정정취소구분명', + 'ord_qty': '주문수량', + 'bond_ord_unpr': '채권주문단가', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'tot_ccld_amt': '총체결금액', + 'ord_psbl_qty': '주문가능수량', + 'orgn_odno': '원주문번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'ord_dvsn_cd': '주문구분코드', + 'mgco_aptm_odno': '운용사지정주문번호', + 'samt_mket_ptci_yn': '소액시장참여여부' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 채권정정취소가능주문조회[국내주식-126] + + 채권정정취소가능주문조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + - ord_dt (str): 주문일자 () + - odno (str): 주문번호 () + - ctx_area_fk200 (str): 연속조회검색조건200 () + - ctx_area_nk200 (str): 연속조회키200 () + Returns: + - DataFrame: 채권정정취소가능주문조회 결과 + + Example: + >>> df = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ord_dt="20250601", odno="", ctx_area_fk200="", ctx_area_nk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 채권정정취소가능주문조회") + result = inquire_psbl_rvsecncl( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ord_dt="", # 주문일자 + odno="", # 주문번호 + ctx_area_fk200="", # 연속조회검색조건200 + ctx_area_nk200="", # 연속조회키200 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 채권정정취소가능주문조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py new file mode 100644 index 0000000..572cbe3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py @@ -0,0 +1,136 @@ +# [장내채권] 주문/계좌 - 채권정정취소가능주문조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 채권정정취소가능주문조회 [국내주식-126] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/inquire-psbl-rvsecncl" + +def inquire_psbl_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ord_dt: str, # 주문일자 + odno: str, # 주문번호 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 채권정정취소가능주문조회[국내주식-126] + 채권정정취소가능주문조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (예: '12345678') + acnt_prdt_cd (str): 계좌상품코드 (예: '01') + ord_dt (str): 주문일자 (예: '20230101') + odno (str): 주문번호 (예: '0000000001') + ctx_area_fk200 (str): 연속조회검색조건200 (예: '조건값') + ctx_area_nk200 (str): 연속조회키200 (예: '키값') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 채권정정취소가능주문조회 데이터 + + Example: + >>> df = inquire_psbl_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ord_dt='20230101', + ... odno='0000000001', + ... ctx_area_fk200='조건값', + ... ctx_area_nk200='키값' + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTSC8035R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORD_DT": ord_dt, + "ODNO": odno, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + ctx_area_nk200 = res.getBody().ctx_area_nk200 + ctx_area_fk200 = res.getBody().ctx_area_fk200 + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_rvsecncl( + cano, + acnt_prdt_cd, + ord_dt, + odno, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/issue_info/chk_issue_info.py b/한국투자증권(API)/examples_llm/domestic_bond/issue_info/chk_issue_info.py new file mode 100644 index 0000000..b86877b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/issue_info/chk_issue_info.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from issue_info import issue_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 발행정보 [국내주식-156] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'prdt_name': '상품명', + 'prdt_eng_name': '상품영문명', + 'ivst_heed_prdt_yn': '투자유의상품여부', + 'exts_yn': '연장여부', + 'bond_clsf_cd': '채권분류코드', + 'bond_clsf_kor_name': '채권분류한글명', + 'papr': '액면가', + 'int_mned_dvsn_cd': '이자월말구분코드', + 'rvnu_shap_cd': '매출형태코드', + 'issu_amt': '발행금액', + 'lstg_rmnd': '상장잔액', + 'int_dfrm_mcnt': '이자지급개월수', + 'bond_int_dfrm_mthd_cd': '채권이자지급방법코드', + 'splt_rdpt_rcnt': '분할상환횟수', + 'prca_dfmt_term_mcnt': '원금거치기간개월수', + 'int_anap_dvsn_cd': '이자선후급구분코드', + 'bond_rght_dvsn_cd': '채권권리구분코드', + 'prdt_pclc_text': '상품특성내용', + 'prdt_abrv_name': '상품약어명', + 'prdt_eng_abrv_name': '상품영문약어명', + 'sprx_psbl_yn': '분리과세가능여부', + 'pbff_pplc_ofrg_mthd_cd': '공모사모모집방법코드', + 'cmco_cd': '주간사코드', + 'issu_istt_cd': '발행기관코드', + 'issu_istt_name': '발행기관명', + 'pnia_dfrm_agcy_istt_cd': '원리금지급대행기관코드', + 'dsct_ec_rt': '할인할증율', + 'srfc_inrt': '표면이율', + 'expd_rdpt_rt': '만기상환율', + 'expd_asrc_erng_rt': '만기보장수익율', + 'bond_grte_istt_name': '채권보증기관명', + 'int_dfrm_day_type_cd': '이자지급일유형코드', + 'ksd_int_calc_unit_cd': '증권예탁결제원이자계산단위코드', + 'int_wunt_uder_prcs_dvsn_cd': '이자원화단위미만처리구분코드', + 'rvnu_dt': '매출일자', + 'issu_dt': '발행일자', + 'lstg_dt': '상장일자', + 'expd_dt': '만기일자', + 'rdpt_dt': '상환일자', + 'sbst_pric': '대용가격', + 'rgbf_int_dfrm_dt': '직전이자지급일자', + 'nxtm_int_dfrm_dt': '차기이자지급일자', + 'frst_int_dfrm_dt': '최초이자지급일자', + 'ecis_pric': '행사가격', + 'rght_stck_std_pdno': '권리주식표준상품번호', + 'ecis_opng_dt': '행사개시일자', + 'ecis_end_dt': '행사종료일자', + 'bond_rvnu_mthd_cd': '채권매출방법코드', + 'oprt_stfno': '조작직원번호', + 'oprt_stff_name': '조작직원명', + 'rgbf_int_dfrm_wday': '직전이자지급요일', + 'nxtm_int_dfrm_wday': '차기이자지급요일', + 'kis_crdt_grad_text': '한국신용평가신용등급내용', + 'kbp_crdt_grad_text': '한국채권평가신용등급내용', + 'nice_crdt_grad_text': '한국신용정보신용등급내용', + 'fnp_crdt_grad_text': '에프앤자산평가신용등급내용', + 'dpsi_psbl_yn': '예탁가능여부', + 'pnia_int_calc_unpr': '원리금이자계산단가', + 'prcm_idx_bond_yn': '물가지수채권여부', + 'expd_exts_srdp_rcnt': '만기연장분할상환횟수', + 'expd_exts_srdp_rt': '만기연장분할상환율', + 'loan_psbl_yn': '대출가능여부', + 'grte_dvsn_cd': '보증구분코드', + 'fnrr_rank_dvsn_cd': '선후순위구분코드', + 'krx_lstg_abol_dvsn_cd': '한국거래소상장폐지구분코드', + 'asst_rqdi_dvsn_cd': '자산유동화구분코드', + 'opcb_dvsn_cd': '옵션부사채구분코드', + 'crfd_item_yn': '크라우드펀딩종목여부', + 'crfd_item_rstc_cclc_dt': '크라우드펀딩종목제한해지일자', + 'bond_nmpr_unit_pric': '채권호가단위가격', + 'ivst_heed_bond_dvsn_name': '투자유의채권구분명', + 'add_erng_rt': '추가수익율', + 'add_erng_rt_aply_dt': '추가수익율적용일자', + 'bond_tr_stop_dvsn_cd': '채권거래정지구분코드', + 'ivst_heed_bond_dvsn_cd': '투자유의채권구분코드', + 'pclr_cndt_text': '특이조건내용', + 'hbbd_yn': '하이브리드채권여부', + 'cdtl_cptl_scty_type_cd': '조건부자본증권유형코드', + 'elec_scty_yn': '전자증권여부', + 'sq1_clop_ecis_opng_dt': '1차콜옵션행사개시일자', + 'frst_erlm_stfno': '최초등록직원번호', + 'frst_erlm_dt': '최초등록일자', + 'frst_erlm_tmd': '최초등록시각', + 'tlg_rcvg_dtl_dtime': '전문수신상세일시' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권 발행정보[국내주식-156] + + 장내채권 발행정보 테스트 함수 + + Parameters: + - pdno (str): 사용자권한정보 (채권 종목번호(ex. KR6449111CB8)) + - prdt_type_cd (str): 거래소코드 (Unique key(302)) + Returns: + - DataFrame: 장내채권 발행정보 결과 + + Example: + >>> df = issue_info(pdno="KR6449111CB8", prdt_type_cd="302") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권 발행정보") + result = issue_info( + pdno="KR6449111CB8", # 사용자권한정보 + prdt_type_cd="302", # 거래소코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 발행정보 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/issue_info/issue_info.py b/한국투자증권(API)/examples_llm/domestic_bond/issue_info/issue_info.py new file mode 100644 index 0000000..c338ff5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/issue_info/issue_info.py @@ -0,0 +1,121 @@ +# [장내채권] 기본시세 - 장내채권 발행정보 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 발행정보 [국내주식-156] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/issue-info" + +def issue_info( + pdno: str, # 사용자권한정보 + prdt_type_cd: str, # 거래소코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 발행정보[국내주식-156] + 장내채권 발행정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 채권 종목번호(ex. KR6449111CB8) + prdt_type_cd (str): Unique key(302) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 발행정보 데이터 + + Example: + >>> df = issue_info("KR6449111CB8", "302") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. 'KR6449111CB8')") + raise ValueError("pdno is required. (e.g. 'KR6449111CB8')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + tr_id = "CTPF1101R" + + # 요청 파라미터 설정 + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 호출 성공 여부 확인 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return issue_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/chk_order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/chk_order_rvsecncl.py new file mode 100644 index 0000000..658fc25 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/chk_order_rvsecncl.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order_rvsecncl import order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 정정취소주문 [국내주식-125] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 장내채권 정정취소주문[국내주식-125] + + 장내채권 정정취소주문 테스트 함수 + + Parameters: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + pdno (str): 상품번호 + orgn_odno (str): 원주문번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + qty_all_ord_yn (str): 잔량전부주문여부 + rvse_cncl_dvsn_cd (str): 정정취소구분코드 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + ctac_tlno (str): 연락전화번호 + + Returns: + - DataFrame: 장내채권 정정취소주문 결과 + + Example: + >>> df = main() + >>> print(df) + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 정정취소주문") + result = order_rvsecncl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="KR6095572D81", + orgn_odno="0004357900", # 실제 테스트 시 유효한 원주문번호로 변경해야 합니다. + ord_qty2="1", # 정정/취소 수량 + bond_ord_unpr="10470", # 정정 단가 + qty_all_ord_yn="Y", # 잔량 전부 주문 여부 + rvse_cncl_dvsn_cd="01", # 01: 정정, 02: 취소 + mgco_aptm_odno="", + ord_svr_dvsn_cd="0", + ctac_tlno="", + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 정정취소주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/order_rvsecncl.py new file mode 100644 index 0000000..ec0fc92 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/order_rvsecncl/order_rvsecncl.py @@ -0,0 +1,113 @@ +# [장내채권] 주문/계좌 - 장내채권 정정취소주문 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 정정취소주문 [국내주식-125] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/order-rvsecncl" + +def order_rvsecncl( + cano: str, + acnt_prdt_cd: str, + pdno: str, + orgn_odno: str, + ord_qty2: str, + bond_ord_unpr: str, + qty_all_ord_yn: str, + rvse_cncl_dvsn_cd: str, + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "0", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 정정취소주문[국내주식-125] + 장내채권 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + pdno (str): 상품번호 + orgn_odno (str): 원주문번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + qty_all_ord_yn (str): 잔량전부주문여부 + rvse_cncl_dvsn_cd (str): 정정취소구분코드 + mgco_aptm_odno (str, optional): 운용사지정주문번호. Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "0". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="KR6095572D81", + ... orgn_odno="0000015402", + ... ord_qty2="2", + ... bond_ord_unpr="10460", + ... qty_all_ord_yn="Y", + ... rvse_cncl_dvsn_cd="01" + ... ) + >>> print(df) + """ + tr_id = "TTTC0953U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "QTY_ALL_ORD_YN": qty_all_ord_yn, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/chk_search_bond_info.py b/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/chk_search_bond_info.py new file mode 100644 index 0000000..1f87b2a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/chk_search_bond_info.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from search_bond_info import search_bond_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기본조회 [국내주식-129] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'ksd_bond_item_name': '증권예탁결제원채권종목명', + 'ksd_bond_item_eng_name': '증권예탁결제원채권종목영문명', + 'ksd_bond_lstg_type_cd': '증권예탁결제원채권상장유형코드', + 'ksd_ofrg_dvsn_cd': '증권예탁결제원모집구분코드', + 'ksd_bond_int_dfrm_dvsn_cd': '증권예탁결제원채권이자지급구분', + 'issu_dt': '발행일자', + 'rdpt_dt': '상환일자', + 'rvnu_dt': '매출일자', + 'iso_crcy_cd': '통화코드', + 'mdwy_rdpt_dt': '중도상환일자', + 'ksd_rcvg_bond_dsct_rt': '증권예탁결제원수신채권할인율', + 'ksd_rcvg_bond_srfc_inrt': '증권예탁결제원수신채권표면이율', + 'bond_expd_rdpt_rt': '채권만기상환율', + 'ksd_prca_rdpt_mthd_cd': '증권예탁결제원원금상환방법코드', + 'int_caltm_mcnt': '이자계산기간개월수', + 'ksd_int_calc_unit_cd': '증권예탁결제원이자계산단위코드', + 'uval_cut_dvsn_cd': '절상절사구분코드', + 'uval_cut_dcpt_dgit': '절상절사소수점자릿수', + 'ksd_dydv_caltm_aply_dvsn_cd': '증권예탁결제원일할계산기간적용', + 'dydv_calc_dcnt': '일할계산일수', + 'bond_expd_asrc_erng_rt': '채권만기보장수익율', + 'padf_plac_hdof_name': '원리금지급장소본점명', + 'lstg_dt': '상장일자', + 'lstg_abol_dt': '상장폐지일자', + 'ksd_bond_issu_mthd_cd': '증권예탁결제원채권발행방법코드', + 'laps_indf_yn': '경과이자지급여부', + 'ksd_lhdy_pnia_dfrm_mthd_cd': '증권예탁결제원공휴일원리금지급', + 'frst_int_dfrm_dt': '최초이자지급일자', + 'ksd_prcm_lnkg_gvbd_yn': '증권예탁결제원물가연동국고채여', + 'dpsi_end_dt': '예탁종료일자', + 'dpsi_strt_dt': '예탁시작일자', + 'dpsi_psbl_yn': '예탁가능여부', + 'atyp_rdpt_bond_erlm_yn': '비정형상환채권등록여부', + 'dshn_occr_yn': '부도발생여부', + 'expd_exts_yn': '만기연장여부', + 'pclr_ptcr_text': '특이사항내용', + 'dpsi_psbl_excp_stat_cd': '예탁가능예외상태코드', + 'expd_exts_srdp_rcnt': '만기연장분할상환횟수', + 'expd_exts_srdp_rt': '만기연장분할상환율', + 'expd_rdpt_rt': '만기상환율', + 'expd_asrc_erng_rt': '만기보장수익율', + 'bond_int_dfrm_mthd_cd': '채권이자지급방법코드', + 'int_dfrm_day_type_cd': '이자지급일유형코드', + 'prca_dfmt_term_mcnt': '원금거치기간개월수', + 'splt_rdpt_rcnt': '분할상환횟수', + 'rgbf_int_dfrm_dt': '직전이자지급일자', + 'nxtm_int_dfrm_dt': '차기이자지급일자', + 'sprx_psbl_yn': '분리과세가능여부', + 'ictx_rt_dvsn_cd': '소득세율구분코드', + 'bond_clsf_cd': '채권분류코드', + 'bond_clsf_kor_name': '채권분류한글명', + 'int_mned_dvsn_cd': '이자월말구분코드', + 'pnia_int_calc_unpr': '원리금이자계산단가', + 'frn_intr': 'FRN금리', + 'aply_day_prcm_idx_lnkg_cefc': '적용일물가지수연동계수', + 'ksd_expd_dydv_calc_bass_cd': '증권예탁결제원만기일할계산기준', + 'expd_dydv_calc_dcnt': '만기일할계산일수', + 'ksd_cbbw_dvsn_cd': '증권예탁결제원신종사채구분코드', + 'crfd_item_yn': '크라우드펀딩종목여부', + 'pnia_bank_ofdy_dfrm_mthd_cd': '원리금은행휴무일지급방법코드', + 'qib_yn': 'QIB여부', + 'qib_cclc_dt': 'QIB해지일자', + 'csbd_yn': '영구채여부', + 'csbd_cclc_dt': '영구채해지일자', + 'ksd_opcb_yn': '증권예탁결제원옵션부사채여부', + 'ksd_sodn_yn': '증권예탁결제원후순위채권여부', + 'ksd_rqdi_scty_yn': '증권예탁결제원유동화증권여부', + 'elec_scty_yn': '전자증권여부', + 'rght_ecis_mbdy_dvsn_cd': '권리행사주체구분코드', + 'int_rkng_mthd_dvsn_cd': '이자산정방법구분코드', + 'ofrg_dvsn_cd': '모집구분코드', + 'ksd_tot_issu_amt': '증권예탁결제원총발행금액', + 'next_indf_chk_ecls_yn': '다음이자지급체크제외여부', + 'ksd_bond_intr_dvsn_cd': '증권예탁결제원채권금리구분코드', + 'ksd_inrt_aply_dvsn_cd': '증권예탁결제원이율적용구분코드', + 'krx_issu_istt_cd': 'KRX발행기관코드', + 'ksd_indf_frqc_uder_calc_cd': '증권예탁결제원이자지급주기미만', + 'ksd_indf_frqc_uder_calc_dcnt': '증권예탁결제원이자지급주기미만', + 'tlg_rcvg_dtl_dtime': '전문수신상세일시' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 기본시세 + 장내채권 기본조회[국내주식-129] + + 장내채권 기본조회 테스트 함수 + + Parameters: + - pdno (str): 상품번호 (상품번호) + - prdt_type_cd (str): 상품유형코드 (Unique key(302)) + Returns: + - DataFrame: 장내채권 기본조회 결과 + + Example: + >>> df = search_bond_info(pdno="", prdt_type_cd="302") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 장내채권 기본조회") + result = search_bond_info( + pdno="KR103502GA34", # 상품번호 + prdt_type_cd="302", # 상품유형코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 기본조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/search_bond_info.py b/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/search_bond_info.py new file mode 100644 index 0000000..e581c0b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/search_bond_info/search_bond_info.py @@ -0,0 +1,115 @@ +# [장내채권] 기본시세 - 장내채권 기본조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기본조회 [국내주식-129] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/quotations/search-bond-info" + +def search_bond_info( + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 기본조회[국내주식-129] + 장내채권 기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 상품번호 (필수) + prdt_type_cd (str): 상품유형코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 기본조회 데이터 + + Example: + >>> df = search_bond_info("KR2033022D33", "302") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. 'KR2033022D33')") + raise ValueError("pdno is required. (e.g. 'KR2033022D33')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1114R" + + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_bond_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/sell/chk_sell.py b/한국투자증권(API)/examples_llm/domestic_bond/sell/chk_sell.py new file mode 100644 index 0000000..33f5383 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/sell/chk_sell.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from sell import sell + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매도주문 [국내주식-123] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [장내채권] 주문/계좌 + 장내채권 매도주문[국내주식-123] + + 장내채권 매도주문 테스트 함수 + + Parameters: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + ord_dvsn (str): 주문구분 + pdno (str): 상품번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + sprx_yn (str): 분리과세여부 + buy_dt (str): 매수일자 + buy_seq (str): 매수순번 + samt_mket_ptci_yn (str): 소액시장참여여부 + sll_agco_opps_sll_yn (str): 매도대행사반대매도여부 + bond_rtl_mket_yn (str): 채권소매시장여부 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + ctac_tlno (str): 연락전화번호 + + Returns: + - DataFrame: 장내채권 매도주문 결과 + + Example: + >>> df = main() + >>> print(df) + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 장내채권 매도주문") + result = sell( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ord_dvsn="01", # 주문구분 + pdno="KR6095572D81", # 상품번호 + ord_qty2="1", # 주문수량 + bond_ord_unpr="10000.0", # 채권주문단가 + sprx_yn="N", # 분리과세여부 + buy_dt="", # 매수일자 + buy_seq="", # 매수순번 + samt_mket_ptci_yn="N", # 소액시장참여여부 + sll_agco_opps_sll_yn="N", # 매도대행사반대매도여부 + bond_rtl_mket_yn="N", # 채권소매시장여부 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ctac_tlno="", # 연락전화번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 장내채권 매도주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_bond/sell/sell.py b/한국투자증권(API)/examples_llm/domestic_bond/sell/sell.py new file mode 100644 index 0000000..a4cc069 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_bond/sell/sell.py @@ -0,0 +1,127 @@ +# [장내채권] 주문/계좌 - 장내채권 매도주문 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매도주문 [국내주식-123] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-bond/v1/trading/sell" + +def sell( + cano: str, + acnt_prdt_cd: str, + ord_dvsn: str, + pdno: str, + ord_qty2: str, + bond_ord_unpr: str, + sprx_yn: str, + samt_mket_ptci_yn: str, + sll_agco_opps_sll_yn: str, + bond_rtl_mket_yn: str, + buy_dt: str = "", + buy_seq: str = "", + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "0", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매도주문[국내주식-123] + 장내채권 매도주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + ord_dvsn (str): 주문구분 + pdno (str): 상품번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + sprx_yn (str): 분리과세여부 + samt_mket_ptci_yn (str): 소액시장참여여부 + sll_agco_opps_sll_yn (str): 매도대행사반대매도여부 + bond_rtl_mket_yn (str): 채권소매시장여부 + buy_dt (str, optional): 매수일자. Defaults to "". + buy_seq (str, optional): 매수순번. Defaults to "". + mgco_aptm_odno (str, optional): 운용사지정주문번호. Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "0". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 매도주문 데이터 + + Example: + >>> df = sell( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ord_dvsn="01", + ... pdno="KR6095572D81", + ... ord_qty2="1", + ... bond_ord_unpr="10000.0", + ... sprx_yn="N", + ... samt_mket_ptci_yn="N", + ... sll_agco_opps_sll_yn="N", + ... bond_rtl_mket_yn="N" + ... ) + >>> print(df) + """ + tr_id = "TTTC0958U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORD_DVSN": ord_dvsn, + "PDNO": pdno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "SPRX_YN": sprx_yn, + "BUY_DT": buy_dt, + "BUY_SEQ": buy_seq, + "SAMT_MKET_PTCI_YN": samt_mket_ptci_yn, + "SLL_AGCO_OPPS_SLL_YN": sll_agco_opps_sll_yn, + "BOND_RTL_MKET_YN": bond_rtl_mket_yn, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/chk_commodity_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/chk_commodity_futures_realtime_conclusion.py new file mode 100644 index 0000000..329b19b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/chk_commodity_futures_realtime_conclusion.py @@ -0,0 +1,116 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +from commodity_futures_realtime_conclusion import commodity_futures_realtime_conclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간체결가[실시간-022] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_prdy_vrss": "선물 전일 대비", + "prdy_vrss_sign": "전일 대비 부호", + "futs_prdy_ctrt": "선물 전일 대비율", + "futs_prpr": "선물 현재가", + "futs_oprc": "선물 시가2", + "futs_hgpr": "선물 최고가", + "futs_lwpr": "선물 최저가", + "last_cnqn": "최종 거래량", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "hts_thpr": "HTS 이론가", + "mrkt_basis": "시장 베이시스", + "dprt": "괴리율", + "nmsc_fctn_stpl_prc": "근월물 약정가", + "fmsc_fctn_stpl_prc": "원월물 약정가", + "spead_prc": "스프레드1", + "hts_otst_stpl_qty": "HTS 미결제 약정 수량", + "otst_stpl_qty_icdc": "미결제 약정 수량 증감", + "oprc_hour": "시가 시간", + "oprc_vrss_prpr_sign": "시가2 대비 현재가 부호", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "hgpr_hour": "최고가 시간", + "hgpr_vrss_prpr_sign": "최고가 대비 현재가 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "lwpr_hour": "최저가 시간", + "lwpr_vrss_prpr_sign": "최저가 대비 현재가 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "shnu_rate": "매수2 비율", + "cttr": "체결강도", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제 약정 직전 수량 증감", + "thpr_basis": "이론 베이시스", + "futs_askp1": "선물 매도호가1", + "futs_bidp1": "선물 매수호가1", + "askp_rsqn1": "매도호가 잔량1", + "bidp_rsqn1": "매수호가 잔량1", + "seln_cntg_csnu": "매도 체결 건수", + "shnu_cntg_csnu": "매수 체결 건수", + "ntby_cntg_csnu": "순매수 체결 건수", + "seln_cntg_smtn": "총 매도 수량", + "shnu_cntg_smtn": "총 매수 수량", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "prdy_vol_vrss_acml_vol_rate": "전일 거래량 대비 등락율", + "dscs_bltr_acml_qty": "협의 대량 거래량", + "dynm_mxpr": "실시간상한가", + "dynm_llam": "실시간하한가", + "dynm_prc_limt_yn": "실시간가격제한구분" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 상품선물 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=commodity_futures_realtime_conclusion, data=["165W09"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/commodity_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/commodity_futures_realtime_conclusion.py new file mode 100644 index 0000000..d9dcdcc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_conclusion/commodity_futures_realtime_conclusion.py @@ -0,0 +1,108 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간체결가[실시간-022] +############################################################################################## + +def commodity_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 상품선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 상품선물의 실시간 체결가 정보를 수신할 수 있습니다. + 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = commodity_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is empty") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0CFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dscs_bltr_acml_qty", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/chk_commodity_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/chk_commodity_futures_realtime_quote.py new file mode 100644 index 0000000..4fdc63e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/chk_commodity_futures_realtime_quote.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +from commodity_futures_realtime_quote import commodity_futures_realtime_quote + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간호가[실시간-023] +############################################################################################## +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_askp1": "선물 매도호가1", + "futs_askp2": "선물 매도호가2", + "futs_askp3": "선물 매도호가3", + "futs_askp4": "선물 매도호가4", + "futs_askp5": "선물 매도호가5", + "futs_bidp1": "선물 매수호가1", + "futs_bidp2": "선물 매수호가2", + "futs_bidp3": "선물 매수호가3", + "futs_bidp4": "선물 매수호가4", + "futs_bidp5": "선물 매수호가5", + "askp_csnu1": "매도호가 건수1", + "askp_csnu2": "매도호가 건수2", + "askp_csnu3": "매도호가 건수3", + "askp_csnu4": "매도호가 건수4", + "askp_csnu5": "매도호가 건수5", + "bidp_csnu1": "매수호가 건수1", + "bidp_csnu2": "매수호가 건수2", + "bidp_csnu3": "매수호가 건수3", + "bidp_csnu4": "매수호가 건수4", + "bidp_csnu5": "매수호가 건수5", + "askp_rsqn1": "매도호가 잔량1", + "askp_rsqn2": "매도호가 잔량2", + "askp_rsqn3": "매도호가 잔량3", + "askp_rsqn4": "매도호가 잔량4", + "askp_rsqn5": "매도호가 잔량5", + "bidp_rsqn1": "매수호가 잔량1", + "bidp_rsqn2": "매수호가 잔량2", + "bidp_rsqn3": "매수호가 잔량3", + "bidp_rsqn4": "매수호가 잔량4", + "bidp_rsqn5": "매수호가 잔량5", + "total_askp_csnu": "총 매도호가 건수", + "total_bidp_csnu": "총 매수호가 건수", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "total_askp_rsqn_icdc": "총 매도호가 잔량 증감", + "total_bidp_rsqn_icdc": "총 매수호가 잔량 증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 상품선물 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=commodity_futures_realtime_quote, data=["165W09"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/commodity_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/commodity_futures_realtime_quote.py new file mode 100644 index 0000000..b5228dc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/commodity_futures_realtime_quote/commodity_futures_realtime_quote.py @@ -0,0 +1,96 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간호가[실시간-023] +############################################################################################## + +def commodity_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 상품선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 상품선물 매도/매수 호가 정보를 실시간으로 수신할 수 있습니다. + 실전계좌만 지원되며, 모의투자는 지원하지 않습니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = commodity_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0CFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/chk_display_board_callput.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/chk_display_board_callput.py new file mode 100644 index 0000000..f393a22 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/chk_display_board_callput.py @@ -0,0 +1,130 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from display_board_callput import display_board_callput + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_콜풋[국내선물-022] +############################################################################################## + +# 컬럼명 한글 변환 및 데이터 출력 +COLUMN_MAPPING = { + 'acpr': '행사가', + 'unch_prpr': '환산 현재가', + 'optn_shrn_iscd': '옵션 단축 종목코드', + 'optn_prpr': '옵션 현재가', + 'optn_prdy_vrss': '옵션 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'optn_prdy_ctrt': '옵션 전일 대비율', + 'optn_bidp': '옵션 매수호가', + 'optn_askp': '옵션 매도호가', + 'tmvl_val': '시간가치 값', + 'nmix_sdpr': '지수 기준가', + 'acml_vol': '누적 거래량', + 'seln_rsqn': '매도 잔량', + 'shnu_rsqn': '매수2 잔량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_otst_stpl_qty': 'HTS 미결제 약정 수량', + 'otst_stpl_qty_icdc': '미결제 약정 수량 증감', + 'delta_val': '델타 값', + 'gama': '감마', + 'vega': '베가', + 'theta': '세타', + 'rho': '로우', + 'hts_ints_vltl': 'HTS 내재 변동성', + 'invl_val': '내재가치 값', + 'esdg': '괴리도', + 'dprt': '괴리율', + 'hist_vltl': '역사적 변동성', + 'hts_thpr': 'HTS 이론가', + 'optn_oprc': '옵션 시가2', + 'optn_hgpr': '옵션 최고가', + 'optn_lwpr': '옵션 최저가', + 'optn_mxpr': '옵션 상한가', + 'optn_llam': '옵션 하한가', + 'atm_cls_name': 'ATM 구분 명', + 'rgbf_vrss_icdc': '직전 대비 증감', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'futs_antc_cnpr': '선물예상체결가', + 'futs_antc_cntg_vrss': '선물예상체결대비', + 'antc_cntg_vrss_sign': '예상 체결 대비 부호', + 'antc_cntg_prdy_ctrt': '예상 체결 전일 대비율', +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내옵션전광판_콜풋 조회 테스트 함수 + + 이 함수는 국내옵션전광판_콜풋 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # Case1 테스트 + logging.info("=== Case1 테스트 ===") + try: + result1, result2 = display_board_callput( + fid_cond_mrkt_div_code="O", + fid_cond_scr_div_code="20503", + fid_mrkt_cls_code="CO", + fid_mtrt_cnt="202508", + fid_mrkt_cls_code1="PO" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # Output1 처리 + logging.info("=== Output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # Output2 처리 + logging.info("=== Output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형 없음) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/display_board_callput.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/display_board_callput.py new file mode 100644 index 0000000..0c834fe --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_callput/display_board_callput.py @@ -0,0 +1,91 @@ +""" +Created on 20250601 +""" + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_콜풋[국내선물-022] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/display-board-callput" + +def display_board_callput( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. O: 옵션) + fid_cond_scr_div_code: str, # [필수] 조건 화면 분류 코드 (ex. 20503) + fid_mrkt_cls_code: str, # [필수] 시장 구분 코드 (ex. CO: 콜옵션) + fid_mtrt_cnt: str, # [필수] 만기 수 (ex. 202508) + fid_mrkt_cls_code1: str, # [필수] 시장 구분 코드 (ex. PO: 풋옵션) + fid_cond_mrkt_cls_code: str = "" # 조건 시장 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내옵션전광판_콜풋 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "중앙" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ output1, output2 각각 100건까지만 확인이 가능합니다. (FY25년도 서비스 개선 예정) + ※ 조회시간이 긴 API인 점 참고 부탁드리며, 잦은 호출을 삼가해주시기 바랍니다. (1초당 최대 1건 권장) + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. O: 옵션) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 20503) + fid_mrkt_cls_code (str): [필수] 시장 구분 코드 (ex. CO: 콜옵션) + fid_mtrt_cnt (str): [필수] 만기 수 (ex. 202508) + fid_mrkt_cls_code1 (str): [필수] 시장 구분 코드 (ex. PO: 풋옵션) + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 DataFrame, output2 DataFrame) + + Example: + >>> df1, df2 = display_board_callput("O", "20503", "CO", "202508", "PO") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'O')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20503')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'CO')") + + if fid_mtrt_cnt == "": + raise ValueError("fid_mtrt_cnt is required (e.g. '202508')") + + if fid_mrkt_cls_code1 == "": + raise ValueError("fid_mrkt_cls_code1 is required (e.g. 'PO')") + + tr_id = "FHPIF05030100" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_MTRT_CNT": fid_mtrt_cnt, + "FID_MRKT_CLS_CODE1": fid_mrkt_cls_code1, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output1_df = pd.DataFrame(res.getBody().output1) + output2_df = pd.DataFrame(res.getBody().output2) + return output1_df, output2_df + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/chk_display_board_futures.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/chk_display_board_futures.py new file mode 100644 index 0000000..921003d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/chk_display_board_futures.py @@ -0,0 +1,91 @@ +""" +Created on 20250112 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from display_board_futures import display_board_futures + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_선물[국내선물-023] +############################################################################################## + +COLUMN_MAPPING = { + 'futs_shrn_iscd': '선물 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '선물 현재가', + 'futs_prdy_vrss': '선물 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'hts_thpr': 'HTS 이론가', + 'acml_vol': '누적 거래량', + 'futs_askp': '선물 매도호가', + 'futs_bidp': '선물 매수호가', + 'hts_otst_stpl_qty': 'HTS 미결제 약정 수량', + 'futs_hgpr': '선물 최고가', + 'futs_lwpr': '선물 최저가', + 'hts_rmnn_dynu': 'HTS 잔존 일수', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'futs_antc_cnpr': '선물예상체결가', + 'futs_antc_cntg_vrss': '선물예상체결대비', + 'antc_cntg_vrss_sign': '예상 체결 대비 부호', + 'antc_cntg_prdy_ctrt': '예상 체결 전일 대비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내선물옵션 선물전광판 조회 테스트 함수 + + 이 함수는 국내선물옵션 선물전광판 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result = display_board_futures( + fid_cond_mrkt_div_code="F", + fid_cond_scr_div_code="20503", + fid_cond_mrkt_cls_code="MKI" + ) + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 표시 (메타데이터에 number 자료형이 명시된 컬럼 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/display_board_futures.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/display_board_futures.py new file mode 100644 index 0000000..2cba9d5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_futures/display_board_futures.py @@ -0,0 +1,69 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_선물[국내선물-023] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/display-board-futures" + +def display_board_futures( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_cond_mrkt_cls_code: str # 조건 시장 구분 코드 +) -> pd.DataFrame: + """ + 국내옵션전광판_선물 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "하단" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 20503) + fid_cond_mrkt_cls_code (str): [필수] 조건 시장 구분 코드 (ex. MKI) + + Returns: + pd.DataFrame: 국내선물옵션 선물전광판 데이터 + + Example: + >>> df = display_board_futures("F", "20503", "MKI") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20503')") + + if fid_cond_mrkt_cls_code == "": + raise ValueError("fid_cond_mrkt_cls_code is required (e.g. 'MKI')") + + tr_id = "FHPIF05030200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/chk_display_board_option_list.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/chk_display_board_option_list.py new file mode 100644 index 0000000..48ece2e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/chk_display_board_option_list.py @@ -0,0 +1,71 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from display_board_option_list import display_board_option_list + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_옵션월물리스트[국내선물-020] +############################################################################################## + +COLUMN_MAPPING = { + 'mtrt_yymm_code': '만기 년월 코드', + 'mtrt_yymm': '만기 년월' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내옵션전광판_옵션월물리스트 조회 테스트 함수 + + 이 함수는 국내옵션전광판_옵션월물리스트 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = display_board_option_list(fid_cond_scr_div_code="509") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드가 없음) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/display_board_option_list.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/display_board_option_list.py new file mode 100644 index 0000000..a4068c2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_option_list/display_board_option_list.py @@ -0,0 +1,63 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_옵션월물리스트[국내선물-020] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/display-board-option-list" + +def display_board_option_list( + fid_cond_scr_div_code: str, + fid_cond_mrkt_div_code: str = "", + fid_cond_mrkt_cls_code: str = "" +) -> pd.DataFrame: + """ + 국내옵션전광판_옵션월물리스트 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "월물리스트 목록 확인" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 509) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + pd.DataFrame: 국내옵션전광판_옵션월물리스트 데이터 + + Example: + >>> df = display_board_option_list(fid_cond_scr_div_code="509") + >>> print(df) + """ + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '509')") + + tr_id = "FHPIO056104C0" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/chk_display_board_top.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/chk_display_board_top.py new file mode 100644 index 0000000..115d832 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/chk_display_board_top.py @@ -0,0 +1,96 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from display_board_top import display_board_top + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내선물 기초자산 시세[국내선물-021] +############################################################################################## + +COLUMN_MAPPING = { + 'unas_prpr': '기초자산 현재가', + 'unas_prdy_vrss': '기초자산 전일 대비', + 'unas_prdy_vrss_sign': '기초자산 전일 대비 부호', + 'unas_prdy_ctrt': '기초자산 전일 대비율', + 'unas_acml_vol': '기초자산 누적 거래량', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '선물 현재가', + 'futs_prdy_vrss': '선물 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'hts_rmnn_dynu': 'HTS 잔존 일수' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내선물 기초자산 시세 조회 테스트 함수 + + 이 함수는 국내선물 기초자산 시세 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + logging.info("=== 국내선물 기초자산 시세 조회 ===") + try: + output1, output2 = display_board_top(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", output1.columns.tolist()) + + # 컬럼명 한글 변환 + + output1 = output1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in output1.columns: + output1[col] = pd.to_numeric(output1[col], errors='coerce').round(2) + + logging.info("결과:") + print(output1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", output2.columns.tolist()) + + # 컬럼명 한글 변환 + output2 = output2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output2.columns: + output2[col] = pd.to_numeric(output2[col], errors='coerce').round(2) + + logging.info("결과:") + print(output2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/display_board_top.py b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/display_board_top.py new file mode 100644 index 0000000..b9aaf77 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/display_board_top/display_board_top.py @@ -0,0 +1,79 @@ +""" +Created on 20250601 +""" + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내선물 기초자산 시세[국내선물-021] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/display-board-top" + +def display_board_top( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. F) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code1: str = "", # 조건 시장 분류 코드 + fid_cond_scr_div_code: str = "", # 조건 화면 분류 코드 + fid_mtrt_cnt: str = "", # 만기 수 + fid_cond_mrkt_cls_code: str = "" # 조건 시장 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내선물 기초자산 시세 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "상단 바" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code1 (str): 조건 시장 분류 코드 + fid_cond_scr_div_code (str): 조건 화면 분류 코드 + fid_mtrt_cnt (str): 만기 수 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> output1, output2 = display_board_top(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09") + >>> print(output1) + >>> print(output2) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + tr_id = "FHPIF05030000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE1": fid_cond_mrkt_div_code1, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MTRT_CNT": fid_mtrt_cnt, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output1 = pd.DataFrame(res.getBody().output1, index=[0]) + output2 = pd.DataFrame(res.getBody().output2) + + return output1, output2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/chk_exp_price_trend.py b/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/chk_exp_price_trend.py new file mode 100644 index 0000000..4bcfbd4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/chk_exp_price_trend.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_price_trend import exp_price_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 일중예상체결추이[국내선물-018] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': '영업 시간', + 'futs_antc_cnpr': '업종 지수 현재가', + 'antc_cntg_vrss_sign': '업종 지수 전일 대비', + 'futs_antc_cntg_vrss': '전일 대비 부호', + 'antc_cntg_prdy_ctrt': '업종 지수 전일 대비율', + 'futs_sdpr': '누적 거래 대금', + 'stck_cntg_hour': '주식체결시간', + 'futs_antc_cnpr': '선물예상체결가', + 'antc_cntg_vrss_sign': '예상체결대비부호', + 'futs_antc_cntg_vrss': '선물예상체결대비', + 'antc_cntg_prdy_ctrt': '예상체결전일대비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 일중예상체결추이 조회 테스트 함수 + + 이 함수는 선물옵션 일중예상체결추이 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = exp_price_trend(fid_input_iscd="101W09", fid_cond_mrkt_div_code="F") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("사용 가능한 컬럼 (output1): %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 (output1) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (output1) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과 (output1):") + print(result1) + + # output2 결과 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 (output2) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (output2) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과 (output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/exp_price_trend.py b/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/exp_price_trend.py new file mode 100644 index 0000000..a2be8ad --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/exp_price_trend/exp_price_trend.py @@ -0,0 +1,70 @@ +""" +Created on 20250601 +""" + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 일중예상체결추이[국내선물-018] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/exp-price-trend" + +def exp_price_trend( + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code: str # [필수] 조건 시장 분류 코드 (ex. F) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 일중예상체결추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0548] 선물옵션 예상체결추이 화면의 기능을 API로 개발한 사항입니다. + + Args: + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = exp_price_trend(fid_input_iscd="101W09", fid_cond_mrkt_div_code="F") + >>> print(df1) + >>> print(df2) + """ + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + tr_id = "FHPIF05110100" # 선물옵션 일중예상체결추이 + + params = { + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code # 조건 시장 분류 코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1은 object 타입이므로 단일 행 DataFrame + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2는 array 타입이므로 여러 행 DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/chk_fuopt_ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/chk_fuopt_ccnl_notice.py new file mode 100644 index 0000000..f2a4bd6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/chk_fuopt_ccnl_notice.py @@ -0,0 +1,89 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +from fuopt_ccnl_notice import fuopt_ccnl_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 선물옵션 실시간체결통보[실시간-012] +############################################################################################## + +COLUMN_MAPPING = { + "cust_id": "고객 ID", + "acnt_no": "계좌번호", + "oder_no": "주문번호", + "ooder_no": "원주문번호", + "seln_byov_cls": "매도매수구분", + "rctf_cls": "정정구분", + "oder_kind2": "주문종류2", + "stck_shrn_iscd": "주식 단축 종목코드", + "cntg_qty": "체결 수량", + "cntg_unpr": "체결단가", + "stck_cntg_hour": "주식 체결 시간", + "rfus_yn": "거부여부", + "cntg_yn": "체결여부", + "acpt_yn": "접수여부", + "brnc_no": "지점번호", + "oder_qty": "주문수량", + "acnt_name": "계좌명", + "cntg_isnm": "체결종목명", + "oder_cond": "주문조건", + "ord_grp": "주문그룹ID", + "ord_grpseq": "주문그룹SEQ", + "order_prc": "주문가격" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 실시간체결통보 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=fuopt_ccnl_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/fuopt_ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/fuopt_ccnl_notice.py new file mode 100644 index 0000000..3022a19 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/fuopt_ccnl_notice/fuopt_ccnl_notice.py @@ -0,0 +1,81 @@ +""" +Created on 20250601 +""" + +import logging +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 선물옵션 실시간체결통보[실시간-012] +############################################################################################## + +def fuopt_ccnl_notice( + tr_type: str, + tr_key: str, +): + """ + 선물옵션 실시간체결통보 API입니다. + 실시간 웹소켓 연결을 통해 선물옵션 거래의 실시간 체결 통보를 수신할 수 있습니다. + 주문접수, 체결, 정정, 취소 등의 거래 상태 변화를 실시간으로 통보받을 수 있습니다. + 고객ID, 계좌번호, 주문번호, 체결수량, 체결단가 등의 상세 거래 정보를 포함합니다. + 실전계좌와 모의투자 모두 지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. dttest11) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = fuopt_ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond", + "ord_grp", + "ord_grpseq", + "order_prc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/chk_futures_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/chk_futures_exp_ccnl.py new file mode 100644 index 0000000..c5df2a9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/chk_futures_exp_ccnl.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from futures_exp_ccnl import futures_exp_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물단축종목코드", + "bsop_hour": "영업시간", + "antc_cnpr": "예상체결가", + "antc_cntg_vrss": "예상체결대비", + "antc_cntg_vrss_sign": "예상체결대비부호", + "antc_cntg_prdy_ctrt": "예상체결전일대비율", + "antc_mkop_cls_code": "예상장운영구분코드", + "antc_cnqn": "예상체결수량" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=futures_exp_ccnl, data=["111W07"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/futures_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/futures_exp_ccnl.py new file mode 100644 index 0000000..8ab85da --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/futures_exp_ccnl/futures_exp_ccnl.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] +############################################################################################## + +def futures_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = futures_exp_ccnl("1", "111W07") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code", + "antc_cnqn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/chk_index_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/chk_index_futures_realtime_conclusion.py new file mode 100644 index 0000000..a3622a3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/chk_index_futures_realtime_conclusion.py @@ -0,0 +1,116 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_futures_realtime_conclusion import index_futures_realtime_conclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간체결가[실시간-010] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_prdy_vrss": "선물 전일 대비", + "prdy_vrss_sign": "전일 대비 부호", + "futs_prdy_ctrt": "선물 전일 대비율", + "futs_prpr": "선물 현재가", + "futs_oprc": "선물 시가2", + "futs_hgpr": "선물 최고가", + "futs_lwpr": "선물 최저가", + "last_cnqn": "최종 거래량", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "hts_thpr": "HTS 이론가", + "mrkt_basis": "시장 베이시스", + "dprt": "괴리율", + "nmsc_fctn_stpl_prc": "근월물 약정가", + "fmsc_fctn_stpl_prc": "원월물 약정가", + "spead_prc": "스프레드1", + "hts_otst_stpl_qty": "HTS 미결제 약정 수량", + "otst_stpl_qty_icdc": "미결제 약정 수량 증감", + "oprc_hour": "시가 시간", + "oprc_vrss_prpr_sign": "시가2 대비 현재가 부호", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "hgpr_hour": "최고가 시간", + "hgpr_vrss_prpr_sign": "최고가 대비 현재가 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "lwpr_hour": "최저가 시간", + "lwpr_vrss_prpr_sign": "최저가 대비 현재가 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "shnu_rate": "매수2 비율", + "cttr": "체결강도", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제 약정 직전 수량 증감", + "thpr_basis": "이론 베이시스", + "futs_askp1": "선물 매도호가1", + "futs_bidp1": "선물 매수호가1", + "askp_rsqn1": "매도호가 잔량1", + "bidp_rsqn1": "매수호가 잔량1", + "seln_cntg_csnu": "매도 체결 건수", + "shnu_cntg_csnu": "매수 체결 건수", + "ntby_cntg_csnu": "순매수 체결 건수", + "seln_cntg_smtn": "총 매도 수량", + "shnu_cntg_smtn": "총 매수 수량", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "prdy_vol_vrss_acml_vol_rate": "전일 거래량 대비 등락율", + "dscs_bltr_acml_qty": "협의 대량 거래량", + "dynm_mxpr": "실시간상한가", + "dynm_llam": "실시간하한가", + "dynm_prc_limt_yn": "실시간가격제한구분" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 지수선물 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_futures_realtime_conclusion, data=["101W09"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/index_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/index_futures_realtime_conclusion.py new file mode 100644 index 0000000..5c57688 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_conclusion/index_futures_realtime_conclusion.py @@ -0,0 +1,109 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간체결가[실시간-010] +############################################################################################## + +def index_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 지수선물의 실시간 체결가 정보를 수신할 수 있습니다. + 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dscs_bltr_acml_qty", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/chk_index_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/chk_index_futures_realtime_quote.py new file mode 100644 index 0000000..8a0d90a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/chk_index_futures_realtime_quote.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_futures_realtime_quote import index_futures_realtime_quote + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간호가[실시간-011] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_askp1": "선물 매도호가1", + "futs_askp2": "선물 매도호가2", + "futs_askp3": "선물 매도호가3", + "futs_askp4": "선물 매도호가4", + "futs_askp5": "선물 매도호가5", + "futs_bidp1": "선물 매수호가1", + "futs_bidp2": "선물 매수호가2", + "futs_bidp3": "선물 매수호가3", + "futs_bidp4": "선물 매수호가4", + "futs_bidp5": "선물 매수호가5", + "askp_csnu1": "매도호가 건수1", + "askp_csnu2": "매도호가 건수2", + "askp_csnu3": "매도호가 건수3", + "askp_csnu4": "매도호가 건수4", + "askp_csnu5": "매도호가 건수5", + "bidp_csnu1": "매수호가 건수1", + "bidp_csnu2": "매수호가 건수2", + "bidp_csnu3": "매수호가 건수3", + "bidp_csnu4": "매수호가 건수4", + "bidp_csnu5": "매수호가 건수5", + "askp_rsqn1": "매도호가 잔량1", + "askp_rsqn2": "매도호가 잔량2", + "askp_rsqn3": "매도호가 잔량3", + "askp_rsqn4": "매도호가 잔량4", + "askp_rsqn5": "매도호가 잔량5", + "bidp_rsqn1": "매수호가 잔량1", + "bidp_rsqn2": "매수호가 잔량2", + "bidp_rsqn3": "매수호가 잔량3", + "bidp_rsqn4": "매수호가 잔량4", + "bidp_rsqn5": "매수호가 잔량5", + "total_askp_csnu": "총 매도호가 건수", + "total_bidp_csnu": "총 매수호가 건수", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "total_askp_rsqn_icdc": "총 매도호가 잔량 증감", + "total_bidp_rsqn_icdc": "총 매수호가 잔량 증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 지수선물 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_futures_realtime_quote, data=["101W09"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/index_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/index_futures_realtime_quote.py new file mode 100644 index 0000000..500838c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_futures_realtime_quote/index_futures_realtime_quote.py @@ -0,0 +1,97 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간호가[실시간-011] +############################################################################################## + +def index_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 지수선물의 실시간 호가 정보를 수신할 수 있습니다. + 매도/매수 호가 1~5단계, 호가 건수, 호가 잔량 등의 상세 정보를 제공합니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/chk_index_option_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/chk_index_option_realtime_conclusion.py new file mode 100644 index 0000000..f97966d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/chk_index_option_realtime_conclusion.py @@ -0,0 +1,124 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_option_realtime_conclusion import index_option_realtime_conclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간체결가[실시간-014] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션 단축 종목코드", + "bsop_hour": "영업 시간", + "optn_prpr": "옵션 현재가", + "prdy_vrss_sign": "전일 대비 부호", + "optn_prdy_vrss": "옵션 전일 대비", + "prdy_ctrt": "전일 대비율", + "optn_oprc": "옵션 시가2", + "optn_hgpr": "옵션 최고가", + "optn_lwpr": "옵션 최저가", + "last_cnqn": "최종 거래량", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "hts_thpr": "HTS 이론가", + "hts_otst_stpl_qty": "HTS 미결제 약정 수량", + "otst_stpl_qty_icdc": "미결제 약정 수량 증감", + "oprc_hour": "시가 시간", + "oprc_vrss_prpr_sign": "시가2 대비 현재가 부호", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "hgpr_hour": "최고가 시간", + "hgpr_vrss_prpr_sign": "최고가 대비 현재가 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "lwpr_hour": "최저가 시간", + "lwpr_vrss_prpr_sign": "최저가 대비 현재가 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "shnu_rate": "매수2 비율", + "prmm_val": "프리미엄 값", + "invl_val": "내재가치 값", + "tmvl_val": "시간가치 값", + "delta": "델타", + "gama": "감마", + "vega": "베가", + "theta": "세타", + "rho": "로우", + "hts_ints_vltl": "HTS 내재 변동성", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제 약정 직전 수량 증감", + "thpr_basis": "이론 베이시스", + "unas_hist_vltl": "역사적변동성", + "cttr": "체결강도", + "dprt": "괴리율", + "mrkt_basis": "시장 베이시스", + "optn_askp1": "옵션 매도호가1", + "optn_bidp1": "옵션 매수호가1", + "askp_rsqn1": "매도호가 잔량1", + "bidp_rsqn1": "매수호가 잔량1", + "seln_cntg_csnu": "매도 체결 건수", + "shnu_cntg_csnu": "매수 체결 건수", + "ntby_cntg_csnu": "순매수 체결 건수", + "seln_cntg_smtn": "총 매도 수량", + "shnu_cntg_smtn": "총 매수 수량", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "prdy_vol_vrss_acml_vol_rate": "전일 거래량 대비 등락율", + "avrg_vltl": "평균 변동성", + "dscs_lrqn_vol": "협의대량누적 거래량", + "dynm_mxpr": "실시간상한가", + "dynm_llam": "실시간하한가", + "dynm_prc_limt_yn": "실시간가격제한구분" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 지수옵션 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_option_realtime_conclusion, data=["201W08427"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/index_option_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/index_option_realtime_conclusion.py new file mode 100644 index 0000000..86f0109 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_conclusion/index_option_realtime_conclusion.py @@ -0,0 +1,121 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간체결가[실시간-014] +############################################################################################## + +def index_option_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수옵션 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 지수옵션의 실시간 체결가 정보를 수신할 수 있습니다. + 옵션 현재가, 시고저가, 체결량, 누적거래량, 이론가 등의 기본 정보와 함께 + 델타, 감마, 베가, 세타, 로우 등의 그리스 지표와 내재가치, 시간가치, 변동성 정보를 제공합니다. + 옵션 거래에 필수적인 전문 지표들을 포함하는 확장된 체결가 정보입니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 201S11305) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_option_realtime_conclusion("1", "101W09") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IOCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "avrg_vltl", + "dscs_lrqn_vol", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/chk_index_option_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/chk_index_option_realtime_quote.py new file mode 100644 index 0000000..e454497 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/chk_index_option_realtime_quote.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_option_realtime_quote import index_option_realtime_quote + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간호가[실시간-015] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션 단축 종목코드", + "bsop_hour": "영업 시간", + "optn_askp1": "옵션 매도호가1", + "optn_askp2": "옵션 매도호가2", + "optn_askp3": "옵션 매도호가3", + "optn_askp4": "옵션 매도호가4", + "optn_askp5": "옵션 매도호가5", + "optn_bidp1": "옵션 매수호가1", + "optn_bidp2": "옵션 매수호가2", + "optn_bidp3": "옵션 매수호가3", + "optn_bidp4": "옵션 매수호가4", + "optn_bidp5": "옵션 매수호가5", + "askp_csnu1": "매도호가 건수1", + "askp_csnu2": "매도호가 건수2", + "askp_csnu3": "매도호가 건수3", + "askp_csnu4": "매도호가 건수4", + "askp_csnu5": "매도호가 건수5", + "bidp_csnu1": "매수호가 건수1", + "bidp_csnu2": "매수호가 건수2", + "bidp_csnu3": "매수호가 건수3", + "bidp_csnu4": "매수호가 건수4", + "bidp_csnu5": "매수호가 건수5", + "askp_rsqn1": "매도호가 잔량1", + "askp_rsqn2": "매도호가 잔량2", + "askp_rsqn3": "매도호가 잔량3", + "askp_rsqn4": "매도호가 잔량4", + "askp_rsqn5": "매도호가 잔량5", + "bidp_rsqn1": "매수호가 잔량1", + "bidp_rsqn2": "매수호가 잔량2", + "bidp_rsqn3": "매수호가 잔량3", + "bidp_rsqn4": "매수호가 잔량4", + "bidp_rsqn5": "매수호가 잔량5", + "total_askp_csnu": "총 매도호가 건수", + "total_bidp_csnu": "총 매수호가 건수", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "total_askp_rsqn_icdc": "총 매도호가 잔량 증감", + "total_bidp_rsqn_icdc": "총 매수호가 잔량 증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 지수옵션 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_option_realtime_quote, data=["201W08427"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/index_option_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/index_option_realtime_quote.py new file mode 100644 index 0000000..25edcfd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/index_option_realtime_quote/index_option_realtime_quote.py @@ -0,0 +1,95 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간호가[실시간-015] +############################################################################################## + +def index_option_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수옵션 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 지수옵션 매도/매수 호가 정보를 실시간으로 수신할 수 있습니다. + 실전계좌만 지원되며, 모의투자는 지원하지 않습니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 201S11305) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_option_realtime_quote("1", "201S11305") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IOASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/chk_inquire_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/chk_inquire_asking_price.py new file mode 100644 index 0000000..fc9d662 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/chk_inquire_asking_price.py @@ -0,0 +1,129 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_asking_price import inquire_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세호가[v1_국내선물-007] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '선물 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_vrss': '선물 전일 대비', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'acml_vol': '누적 거래량', + 'futs_prdy_clpr': '선물 전일 종가', + 'futs_shrn_iscd': '선물 단축 종목코드', + 'futs_askp1': '선물 매도호가1', + 'futs_askp2': '선물 매도호가2', + 'futs_askp3': '선물 매도호가3', + 'futs_askp4': '선물 매도호가4', + 'futs_askp5': '선물 매도호가5', + 'futs_bidp1': '선물 매수호가1', + 'futs_bidp2': '선물 매수호가2', + 'futs_bidp3': '선물 매수호가3', + 'futs_bidp4': '선물 매수호가4', + 'futs_bidp5': '선물 매수호가5', + 'askp_rsqn1': '매도호가 잔량1', + 'askp_rsqn2': '매도호가 잔량2', + 'askp_rsqn3': '매도호가 잔량3', + 'askp_rsqn4': '매도호가 잔량4', + 'askp_rsqn5': '매도호가 잔량5', + 'bidp_rsqn1': '매수호가 잔량1', + 'bidp_rsqn2': '매수호가 잔량2', + 'bidp_rsqn3': '매수호가 잔량3', + 'bidp_rsqn4': '매수호가 잔량4', + 'bidp_rsqn5': '매수호가 잔량5', + 'askp_csnu1': '매도호가 건수1', + 'askp_csnu2': '매도호가 건수2', + 'askp_csnu3': '매도호가 건수3', + 'askp_csnu4': '매도호가 건수4', + 'askp_csnu5': '매도호가 건수5', + 'bidp_csnu1': '매수호가 건수1', + 'bidp_csnu2': '매수호가 건수2', + 'bidp_csnu3': '매수호가 건수3', + 'bidp_csnu4': '매수호가 건수4', + 'bidp_csnu5': '매수호가 건수5', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'total_askp_csnu': '총 매도호가 건수', + 'total_bidp_csnu': '총 매수호가 건수', + 'aspr_acpt_hour': '호가 접수 시간' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 시세호가 조회 테스트 함수 + + 이 함수는 선물옵션 시세호가 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_asking_price(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09", env_dv="real") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드 없음) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/inquire_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/inquire_asking_price.py new file mode 100644 index 0000000..9c71faf --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_asking_price/inquire_asking_price.py @@ -0,0 +1,81 @@ +""" +Created on 20250601 +""" + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세호가[v1_국내선물-007] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/inquire-asking-price" + +def inquire_asking_price( + fid_cond_mrkt_div_code: str, # [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, JF: 주식선물) + fid_input_iscd: str, # [필수] FID 입력 종목코드 (ex. 101S03) + env_dv: str # [필수] 실전모의구분 (ex. real:실전, demo:모의) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 시세호가 API입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, JF: 주식선물) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101W09) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_asking_price("F", "101W09", "real") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F', 'JF')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHMIF10010000" + elif env_dv == "demo": + tr_id = "FHMIF10010000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (object) -> DataFrame + output2_data = pd.DataFrame([res.getBody().output2]) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/chk_inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/chk_inquire_balance.py new file mode 100644 index 0000000..663dca1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/chk_inquire_balance.py @@ -0,0 +1,136 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_balance import inquire_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고현황[v1_국내선물-004] +############################################################################################## + +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'shtn_pdno': '단축상품번호', + 'prdt_name': '상품명', + 'sll_buy_dvsn_name': '매도매수구분명', + 'cblc_qty': '잔고수량', + 'excc_unpr': '정산단가', + 'ccld_avg_unpr1': '체결평균단가1', + 'idx_clpr': '지수종가', + 'pchs_amt': '매입금액', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'trad_pfls_amt': '매매손익금액', + 'lqd_psbl_qty': '청산가능수량', + 'dnca_cash': '예수금현금', + 'frcr_dncl_amt': '외화예수금액', + 'dnca_sbst': '예수금대용', + 'tot_dncl_amt': '총예수금액', + 'tot_ccld_amt': '총체결금액', + 'cash_mgna': '현금증거금', + 'sbst_mgna': '대용증거금', + 'mgna_tota': '증거금총액', + 'opt_dfpa': '옵션차금', + 'thdt_dfpa': '당일차금', + 'rnwl_dfpa': '갱신차금', + 'fee': '수수료', + 'nxdy_dnca': '익일예수금', + 'nxdy_dncl_amt': '익일예수금액', + 'prsm_dpast': '추정예탁자산', + 'prsm_dpast_amt': '추정예탁자산금액', + 'pprt_ord_psbl_cash': '적정주문가능현금', + 'add_mgna_cash': '추가증거금현금', + 'add_mgna_tota': '추가증거금총액', + 'futr_trad_pfls_amt': '선물매매손익금액', + 'opt_trad_pfls_amt': '옵션매매손익금액', + 'futr_evlu_pfls_amt': '선물평가손익금액', + 'opt_evlu_pfls_amt': '옵션평가손익금액', + 'trad_pfls_amt_smtl': '매매손익금액합계', + 'evlu_pfls_amt_smtl': '평가손익금액합계', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ord_psbl_tota': '주문가능총액', + 'pchs_amt_smtl': '매입금액합계', + 'evlu_amt_smtl': '평가금액합계' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 잔고현황 조회 테스트 함수 + + 이 함수는 선물옵션 잔고현황 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", + excc_stat_cd="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/inquire_balance.py new file mode 100644 index 0000000..f4e9f32 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance/inquire_balance.py @@ -0,0 +1,138 @@ +""" +Created on 20250601 +""" + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고현황[v1_국내선물-004] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-balance" + +def inquire_balance( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + mgna_dvsn: str, # [필수] 증거금 구분 (ex. 01:게시,02:유지) + excc_stat_cd: str, # [필수] 정산상태코드 (ex. 1:정산,2:본정산) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 잔고현황 API입니다. 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + mgna_dvsn (str): [필수] 증거금 구분 (ex. 01:게시,02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산,2:본정산) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀 깊이 (자동 관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 선물옵션 잔고현황 데이터 + + Example: + >>> df1, df2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", excc_stat_cd="1") + >>> print(df1) + >>> print(df2) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01' or '02')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1' or '2')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "CTFO6118R" + elif env_dv == "demo": + tr_id = "VTFO6118R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance( + env_dv, cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/chk_inquire_balance_settlement_pl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/chk_inquire_balance_settlement_pl.py new file mode 100644 index 0000000..7028203 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/chk_inquire_balance_settlement_pl.py @@ -0,0 +1,109 @@ +""" +Created on 20250601 +""" +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_balance_settlement_pl import inquire_balance_settlement_pl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고정산손익내역[v1_국내선물-013] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'trad_dvsn_name': '매매구분명', + 'bfdy_cblc_qty': '전일잔고수량', + 'new_qty': '신규수량', + 'mnpl_rpch_qty': '전매환매수량', + 'cblc_qty': '잔고수량', + 'cblc_amt': '잔고금액', + 'trad_pfls_amt': '매매손익금액', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'nxdy_dnca': '익일예수금', + 'mmga_cash': '유지증거금현금', + 'brkg_mgna_cash': '위탁증거금현금', + 'opt_buy_chgs': '옵션매수대금', + 'opt_lqd_evlu_amt': '옵션청산평가금액', + 'dnca_sbst': '예수금대용', + 'mmga_tota': '유지증거금총액', + 'brkg_mgna_tota': '위탁증거금총액', + 'opt_sll_chgs': '옵션매도대금', + 'fee': '수수료', + 'thdt_dfpa': '당일차금', + 'rnwl_dfpa': '갱신차금', + 'dnca_cash': '예수금현금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 잔고정산손익내역 조회 테스트 함수 + + 이 함수는 선물옵션 잔고정산손익내역 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # Case 1 + logging.info("=== Case 1 ===") + try: + result1, result2 = inquire_balance_settlement_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dt="20230906") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼 (output1): %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 (output1) + + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과 (output1):") + print(result1) + + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 (output2) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과 (output2):") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/inquire_balance_settlement_pl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/inquire_balance_settlement_pl.py new file mode 100644 index 0000000..3bb8fd2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_settlement_pl/inquire_balance_settlement_pl.py @@ -0,0 +1,120 @@ +""" +Created on 20250601 +""" + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고정산손익내역[v1_국내선물-013] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-balance-settlement-pl" + +def inquire_balance_settlement_pl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 (ex. 03) + inqr_dt: str, # 조회일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 잔고정산손익내역 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + inqr_dt (str): [필수] 조회일자 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_balance_settlement_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dt="20230906") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_dt == "": + raise ValueError("inqr_dt is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6117R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_DT": inqr_dt, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_settlement_pl( + cano, acnt_prdt_cd, inqr_dt, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/chk_inquire_balance_valuation_pl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/chk_inquire_balance_valuation_pl.py new file mode 100644 index 0000000..e6156ed --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/chk_inquire_balance_valuation_pl.py @@ -0,0 +1,134 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_balance_valuation_pl import inquire_balance_valuation_pl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고평가손익내역[v1_국내선물-015] +############################################################################################## + +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'shtn_pdno': '단축상품번호', + 'prdt_name': '상품명', + 'sll_buy_dvsn_name': '매도매수구분명', + 'cblc_qty1': '잔고수량1', + 'excc_unpr': '정산단가', + 'ccld_avg_unpr1': '체결평균단가1', + 'idx_clpr': '지수종가', + 'pchs_amt': '매입금액', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'trad_pfls_amt': '매매손익금액', + 'lqd_psbl_qty': '청산가능수량', + 'dnca_cash': '예수금현금', + 'frcr_dncl_amt': '외화예수금액', + 'dnca_sbst': '예수금대용', + 'tot_dncl_amt': '총예수금액', + 'tot_ccld_amt': '총체결금액', + 'cash_mgna': '현금증거금', + 'sbst_mgna': '대용증거금', + 'mgna_tota': '증거금총액', + 'opt_dfpa': '옵션차금', + 'thdt_dfpa': '당일차금', + 'rnwl_dfpa': '갱신차금', + 'fee': '수수료', + 'nxdy_dnca': '익일예수금', + 'nxdy_dncl_amt': '익일예수금액', + 'prsm_dpast': '추정예탁자산', + 'prsm_dpast_amt': '추정예탁자산금액', + 'pprt_ord_psbl_cash': '적정주문가능현금', + 'add_mgna_cash': '추가증거금현금', + 'add_mgna_tota': '추가증거금총액', + 'futr_trad_pfls_amt': '선물매매손익금액', + 'opt_trad_pfls_amt': '옵션매매손익금액', + 'futr_evlu_pfls_amt': '선물평가손익금액', + 'opt_evlu_pfls_amt': '옵션평가손익금액', + 'trad_pfls_amt_smtl': '매매손익금액합계', + 'evlu_pfls_amt_smtl': '평가손익금액합계', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ord_psbl_tota': '주문가능총액' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 잔고평가손익내역 조회 테스트 함수 + + 이 함수는 선물옵션 잔고평가손익내역 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_balance_valuation_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", + excc_stat_cd="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/inquire_balance_valuation_pl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/inquire_balance_valuation_pl.py new file mode 100644 index 0000000..13ea692 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_balance_valuation_pl/inquire_balance_valuation_pl.py @@ -0,0 +1,129 @@ +""" +Created on 20250601 +""" + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고평가손익내역[v1_국내선물-015] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-balance-valuation-pl" + + +def inquire_balance_valuation_pl( + cano: str, # [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn: str, # [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd: str, # [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + FK200: str = "", # 연속조회검색조건200 (ex. 연속조회검색조건200) + NK200: str = "", # 연속조회키200 (ex. 연속조회키200) + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 시장별 투자자매매동향(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0404] 시장별 일별동향 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn (str): [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + FK200 (str): 연속조회검색조건200 (ex. 연속조회검색조건200) + NK200 (str): 연속조회키200 (ex. 연속조회키200) + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_balance_valuation_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", excc_stat_cd="1") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01:개시, 02:유지')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1:정산, 2:본정산')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6159R" # 선물옵션 잔고평가손익내역 + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_valuation_pl( + cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, + max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/chk_inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/chk_inquire_ccnl.py new file mode 100644 index 0000000..a6fa2d5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/chk_inquire_ccnl.py @@ -0,0 +1,128 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_ccnl import inquire_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문체결내역조회[v1_국내선물-003] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_gno_brno': '주문채번지점번호', + 'cano': '종합계좌번호', + 'csac_name': '종합계좌명', + 'acnt_prdt_cd': '계좌상품코드', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'trad_dvsn_name': '매매구분명', + 'nmpr_type_cd': '호가유형코드', + 'nmpr_type_name': '호가유형명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'prdt_type_cd': '상품유형코드', + 'ord_qty': '주문수량', + 'ord_idx': '주문지수', + 'qty': '잔량', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'avg_idx': '평균지수', + 'tot_ccld_amt': '총체결금액', + 'rjct_qty': '거부수량', + 'ingr_trad_rjct_rson_cd': '장내매매거부사유코드', + 'ingr_trad_rjct_rson_name': '장내매매거부사유명', + 'ord_stfno': '주문직원번호', + 'sprd_item_yn': '스프레드종목여부', + 'ord_ip_addr': '주문IP주소', + 'tot_ord_qty': '총주문수량', + 'tot_ccld_amt_smtl': '총체결금액합계', + 'tot_ccld_qty_smtl': '총체결수량합계', + 'fee_smtl': '수수료합계', + 'ctac_tlno': '연락전화번호' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 주문체결내역조회 테스트 함수 + + 이 함수는 선물옵션 주문체결내역조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_ccnl( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + strt_ord_dt="20220730", + end_ord_dt="20220830", + sll_buy_dvsn_cd="00", + ccld_nccs_dvsn="00", + sort_sqn="DS" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/inquire_ccnl.py new file mode 100644 index 0000000..34b1762 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl/inquire_ccnl.py @@ -0,0 +1,172 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문체결내역조회[v1_국내선물-003] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-ccnl" + +def inquire_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + strt_ord_dt: str, # [필수] 시작주문일자 (ex. 주문내역 조회 시작 일자, YYYYMMDD) + end_ord_dt: str, # [필수] 종료주문일자 (ex. 주문내역 조회 마지막 일자, YYYYMMDD) + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (ex. 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn: str, # [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn: str, # [필수] 정렬순서 (ex. AS:정순, DS:역순) + pdno: str = "", # 상품번호 + strt_odno: str = "", # 시작주문번호 + mket_id_cd: str = "", # 시장ID코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 주문체결내역조회 API입니다. 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + strt_ord_dt (str): [필수] 시작주문일자 (ex. 주문내역 조회 시작 일자, YYYYMMDD) + end_ord_dt (str): [필수] 종료주문일자 (ex. 주문내역 조회 마지막 일자, YYYYMMDD) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn (str): [필수] 정렬순서 (ex. AS:정순, DS:역순) + pdno (str, optional): 상품번호. Defaults to "". + strt_odno (str, optional): 시작주문번호. Defaults to "". + mket_id_cd (str, optional): 시장ID코드. Defaults to "". + FK200 (str, optional): 연속조회검색조건200. Defaults to "". + NK200 (str, optional): 연속조회키200. Defaults to "". + tr_cont (str, optional): 연속거래여부. Defaults to "". + dataframe1 (Optional[pd.DataFrame], optional): 누적 데이터프레임1. Defaults to None. + dataframe2 (Optional[pd.DataFrame], optional): 누적 데이터프레임2. Defaults to None. + depth (int, optional): 내부 재귀깊이 (자동관리). Defaults to 0. + max_depth (int, optional): 최대 재귀 횟수 제한. Defaults to 10. + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주문체결내역 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_ccnl(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20220730", end_ord_dt="20220830", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00", sort_sqn="DS") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if not env_dv: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if not cano: + raise ValueError("cano is required") + + if not acnt_prdt_cd: + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if not strt_ord_dt: + raise ValueError("strt_ord_dt is required (e.g. '20220730')") + + if not end_ord_dt: + raise ValueError("end_ord_dt is required (e.g. '20220830')") + + if not sll_buy_dvsn_cd: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00')") + + if not ccld_nccs_dvsn: + raise ValueError("ccld_nccs_dvsn is required (e.g. '00')") + + if not sort_sqn: + raise ValueError("sort_sqn is required (e.g. 'AS' or 'DS')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTO5201R" + elif env_dv == "demo": + tr_id = "VTTO5201R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + # 파라미터 설정 + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_ORD_DT": strt_ord_dt, + "END_ORD_DT": end_ord_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SORT_SQN": sort_sqn, + "PDNO": pdno, + "STRT_ODNO": strt_odno, + "MKET_ID_CD": mket_id_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 (단일 객체) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # 연속조회 정보 업데이트 + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ccnl( + env_dv, cano, acnt_prdt_cd, strt_ord_dt, end_ord_dt, + sll_buy_dvsn_cd, ccld_nccs_dvsn, sort_sqn, pdno, strt_odno, + mket_id_cd, FK200, NK200, "N", dataframe1, dataframe2, + depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/chk_inquire_ccnl_bstime.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/chk_inquire_ccnl_bstime.py new file mode 100644 index 0000000..b68e518 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/chk_inquire_ccnl_bstime.py @@ -0,0 +1,108 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_ccnl_bstime import inquire_ccnl_bstime + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 기준일체결내역[v1_국내선물-016] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'odno': '주문번호', + 'tr_type_name': '거래유형명', + 'last_sttldt': '최종결제일', + 'ccld_idx': '체결지수', + 'ccld_qty': '체결량', + 'trad_amt': '매매금액', + 'fee': '수수료', + 'ccld_btwn': '체결시간', + 'tot_ccld_qty_smtl': '총체결수량합계', + 'tot_ccld_amt_smtl': '총체결금액합계', + 'fee_adjt': '수수료조정', + 'fee_smtl': '수수료합계' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 기준일체결내역 조회 테스트 함수 + + 이 함수는 선물옵션 기준일체결내역 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_ccnl_bstime( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + ord_dt="20230920", + fuop_tr_strt_tmd="000000", + fuop_tr_end_tmd="240000" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/inquire_ccnl_bstime.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/inquire_ccnl_bstime.py new file mode 100644 index 0000000..69fba93 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ccnl_bstime/inquire_ccnl_bstime.py @@ -0,0 +1,134 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 기준일체결내역[v1_국내선물-016] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-ccnl-bstime" + +def inquire_ccnl_bstime( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + ord_dt: str, # [필수] 주문일자 (ex. 20250101) + fuop_tr_strt_tmd: str, # [필수] 선물옵션거래시작시각 (ex. HHMMSS) + fuop_tr_end_tmd: str, # [필수] 선물옵션거래종료시각 (ex. HHMMSS) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 기준일체결내역 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + ord_dt (str): [필수] 주문일자 (ex. 20250101) + fuop_tr_strt_tmd (str): [필수] 선물옵션거래시작시각 (ex. HHMMSS) + fuop_tr_end_tmd (str): [필수] 선물옵션거래종료시각 (ex. HHMMSS) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션 기준일체결내역 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_ccnl_bstime(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ord_dt="20230920", fuop_tr_strt_tmd="000000", fuop_tr_end_tmd="240000") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if ord_dt == "": + raise ValueError("ord_dt is required (e.g. '20250101')") + + if fuop_tr_strt_tmd == "": + raise ValueError("fuop_tr_strt_tmd is required (e.g. 'HHMMSS')") + + if fuop_tr_end_tmd == "": + raise ValueError("fuop_tr_end_tmd is required (e.g. 'HHMMSS')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO5139R" + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ORD_DT": ord_dt, # 주문일자 + "FUOP_TR_STRT_TMD": fuop_tr_strt_tmd, # 선물옵션거래시작시각 + "FUOP_TR_END_TMD": fuop_tr_end_tmd, # 선물옵션거래종료시각 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ccnl_bstime( + cano, acnt_prdt_cd, ord_dt, fuop_tr_strt_tmd, fuop_tr_end_tmd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/chk_inquire_daily_amount_fee.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/chk_inquire_daily_amount_fee.py new file mode 100644 index 0000000..00f11dd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/chk_inquire_daily_amount_fee.py @@ -0,0 +1,127 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_amount_fee import inquire_daily_amount_fee + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션기간약정수수료일별[v1_국내선물-017] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_dt': '주문일자', + 'pdno': '상품번호', + 'item_name': '종목명', + 'sll_agrm_amt': '매도약정금액', + 'sll_fee': '매도수수료', + 'buy_agrm_amt': '매수약정금액', + 'buy_fee': '매수수수료', + 'tot_fee_smtl': '총수수료합계', + 'trad_pfls': '매매손익', + 'futr_agrm': '선물약정', + 'futr_agrm_amt': '선물약정금액', + 'futr_agrm_amt_smtl': '선물약정금액합계', + 'futr_sll_fee_smtl': '선물매도수수료합계', + 'futr_buy_fee_smtl': '선물매수수수료합계', + 'futr_fee_smtl': '선물수수료합계', + 'opt_agrm': '옵션약정', + 'opt_agrm_amt': '옵션약정금액', + 'opt_agrm_amt_smtl': '옵션약정금액합계', + 'opt_sll_fee_smtl': '옵션매도수수료합계', + 'opt_buy_fee_smtl': '옵션매수수수료합계', + 'opt_fee_smtl': '옵션수수료합계', + 'prdt_futr_agrm': '상품선물약정', + 'prdt_fuop': '상품선물옵션', + 'prdt_futr_evlu_amt': '상품선물평가금액', + 'futr_fee': '선물수수료', + 'opt_fee': '옵션수수료', + 'fee': '수수료', + 'sll_agrm_amt': '매도약정금액', + 'buy_agrm_amt': '매수약정금액', + 'agrm_amt_smtl': '약정금액합계', + 'sll_fee': '매도수수료', + 'buy_fee': '매수수수료', + 'fee_smtl': '수수료합계', + 'trad_pfls_smtl': '매매손익합계' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션기간약정수수료일별 조회 테스트 함수 + + 이 함수는 선물옵션기간약정수수료일별 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 메타데이터에서 제공하는 case1 데이터를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_daily_amount_fee( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_day="20240401", + inqr_end_day="20240625" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 블록 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 블록 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/inquire_daily_amount_fee.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/inquire_daily_amount_fee.py new file mode 100644 index 0000000..2a0e2e5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_amount_fee/inquire_daily_amount_fee.py @@ -0,0 +1,127 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션기간약정수수료일별[v1_국내선물-017] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-daily-amount-fee" + +def inquire_daily_amount_fee( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + inqr_strt_day: str, # [필수] 조회시작일 (ex. 20240401) + inqr_end_day: str, # [필수] 조회종료일 (ex. 20240625) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션기간약정수수료일별 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + inqr_strt_day (str): [필수] 조회시작일 (ex. 20240401) + inqr_end_day (str): [필수] 조회종료일 (ex. 20240625) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션기간약정수수료일별 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_daily_amount_fee(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_day="20240401", inqr_end_day="20240625") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_day == "": + raise ValueError("inqr_strt_day is required") + + if inqr_end_day == "": + raise ValueError("inqr_end_day is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6119R" # 선물옵션기간약정수수료일별 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_STRT_DAY": inqr_strt_day, # 조회시작일 + "INQR_END_DAY": inqr_end_day, # 조회종료일 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_daily_amount_fee( + cano, acnt_prdt_cd, inqr_strt_day, inqr_end_day, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/chk_inquire_daily_fuopchartprice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/chk_inquire_daily_fuopchartprice.py new file mode 100644 index 0000000..9bfccc6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/chk_inquire_daily_fuopchartprice.py @@ -0,0 +1,130 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_fuopchartprice import inquire_daily_fuopchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션기간별시세(일/주/월/년)[v1_국내선물-008] +############################################################################################## + +COLUMN_MAPPING = { + 'futs_prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'futs_prdy_clpr': '선물 전일 종가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '현재가', + 'futs_shrn_iscd': '단축 종목코드', + 'prdy_vol': '전일 거래량', + 'futs_mxpr': '상한가', + 'futs_llam': '하한가', + 'futs_oprc': '시가', + 'futs_hgpr': '최고가', + 'futs_lwpr': '최저가', + 'futs_prdy_oprc': '전일 시가', + 'futs_prdy_hgpr': '전일 최고가', + 'futs_prdy_lwpr': '전일 최저가', + 'futs_askp': '매도호가', + 'futs_bidp': '매수호가', + 'basis': '베이시스', + 'kospi200_nmix': 'KOSPI200 지수', + 'kospi200_prdy_vrss': 'KOSPI200 전일 대비', + 'kospi200_prdy_ctrt': 'KOSPI200 전일 대비율', + 'kospi200_prdy_vrss_sign': '전일 대비 부호', + 'hts_otst_stpl_qty': 'HTS 미결제 약정 수량', + 'otst_stpl_qty_icdc': '미결제 약정 수량 증감', + 'tday_rltv': '당일 체결강도', + 'hts_thpr': 'HTS 이론가', + 'dprt': '괴리율', + 'stck_bsop_date': '영업 일자', + 'futs_prpr': '현재가', + 'futs_oprc': '시가', + 'futs_hgpr': '최고가', + 'futs_lwpr': '최저가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'mod_yn': '변경 여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션기간별시세 조회 테스트 함수 + + 이 함수는 선물옵션기간별시세 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + output1, output2 = inquire_daily_fuopchartprice( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101W09", + fid_input_date_1="20250301", + fid_input_date_2="20250810", + fid_period_div_code="D", + env_dv="real" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", output1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + output1 = output1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output1.columns: + output1[col] = pd.to_numeric(output1[col], errors='coerce').round(2) + + logging.info("결과:") + print(output1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % output2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + output2 = output2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output2.columns: + output2[col] = pd.to_numeric(output2[col], errors='coerce').round(2) + + logging.info("결과:") + print(output2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/inquire_daily_fuopchartprice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/inquire_daily_fuopchartprice.py new file mode 100644 index 0000000..b063924 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_daily_fuopchartprice/inquire_daily_fuopchartprice.py @@ -0,0 +1,109 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션기간별시세(일/주/월/년)[v1_국내선물-008] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/inquire-daily-fuopchartprice" + +def inquire_daily_fuopchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # 종목코드 + fid_input_date_1: str, # 조회 시작일자 + fid_input_date_2: str, # 조회 종료일자 + fid_period_div_code: str, # 기간분류코드 + env_dv: str # 실전모의구분 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (지수)선물옵션 기간별시세 데이터(일/주/월/년) 조회 (최대 100건 조회) + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] 종목코드 (ex. 101W09) + fid_input_date_1 (str): [필수] 조회 시작일자 (ex. 20220301) + fid_input_date_2 (str): [필수] 조회 종료일자 (ex. 20220810) + fid_period_div_code (str): [필수] 기간분류코드 (ex. D: 일봉, W: 주봉) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (기본정보, 차트데이터) 튜플 + + Example: + >>> output1, output2 = inquire_daily_fuopchartprice( + ... fid_cond_mrkt_div_code="F", + ... fid_input_iscd="101W09", + ... fid_input_date_1="20250301", + ... fid_input_date_2="20250810", + ... fid_period_div_code="D", + ... env_dv="real" + ... ) + >>> print(output1) + >>> print(output2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F: 지수선물, O: 지수옵션')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20250301')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20250810')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D: 일봉, W: 주봉')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKIF03020100" + elif env_dv == "demo": + tr_id = "FHKIF03020100" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1: object -> DataFrame (1행) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2: array -> DataFrame (여러행) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/chk_inquire_deposit.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/chk_inquire_deposit.py new file mode 100644 index 0000000..7ec1782 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/chk_inquire_deposit.py @@ -0,0 +1,102 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_deposit import inquire_deposit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 총자산현황[v1_국내선물-014] +############################################################################################## + +COLUMN_MAPPING = { + 'dnca_tota': '예수금총액', + 'bfdy_chck_amt': '전일수표금액', + 'thdt_chck_amt': '당일수표금액', + 'rlth_uwdl_dpos_amt': '실물인수도예치금액', + 'brkg_mgna_cash': '위탁증거금현금', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_tota': '주문가능총액', + 'dnca_sbst': '예수금대용', + 'scts_sbst_amt': '유가증권대용금액', + 'frcr_evlu_amt': '외화평가금액', + 'brkg_mgna_sbst': '위탁증거금대용', + 'sbst_rlse_psbl_amt': '대용해제가능금액', + 'mtnc_rt': '유지비율', + 'add_mgna_tota': '추가증거금총액', + 'add_mgna_cash': '추가증거금현금', + 'rcva': '미수금', + 'futr_trad_pfls': '선물매매손익', + 'opt_trad_pfls_amt': '옵션매매손익금액', + 'trad_pfls_smtl': '매매손익합계', + 'futr_evlu_pfls_amt': '선물평가손익금액', + 'opt_evlu_pfls_amt': '옵션평가손익금액', + 'evlu_pfls_smtl': '평가손익합계', + 'excc_dfpa': '정산차금', + 'opt_dfpa': '옵션차금', + 'brkg_fee': '위탁수수료', + 'nxdy_dnca': '익일예수금', + 'prsm_dpast_amt': '추정예탁자산금액', + 'cash_mntn_amt': '현금유지금액', + 'hack_acdt_acnt_move_amt': '해킹사고계좌이전금액' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 총자산현황 조회 테스트 함수 + + 이 함수는 선물옵션 총자산현황 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/inquire_deposit.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/inquire_deposit.py new file mode 100644 index 0000000..7bfec67 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_deposit/inquire_deposit.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 총자산현황[v1_국내선물-014] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-deposit" + +def inquire_deposit( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str # [필수] 계좌상품코드 (ex. 03) +) -> pd.DataFrame: + """ + 선물옵션 총자산현황 API 입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + + Returns: + pd.DataFrame: 선물옵션 총자산현황 데이터 + + Example: + >>> df = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + tr_id = "CTRP6550R" # 선물옵션 총자산현황 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd # 계좌상품코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/chk_inquire_ngt_balance.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/chk_inquire_ngt_balance.py new file mode 100644 index 0000000..61dbf9e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/chk_inquire_ngt_balance.py @@ -0,0 +1,144 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_ngt_balance import inquire_ngt_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +############################################################################################## + +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'shtn_pdno': '단축상품번호', + 'prdt_name': '상품명', + 'sll_buy_dvsn_name': '매도매수구분명', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'trad_dvsn_name': '매매구분명', + 'cblc_qty': '잔고수량', + 'excc_unpr': '정산단가', + 'ccld_avg_unpr1': '체결평균단가1', + 'idx_clpr': '지수종가', + 'pchs_amt': '매입금액', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'trad_pfls_amt': '매매손익금액', + 'lqd_psbl_qty': '청산가능수량', + 'dnca_cash': '예수금현금', + 'frcr_dncl_amt': '외화예수금액', + 'dnca_sbst': '예수금대용', + 'tot_dncl_amt': '총예수금액', + 'cash_mgna': '현금증거금', + 'sbst_mgna': '대용증거금', + 'mgna_tota': '증거금총액', + 'opt_dfpa': '옵션차금', + 'thdt_dfpa': '당일차금', + 'rnwl_dfpa': '갱신차금', + 'fee': '수수료', + 'nxdy_dnca': '익일예수금', + 'nxdy_dncl_amt': '익일예수금액', + 'prsm_dpast': '추정예탁자산', + 'pprt_ord_psbl_cash': '적정주문가능현금', + 'add_mgna_cash': '추가증거금현금', + 'add_mgna_tota': '추가증거금총액', + 'futr_trad_pfls_amt': '선물매매손익금액', + 'opt_trad_pfls_amt': '옵션매매손익금액', + 'futr_evlu_pfls_amt': '선물평가손익금액', + 'opt_evlu_pfls_amt': '옵션평가손익금액', + 'trad_pfls_amt_smtl': '매매손익금액합계', + 'evlu_pfls_amt_smtl': '평가손익금액합계', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ord_psbl_tota': '주문가능총액', + 'mmga_tot_amt': '유지증거금총금액', + 'mmga_cash_amt': '유지증거금현금금액', + 'mtnc_rt': '유지비율', + 'isfc_amt': '부족금액', + 'pchs_amt_smtl': '매입금액합계', + 'evlu_amt_smtl': '평가금액합계' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + (야간)선물옵션 잔고현황 조회 테스트 함수 + + 이 함수는 (야간)선물옵션 잔고현황 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # Case 1 조회 + logging.info("=== Case 1 조회 ===") + try: + result1, result2 = inquire_ngt_balance( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + mgna_dvsn="01", + excc_stat_cd="1" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/inquire_ngt_balance.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/inquire_ngt_balance.py new file mode 100644 index 0000000..ce4ebd7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_balance/inquire_ngt_balance.py @@ -0,0 +1,131 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance" + +def inquire_ngt_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + mgna_dvsn: str, # 증거금구분 + excc_stat_cd: str, # 정산상태코드 + acnt_pwd: str = "", # 계좌비밀번호 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 잔고현황 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn (str): [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + acnt_pwd (str): 계좌비밀번호 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_ngt_balance("12345678", "01", "01", "1") + >>> print(df1, df2) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01:개시, 02:유지')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1:정산, 2:본정산')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame() + ) + + tr_id = "CTFN6118R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "ACNT_PWD": acnt_pwd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ngt_balance( + cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, acnt_pwd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return (dataframe1, dataframe2) + else: + res.printError(url=API_URL) + return (pd.DataFrame(), pd.DataFrame()) \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/chk_inquire_ngt_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/chk_inquire_ngt_ccnl.py new file mode 100644 index 0000000..8d5261d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/chk_inquire_ngt_ccnl.py @@ -0,0 +1,122 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_ngt_ccnl import inquire_ngt_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_gno_brno': '주문채번지점번호', + 'cano': '종합계좌번호', + 'csac_name': '종합계좌명', + 'acnt_prdt_cd': '계좌상품코드', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'trad_dvsn_name': '매매구분명', + 'nmpr_type_name': '호가유형명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'prdt_type_cd': '상품유형코드', + 'ord_qty': '주문수량', + 'ord_idx4': '주문지수', + 'qty': '잔량', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'avg_idx': '평균지수', + 'tot_ccld_amt': '총체결금액', + 'rjct_qty': '거부수량', + 'ingr_trad_rjct_rson_cd': '장내매매거부사유코드', + 'ingr_trad_rjct_rson_name': '장내매매거부사유명', + 'ord_stfno': '주문직원번호', + 'sprd_item_yn': '스프레드종목여부', + 'ord_ip_addr': '주문IP주소', + 'tot_ord_qty': '총주문수량', + 'tot_ccld_qty': '총체결수량', + 'tot_ccld_qty_SMTL': '총체결수량', + 'tot_ccld_amt': '총체결금액', + 'tot_ccld_amt_SMTL': '총체결금액', + 'fee': '수수료', + 'ctac_tlno': '연락전화번호' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + (야간)선물옵션 주문체결 내역조회 테스트 함수 + + 이 함수는 (야간)선물옵션 주문체결 내역조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_ngt_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20250610", + end_ord_dt="20250613", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/inquire_ngt_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/inquire_ngt_ccnl.py new file mode 100644 index 0000000..62d73ab --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_ngt_ccnl/inquire_ngt_ccnl.py @@ -0,0 +1,164 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl" + +def inquire_ngt_ccnl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_ord_dt: str, # 시작주문일자 + end_ord_dt: str, # 종료주문일자 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sort_sqn: str = "", # 정렬순서 + strt_odno: str = "", # 시작주문번호 + pdno: str = "", # 상품번호 + mket_id_cd: str = "", # 시장ID코드 + fuop_dvsn_cd: str = "", # 선물옵션구분코드 + scrn_dvsn: str = "", # 화면구분 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 주문체결 내역조회 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + strt_ord_dt (str): [필수] 시작주문일자 + end_ord_dt (str): [필수] 종료주문일자 (ex. 조회하려는 마지막 일자 다음일자로 조회 (ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정)) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 공란:default, 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn (str): 정렬순서 (ex. 공란:default(DS:정순, 그외:역순)) + strt_odno (str): 시작주문번호 (ex. 공란:default) + pdno (str): 상품번호 (ex. 공란:default) + mket_id_cd (str): 시장ID코드 (ex. 공란:default) + fuop_dvsn_cd (str): 선물옵션구분코드 (ex. 공란:전체, 01:선물, 02:옵션) + scrn_dvsn (str): 화면구분 (ex. 02(Default)) + FK200 (str): 연속조회검색조건200 (ex. 공란:최초 조회시, 이전 조회 Output CTX_AREA_FK200값:다음페이지 조회시(2번째부터)) + NK200 (str): 연속조회키200 (ex. 공란:최초 조회시, 이전 조회 Output CTX_AREA_NK200값:다음페이지 조회시(2번째부터)) + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_ngt_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20231201", end_ord_dt="20231214", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if strt_ord_dt == "" or strt_ord_dt is None: + raise ValueError("strt_ord_dt is required") + + if end_ord_dt == "" or end_ord_dt is None: + raise ValueError("end_ord_dt is required (e.g. '조회하려는 마지막 일자 다음일자로 조회 (ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정)')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '공란:default, 00:전체, 01:매도, 02:매수')") + + if ccld_nccs_dvsn == "" or ccld_nccs_dvsn is None: + raise ValueError("ccld_nccs_dvsn is required (e.g. '00:전체, 01:체결, 02:미체결')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "STTN5201R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_ORD_DT": strt_ord_dt, + "END_ORD_DT": end_ord_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SORT_SQN": sort_sqn, + "STRT_ODNO": strt_odno, + "PDNO": pdno, + "MKET_ID_CD": mket_id_cd, + "FUOP_DVSN_CD": fuop_dvsn_cd, + "SCRN_DVSN": scrn_dvsn, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + print(res.getBody()) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ngt_ccnl( + cano, acnt_prdt_cd, strt_ord_dt, end_ord_dt, sll_buy_dvsn_cd, ccld_nccs_dvsn, + sort_sqn, strt_odno, pdno, mket_id_cd, fuop_dvsn_cd, scrn_dvsn, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/chk_inquire_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/chk_inquire_price.py new file mode 100644 index 0000000..ac7bb78 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/chk_inquire_price.py @@ -0,0 +1,145 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_price import inquire_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세[v1_국내선물-006] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '선물 현재가', + 'futs_prdy_vrss': '선물 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_clpr': '선물 전일 종가', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_otst_stpl_qty': 'HTS 미결제 약정 수량', + 'otst_stpl_qty_icdc': '미결제 약정 수량 증감', + 'futs_oprc': '선물 시가2', + 'futs_hgpr': '선물 최고가', + 'futs_lwpr': '선물 최저가', + 'futs_mxpr': '선물 상한가', + 'futs_llam': '선물 하한가', + 'basis': '베이시스', + 'futs_sdpr': '선물 기준가', + 'hts_thpr': 'HTS 이론가', + 'dprt': '괴리율', + 'crbr_aply_mxpr': '서킷브레이커 적용 상한가', + 'crbr_aply_llam': '서킷브레이커 적용 하한가', + 'futs_last_tr_date': '선물 최종 거래 일자', + 'hts_rmnn_dynu': 'HTS 잔존 일수', + 'futs_lstn_medm_hgpr': '선물 상장 중 최고가', + 'futs_lstn_medm_lwpr': '선물 상장 중 최저가', + 'delta_val': '델타 값', + 'gama': '감마', + 'theta': '세타', + 'vega': '베가', + 'rho': '로우', + 'hist_vltl': '역사적 변동성', + 'hts_ints_vltl': 'HTS 내재 변동성', + 'mrkt_basis': '시장 베이시스', + 'acpr': '행사가', + 'bstp_cls_code': '업종 구분 코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 시세 조회 테스트 함수 + + 이 함수는 선물옵션 시세 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 101S09 종목을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2, result3 = inquire_price( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101W09", + env_dv="real" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + # output3 처리 + logging.info("=== output3 결과 ===") + logging.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 컬럼명 한글 변환 + result3 = result3.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logging.info("결과:") + print(result3) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/inquire_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/inquire_price.py new file mode 100644 index 0000000..5464471 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_price/inquire_price.py @@ -0,0 +1,91 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세[v1_국내선물-006] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/inquire-price" + +def inquire_price( + fid_cond_mrkt_div_code: str, # [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd: str, # [필수] FID 입력 종목코드 (ex. 101W09) + env_dv: str # [필수] 실전모의구분 (ex. real:실전, demo:모의) +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 시세 API입니다. + + ※ 종목코드 마스터파일 정제코드는 한국투자증권 Github 참고: + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101W09) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 선물옵션 시세 데이터 (output1, output2, output3) + + Example: + >>> result1, result2, result3 = inquire_price( + ... fid_cond_mrkt_div_code="F", + ... fid_input_iscd="101W09", + ... env_dv="real" + ... ) + >>> print(result1) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F', 'O')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHMIF10000000" + elif env_dv == "demo": + tr_id = "FHMIF10000000" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 처리 + output1 = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 처리 + output2 = pd.DataFrame(res.getBody().output2, index=[0]) + + # output3 처리 + output3 = pd.DataFrame(res.getBody().output3, index=[0]) + + return output1, output2, output3 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/chk_inquire_psbl_ngt_order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/chk_inquire_psbl_ngt_order.py new file mode 100644 index 0000000..6bf483c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/chk_inquire_psbl_ngt_order.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_psbl_ngt_order import inquire_psbl_ngt_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +############################################################################################## + +COLUMN_MAPPING = { + 'max_ord_psbl_qty': '최대주문가능수량', + 'tot_psbl_qty': '최대주문가능수량', + 'lqd_psbl_qty': '청산가능수량', + 'lqd_psbl_qty_1': '청산가능수량', + 'ord_psbl_qty': '주문가능수량', + 'bass_idx': '기준지수' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + (야간)선물옵션 주문가능 조회 테스트 함수 + + 이 함수는 (야간)선물옵션 주문가능 조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_psbl_ngt_order( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="101W09", + prdt_type_cd="301", + sll_buy_dvsn_cd="02", + unit_price="322", + ord_dvsn_cd="01" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/inquire_psbl_ngt_order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/inquire_psbl_ngt_order.py new file mode 100644 index 0000000..9c371b0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_ngt_order/inquire_psbl_ngt_order.py @@ -0,0 +1,94 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-psbl-ngt-order" + +def inquire_psbl_ngt_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + unit_price: str, # 주문가격1 + ord_dvsn_cd: str # 주문구분코드 +) -> pd.DataFrame: + """ + (야간)선물옵션 주문가능 조회 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + pdno (str): [필수] 상품번호 + prdt_type_cd (str): [필수] 상품유형코드 (ex. 301:선물옵션) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도, 02:매수) + unit_price (str): [필수] 주문가격1 + ord_dvsn_cd (str): [필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK)) + + Returns: + pd.DataFrame: (야간)선물옵션 주문가능 데이터 + + Example: + >>> df = inquire_psbl_ngt_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="101W09", prdt_type_cd="301", sll_buy_dvsn_cd="02", unit_price="322", ord_dvsn_cd="01") + >>> print(df) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required") + + if prdt_type_cd == "" or prdt_type_cd is None: + raise ValueError("prdt_type_cd is required (e.g. '301')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01', '02')") + + if unit_price == "" or unit_price is None: + raise ValueError("unit_price is required") + + if ord_dvsn_cd == "" or ord_dvsn_cd is None: + raise ValueError("ord_dvsn_cd is required (e.g. '01', '02', '03', '04', '10', '11', '12', '13', '14', '15')") + + tr_id = "STTN5105R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "UNIT_PRICE": unit_price, + "ORD_DVSN_CD": ord_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/chk_inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/chk_inquire_psbl_order.py new file mode 100644 index 0000000..de2174d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/chk_inquire_psbl_order.py @@ -0,0 +1,83 @@ +""" +Created on 20250115 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_psbl_order import inquire_psbl_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문가능[v1_국내선물-005] +############################################################################################## + +COLUMN_MAPPING = { + 'tot_psbl_qty': '총가능수량', + 'lqd_psbl_qty1': '청산가능수량1', + 'ord_psbl_qty': '주문가능수량', + 'bass_idx': '기준지수' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 주문가능 조회 테스트 함수 + + 이 함수는 선물옵션 주문가능 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 실전 환경의 선물옵션 계좌를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_psbl_order( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="101W09", + sll_buy_dvsn_cd="02", + unit_price="1", + ord_dvsn_cd="01" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/inquire_psbl_order.py new file mode 100644 index 0000000..52fc1fd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_psbl_order/inquire_psbl_order.py @@ -0,0 +1,101 @@ +""" +Created on 20250115 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문가능[v1_국내선물-005] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/inquire-psbl-order" + +def inquire_psbl_order( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + pdno: str, # [필수] 상품번호 (ex. 선물 6자리, 옵션 9자리) + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (ex. 01:매도,02:매수) + unit_price: str, # [필수] 주문가격1 + ord_dvsn_cd: str # [필수] 주문구분코드 +) -> pd.DataFrame: + """ + 선물옵션 주문가능 API입니다. 주문가능 내역과 수량을 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + pdno (str): [필수] 상품번호 (ex. 선물 6자리, 옵션 9자리) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도,02:매수) + unit_price (str): [필수] 주문가격1 + ord_dvsn_cd (str): [필수] 주문구분코드 + + Returns: + pd.DataFrame: 선물옵션 주문가능 데이터 + + Example: + >>> df = inquire_psbl_order(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... pdno="101W09", sll_buy_dvsn_cd="02", unit_price="1", ord_dvsn_cd="01") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '101W09')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01' or '02')") + + if unit_price == "": + raise ValueError("unit_price is required") + + if ord_dvsn_cd == "": + raise ValueError("ord_dvsn_cd is required") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTO5105R" + elif env_dv == "demo": + tr_id = "VTTO5105R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "UNIT_PRICE": unit_price, + "ORD_DVSN_CD": ord_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/chk_inquire_time_fuopchartprice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/chk_inquire_time_fuopchartprice.py new file mode 100644 index 0000000..4f828a5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/chk_inquire_time_fuopchartprice.py @@ -0,0 +1,132 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_fuopchartprice import inquire_time_fuopchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 분봉조회[v1_국내선물-012] +############################################################################################## + +COLUMN_MAPPING = { + 'futs_prdy_vrss': '선물 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'futs_prdy_ctrt': '선물 전일 대비율', + 'futs_prdy_clpr': '선물 전일 종가', + 'prdy_nmix': '전일 지수', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'futs_prpr': '선물 현재가', + 'futs_shrn_iscd': '선물 단축 종목코드', + 'prdy_vol': '전일 거래량', + 'futs_mxpr': '선물 상한가', + 'futs_llam': '선물 하한가', + 'futs_oprc': '선물 시가2', + 'futs_hgpr': '선물 최고가', + 'futs_lwpr': '선물 최저가', + 'futs_prdy_oprc': '선물 전일 시가', + 'futs_prdy_hgpr': '선물 전일 최고가', + 'futs_prdy_lwpr': '선물 전일 최저가', + 'futs_askp': '선물 매도호가', + 'futs_bidp': '선물 매수호가', + 'basis': '베이시스', + 'kospi200_nmix': 'KOSPI200 지수', + 'kospi200_prdy_vrss': 'KOSPI200 전일 대비', + 'kospi200_prdy_ctrt': 'KOSPI200 전일 대비율', + 'kospi200_prdy_vrss_sign': 'KOSPI200 전일 대비 부호', + 'hts_otst_stpl_qty': 'HTS 미결제 약정 수량', + 'otst_stpl_qty_icdc': '미결제 약정 수량 증감', + 'tday_rltv': '당일 체결강도', + 'hts_thpr': 'HTS 이론가', + 'dprt': '괴리율', + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'futs_prpr': '선물 현재가', + 'futs_oprc': '선물 시가2', + 'futs_hgpr': '선물 최고가', + 'futs_lwpr': '선물 최저가', + 'cntg_vol': '체결 거래량', + 'acml_tr_pbmn': '누적 거래 대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 분봉조회 테스트 함수 + + 이 함수는 선물옵션 분봉조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_time_fuopchartprice( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101T12", + fid_hour_cls_code="60", + fid_pw_data_incu_yn="Y", + fid_fake_tick_incu_yn="N", + fid_input_date_1="20230901", + fid_input_hour_1="100000" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/inquire_time_fuopchartprice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/inquire_time_fuopchartprice.py new file mode 100644 index 0000000..062d8d8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/inquire_time_fuopchartprice/inquire_time_fuopchartprice.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 분봉조회[v1_국내선물-012] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/quotations/inquire-time-fuopchartprice" + +def inquire_time_fuopchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 (F: 지수선물, O: 지수옵션) + fid_input_iscd: str, # FID 입력 종목코드 (101T12) + fid_hour_cls_code: str, # FID 시간 구분 코드 (30: 30초, 60: 1분) + fid_pw_data_incu_yn: str, # FID 과거 데이터 포함 여부 (Y:과거, N: 당일) + fid_fake_tick_incu_yn: str, # FID 허봉 포함 여부 (N) + fid_input_date_1: str, # FID 입력 날짜1 (20230901) + fid_input_hour_1: str # FID 입력 시간1 (100000) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 분봉조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 102건까지 확인 가능하며, + FID_INPUT_DATE_1(입력날짜), FID_INPUT_HOUR_1(입력시간)을 이용하여 다음 조회 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101T12) + fid_hour_cls_code (str): [필수] FID 시간 구분 코드 (ex. 30: 30초, 60: 1분) + fid_pw_data_incu_yn (str): [필수] FID 과거 데이터 포함 여부 (ex. Y:과거, N: 당일) + fid_fake_tick_incu_yn (str): [필수] FID 허봉 포함 여부 (ex. N) + fid_input_date_1 (str): [필수] FID 입력 날짜1 (ex. 20230901) + fid_input_hour_1 (str): [필수] FID 입력 시간1 (ex. 100000) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션 분봉 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_time_fuopchartprice("F", "101T12", "60", "Y", "N", "20230901", "100000") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F: 지수선물, O: 지수옵션')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101T12')") + + if fid_hour_cls_code == "": + raise ValueError("fid_hour_cls_code is required (e.g. '30: 30초, 60: 1분')") + + if fid_pw_data_incu_yn == "": + raise ValueError("fid_pw_data_incu_yn is required (e.g. 'Y:과거, N: 당일')") + + if fid_fake_tick_incu_yn == "": + raise ValueError("fid_fake_tick_incu_yn is required (e.g. 'N')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20230901')") + + if fid_input_hour_1 == "": + raise ValueError("fid_input_hour_1 is required (e.g. '100000')") + + tr_id = "FHKIF03020200" # 선물옵션 분봉조회 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_FAKE_TICK_INCU_YN": fid_fake_tick_incu_yn, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1: object array -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2: array -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/chk_krx_ngt_futures_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/chk_krx_ngt_futures_asking_price.py new file mode 100644 index 0000000..13527a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/chk_krx_ngt_futures_asking_price.py @@ -0,0 +1,103 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_futures_asking_price import krx_ngt_futures_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간호가 [실시간-065] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_askp1": "선물 매도호가1", + "futs_askp2": "선물 매도호가2", + "futs_askp3": "선물 매도호가3", + "futs_askp4": "선물 매도호가4", + "futs_askp5": "선물 매도호가5", + "futs_bidp1": "선물 매수호가1", + "futs_bidp2": "선물 매수호가2", + "futs_bidp3": "선물 매수호가3", + "futs_bidp4": "선물 매수호가4", + "futs_bidp5": "선물 매수호가5", + "askp_csnu1": "매도호가 건수1", + "askp_csnu2": "매도호가 건수2", + "askp_csnu3": "매도호가 건수3", + "askp_csnu4": "매도호가 건수4", + "askp_csnu5": "매도호가 건수5", + "bidp_csnu1": "매수호가 건수1", + "bidp_csnu2": "매수호가 건수2", + "bidp_csnu3": "매수호가 건수3", + "bidp_csnu4": "매수호가 건수4", + "bidp_csnu5": "매수호가 건수5", + "askp_rsqn1": "매도호가 잔량1", + "askp_rsqn2": "매도호가 잔량2", + "askp_rsqn3": "매도호가 잔량3", + "askp_rsqn4": "매도호가 잔량4", + "askp_rsqn5": "매도호가 잔량5", + "bidp_rsqn1": "매수호가 잔량1", + "bidp_rsqn2": "매수호가 잔량2", + "bidp_rsqn3": "매수호가 잔량3", + "bidp_rsqn4": "매수호가 잔량4", + "bidp_rsqn5": "매수호가 잔량5", + "total_askp_csnu": "총 매도호가 건수", + "total_bidp_csnu": "총 매수호가 건수", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "total_askp_rsqn_icdc": "총 매도호가 잔량 증감", + "total_bidp_rsqn_icdc": "총 매수호가 잔량 증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간선물 실시간호가 조회 테스트 함수 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_futures_asking_price, data=["101W09"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/krx_ngt_futures_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/krx_ngt_futures_asking_price.py new file mode 100644 index 0000000..dc16d49 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_asking_price/krx_ngt_futures_asking_price.py @@ -0,0 +1,99 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간호가 [실시간-065] +############################################################################################## + +def krx_ngt_futures_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + ※ 선물옵션 호가 데이터는 0.2초 필터링 옵션이 있습니다. + 필터링 사유는 순간적으로 데이터가 폭증할 경우 서버 뿐만아니라 클라이언트 환경에도 부하를 줄 수 있어 적용된 사항인 점 양해 부탁드립니다. + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_asking_price("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/chk_krx_ngt_futures_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/chk_krx_ngt_futures_ccnl.py new file mode 100644 index 0000000..daf4ce7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/chk_krx_ngt_futures_ccnl.py @@ -0,0 +1,115 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_futures_ccnl import krx_ngt_futures_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간종목체결 [실시간-064] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물 단축 종목코드", + "bsop_hour": "영업 시간", + "futs_prdy_vrss": "선물 전일 대비", + "prdy_vrss_sign": "전일 대비 부호", + "futs_prdy_ctrt": "선물 전일 대비율", + "futs_prpr": "선물 현재가", + "futs_oprc": "선물 시가2", + "futs_hgpr": "선물 최고가", + "futs_lwpr": "선물 최저가", + "last_cnqn": "최종 거래량", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "hts_thpr": "HTS 이론가", + "mrkt_basis": "시장 베이시스", + "dprt": "괴리율", + "nmsc_fctn_stpl_prc": "근월물 약정가", + "fmsc_fctn_stpl_prc": "원월물 약정가", + "spead_prc": "스프레드1", + "hts_otst_stpl_qty": "HTS 미결제 약정 수량", + "otst_stpl_qty_icdc": "미결제 약정 수량 증감", + "oprc_hour": "시가 시간", + "oprc_vrss_prpr_sign": "시가2 대비 현재가 부호", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "hgpr_hour": "최고가 시간", + "hgpr_vrss_prpr_sign": "최고가 대비 현재가 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "lwpr_hour": "최저가 시간", + "lwpr_vrss_prpr_sign": "최저가 대비 현재가 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "shnu_rate": "매수2 비율", + "cttr": "체결강도", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제 약정 직전 수량 증감", + "thpr_basis": "이론 베이시스", + "futs_askp1": "선물 매도호가1", + "futs_bidp1": "선물 매수호가1", + "askp_rsqn1": "매도호가 잔량1", + "bidp_rsqn1": "매수호가 잔량1", + "seln_cntg_csnu": "매도 체결 건수", + "shnu_cntg_csnu": "매수 체결 건수", + "ntby_cntg_csnu": "순매수 체결 건수", + "seln_cntg_smtn": "총 매도 수량", + "shnu_cntg_smtn": "총 매수 수량", + "total_askp_rsqn": "총 매도호가 잔량", + "total_bidp_rsqn": "총 매수호가 잔량", + "prdy_vol_vrss_acml_vol_rate": "전일 거래량 대비 등락율", + "dynm_mxpr": "실시간상한가", + "dynm_llam": "실시간하한가", + "dynm_prc_limt_yn": "실시간가격제한구분" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내선물옵션] 실시간시세 > KRX야간선물 실시간종목체결 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_futures_ccnl, data=["101W9000"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/krx_ngt_futures_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/krx_ngt_futures_ccnl.py new file mode 100644 index 0000000..7f26dd3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl/krx_ngt_futures_ccnl.py @@ -0,0 +1,108 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간종목체결 [실시간-064] +############################################################################################## + +def krx_ngt_futures_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/chk_krx_ngt_futures_ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/chk_krx_ngt_futures_ccnl_notice.py new file mode 100644 index 0000000..eadea59 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/chk_krx_ngt_futures_ccnl_notice.py @@ -0,0 +1,85 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_futures_ccnl_notice import krx_ngt_futures_ccnl_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간체결통보 [실시간-066] +############################################################################################## + +COLUMN_MAPPING = { + "cust_id": "고객 ID", + "acnt_no": "계좌번호", + "oder_no": "주문번호", + "ooder_no": "원주문번호", + "seln_byov_cls": "매도매수구분", + "rctf_cls": "정정구분", + "oder_kind2": "주문종류2", + "stck_shrn_iscd": "주식 단축 종목코드", + "cntg_qty": "체결 수량", + "cntg_unpr": "체결단가", + "stck_cntg_hour": "주식 체결 시간", + "rfus_yn": "거부여부", + "cntg_yn": "체결여부", + "acpt_yn": "접수여부", + "brnc_no": "지점번호", + "oder_qty": "주문수량", + "acnt_name": "계좌명", + "cntg_isnm": "체결종목명", + "oder_cond": "주문조건" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간선물 실시간체결통보 테스트 함수 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_futures_ccnl_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/krx_ngt_futures_ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/krx_ngt_futures_ccnl_notice.py new file mode 100644 index 0000000..f6f68af --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_futures_ccnl_notice/krx_ngt_futures_ccnl_notice.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간체결통보 [실시간-066] +############################################################################################## + +def krx_ngt_futures_ccnl_notice( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/chk_krx_ngt_option_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/chk_krx_ngt_option_asking_price.py new file mode 100644 index 0000000..ace36db --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/chk_krx_ngt_option_asking_price.py @@ -0,0 +1,103 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_option_asking_price import krx_ngt_option_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간호가 [실시간-033] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션단축종목코드", + "bsop_hour": "영업시간", + "optn_askp1": "옵션매도호가1", + "optn_askp2": "옵션매도호가2", + "optn_askp3": "옵션매도호가3", + "optn_askp4": "옵션매도호가4", + "optn_askp5": "옵션매도호가5", + "optn_bidp1": "옵션매수호가1", + "optn_bidp2": "옵션매수호가2", + "optn_bidp3": "옵션매수호가3", + "optn_bidp4": "옵션매수호가4", + "optn_bidp5": "옵션매수호가5", + "askp_csnu1": "매도호가건수1", + "askp_csnu2": "매도호가건수2", + "askp_csnu3": "매도호가건수3", + "askp_csnu4": "매도호가건수4", + "askp_csnu5": "매도호가건수5", + "bidp_csnu1": "매수호가건수1", + "bidp_csnu2": "매수호가건수2", + "bidp_csnu3": "매수호가건수3", + "bidp_csnu4": "매수호가건수4", + "bidp_csnu5": "매수호가건수5", + "askp_rsqn1": "매도호가잔량1", + "askp_rsqn2": "매도호가잔량2", + "askp_rsqn3": "매도호가잔량3", + "askp_rsqn4": "매도호가잔량4", + "askp_rsqn5": "매도호가잔량5", + "bidp_rsqn1": "매수호가잔량1", + "bidp_rsqn2": "매수호가잔량2", + "bidp_rsqn3": "매수호가잔량3", + "bidp_rsqn4": "매수호가잔량4", + "bidp_rsqn5": "매수호가잔량5", + "total_askp_csnu": "총매도호가건수", + "total_bidp_csnu": "총매수호가건수", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "total_askp_rsqn_icdc": "총매도호가잔량증감", + "total_bidp_rsqn_icdc": "총매수호가잔량증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간옵션 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 - case1 + kws.subscribe(request=krx_ngt_option_asking_price, data=["101W9000"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/krx_ngt_option_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/krx_ngt_option_asking_price.py new file mode 100644 index 0000000..a541c3d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_asking_price/krx_ngt_option_asking_price.py @@ -0,0 +1,97 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간호가 [실시간-033] +############################################################################################## + +def krx_ngt_option_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_asking_price("1", "101W09") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/chk_krx_ngt_option_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/chk_krx_ngt_option_ccnl.py new file mode 100644 index 0000000..096e75e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/chk_krx_ngt_option_ccnl.py @@ -0,0 +1,121 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_option_ccnl import krx_ngt_option_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간체결가 [실시간-032] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션단축종목코드", + "bsop_hour": "영업시간", + "optn_prpr": "옵션현재가", + "prdy_vrss_sign": "전일대비부호", + "optn_prdy_vrss": "옵션전일대비", + "prdy_ctrt": "전일대비율", + "optn_oprc": "옵션시가2", + "optn_hgpr": "옵션최고가", + "optn_lwpr": "옵션최저가", + "last_cnqn": "최종거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "hts_thpr": "HTS이론가", + "hts_otst_stpl_qty": "HTS미결제약정수량", + "otst_stpl_qty_icdc": "미결제약정수량증감", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가2대비현재가부호", + "oprc_vrss_nmix_prpr": "시가대비지수현재가", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "최고가대비현재가부호", + "hgpr_vrss_nmix_prpr": "최고가대비지수현재가", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "최저가대비현재가부호", + "lwpr_vrss_nmix_prpr": "최저가대비지수현재가", + "shnu_rate": "매수2비율", + "prmm_val": "프리미엄값", + "invl_val": "내재가치값", + "tmvl_val": "시간가치값", + "delta": "델타", + "gama": "감마", + "vega": "베가", + "theta": "세타", + "rho": "로우", + "hts_ints_vltl": "HTS내재변동성", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제약정직전수량증감", + "thpr_basis": "이론베이시스", + "unas_hist_vltl": "역사적변동성", + "cttr": "체결강도", + "dprt": "괴리율", + "mrkt_basis": "시장베이시스", + "optn_askp1": "옵션매도호가1", + "optn_bidp1": "옵션매수호가1", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "dynm_mxpr": "실시간상한가", + "dynm_prc_limt_yn": "실시간가격제한구분", + "dynm_llam": "실시간하한가" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간옵션 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_option_ccnl, data=["101W9000"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/krx_ngt_option_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/krx_ngt_option_ccnl.py new file mode 100644 index 0000000..778b34c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_ccnl/krx_ngt_option_ccnl.py @@ -0,0 +1,114 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간체결가 [실시간-032] +############################################################################################## + +def krx_ngt_option_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (str): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_prc_limt_yn", + "dynm_llam" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/chk_krx_ngt_option_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/chk_krx_ngt_option_exp_ccnl.py new file mode 100644 index 0000000..308b734 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/chk_krx_ngt_option_exp_ccnl.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_option_exp_ccnl import krx_ngt_option_exp_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간예상체결 [실시간-034] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션단축종목코드", + "bsop_hour": "영업시간", + "antc_cnpr": "예상체결가", + "antc_cntg_vrss": "예상체결대비", + "antc_cntg_vrss_sign": "예상체결대비부호", + "antc_cntg_prdy_ctrt": "예상체결전일대비율", + "antc_mkop_cls_code": "예상장운영구분코드", + "antc_cnqn": "예상체결수량" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간옵션실시간예상체결 조회 테스트 함수 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_option_exp_ccnl, data=["101W9000"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/krx_ngt_option_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/krx_ngt_option_exp_ccnl.py new file mode 100644 index 0000000..8119c15 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_exp_ccnl/krx_ngt_option_exp_ccnl.py @@ -0,0 +1,67 @@ +""" +Created on 20250601 +""" + +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간예상체결 [실시간-034] +############################################################################################## + +def krx_ngt_option_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 + KRX야간옵션실시간예상체결 [실시간-034] + + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_exp_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code", + "antc_cnqn" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/chk_krx_ngt_option_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/chk_krx_ngt_option_notice.py new file mode 100644 index 0000000..b759b18 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/chk_krx_ngt_option_notice.py @@ -0,0 +1,86 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from krx_ngt_option_notice import krx_ngt_option_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간체결통보 [실시간-067] +############################################################################################## + +COLUMN_MAPPING = { + "cust_id": "고객 ID", + "acnt_no": "계좌번호", + "oder_no": "주문번호", + "ooder_no": "원주문번호", + "seln_byov_cls": "매도매수구분", + "rctf_cls": "정정구분", + "oder_kind2": "주문종류2", + "stck_shrn_iscd": "주식 단축 종목코드", + "cntg_qty": "체결 수량", + "cntg_unpr": "체결단가", + "stck_cntg_hour": "주식 체결 시간", + "rfus_yn": "거부여부", + "cntg_yn": "체결여부", + "acpt_yn": "접수여부", + "brnc_no": "지점번호", + "oder_qty": "주문수량", + "acnt_name": "계좌명", + "cntg_isnm": "체결종목명", + "oder_cond": "주문조건" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + KRX야간옵션실시간체결통보 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=krx_ngt_option_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/krx_ngt_option_notice.py b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/krx_ngt_option_notice.py new file mode 100644 index 0000000..74fe69a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/krx_ngt_option_notice/krx_ngt_option_notice.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간체결통보 [실시간-067] +############################################################################################## + +def krx_ngt_option_notice( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 고객 ID + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/chk_ngt_margin_detail.py b/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/chk_ngt_margin_detail.py new file mode 100644 index 0000000..c1958f1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/chk_ngt_margin_detail.py @@ -0,0 +1,166 @@ +""" +Created on 20250116 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ngt_margin_detail import ngt_margin_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 증거금 상세 [국내선물-024] +############################################################################################## + +COLUMN_MAPPING = { + 'futr_new_mgn_amt': '선물신규증거금액', + 'futr_sprd_ord_mgna': '선물스프레드주문증거금', + 'opt_sll_new_mgn_amt': '옵션매도신규증거금액', + 'opt_buy_new_mgn_amt': '옵션매수신규증거금액', + 'new_mgn_amt': '신규증거금액', + 'opt_pric_mgna': '옵션가격증거금', + 'fuop_pric_altr_mgna': '선물옵션가격변동증거금', + 'futr_sprd_mgna': '선물스프레드증거금', + 'uwdl_mgna': '인수도증거금', + 'ctrt_per_min_mgna': '계약당최소증거금', + 'tot_risk_mgna': '총위험증거금', + 'netrisk_brkg_mgna': '순위험위탁증거금', + 'opt_sll_chgs': '옵션매도대금', + 'opt_buy_chgs': '옵션매수대금', + 'futr_loss_amt': '선물손실금액', + 'futr_prft_amt': '선물이익금액', + 'thdt_ccld_net_loss_amt': '당일체결순손실금액', + 'brkg_mgna': '위탁증거금', + 'futr_new_mgn_amt': '선물신규증거금액', + 'futr_sprd_ord_mgna': '선물스프레드주문증거금', + 'opt_sll_new_mgn_amt': '옵션매도신규증거금액', + 'opt_buy_new_mgn_amt': '옵션매수신규증거금액', + 'new_mgn_amt': '신규증거금액', + 'opt_pric_mgna': '옵션가격증거금', + 'fuop_pric_altr_mgna': '선물옵션가격변동증거금', + 'futr_sprd_mgna': '선물스프레드증거금', + 'uwdl_mgna': '인수도증거금', + 'ctrt_per_min_mgna': '계약당최소증거금', + 'tot_risk_mgna': '총위험증거금', + 'netrisk_brkg_mgna': '순위험위탁증거금', + 'opt_sll_chgs': '옵션매도대금', + 'opt_buy_chgs': '옵션매수대금', + 'futr_loss_amt': '선물손실금액', + 'futr_prft_amt': '선물이익금액', + 'thdt_ccld_net_loss_amt': '당일체결순손실금액', + 'brkg_mgna': '위탁증거금', + 'dnca_cash': '예수금현금', + 'dnca_sbst': '예수금대용', + 'dnca_tota': '예수금총액', + 'wdrw_psbl_cash_amt': '인출가능현금금액', + 'wdrw_psbl_sbsa': '인출가능대용금액', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'ord_psbl_cash_amt': '주문가능현금금액', + 'ord_psbl_sbsa': '주문가능대용금액', + 'ord_psbl_tot_amt': '주문가능총금액', + 'brkg_mgna_cash_amt': '위탁증거금현금금액', + 'brkg_mgna_sbst': '위탁증거금대용', + 'brkg_mgna_tot_amt': '위탁증거금총금액', + 'add_mgna_cash_amt': '추가증거금현금금액', + 'add_mgna_sbsa': '추가증거금대용금액', + 'add_mgna_tot_amt': '추가증거금총금액', + 'bfdy_sbst_sll_sbst_amt': '전일대용매도대용금액', + 'thdt_sbst_sll_sbst_amt': '당일대용매도대용금액', + 'bfdy_sbst_sll_ccld_amt': '전일대용매도체결금액', + 'thdt_sbst_sll_ccld_amt': '당일대용매도체결금액', + 'opt_dfpa': '옵션차금', + 'excc_dfpa': '정산차금', + 'fee_amt': '수수료금액', + 'nxdy_dncl_amt': '익일예수금액', + 'prsm_dpast_amt': '추정예탁자산금액', + 'opt_buy_exus_acnt_yn': '옵션매수전용계좌여부', + 'base_dpsa_gdat_grad_cd': '기본예탁금차등등급코드', + 'opt_base_dpsa_gdat_grad_cd': '옵션기본예탁금차등등급코드' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + (야간)선물옵션 증거금 상세 조회 테스트 함수 + + 이 함수는 (야간)선물옵션 증거금 상세 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2, result3 = ngt_margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn_cd="01") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + # output3 처리 + logging.info("=== output3 결과 ===") + logging.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 컬럼명 한글 변환 + result3 = result3.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logging.info("결과:") + print(result3) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/ngt_margin_detail.py b/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/ngt_margin_detail.py new file mode 100644 index 0000000..4d08285 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/ngt_margin_detail/ngt_margin_detail.py @@ -0,0 +1,74 @@ +""" +Created on 20250116 +""" + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 증거금 상세 [국내선물-024] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/ngt-margin-detail" + + +def ngt_margin_detail( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + mgna_dvsn_cd: str # 증거금 구분코드 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 증거금상세 API입니다. + 한국투자 HTS(eFriend Force) > [2537] 야간선물옵션 증거금상세 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + mgna_dvsn_cd (str): [필수] 증거금 구분코드 (ex. 01:위탁, 02:유지) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: (output1, output2, output3) 데이터프레임 + + Example: + >>> df1, df2, df3 = ngt_margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn_cd="01") + >>> print(df1) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if mgna_dvsn_cd == "": + raise ValueError("mgna_dvsn_cd is required (e.g. '01:위탁, 02:유지')") + + tr_id = "CTFN7107R" # (야간)선물옵션 증거금 상세 + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN_CD": mgna_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame(res.getBody().output1) + output2_data = pd.DataFrame(res.getBody().output2) + output3_data = pd.DataFrame([res.getBody().output3]) + + return output1_data, output2_data, output3_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/chk_option_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/chk_option_exp_ccnl.py new file mode 100644 index 0000000..a4f5848 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/chk_option_exp_ccnl.py @@ -0,0 +1,73 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from option_exp_ccnl import option_exp_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간예상체결 [실시간-046] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "옵션단축종목코드", + "bsop_hour": "영업시간", + "antc_cnpr": "예상체결가", + "antc_cntg_vrss": "예상체결대비", + "antc_cntg_vrss_sign": "예상체결대비부호", + "antc_cntg_prdy_ctrt": "예상체결전일대비율", + "antc_mkop_cls_code": "예상장운영구분코드" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식옵션 실시간예상체결 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 - case1 + kws.subscribe(request=option_exp_ccnl, data=["339W08088"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/option_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/option_exp_ccnl.py new file mode 100644 index 0000000..fcf5f05 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/option_exp_ccnl/option_exp_ccnl.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간예상체결 [실시간-046] +############################################################################################## + +def option_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 + 주식옵션 실시간예상체결 [실시간-046] + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = option_exp_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/order/chk_order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/order/chk_order.py new file mode 100644 index 0000000..d024df3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/order/chk_order.py @@ -0,0 +1,87 @@ +""" +Created on 20250116 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order import order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 주문 테스트 함수 + + 이 함수는 선물옵션 주문 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order( + env_dv="real", + ord_dv="day", + ord_prcs_dvsn_cd="02", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + sll_buy_dvsn_cd="02", + shtn_pdno="101W09", + ord_qty="1", + unit_price="0", + nmpr_type_cd="02", + krx_nmpr_cndt_cd="0", + ord_dvsn_cd="02" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/order/order.py b/한국투자증권(API)/examples_llm/domestic_futureoption/order/order.py new file mode 100644 index 0000000..ccb87f7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/order/order.py @@ -0,0 +1,149 @@ +""" +Created on 20250116 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/order" + +def order( + env_dv: str, # 실전모의구분 + ord_dv: str, # 매도매수구분 + ord_prcs_dvsn_cd: str, # 주문처리구분코드 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + shtn_pdno: str, # 단축상품번호 + ord_qty: str, # 주문수량 + unit_price: str, # 주문가격1 + nmpr_type_cd: str, # 호가유형코드 + krx_nmpr_cndt_cd: str, # 한국거래소호가조건코드 + ord_dvsn_cd: str, # 주문구분코드 + ctac_tlno: str = "", # 연락전화번호 + fuop_item_dvsn_cd: str = "" # 선물옵션종목구분코드 +) -> pd.DataFrame: + """ + [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] + 선물옵션 주문 API입니다. + * 선물옵션 운영시간 외 API 호출 시 애러가 발생하오니 운영시간을 확인해주세요. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd (str): [필수] 주문처리구분코드 (ex. 02:주문전송) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도, 02:매수) + shtn_pdno (str): [필수] 단축상품번호 (ex. 종목번호, 선물 6자리 (예: 101W09), 옵션 9자리 (예: 201S03370)) + ord_qty (str): [필수] 주문수량 + unit_price (str): [필수] 주문가격1 (ex. 시장가나 최유리 지정가인 경우 0으로 입력) + nmpr_type_cd (str): [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd (str): [필수] 한국거래소호가조건코드 (ex. 0:없음, 3:IOC, 4:FOK) + ord_dvsn_cd (str): [필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK)) + ctac_tlno (str): 연락전화번호 (ex. 고객의 연락 가능한 전화번호) + fuop_item_dvsn_cd (str): 선물옵션종목구분코드 (ex. 공란(Default)) + + Returns: + pd.DataFrame: 선물옵션 주문 결과 데이터 + + Example: + >>> df = order(env_dv="real", ord_dv="day", ord_prcs_dvsn_cd="02", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, sll_buy_dvsn_cd="02", shtn_pdno="101W09", ord_qty="1", unit_price="0", nmpr_type_cd="02", krx_nmpr_cndt_cd="0", ord_dvsn_cd="02") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + if ord_dv == "": + raise ValueError("ord_dv is required (e.g. 'day', 'night')") + + if ord_prcs_dvsn_cd == "": + raise ValueError("ord_prcs_dvsn_cd is required (e.g. '02')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01', '02')") + + if shtn_pdno == "": + raise ValueError("shtn_pdno is required (e.g. '101W09', '201S03370')") + + if ord_qty == "": + raise ValueError("ord_qty is required") + + if unit_price == "": + raise ValueError("unit_price is required (e.g. '0')") + + if nmpr_type_cd == "": + raise ValueError("nmpr_type_cd is required (e.g. '01', '02', '03', '04')") + + if krx_nmpr_cndt_cd == "": + raise ValueError("krx_nmpr_cndt_cd is required (e.g. '0', '3', '4')") + + if ord_dvsn_cd == "": + raise ValueError("ord_dvsn_cd is required (e.g. '01', '02', '03', '04', '10', '11', '12', '13', '14', '15')") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "day": + tr_id = "TTTO1101U" + elif ord_dv == "night": + tr_id = "STTN1101U" + else: + raise ValueError("ord_dv can only be 'day' or 'night'") + elif env_dv == "demo": + if ord_dv == "day": + tr_id = "VTTO1101U" + else: + raise ValueError("ord_dv can only be 'day' for demo environment") + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "ORD_PRCS_DVSN_CD": ord_prcs_dvsn_cd, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "SHTN_PDNO": shtn_pdno, + "ORD_QTY": ord_qty, + "UNIT_PRICE": unit_price, + "NMPR_TYPE_CD": nmpr_type_cd, + "KRX_NMPR_CNDT_CD": krx_nmpr_cndt_cd, + "ORD_DVSN_CD": ord_dvsn_cd, + "CTAC_TLNO": ctac_tlno, + "FUOP_ITEM_DVSN_CD": fuop_item_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/chk_order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/chk_order_rvsecncl.py new file mode 100644 index 0000000..48e310a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/chk_order_rvsecncl.py @@ -0,0 +1,92 @@ +""" +Created on 20250114 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_rvsecncl import order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] +############################################################################################## + +COLUMN_MAPPING = { + 'ACNT_NAME': '계좌명', + 'TRAD_DVSN_NAME': '매매구분명', + 'ITEM_NAME': '종목명', + 'ORD_TMD': '주문시각', + 'ORD_GNO_BRNO': '주문채번지점번호', + 'ORGN_ODNO': '원주문번호', + 'ODNO': '주문번호' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 선물옵션 정정취소주문 조회 테스트 함수 + + 이 함수는 선물옵션 정정취소주문 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result = order_rvsecncl( + env_dv="real", + day_dv="day", + ord_prcs_dvsn_cd="02", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rvse_cncl_dvsn_cd="02", + orgn_odno="0000004018", + ord_qty="0", + unit_price="0", + nmpr_type_cd="02", + krx_nmpr_cndt_cd="0", + rmn_qty_yn="Y", + ord_dvsn_cd="01" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/order_rvsecncl.py new file mode 100644 index 0000000..adfd732 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/order_rvsecncl/order_rvsecncl.py @@ -0,0 +1,113 @@ +""" +Created on 20250114 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-futureoption/v1/trading/order-rvsecncl" + +def order_rvsecncl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + day_dv: str, # [필수] 주야간구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd: str, # [필수] 주문처리구분코드 (ex. 02) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + rvse_cncl_dvsn_cd: str, # [필수] 정정취소구분코드 (ex. 01:정정, 02:취소) + orgn_odno: str, # [필수] 원주문번호 + ord_qty: str, # [필수] 주문수량 (ex. 0:전량, 그 외는 수량) + unit_price: str, # [필수] 주문가격1 (ex 0:시장가/최유리, 그 외 가격) + nmpr_type_cd: str, # [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd: str, # [필수] 한국거래소호가조건코드 (ex. 0:취소/없음, 3:IOC, 4:FOK) + rmn_qty_yn: str, # [필수] 잔여수량여부 (ex. Y:전량, N:일부) + ord_dvsn_cd: str, # [필수] 주문구분코드 + fuop_item_dvsn_cd: str = "" # 선물옵션종목구분코드 +) -> pd.DataFrame: + """ + 선물옵션 주문 건에 대하여 정정 및 취소하는 API입니다. 단, 이미 체결된 건은 정정 및 취소가 불가합니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + day_dv (str): [필수] 주야간구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd (str): [필수] 주문처리구분코드 (ex. 02) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + rvse_cncl_dvsn_cd (str): [필수] 정정취소구분코드 (ex. 01:정정, 02:취소) + orgn_odno (str): [필수] 원주문번호 + ord_qty (str): [필수] 주문수량 (ex. 0:전량, 그 외는 수량) + unit_price (str): [필수] 주문가격1 (ex 0:시장가/최유리, 그 외 가격) + nmpr_type_cd (str): [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd (str): [필수] 한국거래소호가조건코드 (ex. 0:취소/없음, 3:IOC, 4:FOK) + rmn_qty_yn (str): [필수] 잔여수량여부 (ex. Y:전량, N:일부) + ord_dvsn_cd (str): [필수] 주문구분코드 + fuop_item_dvsn_cd (str): 선물옵션종목구분코드 + + Returns: + pd.DataFrame: 선물옵션 정정취소주문 결과 데이터 + + Example: + >>> df = order_rvsecncl( + ... env_dv="real", day_dv="day", ord_prcs_dvsn_cd="02", + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rvse_cncl_dvsn_cd="02", + ... orgn_odno="0000004018", ord_qty="0", unit_price="0", + ... nmpr_type_cd="02", krx_nmpr_cndt_cd="0", rmn_qty_yn="Y", + ... ord_dvsn_cd="01" + ... ) + >>> print(df) + """ + + # tr_id 설정 + if env_dv == "real": + if day_dv == "day": + tr_id = "TTTO1103U" + elif day_dv == "night": + tr_id = "TTTN1103U" + else: + raise ValueError("day_dv can only be 'day' or 'night'") + elif env_dv == "demo": + if day_dv == "day": + tr_id = "VTTO1103U" + else: + raise ValueError("day_dv can only be 'day' for demo environment") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "ORD_PRCS_DVSN_CD": ord_prcs_dvsn_cd, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORGN_ODNO": orgn_odno, + "ORD_QTY": ord_qty, + "UNIT_PRICE": unit_price, + "NMPR_TYPE_CD": nmpr_type_cd, + "KRX_NMPR_CNDT_CD": krx_nmpr_cndt_cd, + "RMN_QTY_YN": rmn_qty_yn, + "ORD_DVSN_CD": ord_dvsn_cd, + "FUOP_ITEM_DVSN_CD": fuop_item_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/chk_stock_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/chk_stock_futures_realtime_conclusion.py new file mode 100644 index 0000000..64c0af8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/chk_stock_futures_realtime_conclusion.py @@ -0,0 +1,116 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +from stock_futures_realtime_conclusion import stock_futures_realtime_conclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간체결가 [실시간-029] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물단축종목코드", + "bsop_hour": "영업시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비부호", + "prdy_vrss": "전일대비", + "futs_prdy_ctrt": "선물전일대비율", + "stck_oprc": "주식시가2", + "stck_hgpr": "주식최고가", + "stck_lwpr": "주식최저가", + "last_cnqn": "최종거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "hts_thpr": "HTS이론가", + "mrkt_basis": "시장베이시스", + "dprt": "괴리율", + "nmsc_fctn_stpl_prc": "근월물약정가", + "fmsc_fctn_stpl_prc": "원월물약정가", + "spead_prc": "스프레드1", + "hts_otst_stpl_qty": "HTS미결제약정수량", + "otst_stpl_qty_icdc": "미결제약정수량증감", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가2대비현재가부호", + "oprc_vrss_prpr": "시가2대비현재가", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "최고가대비현재가부호", + "hgpr_vrss_prpr": "최고가대비현재가", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "최저가대비현재가부호", + "lwpr_vrss_prpr": "최저가대비현재가", + "shnu_rate": "매수2비율", + "cttr": "체결강도", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제약정직전수량증감", + "thpr_basis": "이론베이시스", + "askp1": "매도호가1", + "bidp1": "매수호가1", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "dynm_mxpr": "실시간상한가", + "dynm_llam": "실시간하한가", + "dynm_prc_limt_yn": "실시간가격제한구분" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식선물 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=stock_futures_realtime_conclusion, data=["111W08"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/stock_futures_realtime_conclusion.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/stock_futures_realtime_conclusion.py new file mode 100644 index 0000000..d45d23d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_conclusion/stock_futures_realtime_conclusion.py @@ -0,0 +1,108 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간체결가 [실시간-029] +############################################################################################## + +def stock_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 주식선물의 실시간 체결가 정보를 수신할 수 있습니다. + 주식 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = stock_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "futs_prdy_ctrt", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "askp1", + "bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/chk_stock_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/chk_stock_futures_realtime_quote.py new file mode 100644 index 0000000..3344c08 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/chk_stock_futures_realtime_quote.py @@ -0,0 +1,135 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +from stock_futures_realtime_quote import stock_futures_realtime_quote + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간호가 [실시간-030] +############################################################################################## + +COLUMN_MAPPING = { + "futs_shrn_iscd": "선물단축종목코드", + "bsop_hour": "영업시간", + "askp1": "매도호가1", + "askp2": "매도호가2", + "askp3": "매도호가3", + "askp4": "매도호가4", + "askp5": "매도호가5", + "askp6": "매도호가6", + "askp7": "매도호가7", + "askp8": "매도호가8", + "askp9": "매도호가9", + "askp10": "매도호가10", + "bidp1": "매수호가1", + "bidp2": "매수호가2", + "bidp3": "매수호가3", + "bidp4": "매수호가4", + "bidp5": "매수호가5", + "bidp6": "매수호가6", + "bidp7": "매수호가7", + "bidp8": "매수호가8", + "bidp9": "매수호가9", + "bidp10": "매수호가10", + "askp_csnu1": "매도호가건수1", + "askp_csnu2": "매도호가건수2", + "askp_csnu3": "매도호가건수3", + "askp_csnu4": "매도호가건수4", + "askp_csnu5": "매도호가건수5", + "askp_csnu6": "매도호가건수6", + "askp_csnu7": "매도호가건수7", + "askp_csnu8": "매도호가건수8", + "askp_csnu9": "매도호가건수9", + "askp_csnu10": "매도호가건수10", + "bidp_csnu1": "매수호가건수1", + "bidp_csnu2": "매수호가건수2", + "bidp_csnu3": "매수호가건수3", + "bidp_csnu4": "매수호가건수4", + "bidp_csnu5": "매수호가건수5", + "bidp_csnu6": "매수호가건수6", + "bidp_csnu7": "매수호가건수7", + "bidp_csnu8": "매수호가건수8", + "bidp_csnu9": "매수호가건수9", + "bidp_csnu10": "매수호가건수10", + "askp_rsqn1": "매도호가잔량1", + "askp_rsqn2": "매도호가잔량2", + "askp_rsqn3": "매도호가잔량3", + "askp_rsqn4": "매도호가잔량4", + "askp_rsqn5": "매도호가잔량5", + "askp_rsqn6": "매도호가잔량6", + "askp_rsqn7": "매도호가잔량7", + "askp_rsqn8": "매도호가잔량8", + "askp_rsqn9": "매도호가잔량9", + "askp_rsqn10": "매도호가잔량10", + "bidp_rsqn1": "매수호가잔량1", + "bidp_rsqn2": "매수호가잔량2", + "bidp_rsqn3": "매수호가잔량3", + "bidp_rsqn4": "매수호가잔량4", + "bidp_rsqn5": "매수호가잔량5", + "bidp_rsqn6": "매수호가잔량6", + "bidp_rsqn7": "매수호가잔량7", + "bidp_rsqn8": "매수호가잔량8", + "bidp_rsqn9": "매수호가잔량9", + "bidp_rsqn10": "매수호가잔량10", + "total_askp_csnu": "총매도호가건수", + "total_bidp_csnu": "총매수호가건수", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "total_askp_rsqn_icdc": "총매도호가잔량증감", + "total_bidp_rsqn_icdc": "총매수호가잔량증감" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식선물 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=stock_futures_realtime_quote, data=["111W08"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/stock_futures_realtime_quote.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/stock_futures_realtime_quote.py new file mode 100644 index 0000000..a05fd47 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_futures_realtime_quote/stock_futures_realtime_quote.py @@ -0,0 +1,128 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간호가 [실시간-030] +############################################################################################## + +def stock_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 주식선물의 실시간 호가 정보를 수신할 수 있습니다. + 매도/매수 호가 1~10단계까지의 확장된 호가 정보를 제공하는 특별한 API입니다. + 호가별 건수, 호가별 잔량 등의 상세 정보를 포함합니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = stock_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "askp10", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "bidp10", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "askp_csnu6", + "askp_csnu7", + "askp_csnu8", + "askp_csnu9", + "askp_csnu10", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "bidp_csnu6", + "bidp_csnu7", + "bidp_csnu8", + "bidp_csnu9", + "bidp_csnu10", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/chk_stock_option_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/chk_stock_option_asking_price.py new file mode 100644 index 0000000..bd57098 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/chk_stock_option_asking_price.py @@ -0,0 +1,134 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from stock_option_asking_price import stock_option_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간호가 [실시간-045] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "종목코드", + "bsop_hour": "영업시간", + "optn_askp1": "옵션매도호가1", + "optn_askp2": "옵션매도호가2", + "optn_askp3": "옵션매도호가3", + "optn_askp4": "옵션매도호가4", + "optn_askp5": "옵션매도호가5", + "optn_bidp1": "옵션매수호가1", + "optn_bidp2": "옵션매수호가2", + "optn_bidp3": "옵션매수호가3", + "optn_bidp4": "옵션매수호가4", + "optn_bidp5": "옵션매수호가5", + "askp_csnu1": "매도호가건수1", + "askp_csnu2": "매도호가건수2", + "askp_csnu3": "매도호가건수3", + "askp_csnu4": "매도호가건수4", + "askp_csnu5": "매도호가건수5", + "bidp_csnu1": "매수호가건수1", + "bidp_csnu2": "매수호가건수2", + "bidp_csnu3": "매수호가건수3", + "bidp_csnu4": "매수호가건수4", + "bidp_csnu5": "매수호가건수5", + "askp_rsqn1": "매도호가잔량1", + "askp_rsqn2": "매도호가잔량2", + "askp_rsqn3": "매도호가잔량3", + "askp_rsqn4": "매도호가잔량4", + "askp_rsqn5": "매도호가잔량5", + "bidp_rsqn1": "매수호가잔량1", + "bidp_rsqn2": "매수호가잔량2", + "bidp_rsqn3": "매수호가잔량3", + "bidp_rsqn4": "매수호가잔량4", + "bidp_rsqn5": "매수호가잔량5", + "total_askp_csnu": "총매도호가건수", + "total_bidp_csnu": "총매수호가건수", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "total_askp_rsqn_icdc": "총매도호가잔량증감", + "total_bidp_rsqn_icdc": "총매수호가잔량증감", + "optn_askp6": "옵션매도호가6", + "optn_askp7": "옵션매도호가7", + "optn_askp8": "옵션매도호가8", + "optn_askp9": "옵션매도호가9", + "optn_askp10": "옵션매도호가10", + "optn_bidp6": "옵션매수호가6", + "optn_bidp7": "옵션매수호가7", + "optn_bidp8": "옵션매수호가8", + "optn_bidp9": "옵션매수호가9", + "optn_bidp10": "옵션매수호가10", + "askp_csnu6": "매도호가건수6", + "askp_csnu7": "매도호가건수7", + "askp_csnu8": "매도호가건수8", + "askp_csnu9": "매도호가건수9", + "askp_csnu10": "매도호가건수10", + "bidp_csnu6": "매수호가건수6", + "bidp_csnu7": "매수호가건수7", + "bidp_csnu8": "매수호가건수8", + "bidp_csnu9": "매수호가건수9", + "bidp_csnu10": "매수호가건수10", + "askp_rsqn6": "매도호가잔량6", + "askp_rsqn7": "매도호가잔량7", + "askp_rsqn8": "매도호가잔량8", + "askp_rsqn9": "매도호가잔량9", + "askp_rsqn10": "매도호가잔량10", + "bidp_rsqn6": "매수호가잔량6", + "bidp_rsqn7": "매수호가잔량7", + "bidp_rsqn8": "매수호가잔량8", + "bidp_rsqn9": "매수호가잔량9", + "bidp_rsqn10": "매수호가잔량10" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내선물옵션 주식옵션 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=stock_option_asking_price, data=["239W08090"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/stock_option_asking_price.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/stock_option_asking_price.py new file mode 100644 index 0000000..5c1dcd3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_asking_price/stock_option_asking_price.py @@ -0,0 +1,124 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간호가 [실시간-045] +############################################################################################## + +def stock_option_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 국내선물옵션 주식옵션 실시간호가 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = stock_option_asking_price("1", "111W80") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc", + "optn_askp6", + "optn_askp7", + "optn_askp8", + "optn_askp9", + "optn_askp10", + "optn_bidp6", + "optn_bidp7", + "optn_bidp8", + "optn_bidp9", + "optn_bidp10", + "askp_csnu6", + "askp_csnu7", + "askp_csnu8", + "askp_csnu9", + "askp_csnu10", + "bidp_csnu6", + "bidp_csnu7", + "bidp_csnu8", + "bidp_csnu9", + "bidp_csnu10", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/chk_stock_option_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/chk_stock_option_ccnl.py new file mode 100644 index 0000000..88ad14c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/chk_stock_option_ccnl.py @@ -0,0 +1,119 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from stock_option_ccnl import stock_option_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간체결가 [실시간-044] +############################################################################################## + +COLUMN_MAPPING = { + "optn_shrn_iscd": "종목코드", + "bsop_hour": "영업시간", + "optn_prpr": "옵션현재가", + "prdy_vrss_sign": "전일대비부호", + "optn_prdy_vrss": "옵션전일대비", + "prdy_ctrt": "전일대비율", + "optn_oprc": "옵션시가2", + "optn_hgpr": "옵션최고가", + "optn_lwpr": "옵션최저가", + "last_cnqn": "최종거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "hts_thpr": "HTS이론가", + "hts_otst_stpl_qty": "HTS미결제약정수량", + "otst_stpl_qty_icdc": "미결제약정수량증감", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가2대비현재가부호", + "oprc_vrss_nmix_prpr": "시가대비지수현재가", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "최고가대비현재가부호", + "hgpr_vrss_nmix_prpr": "최고가대비지수현재가", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "최저가대비현재가부호", + "lwpr_vrss_nmix_prpr": "최저가대비지수현재가", + "shnu_rate": "매수2비율", + "prmm_val": "프리미엄값", + "invl_val": "내재가치값", + "tmvl_val": "시간가치값", + "delta": "델타", + "gama": "감마", + "vega": "베가", + "theta": "세타", + "rho": "로우", + "hts_ints_vltl": "HTS내재변동성", + "esdg": "괴리도", + "otst_stpl_rgbf_qty_icdc": "미결제약정직전수량증감", + "thpr_basis": "이론베이시스", + "unas_hist_vltl": "역사적변동성", + "cttr": "체결강도", + "dprt": "괴리율", + "mrkt_basis": "시장베이시스", + "optn_askp1": "옵션매도호가1", + "optn_bidp1": "옵션매수호가1", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식옵션 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=stock_option_ccnl, data=["339W08088"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/stock_option_ccnl.py b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/stock_option_ccnl.py new file mode 100644 index 0000000..9fd17b4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_futureoption/stock_option_ccnl/stock_option_ccnl.py @@ -0,0 +1,110 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간체결가 [실시간-044] +############################################################################################## + +def stock_option_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식옵션 실시간체결가 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = stock_option_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/after_hour_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/after_hour_balance.py new file mode 100644 index 0000000..288a5d4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/after_hour_balance.py @@ -0,0 +1,172 @@ +# DOMSTK_RANK - 국내주식 시간외잔량 순위 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외잔량 순위[v1_국내주식-093] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/after-hour-balance" + +def after_hour_balance( + fid_input_price_1: str, # 입력 가격1 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_vol_cnt: str, # 거래량 수 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외잔량 순위[v1_국내주식-093] + 국내주식 시간외잔량 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key( 20176 ) + fid_rank_sort_cls_code (str): 1: 장전 시간외, 2: 장후 시간외, 3:매도잔량, 4:매수잔량 + fid_div_cls_code (str): 0 : 전체 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_trgt_cls_code (str): 0 : 전체 + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 시간외잔량 순위 데이터 + + Example: + >>> df = after_hour_balance( + ... fid_input_price_1="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20176", + ... fid_rank_sort_cls_code="1", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_exls_cls_code="0", + ... fid_trgt_cls_code="0", + ... fid_vol_cnt="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20176')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20176')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHPST01760000" + + # API 요청 파라미터 설정 + params = { + "fid_input_price_1": fid_input_price_1, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return after_hour_balance( + fid_input_price_1, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_vol_cnt, + fid_input_price_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/chk_after_hour_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/chk_after_hour_balance.py new file mode 100644 index 0000000..afa0e26 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/after_hour_balance/chk_after_hour_balance.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from after_hour_balance import after_hour_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외잔량순위 [v1_국내주식-093] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'ovtm_total_askp_rsqn': '시간외 총 매도호가 잔량', + 'ovtm_total_bidp_rsqn': '시간외 총 매수호가 잔량', + 'mkob_otcp_vol': '장개시전 시간외종가 거래량', + 'mkfa_otcp_vol': '장종료후 시간외종가 거래량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 순위분석 + 국내주식 시간외잔량 순위[v1_국내주식-093] + + 국내주식 시간외잔량 순위 테스트 함수 + + Parameters: + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20176 )) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (1: 장전 시간외, 2: 장후 시간외, 3:매도잔량, 4:매수잔량) + - fid_div_cls_code (str): 분류 구분 코드 (0 : 전체) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + Returns: + - DataFrame: 국내주식 시간외잔량 순위 결과 + + Example: + >>> df = after_hour_balance(fid_input_price_1="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20176", fid_rank_sort_cls_code="1", fid_div_cls_code="0", fid_input_iscd="0000", fid_trgt_exls_cls_code="0", fid_trgt_cls_code="0", fid_vol_cnt="", fid_input_price_2="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 국내주식 시간외잔량 순위") + result = after_hour_balance( + fid_input_price_1="", # 입력 가격1 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20176", # 조건 화면 분류 코드 + fid_rank_sort_cls_code="1", # 순위 정렬 구분 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_vol_cnt="", # 거래량 수 + fid_input_price_2="" # 입력 가격2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 시간외잔량 순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/asking_price_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/asking_price_krx.py new file mode 100644 index 0000000..50c45d8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/asking_price_krx.py @@ -0,0 +1,85 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (KRX) [실시간-004] +############################################################################################## + +def asking_price_krx( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간 호가 데이터 구독 (KRX)[H0STASP0] + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내주식의 호가 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제 기능을 제공합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + env_dv (str): 실전모의구분 (real: 실전, demo: 모의) + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터 + columns (list[str]): 실시간 데이터의 컬럼 정보 + + Raises: + ValueError: 필수 파라미터가 누락되었거나 잘못된 경우 발생 + + Example: + >>> msg, columns = subscribe_krx_realtime_asking_price("1", "005930", env_dv="real") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신되며, 구독 해제 시까지 계속됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STASP0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STASP0" # 모의투자용 TR ID (웹소켓은 동일한 TR ID 사용) + else: + raise ValueError("env_dv는 'real' 또는 'demo'만 가능합니다.") + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "BSOP_HOUR", "HOUR_CLS_CODE", + "ASKP1", "ASKP2", "ASKP3", "ASKP4", "ASKP5", + "ASKP6", "ASKP7", "ASKP8", "ASKP9", "ASKP10", + "BIDP1", "BIDP2", "BIDP3", "BIDP4", "BIDP5", + "BIDP6", "BIDP7", "BIDP8", "BIDP9", "BIDP10", + "ASKP_RSQN1", "ASKP_RSQN2", "ASKP_RSQN3", "ASKP_RSQN4", "ASKP_RSQN5", + "ASKP_RSQN6", "ASKP_RSQN7", "ASKP_RSQN8", "ASKP_RSQN9", "ASKP_RSQN10", + "BIDP_RSQN1", "BIDP_RSQN2", "BIDP_RSQN3", "BIDP_RSQN4", "BIDP_RSQN5", + "BIDP_RSQN6", "BIDP_RSQN7", "BIDP_RSQN8", "BIDP_RSQN9", "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "OVTM_TOTAL_ASKP_RSQN", "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", "ANTC_CNQN", "ANTC_VOL", "ANTC_CNTG_VRSS", "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", "ACML_VOL", "TOTAL_ASKP_RSQN_ICDC", "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", "OVTM_TOTAL_BIDP_ICDC", "STCK_DEAL_CLS_CODE" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/chk_asking_price_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/chk_asking_price_krx.py new file mode 100644 index 0000000..3120f92 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_krx/chk_asking_price_krx.py @@ -0,0 +1,155 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from asking_price_krx import asking_price_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (KRX) [실시간-004] +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "BSOP_HOUR": "영업 시간", + "HOUR_CLS_CODE": "시간 구분 코드", + "ASKP1": "매도호가1", + "ASKP2": "매도호가2", + "ASKP3": "매도호가3", + "ASKP4": "매도호가4", + "ASKP5": "매도호가5", + "ASKP6": "매도호가6", + "ASKP7": "매도호가7", + "ASKP8": "매도호가8", + "ASKP9": "매도호가9", + "ASKP10": "매도호가10", + "BIDP1": "매수호가1", + "BIDP2": "매수호가2", + "BIDP3": "매수호가3", + "BIDP4": "매수호가4", + "BIDP5": "매수호가5", + "BIDP6": "매수호가6", + "BIDP7": "매수호가7", + "BIDP8": "매수호가8", + "BIDP9": "매수호가9", + "BIDP10": "매수호가10", + "ASKP_RSQN1": "매도호가 잔량1", + "ASKP_RSQN2": "매도호가 잔량2", + "ASKP_RSQN3": "매도호가 잔량3", + "ASKP_RSQN4": "매도호가 잔량4", + "ASKP_RSQN5": "매도호가 잔량5", + "ASKP_RSQN6": "매도호가 잔량6", + "ASKP_RSQN7": "매도호가 잔량7", + "ASKP_RSQN8": "매도호가 잔량8", + "ASKP_RSQN9": "매도호가 잔량9", + "ASKP_RSQN10": "매도호가 잔량10", + "BIDP_RSQN1": "매수호가 잔량1", + "BIDP_RSQN2": "매수호가 잔량2", + "BIDP_RSQN3": "매수호가 잔량3", + "BIDP_RSQN4": "매수호가 잔량4", + "BIDP_RSQN5": "매수호가 잔량5", + "BIDP_RSQN6": "매수호가 잔량6", + "BIDP_RSQN7": "매수호가 잔량7", + "BIDP_RSQN8": "매수호가 잔량8", + "BIDP_RSQN9": "매수호가 잔량9", + "BIDP_RSQN10": "매수호가 잔량10", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "OVTM_TOTAL_ASKP_RSQN": "시간외 총 매도호가 잔량", + "OVTM_TOTAL_BIDP_RSQN": "시간외 총 매수호가 잔량", + "ANTC_CNPR": "예상 체결가", + "ANTC_CNQN": "예상 체결량", + "ANTC_VOL": "예상 거래량", + "ANTC_CNTG_VRSS": "예상 체결 대비", + "ANTC_CNTG_VRSS_SIGN": "예상 체결 대비 부호", + "ANTC_CNTG_PRDY_CTRT": "예상 체결 전일 대비율", + "ACML_VOL": "누적 거래량", + "TOTAL_ASKP_RSQN_ICDC": "총 매도호가 잔량 증감", + "TOTAL_BIDP_RSQN_ICDC": "총 매수호가 잔량 증감", + "OVTM_TOTAL_ASKP_ICDC": "시간외 총 매도호가 증감", + "OVTM_TOTAL_BIDP_ICDC": "시간외 총 매수호가 증감", + "STCK_DEAL_CLS_CODE": "주식 매매 구분 코드" +} + +NUMERIC_COLUMNS = [ + "매도호가1", "매도호가2", "매도호가3", "매도호가4", "매도호가5", + "매도호가6", "매도호가7", "매도호가8", "매도호가9", "매도호가10", + "매수호가1", "매수호가2", "매수호가3", "매수호가4", "매수호가5", + "매수호가6", "매수호가7", "매수호가8", "매수호가9", "매수호가10", + "매도호가 잔량1", "매도호가 잔량2", "매도호가 잔량3", "매도호가 잔량4", "매도호가 잔량5", + "매도호가 잔량6", "매도호가 잔량7", "매도호가 잔량8", "매도호가 잔량9", "매도호가 잔량10", + "매수호가 잔량1", "매수호가 잔량2", "매수호가 잔량3", "매수호가 잔량4", "매수호가 잔량5", + "매수호가 잔량6", "매수호가 잔량7", "매수호가 잔량8", "매수호가 잔량9", "매수호가 잔량10", + "총 매도호가 잔량", "총 매수호가 잔량", "시간외 총 매도호가 잔량", "시간외 총 매수호가 잔량", + "예상 체결가", "예상 체결량", "예상 거래량", "예상 체결 대비", "예상 체결 전일 대비율", + "누적 거래량", "총 매도호가 잔량 증감", "총 매수호가 잔량 증감", "시간외 총 매도호가 증감", "시간외 총 매수호가 증감" +] + + +def main(): + """ + 국내주식 실시간호가 (KRX) + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id +- 데이터 건수 : (ex. 001 데이터 건수를 참조하여 활용) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=asking_price_krx, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/asking_price_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/asking_price_nxt.py new file mode 100644 index 0000000..9ca4ca5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/asking_price_nxt.py @@ -0,0 +1,130 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (NXT) +############################################################################################## + + + +def asking_price_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간호가 (NXT)[H0NXASP0] 구독 함수 + 국내주식 실시간호가 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_asking_price("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXASP0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터 기반 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "BSOP_HOUR", + "HOUR_CLS_CODE", + "ASKP1", + "ASKP2", + "ASKP3", + "ASKP4", + "ASKP5", + "ASKP6", + "ASKP7", + "ASKP8", + "ASKP9", + "ASKP10", + "BIDP1", + "BIDP2", + "BIDP3", + "BIDP4", + "BIDP5", + "BIDP6", + "BIDP7", + "BIDP8", + "BIDP9", + "BIDP10", + "ASKP_RSQN1", + "ASKP_RSQN2", + "ASKP_RSQN3", + "ASKP_RSQN4", + "ASKP_RSQN5", + "ASKP_RSQN6", + "ASKP_RSQN7", + "ASKP_RSQN8", + "ASKP_RSQN9", + "ASKP_RSQN10", + "BIDP_RSQN1", + "BIDP_RSQN2", + "BIDP_RSQN3", + "BIDP_RSQN4", + "BIDP_RSQN5", + "BIDP_RSQN6", + "BIDP_RSQN7", + "BIDP_RSQN8", + "BIDP_RSQN9", + "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "OVTM_TOTAL_ASKP_RSQN", + "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", + "ANTC_CNQN", + "ANTC_VOL", + "ANTC_CNTG_VRSS", + "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", + "ACML_VOL", + "TOTAL_ASKP_RSQN_ICDC", + "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", + "OVTM_TOTAL_BIDP_ICDC", + "STCK_DEAL_CLS_CODE", + "KMID_PRC", + "KMID_TOTAL_RSQN", + "KMID_CLS_CODE", + "NMID_PRC", + "NMID_TOTAL_RSQN", + "NMID_CLS_CODE", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/chk_asking_price_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/chk_asking_price_nxt.py new file mode 100644 index 0000000..0f81211 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_nxt/chk_asking_price_nxt.py @@ -0,0 +1,151 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from asking_price_nxt import asking_price_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (NXT) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "BSOP_HOUR": "영업 시간", + "HOUR_CLS_CODE": "시간 구분 코드", + "ASKP1": "매도호가1", + "ASKP2": "매도호가2", + "ASKP3": "매도호가3", + "ASKP4": "매도호가4", + "ASKP5": "매도호가5", + "ASKP6": "매도호가6", + "ASKP7": "매도호가7", + "ASKP8": "매도호가8", + "ASKP9": "매도호가9", + "ASKP10": "매도호가10", + "BIDP1": "매수호가1", + "BIDP2": "매수호가2", + "BIDP3": "매수호가3", + "BIDP4": "매수호가4", + "BIDP5": "매수호가5", + "BIDP6": "매수호가6", + "BIDP7": "매수호가7", + "BIDP8": "매수호가8", + "BIDP9": "매수호가9", + "BIDP10": "매수호가10", + "ASKP_RSQN1": "매도호가 잔량1", + "ASKP_RSQN2": "매도호가 잔량2", + "ASKP_RSQN3": "매도호가 잔량3", + "ASKP_RSQN4": "매도호가 잔량4", + "ASKP_RSQN5": "매도호가 잔량5", + "ASKP_RSQN6": "매도호가 잔량6", + "ASKP_RSQN7": "매도호가 잔량7", + "ASKP_RSQN8": "매도호가 잔량8", + "ASKP_RSQN9": "매도호가 잔량9", + "ASKP_RSQN10": "매도호가 잔량10", + "BIDP_RSQN1": "매수호가 잔량1", + "BIDP_RSQN2": "매수호가 잔량2", + "BIDP_RSQN3": "매수호가 잔량3", + "BIDP_RSQN4": "매수호가 잔량4", + "BIDP_RSQN5": "매수호가 잔량5", + "BIDP_RSQN6": "매수호가 잔량6", + "BIDP_RSQN7": "매수호가 잔량7", + "BIDP_RSQN8": "매수호가 잔량8", + "BIDP_RSQN9": "매수호가 잔량9", + "BIDP_RSQN10": "매수호가 잔량10", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "OVTM_TOTAL_ASKP_RSQN": "시간외 총 매도호가 잔량", + "OVTM_TOTAL_BIDP_RSQN": "시간외 총 매수호가 잔량", + "ANTC_CNPR": "예상 체결가", + "ANTC_CNQN": "예상 체결량", + "ANTC_VOL": "예상 거래량", + "ANTC_CNTG_VRSS": "예상 체결 대비", + "ANTC_CNTG_VRSS_SIGN": "예상 체결 대비 부호", + "ANTC_CNTG_PRDY_CTRT": "예상 체결 전일 대비율", + "ACML_VOL": "누적 거래량", + "TOTAL_ASKP_RSQN_ICDC": "총 매도호가 잔량 증감", + "TOTAL_BIDP_RSQN_ICDC": "총 매수호가 잔량 증감", + "OVTM_TOTAL_ASKP_ICDC": "시간외 총 매도호가 증감", + "OVTM_TOTAL_BIDP_ICDC": "시간외 총 매수호가 증감", + "STCK_DEAL_CLS_CODE": "주식 매매 구분 코드", + "KMID_PRC": "KRX 중간가", + "KMID_TOTAL_RSQN": "KRX 중간가잔량합계수량", + "KMID_CLS_CODE": "KRX 중간가 매수매도 구분", + "NMID_PRC": "NXT 중간가", + "NMID_TOTAL_RSQN": "NXT 중간가잔량합계수량", + "NMID_CLS_CODE": "NXT 중간가 매수매도 구분" +} + +NUMERIC_COLUMNS = [ + "매도호가1", "매도호가2", "매도호가3", "매도호가4", "매도호가5", + "매도호가6", "매도호가7", "매도호가8", "매도호가9", "매도호가10", + "매수호가1", "매수호가2", "매수호가3", "매수호가4", "매수호가5", + "매수호가6", "매수호가7", "매수호가8", "매수호가9", "매수호가10", + "매도호가 잔량1", "매도호가 잔량2", "매도호가 잔량3", "매도호가 잔량4", "매도호가 잔량5", + "매도호가 잔량6", "매도호가 잔량7", "매도호가 잔량8", "매도호가 잔량9", "매도호가 잔량10", + "매수호가 잔량1", "매수호가 잔량2", "매수호가 잔량3", "매수호가 잔량4", "매수호가 잔량5", + "매수호가 잔량6", "매수호가 잔량7", "매수호가 잔량8", "매수호가 잔량9", "매수호가 잔량10", + "총 매도호가 잔량", "총 매수호가 잔량", "시간외 총 매도호가 잔량", "시간외 총 매수호가 잔량", + "예상 체결가", "예상 체결량", "예상 거래량", "예상 체결 대비", "예상 체결 전일 대비율", + "누적 거래량", "총 매도호가 잔량 증감", "총 매수호가 잔량 증감", + "시간외 총 매도호가 증감", "시간외 총 매수호가 증감", "KRX 중간가", + "KRX 중간가잔량합계수량", "NXT 중간가", "NXT 중간가잔량합계수량" +] + + +def main(): + """ + 국내주식 실시간호가 (NXT) + + 국내주식 실시간호가 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=asking_price_nxt, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/asking_price_total.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/asking_price_total.py new file mode 100644 index 0000000..d2f084c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/asking_price_total.py @@ -0,0 +1,129 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (통합) +############################################################################################## + + +def asking_price_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간호가 (통합)[H0UNASP0] + 국내주식 실시간호가 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_asking_price("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 서버로부터 실시간 데이터가 지속적으로 전송됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0UNASP0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "BSOP_HOUR", + "HOUR_CLS_CODE", + "ASKP1", + "ASKP2", + "ASKP3", + "ASKP4", + "ASKP5", + "ASKP6", + "ASKP7", + "ASKP8", + "ASKP9", + "ASKP10", + "BIDP1", + "BIDP2", + "BIDP3", + "BIDP4", + "BIDP5", + "BIDP6", + "BIDP7", + "BIDP8", + "BIDP9", + "BIDP10", + "ASKP_RSQN1", + "ASKP_RSQN2", + "ASKP_RSQN3", + "ASKP_RSQN4", + "ASKP_RSQN5", + "ASKP_RSQN6", + "ASKP_RSQN7", + "ASKP_RSQN8", + "ASKP_RSQN9", + "ASKP_RSQN10", + "BIDP_RSQN1", + "BIDP_RSQN2", + "BIDP_RSQN3", + "BIDP_RSQN4", + "BIDP_RSQN5", + "BIDP_RSQN6", + "BIDP_RSQN7", + "BIDP_RSQN8", + "BIDP_RSQN9", + "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "OVTM_TOTAL_ASKP_RSQN", + "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", + "ANTC_CNQN", + "ANTC_VOL", + "ANTC_CNTG_VRSS", + "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", + "ACML_VOL", + "TOTAL_ASKP_RSQN_ICDC", + "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", + "OVTM_TOTAL_BIDP_ICDC", + "STCK_DEAL_CLS_CODE", + "KMID_PRC", + "KMID_TOTAL_RSQN", + "KMID_CLS_CODE", + "NMID_PRC", + "NMID_TOTAL_RSQN", + "NMID_CLS_CODE", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/chk_asking_price_total.py b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/chk_asking_price_total.py new file mode 100644 index 0000000..20bf116 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/asking_price_total/chk_asking_price_total.py @@ -0,0 +1,151 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from asking_price_total import asking_price_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (통합) +############################################################################################## + + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "BSOP_HOUR": "영업 시간", + "HOUR_CLS_CODE": "시간 구분 코드", + "ASKP1": "매도호가1", + "ASKP2": "매도호가2", + "ASKP3": "매도호가3", + "ASKP4": "매도호가4", + "ASKP5": "매도호가5", + "ASKP6": "매도호가6", + "ASKP7": "매도호가7", + "ASKP8": "매도호가8", + "ASKP9": "매도호가9", + "ASKP10": "매도호가10", + "BIDP1": "매수호가1", + "BIDP2": "매수호가2", + "BIDP3": "매수호가3", + "BIDP4": "매수호가4", + "BIDP5": "매수호가5", + "BIDP6": "매수호가6", + "BIDP7": "매수호가7", + "BIDP8": "매수호가8", + "BIDP9": "매수호가9", + "BIDP10": "매수호가10", + "ASKP_RSQN1": "매도호가 잔량1", + "ASKP_RSQN2": "매도호가 잔량2", + "ASKP_RSQN3": "매도호가 잔량3", + "ASKP_RSQN4": "매도호가 잔량4", + "ASKP_RSQN5": "매도호가 잔량5", + "ASKP_RSQN6": "매도호가 잔량6", + "ASKP_RSQN7": "매도호가 잔량7", + "ASKP_RSQN8": "매도호가 잔량8", + "ASKP_RSQN9": "매도호가 잔량9", + "ASKP_RSQN10": "매도호가 잔량10", + "BIDP_RSQN1": "매수호가 잔량1", + "BIDP_RSQN2": "매수호가 잔량2", + "BIDP_RSQN3": "매수호가 잔량3", + "BIDP_RSQN4": "매수호가 잔량4", + "BIDP_RSQN5": "매수호가 잔량5", + "BIDP_RSQN6": "매수호가 잔량6", + "BIDP_RSQN7": "매수호가 잔량7", + "BIDP_RSQN8": "매수호가 잔량8", + "BIDP_RSQN9": "매수호가 잔량9", + "BIDP_RSQN10": "매수호가 잔량10", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "OVTM_TOTAL_ASKP_RSQN": "시간외 총 매도호가 잔량", + "OVTM_TOTAL_BIDP_RSQN": "시간외 총 매수호가 잔량", + "ANTC_CNPR": "예상 체결가", + "ANTC_CNQN": "예상 체결량", + "ANTC_VOL": "예상 거래량", + "ANTC_CNTG_VRSS": "예상 체결 대비", + "ANTC_CNTG_VRSS_SIGN": "예상 체결 대비 부호", + "ANTC_CNTG_PRDY_CTRT": "예상 체결 전일 대비율", + "ACML_VOL": "누적 거래량", + "TOTAL_ASKP_RSQN_ICDC": "총 매도호가 잔량 증감", + "TOTAL_BIDP_RSQN_ICDC": "총 매수호가 잔량 증감", + "OVTM_TOTAL_ASKP_ICDC": "시간외 총 매도호가 증감", + "OVTM_TOTAL_BIDP_ICDC": "시간외 총 매수호가 증감", + "STCK_DEAL_CLS_CODE": "주식 매매 구분 코드", + "KMID_PRC": "KRX 중간가", + "KMID_TOTAL_RSQN": "KRX 중간가잔량합계수량", + "KMID_CLS_CODE": "KRX 중간가 매수매도 구분", + "NMID_PRC": "NXT 중간가", + "NMID_TOTAL_RSQN": "NXT 중간가잔량합계수량", + "NMID_CLS_CODE": "NXT 중간가 매수매도 구분" +} + +NUMERIC_COLUMNS = [ + "매도호가1", "매도호가2", "매도호가3", "매도호가4", "매도호가5", + "매도호가6", "매도호가7", "매도호가8", "매도호가9", "매도호가10", + "매수호가1", "매수호가2", "매수호가3", "매수호가4", "매수호가5", + "매수호가6", "매수호가7", "매수호가8", "매수호가9", "매수호가10", + "매도호가 잔량1", "매도호가 잔량2", "매도호가 잔량3", "매도호가 잔량4", "매도호가 잔량5", + "매도호가 잔량6", "매도호가 잔량7", "매도호가 잔량8", "매도호가 잔량9", "매도호가 잔량10", + "매수호가 잔량1", "매수호가 잔량2", "매수호가 잔량3", "매수호가 잔량4", "매수호가 잔량5", + "매수호가 잔량6", "매수호가 잔량7", "매수호가 잔량8", "매수호가 잔량9", "매수호가 잔량10", + "총 매도호가 잔량", "총 매수호가 잔량", "시간외 총 매도호가 잔량", "시간외 총 매수호가 잔량", + "예상 체결가", "예상 체결량", "예상 거래량", "예상 체결 대비", "예상 체결 전일 대비율", + "누적 거래량", "총 매도호가 잔량 증감", "총 매수호가 잔량 증감", "시간외 총 매도호가 증감", + "시간외 총 매수호가 증감", "KRX 중간가", "KRX 중간가잔량합계수량", "NXT 중간가", "NXT 중간가잔량합계수량" +] + + +def main(): + """ + 국내주식 실시간호가 (통합) + + 국내주식 실시간호가 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=asking_price_total, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/bulk_trans_num.py b/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/bulk_trans_num.py new file mode 100644 index 0000000..372c429 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/bulk_trans_num.py @@ -0,0 +1,187 @@ +""" +Created on 2025-06-16 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 대량체결건수 상위[국내주식-107] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/bulk-trans-num" + +def bulk_trans_num( + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_input_iscd_2: str, # 입력 종목코드2 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 대량체결건수 상위[국내주식-107] + 국내주식 대량체결건수 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_prc_2 (str): ~ 가격 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(11909) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_rank_sort_cls_code (str): 0:매수상위, 1:매도상위 + fid_div_cls_code (str): 0:전체 + fid_input_price_1 (str): 건별금액 ~ + fid_aply_rang_prc_1 (str): 가격 ~ + fid_input_iscd_2 (str): 공백:전체종목, 개별종목 조회시 종목코드 (000660) + fid_trgt_exls_cls_code (str): 0:전체 + fid_trgt_cls_code (str): 0:전체 + fid_vol_cnt (str): 거래량 ~ + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 대량체결건수 상위 데이터 + + Example: + >>> df = bulk_trans_num( + fid_aply_rang_prc_2="100000", + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11909", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_div_cls_code="0", + fid_input_price_1="50000", + fid_aply_rang_prc_1="200000", + fid_input_iscd_2="", + fid_trgt_exls_cls_code="0", + fid_trgt_cls_code="0", + fid_vol_cnt="1000" + ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11909')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11909')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST190900C0" + + params = { + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_input_iscd_2": fid_input_iscd_2, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_vol_cnt": fid_vol_cnt, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 다음 페이지 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return bulk_trans_num( + fid_aply_rang_prc_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_input_price_1, + fid_aply_rang_prc_1, + fid_input_iscd_2, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_vol_cnt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/chk_bulk_trans_num.py b/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/chk_bulk_trans_num.py new file mode 100644 index 0000000..bff05be --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/bulk_trans_num/chk_bulk_trans_num.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from bulk_trans_num import bulk_trans_num + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 대량체결건수 상위[국내주식-107] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'shnu_cntg_csnu': '매수2 체결 건수', + 'seln_cntg_csnu': '매도 체결 건수', + 'ntby_cnqn': '순매수 체결량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 순위분석 + 국내주식 대량체결건수 상위[국내주식-107] + + 국내주식 대량체결건수 상위 테스트 함수 + + Parameters: + - fid_aply_rang_prc_2 (str): 적용 범위 가격2 (~ 가격) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(11909)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0:매수상위, 1:매도상위) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체) + - fid_input_price_1 (str): 입력 가격1 (건별금액 ~) + - fid_aply_rang_prc_1 (str): 적용 범위 가격1 (가격 ~) + - fid_input_iscd_2 (str): 입력 종목코드2 (공백:전체종목, 개별종목 조회시 종목코드 (000660)) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0:전체) + - fid_trgt_cls_code (str): 대상 구분 코드 (0:전체) + - fid_vol_cnt (str): 거래량 수 (거래량 ~) + Returns: + - DataFrame: 국내주식 대량체결건수 상위 결과 + + Example: + >>> df = bulk_trans_num(fid_aply_rang_prc_2="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="11909", fid_input_iscd="0000", fid_rank_sort_cls_code="0", fid_div_cls_code="0", fid_input_price_1="", fid_aply_rang_prc_1="", fid_input_iscd_2="", fid_trgt_exls_cls_code="0", fid_trgt_cls_code="0", fid_vol_cnt="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 국내주식 대량체결건수 상위") + result = bulk_trans_num( + fid_aply_rang_prc_2="", # 적용 범위 가격2 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="11909", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_price_1="", # 입력 가격1 + fid_aply_rang_prc_1="", # 적용 범위 가격1 + fid_input_iscd_2="", # 입력 종목코드2 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_vol_cnt="", # 거래량 수 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 대량체결건수 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/capture_uplowprice.py b/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/capture_uplowprice.py new file mode 100644 index 0000000..09fd310 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/capture_uplowprice.py @@ -0,0 +1,98 @@ +""" +Created on 20250113 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 상하한가 포착 [국내주식-190] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/capture-uplowprice" + + +def capture_uplowprice( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11300) + fid_prc_cls_code: str, # [필수] 상하한가 구분코드 (ex. 0:상한가, 1:하한가) + fid_div_cls_code: str, + # [필수] 분류구분코드 (ex. 0:상하한가종목, 6:8%상하한가 근접, 5:10%상하한가 근접, 1:15%상하한가 근접, 2:20%상하한가 근접, 3:25%상하한가 근접) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_trgt_cls_code: str = "", # 대상구분코드 + fid_trgt_exls_cls_code: str = "", # 대상제외구분코드 + fid_input_price_1: str = "", # 입력가격1 + fid_input_price_2: str = "", # 입력가격2 + fid_vol_cnt: str = "" # 거래량수 +) -> pd.DataFrame: + """ + 국내주식 상하한가 포착 API입니다. + 한국투자 HTS(eFriend Plus) > [0917] 실시간 상하한가 포착 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11300) + fid_prc_cls_code (str): [필수] 상하한가 구분코드 (ex. 0:상한가, 1:하한가) + fid_div_cls_code (str): [필수] 분류구분코드 (ex. 0:상하한가종목, 6:8%상하한가 근접, 5:10%상하한가 근접, 1:15%상하한가 근접, 2:20%상하한가 근접, 3:25%상하한가 근접) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_trgt_cls_code (str): 대상구분코드 + fid_trgt_exls_cls_code (str): 대상제외구분코드 + fid_input_price_1 (str): 입력가격1 + fid_input_price_2 (str): 입력가격2 + fid_vol_cnt (str): 거래량수 + + Returns: + pd.DataFrame: 상하한가 포착 데이터 + + Example: + >>> df = capture_uplowprice("J", "11300", "0", "0", "0000") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11300')") + + if fid_prc_cls_code == "": + raise ValueError("fid_prc_cls_code is required (e.g. '0', '1')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0', '6', '5', '1', '2', '3')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000', '0001', '1001')") + + tr_id = "FHKST130000C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_PRC_CLS_CODE": fid_prc_cls_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/chk_capture_uplowprice.py b/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/chk_capture_uplowprice.py new file mode 100644 index 0000000..5cfe05c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/capture_uplowprice/chk_capture_uplowprice.py @@ -0,0 +1,91 @@ +""" +Created on 20250113 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from capture_uplowprice import capture_uplowprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 상하한가 포착 [국내주식-190] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'stck_prpr': '주식현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'total_askp_rsqn': '총매도호가잔량', + 'total_bidp_rsqn': '총매수호가잔량', + 'askp_rsqn1': '매도호가잔량1', + 'bidp_rsqn1': '매수호가잔량1', + 'prdy_vol': '전일거래량', + 'seln_cnqn': '매도체결량', + 'shnu_cnqn': '매수2체결량', + 'stck_llam': '주식하한가', + 'stck_mxpr': '주식상한가', + 'prdy_vrss_vol_rate': '전일대비거래량비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 상하한가 포착 조회 테스트 함수 + + 이 함수는 국내주식 상하한가 포착 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = capture_uplowprice( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11300", + fid_prc_cls_code="0", + fid_div_cls_code="0", + fid_input_iscd="0000" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/ccnl_krx.py new file mode 100644 index 0000000..553bdb8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/ccnl_krx.py @@ -0,0 +1,85 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가(KRX) [실시간-003] +############################################################################################## + +def ccnl_krx( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (KRX)[H0STCNT0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 국내 주식의 실시간 체결가 데이터를 구독합니다. + 실시간 데이터를 구독하거나 구독 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 + ValueError: env_dv가 'real' 또는 'demo'가 아닌 경우 + + Example: + >>> msg, columns = ccnl_krx("1", "005930", env_dv="real") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STCNT0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STCNT0" # 모의투자용 TR ID (웹소켓은 동일한 TR ID 사용) + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "STCK_CNTG_HOUR", "STCK_PRPR", "PRDY_VRSS_SIGN", + "PRDY_VRSS", "PRDY_CTRT", "WGHN_AVRG_STCK_PRC", "STCK_OPRC", + "STCK_HGPR", "STCK_LWPR", "ASKP1", "BIDP1", "CNTG_VOL", "ACML_VOL", + "ACML_TR_PBMN", "SELN_CNTG_CSNU", "SHNU_CNTG_CSNU", "NTBY_CNTG_CSNU", + "CTTR", "SELN_CNTG_SMTN", "SHNU_CNTG_SMTN", "CCLD_DVSN", "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", "OPRC_HOUR", "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", "HGPR_HOUR", "HGPR_VRSS_PRPR_SIGN", "HGPR_VRSS_PRPR", + "LWPR_HOUR", "LWPR_VRSS_PRPR_SIGN", "LWPR_VRSS_PRPR", "BSOP_DATE", + "NEW_MKOP_CLS_CODE", "TRHT_YN", "ASKP_RSQN1", "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", "MRKT_TRTM_CLS_CODE", "VI_STND_PRC" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/chk_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/chk_ccnl_krx.py new file mode 100644 index 0000000..25cf43f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_krx/chk_ccnl_krx.py @@ -0,0 +1,149 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_krx import ccnl_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가(KRX) [실시간-003] +############################################################################################## + + +# 컬럼 매핑 +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "STCK_CNTG_HOUR": "주식 체결 시간", + "STCK_PRPR": "주식 현재가", + "PRDY_VRSS_SIGN": "전일 대비 부호", + "PRDY_VRSS": "전일 대비", + "PRDY_CTRT": "전일 대비율", + "WGHN_AVRG_STCK_PRC": "가중 평균 주식 가격", + "STCK_OPRC": "주식 시가", + "STCK_HGPR": "주식 최고가", + "STCK_LWPR": "주식 최저가", + "ASKP1": "매도호가1", + "BIDP1": "매수호가1", + "CNTG_VOL": "체결 거래량", + "ACML_VOL": "누적 거래량", + "ACML_TR_PBMN": "누적 거래 대금", + "SELN_CNTG_CSNU": "매도 체결 건수", + "SHNU_CNTG_CSNU": "매수 체결 건수", + "NTBY_CNTG_CSNU": "순매수 체결 건수", + "CTTR": "체결강도", + "SELN_CNTG_SMTN": "총 매도 수량", + "SHNU_CNTG_SMTN": "총 매수 수량", + "CCLD_DVSN": "체결구분", + "SHNU_RATE": "매수비율", + "PRDY_VOL_VRSS_ACML_VOL_RATE": "전일 거래량 대비 등락율", + "OPRC_HOUR": "시가 시간", + "OPRC_VRSS_PRPR_SIGN": "시가대비구분", + "OPRC_VRSS_PRPR": "시가대비", + "HGPR_HOUR": "최고가 시간", + "HGPR_VRSS_PRPR_SIGN": "고가대비구분", + "HGPR_VRSS_PRPR": "고가대비", + "LWPR_HOUR": "최저가 시간", + "LWPR_VRSS_PRPR_SIGN": "저가대비구분", + "LWPR_VRSS_PRPR": "저가대비", + "BSOP_DATE": "영업 일자", + "NEW_MKOP_CLS_CODE": "신 장운영 구분 코드", + "TRHT_YN": "거래정지 여부", + "ASKP_RSQN1": "매도호가 잔량1", + "BIDP_RSQN1": "매수호가 잔량1", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "VOL_TNRT": "거래량 회전율", + "PRDY_SMNS_HOUR_ACML_VOL": "전일 동시간 누적 거래량", + "PRDY_SMNS_HOUR_ACML_VOL_RATE": "전일 동시간 누적 거래량 비율", + "HOUR_CLS_CODE": "시간 구분 코드", + "MRKT_TRTM_CLS_CODE": "임의종료구분코드", + "VI_STND_PRC": "정적VI발동기준가" +} + +NUMERIC_COLUMNS = [ + "주식 현재가", "전일 대비", "전일 대비율", "가중 평균 주식 가격", "주식 시가", "주식 최고가", "주식 최저가", + "매도호가1", "매수호가1", "체결 거래량", "누적 거래량", "누적 거래 대금", "매도 체결 건수", "매수 체결 건수", + "순매수 체결 건수", "체결강도", "총 매도 수량", "총 매수 수량", "매수비율", "전일 거래량 대비 등락율", + "시가대비", "고가대비", "저가대비", "매도호가 잔량1", "매수호가 잔량1", "총 매도호가 잔량", "총 매수호가 잔량", + "거래량 회전율", "전일 동시간 누적 거래량", "전일 동시간 누적 거래량 비율", "정적VI발동기준가" +] + + +def main(): + """ + 국내주식 실시간체결가 (KRX) + + [참고자료] + +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + +※ 데이터가 많은 경우 여러 건을 페이징 처리해서 데이터를 보내는 점 참고 부탁드립니다. +ex) 0|H0STCNT0|004|... 인 경우 004가 데이터 개수를 의미하여, 뒤에 체결데이터가 4건 들어옴 +→ 0|H0STCNT0|004|005930^123929...(체결데이터1)...^005930^123929...(체결데이터2)...^005930^123929...(체결데이터3)...^005930^123929...(체결데이터4)... + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_krx, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/ccnl_notice.py new file mode 100644 index 0000000..ff17c14 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/ccnl_notice.py @@ -0,0 +1,78 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 주식체결통보 [실시간-005] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결통보[H0STCNI0] + 국내주식 실시간 체결통보 수신 시에 (1) 주문·정정·취소·거부 접수 통보 와 (2) 체결 통보 가 모두 수신됩니다. + (14번째 값(CNTG_YN;체결여부)가 2이면 체결통보, 1이면 주문·정정·취소·거부 접수 통보입니다.) + + ※ 모의투자는 H0STCNI9 로 변경하여 사용합니다. + + 실시간 데이터 구독을 위한 웹소켓 함수입니다. 구독을 등록하거나 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1")/해제("0") 여부 + tr_key (str): [필수] 종목코드 (예: "005930") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", "005930", env_dv="real") + >>> print(msg, columns) + + 웹소켓을 통해 실시간 데이터를 수신하며, 데이터는 암호화되어 제공됩니다. + AES256 KEY와 IV를 사용하여 복호화해야 합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STCNI0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STCNI9" # 모의투자용 TR ID + else: + raise ValueError("env_dv는 'real' 또는 'demo'만 가능합니다.") + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "CUST_ID", "ACNT_NO", "ODER_NO", "ODER_QTY", "SELN_BYOV_CLS", "RCTF_CLS", + "ODER_KIND", "ODER_COND", "STCK_SHRN_ISCD", "CNTG_QTY", "CNTG_UNPR", + "STCK_CNTG_HOUR", "RFUS_YN", "CNTG_YN", "ACPT_YN", "BRNC_NO", "ACNT_NO2", + "ACNT_NAME", "ORD_COND_PRC", "ORD_EXG_GB", "POPUP_YN", "FILLER", "CRDT_CLS", + "CRDT_LOAN_DATE", "CNTG_ISNM40", "ODER_PRC" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/chk_ccnl_notice.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/chk_ccnl_notice.py new file mode 100644 index 0000000..a26e723 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_notice/chk_ccnl_notice.py @@ -0,0 +1,117 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_notice import ccnl_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 주식체결통보 [실시간-005] +############################################################################################## + +COLUMN_MAPPING = { + "CUST_ID": "고객 ID", + "ACNT_NO": "계좌번호", + "ODER_NO": "주문번호", + "ODER_QTY": "주문수량", + "SELN_BYOV_CLS": "매도매수구분", + "RCTF_CLS": "접수구분", + "ODER_KIND": "주문종류", + "ODER_COND": "주문조건", + "STCK_SHRN_ISCD": "종목코드", + "CNTG_QTY": "체결수량", + "CNTG_UNPR": "체결단가", + "STCK_CNTG_HOUR": "주식체결시간", + "RFUS_YN": "거부여부", + "CNTG_YN": "체결여부", + "ACPT_YN": "접수여부", + "BRNC_NO": "지점번호", + "ACNT_NO2": "계좌번호2", + "ACNT_NAME": "계좌명", + "ORD_COND_PRC": "호가조건가격", + "ORD_EXG_GB": "주문거래소 구분", + "POPUP_YN": "체결정보 표시", + "FILLER": "필러", + "CRDT_CLS": "신용거래구분", + "CRDT_LOAN_DATE": "신용대출일자", + "CNTG_ISNM40": "체결일자", + "ODER_PRC": "주문가격" +} +NUMERIC_COLUMNS = ["주문수량", "체결수량", "체결단가", "호가조건가격", "주문가격"] + + +def main(): + """ + 국내주식 실시간체결통보 + + 국내주식 실시간 체결통보 수신 시에 (1) 주문·정정·취소·거부 접수 통보 와 (2) 체결 통보 가 모두 수신됩니다. +(14번째 값(CNTG_YN;체결여부)가 2이면 체결통보, 1이면 주문·정정·취소·거부 접수 통보입니다.) + +※ 모의투자는 H0STCNI9 로 변경하여 사용합니다. + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id +- 데이터 건수 : (ex. 001 데이터 건수를 참조하여 활용) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + +체결 통보 응답 결과는 암호화되어 출력됩니다. AES256 KEY IV를 활용해 복호화하여 활용하세요. 자세한 예제는 [도구>wikidocs]에 준비되어 있습니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/ccnl_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/ccnl_nxt.py new file mode 100644 index 0000000..46cd83b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/ccnl_nxt.py @@ -0,0 +1,75 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (NXT) +############################################################################################## + + +def ccnl_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (NXT)[H0NXCNT0] + 국내주식 실시간체결가 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 체결가 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 리스트 + + Example: + >>> msg, columns = ccnl_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하세요. tr_key는 유효한 종목코드를 입력해야 합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다. 유효한 종목코드를 입력하세요.") + + tr_id = "H0NXCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 페치 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "STCK_CNTG_HOUR", "STCK_PRPR", "PRDY_VRSS_SIGN", + "PRDY_VRSS", "PRDY_CTRT", "WGHN_AVRG_STCK_PRC", "STCK_OPRC", + "STCK_HGPR", "STCK_LWPR", "ASKP1", "BIDP1", "CNTG_VOL", "ACML_VOL", + "ACML_TR_PBMN", "SELN_CNTG_CSNU", "SHNU_CNTG_CSNU", "NTBY_CNTG_CSNU", + "CTTR", "SELN_CNTG_SMTN", "SHNU_CNTG_SMTN", "CNTG_CLS_CODE", + "SHNU_RATE", "PRDY_VOL_VRSS_ACML_VOL_RATE", "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", "OPRC_VRSS_PRPR", "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", "HGPR_VRSS_PRPR", "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", "LWPR_VRSS_PRPR", "BSOP_DATE", + "NEW_MKOP_CLS_CODE", "TRHT_YN", "ASKP_RSQN1", "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", "MRKT_TRTM_CLS_CODE", "VI_STND_PRC" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/chk_ccnl_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/chk_ccnl_nxt.py new file mode 100644 index 0000000..bc6fc9a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_nxt/chk_ccnl_nxt.py @@ -0,0 +1,128 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_nxt import ccnl_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (NXT) +############################################################################################## + + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "STCK_CNTG_HOUR": "주식 체결 시간", + "STCK_PRPR": "주식 현재가", + "PRDY_VRSS_SIGN": "전일 대비 부호", + "PRDY_VRSS": "전일 대비", + "PRDY_CTRT": "전일 대비율", + "WGHN_AVRG_STCK_PRC": "가중 평균 주식 가격", + "STCK_OPRC": "주식 시가", + "STCK_HGPR": "주식 최고가", + "STCK_LWPR": "주식 최저가", + "ASKP1": "매도호가1", + "BIDP1": "매수호가1", + "CNTG_VOL": "체결 거래량", + "ACML_VOL": "누적 거래량", + "ACML_TR_PBMN": "누적 거래 대금", + "SELN_CNTG_CSNU": "매도 체결 건수", + "SHNU_CNTG_CSNU": "매수 체결 건수", + "NTBY_CNTG_CSNU": "순매수 체결 건수", + "CTTR": "체결강도", + "SELN_CNTG_SMTN": "총 매도 수량", + "SHNU_CNTG_SMTN": "총 매수 수량", + "CNTG_CLS_CODE": "체결구분", + "SHNU_RATE": "매수비율", + "PRDY_VOL_VRSS_ACML_VOL_RATE": "전일 거래량 대비 등락율", + "OPRC_HOUR": "시가 시간", + "OPRC_VRSS_PRPR_SIGN": "시가대비구분", + "OPRC_VRSS_PRPR": "시가대비", + "HGPR_HOUR": "최고가 시간", + "HGPR_VRSS_PRPR_SIGN": "고가대비구분", + "HGPR_VRSS_PRPR": "고가대비", + "LWPR_HOUR": "최저가 시간", + "LWPR_VRSS_PRPR_SIGN": "저가대비구분", + "LWPR_VRSS_PRPR": "저가대비", + "BSOP_DATE": "영업 일자", + "NEW_MKOP_CLS_CODE": "신 장운영 구분 코드", + "TRHT_YN": "거래정지 여부", + "ASKP_RSQN1": "매도호가 잔량1", + "BIDP_RSQN1": "매수호가 잔량1", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "VOL_TNRT": "거래량 회전율", + "PRDY_SMNS_HOUR_ACML_VOL": "전일 동시간 누적 거래량", + "PRDY_SMNS_HOUR_ACML_VOL_RATE": "전일 동시간 누적 거래량 비율", + "HOUR_CLS_CODE": "시간 구분 코드", + "MRKT_TRTM_CLS_CODE": "임의종료구분코드", + "VI_STND_PRC": "정적VI발동기준가" +} + +NUMERIC_COLUMNS = [ + "주식 현재가", "전일 대비", "전일 대비율", "가중 평균 주식 가격", "주식 시가", + "주식 최고가", "주식 최저가", "매도호가1", "매수호가1", "체결 거래량", + "누적 거래량", "누적 거래 대금", "매도 체결 건수", "매수 체결 건수", + "순매수 체결 건수", "체결강도", "총 매도 수량", "총 매수 수량", + "매수비율", "전일 거래량 대비 등락율", "시가대비", "고가대비", "저가대비", + "매도호가 잔량1", "매수호가 잔량1", "총 매도호가 잔량", "총 매수호가 잔량", + "거래량 회전율", "전일 동시간 누적 거래량", "전일 동시간 누적 거래량 비율", + "정적VI발동기준가" +] + + +def main(): + """ + 국내주식 실시간체결가 (NXT) + + 국내주식 실시간체결가 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_nxt, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/ccnl_total.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/ccnl_total.py new file mode 100644 index 0000000..893f64e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/ccnl_total.py @@ -0,0 +1,111 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (통합) +############################################################################################## + + +def ccnl_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (통합)[H0UNCNT0] + 국내주식 실시간체결가 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 실시간 데이터를 구독할 주식의 종목코드 + + Returns: + message (dict): 실시간 체결가 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = ccnl_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UNCNT0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터를 가져옵니다. + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터에 기반한 정확한 컬럼 리스트 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/chk_ccnl_total.py b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/chk_ccnl_total.py new file mode 100644 index 0000000..9030dc8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ccnl_total/chk_ccnl_total.py @@ -0,0 +1,126 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_total import ccnl_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (통합) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "STCK_CNTG_HOUR": "주식 체결 시간", + "STCK_PRPR": "주식 현재가", + "PRDY_VRSS_SIGN": "전일 대비 부호", + "PRDY_VRSS": "전일 대비", + "PRDY_CTRT": "전일 대비율", + "WGHN_AVRG_STCK_PRC": "가중 평균 주식 가격", + "STCK_OPRC": "주식 시가", + "STCK_HGPR": "주식 최고가", + "STCK_LWPR": "주식 최저가", + "ASKP1": "매도호가1", + "BIDP1": "매수호가1", + "CNTG_VOL": "체결 거래량", + "ACML_VOL": "누적 거래량", + "ACML_TR_PBMN": "누적 거래 대금", + "SELN_CNTG_CSNU": "매도 체결 건수", + "SHNU_CNTG_CSNU": "매수 체결 건수", + "NTBY_CNTG_CSNU": "순매수 체결 건수", + "CTTR": "체결강도", + "SELN_CNTG_SMTN": "총 매도 수량", + "SHNU_CNTG_SMTN": "총 매수 수량", + "CNTG_CLS_CODE": "체결구분", + "SHNU_RATE": "매수비율", + "PRDY_VOL_VRSS_ACML_VOL_RATE": "전일 거래량 대비 등락율", + "OPRC_HOUR": "시가 시간", + "OPRC_VRSS_PRPR_SIGN": "시가대비구분", + "OPRC_VRSS_PRPR": "시가대비", + "HGPR_HOUR": "최고가 시간", + "HGPR_VRSS_PRPR_SIGN": "고가대비구분", + "HGPR_VRSS_PRPR": "고가대비", + "LWPR_HOUR": "최저가 시간", + "LWPR_VRSS_PRPR_SIGN": "저가대비구분", + "LWPR_VRSS_PRPR": "저가대비", + "BSOP_DATE": "영업 일자", + "NEW_MKOP_CLS_CODE": "신 장운영 구분 코드", + "TRHT_YN": "거래정지 여부", + "ASKP_RSQN1": "매도호가 잔량1", + "BIDP_RSQN1": "매수호가 잔량1", + "TOTAL_ASKP_RSQN": "총 매도호가 잔량", + "TOTAL_BIDP_RSQN": "총 매수호가 잔량", + "VOL_TNRT": "거래량 회전율", + "PRDY_SMNS_HOUR_ACML_VOL": "전일 동시간 누적 거래량", + "PRDY_SMNS_HOUR_ACML_VOL_RATE": "전일 동시간 누적 거래량 비율", + "HOUR_CLS_CODE": "시간 구분 코드", + "MRKT_TRTM_CLS_CODE": "임의종료구분코드", + "VI_STND_PRC": "정적VI발동기준가" +} + +NUMERIC_COLUMNS = [ + "주식 현재가", "전일 대비", "전일 대비율", "가중 평균 주식 가격", "주식 시가", + "주식 최고가", "주식 최저가", "매도호가1", "매수호가1", "체결 거래량", + "누적 거래량", "누적 거래 대금", "매도 체결 건수", "매수 체결 건수", + "순매수 체결 건수", "체결강도", "총 매도 수량", "총 매수 수량", "매수비율", + "전일 거래량 대비 등락율", "시가대비", "고가대비", "저가대비", "매도호가 잔량1", + "매수호가 잔량1", "총 매도호가 잔량", "총 매수호가 잔량", "거래량 회전율", + "전일 동시간 누적 거래량", "전일 동시간 누적 거래량 비율", "정적VI발동기준가" +] + + +def main(): + """ + 국내주식 실시간체결가 (통합) + + 국내주식 실시간체결가 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_total, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_chk_holiday.py b/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_chk_holiday.py new file mode 100644 index 0000000..baad0c9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_chk_holiday.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from chk_holiday import chk_holiday + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 업종/기타 > 국내휴장일조회[국내주식-040] +############################################################################################## + +COLUMN_MAPPING = { + 'bass_dt': '기준일자', + 'wday_dvsn_cd': '요일구분코드', + 'bzdy_yn': '영업일여부', + 'tr_day_yn': '거래일여부', + 'opnd_yn': '개장일여부', + 'sttl_day_yn': '결제일여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내휴장일조회 테스트 함수 + + 이 함수는 국내휴장일조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = chk_holiday(bass_dt="20250630") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_holiday.py b/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_holiday.py new file mode 100644 index 0000000..24c2c33 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/chk_holiday/chk_holiday.py @@ -0,0 +1,109 @@ +""" +Created on 20250601 +""" + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 업종/기타 > 국내휴장일조회[국내주식-040] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/chk-holiday" + + +def chk_holiday( + bass_dt: str, # 기준일자 (YYYYMMDD) + NK100: str = "", # 연속조회키 + FK100: str = "", # 연속조회검색조건 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + (★중요) 국내휴장일조회(TCA0903R) 서비스는 당사 원장서비스와 연관되어 있어 + 단시간 내 다수 호출시 서비스에 영향을 줄 수 있어 가급적 1일 1회 호출 부탁드립니다. + + 국내휴장일조회 API입니다. + 영업일, 거래일, 개장일, 결제일 여부를 조회할 수 있습니다. + 주문을 넣을 수 있는지 확인하고자 하실 경우 개장일여부(opnd_yn)을 사용하시면 됩니다. + + Args: + bass_dt (str): [필수] 기준일자 (ex. YYYYMMDD) + NK100 (str): 연속조회키 + FK100 (str): 연속조회검색조건 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 국내휴장일조회 데이터 + + Example: + >>> df = chk_holiday(bass_dt="20250630") + >>> print(df) + """ + + if bass_dt == "": + raise ValueError("bass_dt is required (e.g. 'YYYYMMDD')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTCA0903R" # 국내휴장일조회 + + params = { + "BASS_DT": bass_dt, + "CTX_AREA_FK": FK100, + "CTX_AREA_NK": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk + NK100 = res.getBody().ctx_area_nk + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return chk_holiday( + bass_dt, NK100, FK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/chk_comp_interest.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/chk_comp_interest.py new file mode 100644 index 0000000..2b74748 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/chk_comp_interest.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from comp_interest import comp_interest + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 금리 종합(국내채권_금리)[국내주식-155] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bcdt_code': '자료코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'bond_mnrt_prpr': '채권금리현재가', + 'prdy_vrss_sign': '전일대비부호', + 'bond_mnrt_prdy_vrss': '채권금리전일대비', + 'prdy_ctrt': '전일대비율', + 'stck_bsop_date': '주식영업일자', + 'bcdt_code': '자료코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'bond_mnrt_prpr': '채권금리현재가', + 'prdy_vrss_sign': '전일대비부호', + 'bond_mnrt_prdy_vrss': '채권금리전일대비', + 'bstp_nmix_prdy_ctrt': '업종지수전일대비율', + 'stck_bsop_date': '주식영업일자' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 업종/기타 + 금리 종합(국내채권_금리)[국내주식-155] + + 금리 종합(국내채권_금리) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (Unique key(I)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Unique key(20702)) + - fid_div_cls_code (str): 분류구분코드 (1: 해외금리지표) + - fid_div_cls_code1 (str): 분류구분코드 (공백 : 전체) + + Returns: + - Tuple[DataFrame, ...]: 금리 종합(국내채권_금리) 결과 + + Example: + >>> df1, df2 = comp_interest(fid_cond_mrkt_div_code="I", fid_cond_scr_div_code="20702", fid_div_cls_code="1", fid_div_cls_code1="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = comp_interest( + fid_cond_mrkt_div_code="I", # 조건시장분류코드 + fid_cond_scr_div_code="20702", # 조건화면분류코드 + fid_div_cls_code="1", # 분류구분코드 + fid_div_cls_code1="", # 분류구분코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/comp_interest.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/comp_interest.py new file mode 100644 index 0000000..b9e8c09 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_interest/comp_interest.py @@ -0,0 +1,135 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 금리 종합(국내채권_금리)[국내주식-155] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/comp-interest" + +def comp_interest( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_div_cls_code: str, # 분류구분코드 + fid_div_cls_code1: str, # 분류구분코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 금리 종합(국내채권_금리)[국내주식-155] + 금리 종합(국내채권_금리) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_div_cls_code (str): 분류구분코드 (필수) + fid_div_cls_code1 (str): 분류구분코드 (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 금리 종합(국내채권_금리) 데이터 + + Example: + >>> df1, df2 = comp_interest('01', '20702', '1', '') + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. '01')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. '01')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20702')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20702')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHPST07020000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_DIV_CLS_CODE1": fid_div_cls_code1, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return comp_interest( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_div_cls_code1, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/chk_comp_program_trade_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/chk_comp_program_trade_daily.py new file mode 100644 index 0000000..c590256 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/chk_comp_program_trade_daily.py @@ -0,0 +1,145 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from comp_program_trade_daily import comp_program_trade_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(일별)[국내주식-115] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'nabt_entm_seln_tr_pbmn': '비차익 위탁 매도 거래 대금', + 'nabt_onsl_seln_vol': '비차익 자기 매도 거래량', + 'whol_onsl_seln_tr_pbmn': '전체 자기 매도 거래 대금', + 'arbt_smtn_shnu_vol': '차익 합계 매수2 거래량', + 'nabt_smtn_shnu_tr_pbmn': '비차익 합계 매수2 거래 대금', + 'arbt_entm_ntby_qty': '차익 위탁 순매수 수량', + 'nabt_entm_ntby_tr_pbmn': '비차익 위탁 순매수 거래 대금', + 'arbt_entm_seln_vol': '차익 위탁 매도 거래량', + 'nabt_entm_seln_vol_rate': '비차익 위탁 매도 거래량 비율', + 'nabt_onsl_seln_vol_rate': '비차익 자기 매도 거래량 비율', + 'whol_onsl_seln_tr_pbmn_rate': '전체 자기 매도 거래 대금 비율', + 'arbt_smtm_shun_vol_rate': '차익 합계 매수 거래량 비율', + 'nabt_smtm_shun_tr_pbmn_rate': '비차익 합계 매수 거래대금 비율', + 'arbt_entm_ntby_qty_rate': '차익 위탁 순매수 수량 비율', + 'nabt_entm_ntby_tr_pbmn_rate': '비차익 위탁 순매수 거래 대금', + 'arbt_entm_seln_vol_rate': '차익 위탁 매도 거래량 비율', + 'nabt_entm_seln_tr_pbmn_rate': '비차익 위탁 매도 거래 대금 비', + 'nabt_onsl_seln_tr_pbmn': '비차익 자기 매도 거래 대금', + 'whol_smtn_seln_vol': '전체 합계 매도 거래량', + 'arbt_smtn_shnu_tr_pbmn': '차익 합계 매수2 거래 대금', + 'whol_entm_shnu_vol': '전체 위탁 매수2 거래량', + 'arbt_entm_ntby_tr_pbmn': '차익 위탁 순매수 거래 대금', + 'nabt_onsl_ntby_qty': '비차익 자기 순매수 수량', + 'arbt_entm_seln_tr_pbmn': '차익 위탁 매도 거래 대금', + 'whol_seln_vol_rate': '전체 매도 거래량 비율', + 'whol_entm_shnu_vol_rate': '전체 위탁 매수 거래량 비율', + 'whol_entm_seln_tr_pbmn': '전체 위탁 매도 거래 대금', + 'nabt_smtm_seln_vol': '비차익 합계 매도 거래량', + 'arbt_entm_shnu_vol': '차익 위탁 매수2 거래량', + 'nabt_entm_shnu_tr_pbmn': '비차익 위탁 매수2 거래 대금', + 'whol_onsl_shnu_vol': '전체 자기 매수2 거래량', + 'arbt_onsl_ntby_tr_pbmn': '차익 자기 순매수 거래 대금', + 'nabt_smtn_ntby_qty': '비차익 합계 순매수 수량', + 'arbt_onsl_seln_vol': '차익 자기 매도 거래량', + 'whol_entm_ntby_qty': '전체 위탁 순매수 수량', + 'nabt_onsl_ntby_tr_pbmn': '비차익 자기 순매수 거래 대금', + 'arbt_onsl_seln_tr_pbmn': '차익 자기 매도 거래 대금', + 'nabt_smtm_seln_tr_pbmn_rate': '비차익 합계 매도 거래대금 비율', + 'arbt_entm_shnu_vol_rate': '차익 위탁 매수 거래량 비율', + 'nabt_entm_shnu_tr_pbmn_rate': '비차익 위탁 매수 거래 대금 비', + 'whol_onsl_shnu_tr_pbmn': '전체 자기 매수2 거래 대금', + 'arbt_onsl_ntby_tr_pbmn_rate': '차익 자기 순매수 거래 대금 비', + 'nabt_smtm_ntby_qty_rate': '비차익 합계 순매수 수량 비율', + 'arbt_onsl_seln_vol_rate': '차익 자기 매도 거래량 비율', + 'whol_entm_seln_vol': '전체 위탁 매도 거래량', + 'arbt_entm_shnu_tr_pbmn': '차익 위탁 매수2 거래 대금', + 'nabt_onsl_shnu_vol': '비차익 자기 매수2 거래량', + 'whol_smtn_shnu_vol': '전체 합계 매수2 거래량', + 'arbt_smtn_ntby_tr_pbmn': '차익 합계 순매수 거래 대금', + 'arbt_smtn_seln_vol': '차익 합계 매도 거래량', + 'whol_entm_seln_tr_pbmn_rate': '전체 위탁 매도 거래 대금 비율', + 'nabt_onsl_seln_vol_rate': '전체 자기 매도 거래량 비율', + 'arbt_onsl_shnu_vol_rate': '차익 자기 매수 거래량 비율', + 'nabt_smtm_shun_vol_rate': '비차익 합계 매수 거래량 비율', + 'whol_shun_tr_pbmn_rate': '전체 매수 거래대금 비율', + 'nabt_entm_ntby_qty_rate': '비차익 위탁 순매수 수량 비율', + 'arbt_smtm_seln_tr_pbmn_rate': '차익 합계 매도 거래대금 비율', + 'arbt_onsl_shnu_vol': '차익 자기 매수2 거래량', + 'nabt_onsl_shnu_tr_pbmn': '비차익 자기 매수2 거래 대금', + 'nabt_smtn_shnu_vol': '비차익 합계 매수2 거래량', + 'whol_smtn_shnu_tr_pbmn': '전체 합계 매수2 거래 대금', + 'arbt_smtm_ntby_qty': '차익 합계 순매수 수량', + 'nabt_smtn_ntby_tr_pbmn': '비차익 합계 순매수 거래 대금', + 'arbt_smtn_seln_tr_pbmn': '차익 합계 매도 거래 대금', + 'arbt_onsl_shnu_tr_pbmn_rate': '차익 자기 매수 거래 대금 비율', + 'whol_shun_vol_rate': '전체 매수 거래량 비율', + 'arbt_smtm_ntby_tr_pbmn_rate': '차익 합계 순매수 거래대금 비율', + 'whol_entm_ntby_qty_rate': '전체 위탁 순매수 수량 비율', + 'arbt_smtm_seln_tr_pbmn_rate': '차익 합계 매도 거래대금 비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 프로그램매매 종합현황(일별) 조회 테스트 함수 + + 이 함수는 프로그램매매 종합현황(일별) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = comp_program_trade_daily( + fid_cond_mrkt_div_code="J", + fid_mrkt_cls_code="K", + fid_input_date_1="20250101", + fid_input_date_2="20250617" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 (메타데이터에 number로 명시적으로 선언된 필드가 없음) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/comp_program_trade_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/comp_program_trade_daily.py new file mode 100644 index 0000000..730570a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_daily/comp_program_trade_daily.py @@ -0,0 +1,69 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(일별)[국내주식-115] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/comp-program-trade-daily" + + +def comp_program_trade_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식,NX:NXT,UN:통합) + fid_mrkt_cls_code: str, # [필수] 시장구분코드 (ex. K:코스피,Q:코스닥) + fid_input_date_1: str = "", # 검색시작일 + fid_input_date_2: str = "" # 검색종료일 +) -> pd.DataFrame: + """ + 프로그램매매 종합현황(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0460] 프로그램매매 종합현황 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식,NX:NXT,UN:통합) + fid_mrkt_cls_code (str): [필수] 시장구분코드 (ex. K:코스피,Q:코스닥) + fid_input_date_1 (str): 검색시작일 + fid_input_date_2 (str): 검색종료일 + + Returns: + pd.DataFrame: 프로그램매매 종합현황(일별) 데이터 + + Example: + >>> df = comp_program_trade_daily("J", "K", "20250101", "20250617") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식,NX:NXT,UN:통합')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'K:코스피,Q:코스닥')") + + tr_id = "FHPPG04600001" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/chk_comp_program_trade_today.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/chk_comp_program_trade_today.py new file mode 100644 index 0000000..6c4b6f9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/chk_comp_program_trade_today.py @@ -0,0 +1,85 @@ +""" +Created on 20250101 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from comp_program_trade_today import comp_program_trade_today + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(시간) [국내주식-114] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'stck_clpr': '주식종가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'acml_tr_pbmn': '누적거래대금', + 'whol_smtn_seln_vol': '전체합계매도거래량', + 'whol_smtn_shnu_vol': '전체합계매수2', + 'whol_smtn_ntby_qty': '전체합계순매수수량', + 'whol_smtn_seln_tr_pbmn': '전체합계매도거래대금', + 'whol_smtn_shnu_tr_pbmn': '전체합계매수2거래대금', + 'whol_smtn_ntby_tr_pbmn': '전체합계순매수거래대금', + 'whol_ntby_vol_icdc': '전체순매수거래량증감', + 'whol_ntby_tr_pbmn_icdc2': '전체순매수거래대금증감2' +} + +NUMERIC_COLUMNS = ['전일대비율', '누적거래량', '누적거래대금', '전체합계매도거래량', '전체합계매수2', + '전체합계순매수수량', '전체합계매도거래대금', '전체합계매수2거래대금', '전체합계순매수거래대금'] + + +def main(): + """ + 프로그램매매 종합현황(시간) 조회 테스트 함수 + + 이 함수는 프로그램매매 종합현황(시간) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 코스피(K) 시장을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = comp_program_trade_today(fid_cond_mrkt_div_code="J", fid_mrkt_cls_code="K") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에서 number로 명시된 컬럼만) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/comp_program_trade_today.py b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/comp_program_trade_today.py new file mode 100644 index 0000000..1590335 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/comp_program_trade_today/comp_program_trade_today.py @@ -0,0 +1,81 @@ +""" +Created on 20250101 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(시간) [국내주식-114] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/comp-program-trade-today" + +def comp_program_trade_today( + fid_cond_mrkt_div_code: str, # [필수] 시장 구분 코드 (J:KRX,NX:NXT,UN:통합) + fid_mrkt_cls_code: str, # [필수] 시장구분코드 (K:코스피, Q:코스닥) + fid_sctn_cls_code: str = "", # 구간 구분 코드 + fid_input_iscd: str = "", # 입력종목코드 + fid_cond_mrkt_div_code1: str = "", # 시장분류코드 + fid_input_hour_1: str = "" # 입력시간 +) -> pd.DataFrame: + """ + 프로그램매매 종합현황(시간) API입니다. + 한국투자 HTS(eFriend Plus) > [0460] 프로그램매매 종합현황 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 장시간(09:00~15:30) 동안의 최근 30분간의 데이터 확인이 가능하며, 다음조회가 불가합니다. + ※ 장시간(09:00~15:30) 이후에는 bsop_hour 에 153000 ~ 170000 까지의 시간데이터가 출력되지만 데이터는 모두 동일한 장마감 데이터인 점 유의 부탁드립니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 구분 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_mrkt_cls_code (str): [필수] 시장구분코드 (ex. K:코스피, Q:코스닥) + fid_sctn_cls_code (str): 구간 구분 코드 + fid_input_iscd (str): 입력종목코드 + fid_cond_mrkt_div_code1 (str): 시장분류코드 + fid_input_hour_1 (str): 입력시간 + + Returns: + pd.DataFrame: 프로그램매매 종합현황 데이터 + + Example: + >>> df = comp_program_trade_today("J", "K") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX,NX:NXT,UN:통합')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'K:코스피, Q:코스닥')") + + tr_id = "FHPPG04600101" # 프로그램매매 종합현황(시간) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 구분 코드 + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, # 시장구분코드 + "FID_SCTN_CLS_CODE": fid_sctn_cls_code, # 구간 구분 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력종목코드 + "FID_COND_MRKT_DIV_CODE1": fid_cond_mrkt_div_code1,# 시장분류코드 + "FID_INPUT_HOUR_1": fid_input_hour_1 # 입력시간 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # array 타입이므로 DataFrame으로 반환 + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/chk_credit_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/chk_credit_balance.py new file mode 100644 index 0000000..62a500b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/chk_credit_balance.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from credit_balance import credit_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신용잔고 상위 [국내주식-109] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bstp_cls_code': '업종 구분 코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stnd_date1': '기준 일자1', + 'stnd_date2': '기준 일자2', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'whol_loan_rmnd_stcn': '전체 융자 잔고 주수', + 'whol_loan_rmnd_amt': '전체 융자 잔고 금액', + 'whol_loan_rmnd_rate': '전체 융자 잔고 비율', + 'whol_stln_rmnd_stcn': '전체 대주 잔고 주수', + 'whol_stln_rmnd_amt': '전체 대주 잔고 금액', + 'whol_stln_rmnd_rate': '전체 대주 잔고 비율', + 'nday_vrss_loan_rmnd_inrt': 'N일 대비 융자 잔고 증가율', + 'nday_vrss_stln_rmnd_inrt': 'N일 대비 대주 잔고 증가율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 신용잔고 상위[국내주식-109] + + 국내주식 신용잔고 상위 테스트 함수 + + Parameters: + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(11701)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200,) + - fid_option (str): 증가율기간 (2~999) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 ('(융자)0:잔고비율 상위, 1: 잔고수량 상위, 2: 잔고금액 상위, 3: 잔고비율 증가상위, 4: 잔고비율 감소상위 (대주)5:잔고비율 상위, 6: 잔고수량 상위, 7: 잔고금액 상위, 8: 잔고비율 증가상위, 9: 잔고비율 감소상위 ') + + Returns: + - Tuple[DataFrame, ...]: 국내주식 신용잔고 상위 결과 + + Example: + >>> df1, df2 = credit_balance(fid_cond_scr_div_code="11701", fid_input_iscd="0000", fid_option="2", fid_cond_mrkt_div_code="J", fid_rank_sort_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 국내주식 신용잔고 상위") + result1, result2 = credit_balance( + fid_cond_scr_div_code="11701", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_option="2", # 증가율기간 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/credit_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/credit_balance.py new file mode 100644 index 0000000..1b04212 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/credit_balance/credit_balance.py @@ -0,0 +1,164 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신용잔고 상위 [국내주식-109] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/credit-balance" + +def credit_balance( + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_option: str, # 증가율기간 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 신용잔고 상위[국내주식-109] + 국내주식 신용잔고 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): Unique key(11701) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, + fid_option (str): 2~999 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_rank_sort_cls_code (str): '(융자)0:잔고비율 상위, 1: 잔고수량 상위, 2: 잔고금액 상위, 3: 잔고비율 증가상위, 4: 잔고비율 감소상위 (대주)5:잔고비율 상위, 6: 잔고수량 상위, 7: 잔고금액 상위, 8: 잔고비율 증가상위, 9: 잔고비율 감소상위 ' + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 신용잔고 상위 데이터 + + Example: + >>> df1, df2 = credit_balance('11701', '0000', '2', 'J', '0') + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11701')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11701')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_option: + logger.error("fid_option is required. (e.g. '2')") + raise ValueError("fid_option is required. (e.g. '2')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if fid_rank_sort_cls_code not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKST17010000" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_OPTION": fid_option, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return credit_balance( + fid_cond_scr_div_code, + fid_input_iscd, + fid_option, + fid_cond_mrkt_div_code, + fid_rank_sort_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/chk_credit_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/chk_credit_by_company.py new file mode 100644 index 0000000..79409a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/chk_credit_by_company.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from credit_by_company import credit_by_company + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 당사 신용가능종목[국내주식-111] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'crdt_rate': '신용 비율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 당사 신용가능종목[국내주식-111] + + 국내주식 당사 신용가능종목 테스트 함수 + + Parameters: + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0:코드순, 1:이름순) + - fid_slct_yn (str): 선택 여부 (0:신용주문가능, 1: 신용주문불가) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20477)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + Returns: + - DataFrame: 국내주식 당사 신용가능종목 결과 + + Example: + >>> df = credit_by_company(fid_rank_sort_cls_code="0", fid_slct_yn="0", fid_input_iscd="0000", fid_cond_scr_div_code="20477", fid_cond_mrkt_div_code="J") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = credit_by_company( + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_slct_yn="0", # 선택 여부 + fid_input_iscd="0000", # 입력 종목코드 + fid_cond_scr_div_code="20477", # 조건 화면 분류 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 당사 신용가능종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/credit_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/credit_by_company.py new file mode 100644 index 0000000..0fd55f0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/credit_by_company/credit_by_company.py @@ -0,0 +1,151 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 당사 신용가능종목[국내주식-111] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/credit-by-company" + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +def credit_by_company( + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_slct_yn: str, # 선택 여부 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 당사 신용가능종목[국내주식-111] + 국내주식 당사 신용가능종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_rank_sort_cls_code (str): 0:코드순, 1:이름순 + fid_slct_yn (str): 0:신용주문가능, 1: 신용주문불가 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_cond_scr_div_code (str): Unique key(20477) + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 당사 신용가능종목 데이터 + + Example: + >>> df = credit_by_company( + ... fid_rank_sort_cls_code="1", + ... fid_slct_yn="0", + ... fid_input_iscd="0000", + ... fid_cond_scr_div_code="20477", + ... fid_cond_mrkt_div_code="J" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + + if not fid_slct_yn: + logger.error("fid_slct_yn is required. (e.g. '0')") + raise ValueError("fid_slct_yn is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20477')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20477')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 ID 설정 + + tr_id = "FHPST04770000" + + # 요청 파라미터 설정 + params = { + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_slct_yn": fid_slct_yn, + "fid_input_iscd": fid_input_iscd, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return credit_by_company( + fid_rank_sort_cls_code, + fid_slct_yn, + fid_input_iscd, + fid_cond_scr_div_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/chk_daily_credit_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/chk_daily_credit_balance.py new file mode 100644 index 0000000..9976632 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/chk_daily_credit_balance.py @@ -0,0 +1,122 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from daily_credit_balance import daily_credit_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 신용잔고 일별추이[국내주식-110] +############################################################################################## + +COLUMN_MAPPING = { + 'deal_date': '매매 일자', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'stlm_date': '결제 일자', + 'whol_loan_new_stcn': '전체 융자 신규 주수', + 'whol_loan_rdmp_stcn': '전체 융자 상환 주수', + 'whol_loan_rmnd_stcn': '전체 융자 잔고 주수', + 'whol_loan_new_amt': '전체 융자 신규 금액', + 'whol_loan_rdmp_amt': '전체 융자 상환 금액', + 'whol_loan_rmnd_amt': '전체 융자 잔고 금액', + 'whol_loan_rmnd_rate': '전체 융자 잔고 비율', + 'whol_loan_gvrt': '전체 융자 공여율', + 'whol_stln_new_stcn': '전체 대주 신규 주수', + 'whol_stln_rdmp_stcn': '전체 대주 상환 주수', + 'whol_stln_rmnd_stcn': '전체 대주 잔고 주수', + 'whol_stln_new_amt': '전체 대주 신규 금액', + 'whol_stln_rdmp_amt': '전체 대주 상환 금액', + 'whol_stln_rmnd_amt': '전체 대주 잔고 금액', + 'whol_stln_rmnd_rate': '전체 대주 잔고 비율', + 'whol_stln_gvrt': '전체 대주 공여율', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가' +} + +NUMERIC_COLUMNS = ['전일 대비율', '누적 거래량', '전체 융자 신규 주수', '전체 융자 상환 주수', '전체 융자 잔고 주수', + '전체 융자 신규 금액', '전체 융자 상환 금액', '전체 융자 잔고 금액', '전체 융자 잔고 비율', '전체 융자 공여율', + '전체 대주 신규 주수', '전체 대주 상환 주수', '전체 대주 잔고 주수', '전체 대주 신규 금액', '전체 대주 상환 금액', + '전체 대주 잔고 금액', '전체 대주 잔고 비율', '전체 대주 공여율', '주식 시가2', '주식 최고가', '주식 최저가'] + + +def main(): + """ + 국내주식 신용잔고 일별추이 조회 테스트 함수 + + 이 함수는 국내주식 신용잔고 일별추이 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 셀트리온(068270)을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1 = daily_credit_balance(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20476", + fid_input_iscd="068270", fid_input_date_1="20240508") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # case2 조회 + logging.info("=== case2 조회 ===") + try: + result2 = daily_credit_balance(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20476", + fid_input_iscd="068270", fid_input_date_1="20240501") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/daily_credit_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/daily_credit_balance.py new file mode 100644 index 0000000..9d2f139 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_credit_balance/daily_credit_balance.py @@ -0,0 +1,112 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 신용잔고 일별추이[국내주식-110] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/daily-credit-balance" + +def daily_credit_balance( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 + fid_cond_scr_div_code: str, # [필수] 화면 분류 코드 + fid_input_iscd: str, # [필수] 종목코드 + fid_input_date_1: str, # [필수] 결제일자 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 국내주식 신용잔고 일별추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0476] 국내주식 신용잔고 일별추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 한 번의 호출에 최대 30건 확인 가능하며, fid_input_date_1 을 입력하여 다음 조회가 가능합니다. + + ※ 상환수량은 "매도상환수량+현금상환수량"의 합계 수치입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J: 주식) + fid_cond_scr_div_code (str): [필수] 화면 분류 코드 (ex. 20476) + fid_input_iscd (str): [필수] 종목코드 (ex. 005930) + fid_input_date_1 (str): [필수] 결제일자 (ex. 20240313) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 국내주식 신용잔고 일별추이 데이터 + + Example: + >>> df = daily_credit_balance("J", "20476", "005930", "20240313") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20476')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20240313')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "FHPST04760000" # 국내주식 신용잔고 일별추이 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 분류 코드 + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, # 화면 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 종목코드 + "FID_INPUT_DATE_1": fid_input_date_1 # 결제일자 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return daily_credit_balance( + fid_cond_mrkt_div_code, fid_cond_scr_div_code, fid_input_iscd, fid_input_date_1, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/chk_daily_loan_trans.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/chk_daily_loan_trans.py new file mode 100644 index 0000000..f4cab9f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/chk_daily_loan_trans.py @@ -0,0 +1,84 @@ +""" +Created on 20250114 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from daily_loan_trans import daily_loan_trans + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 일별 대차거래추이 [국내주식-135] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_date': '일자', + 'stck_prpr': '주식 종가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'new_stcn': '당일 증가 주수 (체결)', + 'rdmp_stcn': '당일 감소 주수 (상환)', + 'prdy_rmnd_vrss': '대차거래 증감', + 'rmnd_stcn': '당일 잔고 주수', + 'rmnd_amt': '당일 잔고 금액' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별 일별 대차거래추이 조회 테스트 함수 + + 이 함수는 종목별 일별 대차거래추이 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = daily_loan_trans( + mrkt_div_cls_code="1", + mksc_shrn_iscd="005930", + start_date="20240301", + end_date="20240328" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/daily_loan_trans.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/daily_loan_trans.py new file mode 100644 index 0000000..34bd18c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_loan_trans/daily_loan_trans.py @@ -0,0 +1,74 @@ +""" +Created on 20250114 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 일별 대차거래추이 [국내주식-135] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/daily-loan-trans" + +def daily_loan_trans( + mrkt_div_cls_code: str, # [필수] 조회구분 (ex. 1:코스피,2:코스닥,3:종목) + mksc_shrn_iscd: str, # [필수] 종목코드 (ex. 123456) + start_date: str = "", # 시작일자 + end_date: str = "", # 종료일자 + cts: str = "" # 이전조회KEY +) -> pd.DataFrame: + """ + 종목별 일별 대차거래추이 API입니다. + 한 번의 조회에 최대 100건까지 조회 가능하며, start_date, end_date 를 수정하여 다음 조회가 가능합니다. + + Args: + mrkt_div_cls_code (str): [필수] 조회구분 (ex. 1:코스피,2:코스닥,3:종목) + mksc_shrn_iscd (str): [필수] 종목코드 (ex. 123456) + start_date (str): 시작일자 + end_date (str): 종료일자 + cts (str): 이전조회KEY + + Returns: + pd.DataFrame: 종목별 일별 대차거래추이 데이터 + + Example: + >>> df = daily_loan_trans(mrkt_div_cls_code="1", mksc_shrn_iscd="005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if mrkt_div_cls_code == "": + raise ValueError("mrkt_div_cls_code is required (e.g. '1', '2', '3')") + + if mksc_shrn_iscd == "": + raise ValueError("mksc_shrn_iscd is required (e.g. '123456')") + + tr_id = "HHPST074500C0" + + params = { + "MRKT_DIV_CLS_CODE": mrkt_div_cls_code, + "MKSC_SHRN_ISCD": mksc_shrn_iscd, + "START_DATE": start_date, + "END_DATE": end_date, + "CTS": cts + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + result_data = pd.DataFrame(res.getBody().output1) + return result_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/chk_daily_short_sale.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/chk_daily_short_sale.py new file mode 100644 index 0000000..b38053b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/chk_daily_short_sale.py @@ -0,0 +1,118 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from daily_short_sale import daily_short_sale + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 공매도 일별추이[국내주식-134] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'stnd_vol_smtn': '기준 거래량 합계', + 'ssts_cntg_qty': '공매도 체결 수량', + 'ssts_vol_rlim': '공매도 거래량 비중', + 'acml_ssts_cntg_qty': '누적 공매도 체결 수량', + 'acml_ssts_cntg_qty_rlim': '누적 공매도 체결 수량 비중', + 'acml_tr_pbmn': '누적 거래 대금', + 'stnd_tr_pbmn_smtn': '기준 거래대금 합계', + 'ssts_tr_pbmn': '공매도 거래 대금', + 'ssts_tr_pbmn_rlim': '공매도 거래대금 비중', + 'acml_ssts_tr_pbmn': '누적 공매도 거래 대금', + 'acml_ssts_tr_pbmn_rlim': '누적 공매도 거래 대금 비중', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'avrg_prc': '평균가격' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 국내주식 공매도 일별추이 조회 테스트 함수 + + 이 함수는 국내주식 공매도 일별추이 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = daily_short_sale( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_date_1="20240301", + fid_input_date_2="20240328" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 타입 명시된 것이 없으므로 비어있음) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 타입 명시된 것이 없으므로 비어있음) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/daily_short_sale.py b/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/daily_short_sale.py new file mode 100644 index 0000000..bbec114 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/daily_short_sale/daily_short_sale.py @@ -0,0 +1,77 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 공매도 일별추이[국내주식-134] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/daily-short-sale" + +def daily_short_sale( + fid_cond_mrkt_div_code: str, # [필수] 시장분류코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 종목코드 (ex. 123456) + fid_input_date_1: str = "", # 시작일자 + fid_input_date_2: str = "" # 종료일자 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 공매도 일별추이를 조회합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + fid_input_date_1 (str): 시작일자 + fid_input_date_2 (str): 종료일자 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 쌍 + + Example: + >>> df1, df2 = daily_short_sale("J", "005930", "20240301", "20240328") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST04830000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object 타입 -> DataFrame) + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 처리 (array 타입 -> DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/disparity/chk_disparity.py b/한국투자증권(API)/examples_llm/domestic_stock/disparity/chk_disparity.py new file mode 100644 index 0000000..2452d3c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/disparity/chk_disparity.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from disparity import disparity + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 이격도 순위 [v1_국내주식-095] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'prdy_vrss_sign': '전일 대비 부호', + 'acml_vol': '누적 거래량', + 'd5_dsrt': '5일 이격도', + 'd10_dsrt': '10일 이격도', + 'd20_dsrt': '20일 이격도', + 'd60_dsrt': '60일 이격도', + 'd120_dsrt': '120일 이격도' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 이격도 순위[v1_국내주식-095] + + 국내주식 이격도 순위 테스트 함수 + + Parameters: + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20178 )) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보톧주, 7:우선주) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0: 이격도상위순, 1:이격도하위순) + - fid_hour_cls_code (str): 시간 구분 코드 (5:이격도5, 10:이격도10, 20:이격도20, 60:이격도60, 120:이격도120) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + Returns: + - DataFrame: 국내주식 이격도 순위 결과 + + Example: + >>> df = disparity(fid_input_price_2="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20178", fid_div_cls_code="0", fid_rank_sort_cls_code="0", fid_hour_cls_code="5", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="", fid_vol_cnt="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 국내주식 이격도 순위") + result = disparity( + fid_input_price_2="", # 입력 가격2 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20178", # 조건 화면 분류 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_hour_cls_code="5", # 시간 구분 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_input_price_1="", # 입력 가격1 + fid_vol_cnt="" # 거래량 수 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 이격도 순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/disparity/disparity.py b/한국투자증권(API)/examples_llm/domestic_stock/disparity/disparity.py new file mode 100644 index 0000000..12c2884 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/disparity/disparity.py @@ -0,0 +1,169 @@ +""" +Created on 2025-06-16 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 이격도 순위 [v1_국내주식-095] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/disparity" + +def disparity( + fid_input_price_2: str, # 입력 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_hour_cls_code: str, # 시간 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 이격도 순위[v1_국내주식-095] + 국내주식 이격도 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20178 ) + fid_div_cls_code (str): 0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보톧주, 7:우선주 + fid_rank_sort_cls_code (str): 0: 이격도상위순, 1:이격도하위순 + fid_hour_cls_code (str): 5:이격도5, 10:이격도10, 20:이격도20, 60:이격도60, 120:이격도120 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 이격도 순위 데이터 + + Example: + >>> df = disparity( + ... fid_input_price_2="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20178", + ... fid_div_cls_code="0", + ... fid_rank_sort_cls_code="0", + ... fid_hour_cls_code="5", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_vol_cnt="" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20178')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20178')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '5')") + raise ValueError("fid_hour_cls_code is required. (e.g. '5')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01780000" + + params = { + "fid_input_price_2": fid_input_price_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_hour_cls_code": fid_hour_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_vol_cnt": fid_vol_cnt, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return disparity( + fid_input_price_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_rank_sort_cls_code, + fid_hour_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_vol_cnt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/chk_dividend_rate.py b/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/chk_dividend_rate.py new file mode 100644 index 0000000..1efee9b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/chk_dividend_rate.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from dividend_rate import dividend_rate + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 배당률 상위[국내주식-106] +############################################################################################## + +COLUMN_MAPPING = { + 'rank': '순위', + 'sht_cd': '종목코드', + 'record_date': '기준일', + 'per_sto_divi_amt': '현금/주식배당금', + 'divi_rate': '현금/주식배당률(%)', + 'divi_kind': '배당종류' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 배당률 상위[국내주식-106] + + 국내주식 배당률 상위 테스트 함수 + + Parameters: + - cts_area (str): CTS_AREA (공백) + - gb1 (str): KOSPI (0:전체, 1:코스피, 2: 코스피200, 3: 코스닥) + - upjong (str): 업종구분 ('코스피(0001:종합, 0002:대형주.…0027:제조업 ), 코스닥(1001:종합, …. 1041:IT부품 코스피200 (2001:KOSPI200, 2007:KOSPI100, 2008:KOSPI50)') + - gb2 (str): 종목선택 (0:전체, 6:보통주, 7:우선주) + - gb3 (str): 배당구분 (1:주식배당, 2: 현금배당) + - f_dt (str): 기준일From () + - t_dt (str): 기준일To () + - gb4 (str): 결산/중간배당 (0:전체, 1:결산배당, 2:중간배당) + Returns: + - DataFrame: 국내주식 배당률 상위 결과 + + Example: + >>> df = dividend_rate(cts_area="", gb1="0", upjong="0001", gb2="0", gb3="1", f_dt="20230101", t_dt="20231231", gb4="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = dividend_rate( + cts_area="", # CTS_AREA + gb1="0", # KOSPI + upjong="0001", # 업종구분 + gb2="0", # 종목선택 + gb3="1", # 배당구분 + f_dt="20230101", # 기준일From + t_dt="20231231", # 기준일To + gb4="0", # 결산/중간배당 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 배당률 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/dividend_rate.py b/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/dividend_rate.py new file mode 100644 index 0000000..ea69b98 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/dividend_rate/dividend_rate.py @@ -0,0 +1,160 @@ +""" +Created on 2025-06-16 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 배당률 상위[국내주식-106] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/dividend-rate" + +def dividend_rate( + cts_area: str, # CTS_AREA + gb1: str, # KOSPI + upjong: str, # 업종구분 + gb2: str, # 종목선택 + gb3: str, # 배당구분 + f_dt: str, # 기준일From + t_dt: str, # 기준일To + gb4: str, # 결산/중간배당 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 배당률 상위[국내주식-106] + 국내주식 배당률 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts_area (str): 공백 + gb1 (str): 0:전체, 1:코스피, 2: 코스피200, 3: 코스닥, + upjong (str): '코스피(0001:종합, 0002:대형주.…0027:제조업 ), 코스닥(1001:종합, …. 1041:IT부품 코스피200 (2001:KOSPI200, 2007:KOSPI100, 2008:KOSPI50)' + gb2 (str): 0:전체, 6:보통주, 7:우선주 + gb3 (str): 1:주식배당, 2: 현금배당 + f_dt (str): 기준일 시작 + t_dt (str): 기준일 종료 + gb4 (str): 0:전체, 1:결산배당, 2:중간배당 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 배당률 상위 데이터 + + Example: + >>> df = dividend_rate( + ... cts_area=" ", + ... gb1="1", + ... upjong="0001", + ... gb2="0", + ... gb3="1", + ... f_dt="20230101", + ... t_dt="20231231", + ... gb4="0" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '1')") + raise ValueError("gb1 is required. (e.g. '1')") + + if not upjong: + logger.error("upjong is required. (e.g. '0001')") + raise ValueError("upjong is required. (e.g. '0001')") + + if not gb2: + logger.error("gb2 is required. (e.g. '0')") + raise ValueError("gb2 is required. (e.g. '0')") + + if not gb3: + logger.error("gb3 is required. (e.g. '1')") + raise ValueError("gb3 is required. (e.g. '1')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + if not gb4: + logger.error("gb4 is required. (e.g. '0')") + raise ValueError("gb4 is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB13470100" + + params = { + "CTS_AREA": cts_area, + "GB1": gb1, + "UPJONG": upjong, + "GB2": gb2, + "GB3": gb3, + "F_DT": f_dt, + "T_DT": t_dt, + "GB4": gb4, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return dividend_rate( + cts_area, + gb1, + upjong, + gb2, + gb3, + f_dt, + t_dt, + gb4, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/chk_estimate_perform.py b/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/chk_estimate_perform.py new file mode 100644 index 0000000..3af30d4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/chk_estimate_perform.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from estimate_perform import estimate_perform + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목추정실적[국내주식-187] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'sht_cd': 'ELW단축종목코드', + 'item_kor_nm': 'HTS한글종목명', + 'estdate': '전일대비부호', + 'capital': '누적거래량', + 'forn_item_lmtrt': '행사가', + 'data1': 'DATA1', + 'data2': 'DATA2', + 'data3': 'DATA3', + 'data4': 'DATA4', + 'data5': 'DATA5', + 'output3': '응답상세', + 'data1': 'DATA1', + 'data2': 'DATA2', + 'data3': 'DATA3', + 'data4': 'DATA4', + 'data5': 'DATA5', + 'output4': '응답상세', + 'dt': '결산년월' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 국내주식 종목추정실적[국내주식-187] + + 국내주식 종목추정실적 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (ex) 265520) + + Returns: + - Tuple[DataFrame, ...]: 국내주식 종목추정실적 결과 + + Example: + >>> df1, df2, df3, df4 = estimate_perform(sht_cd="265520") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 국내주식 종목추정실적") + result1, result2, result3, result4 = estimate_perform( + sht_cd="265520", # 종목코드 + ) + + # 결과 확인 + results = [result1, result2, result3, result4] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + # output3 결과 처리 + logger.info("=== output3 조회 ===") + if not result3.empty: + logger.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result3 = result3.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logger.info("output3 결과:") + print(result3) + else: + logger.info("output3 데이터가 없습니다.") + + # output4 결과 처리 + logger.info("=== output4 조회 ===") + if not result4.empty: + logger.info("사용 가능한 컬럼: %s", result4.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result4 = result4.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result4.columns: + result4[col] = pd.to_numeric(result4[col], errors='coerce').round(2) + + logger.info("output4 결과:") + print(result4) + else: + logger.info("output4 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/estimate_perform.py b/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/estimate_perform.py new file mode 100644 index 0000000..6ed8e15 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/estimate_perform/estimate_perform.py @@ -0,0 +1,138 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목추정실적[국내주식-187] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/estimate-perform" + +def estimate_perform( + sht_cd: str, # 종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + dataframe4: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output4) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 종목추정실적[국내주식-187] + 국내주식 종목추정실적 API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 종목코드 (예: 265520) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + dataframe4 (Optional[pd.DataFrame]): 누적 데이터프레임 (output4) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]: 국내주식 종목추정실적 데이터 + + Example: + >>> df1, df2, df3, df4 = estimate_perform("265520") + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not sht_cd: + logger.error("sht_cd is required. (e.g. '265520')") + raise ValueError("sht_cd is required. (e.g. '265520')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame(), + dataframe3 if dataframe3 is not None else pd.DataFrame(), + dataframe4 if dataframe4 is not None else pd.DataFrame() + ) + + tr_id = "HHKST668300C0" + + params = { + "SHT_CD": sht_cd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + current_data3 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe3 = pd.concat([dataframe3, current_data3], + ignore_index=True) if dataframe3 is not None else current_data3 + else: + dataframe3 = pd.DataFrame() if dataframe3 is None else dataframe3 + + # output4 처리 + if hasattr(res.getBody(), 'output4'): + output_data = res.getBody().output4 + if output_data: + current_data4 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe4 = pd.concat([dataframe4, current_data4], + ignore_index=True) if dataframe4 is not None else current_data4 + else: + dataframe4 = pd.DataFrame() if dataframe4 is None else dataframe4 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return estimate_perform( + sht_cd, dataframe1, dataframe2, dataframe3, dataframe4, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3, dataframe4 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/chk_exp_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/chk_exp_ccnl_krx.py new file mode 100644 index 0000000..773f0af --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/chk_exp_ccnl_krx.py @@ -0,0 +1,145 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_ccnl_krx import exp_ccnl_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비구분", + "prdy_vrss": "전일대비", + "prdy_ctrt": "등락율", + "wghn_avrg_stck_prc": "가중평균주식가격", + "stck_oprc": "시가", + "stck_hgpr": "고가", + "stck_lwpr": "저가", + "askp1": "매도호가", + "bidp1": "매수호가", + "cntg_vol": "거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "cttr": "체결강도", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "cntg_cls_code": "체결구분", + "shnu_rate": "매수비율", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가대비구분", + "oprc_vrss_prpr": "시가대비", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "고가대비구분", + "hgpr_vrss_prpr": "고가대비", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "저가대비구분", + "lwpr_vrss_prpr": "저가대비", + "bsop_date": "영업일자", + "new_mkop_cls_code": "신장운영구분코드", + "trht_yn": "거래정지여부", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "vol_tnrt": "거래량회전율", + "prdy_smns_hour_acml_vol": "전일동시간누적거래량", + "prdy_smns_hour_acml_vol_rate": "전일동시간누적거래량비율", + "hour_cls_code": "시간구분코드", + "mrkt_trtm_cls_code": "임의종료구분코드" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "등락율", "가중평균주식가격", "시가", "고가", "저가", + "매도호가", "매수호가", "거래량", "누적거래량", "누적거래대금", "매도체결건수", + "매수체결건수", "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수비율", + "전일거래량대비등락율", "시가대비", "고가대비", "저가대비", "매도호가잔량1", + "매수호가잔량1", "총매도호가잔량", "총매수호가잔량", "거래량회전율", + "전일동시간누적거래량", "전일동시간누적거래량비율" +] + + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (KRX) [실시간-041] +############################################################################################## + +def main(): + """ + 국내주식 실시간예상체결 (KRX) + + 국내주식 실시간예상체결 API입니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=exp_ccnl_krx, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/exp_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/exp_ccnl_krx.py new file mode 100644 index 0000000..df5a31b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_krx/exp_ccnl_krx.py @@ -0,0 +1,107 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (KRX) [실시간-041] +############################################################################################## + + +def exp_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (KRX)[H0STANC0] + 국내주식 실시간예상체결 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = exp_ccnl_krx("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + "hour_cls_code", + "mrkt_trtm_cls_code", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/chk_exp_ccnl_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/chk_exp_ccnl_nxt.py new file mode 100644 index 0000000..cc4cd25 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/chk_exp_ccnl_nxt.py @@ -0,0 +1,127 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_ccnl_nxt import exp_ccnl_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (NXT) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권단축종목코드", + "STCK_CNTG_HOUR": "주식체결시간", + "STCK_PRPR": "주식현재가", + "PRDY_VRSS_SIGN": "전일대비구분", + "PRDY_VRSS": "전일대비", + "PRDY_CTRT": "등락율", + "WGHN_AVRG_STCK_PRC": "가중평균주식가격", + "STCK_OPRC": "시가", + "STCK_HGPR": "고가", + "STCK_LWPR": "저가", + "ASKP1": "매도호가", + "BIDP1": "매수호가", + "CNTG_VOL": "거래량", + "ACML_VOL": "누적거래량", + "ACML_TR_PBMN": "누적거래대금", + "SELN_CNTG_CSNU": "매도체결건수", + "SHNU_CNTG_CSNU": "매수체결건수", + "NTBY_CNTG_CSNU": "순매수체결건수", + "CTTR": "체결강도", + "SELN_CNTG_SMTN": "총매도수량", + "SHNU_CNTG_SMTN": "총매수수량", + "CNTG_CLS_CODE": "체결구분", + "SHNU_RATE": "매수비율", + "PRDY_VOL_VRSS_ACML_VOL_RATE": "전일거래량대비등락율", + "OPRC_HOUR": "시가시간", + "OPRC_VRSS_PRPR_SIGN": "시가대비구분", + "OPRC_VRSS_PRPR": "시가대비", + "HGPR_HOUR": "최고가시간", + "HGPR_VRSS_PRPR_SIGN": "고가대비구분", + "HGPR_VRSS_PRPR": "고가대비", + "LWPR_HOUR": "최저가시간", + "LWPR_VRSS_PRPR_SIGN": "저가대비구분", + "LWPR_VRSS_PRPR": "저가대비", + "BSOP_DATE": "영업일자", + "NEW_MKOP_CLS_CODE": "신장운영구분코드", + "TRHT_YN": "거래정지여부", + "ASKP_RSQN1": "매도호가잔량1", + "BIDP_RSQN1": "매수호가잔량1", + "TOTAL_ASKP_RSQN": "총매도호가잔량", + "TOTAL_BIDP_RSQN": "총매수호가잔량", + "VOL_TNRT": "거래량회전율", + "PRDY_SMNS_HOUR_ACML_VOL": "전일동시간누적거래량", + "PRDY_SMNS_HOUR_ACML_VOL_RATE": "전일동시간누적거래량비율", + "HOUR_CLS_CODE": "시간구분코드", + "MRKT_TRTM_CLS_CODE": "임의종료구분코드", + "VI_STND_PRC": "VI 상태값" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "등락율", "가중평균주식가격", "시가", "고가", "저가", + "매도호가", "매수호가", "거래량", "누적거래량", "누적거래대금", "매도체결건수", + "매수체결건수", "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수비율", + "전일거래량대비등락율", "시가대비", "고가대비", "저가대비", "매도호가잔량1", + "매수호가잔량1", "총매도호가잔량", "총매수호가잔량", "거래량회전율", "전일동시간누적거래량", + "전일동시간누적거래량비율", "VI 상태값" +] + + +def main(): + """ + 국내주식 실시간예상체결 (NXT) + + 국내주식 실시간예상체결 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe( + request=exp_ccnl_nxt, + data=["005930", "000660", "005380"] + ) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/exp_ccnl_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/exp_ccnl_nxt.py new file mode 100644 index 0000000..2d0f4e4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_nxt/exp_ccnl_nxt.py @@ -0,0 +1,109 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (NXT) +############################################################################################## + +def exp_ccnl_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (NXT)[H0NXANC0] + 국내주식 실시간예상체결 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = exp_ccnl_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0NXANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/chk_exp_ccnl_total.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/chk_exp_ccnl_total.py new file mode 100644 index 0000000..baeff8d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/chk_exp_ccnl_total.py @@ -0,0 +1,127 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_ccnl_total import exp_ccnl_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결(통합) +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권단축종목코드", + "STCK_CNTG_HOUR": "주식체결시간", + "STCK_PRPR": "주식현재가", + "PRDY_VRSS_SIGN": "전일대비구분", + "PRDY_VRSS": "전일대비", + "PRDY_CTRT": "등락율", + "WGHN_AVRG_STCK_PRC": "가중평균주식가격", + "STCK_OPRC": "시가", + "STCK_HGPR": "고가", + "STCK_LWPR": "저가", + "ASKP1": "매도호가", + "BIDP1": "매수호가", + "CNTG_VOL": "거래량", + "ACML_VOL": "누적거래량", + "ACML_TR_PBMN": "누적거래대금", + "SELN_CNTG_CSNU": "매도체결건수", + "SHNU_CNTG_CSNU": "매수체결건수", + "NTBY_CNTG_CSNU": "순매수체결건수", + "CTTR": "체결강도", + "SELN_CNTG_SMTN": "총매도수량", + "SHNU_CNTG_SMTN": "총매수수량", + "CNTG_CLS_CODE": "체결구분", + "SHNU_RATE": "매수비율", + "PRDY_VOL_VRSS_ACML_VOL_RATE": "전일거래량대비등락율", + "OPRC_HOUR": "시가시간", + "OPRC_VRSS_PRPR_SIGN": "시가대비구분", + "OPRC_VRSS_PRPR": "시가대비", + "HGPR_HOUR": "최고가시간", + "HGPR_VRSS_PRPR_SIGN": "고가대비구분", + "HGPR_VRSS_PRPR": "고가대비", + "LWPR_HOUR": "최저가시간", + "LWPR_VRSS_PRPR_SIGN": "저가대비구분", + "LWPR_VRSS_PRPR": "저가대비", + "BSOP_DATE": "영업일자", + "NEW_MKOP_CLS_CODE": "신장운영구분코드", + "TRHT_YN": "거래정지여부", + "ASKP_RSQN1": "매도호가잔량1", + "BIDP_RSQN1": "매수호가잔량1", + "TOTAL_ASKP_RSQN": "총매도호가잔량", + "TOTAL_BIDP_RSQN": "총매수호가잔량", + "VOL_TNRT": "거래량회전율", + "PRDY_SMNS_HOUR_ACML_VOL": "전일동시간누적거래량", + "PRDY_SMNS_HOUR_ACML_VOL_RATE": "전일동시간누적거래량비율", + "HOUR_CLS_CODE": "시간구분코드", + "MRKT_TRTM_CLS_CODE": "임의종료구분코드", + "VI_STND_PRC": "VI 상태값" +} + +# 숫자형 컬럼 리스트 +NUMERIC_COLUMNS = [ + "STCK_PRPR", "PRDY_VRSS", "PRDY_CTRT", "WGHN_AVRG_STCK_PRC", "STCK_OPRC", + "STCK_HGPR", "STCK_LWPR", "ASKP1", "BIDP1", "CNTG_VOL", "ACML_VOL", + "ACML_TR_PBMN", "SELN_CNTG_CSNU", "SHNU_CNTG_CSNU", "NTBY_CNTG_CSNU", + "CTTR", "SELN_CNTG_SMTN", "SHNU_CNTG_SMTN", "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", "OPRC_VRSS_PRPR", "HGPR_VRSS_PRPR", + "LWPR_VRSS_PRPR", "ASKP_RSQN1", "BIDP_RSQN1", "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", "VOL_TNRT", "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", "VI_STND_PRC" +] + +def main(): + """ + 국내주식 실시간예상체결 (통합) + + 국내주식 실시간예상체결 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=exp_ccnl_total, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/exp_ccnl_total.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/exp_ccnl_total.py new file mode 100644 index 0000000..f912c51 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_ccnl_total/exp_ccnl_total.py @@ -0,0 +1,106 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결(통합) +############################################################################################## + +def exp_ccnl_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (통합)[H0UNANC0] + 국내주식 실시간예상체결 (통합) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 + + Example: + >>> msg, columns = exp_ccnl_total("1", "005930") + >>> print(msg, columns) + + Note: + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 시 지속적으로 데이터가 업데이트됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다. 빈 문자열을 사용할 수 없습니다.") + + tr_id = "H0UNANC0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터를 가져옵니다. + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터에 기반한 정확한 컬럼 리스트 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/chk_exp_closing_price.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/chk_exp_closing_price.py new file mode 100644 index 0000000..8051d40 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/chk_exp_closing_price.py @@ -0,0 +1,83 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_closing_price import exp_closing_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 장마감 예상체결가[국내주식-120] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'sdpr_vrss_prpr': '기준가 대비 현재가', + 'sdpr_vrss_prpr_rate': '기준가 대비 현재가 비율', + 'cntg_vol': '체결 거래량' +} + +NUMERIC_COLUMNS = ['전일 대비율', '기준가 대비 현재가 비율'] + + +def main(): + """ + 국내주식 장마감 예상체결가 조회 테스트 함수 + + 이 함수는 국내주식 장마감 예상체결가 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = exp_closing_price( + fid_cond_mrkt_div_code="J", + fid_input_iscd="0001", + fid_rank_sort_cls_code="0", + fid_cond_scr_div_code="11173", + fid_blng_cls_code="0" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/exp_closing_price.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/exp_closing_price.py new file mode 100644 index 0000000..1ad6feb --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_closing_price/exp_closing_price.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 장마감 예상체결가[국내주식-120] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/exp-closing-price" + +def exp_closing_price( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + fid_rank_sort_cls_code: str, # [필수] 순위정렬구분코드 (ex. 0:전체, 1:상한가마감예상, 2:하한가마감예상, 3:직전대비상승률상위, 4:직전대비하락률상위) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11173) + fid_blng_cls_code: str # [필수] 소속구분코드 (ex. 0:전체, 1:종가범위연장) +) -> pd.DataFrame: + """ + 국내주식 장마감 예상체결가 API입니다. + 한국투자 HTS(eFriend Plus) > [0183] 장마감 예상체결가 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:전체, 1:상한가마감예상, 2:하한가마감예상, 3:직전대비상승률상위, 4:직전대비하락률상위) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11173) + fid_blng_cls_code (str): [필수] 소속구분코드 (ex. 0:전체, 1:종가범위연장) + + Returns: + pd.DataFrame: 국내주식 장마감 예상체결가 데이터 + + Example: + >>> df = exp_closing_price("J", "0001", "0", "11173", "0") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000', '0001', '1001', '2001', '4001')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0', '1', '2', '3', '4')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11173')") + + if fid_blng_cls_code == "": + raise ValueError("fid_blng_cls_code is required (e.g. '0', '1')") + + tr_id = "FHKST117300C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/chk_exp_index_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/chk_exp_index_trend.py new file mode 100644 index 0000000..0e38b3b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/chk_exp_index_trend.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from exp_index_trend import exp_index_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결지수 추이[국내주식-121] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식 단축 종목코드', + 'bstp_nmix_prpr': 'HTS 한글 종목명', + 'prdy_vrss_sign': '주식 현재가', + 'bstp_nmix_prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비 부호', + 'acml_vol': '전일 대비율', + 'acml_tr_pbmn': '기준가 대비 현재가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내주식 예상체결지수 추이[국내주식-121] + + 국내주식 예상체결지수 추이 테스트 함수 + + Parameters: + - fid_mkop_cls_code (str): 장운영 구분 코드 (1: 장시작전, 2: 장마감) + - fid_input_hour_1 (str): 입력 시간1 (10(10초), 30(30초), 60(1분), 600(10분)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 U)) + Returns: + - DataFrame: 국내주식 예상체결지수 추이 결과 + + Example: + >>> df = exp_index_trend(fid_mkop_cls_code="1", fid_input_hour_1="", fid_input_iscd="0001", fid_cond_mrkt_div_code="U") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = exp_index_trend( + fid_mkop_cls_code="1", # 장운영 구분 코드 + fid_input_hour_1="", # 입력 시간1 + fid_input_iscd="0001", # 입력 종목코드 + fid_cond_mrkt_div_code="U", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 예상체결지수 추이 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/exp_index_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/exp_index_trend.py new file mode 100644 index 0000000..a515afc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_index_trend/exp_index_trend.py @@ -0,0 +1,124 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결지수 추이[국내주식-121] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/exp-index-trend" + + + +def exp_index_trend( + fid_mkop_cls_code: str, # 장운영 구분 코드 + fid_input_hour_1: str, # 입력 시간1 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식 예상체결지수 추이[국내주식-121] + 국내주식 예상체결지수 추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_mkop_cls_code (str): 1: 장시작전, 2: 장마감 + fid_input_hour_1 (str): 10(10초), 30(30초), 60(1분), 600(10분) + fid_input_iscd (str): 0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 예상체결지수 추이 데이터 + + Example: + >>> df = exp_index_trend('1', '10', '0000', 'U') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '1')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '1')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01840000" + + params = { + "FID_MKOP_CLS_CODE": fid_mkop_cls_code, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return exp_index_trend( + fid_mkop_cls_code, + fid_input_hour_1, + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/chk_exp_price_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/chk_exp_price_trend.py new file mode 100644 index 0000000..1d0d723 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/chk_exp_price_trend.py @@ -0,0 +1,103 @@ +""" +Created on 20250601 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from exp_price_trend import exp_price_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 예상체결가 추이[국내주식-118] +############################################################################################## + +COLUMN_MAPPING = { + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'antc_cnpr': '예상 체결가', + 'antc_cntg_vrss_sign': '예상 체결 대비 부호', + 'antc_cntg_vrss': '예상 체결 대비', + 'antc_cntg_prdy_ctrt': '예상 체결 전일 대비율', + 'antc_vol': '예상 거래량', + 'antc_tr_pbmn': '예상 거래대금', + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 예상체결가 추이 조회 테스트 함수 + + 이 함수는 국내주식 예상체결가 추이 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== Case1: 삼성전자 예상체결가 추이 조회 ===") + try: + output1, output2 = exp_price_trend( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_mkop_cls_code="0" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== Output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", output1.columns.tolist()) + + # 컬럼명 한글 변환 + output1 = output1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output1.columns: + output1[col] = pd.to_numeric(output1[col], errors='coerce').round(2) + + logging.info("결과:") + print(output1) + + # output2 처리 + logging.info("=== Output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", output2.columns.tolist()) + + # 컬럼명 한글 변환 + output2 = output2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output2.columns: + output2[col] = pd.to_numeric(output2[col], errors='coerce').round(2) + + logging.info("결과:") + print(output2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/exp_price_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/exp_price_trend.py new file mode 100644 index 0000000..366ffab --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_price_trend/exp_price_trend.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + +import logging +import sys +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 예상체결가 추이[국내주식-118] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/exp-price-trend" + +def exp_price_trend( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # 입력 종목코드 (ex. 123456) + fid_mkop_cls_code: str # (ex. 0:전체, 4:체결량 0 제외) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 예상체결가 추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0184] 예상체결지수 추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 최대 30건 확인 가능하며, 다음 조회가 불가합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_mkop_cls_code (str): [필수] (ex. 0:전체, 4:체결량 0 제외) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터 + + Example: + >>> output1, output2 = exp_price_trend("J", "005930", "0") + >>> print(output1) + >>> print(output2) + """ + + if not fid_cond_mrkt_div_code: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if not fid_input_iscd: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if not fid_mkop_cls_code: + raise ValueError("fid_mkop_cls_code is required (e.g. '0')") + + tr_id = "FHPST01810000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_MKOP_CLS_CODE": fid_mkop_cls_code, + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame([res.getBody().output1]) + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/chk_exp_total_index.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/chk_exp_total_index.py new file mode 100644 index 0000000..3392dbc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/chk_exp_total_index.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from exp_total_index import exp_total_index + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결 전체지수[국내주식-122] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'ascn_issu_cnt': '상승 종목 수', + 'down_issu_cnt': '하락 종목 수', + 'stnr_issu_cnt': '보합 종목 수', + 'bstp_cls_code': '업종 구분 코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_vol': '누적 거래량', + 'nmix_sdpr': '지수 기준가', + 'ascn_issu_cnt': '상승 종목 수', + 'stnr_issu_cnt': '보합 종목 수', + 'down_issu_cnt': '하락 종목 수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내주식 예상체결 전체지수[국내주식-122] + + 국내주식 예상체결 전체지수 테스트 함수 + + Parameters: + - fid_mrkt_cls_code (str): 시장 구분 코드 (0:전체 K:거래소 Q:코스닥) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (업종 U)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(11175)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_mkop_cls_code (str): 장운영 구분 코드 (1:장시작전, 2:장마감) + + Returns: + - Tuple[DataFrame, ...]: 국내주식 예상체결 전체지수 결과 + + Example: + >>> df1, df2 = exp_total_index(fid_mrkt_cls_code="0", fid_cond_mrkt_div_code="U", fid_cond_scr_div_code="11175", fid_input_iscd="0000", fid_mkop_cls_code="1") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = exp_total_index( + fid_mrkt_cls_code="0", # 시장 구분 코드 + fid_cond_mrkt_div_code="U", # 조건 시장 분류 코드 + fid_cond_scr_div_code="11175", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_mkop_cls_code="1", # 장운영 구분 코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/exp_total_index.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/exp_total_index.py new file mode 100644 index 0000000..57ec060 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_total_index/exp_total_index.py @@ -0,0 +1,158 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결 전체지수[국내주식-122] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/exp-total-index" + + +def exp_total_index( + fid_mrkt_cls_code: str, # 시장 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_mkop_cls_code: str, # 장운영 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식 예상체결 전체지수[국내주식-122] + 국내주식 예상체결 전체지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_mrkt_cls_code (str): 0:전체 K:거래소 Q:코스닥 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_cond_scr_div_code (str): Unique key(11175) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_mkop_cls_code (str): 1:장시작전, 2:장마감 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 예상체결 전체지수 데이터 + + Example: + >>> df1, df2 = exp_total_index( + ... fid_mrkt_cls_code="K", + ... fid_cond_mrkt_div_code="U", + ... fid_cond_scr_div_code="11175", + ... fid_input_iscd="1001", + ... fid_mkop_cls_code="1" + ... ) + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'K')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'K')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11175')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11175')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '1001')") + raise ValueError("fid_input_iscd is required. (e.g. '1001')") + + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '1')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHKUP11750000" + + params = { + "fid_mrkt_cls_code": fid_mrkt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_mkop_cls_code": fid_mkop_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return exp_total_index( + fid_mrkt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_mkop_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/chk_exp_trans_updown.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/chk_exp_trans_updown.py new file mode 100644 index 0000000..d7f6224 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/chk_exp_trans_updown.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from exp_trans_updown import exp_trans_updown + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 예상체결 상승_하락상위[v1_국내주식-103] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'stck_sdpr': '주식 기준가', + 'seln_rsqn': '매도 잔량', + 'askp': '매도호가', + 'bidp': '매수호가', + 'shnu_rsqn': '매수2 잔량', + 'cntg_vol': '체결 거래량', + 'antc_tr_pbmn': '체결 거래대금', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 예상체결 상승_하락상위[v1_국내주식-103] + + 국내주식 예상체결 상승_하락상위 테스트 함수 + + Parameters: + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0:상승률1:상승폭2:보합3:하락율4:하락폭5:체결량6:거래대금) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20182)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체 1:보통주 2:우선주) + - fid_aply_rang_prc_1 (str): 적용 범위 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_pbmn (str): 거래대금 (입력값 없을때 전체 (거래대금 ~) 천원단위) + - fid_blng_cls_code (str): 소속 구분 코드 (0: 전체) + - fid_mkop_cls_code (str): 장운영 구분 코드 (0:장전예상1:장마감예상) + Returns: + - DataFrame: 국내주식 예상체결 상승_하락상위 결과 + + Example: + >>> df = exp_trans_updown(fid_rank_sort_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20182", fid_input_iscd="0000", fid_div_cls_code="0", fid_aply_rang_prc_1="", fid_vol_cnt="", fid_pbmn="", fid_blng_cls_code="0", fid_mkop_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = exp_trans_updown( + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20182", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_aply_rang_prc_1="", # 적용 범위 가격1 + fid_vol_cnt="", # 거래량 수 + fid_pbmn="", # 거래대금 + fid_blng_cls_code="0", # 소속 구분 코드 + fid_mkop_cls_code="0", # 장운영 구분 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 예상체결 상승_하락상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/exp_trans_updown.py b/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/exp_trans_updown.py new file mode 100644 index 0000000..3a407a2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/exp_trans_updown/exp_trans_updown.py @@ -0,0 +1,177 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 예상체결 상승_하락상위[v1_국내주식-103] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/exp-trans-updown" + +def exp_trans_updown( + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_vol_cnt: str, # 거래량 수 + fid_pbmn: str, # 거래대금 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_mkop_cls_code: str, # 장운영 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 예상체결 상승_하락상위[v1_국내주식-103] + 국내주식 예상체결 상승_하락상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_rank_sort_cls_code (str): 0:상승률1:상승폭2:보합3:하락율4:하락폭5:체결량6:거래대금 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20182) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_div_cls_code (str): 0:전체 1:보통주 2:우선주 + fid_aply_rang_prc_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_pbmn (str): 입력값 없을때 전체 (거래대금 ~) 천원단위 + fid_blng_cls_code (str): 0: 전체 + fid_mkop_cls_code (str): 0:장전예상1:장마감예상 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 예상체결 상승_하락상위 데이터 + + Example: + >>> df = exp_trans_updown( + ... fid_rank_sort_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20182", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_aply_rang_prc_1="", + ... fid_vol_cnt="", + ... fid_pbmn="", + ... fid_blng_cls_code="0", + ... fid_mkop_cls_code="0" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20182')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20182')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '0')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01820000" + + params = { + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_vol_cnt": fid_vol_cnt, + "fid_pbmn": fid_pbmn, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_mkop_cls_code": fid_mkop_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return exp_trans_updown( + fid_rank_sort_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_aply_rang_prc_1, + fid_vol_cnt, + fid_pbmn, + fid_blng_cls_code, + fid_mkop_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/chk_finance_balance_sheet.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/chk_finance_balance_sheet.py new file mode 100644 index 0000000..eecac99 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/chk_finance_balance_sheet.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_balance_sheet import finance_balance_sheet + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 대차대조표 [v1_국내주식-078] +############################################################################################## + + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'cras': '유동자산', + 'fxas': '고정자산', + 'total_aset': '자산총계', + 'flow_lblt': '유동부채', + 'fix_lblt': '고정부채', + 'total_lblt': '부채총계', + 'cpfn': '자본금', + 'cfp_surp': '자본 잉여금', + 'prfi_surp': '이익 잉여금', + 'total_cptl': '자본총계' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 대차대조표[v1_국내주식-078] + + 국내주식 대차대조표 테스트 함수 + + Parameters: + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + Returns: + - DataFrame: 국내주식 대차대조표 결과 + + Example: + >>> df = finance_balance_sheet(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_balance_sheet( + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_input_iscd="000660", # 입력 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 대차대조표 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/finance_balance_sheet.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/finance_balance_sheet.py new file mode 100644 index 0000000..26ce9b4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_balance_sheet/finance_balance_sheet.py @@ -0,0 +1,122 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 대차대조표 [v1_국내주식-078] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/balance-sheet" + +def finance_balance_sheet( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 대차대조표[v1_국내주식-078] + 국내주식 대차대조표 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0: 년, 1: 분기 + fid_cond_mrkt_div_code (str): J + fid_input_iscd (str): 000660 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 대차대조표 데이터 + + Example: + >>> df = finance_balance_sheet("0", "J", "000660") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430100" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_balance_sheet( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/chk_finance_financial_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/chk_finance_financial_ratio.py new file mode 100644 index 0000000..7f27b7d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/chk_finance_financial_ratio.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_financial_ratio import finance_financial_ratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 재무비율 [v1_국내주식-080] +############################################################################################## + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'grs': '매출액 증가율', + 'bsop_prfi_inrt': '영업 이익 증가율', + 'ntin_inrt': '순이익 증가율', + 'roe_val': 'ROE 값', + 'eps': 'EPS', + 'sps': '주당매출액', + 'bps': 'BPS', + 'rsrv_rate': '유보 비율', + 'lblt_rate': '부채 비율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 재무비율[v1_국내주식-080] + + 국내주식 재무비율 테스트 함수 + + Parameters: + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + Returns: + - DataFrame: 국내주식 재무비율 결과 + + Example: + >>> df = finance_financial_ratio(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_financial_ratio( + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_input_iscd="000660", # 입력 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 재무비율 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/finance_financial_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/finance_financial_ratio.py new file mode 100644 index 0000000..1c5d707 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_financial_ratio/finance_financial_ratio.py @@ -0,0 +1,122 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 재무비율 [v1_국내주식-080] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/financial-ratio" + +def finance_financial_ratio( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 재무비율[v1_국내주식-080] + 국내주식 재무비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0: 년, 1: 분기 + fid_cond_mrkt_div_code (str): J + fid_input_iscd (str): 000660 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 재무비율 데이터 + + Example: + >>> df = finance_financial_ratio("0", "J", "000660") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430300" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_financial_ratio( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/chk_finance_growth_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/chk_finance_growth_ratio.py new file mode 100644 index 0000000..d53f3c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/chk_finance_growth_ratio.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_growth_ratio import finance_growth_ratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 성장성비율 [v1_국내주식-085] +############################################################################################## + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'grs': '매출액 증가율', + 'bsop_prfi_inrt': '영업 이익 증가율', + 'equt_inrt': '자기자본 증가율', + 'totl_aset_inrt': '총자산 증가율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 성장성비율[v1_국내주식-085] + + 국내주식 성장성비율 테스트 함수 + + Parameters: + - fid_input_iscd (str): 입력 종목코드 (ex : 000660) + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + Returns: + - DataFrame: 국내주식 성장성비율 결과 + + Example: + >>> df = finance_growth_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_growth_ratio( + fid_input_iscd="000660", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 성장성비율 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/finance_growth_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/finance_growth_ratio.py new file mode 100644 index 0000000..9088902 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_growth_ratio/finance_growth_ratio.py @@ -0,0 +1,122 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 성장성비율 [v1_국내주식-085] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/growth-ratio" + +def finance_growth_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 성장성비율[v1_국내주식-085] + 국내주식 성장성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 입력 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 성장성비율 데이터 + + Example: + >>> df = finance_growth_ratio('005930', '1', 'J') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API URL 및 거래 ID 설정 + tr_id = "FHKST66430800" + + # 요청 파라미터 설정 + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_growth_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/chk_finance_income_statement.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/chk_finance_income_statement.py new file mode 100644 index 0000000..0efa886 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/chk_finance_income_statement.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_income_statement import finance_income_statement + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 손익계산서 [v1_국내주식-079] +############################################################################################## + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'sale_account': '매출액', + 'sale_cost': '매출 원가', + 'sale_totl_prfi': '매출 총 이익', + 'depr_cost': '감가상각비', + 'sell_mang': '판매 및 관리비', + 'bsop_prti': '영업 이익', + 'bsop_non_ernn': '영업 외 수익', + 'bsop_non_expn': '영업 외 비용', + 'op_prfi': '경상 이익', + 'spec_prfi': '특별 이익', + 'spec_loss': '특별 손실', + 'thtr_ntin': '당기순이익' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 국내주식 손익계산서[v1_국내주식-079] + + 국내주식 손익계산서 테스트 함수 + + Parameters: + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기 ※ 분기데이터는 연단위 누적합산) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + Returns: + - DataFrame: 국내주식 손익계산서 결과 + + Example: + >>> df = finance_income_statement(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_income_statement( + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_input_iscd="000660", # 입력 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 손익계산서 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/finance_income_statement.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/finance_income_statement.py new file mode 100644 index 0000000..f058296 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_income_statement/finance_income_statement.py @@ -0,0 +1,119 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 손익계산서 [v1_국내주식-079] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/income-statement" + +def finance_income_statement( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + 국내주식 손익계산서 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + fid_input_iscd (str): 입력 종목코드 (예: '000660') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 손익계산서 데이터 + + Example: + >>> df = finance_income_statement('1', 'J', '005930') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430200" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_income_statement( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/chk_finance_other_major_ratios.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/chk_finance_other_major_ratios.py new file mode 100644 index 0000000..999cce3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/chk_finance_other_major_ratios.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_other_major_ratios import finance_other_major_ratios + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 기타주요비율[v1_국내주식-082] +############################################################################################## + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'payout_rate': '배당 성향', + 'eva': 'EVA', + 'ebitda': 'EBITDA', + 'ev_ebitda': 'EV_EBITDA' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 기타주요비율[v1_국내주식-082] + + 국내주식 기타주요비율 테스트 함수 + + Parameters: + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + Returns: + - DataFrame: 국내주식 기타주요비율 결과 + + Example: + >>> df = finance_other_major_ratios(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_other_major_ratios( + fid_input_iscd="000660", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 기타주요비율 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/finance_other_major_ratios.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/finance_other_major_ratios.py new file mode 100644 index 0000000..86c2912 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_other_major_ratios/finance_other_major_ratios.py @@ -0,0 +1,116 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 기타주요비율[v1_국내주식-082] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/other-major-ratios" + +def finance_other_major_ratios( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 기타주요비율[v1_국내주식-082] + 국내주식 기타주요비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (예: '0' - 년, '1' - 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 기타주요비율 데이터 + + Example: + >>> df = finance_other_major_ratios('005930', '1', 'J') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430500" + + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_other_major_ratios( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/chk_finance_profit_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/chk_finance_profit_ratio.py new file mode 100644 index 0000000..64ca35f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/chk_finance_profit_ratio.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_profit_ratio import finance_profit_ratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 수익성비율[v1_국내주식-081] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'cptl_ntin_rate': '총자본 순이익율', + 'self_cptl_ntin_inrt': '자기자본 순이익율', + 'sale_ntin_rate': '매출액 순이익율', + 'sale_totl_rate': '매출액 총이익율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 수익성비율[v1_국내주식-081] + + 국내주식 수익성비율 테스트 함수 + + Parameters: + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + Returns: + - DataFrame: 국내주식 수익성비율 결과 + + Example: + >>> df = finance_profit_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_profit_ratio( + fid_input_iscd="000660", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 수익성비율 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/finance_profit_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/finance_profit_ratio.py new file mode 100644 index 0000000..c0b3700 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_profit_ratio/finance_profit_ratio.py @@ -0,0 +1,128 @@ +# [국내주식] 종목정보 - 국내주식 수익성비율 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 수익성비율[v1_국내주식-081] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/profit-ratio" + +def finance_profit_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 수익성비율[v1_국내주식-081] + 국내주식 수익성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 입력 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 수익성비율 데이터 + + Example: + >>> df = finance_profit_ratio('005930', '1', 'J') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430400" + + params = { + "fid_input_iscd": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_profit_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/chk_finance_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/chk_finance_ratio.py new file mode 100644 index 0000000..5d34b80 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/chk_finance_ratio.py @@ -0,0 +1,114 @@ +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_ratio import finance_ratio + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 재무비율 순위[v1_국내주식-092] +############################################################################################## + + +COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'cptl_op_prfi': '총자본경상이익율', + 'cptl_ntin_rate': '총자본 순이익율', + 'sale_totl_rate': '매출액 총이익율', + 'sale_ntin_rate': '매출액 순이익율', + 'bis': '자기자본비율', + 'lblt_rate': '부채 비율', + 'bram_depn': '차입금 의존도', + 'rsrv_rate': '유보 비율', + 'grs': '매출액 증가율', + 'op_prfi_inrt': '경상 이익 증가율', + 'bsop_prfi_inrt': '영업 이익 증가율', + 'ntin_inrt': '순이익 증가율', + 'equt_inrt': '자기자본 증가율', + 'cptl_tnrt': '총자본회전율', + 'sale_bond_tnrt': '매출 채권 회전율', + 'totl_aset_inrt': '총자산 증가율', + 'stac_month': '결산 월', + 'stac_month_cls_code': '결산 월 구분 코드', + 'iqry_csnu': '조회 건수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 재무비율 순위[v1_국내주식-092] + + 국내주식 재무비율 순위 테스트 함수 + + Parameters: + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20175 )) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_div_cls_code (str): 분류 구분 코드 (0 : 전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_input_option_1 (str): 입력 옵션1 (회계년도 입력 (ex 2023)) + - fid_input_option_2 (str): 입력 옵션2 (0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (7: 수익성 분석, 11 : 안정성 분석, 15: 성장성 분석, 20: 활동성 분석) + - fid_blng_cls_code (str): 소속 구분 코드 (0) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + Returns: + - DataFrame: 국내주식 재무비율 순위 결과 + + Example: + >>> df = finance_ratio(fid_trgt_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20175", fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="3", fid_rank_sort_cls_code="7", fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + result = finance_ratio( + fid_trgt_cls_code="0", # 대상 구분 코드, + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드, + fid_cond_scr_div_code="20175", # 조건 화면 분류 코드, + fid_input_iscd="0000", # 입력 종목코드, + fid_div_cls_code="0", # 분류 구분 코드, + fid_input_price_1="", # 입력 가격1, + fid_input_price_2="", # 입력 가격2, + fid_vol_cnt="", # 거래량 수, + fid_input_option_1="2023", # 입력 옵션1, + fid_input_option_2="3", # 입력 옵션2, + fid_rank_sort_cls_code="7", # 순위 정렬 구분 코드, + fid_blng_cls_code="0", # 소속 구분 코드, + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 재무비율 순위 결과 ===") + print(result) + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/finance_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/finance_ratio.py new file mode 100644 index 0000000..b94a10f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_ratio/finance_ratio.py @@ -0,0 +1,166 @@ +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 재무비율 순위[v1_국내주식-092] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/finance-ratio" + +def finance_ratio( + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 재무비율 순위[v1_국내주식-092] + 국내주식 재무비율 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key, 20175) + fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + fid_div_cls_code (str): 분류 구분 코드 (0 : 전체) + fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체, 가격 ~) + fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체, ~ 가격) + fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체, 거래량 ~) + fid_input_option_1 (str): 입력 옵션1 (회계년도 입력, ex 2023) + fid_input_option_2 (str): 입력 옵션2 (0: 1/4분기, 1: 반기, 2: 3/4분기, 3: 결산) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (7: 수익성 분석, 11: 안정성 분석, 15: 성장성 분석, 20: 활동성 분석) + fid_blng_cls_code (str): 소속 구분 코드 (0) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + tr_cont (str): 연속 거래 여부 (공백 : 초기 조회, N : 다음 데이터 조회) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 재무비율 순위 데이터 + + Example: + >>> df = finance_ratio( + ... fid_trgt_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20175", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="3", + ... fid_rank_sort_cls_code="7", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_trgt_cls_code == "": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20175": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["7", "11", "15", "20"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code != "0": + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01750000" + + params = { + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return finance_ratio( + fid_trgt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/chk_finance_stability_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/chk_finance_stability_ratio.py new file mode 100644 index 0000000..6104f58 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/chk_finance_stability_ratio.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from finance_stability_ratio import finance_stability_ratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 안정성비율 [v1_국내주식-083] +############################################################################################## + +COLUMN_MAPPING = { + 'stac_yymm': '결산 년월', + 'lblt_rate': '부채 비율', + 'bram_depn': '차입금 의존도', + 'crnt_rate': '유동 비율', + 'quck_rate': '당좌 비율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 안정성비율[v1_국내주식-083] + + 국내주식 안정성비율 테스트 함수 + + Parameters: + - fid_input_iscd (str): 입력 종목코드 (000660 : 종목코드) + - fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J) + Returns: + - DataFrame: 국내주식 안정성비율 결과 + + Example: + >>> df = finance_stability_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = finance_stability_ratio( + fid_input_iscd="000660", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 안정성비율 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/finance_stability_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/finance_stability_ratio.py new file mode 100644 index 0000000..9648b30 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/finance_stability_ratio/finance_stability_ratio.py @@ -0,0 +1,118 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 안정성비율[v1_국내주식-083] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/finance/stability-ratio" + +def finance_stability_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 안정성비율[v1_국내주식-083] + 국내주식 안정성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (예: '0' - 년, '1' - 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 안정성비율 데이터 + + Example: + >>> df = finance_stability_ratio('005930', '1', 'J') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHKST66430600" + + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_stability_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/chk_fluctuation.py b/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/chk_fluctuation.py new file mode 100644 index 0000000..cb8c9df --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/chk_fluctuation.py @@ -0,0 +1,115 @@ +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from fluctuation import fluctuation + +############################################################################################## +# [국내주식] 순위분석 > 등락률 순위[v1_국내주식-088] +############################################################################################## + +COLUMN_MAPPING = { + "stck_shrn_iscd": "주식 단축 종목코드", + "data_rank": "데이터 순위", + "hts_kor_isnm": "HTS 한글 종목명", + "stck_prpr": "주식 현재가", + "prdy_vrss": "전일 대비", + "prdy_vrss_sign": "전일 대비 부호", + "prdy_ctrt": "전일 대비율", + "acml_vol": "누적 거래량", + "stck_hgpr": "주식 최고가", + "hgpr_hour": "최고가 시간", + "acml_hgpr_date": "누적 최고가 일자", + "stck_lwpr": "주식 최저가", + "lwpr_hour": "최저가 시간", + "acml_lwpr_date": "누적 최저가 일자", + "lwpr_vrss_prpr_rate": "저가 대비 현재가 비율", + "dsgt_date_clpr_vrss_prpr_rate": "영업 일수 대비 현재가 비율", + "cnnt_ascn_dynu": "연속 상승 일수", + "hgpr_vrss_prpr_rate": "고가 대비 현재가 비율", + "cnnt_down_dynu": "연속 하락 일수", + "oprc_vrss_prpr_sign": "시가 대비 부호", + "oprc_vrss_prpr": "시가 대비", + "oprc_vrss_prpr_rate": "시가 대비 현재가 비율", + "prd_rsfl": "기간 등락", + "prd_rsfl_rate": "기간 등락 비율" +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 등락률 순위[v1_국내주식-088] + + 국내주식 등락률 순위 조회 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J: 주식, W: ELW, Q: ETF) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (20170: 등락률) + - fid_input_iscd (str): 입력 종목코드 (0000: 전체) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0000: 등락률순) + - fid_input_cnt_1 (str): 입력 수1 (조회할 종목 수) + - fid_prc_cls_code (str): 가격 구분 코드 (0: 전체) + - fid_input_price_1 (str): 입력 가격1 (하한가) + - fid_input_price_2 (str): 입력 가격2 (상한가) + - fid_vol_cnt (str): 거래량 수 (최소 거래량) + - fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 증거금30% 40% 50% 60% 100% 신용보증금30% 40% 50% 60%) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체) + - fid_rsfl_rate1 (str): 등락 비율1 (하락률 하한) + - fid_rsfl_rate2 (str): 등락 비율2 (상승률 상한) + - tr_cont (str): 연속 거래 여부 + - dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + - DataFrame: 국내주식 등락률 순위 조회 결과 + + Example: + >>> df = fluctuation(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20170", fid_input_iscd="0000", fid_rank_sort_cls_code="0", fid_input_cnt_1="0", fid_prc_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_div_cls_code="0", fid_rsfl_rate1="", fid_rsfl_rate2="") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + result = fluctuation( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="20170", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_input_cnt_1="0", + fid_prc_cls_code="0", + fid_input_price_1="", + fid_input_price_2="", + fid_vol_cnt="", + fid_trgt_cls_code="0", + fid_trgt_exls_cls_code="0", + fid_div_cls_code="0", + fid_rsfl_rate1="", + fid_rsfl_rate2="", + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 거래량순위 조회 결과 ===") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/fluctuation.py b/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/fluctuation.py new file mode 100644 index 0000000..52ea2f2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/fluctuation/fluctuation.py @@ -0,0 +1,126 @@ +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 등락률 순위[v1_국내주식-088] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/fluctuation" + +def fluctuation( + fid_cond_mrkt_div_code: str, # 필수, 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 필수, 조건 화면 분류 코드 + fid_input_iscd: str, # 필수, 입력 종목코드 + fid_rank_sort_cls_code: str, # 필수, 순위 정렬 구분 코드 + fid_input_cnt_1: str, # 필수, 입력 수1 + fid_prc_cls_code: str, # 필수, 가격 구분 코드 + fid_input_price_1: str, # 필수, 입력 가격1 + fid_input_price_2: str, # 필수, 입력 가격2 + fid_vol_cnt: str, # 필수, 거래량 수 + fid_trgt_cls_code: str, # 필수, 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 필수, 대상 제외 구분 코드 + fid_div_cls_code: str, # 필수, 분류 구분 코드 + fid_rsfl_rate1: str, # 필수, 등락 비율1 + fid_rsfl_rate2: str, # 필수, 등락 비율2 + tr_cont: str = "", # 선택, 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 선택, 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 등락률 순위[v1_국내주식-088] + 국내주식 등락률 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (20170: 등락률) + fid_input_iscd (str): 입력 종목코드 (0000: 전체) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0000: 등락률순) + fid_input_cnt_1 (str): 입력 수1 (조회할 종목 수) + fid_prc_cls_code (str): 가격 구분 코드 (0: 전체) + fid_input_price_1 (str): 입력 가격1 (하한가) + fid_input_price_2 (str): 입력 가격2 (상한가) + fid_vol_cnt (str): 거래량 수 (최소 거래량) + fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 증거금30% 40% 50% 60% 100% 신용보증금30% 40% 50% 60%) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + fid_div_cls_code (str): 분류 구분 코드 (0: 전체) + fid_rsfl_rate1 (str): 등락 비율1 (하락률 하한) + fid_rsfl_rate2 (str): 등락 비율2 (상승률 상한) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: API 응답 데이터 + + Example: + >>> df = fluctuation(fid_rsfl_rate2="10", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20170", fid_input_iscd="0000", fid_rank_sort_cls_code="0000", fid_input_cnt_1="10", fid_prc_cls_code="0", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_div_cls_code="0", fid_rsfl_rate1="0") + >>> print(df) + """ + if fid_cond_mrkt_div_code not in ["J", "W", "Q"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + + if fid_cond_scr_div_code != "20170": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + + + tr_id = "FHPST01700000" # 국내주식 등락률 순위 + + params = { + "fid_rsfl_rate2": fid_rsfl_rate2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + "fid_prc_cls_code": fid_prc_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rsfl_rate1": fid_rsfl_rate1 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": # 다음 페이지 존재 + print("Call Next") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return fluctuation( + fid_rsfl_rate2, fid_cond_mrkt_div_code, fid_cond_scr_div_code, + fid_input_iscd, fid_rank_sort_cls_code, fid_input_cnt_1, + fid_prc_cls_code, fid_input_price_1, fid_input_price_2, + fid_vol_cnt, fid_trgt_cls_code, fid_trgt_exls_cls_code, + fid_div_cls_code, fid_rsfl_rate1, "N", dataframe + ) + else: + print("The End") + return dataframe + else: + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/chk_foreign_institution_total.py b/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/chk_foreign_institution_total.py new file mode 100644 index 0000000..48c5682 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/chk_foreign_institution_total.py @@ -0,0 +1,100 @@ +""" +Created on 20250129 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from foreign_institution_total import foreign_institution_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내기관_외국인 매매종목가집계[국내주식-037] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'ntby_qty': '순매수 수량', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'orgn_ntby_qty': '기관계 순매수 수량', + 'ivtr_ntby_qty': '투자신탁 순매수 수량', + 'bank_ntby_qty': '은행 순매수 수량', + 'insu_ntby_qty': '보험 순매수 수량', + 'mrbn_ntby_qty': '종금 순매수 수량', + 'fund_ntby_qty': '기금 순매수 수량', + 'etc_orgt_ntby_vol': '기타 단체 순매수 거래량', + 'etc_corp_ntby_vol': '기타 법인 순매수 거래량', + 'frgn_ntby_tr_pbmn': '외국인 순매수 거래 대금', + 'orgn_ntby_tr_pbmn': '기관계 순매수 거래 대금', + 'ivtr_ntby_tr_pbmn': '투자신탁 순매수 거래 대금', + 'bank_ntby_tr_pbmn': '은행 순매수 거래 대금', + 'insu_ntby_tr_pbmn': '보험 순매수 거래 대금', + 'mrbn_ntby_tr_pbmn': '종금 순매수 거래 대금', + 'fund_ntby_tr_pbmn': '기금 순매수 거래 대금', + 'etc_orgt_ntby_tr_pbmn': '기타 단체 순매수 거래 대금', + 'etc_corp_ntby_tr_pbmn': '기타 법인 순매수 거래 대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내기관_외국인 매매종목가집계 조회 테스트 함수 + + 이 함수는 국내기관_외국인 매매종목가집계 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = foreign_institution_total( + fid_cond_mrkt_div_code="V", + fid_cond_scr_div_code="16449", + fid_input_iscd="0000", + fid_div_cls_code="0", + fid_rank_sort_cls_code="0", + fid_etc_cls_code="0" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/foreign_institution_total.py b/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/foreign_institution_total.py new file mode 100644 index 0000000..39cce26 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/foreign_institution_total/foreign_institution_total.py @@ -0,0 +1,94 @@ +""" +Created on 20250129 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내기관_외국인 매매종목가집계[국내주식-037] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/foreign-institution-total" + +def foreign_institution_total( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류구분코드 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_etc_cls_code: str # 기타구분정렬 +) -> pd.DataFrame: + """ + 국내기관_외국인 매매종목가집계 API입니다. + + HTS(efriend Plus) [0440] 외국인/기관 매매종목 가집계 화면을 API로 구현한 사항으로 화면을 함께 보시면 기능 이해가 쉽습니다. + + 증권사 직원이 장중에 집계/입력한 자료를 단순 누계한 수치로서, + 입력시간은 외국인 09:30, 11:20, 13:20, 14:30 / 기관종합 10:00, 11:20, 13:20, 14:30 이며, + 입력한 시간은 ±10분정도 차이가 발생할 수 있으며, 장운영 사정에 다라 변동될 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. V) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 16449) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0000:전체,0001:코스피,1001:코스닥,...,FAQ 종목정보 다운로드(국내) - 업종코드 참조 ) + fid_div_cls_code (str): [필수] 분류구분코드 (ex. 0:수량정열, 1:금액정열) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:순매수상위,1:순매도상위) + fid_etc_cls_code (str): [필수] 기타구분정렬 (ex. 0:전체,1:외국인,2:기관계,3:기타) + + Returns: + pd.DataFrame: 국내기관_외국인 매매종목가집계 데이터 + + Example: + >>> df = foreign_institution_total("V", "16449", "0000", "0", "0", "0") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'V')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '16449')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000:전체,0001:코스피,1001:코스닥,...,FAQ 종목정보 다운로드(국내) - 업종코드 참조 ')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0:수량정열, 1:금액정열')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0:순매수상위,1:순매도상위')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '0:전체,1:외국인,2:기관계,3:기타')") + + tr_id = "FHPTJ04400000" # 국내기관_외국인 매매종목가집계 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, # 조건화면분류코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_DIV_CLS_CODE": fid_div_cls_code, # 분류구분코드 + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, # 순위정렬구분코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code # 기타구분정렬 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/chk_frgnmem_pchs_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/chk_frgnmem_pchs_trend.py new file mode 100644 index 0000000..3792de6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/chk_frgnmem_pchs_trend.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from frgnmem_pchs_trend import frgnmem_pchs_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외국계 순매수추이 [국내주식-164] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_hour': '영업시간', + 'stck_prpr': '주식현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'frgn_seln_vol': '외국인매도거래량', + 'frgn_shnu_vol': '외국인매수2거래량', + 'glob_ntby_qty': '외국계순매수수량', + 'frgn_ntby_qty_icdc': '외국인순매수수량증감' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별 외국계 순매수추이 조회 테스트 함수 + + 이 함수는 종목별 외국계 순매수추이 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== Case1: 삼성전자 외국계 순매수추이 조회 ===") + try: + result = frgnmem_pchs_trend( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_iscd_2="99999" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/frgnmem_pchs_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/frgnmem_pchs_trend.py new file mode 100644 index 0000000..3345234 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_pchs_trend/frgnmem_pchs_trend.py @@ -0,0 +1,71 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외국계 순매수추이 [국내주식-164] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/frgnmem-pchs-trend" + +def frgnmem_pchs_trend( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # 입력 종목코드 (ex. 123456) + fid_input_iscd_2: str # 입력 종목코드 (ex. 99999) +) -> pd.DataFrame: + """ + 종목별 외국계 순매수추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0433] 종목별 외국계 순매수추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_iscd_2 (str): [필수] 입력 종목코드 (ex. 99999) + + Returns: + pd.DataFrame: 종목별 외국계 순매수추이 데이터 + + Example: + >>> df = frgnmem_pchs_trend("J", "005930", "99999") + >>> print(df) + """ + + if not fid_cond_mrkt_div_code: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if not fid_input_iscd: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if not fid_input_iscd_2: + raise ValueError("fid_input_iscd_2 is required (e.g. '99999')") + + tr_id = "FHKST644400C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output_data = pd.DataFrame(res.getBody().output) + + logging.info("Data fetch complete.") + return output_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/chk_frgnmem_trade_estimate.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/chk_frgnmem_trade_estimate.py new file mode 100644 index 0000000..2503dd2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/chk_frgnmem_trade_estimate.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from frgnmem_trade_estimate import frgnmem_trade_estimate + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 외국계 매매종목 가집계 [국내주식-161] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'glob_ntsl_qty': '외국계순매도수량', + 'stck_prpr': '주식현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'glob_total_seln_qty': '외국계총매도수량', + 'glob_total_shnu_qty': '외국계총매수2수량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 외국계 매매종목 가집계 조회 테스트 함수 + + 이 함수는 외국계 매매종목 가집계 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = frgnmem_trade_estimate( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="16441", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_rank_sort_cls_code_2="0" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/frgnmem_trade_estimate.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/frgnmem_trade_estimate.py new file mode 100644 index 0000000..3742e3d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_estimate/frgnmem_trade_estimate.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 외국계 매매종목 가집계 [국내주식-161] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/frgnmem-trade-estimate" + + +def frgnmem_trade_estimate( + fid_cond_mrkt_div_code: str, + fid_cond_scr_div_code: str, + fid_input_iscd: str, + fid_rank_sort_cls_code: str, + fid_rank_sort_cls_code_2: str +) -> pd.DataFrame: + """ + 외국계 매매종목 가집계 API입니다. + 한국투자 HTS(eFriend Plus) > [0430] 외국계 매매종목 가집계 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 16441) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 1001:코스피, 2001:코스닥) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:금액순, 1:수량순) + fid_rank_sort_cls_code_2 (str): [필수] 순위정렬구분코드2 (ex. 0:매수순, 1:매도순) + + Returns: + pd.DataFrame: 외국계 매매종목 가집계 데이터 + + Example: + >>> df = frgnmem_trade_estimate("J", "16441", "0000", "0", "0") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '16441')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0')") + + if fid_rank_sort_cls_code_2 == "": + raise ValueError("fid_rank_sort_cls_code_2 is required (e.g. '0')") + + tr_id = "FHKST644100C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_RANK_SORT_CLS_CODE_2": fid_rank_sort_cls_code_2 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/chk_frgnmem_trade_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/chk_frgnmem_trade_trend.py new file mode 100644 index 0000000..044a87f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/chk_frgnmem_trade_trend.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-10 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from frgnmem_trade_trend import frgnmem_trade_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 회원사 실 시간 매매동향(틱)[국내주식-163] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'total_seln_qty': '총매도수량', + 'total_shnu_qty': '총매수2수량', + 'bsop_hour': '영업시간', + 'hts_kor_isnm': 'HTS한글종목명', + 'stck_prpr': '주식현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'cntg_vol': '체결거래량', + 'acml_ntby_qty': '누적순매수수량', + 'glob_ntby_qty': '외국계순매수수량', + 'frgn_ntby_qty_icdc': '외국인순매수수량증감' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 시세분석 + 회원사 실 시간 매매동향(틱)[국내주식-163] + + 회원사 실 시간 매매동향(틱) 테스트 함수 + + Parameters: + - fid_cond_scr_div_code (str): 화면분류코드 (20432(primary key)) + - fid_cond_mrkt_div_code (str): 조건시장구분코드 (J 고정입력) + - fid_input_iscd (str): 종목코드 (ex. 005930(삼성전자) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력) + - fid_input_iscd_2 (str): 회원사코드 (ex. 99999(전체) ※ 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조)) + - fid_mrkt_cls_code (str): 시장구분코드 (A(전체),K(코스피), Q(코스닥), K2(코스피200), W(ELW) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력) + - fid_vol_cnt (str): 거래량 (거래량 ~) + + Returns: + - DataFrame: 회원사 실 시간 매매동향(틱) 결과 + + Example: + >>> df1, df2 = frgnmem_trade_trend(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20432", fid_input_iscd="005930", fid_input_iscd_2="99999", fid_mrkt_cls_code="A", fid_vol_cnt="1000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = frgnmem_trade_trend( + fid_cond_scr_div_code="20432", # 화면분류코드 + fid_cond_mrkt_div_code="J", # 조건시장구분코드 + fid_input_iscd="005930", # 종목코드 + fid_input_iscd_2="99999", # 회원사코드 + fid_mrkt_cls_code="A", # 시장구분코드 + fid_vol_cnt="", # 거래량 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/frgnmem_trade_trend.py b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/frgnmem_trade_trend.py new file mode 100644 index 0000000..4ee227a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/frgnmem_trade_trend/frgnmem_trade_trend.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-10 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 회원사 실 시간 매매동향(틱)[국내주식-163] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/frgnmem-trade-trend" + +def frgnmem_trade_trend( + fid_cond_scr_div_code: str, # 화면분류코드 + fid_cond_mrkt_div_code: str, # 조건시장구분코드 + fid_input_iscd: str, # 종목코드 + fid_input_iscd_2: str, # 회원사코드 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_vol_cnt: str, # 거래량 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 시세분석 + 회원사 실 시간 매매동향(틱)[국내주식-163] + 회원사 실 시간 매매동향(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 20432(primary key) + fid_cond_mrkt_div_code (str): J 고정입력 + fid_input_iscd (str): ex. 005930(삼성전자) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력 + fid_input_iscd_2 (str): ex. 99999(전체) ※ 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조) + fid_mrkt_cls_code (str): A(전체),K(코스피), Q(코스닥), K2(코스피200), W(ELW) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력 + fid_vol_cnt (str): 거래량 ~ + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 회원사 실 시간 매매동향(틱) 데이터 + + Example: + >>> df1, df2 = frgnmem_trade_trend( + ... fid_cond_scr_div_code="20432", + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_iscd_2="99999", + ... fid_mrkt_cls_code="A", + ... fid_vol_cnt="1000" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20432')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20432')") + if not fid_cond_mrkt_div_code or fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '99999')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '99999')") + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPST04320000" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_VOL_CNT": fid_vol_cnt, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return frgnmem_trade_trend( + fid_cond_scr_div_code, + fid_input_iscd, + fid_input_iscd_2, + fid_mrkt_cls_code, + fid_vol_cnt, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/chk_hts_top_view.py b/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/chk_hts_top_view.py new file mode 100644 index 0000000..321cb04 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/chk_hts_top_view.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from hts_top_view import hts_top_view + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > HTS조회상위20종목[국내주식-214] +############################################################################################## + +COLUMN_MAPPING = { + 'output1': '응답상세', + 'mrkt_div_cls_code': '시장구분', + 'mksc_shrn_iscd': '종목코드' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + HTS조회상위20종목[국내주식-214] + + HTS조회상위20종목 테스트 함수 + + Parameters: + + Returns: + - DataFrame: HTS조회상위20종목 결과 + + Example: + >>> df = hts_top_view() + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: HTS조회상위20종목") + result = hts_top_view( ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== HTS조회상위20종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/hts_top_view.py b/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/hts_top_view.py new file mode 100644 index 0000000..9eb75c6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/hts_top_view/hts_top_view.py @@ -0,0 +1,98 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 순위분석 > HTS조회상위20종목[국내주식-214] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/hts-top-view" + + +def hts_top_view( + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + HTS조회상위20종목[국내주식-214] + HTS조회상위20종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + tr_cont (str): 연속 거래 여부 ("공백": 초기 조회, "N": 다음 데이터 조회) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: HTS조회상위20종목 데이터 + + Example: + >>> df = hts_top_view(tr_cont="", dataframe=None, depth=0, max_depth=10) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHMCM000100C0" + + # Request Query Parameter가 없으므로 빈 딕셔너리로 유지 + params = {} + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 다음 페이지 호출 여부 결정 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return hts_top_view( + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/chk_index_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/chk_index_ccnl.py new file mode 100644 index 0000000..8a9c786 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/chk_index_ccnl.py @@ -0,0 +1,124 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_ccnl import index_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간체결 [실시간-026] +############################################################################################## + +COLUMN_MAPPING = { + "bstp_cls_code": "업종 구분 코드", + "bsop_hour": "영업 시간", + "prpr_nmix": "현재가 지수", + "prdy_vrss_sign": "전일 대비 부호", + "bstp_nmix_prdy_vrss": "업종 지수 전일 대비", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "pcas_vol": "건별 거래량", + "pcas_tr_pbmn": "건별 거래 대금", + "prdy_ctrt": "전일 대비율", + "oprc_nmix": "시가 지수", + "nmix_hgpr": "지수 최고가", + "nmix_lwpr": "지수 최저가", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "oprc_vrss_nmix_sign": "시가 대비 지수 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "hgpr_vrss_nmix_sign": "최고가 대비 지수 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "lwpr_vrss_nmix_sign": "최저가 대비 지수 부호", + "prdy_clpr_vrss_oprc_rate": "전일 종가 대비 시가2 비율", + "prdy_clpr_vrss_hgpr_rate": "전일 종가 대비 최고가 비율", + "prdy_clpr_vrss_lwpr_rate": "전일 종가 대비 최저가 비율", + "uplm_issu_cnt": "상한 종목 수", + "ascn_issu_cnt": "상승 종목 수", + "stnr_issu_cnt": "보합 종목 수", + "down_issu_cnt": "하락 종목 수", + "lslm_issu_cnt": "하한 종목 수", + "qtqt_ascn_issu_cnt": "기세 상승 종목수", + "qtqt_down_issu_cnt": "기세 하락 종목수", + "tick_vrss": "TICK대비" +} +NUMERIC_COLUMNS = [ + "현재가 지수", "업종 지수 전일 대비", "누적 거래량", "누적 거래 대금", "건별 거래량", "건별 거래 대금", + "전일 대비율", "시가 지수", "지수 최고가", "지수 최저가", "시가 대비 지수 현재가", + "최고가 대비 지수 현재가", "최저가 대비 지수 현재가", "전일 종가 대비 시가2 비율", + "전일 종가 대비 최고가 비율", "전일 종가 대비 최저가 비율", "상한 종목 수", "상승 종목 수", + "보합 종목 수", "하락 종목 수", "하한 종목 수", "기세 상승 종목수", "기세 하락 종목수", "TICK대비" +] + + +def main(): + """ + 국내지수 실시간체결 + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_ccnl, data=["0001", "0128"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/index_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/index_ccnl.py new file mode 100644 index 0000000..44cb428 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_ccnl/index_ccnl.py @@ -0,0 +1,73 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간체결 [실시간-026] +############################################################################################## + +def index_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간체결[H0UPCNT0] 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 국내지수의 실시간 데이터를 구독합니다. + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트되며, 구독을 통해 실시간으로 데이터를 수신할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_realtime_index("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UPCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "prpr_nmix", "prdy_vrss_sign", + "bstp_nmix_prdy_vrss", "acml_vol", "acml_tr_pbmn", "pcas_vol", + "pcas_tr_pbmn", "prdy_ctrt", "oprc_nmix", "nmix_hgpr", "nmix_lwpr", + "oprc_vrss_nmix_prpr", "oprc_vrss_nmix_sign", "hgpr_vrss_nmix_prpr", + "hgpr_vrss_nmix_sign", "lwpr_vrss_nmix_prpr", "lwpr_vrss_nmix_sign", + "prdy_clpr_vrss_oprc_rate", "prdy_clpr_vrss_hgpr_rate", + "prdy_clpr_vrss_lwpr_rate", "uplm_issu_cnt", "ascn_issu_cnt", + "stnr_issu_cnt", "down_issu_cnt", "lslm_issu_cnt", "qtqt_ascn_issu_cnt", + "qtqt_down_issu_cnt", "tick_vrss" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/chk_index_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/chk_index_exp_ccnl.py new file mode 100644 index 0000000..c5f1076 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/chk_index_exp_ccnl.py @@ -0,0 +1,128 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_exp_ccnl import index_exp_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간예상체결 [실시간-027] +############################################################################################## + +COLUMN_MAPPING = { + "bstp_cls_code": "업종 구분 코드", + "bsop_hour": "영업 시간", + "prpr_nmix": "현재가 지수", + "prdy_vrss_sign": "전일 대비 부호", + "bstp_nmix_prdy_vrss": "업종 지수 전일 대비", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금", + "pcas_vol": "건별 거래량", + "pcas_tr_pbmn": "건별 거래 대금", + "prdy_ctrt": "전일 대비율", + "oprc_nmix": "시가 지수", + "nmix_hgpr": "지수 최고가", + "nmix_lwpr": "지수 최저가", + "oprc_vrss_nmix_prpr": "시가 대비 지수 현재가", + "oprc_vrss_nmix_sign": "시가 대비 지수 부호", + "hgpr_vrss_nmix_prpr": "최고가 대비 지수 현재가", + "hgpr_vrss_nmix_sign": "최고가 대비 지수 부호", + "lwpr_vrss_nmix_prpr": "최저가 대비 지수 현재가", + "lwpr_vrss_nmix_sign": "최저가 대비 지수 부호", + "prdy_clpr_vrss_oprc_rate": "전일 종가 대비 시가2 비율", + "prdy_clpr_vrss_hgpr_rate": "전일 종가 대비 최고가 비율", + "prdy_clpr_vrss_lwpr_rate": "전일 종가 대비 최저가 비율", + "uplm_issu_cnt": "상한 종목 수", + "ascn_issu_cnt": "상승 종목 수", + "stnr_issu_cnt": "보합 종목 수", + "down_issu_cnt": "하락 종목 수", + "lslm_issu_cnt": "하한 종목 수", + "qtqt_ascn_issu_cnt": "기세 상승 종목수", + "qtqt_down_issu_cnt": "기세 하락 종목수", + "tick_vrss": "TICK대비" +} + +NUMERIC_COLUMNS = [ + "현재가 지수", "업종 지수 전일 대비", "누적 거래량", "누적 거래 대금", + "건별 거래량", "건별 거래 대금", "전일 대비율", "시가 지수", + "지수 최고가", "지수 최저가", "시가 대비 지수 현재가", + "최고가 대비 지수 현재가", "최저가 대비 지수 현재가", + "전일 종가 대비 시가2 비율", "전일 종가 대비 최고가 비율", + "전일 종가 대비 최저가 비율", "상한 종목 수", "상승 종목 수", + "보합 종목 수", "하락 종목 수", "하한 종목 수", + "기세 상승 종목수", "기세 하락 종목수", "TICK대비" +] + + +def main(): + """ + 국내지수 실시간예상체결 + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_exp_ccnl, data=["0001"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/index_exp_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/index_exp_ccnl.py new file mode 100644 index 0000000..cbdbbd3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_exp_ccnl/index_exp_ccnl.py @@ -0,0 +1,72 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간예상체결 [실시간-027] +############################################################################################## + +def index_exp_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간예상체결[H0UPANC0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 국내지수의 실시간 데이터를 구독합니다. + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트되며, 구독 등록/해제 여부와 종목코드를 통해 데이터를 필터링합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 응답 메시지 + columns (list[str]): 실시간 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = index_exp_ccnl("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UPANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "prpr_nmix", "prdy_vrss_sign", + "bstp_nmix_prdy_vrss", "acml_vol", "acml_tr_pbmn", "pcas_vol", + "pcas_tr_pbmn", "prdy_ctrt", "oprc_nmix", "nmix_hgpr", "nmix_lwpr", + "oprc_vrss_nmix_prpr", "oprc_vrss_nmix_sign", "hgpr_vrss_nmix_prpr", + "hgpr_vrss_nmix_sign", "lwpr_vrss_nmix_prpr", "lwpr_vrss_nmix_sign", + "prdy_clpr_vrss_oprc_rate", "prdy_clpr_vrss_hgpr_rate", + "prdy_clpr_vrss_lwpr_rate", "uplm_issu_cnt", "ascn_issu_cnt", + "stnr_issu_cnt", "down_issu_cnt", "lslm_issu_cnt", + "qtqt_ascn_issu_cnt", "qtqt_down_issu_cnt", "tick_vrss" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/chk_index_program_trade.py b/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/chk_index_program_trade.py new file mode 100644 index 0000000..b8ea478 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/chk_index_program_trade.py @@ -0,0 +1,215 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from index_program_trade import index_program_trade + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간프로그램매매 [실시간-028] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "bstp_cls_code": "업종 구분 코드", + "bsop_hour": "영업 시간", + "arbt_seln_entm_cnqn": "차익 매도 위탁 체결량", + "arbt_seln_onsl_cnqn": "차익 매도 자기 체결량", + "arbt_shnu_entm_cnqn": "차익 매수2 위탁 체결량", + "arbt_shnu_onsl_cnqn": "차익 매수2 자기 체결량", + "nabt_seln_entm_cnqn": "비차익 매도 위탁 체결량", + "nabt_seln_onsl_cnqn": "비차익 매도 자기 체결량", + "nabt_shnu_entm_cnqn": "비차익 매수2 위탁 체결량", + "nabt_shnu_onsl_cnqn": "비차익 매수2 자기 체결량", + "arbt_seln_entm_cntg_amt": "차익 매도 위탁 체결 금액", + "arbt_seln_onsl_cntg_amt": "차익 매도 자기 체결 금액", + "arbt_shnu_entm_cntg_amt": "차익 매수2 위탁 체결 금액", + "arbt_shnu_onsl_cntg_amt": "차익 매수2 자기 체결 금액", + "nabt_seln_entm_cntg_amt": "비차익 매도 위탁 체결 금액", + "nabt_seln_onsl_cntg_amt": "비차익 매도 자기 체결 금액", + "nabt_shnu_entm_cntg_amt": "비차익 매수2 위탁 체결 금액", + "nabt_shnu_onsl_cntg_amt": "비차익 매수2 자기 체결 금액", + "arbt_smtn_seln_vol": "차익 합계 매도 거래량", + "arbt_smtm_seln_vol_rate": "차익 합계 매도 거래량 비율", + "arbt_smtn_seln_tr_pbmn": "차익 합계 매도 거래 대금", + "arbt_smtm_seln_tr_pbmn_rate": "차익 합계 매도 거래대금 비율", + "arbt_smtn_shnu_vol": "차익 합계 매수2 거래량", + "arbt_smtm_shnu_vol_rate": "차익 합계 매수 거래량 비율", + "arbt_smtn_shnu_tr_pbmn": "차익 합계 매수2 거래 대금", + "arbt_smtm_shnu_tr_pbmn_rate": "차익 합계 매수 거래대금 비율", + "arbt_smtn_ntby_qty": "차익 합계 순매수 수량", + "arbt_smtm_ntby_qty_rate": "차익 합계 순매수 수량 비율", + "arbt_smtn_ntby_tr_pbmn": "차익 합계 순매수 거래 대금", + "arbt_smtm_ntby_tr_pbmn_rate": "차익 합계 순매수 거래대금 비율", + "nabt_smtn_seln_vol": "비차익 합계 매도 거래량", + "nabt_smtm_seln_vol_rate": "비차익 합계 매도 거래량 비율", + "nabt_smtn_seln_tr_pbmn": "비차익 합계 매도 거래 대금", + "nabt_smtm_seln_tr_pbmn_rate": "비차익 합계 매도 거래대금 비율", + "nabt_smtn_shnu_vol": "비차익 합계 매수2 거래량", + "nabt_smtm_shnu_vol_rate": "비차익 합계 매수 거래량 비율", + "nabt_smtn_shnu_tr_pbmn": "비차익 합계 매수2 거래 대금", + "nabt_smtm_shnu_tr_pbmn_rate": "비차익 합계 매수 거래대금 비율", + "nabt_smtn_ntby_qty": "비차익 합계 순매수 수량", + "nabt_smtm_ntby_qty_rate": "비차익 합계 순매수 수량 비율", + "nabt_smtn_ntby_tr_pbmn": "비차익 합계 순매수 거래 대금", + "nabt_smtm_ntby_tr_pbmn_rate": "비차익 합계 순매수 거래대금 비율", + "whol_entm_seln_vol": "전체 위탁 매도 거래량", + "entm_seln_vol_rate": "위탁 매도 거래량 비율", + "whol_entm_seln_tr_pbmn": "전체 위탁 매도 거래 대금", + "entm_seln_tr_pbmn_rate": "위탁 매도 거래대금 비율", + "whol_entm_shnu_vol": "전체 위탁 매수2 거래량", + "entm_shnu_vol_rate": "위탁 매수 거래량 비율", + "whol_entm_shnu_tr_pbmn": "전체 위탁 매수2 거래 대금", + "entm_shnu_tr_pbmn_rate": "위탁 매수 거래대금 비율", + "whol_entm_ntby_qt": "전체 위탁 순매수 수량", + "entm_ntby_qty_rat": "위탁 순매수 수량 비율", + "whol_entm_ntby_tr_pbmn": "전체 위탁 순매수 거래 대금", + "entm_ntby_tr_pbmn_rate": "위탁 순매수 금액 비율", + "whol_onsl_seln_vol": "전체 자기 매도 거래량", + "onsl_seln_vol_rate": "자기 매도 거래량 비율", + "whol_onsl_seln_tr_pbmn": "전체 자기 매도 거래 대금", + "onsl_seln_tr_pbmn_rate": "자기 매도 거래대금 비율", + "whol_onsl_shnu_vol": "전체 자기 매수2 거래량", + "onsl_shnu_vol_rate": "자기 매수 거래량 비율", + "whol_onsl_shnu_tr_pbmn": "전체 자기 매수2 거래 대금", + "onsl_shnu_tr_pbmn_rate": "자기 매수 거래대금 비율", + "whol_onsl_ntby_qty": "전체 자기 순매수 수량", + "onsl_ntby_qty_rate": "자기 순매수량 비율", + "whol_onsl_ntby_tr_pbmn": "전체 자기 순매수 거래 대금", + "onsl_ntby_tr_pbmn_rate": "자기 순매수 대금 비율", + "total_seln_qty": "총 매도 수량", + "whol_seln_vol_rate": "전체 매도 거래량 비율", + "total_seln_tr_pbmn": "총 매도 거래 대금", + "whol_seln_tr_pbmn_rate": "전체 매도 거래대금 비율", + "shnu_cntg_smtn": "총 매수 수량", + "whol_shun_vol_rate": "전체 매수 거래량 비율", + "total_shnu_tr_pbmn": "총 매수2 거래 대금", + "whol_shun_tr_pbmn_rate": "전체 매수 거래대금 비율", + "whol_ntby_qty": "전체 순매수 수량", + "whol_smtm_ntby_qty_rate": "전체 합계 순매수 수량 비율", + "whol_ntby_tr_pbmn": "전체 순매수 거래 대금", + "whol_ntby_tr_pbmn_rate": "전체 순매수 거래대금 비율", + "arbt_entm_ntby_qty": "차익 위탁 순매수 수량", + "arbt_entm_ntby_tr_pbmn": "차익 위탁 순매수 거래 대금", + "arbt_onsl_ntby_qty": "차익 자기 순매수 수량", + "arbt_onsl_ntby_tr_pbmn": "차익 자기 순매수 거래 대금", + "nabt_entm_ntby_qty": "비차익 위탁 순매수 수량", + "nabt_entm_ntby_tr_pbmn": "비차익 위탁 순매수 거래 대금", + "nabt_onsl_ntby_qty": "비차익 자기 순매수 수량", + "nabt_onsl_ntby_tr_pbmn": "비차익 자기 순매수 거래 대금", + "acml_vol": "누적 거래량", + "acml_tr_pbmn": "누적 거래 대금" +} + +# 숫자형 컬럼 리스트 +NUMERIC_COLUMNS = [ + "arbt_seln_entm_cnqn", "arbt_seln_onsl_cnqn", "arbt_shnu_entm_cnqn", "arbt_shnu_onsl_cnqn", + "nabt_seln_entm_cnqn", "nabt_seln_onsl_cnqn", "nabt_shnu_entm_cnqn", "nabt_shnu_onsl_cnqn", + "arbt_seln_entm_cntg_amt", "arbt_seln_onsl_cntg_amt", "arbt_shnu_entm_cntg_amt", "arbt_shnu_onsl_cntg_amt", + "nabt_seln_entm_cntg_amt", "nabt_seln_onsl_cntg_amt", "nabt_shnu_entm_cntg_amt", "nabt_shnu_onsl_cntg_amt", + "arbt_smtn_seln_vol", "arbt_smtm_seln_vol_rate", "arbt_smtn_seln_tr_pbmn", "arbt_smtm_seln_tr_pbmn_rate", + "arbt_smtn_shnu_vol", "arbt_smtm_shnu_vol_rate", "arbt_smtn_shnu_tr_pbmn", "arbt_smtm_shnu_tr_pbmn_rate", + "arbt_smtn_ntby_qty", "arbt_smtm_ntby_qty_rate", "arbt_smtn_ntby_tr_pbmn", "arbt_smtm_ntby_tr_pbmn_rate", + "nabt_smtn_seln_vol", "nabt_smtm_seln_vol_rate", "nabt_smtn_seln_tr_pbmn", "nabt_smtm_seln_tr_pbmn_rate", + "nabt_smtn_shnu_vol", "nabt_smtm_shnu_vol_rate", "nabt_smtn_shnu_tr_pbmn", "nabt_smtm_shnu_tr_pbmn_rate", + "nabt_smtn_ntby_qty", "nabt_smtm_ntby_qty_rate", "nabt_smtn_ntby_tr_pbmn", "nabt_smtm_ntby_tr_pbmn_rate", + "whol_entm_seln_vol", "entm_seln_vol_rate", "whol_entm_seln_tr_pbmn", "entm_seln_tr_pbmn_rate", + "whol_entm_shnu_vol", "entm_shnu_vol_rate", "whol_entm_shnu_tr_pbmn", "entm_shnu_tr_pbmn_rate", + "whol_entm_ntby_qt", "entm_ntby_qty_rat", "whol_entm_ntby_tr_pbmn", "entm_ntby_tr_pbmn_rate", + "whol_onsl_seln_vol", "onsl_seln_vol_rate", "whol_onsl_seln_tr_pbmn", "onsl_seln_tr_pbmn_rate", + "whol_onsl_shnu_vol", "onsl_shnu_vol_rate", "whol_onsl_shnu_tr_pbmn", "onsl_shnu_tr_pbmn_rate", + "whol_onsl_ntby_qty", "onsl_ntby_qty_rate", "whol_onsl_ntby_tr_pbmn", "onsl_ntby_tr_pbmn_rate", + "total_seln_qty", "whol_seln_vol_rate", "total_seln_tr_pbmn", "whol_seln_tr_pbmn_rate", + "shnu_cntg_smtn", "whol_shun_vol_rate", "total_shnu_tr_pbmn", "whol_shun_tr_pbmn_rate", + "whol_ntby_qty", "whol_smtm_ntby_qty_rate", "whol_ntby_tr_pbmn", "whol_ntby_tr_pbmn_rate", + "arbt_entm_ntby_qty", "arbt_entm_ntby_tr_pbmn", "arbt_onsl_ntby_qty", "arbt_onsl_ntby_tr_pbmn", + "nabt_entm_ntby_qty", "nabt_entm_ntby_tr_pbmn", "nabt_onsl_ntby_qty", "nabt_onsl_ntby_tr_pbmn", + "acml_vol", "acml_tr_pbmn" +] + + +def main(): + """ + 국내지수 실시간프로그램매매 + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=index_program_trade, data=["0001", "0128"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 안전한 컬럼명 매핑 (존재하는 컬럼에 대해서만 한글명 적용) + if not result.empty: + # 컬럼명 매핑 + existing_columns = {col: COLUMN_MAPPING[col] for col in result.columns if col in COLUMN_MAPPING} + if existing_columns: + result = result.rename(columns=existing_columns) + logging.info(f"컬럼명 매핑 완료: {len(existing_columns)}개 컬럼") + + # 안전한 숫자형 컬럼 변환 (존재하는 컬럼에 대해서만 적용) + NUMERIC_COLUMNS_to_convert = [col for col in NUMERIC_COLUMNS if col in result.columns] + if NUMERIC_COLUMNS_to_convert: + for col in NUMERIC_COLUMNS_to_convert: + try: + # 한글명으로 변환된 컬럼이 있는지 확인 + tarcol = COLUMN_MAPPING.get(col, col) + if tarcol in result.columns: + result[tarcol] = pd.to_numeric(result[tarcol], errors='coerce') + except Exception as e: + logging.warning(f"컬럼 '{col}' 숫자 변환 실패: {e}") + logging.info(f"숫자형 변환 완료: {len(NUMERIC_COLUMNS_to_convert)}개 컬럼") + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/index_program_trade.py b/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/index_program_trade.py new file mode 100644 index 0000000..c99079f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/index_program_trade/index_program_trade.py @@ -0,0 +1,95 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간프로그램매매 [실시간-028] +############################################################################################## + +def index_program_trade( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간프로그램매매[H0UPPGM0] 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 국내지수의 실시간 프로그램 매매 데이터를 구독합니다. + 실시간 데이터를 구독하거나 구독 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 웹소켓으로부터 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = index_program_trade("1", "005930") + >>> print(msg, columns) + + 참고자료: + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UPPGM0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "arbt_seln_entm_cnqn", "arbt_seln_onsl_cnqn", + "arbt_shnu_entm_cnqn", "arbt_shnu_onsl_cnqn", "nabt_seln_entm_cnqn", + "nabt_seln_onsl_cnqn", "nabt_shnu_entm_cnqn", "nabt_shnu_onsl_cnqn", + "arbt_seln_entm_cntg_amt", "arbt_seln_onsl_cntg_amt", "arbt_shnu_entm_cntg_amt", + "arbt_shnu_onsl_cntg_amt", "nabt_seln_entm_cntg_amt", "nabt_seln_onsl_cntg_amt", + "nabt_shnu_entm_cntg_amt", "nabt_shnu_onsl_cntg_amt", "arbt_smtn_seln_vol", + "arbt_smtm_seln_vol_rate", "arbt_smtn_seln_tr_pbmn", "arbt_smtm_seln_tr_pbmn_rate", + "arbt_smtn_shnu_vol", "arbt_smtm_shnu_vol_rate", "arbt_smtn_shnu_tr_pbmn", + "arbt_smtm_shnu_tr_pbmn_rate", "arbt_smtn_ntby_qty", "arbt_smtm_ntby_qty_rate", + "arbt_smtn_ntby_tr_pbmn", "arbt_smtm_ntby_tr_pbmn_rate", "nabt_smtn_seln_vol", + "nabt_smtm_seln_vol_rate", "nabt_smtn_seln_tr_pbmn", "nabt_smtm_seln_tr_pbmn_rate", + "nabt_smtn_shnu_vol", "nabt_smtm_shnu_vol_rate", "nabt_smtn_shnu_tr_pbmn", + "nabt_smtm_shnu_tr_pbmn_rate", "nabt_smtn_ntby_qty", "nabt_smtm_ntby_qty_rate", + "nabt_smtn_ntby_tr_pbmn", "nabt_smtm_ntby_tr_pbmn_rate", "whol_entm_seln_vol", + "entm_seln_vol_rate", "whol_entm_seln_tr_pbmn", "entm_seln_tr_pbmn_rate", + "whol_entm_shnu_vol", "entm_shnu_vol_rate", "whol_entm_shnu_tr_pbmn", + "entm_shnu_tr_pbmn_rate", "whol_entm_ntby_qt", "entm_ntby_qty_rat", + "whol_entm_ntby_tr_pbmn", "entm_ntby_tr_pbmn_rate", "whol_onsl_seln_vol", + "onsl_seln_vol_rate", "whol_onsl_seln_tr_pbmn", "onsl_seln_tr_pbmn_rate", + "whol_onsl_shnu_vol", "onsl_shnu_vol_rate", "whol_onsl_shnu_tr_pbmn", + "onsl_shnu_tr_pbmn_rate", "whol_onsl_ntby_qty", "onsl_ntby_qty_rate", + "whol_onsl_ntby_tr_pbmn", "onsl_ntby_tr_pbmn_rate", "total_seln_qty", + "whol_seln_vol_rate", "total_seln_tr_pbmn", "whol_seln_tr_pbmn_rate", + "shnu_cntg_smtn", "whol_shun_vol_rate", "total_shnu_tr_pbmn", + "whol_shun_tr_pbmn_rate", "whol_ntby_qty", "whol_smtm_ntby_qty_rate", + "whol_ntby_tr_pbmn", "whol_ntby_tr_pbmn_rate", "arbt_entm_ntby_qty", + "arbt_entm_ntby_tr_pbmn", "arbt_onsl_ntby_qty", "arbt_onsl_ntby_tr_pbmn", + "nabt_entm_ntby_qty", "nabt_entm_ntby_tr_pbmn", "nabt_onsl_ntby_qty", + "nabt_onsl_ntby_tr_pbmn", "acml_vol", "acml_tr_pbmn", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/chk_inquire_account_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/chk_inquire_account_balance.py new file mode 100644 index 0000000..45addaa --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/chk_inquire_account_balance.py @@ -0,0 +1,121 @@ +""" +Created on 20250131 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_account_balance import inquire_account_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 투자계좌자산현황조회[v1_국내주식-048] +############################################################################################## + +COLUMN_MAPPING = { + 'pchs_amt': '매입금액', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'crdt_lnd_amt': '신용대출금액', + 'real_nass_amt': '실제순자산금액', + 'whol_weit_rt': '전체비중율', + 'pchs_amt_smtl': '매입금액합계', + 'nass_tot_amt': '순자산총금액', + 'loan_amt_smtl': '대출금액합계', + 'evlu_pfls_amt_smtl': '평가손익금액합계', + 'evlu_amt_smtl': '평가금액합계', + 'tot_asst_amt': '총자산금액', + 'tot_lnda_tot_ulst_lnda': '총대출금액총융자대출금액', + 'cma_auto_loan_amt': 'CMA자동대출금액', + 'tot_mgln_amt': '총담보대출금액', + 'stln_evlu_amt': '대주평가금액', + 'crdt_fncg_amt': '신용융자금액', + 'ocl_apl_loan_amt': 'OCL_APL대출금액', + 'pldg_stup_amt': '질권설정금액', + 'frcr_evlu_tota': '외화평가총액', + 'tot_dncl_amt': '총예수금액', + 'cma_evlu_amt': 'CMA평가금액', + 'dncl_amt': '예수금액', + 'tot_sbst_amt': '총대용금액', + 'thdt_rcvb_amt': '당일미수금액', + 'ovrs_stck_evlu_amt1': '해외주식평가금액1', + 'ovrs_bond_evlu_amt': '해외채권평가금액', + 'mmf_cma_mgge_loan_amt': 'MMFCMA담보대출금액', + 'sbsc_dncl_amt': '청약예수금액', + 'pbst_sbsc_fnds_loan_use_amt': '공모주청약자금대출사용금액', + 'etpr_crdt_grnt_loan_amt': '기업신용공여대출금액' +} + +NUMERIC_COLUMNS = ['매입금액', '평가금액', '평가손익금액', '신용대출금액', '실제순자산금액', '전체비중율', '매입금액합계', '순자산총금액', '대출금액합계', '평가손익금액합계', + '평가금액합계', '총자산금액', '총대출금액총융자대출금액', 'CMA자동대출금액', '총담보대출금액', '대주평가금액', '신용융자금액', 'OCL_APL대출금액', + '질권설정금액', '외화평가총액', '총예수금액', 'CMA평가금액', '예수금액', '총대용금액', '당일미수금액', '해외주식평가금액1', '해외채권평가금액', + 'MMFCMA담보대출금액', '청약예수금액', '공모주청약자금대출사용금액', '기업신용공여대출금액'] + + +def main(): + """ + 투자계좌자산현황조회 테스트 함수 + + 이 함수는 투자계좌자산현황조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_account_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/inquire_account_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/inquire_account_balance.py new file mode 100644 index 0000000..d7c0214 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_account_balance/inquire_account_balance.py @@ -0,0 +1,78 @@ +""" +Created on 20250131 +""" + +import logging +import sys +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 투자계좌자산현황조회[v1_국내주식-048] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-account-balance" + +def inquire_account_balance( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 19 or 21) + inqr_dvsn_1: str = "", # 조회구분1 + bspr_bf_dt_aply_yn: str = "" # 기준가이전일자적용여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 투자계좌자산현황조회 API입니다. + + output1은 한국투자 HTS(eFriend Plus) > [0891] 계좌 자산비중(결제기준) 화면 아래 테이블의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 19 or 21) + inqr_dvsn_1 (str): 조회구분1 + bspr_bf_dt_aply_yn (str): 기준가이전일자적용여부 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_account_balance("12345678", "21") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '19' or '21')") + + tr_id = "CTRP6548R" # 투자계좌자산현황조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_DVSN_1": inqr_dvsn_1, # 조회구분1 + "BSPR_BF_DT_APLY_YN": bspr_bf_dt_aply_yn # 기준가이전일자적용여부 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 - array 타입 + df1 = pd.DataFrame(res.getBody().output1) + + # output2 - object 타입 (단일 객체를 DataFrame으로 변환) + df2 = pd.DataFrame([res.getBody().output2]) + + logging.info("Data fetch complete.") + return df1, df2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/chk_inquire_asking_price_exp_ccn.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/chk_inquire_asking_price_exp_ccn.py new file mode 100644 index 0000000..0e7385a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/chk_inquire_asking_price_exp_ccn.py @@ -0,0 +1,171 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_asking_price_exp_ccn import inquire_asking_price_exp_ccn + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 호가/예상체결[v1_국내주식-011] +############################################################################################## + +COLUMN_MAPPING = { + 'aspr_acpt_hour': '호가 접수 시간', + 'askp1': '매도호가1', + 'askp2': '매도호가2', + 'askp3': '매도호가3', + 'askp4': '매도호가4', + 'askp5': '매도호가5', + 'askp6': '매도호가6', + 'askp7': '매도호가7', + 'askp8': '매도호가8', + 'askp9': '매도호가9', + 'askp10': '매도호가10', + 'bidp1': '매수호가1', + 'bidp2': '매수호가2', + 'bidp3': '매수호가3', + 'bidp4': '매수호가4', + 'bidp5': '매수호가5', + 'bidp6': '매수호가6', + 'bidp7': '매수호가7', + 'bidp8': '매수호가8', + 'bidp9': '매수호가9', + 'bidp10': '매수호가10', + 'askp_rsqn1': '매도호가 잔량1', + 'askp_rsqn2': '매도호가 잔량2', + 'askp_rsqn3': '매도호가 잔량3', + 'askp_rsqn4': '매도호가 잔량4', + 'askp_rsqn5': '매도호가 잔량5', + 'askp_rsqn6': '매도호가 잔량6', + 'askp_rsqn7': '매도호가 잔량7', + 'askp_rsqn8': '매도호가 잔량8', + 'askp_rsqn9': '매도호가 잔량9', + 'askp_rsqn10': '매도호가 잔량10', + 'bidp_rsqn1': '매수호가 잔량1', + 'bidp_rsqn2': '매수호가 잔량2', + 'bidp_rsqn3': '매수호가 잔량3', + 'bidp_rsqn4': '매수호가 잔량4', + 'bidp_rsqn5': '매수호가 잔량5', + 'bidp_rsqn6': '매수호가 잔량6', + 'bidp_rsqn7': '매수호가 잔량7', + 'bidp_rsqn8': '매수호가 잔량8', + 'bidp_rsqn9': '매수호가 잔량9', + 'bidp_rsqn10': '매수호가 잔량10', + 'askp_rsqn_icdc1': '매도호가 잔량 증감1', + 'askp_rsqn_icdc2': '매도호가 잔량 증감2', + 'askp_rsqn_icdc3': '매도호가 잔량 증감3', + 'askp_rsqn_icdc4': '매도호가 잔량 증감4', + 'askp_rsqn_icdc5': '매도호가 잔량 증감5', + 'askp_rsqn_icdc6': '매도호가 잔량 증감6', + 'askp_rsqn_icdc7': '매도호가 잔량 증감7', + 'askp_rsqn_icdc8': '매도호가 잔량 증감8', + 'askp_rsqn_icdc9': '매도호가 잔량 증감9', + 'askp_rsqn_icdc10': '매도호가 잔량 증감10', + 'bidp_rsqn_icdc1': '매수호가 잔량 증감1', + 'bidp_rsqn_icdc2': '매수호가 잔량 증감2', + 'bidp_rsqn_icdc3': '매수호가 잔량 증감3', + 'bidp_rsqn_icdc4': '매수호가 잔량 증감4', + 'bidp_rsqn_icdc5': '매수호가 잔량 증감5', + 'bidp_rsqn_icdc6': '매수호가 잔량 증감6', + 'bidp_rsqn_icdc7': '매수호가 잔량 증감7', + 'bidp_rsqn_icdc8': '매수호가 잔량 증감8', + 'bidp_rsqn_icdc9': '매수호가 잔량 증감9', + 'bidp_rsqn_icdc10': '매수호가 잔량 증감10', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'total_askp_rsqn_icdc': '총 매도호가 잔량 증감', + 'total_bidp_rsqn_icdc': '총 매수호가 잔량 증감', + 'ovtm_total_askp_icdc': '시간외 총 매도호가 증감', + 'ovtm_total_bidp_icdc': '시간외 총 매수호가 증감', + 'ovtm_total_askp_rsqn': '시간외 총 매도호가 잔량', + 'ovtm_total_bidp_rsqn': '시간외 총 매수호가 잔량', + 'ntby_aspr_rsqn': '순매수 호가 잔량', + 'new_mkop_cls_code': '신 장운영 구분 코드', + 'antc_mkop_cls_code': '예상 장운영 구분 코드', + 'stck_prpr': '주식 현재가', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'stck_sdpr': '주식 기준가', + 'antc_cnpr': '예상 체결가', + 'antc_cntg_vrss_sign': '예상 체결 대비 부호', + 'antc_cntg_vrss': '예상 체결 대비', + 'antc_cntg_prdy_ctrt': '예상 체결 전일 대비율', + 'antc_vol': '예상 거래량', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'vi_cls_code': 'VI적용구분코드' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 호가/예상체결 조회 테스트 함수 + + 이 함수는 주식현재가 호가/예상체결 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_asking_price_exp_ccn(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 (호가정보) 처리 + logging.info("=== output1 (호가정보) ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 (예상체결정보) 처리 + logging.info("=== output2 (예상체결정보) ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/inquire_asking_price_exp_ccn.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/inquire_asking_price_exp_ccn.py new file mode 100644 index 0000000..956ce67 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_asking_price_exp_ccn/inquire_asking_price_exp_ccn.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 호가/예상체결[v1_국내주식-011] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn" + +def inquire_asking_price_exp_ccn( + env_dv: str, # 실전모의구분 (real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # 입력 종목코드 (123456) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 호가 예상체결 API입니다. 매수 매도 호가를 확인하실 수 있습니다. 실시간 데이터를 원하신다면 웹소켓 API를 활용하세요. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (호가정보, 예상체결정보) 데이터 + + Example: + >>> result1, result2 = inquire_asking_price_exp_ccn(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(result1) # 호가정보 + >>> print(result2) # 예상체결정보 + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHKST01010200" + elif env_dv == "demo": + tr_id = "FHKST01010200" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd # 입력 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> 호가정보 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) -> 예상체결정보 + output2_data = pd.DataFrame([res.getBody().output2]) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/chk_inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/chk_inquire_balance.py new file mode 100644 index 0000000..d2cca8b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/chk_inquire_balance.py @@ -0,0 +1,147 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_balance import inquire_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회[v1_국내주식-006] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'trad_dvsn_name': '매매구분명', + 'bfdy_buy_qty': '전일매수수량', + 'bfdy_sll_qty': '전일매도수량', + 'thdt_buyqty': '금일매수수량', + 'thdt_sll_qty': '금일매도수량', + 'hldg_qty': '보유수량', + 'ord_psbl_qty': '주문가능수량', + 'pchs_avg_pric': '매입평균가격', + 'pchs_amt': '매입금액', + 'prpr': '현재가', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'evlu_pfls_rt': '평가손익율', + 'evlu_erng_rt': '평가수익율', + 'loan_dt': '대출일자', + 'loan_amt': '대출금액', + 'stln_slng_chgs': '대주매각대금', + 'expd_dt': '만기일자', + 'fltt_rt': '등락율', + 'bfdy_cprs_icdc': '전일대비증감', + 'item_mgna_rt_name': '종목증거금율명', + 'grta_rt_name': '보증금율명', + 'sbst_pric': '대용가격', + 'stck_loan_unpr': '주식대출단가', + 'dnca_tot_amt': '예수금총금액', + 'nxdy_excc_amt': '익일정산금액', + 'prvs_rcdl_excc_amt': '가수도정산금액', + 'cma_evlu_amt': 'CMA평가금액', + 'bfdy_buy_amt': '전일매수금액', + 'thdt_buy_amt': '금일매수금액', + 'nxdy_auto_rdpt_amt': '익일자동상환금액', + 'bfdy_sll_amt': '전일매도금액', + 'thdt_sll_amt': '금일매도금액', + 'd2_auto_rdpt_amt': 'D+2자동상환금액', + 'bfdy_tlex_amt': '전일제비용금액', + 'thdt_tlex_amt': '금일제비용금액', + 'tot_loan_amt': '총대출금액', + 'scts_evlu_amt': '유가평가금액', + 'tot_evlu_amt': '총평가금액', + 'nass_amt': '순자산금액', + 'fncg_gld_auto_rdpt_yn': '융자금자동상환여부', + 'pchs_amt_smtl_amt': '매입금액합계금액', + 'evlu_amt_smtl_amt': '평가금액합계금액', + 'evlu_pfls_smtl_amt': '평가손익합계금액', + 'tot_stln_slng_chgs': '총대주매각대금', + 'bfdy_tot_asst_evlu_amt': '전일총자산평가금액', + 'asst_icdc_amt': '자산증감액', + 'asst_icdc_erng_rt': '자산증감수익율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식잔고조회 테스트 함수 + + 이 함수는 주식잔고조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_balance( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + afhr_flpr_yn="N", + inqr_dvsn="01", + unpr_dvsn="01", + fund_sttl_icld_yn="N", + fncg_amt_auto_rdpt_yn="N", + prcs_dvsn="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/inquire_balance.py new file mode 100644 index 0000000..ddd9392 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance/inquire_balance.py @@ -0,0 +1,170 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회[v1_국내주식-006] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-balance" + +def inquire_balance( + env_dv: str, # 실전모의구분 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + afhr_flpr_yn: str, # 시간외단일가·거래소여부 + inqr_dvsn: str, # 조회구분 + unpr_dvsn: str, # 단가구분 + fund_sttl_icld_yn: str, # 펀드결제분포함여부 + fncg_amt_auto_rdpt_yn: str, # 융자금액자동상환여부 + prcs_dvsn: str, # 처리구분 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식 잔고조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 50건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + * 당일 전량매도한 잔고도 보유수량 0으로 보여질 수 있으나, 해당 보유수량 0인 잔고는 최종 D-2일 이후에는 잔고에서 사라집니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + afhr_flpr_yn (str): [필수] 시간외단일가·거래소여부 (ex. N:기본값, Y:시간외단일가, X:NXT) + inqr_dvsn (str): [필수] 조회구분 (ex. 01 – 대출일별 | 02 – 종목별) + unpr_dvsn (str): [필수] 단가구분 (ex. 01) + fund_sttl_icld_yn (str): [필수] 펀드결제분포함여부 (ex. N, Y) + fncg_amt_auto_rdpt_yn (str): [필수] 융자금액자동상환여부 (ex. N) + prcs_dvsn (str): [필수] 처리구분 (ex. 00: 전일매매포함, 01:전일매매미포함) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주식잔고조회 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, afhr_flpr_yn="N", inqr_dvsn="01", unpr_dvsn="01", fund_sttl_icld_yn="N", fncg_amt_auto_rdpt_yn="N", prcs_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if afhr_flpr_yn == "": + raise ValueError("afhr_flpr_yn is required (e.g. 'N:기본값, Y:시간외단일가, X:NXT')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '01 – 대출일별 | 02 – 종목별')") + + if unpr_dvsn == "": + raise ValueError("unpr_dvsn is required (e.g. '01')") + + if fund_sttl_icld_yn == "": + raise ValueError("fund_sttl_icld_yn is required (e.g. 'N, Y')") + + if fncg_amt_auto_rdpt_yn == "": + raise ValueError("fncg_amt_auto_rdpt_yn is required (e.g. 'N')") + + if prcs_dvsn == "": + raise ValueError("prcs_dvsn is required (e.g. '00: 전일매매포함, 01:전일매매미포함')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC8434R" + elif env_dv == "demo": + tr_id = "VTTC8434R" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "AFHR_FLPR_YN": afhr_flpr_yn, + "OFL_YN": "", + "INQR_DVSN": inqr_dvsn, + "UNPR_DVSN": unpr_dvsn, + "FUND_STTL_ICLD_YN": fund_sttl_icld_yn, + "FNCG_AMT_AUTO_RDPT_YN": fncg_amt_auto_rdpt_yn, + "PRCS_DVSN": prcs_dvsn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance( + env_dv, cano, acnt_prdt_cd, afhr_flpr_yn, inqr_dvsn, unpr_dvsn, + fund_sttl_icld_yn, fncg_amt_auto_rdpt_yn, prcs_dvsn, FK100, NK100, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/chk_inquire_balance_rlz_pl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/chk_inquire_balance_rlz_pl.py new file mode 100644 index 0000000..90a3a53 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/chk_inquire_balance_rlz_pl.py @@ -0,0 +1,148 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_balance_rlz_pl import inquire_balance_rlz_pl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익[v1_국내주식-041] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'trad_dvsn_name': '매매구분명', + 'bfdy_buy_qty': '전일매수수량', + 'bfdy_sll_qty': '전일매도수량', + 'thdt_buyqty': '금일매수수량', + 'thdt_sll_qty': '금일매도수량', + 'hldg_qty': '보유수량', + 'ord_psbl_qty': '주문가능수량', + 'pchs_avg_pric': '매입평균가격', + 'pchs_amt': '매입금액', + 'prpr': '현재가', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'evlu_pfls_rt': '평가손익율', + 'evlu_erng_rt': '평가수익율', + 'loan_dt': '대출일자', + 'loan_amt': '대출금액', + 'stln_slng_chgs': '대주매각대금', + 'expd_dt': '만기일자', + 'stck_loan_unpr': '주식대출단가', + 'bfdy_cprs_icdc': '전일대비증감', + 'fltt_rt': '등락율', + 'dnca_tot_amt': '예수금총금액', + 'nxdy_excc_amt': '익일정산금액', + 'prvs_rcdl_excc_amt': '가수도정산금액', + 'cma_evlu_amt': 'CMA평가금액', + 'bfdy_buy_amt': '전일매수금액', + 'thdt_buy_amt': '금일매수금액', + 'nxdy_auto_rdpt_amt': '익일자동상환금액', + 'bfdy_sll_amt': '전일매도금액', + 'thdt_sll_amt': '금일매도금액', + 'd2_auto_rdpt_amt': 'D+2자동상환금액', + 'bfdy_tlex_amt': '전일제비용금액', + 'thdt_tlex_amt': '금일제비용금액', + 'tot_loan_amt': '총대출금액', + 'scts_evlu_amt': '유가평가금액', + 'tot_evlu_amt': '총평가금액', + 'nass_amt': '순자산금액', + 'fncg_gld_auto_rdpt_yn': '융자금자동상환여부', + 'pchs_amt_smtl_amt': '매입금액합계금액', + 'evlu_amt_smtl_amt': '평가금액합계금액', + 'evlu_pfls_smtl_amt': '평가손익합계금액', + 'tot_stln_slng_chgs': '총대주매각대금', + 'bfdy_tot_asst_evlu_amt': '전일총자산평가금액', + 'asst_icdc_amt': '자산증감액', + 'asst_icdc_erng_rt': '자산증감수익율', + 'rlzt_pfls': '실현손익', + 'rlzt_erng_rt': '실현수익율', + 'real_evlu_pfls': '실평가손익', + 'real_evlu_pfls_erng_rt': '실평가손익수익율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식잔고조회_실현손익 조회 테스트 함수 + + 이 함수는 주식잔고조회_실현손익 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_balance_rlz_pl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + afhr_flpr_yn="N", + inqr_dvsn="02", + unpr_dvsn="01", + fund_sttl_icld_yn="N", + fncg_amt_auto_rdpt_yn="N", + prcs_dvsn="01", + cost_icld_yn="N" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/inquire_balance_rlz_pl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/inquire_balance_rlz_pl.py new file mode 100644 index 0000000..64fe51f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_balance_rlz_pl/inquire_balance_rlz_pl.py @@ -0,0 +1,163 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익[v1_국내주식-041] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl" + +def inquire_balance_rlz_pl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + afhr_flpr_yn: str, # 시간외단일가여부 + inqr_dvsn: str, # 조회구분 + unpr_dvsn: str, # 단가구분 + fund_sttl_icld_yn: str, # 펀드결제포함여부 + fncg_amt_auto_rdpt_yn: str, # 융자금액자동상환여부 + prcs_dvsn: str, # PRCS_DVSN + ofl_yn: str = "", # 오프라인여부 + cost_icld_yn: str = "", # 비용포함여부 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식잔고조회_실현손익 API입니다. + 한국투자 HTS(eFriend Plus) [0800] 국내 체결기준잔고 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + (참고: 포럼 - 공지사항 - 신규 API 추가 안내(주식잔고조회_실현손익 외 1건)) + + Args: + cano (str): [필수] 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + afhr_flpr_yn (str): [필수] 시간외단일가여부 (N:기본값, Y:시간외단일가) + inqr_dvsn (str): [필수] 조회구분 (00:전체) + unpr_dvsn (str): [필수] 단가구분 (01:기본값) + fund_sttl_icld_yn (str): [필수] 펀드결제포함여부 (N:포함하지 않음, Y:포함) + fncg_amt_auto_rdpt_yn (str): [필수] 융자금액자동상환여부 (N:기본값) + prcs_dvsn (str): [필수] PRCS_DVSN (00:전일매매포함, 01:전일매매미포함) + ofl_yn (str): 오프라인여부 + cost_icld_yn (str): 비용포함여부 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주식잔고조회_실현손익 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_balance_rlz_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, afhr_flpr_yn="N", inqr_dvsn="02", unpr_dvsn="01", fund_sttl_icld_yn="N", fncg_amt_auto_rdpt_yn="N", prcs_dvsn="01") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if afhr_flpr_yn == "": + raise ValueError("afhr_flpr_yn is required (e.g. 'N:기본값, Y:시간외단일가')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00:전체')") + + if unpr_dvsn == "": + raise ValueError("unpr_dvsn is required (e.g. '01:기본값')") + + if fund_sttl_icld_yn == "": + raise ValueError("fund_sttl_icld_yn is required (e.g. 'N:포함하지 않음, Y:포함')") + + if fncg_amt_auto_rdpt_yn == "": + raise ValueError("fncg_amt_auto_rdpt_yn is required (e.g. 'N:기본값')") + + if prcs_dvsn == "": + raise ValueError("prcs_dvsn is required (e.g. '00:전일매매포함, 01:전일매매미포함')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8494R" # 주식잔고조회_실현손익 + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "AFHR_FLPR_YN": afhr_flpr_yn, + "OFL_YN": ofl_yn, + "INQR_DVSN": inqr_dvsn, + "UNPR_DVSN": unpr_dvsn, + "FUND_STTL_ICLD_YN": fund_sttl_icld_yn, + "FNCG_AMT_AUTO_RDPT_YN": fncg_amt_auto_rdpt_yn, + "PRCS_DVSN": prcs_dvsn, + "COST_ICLD_YN": cost_icld_yn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_rlz_pl( + cano, acnt_prdt_cd, afhr_flpr_yn, inqr_dvsn, unpr_dvsn, + fund_sttl_icld_yn, fncg_amt_auto_rdpt_yn, prcs_dvsn, + ofl_yn, cost_icld_yn, FK100, NK100, "N", + dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/chk_inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/chk_inquire_ccnl.py new file mode 100644 index 0000000..0f65927 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/chk_inquire_ccnl.py @@ -0,0 +1,76 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_ccnl import inquire_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 체결[v1_국내주식-009] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식 체결 시간', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'cntg_vol': '체결 거래량', + 'tday_rltv': '당일 체결강도', + 'prdy_ctrt': '전일 대비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 체결 조회 테스트 함수 + + 이 함수는 주식현재가 체결 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_ccnl(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/inquire_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/inquire_ccnl.py new file mode 100644 index 0000000..7d5ffdd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_ccnl/inquire_ccnl.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 체결[v1_국내주식-009] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-ccnl" + +def inquire_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내현재가 체결 API 입니다. 종목의 체결 정보를 확인할 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 체결 데이터 + + Example: + >>> df = inquire_ccnl("real", "J", "005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전', 'demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX', 'NX:NXT', 'UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010300" + elif env_dv == "demo": + tr_id = "FHKST01010300" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/chk_inquire_credit_psamount.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/chk_inquire_credit_psamount.py new file mode 100644 index 0000000..342f072 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/chk_inquire_credit_psamount.py @@ -0,0 +1,90 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_credit_psamount import inquire_credit_psamount + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 신용매수가능조회[v1_국내주식-042] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ruse_psbl_amt': '재사용가능금액', + 'fund_rpch_chgs': '펀드환매대금', + 'psbl_qty_calc_unpr': '가능수량계산단가', + 'nrcvb_buy_amt': '미수없는매수금액', + 'nrcvb_buy_qty': '미수없는매수수량', + 'max_buy_amt': '최대매수금액', + 'max_buy_qty': '최대매수수량', + 'cma_evlu_amt': 'CMA평가금액', + 'ovrs_re_use_amt_wcrc': '해외재사용금액원화', + 'ord_psbl_frcr_amt_wcrc': '주문가능외화금액원화' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 신용매수가능조회 테스트 함수 + + 이 함수는 신용매수가능조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_credit_psamount( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="005930", + ord_dvsn="00", + crdt_type="21", + cma_evlu_amt_icld_yn="N", + ovrs_icld_yn="N" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/inquire_credit_psamount.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/inquire_credit_psamount.py new file mode 100644 index 0000000..94a47f9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_credit_psamount/inquire_credit_psamount.py @@ -0,0 +1,98 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 신용매수가능조회[v1_국내주식-042] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-credit-psamount" + +def inquire_credit_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 종목코드 + ord_dvsn: str, # 주문구분 + crdt_type: str, # 신용유형 + cma_evlu_amt_icld_yn: str, # CMA평가금액포함여부 + ovrs_icld_yn: str, # 해외포함여부 + ord_unpr: str = "" # 주문단가 +) -> pd.DataFrame: + """ + 신용매수가능조회 API입니다. + 신용매수주문 시 주문가능수량과 금액을 확인하실 수 있습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + pdno (str): [필수] 종목코드 + ord_dvsn (str): [필수] 주문구분 (ex. 00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 03 : 최유리지정가, 04 : 최우선지정가, 05 : 장전 시간외, 06 : 장후 시간외, 07 : 시간외 단일가 등) + crdt_type (str): [필수] 신용유형 (ex. 21 : 자기융자신규, 23 : 유통융자신규, 26 : 유통대주상환, 28 : 자기대주상환, 25 : 자기융자상환, 27 : 유통융자상환, 22 : 유통대주신규, 24 : 자기대주신규) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 + ovrs_icld_yn (str): [필수] 해외포함여부 + ord_unpr (str): 주문단가 (ex. 1주당 가격. 장전/장후 시간외, 시장가의 경우 "0" 입력 권고) + + Returns: + pd.DataFrame: 신용매수가능조회 데이터 + + Example: + >>> df = inquire_credit_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_dvsn="00", crdt_type="21", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") + >>> print(df) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required (e.g. '00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 03 : 최유리지정가, 04 : 최우선지정가, 05 : 장전 시간외, 06 : 장후 시간외, 07 : 시간외 단일가 등')") + + if crdt_type == "" or crdt_type is None: + raise ValueError("crdt_type is required (e.g. '21 : 자기융자신규, 23 : 유통융자신규, 26 : 유통대주상환, 28 : 자기대주상환, 25 : 자기융자상환, 27 : 유통융자상환, 22 : 유통대주신규, 24 : 자기대주신규')") + + if cma_evlu_amt_icld_yn == "" or cma_evlu_amt_icld_yn is None: + raise ValueError("cma_evlu_amt_icld_yn is required") + + if ovrs_icld_yn == "" or ovrs_icld_yn is None: + raise ValueError("ovrs_icld_yn is required") + + tr_id = "TTTC8909R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_DVSN": ord_dvsn, + "CRDT_TYPE": crdt_type, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "OVRS_ICLD_YN": ovrs_icld_yn, + "ORD_UNPR": ord_unpr + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/chk_inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/chk_inquire_daily_ccld.py new file mode 100644 index 0000000..b3c4fbd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/chk_inquire_daily_ccld.py @@ -0,0 +1,140 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_ccld import inquire_daily_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식일별주문체결조회[v1_국내주식-005] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_dt': '주문일자', + 'ord_gno_brno': '주문채번지점번호', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'ord_dvsn_name': '주문구분명', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'sll_buy_dvsn_cd_name': '매도매수구분코드명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'ord_qty': '주문수량', + 'ord_unpr': '주문단가', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'avg_prvs': '평균가', + 'cncl_yn': '취소여부', + 'tot_ccld_amt': '총체결금액', + 'loan_dt': '대출일자', + 'ordr_empno': '주문자사번', + 'ord_dvsn_cd': '주문구분코드', + 'cnc_cfrm_qty': '취소확인수량', + 'rmn_qty': '잔여수량', + 'rjct_qty': '거부수량', + 'ccld_cndt_name': '체결조건명', + 'inqr_ip_addr': '조회IP주소', + 'cpbc_ordp_ord_rcit_dvsn_cd': '전산주문표주문접수구분코드', + 'cpbc_ordp_infm_mthd_dvsn_cd': '전산주문표통보방법구분코드', + 'infm_tmd': '통보시각', + 'ctac_tlno': '연락전화번호', + 'prdt_type_cd': '상품유형코드', + 'excg_dvsn_cd': '거래소구분코드', + 'cpbc_ordp_mtrl_dvsn_cd': '전산주문표자료구분코드', + 'ord_orgno': '주문조직번호', + 'rsvn_ord_end_dt': '예약주문종료일자', + 'excg_id_dvsn_Cd': '거래소ID구분코드', + 'stpm_cndt_pric': '스톱지정가조건가격', + 'stpm_efct_occr_dtmd': '스톱지정가효력발생상세시각', + 'tot_ord_qty': '총주문수량', + 'tot_ccld_qty': '총체결수량', + 'tot_ccld_amt': '매입평균가격', + 'prsm_tlex_smtl': '총체결금액', + 'pchs_avg_pric': '추정제비용합계' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식일별주문체결조회 테스트 함수 + + 이 함수는 주식일별주문체결조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_daily_ccld( + env_dv="real", + pd_dv="inner", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_dt="20220810", + inqr_end_dt="20220810", + sll_buy_dvsn_cd="00", + inqr_dvsn="00", + pdno="005930", + ccld_dvsn="00", + inqr_dvsn_3="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/inquire_daily_ccld.py new file mode 100644 index 0000000..38d5f54 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_ccld/inquire_daily_ccld.py @@ -0,0 +1,211 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식일별주문체결조회[v1_국내주식-005] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-daily-ccld" + +def inquire_daily_ccld( + env_dv: str, # [필수] 실전모의구분 (real:실전, demo:모의) + pd_dv: str, # [필수] 3개월이전이내구분 (before:이전, inner:이내) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + inqr_strt_dt: str, # [필수] 조회시작일자 + inqr_end_dt: str, # [필수] 조회종료일자 + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (00 : 전체 / 01 : 매도 / 02 : 매수) + ccld_dvsn: str, # [필수] 체결구분 (00 전체 / 01 체결 / 02 미체결) + inqr_dvsn: str, # [필수] 조회구분 (00 역순 / 01 정순) + inqr_dvsn_3: str, # [필수] 조회구분3 (00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환) + pdno: str = "", # 상품번호 + ord_gno_brno: str = "", # 주문채번지점번호 + odno: str = "", # 주문번호 (주문시 한국투자증권 시스템에서 채번된 주문번호) + inqr_dvsn_1: str = "", # 조회구분1 (없음: 전체 / 1: ELW / 2: 프리보드) + FK100: str = "", # 연속조회검색조건100 (공란: 최초 조회 / 이전 조회 Output 사용) + NK100: str = "", # 연속조회키100 (공란: 최초 조회 / 이전 조회 Output 사용) + tr_cont: str = "", # 연속거래여부 + excg_id_dvsn_cd: Optional[str] = "KRX", # 거래소ID구분코드 (KRX / NXT / SOR / ALL) + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식일별주문체결조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 15건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + * 다만, 3개월 이전 체결내역 조회(CTSC9115R) 의 경우, + 장중에는 많은 거래량으로 인해 순간적으로 DB가 밀렸거나 응답을 늦게 받거나 하는 등의 이슈가 있을 수 있어 + ① 가급적 장 종료 이후(15:30 이후) 조회하시고 + ② 조회기간(INQR_STRT_DT와 INQR_END_DT 사이의 간격)을 보다 짧게 해서 조회하는 것을 + 권유드립니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + pd_dv (str): [필수] 3개월이전이내구분 (ex. before:이전, inner:이내) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00 : 전체 / 01 : 매도 / 02 : 매수) + pdno (str): 상품번호 + ccld_dvsn (str): [필수] 체결구분 (ex. 00 전체 / 01 체결 / 02 미체결) + inqr_dvsn (str): [필수] 조회구분 (ex. 00 역순 / 01 정순) + inqr_dvsn_3 (str): [필수] 조회구분3 (ex. 00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환) + ord_gno_brno (str): 주문채번지점번호 + odno (str): 주문번호 (ex. 주문시 한국투자증권 시스템에서 채번된 주문번호) + inqr_dvsn_1 (str): 조회구분1 (ex. 없음: 전체 / 1: ELW / 2: 프리보드) + FK100 (str): 연속조회검색조건100 (ex. 공란: 최초 조회 / 이전 조회 Output 사용) + NK100 (str): 연속조회키100 (ex. 공란: 최초 조회 / 이전 조회 Output 사용) + tr_cont (str): 연속거래여부 + excg_id_dvsn_cd (Optional[str]): 거래소ID구분코드 (ex. KRX / NXT / SOR / ALL) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... env_dv="real", pd_dv="inner", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... inqr_strt_dt="20220810", inqr_end_dt="20220810", + ... sll_buy_dvsn_cd="00", pdno="005930", ccld_dvsn="00", + ... inqr_dvsn="00", inqr_dvsn_3="00" + ... ) + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전', 'demo:모의')") + + if pd_dv == "": + raise ValueError("pd_dv is required (e.g. 'before:이전', 'inner:이내')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00 : 전체 / 01 : 매도 / 02 : 매수')") + + if ccld_dvsn == "": + raise ValueError("ccld_dvsn is required (e.g. '00 전체 / 01 체결 / 02 미체결')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00 역순 / 01 정순')") + + if inqr_dvsn_3 == "": + raise ValueError("inqr_dvsn_3 is required (e.g. '00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + if pd_dv == "before": + tr_id = "CTSC9215R" + elif pd_dv == "inner": + tr_id = "TTTC0081R" + else: + raise ValueError("pd_dv can only be 'before' or 'inner'") + elif env_dv == "demo": + if pd_dv == "before": + tr_id = "VTSC9215R" + elif pd_dv == "inner": + tr_id = "VTTC0081R" + else: + raise ValueError("pd_dv can only be 'before' or 'inner'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "PDNO": pdno, + "CCLD_DVSN": ccld_dvsn, + "INQR_DVSN": inqr_dvsn, + "INQR_DVSN_3": inqr_dvsn_3, + "ORD_GNO_BRNO": ord_gno_brno, + "ODNO": odno, + "INQR_DVSN_1": inqr_dvsn_1, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + if excg_id_dvsn_cd is not None: + params["EXCG_ID_DVSN_CD"] = excg_id_dvsn_cd + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_daily_ccld( + env_dv, pd_dv, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + sll_buy_dvsn_cd, pdno, ccld_dvsn, inqr_dvsn, inqr_dvsn_3, + ord_gno_brno, odno, inqr_dvsn_1, FK100, NK100, "N", + excg_id_dvsn_cd, dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/chk_inquire_daily_indexchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/chk_inquire_daily_indexchartprice.py new file mode 100644 index 0000000..8bd568e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/chk_inquire_daily_indexchartprice.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_daily_indexchartprice import inquire_daily_indexchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) [v1_국내주식-021] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'prdy_nmix': '전일 지수', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_cls_code': '업종 구분 코드', + 'prdy_vol': '전일 거래량', + 'bstp_nmix_oprc': '업종 지수 시가', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'futs_prdy_oprc': '업종 전일 시가', + 'futs_prdy_hgpr': '업종 전일 최고가', + 'futs_prdy_lwpr': '업종 전일 최저가', + 'stck_bsop_date': '영업 일자', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_oprc': '업종 지수 시가', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'mod_yn': '변경 여부' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] + + 국내주식업종기간별시세(일_주_월_년) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (업종 : U) + - fid_input_iscd (str): 업종 상세코드 (0001 : 종합 0002 : 대형주 ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)) + - fid_input_date_1 (str): 조회 시작일자 (조회 시작일자 (ex. 20220501)) + - fid_input_date_2 (str): 조회 종료일자 (조회 종료일자 (ex. 20220530)) + - fid_period_div_code (str): 기간분류코드 (D:일봉 W:주봉, M:월봉, Y:년봉) + - env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의) + + Returns: + - Tuple[DataFrame, ...]: 국내주식업종기간별시세(일_주_월_년) 결과 + + Example: + >>> df1, df2 = inquire_daily_indexchartprice(fid_cond_mrkt_div_code="U", fid_input_iscd="0001", fid_input_date_1="20250101", fid_input_date_2="20250131", fid_period_div_code="D", env_dv="real") # 실전투자 + >>> df1, df2 = inquire_daily_indexchartprice(fid_cond_mrkt_div_code="U", fid_input_iscd="0001", fid_input_date_1="20250101", fid_input_date_2="20250131", fid_period_div_code="D", env_dv="demo") # 모의투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + # API 호출 (모의투자 지원 로직) + result1, result2 = inquire_daily_indexchartprice( + fid_cond_mrkt_div_code="U", # 조건 시장 분류 코드 + fid_input_iscd="0001", # 업종 상세코드 + fid_input_date_1="20250101", # 조회 시작일자 + fid_input_date_2="20250131", # 조회 종료일자 + fid_period_div_code="D", # 기간분류코드 + env_dv="real", # "real": 실전투자, "demo": 모의투자, # [추가] 실전모의구분 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/inquire_daily_indexchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/inquire_daily_indexchartprice.py new file mode 100644 index 0000000..0e8856c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_indexchartprice/inquire_daily_indexchartprice.py @@ -0,0 +1,182 @@ +# [국내주식] 업종/기타 - 국내주식업종기간별시세(일/주/월/년) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice" + +def inquire_daily_indexchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 업종 상세코드 + fid_input_date_1: str, # 조회 시작일자 + fid_input_date_2: str, # 조회 종료일자 + fid_period_div_code: str, # 기간분류코드 + env_dv: str = "real", # [추가] 실전모의구분 (real:실전, demo:모의) + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] + 국내주식업종기간별시세(일_주_월_년) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 업종 : U + fid_input_iscd (str): 0001 : 종합 0002 : 대형주 ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_input_date_1 (str): 조회 시작일자 (ex. 20220501) + fid_input_date_2 (str): 조회 종료일자 (ex. 20220530) + fid_period_div_code (str): D:일봉 W:주봉, M:월봉, Y:년봉 + env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real') + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식업종기간별시세(일_주_월_년) 데이터 + + Example: + >>> df1, df2 = inquire_daily_indexchartprice( + ... fid_cond_mrkt_div_code="U", + ... fid_input_iscd="0001", + ... fid_input_date_1="20220501", + ... fid_input_date_2="20220530", + ... fid_period_div_code="D", + ... env_dv="real" # 실전투자 + ... ) + >>> df1, df2 = inquire_daily_indexchartprice( + ... fid_cond_mrkt_div_code="U", + ... fid_input_iscd="0001", + ... fid_input_date_1="20220501", + ... fid_input_date_2="20220530", + ... fid_period_div_code="D", + ... env_dv="demo" # 모의투자 + ... ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20220501')") + raise ValueError("fid_input_date_1 is required. (e.g. '20220501')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20220530')") + raise ValueError("fid_input_date_2 is required. (e.g. '20220530')") + + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + # env_dv 파라미터 검증 (모의투자 지원 로직) + if env_dv not in ["real", "demo"]: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # API 호출 URL 설정 + + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKUP03500100" # 실전투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_indexchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + fid_period_div_code, + env_dv, # env_dv 파라미터 추가 + dataframe1, + dataframe2, + "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py new file mode 100644 index 0000000..e6ea734 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/chk_inquire_daily_itemchartprice.py @@ -0,0 +1,136 @@ +""" +Created on 20250101 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_itemchartprice import inquire_daily_itemchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년)[v1_국내주식-016] +############################################################################################## + +COLUMN_MAPPING = { + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'stck_prdy_clpr': '주식 전일 종가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'prdy_vol': '전일 거래량', + 'stck_mxpr': '주식 상한가', + 'stck_llam': '주식 하한가', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'stck_prdy_oprc': '주식 전일 시가', + 'stck_prdy_hgpr': '주식 전일 최고가', + 'stck_prdy_lwpr': '주식 전일 최저가', + 'askp': '매도호가', + 'bidp': '매수호가', + 'prdy_vrss_vol': '전일 대비 거래량', + 'vol_tnrt': '거래량 회전율', + 'stck_fcam': '주식 액면가', + 'lstn_stcn': '상장 주수', + 'cpfn': '자본금', + 'hts_avls': 'HTS 시가총액', + 'per': 'PER', + 'eps': 'EPS', + 'pbr': 'PBR', + 'itewhol_loan_rmnd_ratem': '전체 융자 잔고 비율', + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'flng_cls_code': '락 구분 코드', + 'prtt_rate': '분할 비율', + 'mod_yn': '변경 여부', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'revl_issu_reas': '재평가사유코드' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식기간별시세(일/주/월/년) 조회 테스트 함수 + + 이 함수는 국내주식기간별시세(일/주/월/년) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_daily_itemchartprice( + env_dv="real", + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_date_1="20220101", + fid_input_date_2="20220809", + fid_period_div_code="D", + fid_org_adj_prc="1" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py new file mode 100644 index 0000000..77f0eac --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_itemchartprice/inquire_daily_itemchartprice.py @@ -0,0 +1,107 @@ +""" +Created on 20250101 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년)[v1_국내주식-016] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice" + +def inquire_daily_itemchartprice( + env_dv: str, # 실전모의구분 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_input_date_1: str, # 입력 날짜 1 + fid_input_date_2: str, # 입력 날짜 2 + fid_period_div_code: str, # 기간분류코드 + fid_org_adj_prc: str # 수정주가 원주가 가격 여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식기간별시세(일/주/월/년) API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_input_date_1 (str): [필수] 입력 날짜 1 (ex. 조회 시작일자) + fid_input_date_2 (str): [필수] 입력 날짜 2 (ex. 조회 종료일자 (최대 100개)) + fid_period_div_code (str): [필수] 기간분류코드 (ex. D:일봉 W:주봉, M:월봉, Y:년봉) + fid_org_adj_prc (str): [필수] 수정주가 원주가 가격 여부 (ex. 0:수정주가 1:원주가) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_daily_itemchartprice("real", "J", "005930", "20220101", "20220809", "D", "1") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자)')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '조회 시작일자')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '조회 종료일자 (최대 100개)')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D:일봉 W:주봉, M:월봉, Y:년봉')") + + if fid_org_adj_prc == "": + raise ValueError("fid_org_adj_prc is required (e.g. '0:수정주가 1:원주가')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHKST03010100" + elif env_dv == "demo": + tr_id = "FHKST03010100" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_ORG_ADJ_PRC": fid_org_adj_prc + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object 타입이므로 DataFrame) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (array 타입이므로 DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return (output1_data, output2_data) + else: + res.printError(url=API_URL) + return (pd.DataFrame(), pd.DataFrame()) \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/chk_inquire_daily_overtimeprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/chk_inquire_daily_overtimeprice.py new file mode 100644 index 0000000..5e6e461 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/chk_inquire_daily_overtimeprice.py @@ -0,0 +1,115 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_overtimeprice import inquire_daily_overtimeprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가[v1_국내주식-026] +############################################################################################## + +COLUMN_MAPPING = { + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'ovtm_untp_tr_pbmn': '시간외 단일가 거래 대금', + 'ovtm_untp_mxpr': '시간외 단일가 상한가', + 'ovtm_untp_llam': '시간외 단일가 하한가', + 'ovtm_untp_oprc': '시간외 단일가 시가2', + 'ovtm_untp_hgpr': '시간외 단일가 최고가', + 'ovtm_untp_lwpr': '시간외 단일가 최저가', + 'ovtm_untp_antc_cnpr': '시간외 단일가 예상 체결가', + 'ovtm_untp_antc_cntg_vrss': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_vrss_sign': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_ctrt': '시간외 단일가 예상 체결 대비율', + 'ovtm_untp_antc_vol': '시간외 단일가 예상 거래량', + 'stck_bsop_date': '주식 영업 일자', + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'ovtm_untp_tr_pbmn': '시간외 단일가 거래대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 시간외일자별주가 조회 테스트 함수 + + 이 함수는 주식현재가 시간외일자별주가 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_daily_overtimeprice(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형 없음) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/inquire_daily_overtimeprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/inquire_daily_overtimeprice.py new file mode 100644 index 0000000..3456648 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_overtimeprice/inquire_daily_overtimeprice.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가[v1_국내주식-026] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice" + +def inquire_daily_overtimeprice( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str # [필수] 입력 종목코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 시간외일자별주가 API입니다. (최근일 30건만 조회 가능) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> result1, result2 = inquire_daily_overtimeprice("real", "J", "005930") + >>> print(result1) + >>> print(result2) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHPST02320000" + elif env_dv == "demo": + tr_id = "FHPST02320000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/chk_inquire_daily_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/chk_inquire_daily_price.py new file mode 100644 index 0000000..0033262 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/chk_inquire_daily_price.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_price import inquire_daily_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 일자별[v1_국내주식-010] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'stck_clpr': '주식 종가', + 'acml_vol': '누적 거래량', + 'prdy_vrss_vol_rate': '전일 대비 거래량 비율', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'hts_frgn_ehrt': 'HTS 외국인 소진율', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'flng_cls_code': '락 구분 코드', + 'acml_prtt_rate': '누적 분할 비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 일자별 조회 테스트 함수 + + 이 함수는 주식현재가 일자별 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_daily_price(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930", + fid_period_div_code="D", fid_org_adj_prc="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/inquire_daily_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/inquire_daily_price.py new file mode 100644 index 0000000..2e68aa7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_price/inquire_daily_price.py @@ -0,0 +1,91 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 일자별[v1_국내주식-010] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-daily-price" + +def inquire_daily_price( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_period_div_code: str, # [필수] 기간 분류 코드 (ex. D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월) + fid_org_adj_prc: str # [필수] 수정주가 원주가 가격 (ex. 0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격) +) -> pd.DataFrame: + """ + 주식현재가 일자별 API입니다. 일/주/월별 주가를 확인할 수 있으며 최근 30일(주,별)로 제한되어 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_period_div_code (str): [필수] 기간 분류 코드 (ex. D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월) + fid_org_adj_prc (str): [필수] 수정주가 원주가 가격 (ex. 0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격) + + Returns: + pd.DataFrame: 주식현재가 일자별 데이터 + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Example: + >>> df = inquire_daily_price("real", "J", "005930", "D", "1") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자)')") + + if fid_period_div_code == "" or fid_period_div_code is None: + raise ValueError("fid_period_div_code is required (e.g. 'D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월')") + + if fid_org_adj_prc == "" or fid_org_adj_prc is None: + raise ValueError("fid_org_adj_prc is required (e.g. '0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격')") + + # tr_id 설정 (실전/모의 모두 동일) + if env_dv == "real": + tr_id = "FHKST01010400" + elif env_dv == "demo": + tr_id = "FHKST01010400" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_ORG_ADJ_PRC": fid_org_adj_prc + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output은 array 자료형이므로 DataFrame으로 변환 + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/chk_inquire_daily_trade_volume.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/chk_inquire_daily_trade_volume.py new file mode 100644 index 0000000..2350b56 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/chk_inquire_daily_trade_volume.py @@ -0,0 +1,95 @@ +""" +Created on 20250126 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_trade_volume import inquire_daily_trade_volume + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별일별매수매도체결량 [v1_국내주식-056] +############################################################################################## + +COLUMN_MAPPING = { + 'shnu_cnqn_smtn': '매수 체결량 합계', + 'seln_cnqn_smtn': '매도 체결량 합계', + 'stck_bsop_date': '주식 영업 일자', + 'total_seln_qty': '총 매도 수량', + 'total_shnu_qty': '총 매수 수량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별일별매수매도체결량 조회 테스트 함수 + + 이 함수는 종목별일별매수매도체결량 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_daily_trade_volume( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_period_div_code="D" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시되지 않았으므로 없음) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시되지 않았으므로 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/inquire_daily_trade_volume.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/inquire_daily_trade_volume.py new file mode 100644 index 0000000..b82fa72 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_daily_trade_volume/inquire_daily_trade_volume.py @@ -0,0 +1,83 @@ +""" +Created on 20250126 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별일별매수매도체결량 [v1_국내주식-056] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-daily-trade-volume" + +def inquire_daily_trade_volume( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_period_div_code: str, # FID 기간 분류 코드 + fid_input_date_1: str = "", # FID 입력 날짜1 + fid_input_date_2: str = "" # FID 입력 날짜2 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 종목별일별매수매도체결량 API입니다. 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + 국내주식 종목의 일별 매수체결량, 매도체결량 데이터를 확인할 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 123456) + fid_period_div_code (str): [필수] FID 기간 분류 코드 (ex. D) + fid_input_date_1 (str): FID 입력 날짜1 + fid_input_date_2 (str): FID 입력 날짜2 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_daily_trade_volume("J", "005930", "D") + >>> print(df1) + >>> print(df2) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D')") + + tr_id = "FHKST03010800" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) - 단일 레코드 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) - 배열 데이터 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/chk_inquire_elw_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/chk_inquire_elw_price.py new file mode 100644 index 0000000..d7d118c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/chk_inquire_elw_price.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_elw_price import inquire_elw_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 > ELW 현재가 시세 [v1_국내주식-014] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'elw_prpr': 'ELW 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vrss_vol_rate': '전일 대비 거래량 비율', + 'unas_shrn_iscd': '기초자산 단축 종목코드', + 'unas_isnm': '기초자산 종목명', + 'unas_prpr': '기초자산 현재가', + 'unas_prdy_vrss': '기초자산 전일 대비', + 'unas_prdy_vrss_sign': '기초자산 전일 대비 부호', + 'unas_prdy_ctrt': '기초자산 전일 대비율', + 'bidp': '매수호가', + 'askp': '매도호가', + 'acml_tr_pbmn': '누적 거래 대금', + 'vol_tnrt': '거래량 회전율', + 'elw_oprc': 'ELW 시가2', + 'elw_hgpr': 'ELW 최고가', + 'elw_lwpr': 'ELW 최저가', + 'stck_prdy_clpr': '주식 전일 종가', + 'hts_thpr': 'HTS 이론가', + 'dprt': '괴리율', + 'atm_cls_name': 'ATM구분명', + 'hts_ints_vltl': 'HTS 내재 변동성', + 'acpr': '행사가', + 'pvt_scnd_dmrs_prc': '피벗 2차 디저항 가격', + 'pvt_frst_dmrs_prc': '피벗 1차 디저항 가격', + 'pvt_pont_val': '피벗 포인트 값', + 'pvt_frst_dmsp_prc': '피벗 1차 디지지 가격', + 'pvt_scnd_dmsp_prc': '피벗 2차 디지지 가격', + 'dmsp_val': '디지지 값', + 'dmrs_val': '디저항 값', + 'elw_sdpr': 'ELW 기준가', + 'apprch_rate': '접근도', + 'tick_conv_prc': '틱환산가', + 'invt_epmd_cntt': '투자 유의 내용' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] ELW시세 + ELW 현재가 시세[v1_국내주식-014] + + ELW 현재가 시세 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (W : ELW) + - fid_input_iscd (str): FID 입력 종목코드 (종목번호 (6자리)) + - env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의) + Returns: + - DataFrame: ELW 현재가 시세 결과 + + Example: + >>> df = inquire_elw_price(fid_cond_mrkt_div_code="W", fid_input_iscd="123456", env_dv="real") # 실전투자 + >>> df = inquire_elw_price(fid_cond_mrkt_div_code="W", fid_input_iscd="123456", env_dv="demo") # 모의투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + # API 호출 + result = inquire_elw_price( + fid_cond_mrkt_div_code="W", # FID 조건 시장 분류 코드 + fid_input_iscd="57LA50", # FID 입력 종목코드 + env_dv="real", # "real": 실전투자, "demo": 모의투자, #실전모의구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 현재가 시세 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/inquire_elw_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/inquire_elw_price.py new file mode 100644 index 0000000..5d9c32f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_elw_price/inquire_elw_price.py @@ -0,0 +1,133 @@ +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 > ELW 현재가 시세 [v1_국내주식-014] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-elw-price" + +def inquire_elw_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + env_dv: str = "real", # 실전모의구분 (real:실전, demo:모의) + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 현재가 시세[v1_국내주식-014] + ELW 현재가 시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (예: 'W') + fid_input_iscd (str): FID 입력 종목코드 (예: '000660') + env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real') + tr_cont (str): 연속 거래 여부 (기본값: '') + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 현재가 시세 데이터 + + Example: + >>> df = inquire_elw_price('W', '000660', env_dv='real') # 실전투자 + >>> df = inquire_elw_price('W', '000660', env_dv='demo') # 모의투자 + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # env_dv 파라미터 검증 (모의투자 지원 로직) + if env_dv not in ["real", "demo"]: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 설정 + + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKEW15010000" # 실전투자용 TR ID + + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_elw_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + env_dv, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/chk_inquire_index_category_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/chk_inquire_index_category_price.py new file mode 100644 index 0000000..9ca06c4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/chk_inquire_index_category_price.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_index_category_price import inquire_index_category_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 구분별전체시세[v1_국내주식-066] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'prdy_vol': '전일 거래량', + 'ascn_issu_cnt': '상승 종목 수', + 'down_issu_cnt': '하락 종목 수', + 'stnr_issu_cnt': '보합 종목 수', + 'uplm_issu_cnt': '상한 종목 수', + 'lslm_issu_cnt': '하한 종목 수', + 'prdy_tr_pbmn': '전일 거래 대금', + 'dryy_bstp_nmix_hgpr_date': '연중업종지수최고가일자', + 'dryy_bstp_nmix_hgpr': '연중업종지수최고가', + 'dryy_bstp_nmix_lwpr': '연중업종지수최저가', + 'dryy_bstp_nmix_lwpr_date': '연중업종지수최저가일자', + 'bstp_cls_code': '업종 구분 코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'acml_vol_rlim': '누적 거래량 비중', + 'acml_tr_pbmn_rlim': '누적 거래 대금 비중' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내업종 구분별전체시세[v1_국내주식-066] + + 국내업종 구분별전체시세 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (시장구분코드 (업종 U)) + - fid_input_iscd (str): FID 입력 종목코드 (코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)) + - fid_cond_scr_div_code (str): FID 조건 화면 분류 코드 (Unique key( 20214 )) + - fid_mrkt_cls_code (str): FID 시장 구분 코드 (시장구분코드(K:거래소, Q:코스닥, K2:코스피200)) + - fid_blng_cls_code (str): FID 소속 구분 코드 (시장구분코드에 따라 아래와 같이 입력 시장구분코드(K:거래소) 0:전업종, 1:기타구분, 2:자본금구분 3:상업별구분 시장구분코드(Q:코스닥) 0:전업종, 1:기타구분, 2:벤처구분 3:일반구분 시장구분코드(K2:코스닥) 0:전업종) + + Returns: + - Tuple[DataFrame, ...]: 국내업종 구분별전체시세 결과 + + Example: + >>> df1, df2 = inquire_index_category_price(fid_cond_mrkt_div_code="U", fid_input_iscd="0001", fid_cond_scr_div_code="20214", fid_mrkt_cls_code="K", fid_blng_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = inquire_index_category_price( + fid_cond_mrkt_div_code="U", # FID 조건 시장 분류 코드 + fid_input_iscd="0001", # FID 입력 종목코드 + fid_cond_scr_div_code="20214", # FID 조건 화면 분류 코드 + fid_mrkt_cls_code="K", # FID 시장 구분 코드 + fid_blng_cls_code="0", # FID 소속 구분 코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/inquire_index_category_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/inquire_index_category_price.py new file mode 100644 index 0000000..41c2355 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_category_price/inquire_index_category_price.py @@ -0,0 +1,153 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 구분별전체시세[v1_국내주식-066] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-index-category-price" + +def inquire_index_category_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_cond_scr_div_code: str, # FID 조건 화면 분류 코드 + fid_mrkt_cls_code: str, # FID 시장 구분 코드 + fid_blng_cls_code: str, # FID 소속 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 구분별전체시세[v1_국내주식-066] + 국내업종 구분별전체시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_cond_scr_div_code (str): Unique key( 20214 ) + fid_mrkt_cls_code (str): 시장구분코드(K:거래소, Q:코스닥, K2:코스피200) + fid_blng_cls_code (str): 시장구분코드에 따라 아래와 같이 입력 시장구분코드(K:거래소) 0:전업종, 1:기타구분, 2:자본금구분 3:상업별구분 시장구분코드(Q:코스닥) 0:전업종, 1:기타구분, 2:벤처구분 3:일반구분 시장구분코드(K2:코스닥) 0:전업종 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내업종 구분별전체시세 데이터 + + Example: + >>> df1, df2 = inquire_index_category_price( + ... fid_cond_mrkt_div_code='U', + ... fid_input_iscd='0001', + ... fid_cond_scr_div_code='20214', + ... fid_mrkt_cls_code='K', + ... fid_blng_cls_code='0' + ... ) + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20214')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20214')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'K')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'K')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHPUP02140000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_category_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_blng_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/chk_inquire_index_daily_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/chk_inquire_index_daily_price.py new file mode 100644 index 0000000..ff819bd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/chk_inquire_index_daily_price.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_index_daily_price import inquire_index_daily_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 일자별지수 [v1_국내주식-065] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'prdy_vol': '전일 거래량', + 'ascn_issu_cnt': '상승 종목 수', + 'down_issu_cnt': '하락 종목 수', + 'stnr_issu_cnt': '보합 종목 수', + 'uplm_issu_cnt': '상한 종목 수', + 'lslm_issu_cnt': '하한 종목 수', + 'prdy_tr_pbmn': '전일 거래 대금', + 'dryy_bstp_nmix_hgpr_date': '연중업종지수최고가일자', + 'dryy_bstp_nmix_hgpr': '연중업종지수최고가', + 'dryy_bstp_nmix_lwpr': '연중업종지수최저가', + 'dryy_bstp_nmix_lwpr_date': '연중업종지수최저가일자', + 'stck_bsop_date': '주식 영업 일자', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'acml_vol_rlim': '누적 거래량 비중', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'invt_new_psdg': '투자 신 심리도', + 'd20_dsrt': '20일 이격도' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내업종 일자별지수[v1_국내주식-065] + + 국내업종 일자별지수 테스트 함수 + + Parameters: + - fid_period_div_code (str): FID 기간 분류 코드 (일/주/월 구분코드 ( D:일별 , W:주별, M:월별 )) + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (시장구분코드 (업종 U)) + - fid_input_iscd (str): FID 입력 종목코드 (코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)) + - fid_input_date_1 (str): FID 입력 날짜1 (입력 날짜(ex. 20240223)) + + Returns: + - Tuple[DataFrame, ...]: 국내업종 일자별지수 결과 + + Example: + >>> df1, df2 = inquire_index_daily_price(fid_period_div_code="D", fid_cond_mrkt_div_code="U", fid_input_iscd="0001", fid_input_date_1="20250101") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = inquire_index_daily_price( + fid_period_div_code="D", # FID 기간 분류 코드 + fid_cond_mrkt_div_code="U", # FID 조건 시장 분류 코드 + fid_input_iscd="0001", # FID 입력 종목코드 + fid_input_date_1="20250101", # FID 입력 날짜1 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/inquire_index_daily_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/inquire_index_daily_price.py new file mode 100644 index 0000000..c9fdebb --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_daily_price/inquire_index_daily_price.py @@ -0,0 +1,134 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 일자별지수 [v1_국내주식-065] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-index-daily-price" + +def inquire_index_daily_price( + fid_period_div_code: str, # FID 기간 분류 코드 + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_date_1: str, # FID 입력 날짜1 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 일자별지수[v1_국내주식-065] + 국내업종 일자별지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_period_div_code (str): 일/주/월 구분코드 ( D:일별 , W:주별, M:월별 ) + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_input_date_1 (str): 입력 날짜(ex. 20240223) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내업종 일자별지수 데이터 + + Example: + >>> df1, df2 = inquire_index_daily_price('D', 'U', '0001', '20240223') + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240223')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240223')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHPUP02120000" + + params = { + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_daily_price( + fid_period_div_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/chk_inquire_index_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/chk_inquire_index_price.py new file mode 100644 index 0000000..7966c02 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/chk_inquire_index_price.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_index_price import inquire_index_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 현재지수 [v1_국내주식-063] +############################################################################################## + +COLUMN_MAPPING = { + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'prdy_tr_pbmn': '전일 거래 대금', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'prdy_nmix_vrss_nmix_oprc': '전일 지수 대비 지수 시가2', + 'oprc_vrss_prpr_sign': '시가2 대비 현재가 부호', + 'bstp_nmix_oprc_prdy_ctrt': '업종 지수 시가2 전일 대비율', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'prdy_nmix_vrss_nmix_hgpr': '전일 지수 대비 지수 최고가', + 'hgpr_vrss_prpr_sign': '최고가 대비 현재가 부호', + 'bstp_nmix_hgpr_prdy_ctrt': '업종 지수 최고가 전일 대비율', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'prdy_clpr_vrss_lwpr': '전일 종가 대비 최저가', + 'lwpr_vrss_prpr_sign': '최저가 대비 현재가 부호', + 'prdy_clpr_vrss_lwpr_rate': '전일 종가 대비 최저가 비율', + 'ascn_issu_cnt': '상승 종목 수', + 'uplm_issu_cnt': '상한 종목 수', + 'stnr_issu_cnt': '보합 종목 수', + 'down_issu_cnt': '하락 종목 수', + 'lslm_issu_cnt': '하한 종목 수', + 'dryy_bstp_nmix_hgpr': '연중업종지수최고가', + 'dryy_hgpr_vrss_prpr_rate': '연중 최고가 대비 현재가 비율', + 'dryy_bstp_nmix_hgpr_date': '연중업종지수최고가일자', + 'dryy_bstp_nmix_lwpr': '연중업종지수최저가', + 'dryy_lwpr_vrss_prpr_rate': '연중 최저가 대비 현재가 비율', + 'dryy_bstp_nmix_lwpr_date': '연중업종지수최저가일자', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'seln_rsqn_rate': '매도 잔량 비율', + 'shnu_rsqn_rate': '매수2 잔량 비율', + 'ntby_rsqn': '순매수 잔량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내업종 현재지수[v1_국내주식-063] + + 국내업종 현재지수 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (업종(U)) + - fid_input_iscd (str): FID 입력 종목코드 (코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)) + Returns: + - DataFrame: 국내업종 현재지수 결과 + + Example: + >>> df = inquire_index_price(fid_cond_mrkt_div_code="U", fid_input_iscd="0001") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = inquire_index_price( + fid_cond_mrkt_div_code="U", # FID 조건 시장 분류 코드 + fid_input_iscd="0001", # FID 입력 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내업종 현재지수 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/inquire_index_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/inquire_index_price.py new file mode 100644 index 0000000..8301317 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_price/inquire_index_price.py @@ -0,0 +1,117 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 현재지수 [v1_국내주식-063] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-index-price" + +def inquire_index_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 현재지수[v1_국내주식-063] + 국내업종 현재지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 업종(U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 현재지수 데이터 + + Example: + >>> df = inquire_index_price("U", "0001") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + tr_id = "FHPUP02100000" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/chk_inquire_index_tickprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/chk_inquire_index_tickprice.py new file mode 100644 index 0000000..cba6048 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/chk_inquire_index_tickprice.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_index_tickprice import inquire_index_tickprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(초)[국내주식-064] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식 체결 시간', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_tr_pbmn': '누적 거래 대금', + 'acml_vol': '누적 거래량', + 'cntg_vol': '체결 거래량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(초)[국내주식-064] + + 국내업종 시간별지수(초) 테스트 함수 + + Parameters: + - fid_input_iscd (str): 입력 종목코드 (0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150) + - fid_cond_mrkt_div_code (str): 시장 분류 코드 (시장구분코드 (업종 U)) + Returns: + - DataFrame: 국내업종 시간별지수(초) 결과 + + Example: + >>> df = inquire_index_tickprice(fid_input_iscd="0001", fid_cond_mrkt_div_code="U") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = inquire_index_tickprice( + fid_input_iscd="0001", # 입력 종목코드 + fid_cond_mrkt_div_code="U", # 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내업종 시간별지수(초) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/inquire_index_tickprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/inquire_index_tickprice.py new file mode 100644 index 0000000..e8fba43 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_tickprice/inquire_index_tickprice.py @@ -0,0 +1,114 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(초)[국내주식-064] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-index-tickprice" + +def inquire_index_tickprice( + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(초)[국내주식-064] + 국내업종 시간별지수(초) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 시간별지수(초) 데이터 + + Example: + >>> df = inquire_index_tickprice('0001', 'U') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPUP02110100" + + params = { + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_tickprice( + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/chk_inquire_index_timeprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/chk_inquire_index_timeprice.py new file mode 100644 index 0000000..0b65930 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/chk_inquire_index_timeprice.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_index_timeprice import inquire_index_timeprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(분)[국내주식-119] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_hour': '영업 시간', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'acml_tr_pbmn': '누적 거래 대금', + 'acml_vol': '누적 거래량', + 'cntg_vol': '체결 거래량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(분)[국내주식-119] + + 국내업종 시간별지수(분) 테스트 함수 + + Parameters: + - fid_input_hour_1 (str): ?입력 시간1 (초단위, 60(1분), 300(5분), 600(10분)) + - fid_input_iscd (str): 입력 종목코드 (0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (업종 U)) + Returns: + - DataFrame: 국내업종 시간별지수(분) 결과 + + Example: + >>> df = inquire_index_timeprice(fid_input_hour_1="60", fid_input_iscd="0001", fid_cond_mrkt_div_code="U") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = inquire_index_timeprice( + fid_input_hour_1="60", # ?입력 시간1 + fid_input_iscd="0001", # 입력 종목코드 + fid_cond_mrkt_div_code="U", # 조건 시장 분류 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내업종 시간별지수(분) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/inquire_index_timeprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/inquire_index_timeprice.py new file mode 100644 index 0000000..f43eb5d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_index_timeprice/inquire_index_timeprice.py @@ -0,0 +1,118 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(분)[국내주식-119] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-index-timeprice" + +def inquire_index_timeprice( + fid_input_hour_1: str, # ?입력 시간1 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(분)[국내주식-119] + 국내업종 시간별지수(분) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_hour_1 (str): 초단위, 60(1분), 300(5분), 600(10분) + fid_input_iscd (str): 0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 시간별지수(분) 데이터 + + Example: + >>> df = inquire_index_timeprice("60", "0001", "U") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_input_hour_1: + logger.error("fid_input_hour_1 is required. (e.g. '60')") + raise ValueError("fid_input_hour_1 is required. (e.g. '60')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPUP02110200" + + params = { + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_timeprice( + fid_input_hour_1, + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/chk_inquire_investor.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/chk_inquire_investor.py new file mode 100644 index 0000000..aa4baa5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/chk_inquire_investor.py @@ -0,0 +1,89 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_investor import inquire_investor + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 투자자[v1_국내주식-012] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prsn_ntby_qty': '개인 순매수 수량', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'orgn_ntby_qty': '기관계 순매수 수량', + 'prsn_ntby_tr_pbmn': '개인 순매수 거래 대금', + 'frgn_ntby_tr_pbmn': '외국인 순매수 거래 대금', + 'orgn_ntby_tr_pbmn': '기관계 순매수 거래 대금', + 'prsn_shnu_vol': '개인 매수2 거래량', + 'frgn_shnu_vol': '외국인 매수2 거래량', + 'orgn_shnu_vol': '기관계 매수2 거래량', + 'prsn_shnu_tr_pbmn': '개인 매수2 거래 대금', + 'frgn_shnu_tr_pbmn': '외국인 매수2 거래 대금', + 'orgn_shnu_tr_pbmn': '기관계 매수2 거래 대금', + 'prsn_seln_vol': '개인 매도 거래량', + 'frgn_seln_vol': '외국인 매도 거래량', + 'orgn_seln_vol': '기관계 매도 거래량', + 'prsn_seln_tr_pbmn': '개인 매도 거래 대금', + 'frgn_seln_tr_pbmn': '외국인 매도 거래 대금', + 'orgn_seln_tr_pbmn': '기관계 매도 거래 대금' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 주식현재가 투자자 조회 테스트 함수 + + 이 함수는 주식현재가 투자자 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_investor(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 자료형이 명시되지 않았으므로 NUMERIC_COLUMNS는 빈 리스트) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/inquire_investor.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/inquire_investor.py new file mode 100644 index 0000000..3175593 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor/inquire_investor.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 투자자[v1_국내주식-012] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-investor" + +def inquire_investor( + env_dv: str, # [필수] 실전모의구분 + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 + fid_input_iscd: str # [필수] 입력 종목코드 +) -> pd.DataFrame: + """ + 주식현재가 투자자 API입니다. 개인, 외국인, 기관 등 투자 정보를 확인할 수 있습니다. + + [유의사항] + - 외국인은 외국인(외국인투자등록 고유번호가 있는 경우)+기타 외국인을 지칭합니다. + - 당일 데이터는 장 종료 후 제공됩니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 투자자 데이터 + + Example: + >>> df = inquire_investor(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010900" + elif env_dv == "demo": + tr_id = "FHKST01010900" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/chk_inquire_investor_daily_by_market.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/chk_inquire_investor_daily_by_market.py new file mode 100644 index 0000000..ae45e8b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/chk_inquire_investor_daily_by_market.py @@ -0,0 +1,115 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_investor_daily_by_market import inquire_investor_daily_by_market + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(일별) [국내주식-075] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'stck_prdy_clpr': '주식 전일 종가', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'frgn_reg_ntby_qty': '외국인 등록 순매수 수량', + 'frgn_nreg_ntby_qty': '외국인 비등록 순매수 수량', + 'prsn_ntby_qty': '개인 순매수 수량', + 'orgn_ntby_qty': '기관계 순매수 수량', + 'scrt_ntby_qty': '증권 순매수 수량', + 'ivtr_ntby_qty': '투자신탁 순매수 수량', + 'pe_fund_ntby_vol': '사모 펀드 순매수 거래량', + 'bank_ntby_qty': '은행 순매수 수량', + 'insu_ntby_qty': '보험 순매수 수량', + 'mrbn_ntby_qty': '종금 순매수 수량', + 'fund_ntby_qty': '기금 순매수 수량', + 'etc_ntby_qty': '기타 순매수 수량', + 'etc_orgt_ntby_vol': '기타 단체 순매수 거래량', + 'etc_corp_ntby_vol': '기타 법인 순매수 거래량', + 'frgn_ntby_tr_pbmn': '외국인 순매수 거래 대금', + 'frgn_reg_ntby_pbmn': '외국인 등록 순매수 대금', + 'frgn_nreg_ntby_pbmn': '외국인 비등록 순매수 대금', + 'prsn_ntby_tr_pbmn': '개인 순매수 거래 대금', + 'orgn_ntby_tr_pbmn': '기관계 순매수 거래 대금', + 'scrt_ntby_tr_pbmn': '증권 순매수 거래 대금', + 'ivtr_ntby_tr_pbmn': '투자신탁 순매수 거래 대금', + 'pe_fund_ntby_tr_pbmn': '사모 펀드 순매수 거래 대금', + 'bank_ntby_tr_pbmn': '은행 순매수 거래 대금', + 'insu_ntby_tr_pbmn': '보험 순매수 거래 대금', + 'mrbn_ntby_tr_pbmn': '종금 순매수 거래 대금', + 'fund_ntby_tr_pbmn': '기금 순매수 거래 대금', + 'etc_ntby_tr_pbmn': '기타 순매수 거래 대금', + 'etc_orgt_ntby_tr_pbmn': '기타 단체 순매수 거래 대금', + 'etc_corp_ntby_tr_pbmn': '기타 법인 순매수 거래 대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 시장별 투자자매매동향(일별) 조회 테스트 함수 + + 이 함수는 시장별 투자자매매동향(일별) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 업종 코드 0001, 날짜 20240517, 코스피 시장을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_investor_daily_by_market( + fid_cond_mrkt_div_code="U", + fid_input_iscd="0001", + fid_input_date_1="20250701", + fid_input_iscd_1="KSP", + fid_input_date_2="20250701", + fid_input_iscd_2="0001", + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 자료형이 number로 명시된 필드가 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/inquire_investor_daily_by_market.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/inquire_investor_daily_by_market.py new file mode 100644 index 0000000..32cf00f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_daily_by_market/inquire_investor_daily_by_market.py @@ -0,0 +1,90 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(일별) [국내주식-075] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-investor-daily-by-market" + + +def inquire_investor_daily_by_market( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. U:업종) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 0001) + fid_input_date_1: str, # [필수] 입력 날짜1 (ex. 20250701) + fid_input_iscd_1: str, # [필수] 입력 종목코드 (ex. KSP:코스피, KSQ:코스닥) + fid_input_date_2: str, # [필수] 입력 날짜1과 동일날짜 입력 + fid_input_iscd_2: str, # [필수] 입력 종목코드 (ex. 업종분류코드) + +) -> pd.DataFrame: + """ + 시장별 투자자매매동향(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0404] 시장별 일별동향 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. U:업종) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0001) + fid_input_date_1 (str): [필수] 입력 날짜1 (ex. 20250701) + fid_input_iscd_1 (str): [필수] 입력 종목코드 (ex. KSP:코스피, KSQ:코스닥) + fid_input_date_2 (str): [필수] 입력 날짜1과 동일날짜 입력 + fid_input_iscd_2 (str): [필수] 입력 종목코드 (ex. 업종분류코드) + + Returns: + pd.DataFrame: 시장별 투자자매매동향(일별) 데이터 + + Example: + >>> df = inquire_investor_daily_by_market("U", "0001", "20250701", "KSP", "20250701", "0001") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'U')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0001')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20250701')") + + if fid_input_iscd_1 == "": + raise ValueError("fid_input_iscd_1 is required (e.g. 'KSP')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20250701')") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required (e.g. 업종분류코드')") + + tr_id = "FHPTJ04040000" # 시장별 투자자매매동향(일별) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_INPUT_DATE_1": fid_input_date_1, # 입력 날짜1 + "FID_INPUT_ISCD_1": fid_input_iscd_1, # 입력 종목코드 + "FID_INPUT_DATE_2": fid_input_date_2, # 입력 날짜2 + "FID_INPUT_ISCD_2": fid_input_iscd_2, # 입력 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/chk_inquire_investor_time_by_market.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/chk_inquire_investor_time_by_market.py new file mode 100644 index 0000000..99c2b5b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/chk_inquire_investor_time_by_market.py @@ -0,0 +1,140 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_investor_time_by_market import inquire_investor_time_by_market + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(시세)[v1_국내주식-074] +############################################################################################## + +COLUMN_MAPPING = { + 'frgn_seln_vol': '외국인 매도 거래량', + 'frgn_shnu_vol': '외국인 매수2 거래량', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'frgn_seln_tr_pbmn': '외국인 매도 거래 대금', + 'frgn_shnu_tr_pbmn': '외국인 매수2 거래 대금', + 'frgn_ntby_tr_pbmn': '외국인 순매수 거래 대금', + 'prsn_seln_vol': '개인 매도 거래량', + 'prsn_shnu_vol': '개인 매수2 거래량', + 'prsn_ntby_qty': '개인 순매수 수량', + 'prsn_seln_tr_pbmn': '개인 매도 거래 대금', + 'prsn_shnu_tr_pbmn': '개인 매수2 거래 대금', + 'prsn_ntby_tr_pbmn': '개인 순매수 거래 대금', + 'orgn_seln_vol': '기관계 매도 거래량', + 'orgn_shnu_vol': '기관계 매수2 거래량', + 'orgn_ntby_qty': '기관계 순매수 수량', + 'orgn_seln_tr_pbmn': '기관계 매도 거래 대금', + 'orgn_shnu_tr_pbmn': '기관계 매수2 거래 대금', + 'orgn_ntby_tr_pbmn': '기관계 순매수 거래 대금', + 'scrt_seln_vol': '증권 매도 거래량', + 'scrt_shnu_vol': '증권 매수2 거래량', + 'scrt_ntby_qty': '증권 순매수 수량', + 'scrt_seln_tr_pbmn': '증권 매도 거래 대금', + 'scrt_shnu_tr_pbmn': '증권 매수2 거래 대금', + 'scrt_ntby_tr_pbmn': '증권 순매수 거래 대금', + 'ivtr_seln_vol': '투자신탁 매도 거래량', + 'ivtr_shnu_vol': '투자신탁 매수2 거래량', + 'ivtr_ntby_qty': '투자신탁 순매수 수량', + 'ivtr_seln_tr_pbmn': '투자신탁 매도 거래 대금', + 'ivtr_shnu_tr_pbmn': '투자신탁 매수2 거래 대금', + 'ivtr_ntby_tr_pbmn': '투자신탁 순매수 거래 대금', + 'pe_fund_seln_tr_pbmn': '사모 펀드 매도 거래 대금', + 'pe_fund_seln_vol': '사모 펀드 매도 거래량', + 'pe_fund_ntby_vol': '사모 펀드 순매수 거래량', + 'pe_fund_shnu_tr_pbmn': '사모 펀드 매수2 거래 대금', + 'pe_fund_shnu_vol': '사모 펀드 매수2 거래량', + 'pe_fund_ntby_tr_pbmn': '사모 펀드 순매수 거래 대금', + 'bank_seln_vol': '은행 매도 거래량', + 'bank_shnu_vol': '은행 매수2 거래량', + 'bank_ntby_qty': '은행 순매수 수량', + 'bank_seln_tr_pbmn': '은행 매도 거래 대금', + 'bank_shnu_tr_pbmn': '은행 매수2 거래 대금', + 'bank_ntby_tr_pbmn': '은행 순매수 거래 대금', + 'insu_seln_vol': '보험 매도 거래량', + 'insu_shnu_vol': '보험 매수2 거래량', + 'insu_ntby_qty': '보험 순매수 수량', + 'insu_seln_tr_pbmn': '보험 매도 거래 대금', + 'insu_shnu_tr_pbmn': '보험 매수2 거래 대금', + 'insu_ntby_tr_pbmn': '보험 순매수 거래 대금', + 'mrbn_seln_vol': '종금 매도 거래량', + 'mrbn_shnu_vol': '종금 매수2 거래량', + 'mrbn_ntby_qty': '종금 순매수 수량', + 'mrbn_seln_tr_pbmn': '종금 매도 거래 대금', + 'mrbn_shnu_tr_pbmn': '종금 매수2 거래 대금', + 'mrbn_ntby_tr_pbmn': '종금 순매수 거래 대금', + 'fund_seln_vol': '기금 매도 거래량', + 'fund_shnu_vol': '기금 매수2 거래량', + 'fund_ntby_qty': '기금 순매수 수량', + 'fund_seln_tr_pbmn': '기금 매도 거래 대금', + 'fund_shnu_tr_pbmn': '기금 매수2 거래 대금', + 'fund_ntby_tr_pbmn': '기금 순매수 거래 대금', + 'etc_orgt_seln_vol': '기타 단체 매도 거래량', + 'etc_orgt_shnu_vol': '기타 단체 매수2 거래량', + 'etc_orgt_ntby_vol': '기타 단체 순매수 거래량', + 'etc_orgt_seln_tr_pbmn': '기타 단체 매도 거래 대금', + 'etc_orgt_shnu_tr_pbmn': '기타 단체 매수2 거래 대금', + 'etc_orgt_ntby_tr_pbmn': '기타 단체 순매수 거래 대금', + 'etc_corp_seln_vol': '기타 법인 매도 거래량', + 'etc_corp_shnu_vol': '기타 법인 매수2 거래량', + 'etc_corp_ntby_vol': '기타 법인 순매수 거래량', + 'etc_corp_seln_tr_pbmn': '기타 법인 매도 거래 대금', + 'etc_corp_shnu_tr_pbmn': '기타 법인 매수2 거래 대금', + 'etc_corp_ntby_tr_pbmn': '기타 법인 순매수 거래 대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 시장별 투자자매매동향(시세) 조회 테스트 함수 + + 이 함수는 시장별 투자자매매동향(시세) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_investor_time_by_market(fid_input_iscd="999", fid_input_iscd_2="S001") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드가 없으므로 빈 리스트) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/inquire_investor_time_by_market.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/inquire_investor_time_by_market.py new file mode 100644 index 0000000..a894eed --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_investor_time_by_market/inquire_investor_time_by_market.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(시세)[v1_국내주식-074] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-investor-time-by-market" + +def inquire_investor_time_by_market( + fid_input_iscd: str, # [필수] 시장구분 + fid_input_iscd_2: str # [필수] 업종구분 +) -> pd.DataFrame: + """ + 시장별 투자자매매동향(시세성) API입니다. + 한국투자 HTS(eFriend Plus) > [0403] 시장별 시간동향 의 상단 표 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_input_iscd (str): [필수] 시장구분 + fid_input_iscd_2 (str): [필수] 업종구분 + + Returns: + pd.DataFrame: 시장별 투자자매매동향 데이터 + + Example: + >>> df = inquire_investor_time_by_market(fid_input_iscd="999", fid_input_iscd_2="S001") + >>> print(df) + """ + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required") + + tr_id = "FHPTJ04030000" + + params = { + "FID_INPUT_ISCD": fid_input_iscd, # 시장구분 + "FID_INPUT_ISCD_2": fid_input_iscd_2 # 업종구분 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/chk_inquire_member.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/chk_inquire_member.py new file mode 100644 index 0000000..c5a9a59 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/chk_inquire_member.py @@ -0,0 +1,136 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_member import inquire_member + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 회원사[v1_국내주식-013] +############################################################################################## + +COLUMN_MAPPING = { + 'seln_mbcr_no1': '매도 회원사 번호1', + 'seln_mbcr_no2': '매도 회원사 번호2', + 'seln_mbcr_no3': '매도 회원사 번호3', + 'seln_mbcr_no4': '매도 회원사 번호4', + 'seln_mbcr_no5': '매도 회원사 번호5', + 'seln_mbcr_name1': '매도 회원사 명1', + 'seln_mbcr_name2': '매도 회원사 명2', + 'seln_mbcr_name3': '매도 회원사 명3', + 'seln_mbcr_name4': '매도 회원사 명4', + 'seln_mbcr_name5': '매도 회원사 명5', + 'total_seln_qty1': '총 매도 수량1', + 'total_seln_qty2': '총 매도 수량2', + 'total_seln_qty3': '총 매도 수량3', + 'total_seln_qty4': '총 매도 수량4', + 'total_seln_qty5': '총 매도 수량5', + 'seln_mbcr_rlim1': '매도 회원사 비중1', + 'seln_mbcr_rlim2': '매도 회원사 비중2', + 'seln_mbcr_rlim3': '매도 회원사 비중3', + 'seln_mbcr_rlim4': '매도 회원사 비중4', + 'seln_mbcr_rlim5': '매도 회원사 비중5', + 'seln_qty_icdc1': '매도 수량 증감1', + 'seln_qty_icdc2': '매도 수량 증감2', + 'seln_qty_icdc3': '매도 수량 증감3', + 'seln_qty_icdc4': '매도 수량 증감4', + 'seln_qty_icdc5': '매도 수량 증감5', + 'shnu_mbcr_no1': '매수2 회원사 번호1', + 'shnu_mbcr_no2': '매수2 회원사 번호2', + 'shnu_mbcr_no3': '매수2 회원사 번호3', + 'shnu_mbcr_no4': '매수2 회원사 번호4', + 'shnu_mbcr_no5': '매수2 회원사 번호5', + 'shnu_mbcr_name1': '매수2 회원사 명1', + 'shnu_mbcr_name2': '매수2 회원사 명2', + 'shnu_mbcr_name3': '매수2 회원사 명3', + 'shnu_mbcr_name4': '매수2 회원사 명4', + 'shnu_mbcr_name5': '매수2 회원사 명5', + 'total_shnu_qty1': '총 매수2 수량1', + 'total_shnu_qty2': '총 매수2 수량2', + 'total_shnu_qty3': '총 매수2 수량3', + 'total_shnu_qty4': '총 매수2 수량4', + 'total_shnu_qty5': '총 매수2 수량5', + 'shnu_mbcr_rlim1': '매수2 회원사 비중1', + 'shnu_mbcr_rlim2': '매수2 회원사 비중2', + 'shnu_mbcr_rlim3': '매수2 회원사 비중3', + 'shnu_mbcr_rlim4': '매수2 회원사 비중4', + 'shnu_mbcr_rlim5': '매수2 회원사 비중5', + 'shnu_qty_icdc1': '매수2 수량 증감1', + 'shnu_qty_icdc2': '매수2 수량 증감2', + 'shnu_qty_icdc3': '매수2 수량 증감3', + 'shnu_qty_icdc4': '매수2 수량 증감4', + 'shnu_qty_icdc5': '매수2 수량 증감5', + 'glob_total_seln_qty': '외국계 총 매도 수량', + 'glob_seln_rlim': '외국계 매도 비중', + 'glob_ntby_qty': '외국계 순매수 수량', + 'glob_total_shnu_qty': '외국계 총 매수2 수량', + 'glob_shnu_rlim': '외국계 매수2 비중', + 'seln_mbcr_glob_yn_1': '매도 회원사 외국계 여부1', + 'seln_mbcr_glob_yn_2': '매도 회원사 외국계 여부2', + 'seln_mbcr_glob_yn_3': '매도 회원사 외국계 여부3', + 'seln_mbcr_glob_yn_4': '매도 회원사 외국계 여부4', + 'seln_mbcr_glob_yn_5': '매도 회원사 외국계 여부5', + 'shnu_mbcr_glob_yn_1': '매수2 회원사 외국계 여부1', + 'shnu_mbcr_glob_yn_2': '매수2 회원사 외국계 여부2', + 'shnu_mbcr_glob_yn_3': '매수2 회원사 외국계 여부3', + 'shnu_mbcr_glob_yn_4': '매수2 회원사 외국계 여부4', + 'shnu_mbcr_glob_yn_5': '매수2 회원사 외국계 여부5', + 'glob_total_seln_qty_icdc': '외국계 총 매도 수량 증감', + 'glob_total_shnu_qty_icdc': '외국계 총 매수2 수량 증감' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 회원사 조회 테스트 함수 + + 이 함수는 주식현재가 회원사 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_member(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/inquire_member.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/inquire_member.py new file mode 100644 index 0000000..ac77f1a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member/inquire_member.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 회원사[v1_국내주식-013] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-member" + +def inquire_member( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 주식 현재가 회원사 API입니다. 회원사의 투자 정보를 확인할 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 회원사 데이터 + + Example: + >>> df = inquire_member(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010600" + elif env_dv == "demo": + tr_id = "FHKST01010600" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/chk_inquire_member_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/chk_inquire_member_daily.py new file mode 100644 index 0000000..39aa5aa --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/chk_inquire_member_daily.py @@ -0,0 +1,83 @@ +""" +Created on 20250101 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_member_daily import inquire_member_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 주식현재가 회원사 종목매매동향 [국내주식-197] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'total_seln_qty': '총매도수량', + 'total_shnu_qty': '총매수2수량', + 'ntby_qty': '순매수수량', + 'stck_prpr': '주식현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 회원사 종목매매동향 조회 테스트 함수 + + 이 함수는 주식현재가 회원사 종목매매동향 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_member_daily( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_iscd_2="00003", + fid_input_date_1="20240501", + fid_input_date_2="20240624" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/inquire_member_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/inquire_member_daily.py new file mode 100644 index 0000000..073b8d3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_member_daily/inquire_member_daily.py @@ -0,0 +1,92 @@ +""" +Created on 20250101 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 주식현재가 회원사 종목매매동향 [국내주식-197] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-member-daily" + +def inquire_member_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. 주식J) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456) + fid_input_iscd_2: str, # [필수] 회원사코드 (ex. 회원사코드 FAQ 종목정보 다운로드(국내) > 회원사 참조) + fid_input_date_1: str, # [필수] 입력날짜1 + fid_input_date_2: str, # [필수] 입력날짜2 + fid_sctn_cls_code: str = "" # 데이터 순위 (초기값: "") +) -> pd.DataFrame: + """ + 주식현재가 회원사 종목매매동향 API입니다. + 한국투자 HTS(eFriend Plus) > [0454] 증권사 종목매매동향 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (J:KRX, NX:NXT) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_input_iscd_2 (str): [필수] 회원사코드 (ex. 회원사코드 FAQ 종목정보 다운로드(국내) > 회원사 참조) + fid_input_date_1 (str): [필수] 입력날짜1 + fid_input_date_2 (str): [필수] 입력날짜2 + fid_sctn_cls_code (str): 데이터 순위 (초기값: "") + + Returns: + pd.DataFrame: 주식현재가 회원사 종목매매동향 데이터 + + Example: + >>> df = inquire_member_daily( + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_iscd_2="00003", + ... fid_input_date_1="20240501", + ... fid_input_date_2="20240624" + ... ) + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required (e.g. '00003')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required") + + tr_id = "FHPST04540000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_SCTN_CLS_CODE": fid_sctn_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/chk_inquire_overtime_asking_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/chk_inquire_overtime_asking_price.py new file mode 100644 index 0000000..e46b32e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/chk_inquire_overtime_asking_price.py @@ -0,0 +1,149 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_overtime_asking_price import inquire_overtime_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외호가[국내주식-077] +############################################################################################## + +COLUMN_MAPPING = { + 'ovtm_untp_last_hour': '시간외 단일가 최종 시간', + 'ovtm_untp_askp1': '시간외 단일가 매도호가1', + 'ovtm_untp_askp2': '시간외 단일가 매도호가2', + 'ovtm_untp_askp3': '시간외 단일가 매도호가3', + 'ovtm_untp_askp4': '시간외 단일가 매도호가4', + 'ovtm_untp_askp5': '시간외 단일가 매도호가5', + 'ovtm_untp_askp6': '시간외 단일가 매도호가6', + 'ovtm_untp_askp7': '시간외 단일가 매도호가7', + 'ovtm_untp_askp8': '시간외 단일가 매도호가8', + 'ovtm_untp_askp9': '시간외 단일가 매도호가9', + 'ovtm_untp_askp10': '시간외 단일가 매도호가10', + 'ovtm_untp_bidp1': '시간외 단일가 매수호가1', + 'ovtm_untp_bidp2': '시간외 단일가 매수호가2', + 'ovtm_untp_bidp3': '시간외 단일가 매수호가3', + 'ovtm_untp_bidp4': '시간외 단일가 매수호가4', + 'ovtm_untp_bidp5': '시간외 단일가 매수호가5', + 'ovtm_untp_bidp6': '시간외 단일가 매수호가6', + 'ovtm_untp_bidp7': '시간외 단일가 매수호가7', + 'ovtm_untp_bidp8': '시간외 단일가 매수호가8', + 'ovtm_untp_bidp9': '시간외 단일가 매수호가9', + 'ovtm_untp_bidp10': '시간외 단일가 매수호가10', + 'ovtm_untp_askp_icdc1': '시간외 단일가 매도호가 증감1', + 'ovtm_untp_askp_icdc2': '시간외 단일가 매도호가 증감2', + 'ovtm_untp_askp_icdc3': '시간외 단일가 매도호가 증감3', + 'ovtm_untp_askp_icdc4': '시간외 단일가 매도호가 증감4', + 'ovtm_untp_askp_icdc5': '시간외 단일가 매도호가 증감5', + 'ovtm_untp_askp_icdc6': '시간외 단일가 매도호가 증감6', + 'ovtm_untp_askp_icdc7': '시간외 단일가 매도호가 증감7', + 'ovtm_untp_askp_icdc8': '시간외 단일가 매도호가 증감8', + 'ovtm_untp_askp_icdc9': '시간외 단일가 매도호가 증감9', + 'ovtm_untp_askp_icdc10': '시간외 단일가 매도호가 증감10', + 'ovtm_untp_bidp_icdc1': '시간외 단일가 매수호가 증감1', + 'ovtm_untp_bidp_icdc2': '시간외 단일가 매수호가 증감2', + 'ovtm_untp_bidp_icdc3': '시간외 단일가 매수호가 증감3', + 'ovtm_untp_bidp_icdc4': '시간외 단일가 매수호가 증감4', + 'ovtm_untp_bidp_icdc5': '시간외 단일가 매수호가 증감5', + 'ovtm_untp_bidp_icdc6': '시간외 단일가 매수호가 증감6', + 'ovtm_untp_bidp_icdc7': '시간외 단일가 매수호가 증감7', + 'ovtm_untp_bidp_icdc8': '시간외 단일가 매수호가 증감8', + 'ovtm_untp_bidp_icdc9': '시간외 단일가 매수호가 증감9', + 'ovtm_untp_bidp_icdc10': '시간외 단일가 매수호가 증감10', + 'ovtm_untp_askp_rsqn1': '시간외 단일가 매도호가 잔량1', + 'ovtm_untp_askp_rsqn2': '시간외 단일가 매도호가 잔량2', + 'ovtm_untp_askp_rsqn3': '시간외 단일가 매도호가 잔량3', + 'ovtm_untp_askp_rsqn4': '시간외 단일가 매도호가 잔량4', + 'ovtm_untp_askp_rsqn5': '시간외 단일가 매도호가 잔량5', + 'ovtm_untp_askp_rsqn6': '시간외 단일가 매도호가 잔량6', + 'ovtm_untp_askp_rsqn7': '시간외 단일가 매도호가 잔량7', + 'ovtm_untp_askp_rsqn8': '시간외 단일가 매도호가 잔량8', + 'ovtm_untp_askp_rsqn9': '시간외 단일가 매도호가 잔량9', + 'ovtm_untp_askp_rsqn10': '시간외 단일가 매도호가 잔량10', + 'ovtm_untp_bidp_rsqn1': '시간외 단일가 매수호가 잔량1', + 'ovtm_untp_bidp_rsqn': '시간외 단일가 매수호가 잔량2', + 'ovtm_untp_bidp_rsqn3': '시간외 단일가 매수호가 잔량3', + 'ovtm_untp_bidp_rsqn4': '시간외 단일가 매수호가 잔량4', + 'ovtm_untp_bidp_rsqn5': '시간외 단일가 매수호가 잔량5', + 'ovtm_untp_bidp_rsqn6': '시간외 단일가 매수호가 잔량6', + 'ovtm_untp_bidp_rsqn7': '시간외 단일가 매수호가 잔량7', + 'ovtm_untp_bidp_rsqn8': '시간외 단일가 매수호가 잔량8', + 'ovtm_untp_bidp_rsqn9': '시간외 단일가 매수호가 잔량9', + 'ovtm_untp_bidp_rsqn10': '시간외 단일가 매수호가 잔량10', + 'ovtm_untp_total_askp_rsqn': '시간외 단일가 총 매도호가 잔량', + 'ovtm_untp_total_bidp_rsqn': '시간외 단일가 총 매수호가 잔량', + 'ovtm_untp_total_askp_rsqn_icdc': '시간외 단일가 총 매도호가 잔량', + 'ovtm_untp_total_bidp_rsqn_icdc': '시간외 단일가 총 매수호가 잔량', + 'ovtm_untp_ntby_bidp_rsqn': '시간외 단일가 순매수 호가 잔량', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'total_askp_rsqn_icdc': '총 매도호가 잔량 증감', + 'total_bidp_rsqn_icdc': '총 매수호가 잔량 증감', + 'ovtm_total_askp_rsqn': '시간외 총 매도호가 잔량', + 'ovtm_total_bidp_rsqn': '시간외 총 매수호가 잔량', + 'ovtm_total_askp_icdc': '시간외 총 매도호가 증감', + 'ovtm_total_bidp_icdc': '시간외 총 매수호가 증감' +} + +NUMERIC_COLUMNS = ['시간외 단일가 매도호가1', '시간외 단일가 매도호가2', '시간외 단일가 매도호가3', + '시간외 단일가 매도호가4', '시간외 단일가 매도호가5', '시간외 단일가 매도호가6', + '시간외 단일가 매도호가7', '시간외 단일가 매도호가8', '시간외 단일가 매도호가9', + '시간외 단일가 매도호가10', '시간외 단일가 매수호가1', '시간외 단일가 매수호가2', + '시간외 단일가 매수호가3', '시간외 단일가 매수호가4', '시간외 단일가 매수호가5', + '시간외 단일가 매수호가6', '시간외 단일가 매수호가7', '시간외 단일가 매수호가8', + '시간외 단일가 매수호가9', '시간외 단일가 매수호가10'] + + +def main(): + """ + 국내주식 시간외호가 조회 테스트 함수 + + 이 함수는 국내주식 시간외호가 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_overtime_asking_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/inquire_overtime_asking_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/inquire_overtime_asking_price.py new file mode 100644 index 0000000..fc8eedf --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_asking_price/inquire_overtime_asking_price.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외호가[국내주식-077] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-overtime-asking-price" + +def inquire_overtime_asking_price( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 시간외호가 API입니다. + 한국투자 HTS(eFriend Plus) > [0230] 시간외 현재가 화면의 '호가' 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J:주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 국내주식 시간외호가 데이터 + + Example: + >>> df = inquire_overtime_asking_price("J", "005930") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST02300400" # 국내주식 시간외호가 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/chk_inquire_overtime_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/chk_inquire_overtime_price.py new file mode 100644 index 0000000..5376741 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/chk_inquire_overtime_price.py @@ -0,0 +1,110 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_overtime_price import inquire_overtime_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외현재가[국내주식-076] +############################################################################################## + +COLUMN_MAPPING = { + 'bstp_kor_isnm': '업종 한글 종목명', + 'mang_issu_cls_name': '관리 종목 구분 명', + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'ovtm_untp_tr_pbmn': '시간외 단일가 거래 대금', + 'ovtm_untp_mxpr': '시간외 단일가 상한가', + 'ovtm_untp_llam': '시간외 단일가 하한가', + 'ovtm_untp_oprc': '시간외 단일가 시가2', + 'ovtm_untp_hgpr': '시간외 단일가 최고가', + 'ovtm_untp_lwpr': '시간외 단일가 최저가', + 'marg_rate': '증거금 비율', + 'ovtm_untp_antc_cnpr': '시간외 단일가 예상 체결가', + 'ovtm_untp_antc_cntg_vrss': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_vrss_sign': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_ctrt': '시간외 단일가 예상 체결 대비율', + 'ovtm_untp_antc_cnqn': '시간외 단일가 예상 체결량', + 'crdt_able_yn': '신용 가능 여부', + 'new_lstn_cls_name': '신규 상장 구분 명', + 'sltr_yn': '정리매매 여부', + 'mang_issu_yn': '관리 종목 여부', + 'mrkt_warn_cls_code': '시장 경고 구분 코드', + 'trht_yn': '거래정지 여부', + 'vlnt_deal_cls_name': '임의 매매 구분 명', + 'ovtm_untp_sdpr': '시간외 단일가 기준가', + 'mrkt_warn_cls_name': '시장 경구 구분 명', + 'revl_issu_reas_name': '재평가 종목 사유 명', + 'insn_pbnt_yn': '불성실 공시 여부', + 'flng_cls_name': '락 구분 이름', + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'ovtm_vi_cls_code': '시간외단일가VI적용구분코드', + 'bidp': '매수호가', + 'askp': '매도호가' +} + +NUMERIC_COLUMNS = [ + '시간외 단일가 현재가', '시간외 단일가 전일 대비율', '시간외 단일가 거래량', + '시간외 단일가 거래 대금', '시간외 단일가 상한가', '시간외 단일가 하한가', + '시간외 단일가 시가2', '시간외 단일가 최고가', '시간외 단일가 최저가', + '증거금 비율', '시간외 단일가 예상 체결가', '시간외 단일가 예상 체결 대비율', + '시간외 단일가 예상 체결량' +] + + +def main(): + """ + 국내주식 시간외현재가 조회 테스트 함수 + + 이 함수는 국내주식 시간외현재가 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_overtime_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에서 number로 명시된 컬럼만) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/inquire_overtime_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/inquire_overtime_price.py new file mode 100644 index 0000000..94b4847 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_overtime_price/inquire_overtime_price.py @@ -0,0 +1,66 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외현재가[국내주식-076] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-overtime-price" + +def inquire_overtime_price( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 (ex. J: 주식) + fid_input_iscd: str # [필수] 종목코드 (ex. 005930) +) -> pd.DataFrame: + """ + 국내주식 시간외현재가 API입니다. + 한국투자 HTS(eFriend Plus) > [0230] 시간외 현재가 화면의 좌측 상단기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J: 주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 005930) + + Returns: + pd.DataFrame: 시간외현재가 데이터 + + Example: + >>> df = inquire_overtime_price("J", "005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + tr_id = "FHPST02300000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/chk_inquire_period_profit.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/chk_inquire_period_profit.py new file mode 100644 index 0000000..35d7e53 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/chk_inquire_period_profit.py @@ -0,0 +1,123 @@ +""" +Created on 20250125 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_period_profit import inquire_period_profit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별손익일별합산조회[v1_국내주식-052] +############################################################################################## + +COLUMN_MAPPING = { + 'trad_dt': '매매일자', + 'buy_amt': '매수금액', + 'sll_amt': '매도금액', + 'rlzt_pfls': '실현손익', + 'fee': '수수료', + 'loan_int': '대출이자', + 'tl_tax': '제세금', + 'pfls_rt': '손익률', + 'sll_qty1': '매도수량1', + 'buy_qty1': '매수수량1', + 'sll_qty_smtl': '매도수량합계', + 'sll_tr_amt_smtl': '매도거래금액합계', + 'sll_fee_smtl': '매도수수료합계', + 'sll_tltx_smtl': '매도제세금합계', + 'sll_excc_amt_smtl': '매도정산금액합계', + 'buy_qty_smtl': '매수수량합계', + 'buy_tr_amt_smtl': '매수거래금액합계', + 'buy_fee_smtl': '매수수수료합계', + 'buy_tax_smtl': '매수제세금합계', + 'buy_excc_amt_smtl': '매수정산금액합계', + 'tot_qty': '총수량', + 'tot_tr_amt': '총거래금액', + 'tot_fee': '총수수료', + 'tot_tltx': '총제세금', + 'tot_excc_amt': '총정산금액', + 'tot_rlzt_pfls': '총실현손익', + 'loan_int': '대출이자' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 기간별손익일별합산조회 테스트 함수 + + 이 함수는 기간별손익일별합산조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_period_profit( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_dt="20230101", + inqr_end_dt="20240301", + sort_dvsn="00", + inqr_dvsn="00", + cblc_dvsn="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/inquire_period_profit.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/inquire_period_profit.py new file mode 100644 index 0000000..fc8f142 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_profit/inquire_period_profit.py @@ -0,0 +1,151 @@ +""" +Created on 20250125 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별손익일별합산조회[v1_국내주식-052] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-period-profit" + +def inquire_period_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + sort_dvsn: str, # 정렬구분 (ex. 00: 최근 순, 01: 과거 순, 02: 최근 순) + inqr_dvsn: str, # 조회구분 (ex. 00) + cblc_dvsn: str, # 잔고구분 (ex. 00: 전체) + pdno: str = "", # 상품번호 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 기간별손익일별합산조회 API입니다. + 한국투자 HTS(eFriend Plus) > [0856] 기간별 매매손익 화면 에서 "일별" 클릭 시의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + sort_dvsn (str): [필수] 정렬구분 (00: 최근 순, 01: 과거 순, 02: 최근 순) + inqr_dvsn (str): [필수] 조회구분 (00) + cblc_dvsn (str): [필수] 잔고구분 (00: 전체) + pdno (str): 상품번호 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 기간별손익일별합산조회 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_period_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20230101", inqr_end_dt="20240301", sort_dvsn="00", inqr_dvsn="00", cblc_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if sort_dvsn == "": + raise ValueError("sort_dvsn is required (e.g. '00', '01', '02')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00')") + + if cblc_dvsn == "": + raise ValueError("cblc_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8708R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SORT_DVSN": sort_dvsn, + "INQR_DVSN": inqr_dvsn, + "CBLC_DVSN": cblc_dvsn, + "PDNO": pdno, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_period_profit( + cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, sort_dvsn, inqr_dvsn, cblc_dvsn, + pdno, NK100, FK100, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/chk_inquire_period_trade_profit.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/chk_inquire_period_trade_profit.py new file mode 100644 index 0000000..33df3c1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/chk_inquire_period_trade_profit.py @@ -0,0 +1,128 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_period_trade_profit import inquire_period_trade_profit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별매매손익현황조회[v1_국내주식-060] +############################################################################################## + +COLUMN_MAPPING = { + 'trad_dt': '매매일자', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'trad_dvsn_name': '매매구분명', + 'loan_dt': '대출일자', + 'hldg_qty': '보유수량', + 'pchs_unpr': '매입단가', + 'buy_qty': '매수수량', + 'buy_amt': '매수금액', + 'sll_pric': '매도가격', + 'sll_qty': '매도수량', + 'sll_amt': '매도금액', + 'rlzt_pfls': '실현손익', + 'pfls_rt': '손익률', + 'fee': '수수료', + 'tl_tax': '제세금', + 'loan_int': '대출이자', + 'sll_qty_smtl': '매도수량합계', + 'sll_tr_amt_smtl': '매도거래금액합계', + 'sll_fee_smtl': '매도수수료합계', + 'sll_tltx_smtl': '매도제세금합계', + 'sll_excc_amt_smtl': '매도정산금액합계', + 'buyqty_smtl': '매수수량합계', + 'buy_tr_amt_smtl': '매수거래금액합계', + 'buy_fee_smtl': '매수수수료합계', + 'buy_tax_smtl': '매수제세금합계', + 'buy_excc_amt_smtl': '매수정산금액합계', + 'tot_qty': '총수량', + 'tot_tr_amt': '총거래금액', + 'tot_fee': '총수수료', + 'tot_tltx': '총제세금', + 'tot_excc_amt': '총정산금액', + 'tot_rlzt_pfls': '총실현손익', + 'loan_int': '대출이자', + 'tot_pftrt': '총수익률' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 기간별매매손익현황조회 테스트 함수 + + 이 함수는 기간별매매손익현황조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # Case1 조회 + logging.info("=== Case1 조회 ===") + try: + result1, result2 = inquire_period_trade_profit( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + sort_dvsn="02", + inqr_strt_dt="20230216", + inqr_end_dt="20240301", + cblc_dvsn="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼 (output1): %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과 (output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과 (output2):") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/inquire_period_trade_profit.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/inquire_period_trade_profit.py new file mode 100644 index 0000000..ca28d7b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_period_trade_profit/inquire_period_trade_profit.py @@ -0,0 +1,143 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별매매손익현황조회[v1_국내주식-060] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-period-trade-profit" + +def inquire_period_trade_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + sort_dvsn: str, # 정렬구분 (00: 최근, 01:과거, 02:최근) + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + cblc_dvsn: str, # 잔고구분 (00: 전체) + pdno: str = "", # 상품번호 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 기간별매매손익현황조회 API입니다. + 한국투자 HTS(eFriend Plus) > [0856] 기간별 매매손익 화면 에서 "종목별" 클릭 시의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + sort_dvsn (str): [필수] 정렬구분 (ex. 00: 최근, 01:과거, 02:최근) + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + cblc_dvsn (str): [필수] 잔고구분 (ex. 00: 전체) + pdno (str): 상품번호 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 기간별매매손익현황 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_period_trade_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, sort_dvsn="02", inqr_strt_dt="20230216", inqr_end_dt="20240301", cblc_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if sort_dvsn == "": + raise ValueError("sort_dvsn is required (e.g. '00', '01', '02')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if cblc_dvsn == "": + raise ValueError("cblc_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8715R" # 기간별매매손익현황조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "SORT_DVSN": sort_dvsn, # 정렬구분 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": cblc_dvsn, # 잔고구분 + "PDNO": pdno, # 상품번호 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data1 = pd.DataFrame(res.getBody().output1) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_period_trade_profit( + cano, acnt_prdt_cd, sort_dvsn, inqr_strt_dt, inqr_end_dt, cblc_dvsn, + pdno, NK100, FK100, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/chk_inquire_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/chk_inquire_price.py new file mode 100644 index 0000000..ad79be5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/chk_inquire_price.py @@ -0,0 +1,151 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_price import inquire_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세[v1_국내주식-008] +############################################################################################## + +COLUMN_MAPPING = { + 'iscd_stat_cls_code': '종목 상태 구분 코드', + 'marg_rate': '증거금 비율', + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'new_hgpr_lwpr_cls_code': '신 고가 저가 구분 코드', + 'bstp_kor_isnm': '업종 한글 종목명', + 'temp_stop_yn': '임시 정지 여부', + 'oprc_rang_cont_yn': '시가 범위 연장 여부', + 'clpr_rang_cont_yn': '종가 범위 연장 여부', + 'crdt_able_yn': '신용 가능 여부', + 'grmn_rate_cls_code': '보증금 비율 구분 코드', + 'elw_pblc_yn': 'ELW 발행 여부', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_tr_pbmn': '누적 거래 대금', + 'acml_vol': '누적 거래량', + 'prdy_vrss_vol_rate': '전일 대비 거래량 비율', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'stck_mxpr': '주식 상한가', + 'stck_llam': '주식 하한가', + 'stck_sdpr': '주식 기준가', + 'wghn_avrg_stck_prc': '가중 평균 주식 가격', + 'hts_frgn_ehrt': 'HTS 외국인 소진율', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'pgtr_ntby_qty': '프로그램매매 순매수 수량', + 'pvt_scnd_dmrs_prc': '피벗 2차 디저항 가격', + 'pvt_frst_dmrs_prc': '피벗 1차 디저항 가격', + 'pvt_pont_val': '피벗 포인트 값', + 'pvt_frst_dmsp_prc': '피벗 1차 디지지 가격', + 'pvt_scnd_dmsp_prc': '피벗 2차 디지지 가격', + 'dmrs_val': '디저항 값', + 'dmsp_val': '디지지 값', + 'cpfn': '자본금', + 'rstc_wdth_prc': '제한 폭 가격', + 'stck_fcam': '주식 액면가', + 'stck_sspr': '주식 대용가', + 'aspr_unit': '호가단위', + 'hts_deal_qty_unit_val': 'HTS 매매 수량 단위 값', + 'lstn_stcn': '상장 주수', + 'hts_avls': 'HTS 시가총액', + 'per': 'PER', + 'pbr': 'PBR', + 'stac_month': '결산 월', + 'vol_tnrt': '거래량 회전율', + 'eps': 'EPS', + 'bps': 'BPS', + 'd250_hgpr': '250일 최고가', + 'd250_hgpr_date': '250일 최고가 일자', + 'd250_hgpr_vrss_prpr_rate': '250일 최고가 대비 현재가 비율', + 'd250_lwpr': '250일 최저가', + 'd250_lwpr_date': '250일 최저가 일자', + 'd250_lwpr_vrss_prpr_rate': '250일 최저가 대비 현재가 비율', + 'stck_dryy_hgpr': '주식 연중 최고가', + 'dryy_hgpr_vrss_prpr_rate': '연중 최고가 대비 현재가 비율', + 'dryy_hgpr_date': '연중 최고가 일자', + 'stck_dryy_lwpr': '주식 연중 최저가', + 'dryy_lwpr_vrss_prpr_rate': '연중 최저가 대비 현재가 비율', + 'dryy_lwpr_date': '연중 최저가 일자', + 'w52_hgpr': '52주일 최고가', + 'w52_hgpr_vrss_prpr_ctrt': '52주일 최고가 대비 현재가 대비', + 'w52_hgpr_date': '52주일 최고가 일자', + 'w52_lwpr': '52주일 최저가', + 'w52_lwpr_vrss_prpr_ctrt': '52주일 최저가 대비 현재가 대비', + 'w52_lwpr_date': '52주일 최저가 일자', + 'whol_loan_rmnd_rate': '전체 융자 잔고 비율', + 'ssts_yn': '공매도가능여부', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'fcam_cnnm': '액면가 통화명', + 'cpfn_cnnm': '자본금 통화명', + 'apprch_rate': '접근도', + 'frgn_hldn_qty': '외국인 보유 수량', + 'vi_cls_code': 'VI적용구분코드', + 'ovtm_vi_cls_code': '시간외단일가VI적용구분코드', + 'last_ssts_cntg_qty': '최종 공매도 체결 수량', + 'invt_caful_yn': '투자유의여부', + 'mrkt_warn_cls_code': '시장경고코드', + 'short_over_yn': '단기과열여부', + 'sltr_yn': '정리매매여부', + 'mang_issu_cls_code': '관리종목여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 시세 조회 테스트 함수 + + 이 함수는 주식현재가 시세 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_price(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 타입이 명시되지 않음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/inquire_price.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/inquire_price.py new file mode 100644 index 0000000..bb6ab22 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price/inquire_price.py @@ -0,0 +1,78 @@ +""" +Created on 20250112 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세[v1_국내주식-008] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-price" + +def inquire_price( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수) +) -> pd.DataFrame: + """ + 주식 현재가 시세 API입니다. 실시간 시세를 원하신다면 웹소켓 API를 활용하세요. + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수) + + Returns: + pd.DataFrame: 주식 현재가 시세 데이터 + + Example: + >>> df = inquire_price("real", "J", "005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010100" + elif env_dv == "demo": + tr_id = "FHKST01010100" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/chk_inquire_price_2.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/chk_inquire_price_2.py new file mode 100644 index 0000000..e79fa32 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/chk_inquire_price_2.py @@ -0,0 +1,123 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_price_2 import inquire_price_2 + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세2[v1_국내주식-054] +############################################################################################## + +COLUMN_MAPPING = { + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'new_hgpr_lwpr_cls_code': '신 고가 저가 구분 코드', + 'mxpr_llam_cls_code': '상하한가 구분 코드', + 'crdt_able_yn': '신용 가능 여부', + 'stck_mxpr': '주식 상한가', + 'elw_pblc_yn': 'ELW 발행 여부', + 'prdy_clpr_vrss_oprc_rate': '전일 종가 대비 시가2 비율', + 'crdt_rate': '신용 비율', + 'marg_rate': '증거금 비율', + 'lwpr_vrss_prpr': '최저가 대비 현재가', + 'lwpr_vrss_prpr_sign': '최저가 대비 현재가 부호', + 'prdy_clpr_vrss_lwpr_rate': '전일 종가 대비 최저가 비율', + 'stck_lwpr': '주식 최저가', + 'hgpr_vrss_prpr': '최고가 대비 현재가', + 'hgpr_vrss_prpr_sign': '최고가 대비 현재가 부호', + 'prdy_clpr_vrss_hgpr_rate': '전일 종가 대비 최고가 비율', + 'stck_hgpr': '주식 최고가', + 'oprc_vrss_prpr': '시가2 대비 현재가', + 'oprc_vrss_prpr_sign': '시가2 대비 현재가 부호', + 'mang_issu_yn': '관리 종목 여부', + 'divi_app_cls_code': '동시호가배분처리코드', + 'short_over_yn': '단기과열여부', + 'mrkt_warn_cls_code': '시장경고코드', + 'invt_caful_yn': '투자유의여부', + 'stange_runup_yn': '이상급등여부', + 'ssts_hot_yn': '공매도과열 여부', + 'low_current_yn': '저유동성 종목 여부', + 'vi_cls_code': 'VI적용구분코드', + 'short_over_cls_code': '단기과열구분코드', + 'stck_llam': '주식 하한가', + 'new_lstn_cls_name': '신규 상장 구분 명', + 'vlnt_deal_cls_name': '임의 매매 구분 명', + 'flng_cls_name': '락 구분 이름', + 'revl_issu_reas_name': '재평가 종목 사유 명', + 'mrkt_warn_cls_name': '시장 경고 구분 명', + 'stck_sdpr': '주식 기준가', + 'bstp_cls_code': '업종 구분 코드', + 'stck_prdy_clpr': '주식 전일 종가', + 'insn_pbnt_yn': '불성실 공시 여부', + 'fcam_mod_cls_name': '액면가 변경 구분 명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_tr_pbmn': '누적 거래 대금', + 'acml_vol': '누적 거래량', + 'prdy_vrss_vol_rate': '전일 대비 거래량 비율', + 'bstp_kor_isnm': '업종 한글 종목명', + 'sltr_yn': '정리매매 여부', + 'trht_yn': '거래정지 여부', + 'oprc_rang_cont_yn': '시가 범위 연장 여부', + 'vlnt_fin_cls_code': '임의 종료 구분 코드', + 'stck_oprc': '주식 시가2', + 'prdy_vol': '전일 거래량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 시세2 조회 테스트 함수 + + 이 함수는 주식현재가 시세2 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_price_2(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/inquire_price_2.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/inquire_price_2.py new file mode 100644 index 0000000..1f87c30 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_price_2/inquire_price_2.py @@ -0,0 +1,63 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세2[v1_국내주식-054] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-price-2" + +def inquire_price_2( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 +) -> pd.DataFrame: + """ + 주식현재가 시세2 API입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + pd.DataFrame: 주식현재가 시세2 데이터 + + Example: + >>> df = inquire_price_2("J", "005930") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + tr_id = "FHPST01010000" # 주식현재가 시세2 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/chk_inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/chk_inquire_psbl_order.py new file mode 100644 index 0000000..92c710a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/chk_inquire_psbl_order.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_psbl_order import inquire_psbl_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + + +############################################################################################## +# [국내주식] 주문/계좌 > 매수가능조회[v1_국내주식-007] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_psbl_cash': '주문가능현금', + 'ord_psbl_sbst': '주문가능대용', + 'ruse_psbl_amt': '재사용가능금액', + 'fund_rpch_chgs': '펀드환매대금', + 'psbl_qty_calc_unpr': '가능수량계산단가', + 'nrcvb_buy_amt': '미수없는매수금액', + 'nrcvb_buy_qty': '미수없는매수수량', + 'max_buy_amt': '최대매수금액', + 'max_buy_qty': '최대매수수량', + 'cma_evlu_amt': 'CMA평가금액', + 'ovrs_re_use_amt_wcrc': '해외재사용금액원화', + 'ord_psbl_frcr_amt_wcrc': '주문가능외화금액원화' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 매수가능조회 테스트 함수 + + 이 함수는 매수가능조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_psbl_order(env_dv="real",cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_unpr="55000", + ord_dvsn="01", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/inquire_psbl_order.py new file mode 100644 index 0000000..e163571 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_order/inquire_psbl_order.py @@ -0,0 +1,118 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 매수가능조회[v1_국내주식-007] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-psbl-order" + +def inquire_psbl_order( + env_dv: str, # 실전모의구분 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + ord_unpr: str, # 주문단가 + ord_dvsn: str, # 주문구분 + cma_evlu_amt_icld_yn: str, # CMA평가금액포함여부 + ovrs_icld_yn: str # 해외포함여부 +) -> pd.DataFrame: + """ + 매수가능 조회 API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 1건까지 확인 가능합니다. + + 1) 매수가능금액 확인 + . 미수 사용 X: nrcvb_buy_amt(미수없는매수금액) 확인 + . 미수 사용 O: max_buy_amt(최대매수금액) 확인 + + 2) 매수가능수량 확인 + . 특정 종목 전량매수 시 가능수량을 확인하실 경우 ORD_DVSN:00(지정가)는 종목증거금율이 반영되지 않습니다. + 따라서 "반드시" ORD_DVSN:01(시장가)로 지정하여 종목증거금율이 반영된 가능수량을 확인하시기 바랍니다. + + (다만, 조건부지정가 등 특정 주문구분(ex.IOC)으로 주문 시 가능수량을 확인할 경우 주문 시와 동일한 주문구분(ex.IOC) 입력하여 가능수량 확인) + + . 미수 사용 X: ORD_DVSN:01(시장가) or 특정 주문구분(ex.IOC)로 지정하여 nrcvb_buy_qty(미수없는매수수량) 확인 + . 미수 사용 O: ORD_DVSN:01(시장가) or 특정 주문구분(ex.IOC)로 지정하여 max_buy_qty(최대매수수량) 확인 + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + pdno (str): [필수] 상품번호 (ex. 종목번호(6자리)) + ord_unpr (str): [필수] 주문단가 (ex. 1주당 가격) + ord_dvsn (str): [필수] 주문구분 (ex. 01 : 시장가) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y) + ovrs_icld_yn (str): [필수] 해외포함여부 (ex. N) + + Returns: + pd.DataFrame: 매수가능조회 데이터 + + Example: + >>> df = inquire_psbl_order(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_unpr="55000", ord_dvsn="01", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '종목번호(6자리)')") + + if ord_unpr == "": + raise ValueError("ord_unpr is required (e.g. '1주당 가격')") + + if ord_dvsn == "": + raise ValueError("ord_dvsn is required (e.g. '01 : 시장가')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y')") + + if ovrs_icld_yn == "": + raise ValueError("ovrs_icld_yn is required (e.g. 'N')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC8908R" + elif env_dv == "demo": + tr_id = "VTTC8908R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_UNPR": ord_unpr, + "ORD_DVSN": ord_dvsn, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "OVRS_ICLD_YN": ovrs_icld_yn + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py new file mode 100644 index 0000000..32e5dd2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/chk_inquire_psbl_rvsecncl.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_psbl_rvsecncl import inquire_psbl_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식정정취소가능주문조회[v1_국내주식-004] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_gno_brno': '주문채번지점번호', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'ord_dvsn_name': '주문구분명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'rvse_cncl_dvsn_name': '정정취소구분명', + 'ord_qty': '주문수량', + 'ord_unpr': '주문단가', + 'ord_tmd': '주문시각', + 'tot_ccld_qty': '총체결수량', + 'tot_ccld_amt': '총체결금액', + 'psbl_qty': '가능수량', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'ord_dvsn_cd': '주문구분코드', + 'mgco_aptm_odno': '운용사지정주문번호', + 'excg_dvsn_cd': '거래소구분코드', + 'excg_id_dvsn_cd': '거래소ID구분코드', + 'excg_id_dvsn_name': '거래소ID구분명', + 'stpm_cndt_pric': '스톱지정가조건가격', + 'stpm_efct_occr_yn': '스톱지정가효력발생여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식정정취소가능주문조회 테스트 함수 + + 이 함수는 주식정정취소가능주문조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dvsn_1="1", inqr_dvsn_2="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py new file mode 100644 index 0000000..66a5e4c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_rvsecncl/inquire_psbl_rvsecncl.py @@ -0,0 +1,118 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식정정취소가능주문조회[v1_국내주식-004] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl" + +def inquire_psbl_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_dvsn_1: str, # 조회구분1 + inqr_dvsn_2: str, # 조회구분2 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 주식정정취소가능주문조회 API입니다. 한 번의 호출에 최대 50건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + ※ 주식주문(정정취소) 호출 전에 반드시 주식정정취소가능주문조회 호출을 통해 정정취소가능수량(output > psbl_qty)을 확인하신 후 정정취소주문 내시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + inqr_dvsn_1 (str): [필수] 조회구분1 (ex. 0: 주문, 1: 종목) + inqr_dvsn_2 (str): [필수] 조회구분2 (ex. 0: 전체, 1: 매도, 2: 매수) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 주식정정취소가능주문조회 데이터 + + Example: + >>> df = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dvsn_1="1", inqr_dvsn_2="0") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if inqr_dvsn_1 == "": + raise ValueError("inqr_dvsn_1 is required (e.g. '0: 주문, 1: 종목')") + + if inqr_dvsn_2 == "": + raise ValueError("inqr_dvsn_2 is required (e.g. '0: 전체, 1: 매도, 2: 매수')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTC0084R" # 주식정정취소가능주문조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_DVSN_1": inqr_dvsn_1, # 조회구분1 + "INQR_DVSN_2": inqr_dvsn_2, # 조회구분2 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_psbl_rvsecncl( + cano, acnt_prdt_cd, inqr_dvsn_1, inqr_dvsn_2, FK100, NK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/chk_inquire_psbl_sell.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/chk_inquire_psbl_sell.py new file mode 100644 index 0000000..af51a8d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/chk_inquire_psbl_sell.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_psbl_sell import inquire_psbl_sell + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 주문/계좌 > 매도가능수량조회 [국내주식-165] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'buy_qty': '매수수량', + 'sll_qty': '매도수량', + 'cblc_qty': '잔고수량', + 'nsvg_qty': '비저축수량', + 'ord_psbl_qty': '주문가능수량', + 'pchs_avg_pric': '매입평균가격', + 'pchs_amt': '매입금액', + 'now_pric': '현재가', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'evlu_pfls_rt': '평가손익율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 주문/계좌 + 매도가능수량조회[국내주식-165] + + 매도가능수량조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (종합계좌번호) + - acnt_prdt_cd (str): 계좌상품코드 (계좌상품코드) + - pdno (str): 종목번호 (보유종목 코드 ex)000660) + Returns: + - DataFrame: 매도가능수량조회 결과 + + Example: + >>> df = inquire_psbl_sell(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="000660") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # kis_auth 모듈에서 계좌 정보 가져오기 + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 매도가능수량조회") + result = inquire_psbl_sell( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + pdno="005930", # 종목번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 매도가능수량조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/inquire_psbl_sell.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/inquire_psbl_sell.py new file mode 100644 index 0000000..759bc2e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_psbl_sell/inquire_psbl_sell.py @@ -0,0 +1,120 @@ +# [국내주식] 주문/계좌 - 매도가능수량조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-20 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 주문/계좌 > 매도가능수량조회 [국내주식-165] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/inquire-psbl-sell" + +def inquire_psbl_sell( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 종목번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 주문/계좌 + 매도가능수량조회[국내주식-165] + 매도가능수량조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + pdno (str): 보유종목 코드 ex)000660 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 매도가능수량조회 데이터 + + Example: + >>> df = inquire_psbl_sell("12345678", "01", "000660") + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC8408R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_sell( + cano, + acnt_prdt_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/chk_inquire_time_dailychartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/chk_inquire_time_dailychartprice.py new file mode 100644 index 0000000..ad467c3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/chk_inquire_time_dailychartprice.py @@ -0,0 +1,109 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_dailychartprice import inquire_time_dailychartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식일별분봉조회 [국내주식-213] +############################################################################################## + + +COLUMN_MAPPING = { + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'stck_prdy_clpr': '주식 전일 종가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'stck_prpr': '주식 현재가', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'cntg_vol': '체결 거래량', + 'acml_tr_pbmn': '누적 거래 대금' +} + +NUMERIC_COLUMNS = ['전일 대비', '전일 대비율'] + + +def main(): + """ + 주식일별분봉조회 테스트 함수 + + 이 함수는 주식일별분봉조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_time_dailychartprice( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_hour_1="130000", + fid_input_date_1="20241023" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result1 = result1.rename(columns=COLUMN_MAPPING) + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/inquire_time_dailychartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/inquire_time_dailychartprice.py new file mode 100644 index 0000000..aafa68e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_dailychartprice/inquire_time_dailychartprice.py @@ -0,0 +1,94 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식일별분봉조회 [국내주식-213] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-time-dailychartprice" + +def inquire_time_dailychartprice( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + fid_input_iscd: str, # 종목코드 + fid_input_hour_1: str, # 입력 시간1 + fid_input_date_1: str, # 입력 날짜1 + fid_pw_data_incu_yn: str = "N", # 과거 데이터 포함 여부 + fid_fake_tick_incu_yn: str = "" # 허봉 포함 여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식일별분봉조회 API입니다. + + 실전계좌의 경우, 한 번의 호출에 최대 120건까지 확인 가능하며, + FID_INPUT_DATE_1, FID_INPUT_HOUR_1 이용하여 과거일자 분봉조회 가능합니다. + + ※ 과거 분봉 조회 시, 당사 서버에서 보관하고 있는 만큼의 데이터만 확인이 가능합니다. (최대 1년 분봉 보관) + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J:주식,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + fid_input_hour_1 (str): [필수] 입력 시간1 (ex. 130000) + fid_input_date_1 (str): [필수] 입력 날짜1 (ex. 20241023) + fid_pw_data_incu_yn (str): 과거 데이터 포함 여부 (기본값: "N") + fid_fake_tick_incu_yn (str): 허봉 포함 여부 (기본값: "") + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_dailychartprice("J", "005930", "130000", "20241023") + >>> print(output1) + >>> print(output2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J', 'NX', 'UN')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_hour_1 == "": + raise ValueError("fid_input_hour_1 is required (e.g. '130000')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20241023')") + + tr_id = "FHKST03010230" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_FAKE_TICK_INCU_YN": fid_fake_tick_incu_yn + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1 = pd.DataFrame([res.getBody().output1]) + + # output2 (array) -> DataFrame + output2 = pd.DataFrame(res.getBody().output2) + + return output1, output2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py new file mode 100644 index 0000000..1d553d8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_time_indexchartprice import inquire_time_indexchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 업종 분봉조회[v1_국내주식-045] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'Output1': '응답상세', + 'bstp_nmix_prdy_vrss': '업종 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'bstp_nmix_prdy_ctrt': '업종 지수 전일 대비율', + 'prdy_nmix': '전일 지수', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_cls_code': '업종 구분 코드', + 'prdy_vol': '전일 거래량', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'futs_prdy_oprc': '선물 전일 시가', + 'futs_prdy_hgpr': '선물 전일 최고가', + 'futs_prdy_lwpr': '선물 전일 최저가', + 'Output2': '응답상세2', + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'bstp_nmix_prpr': '업종 지수 현재가', + 'bstp_nmix_oprc': '업종 지수 시가2', + 'bstp_nmix_hgpr': '업종 지수 최고가', + 'bstp_nmix_lwpr': '업종 지수 최저가', + 'cntg_vol': '체결 거래량', + 'acml_tr_pbmn': '누적 거래 대금' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 업종 분봉조회[v1_국내주식-045] + + 업종 분봉조회 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (U) + - fid_etc_cls_code (str): FID 기타 구분 코드 (0: 기본 1:장마감,시간외 제외) + - fid_input_iscd (str): FID 입력 종목코드 (0001 : 종합 0002 : 대형주 ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)) + - fid_input_hour_1 (str): FID 입력 시간1 (30, 60 -> 1분, 600-> 10분, 3600 -> 1시간) + - fid_pw_data_incu_yn (str): FID 과거 데이터 포함 여부 (Y (과거) / N (당일)) + + Returns: + - Tuple[DataFrame, ...]: 업종 분봉조회 결과 + + Example: + >>> df1, df2 = inquire_time_indexchartprice(fid_cond_mrkt_div_code="U", fid_etc_cls_code="0", fid_input_iscd="0001", fid_input_hour_1="60", fid_pw_data_incu_yn="Y") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = inquire_time_indexchartprice( + fid_cond_mrkt_div_code="U", # FID 조건 시장 분류 코드 + fid_etc_cls_code="0", # FID 기타 구분 코드 + fid_input_iscd="0001", # FID 입력 종목코드 + fid_input_hour_1="60", # FID 입력 시간1 + fid_pw_data_incu_yn="Y", # FID 과거 데이터 포함 여부 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py new file mode 100644 index 0000000..7327b51 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py @@ -0,0 +1,177 @@ +# [국내주식] 업종/기타 - 업종 분봉조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 업종 분봉조회[v1_국내주식-045] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-time-indexchartprice" + +def inquire_time_indexchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_etc_cls_code: str, # FID 기타 구분 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_hour_1: str, # FID 입력 시간1 + fid_pw_data_incu_yn: str, # FID 과거 데이터 포함 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 업종 분봉조회[v1_국내주식-045] + 업종 분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (예: 'U') + fid_etc_cls_code (str): FID 기타 구분 코드 (예: '0' 기본, '1' 장마감, 시간외 제외) + fid_input_iscd (str): FID 입력 종목코드 (예: '0001' 종합, '0002' 대형주) + fid_input_hour_1 (str): FID 입력 시간1 (예: '30', '60', '600', '3600') + fid_pw_data_incu_yn (str): FID 과거 데이터 포함 여부 (예: 'Y' 과거, 'N' 당일) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 업종 분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_indexchartprice( + ... fid_cond_mrkt_div_code='U', + ... fid_etc_cls_code='0', + ... fid_input_iscd='0001', + ... fid_input_hour_1='30', + ... fid_pw_data_incu_yn='Y' + ... ) + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_etc_cls_code: + logger.error("fid_etc_cls_code is required. (e.g. '0')") + raise ValueError("fid_etc_cls_code is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_hour_1: + logger.error("fid_input_hour_1 is required. (e.g. '30')") + raise ValueError("fid_input_hour_1 is required. (e.g. '30')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'Y')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'Y')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHKUP03500200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_indexchartprice( + fid_cond_mrkt_div_code, + fid_etc_cls_code, + fid_input_iscd, + fid_input_hour_1, + fid_pw_data_incu_yn, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py new file mode 100644 index 0000000..09d2b67 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py @@ -0,0 +1,102 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_itemchartprice import inquire_time_itemchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식당일분봉조회[v1_국내주식-022] +############################################################################################## + +COLUMN_MAPPING = { + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'stck_prdy_clpr': '전일대비 종가', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래대금', + 'hts_kor_isnm': '한글 종목명', + 'stck_prpr': '주식 현재가', + 'stck_bsop_date': '주식 영업일자', + 'stck_cntg_hour': '주식 체결시간', + 'stck_prpr': '주식 현재가', + 'stck_oprc': '주식 시가', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'cntg_vol': '체결 거래량', + 'acml_tr_pbmn': '누적 거래대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식당일분봉조회 테스트 함수 + + 이 함수는 주식당일분봉조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + output1, output2 = inquire_time_itemchartprice(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", fid_input_hour_1="093000", + fid_pw_data_incu_yn="Y") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 block + logging.info("사용 가능한 컬럼 (output1): %s", output1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + output1 = output1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output1.columns: + output1[col] = pd.to_numeric(output1[col], errors='coerce').round(2) + + logging.info("결과 (output1):") + print(output1) + + # output2 block + logging.info("사용 가능한 컬럼 (output2): %s", output2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + output2 = output2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in output2.columns: + output2[col] = pd.to_numeric(output2[col], errors='coerce').round(2) + + logging.info("결과 (output2):") + print(output2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py new file mode 100644 index 0000000..9238531 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식당일분봉조회[v1_국내주식-022] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice" + +def inquire_time_itemchartprice( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_input_hour_1: str, # [필수] 입력 시간1 (ex. 입력시간) + fid_pw_data_incu_yn: str, # [필수] 과거 데이터 포함 여부 + fid_etc_cls_code: str = "" # [필수] 기타 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식당일분봉조회 API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 30건까지 확인 가능합니다. + + ※ 당일 분봉 데이터만 제공됩니다. (전일자 분봉 미제공) + + ※ input > FID_INPUT_HOUR_1 에 미래일시 입력 시에 현재가로 조회됩니다. + ex) 오전 10시에 113000 입력 시에 오전 10시~11시30분 사이의 데이터가 오전 10시 값으로 조회됨 + + ※ output2의 첫번째 배열의 체결량(cntg_vol)은 첫체결이 발생되기 전까지는 이전 분봉의 체결량이 해당 위치에 표시됩니다. + 해당 분봉의 첫 체결이 발생되면 해당 이전분 체결량이 두번째 배열로 이동되면서 새로운 체결량으로 업데이트됩니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_hour_1 (str): [필수] 입력 시간1 (ex. 입력시간) + fid_pw_data_incu_yn (str): [필수] 과거 데이터 포함 여부 + fid_etc_cls_code (str): [필수] 기타 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_itemchartprice(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930", fid_input_hour_1="093000", fid_pw_data_incu_yn="Y") + >>> print(output1) + >>> print(output2) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_hour_1 == "" or fid_input_hour_1 is None: + raise ValueError("fid_input_hour_1 is required (e.g. '입력시간')") + + if fid_pw_data_incu_yn == "" or fid_pw_data_incu_yn is None: + raise ValueError("fid_pw_data_incu_yn is required") + + # tr_id 설정 (실전/모의 동일) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKST03010200" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_ETC_CLS_CODE": fid_etc_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame (1행) + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame (여러행) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/chk_inquire_time_itemconclusion.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/chk_inquire_time_itemconclusion.py new file mode 100644 index 0000000..52116f4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/chk_inquire_time_itemconclusion.py @@ -0,0 +1,107 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_itemconclusion import inquire_time_itemconclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결[v1_국내주식-023] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'stck_cntg_hour': '주식 체결 시간', + 'stck_pbpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'askp': '매도호가', + 'bidp': '매수호가', + 'tday_rltv': '당일 체결강도', + 'acml_vol': '누적 거래량', + 'cnqn': '체결량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식현재가 당일시간대별체결 조회 테스트 함수 + + 이 함수는 주식현재가 당일시간대별체결 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_time_itemconclusion( + env_dv="real", + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_hour_1="115959" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시되지 않음) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시되지 않음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/inquire_time_itemconclusion.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/inquire_time_itemconclusion.py new file mode 100644 index 0000000..7474386 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_itemconclusion/inquire_time_itemconclusion.py @@ -0,0 +1,88 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결[v1_국내주식-023] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion" + +def inquire_time_itemconclusion( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 + fid_input_hour_1: str # [필수] 입력 시간1 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 당일시간대별체결 API입니다. + + Args: + env_dv (str): [필수] 실전모의구분 (real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 + fid_input_hour_1 (str): [필수] 입력 시간1 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_time_itemconclusion("real", "U", "0001", "115959") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '입력 종목코드')") + + if fid_input_hour_1 == "" or fid_input_hour_1 is None: + raise ValueError("fid_input_hour_1 is required (e.g. '입력 시간1')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHPST01060000" + elif env_dv == "demo": + tr_id = "FHPST01060000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object -> DataFrame) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (object -> DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/chk_inquire_time_overtimeconclusion.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/chk_inquire_time_overtimeconclusion.py new file mode 100644 index 0000000..04797de --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/chk_inquire_time_overtimeconclusion.py @@ -0,0 +1,118 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_overtimeconclusion import inquire_time_overtimeconclusion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외시간별체결[v1_국내주식-025] +############################################################################################## + +COLUMN_MAPPING = { + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'ovtm_untp_tr_pbmn': '시간외 단일가 거래 대금', + 'ovtm_untp_mxpr': '시간외 단일가 상한가', + 'ovtm_untp_llam': '시간외 단일가 하한가', + 'ovtm_untp_oprc': '시간외 단일가 시가2', + 'ovtm_untp_hgpr': '시간외 단일가 최고가', + 'ovtm_untp_lwpr': '시간외 단일가 최저가', + 'ovtm_untp_antc_cnpr': '시간외 단일가 예상 체결가', + 'ovtm_untp_antc_cntg_vrss': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_vrss_sign': '시간외 단일가 예상 체결 대비 부호', + 'ovtm_untp_antc_cntg_ctrt': '시간외 단일가 예상 체결 대비율', + 'ovtm_untp_antc_vol': '시간외 단일가 예상 거래량', + 'uplm_sign': '상한 부호', + 'lslm_sign': '하한 부호', + 'stck_cntg_hour': '주식 체결 시간', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'askp': '매도호가', + 'bidp': '매수호가', + 'acml_vol': '누적 거래량', + 'cntg_vol': '체결 거래량' +} + +NUMERIC_COLUMNS = ['시간외 단일가 현재가', '시간외 단일가 전일 대비', '시간외 단일가 전일 대비율', + '시간외 단일가 거래량', '시간외 단일가 거래 대금', '시간외 단일가 시가2', + '시간외 단일가 최고가', '시간외 단일가 최저가', '시간외 단일가 예상 체결가', + '시간외 단일가 예상 체결 대비', '시간외 단일가 예상 체결 대비율', '시간외 단일가 예상 거래량', '주식 현재가', '전일 대비', '전일 대비율', '매도호가', + '매수호가', '누적 거래량', '체결 거래량'] + + +def main(): + """ + 주식현재가 시간외시간별체결 조회 테스트 함수 + + 이 함수는 주식현재가 시간외시간별체결 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = inquire_time_overtimeconclusion(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", fid_hour_cls_code="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/inquire_time_overtimeconclusion.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/inquire_time_overtimeconclusion.py new file mode 100644 index 0000000..0dfdee1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_time_overtimeconclusion/inquire_time_overtimeconclusion.py @@ -0,0 +1,88 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외시간별체결[v1_국내주식-025] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-time-overtimeconclusion" + +def inquire_time_overtimeconclusion( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식/ETF/ETN) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456(ETN의 경우 Q로 시작 Q500001)) + fid_hour_cls_code: str # [필수] 적립금구분코드 (ex. 1: 시간외) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 시간외시간별체결 API입니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식/ETF/ETN) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456(ETN의 경우 Q로 시작 Q500001)) + fid_hour_cls_code (str): [필수] 적립금구분코드 (ex. 1: 시간외) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_overtimeconclusion("real", "J", "005930", "1") + >>> print(output1) + >>> print(output2) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식/ETF/ETN')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456(ETN의 경우 Q로 시작 Q500001)')") + + if fid_hour_cls_code == "" or fid_hour_cls_code is None: + raise ValueError("fid_hour_cls_code is required (e.g. '1: 시간외')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHPST02310000" + elif env_dv == "demo": + tr_id = "FHPST02310000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/chk_inquire_vi_status.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/chk_inquire_vi_status.py new file mode 100644 index 0000000..30a867e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/chk_inquire_vi_status.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka + +from inquire_vi_status import inquire_vi_status + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 변동성완화장치(VI) 현황[v1_국내주식-055] +############################################################################################## + +COLUMN_MAPPING = { + 'Output1': '응답상세', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'vi_cls_code': 'VI발동상태', + 'bsop_date': '영업 일자', + 'cntg_vi_hour': 'VI발동시간', + 'vi_cncl_hour': 'VI해제시간', + 'vi_kind_code': 'VI종류코드', + 'vi_prc': 'VI발동가격', + 'vi_stnd_prc': '정적VI발동기준가격', + 'vi_dprt': '정적VI발동괴리율', + 'vi_dmc_stnd_prc': '동적VI발동기준가격', + 'vi_dmc_dprt': '동적VI발동괴리율', + 'vi_count': 'VI발동횟수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 업종/기타 + 변동성완화장치(VI) 현황[v1_국내주식-055] + + 변동성완화장치(VI) 현황 테스트 함수 + + Parameters: + - fid_div_cls_code (str): FID 분류 구분 코드 (0:전체 1:상승 2:하락) + - fid_cond_scr_div_code (str): FID 조건 화면 분류 코드 (20139) + - fid_mrkt_cls_code (str): FID 시장 구분 코드 (0:전체 K:거래소 Q:코스닥) + - fid_input_iscd (str): FID 입력 종목코드 () + - fid_rank_sort_cls_code (str): FID 순위 정렬 구분 코드 (0:전체1:정적2:동적3:정적&동적) + - fid_input_date_1 (str): FID 입력 날짜1 (영업일) + - fid_trgt_cls_code (str): FID 대상 구분 코드 () + - fid_trgt_exls_cls_code (str): FID 대상 제외 구분 코드 () + Returns: + - DataFrame: 변동성완화장치(VI) 현황 결과 + + Example: + >>> df = inquire_vi_status(fid_div_cls_code="0", fid_cond_scr_div_code="20139", fid_mrkt_cls_code="0", fid_input_iscd="", fid_rank_sort_cls_code="0", fid_input_date_1="20250101", fid_trgt_cls_code="", fid_trgt_exls_cls_code="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = inquire_vi_status( + fid_div_cls_code="0", # FID 분류 구분 코드 + fid_cond_scr_div_code="20139", # FID 조건 화면 분류 코드 + fid_mrkt_cls_code="0", # FID 시장 구분 코드 + fid_input_iscd="", # FID 입력 종목코드 + fid_rank_sort_cls_code="0", # FID 순위 정렬 구분 코드 + fid_input_date_1="20200420", # FID 입력 날짜1 + fid_trgt_cls_code="0", # FID 대상 구분 코드 + fid_trgt_exls_cls_code="", # FID 대상 제외 구분 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 변동성완화장치(VI) 현황 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/inquire_vi_status.py b/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/inquire_vi_status.py new file mode 100644 index 0000000..874b047 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/inquire_vi_status/inquire_vi_status.py @@ -0,0 +1,158 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 변동성완화장치(VI) 현황[v1_국내주식-055] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/inquire-vi-status" + +def inquire_vi_status( + fid_div_cls_code: str, # FID 분류 구분 코드 + fid_cond_scr_div_code: str, # FID 조건 화면 분류 코드 + fid_mrkt_cls_code: str, # FID 시장 구분 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_rank_sort_cls_code: str, # FID 순위 정렬 구분 코드 + fid_input_date_1: str, # FID 입력 날짜1 + fid_trgt_cls_code: str, # FID 대상 구분 코드 + fid_trgt_exls_cls_code: str, # FID 대상 제외 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 변동성완화장치(VI) 현황[v1_국내주식-055] + 변동성완화장치(VI) 현황 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0:전체 1:상승 2:하락 + fid_cond_scr_div_code (str): 20139 + fid_mrkt_cls_code (str): 0:전체 K:거래소 Q:코스닥 + fid_input_iscd (str): 종목코드 + fid_rank_sort_cls_code (str): 0:전체 1:정적 2:동적 3:정적&동적 + fid_input_date_1 (str): 영업일 + fid_trgt_cls_code (str): 대상 구분 코드 + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 변동성완화장치(VI) 현황 데이터 + + Example: + >>> df = inquire_vi_status( + ... fid_div_cls_code="0", + ... fid_cond_scr_div_code="20139", + ... fid_mrkt_cls_code="0", + ... fid_input_iscd="005930", + ... fid_rank_sort_cls_code="0", + ... fid_input_date_1="20240126", + ... fid_trgt_cls_code="", + ... fid_trgt_exls_cls_code="" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 (첨부된 사진 기준, 비어있으면 빼고 체크) + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20139')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20139')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. '0')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20200420')") + raise ValueError("fid_input_date_1 is required. (e.g. '20200420')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01390000" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_vi_status( + fid_div_cls_code, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_input_date_1, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/chk_intgr_margin.py b/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/chk_intgr_margin.py new file mode 100644 index 0000000..5761702 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/chk_intgr_margin.py @@ -0,0 +1,278 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from intgr_margin import intgr_margin + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식통합증거금 현황 [국내주식-191] +############################################################################################## + +COLUMN_MAPPING = { + 'acmga_rt': '계좌증거금율', + 'acmga_pct100_aptm_rson': '계좌증거금100퍼센트지정사유', + 'stck_cash_objt_amt': '주식현금대상금액', + 'stck_sbst_objt_amt': '주식대용대상금액', + 'stck_evlu_objt_amt': '주식평가대상금액', + 'stck_ruse_psbl_objt_amt': '주식재사용가능대상금액', + 'stck_fund_rpch_chgs_objt_amt': '주식펀드환매대금대상금액', + 'stck_fncg_rdpt_objt_atm': '주식융자상환금대상금액', + 'bond_ruse_psbl_objt_amt': '채권재사용가능대상금액', + 'stck_cash_use_amt': '주식현금사용금액', + 'stck_sbst_use_amt': '주식대용사용금액', + 'stck_evlu_use_amt': '주식평가사용금액', + 'stck_ruse_psbl_amt_use_amt': '주식재사용가능금사용금액', + 'stck_fund_rpch_chgs_use_amt': '주식펀드환매대금사용금액', + 'stck_fncg_rdpt_amt_use_amt': '주식융자상환금사용금액', + 'bond_ruse_psbl_amt_use_amt': '채권재사용가능금사용금액', + 'stck_cash_ord_psbl_amt': '주식현금주문가능금액', + 'stck_sbst_ord_psbl_amt': '주식대용주문가능금액', + 'stck_evlu_ord_psbl_amt': '주식평가주문가능금액', + 'stck_ruse_psbl_ord_psbl_amt': '주식재사용가능주문가능금액', + 'stck_fund_rpch_ord_psbl_amt': '주식펀드환매주문가능금액', + 'bond_ruse_psbl_ord_psbl_amt': '채권재사용가능주문가능금액', + 'rcvb_amt': '미수금액', + 'stck_loan_grta_ruse_psbl_amt': '주식대출보증금재사용가능금액', + 'stck_cash20_max_ord_psbl_amt': '주식현금20최대주문가능금액', + 'stck_cash30_max_ord_psbl_amt': '주식현금30최대주문가능금액', + 'stck_cash40_max_ord_psbl_amt': '주식현금40최대주문가능금액', + 'stck_cash50_max_ord_psbl_amt': '주식현금50최대주문가능금액', + 'stck_cash60_max_ord_psbl_amt': '주식현금60최대주문가능금액', + 'stck_cash100_max_ord_psbl_amt': '주식현금100최대주문가능금액', + 'stck_rsip100_max_ord_psbl_amt': '주식재사용불가100최대주문가능', + 'bond_max_ord_psbl_amt': '채권최대주문가능금액', + 'stck_fncg45_max_ord_psbl_amt': '주식융자45최대주문가능금액', + 'stck_fncg50_max_ord_psbl_amt': '주식융자50최대주문가능금액', + 'stck_fncg60_max_ord_psbl_amt': '주식융자60최대주문가능금액', + 'stck_fncg70_max_ord_psbl_amt': '주식융자70최대주문가능금액', + 'stck_stln_max_ord_psbl_amt': '주식대주최대주문가능금액', + 'lmt_amt': '한도금액', + 'ovrs_stck_itgr_mgna_dvsn_name': '해외주식통합증거금구분명', + 'usd_objt_amt': '미화대상금액', + 'usd_use_amt': '미화사용금액', + 'usd_ord_psbl_amt': '미화주문가능금액', + 'hkd_objt_amt': '홍콩달러대상금액', + 'hkd_use_amt': '홍콩달러사용금액', + 'hkd_ord_psbl_amt': '홍콩달러주문가능금액', + 'jpy_objt_amt': '엔화대상금액', + 'jpy_use_amt': '엔화사용금액', + 'jpy_ord_psbl_amt': '엔화주문가능금액', + 'cny_objt_amt': '위안화대상금액', + 'cny_use_amt': '위안화사용금액', + 'cny_ord_psbl_amt': '위안화주문가능금액', + 'usd_ruse_objt_amt': '미화재사용대상금액', + 'usd_ruse_amt': '미화재사용금액', + 'usd_ruse_ord_psbl_amt': '미화재사용주문가능금액', + 'hkd_ruse_objt_amt': '홍콩달러재사용대상금액', + 'hkd_ruse_amt': '홍콩달러재사용금액', + 'hkd_ruse_ord_psbl_amt': '홍콩달러재사용주문가능금액', + 'jpy_ruse_objt_amt': '엔화재사용대상금액', + 'jpy_ruse_amt': '엔화재사용금액', + 'jpy_ruse_ord_psbl_amt': '엔화재사용주문가능금액', + 'cny_ruse_objt_amt': '위안화재사용대상금액', + 'cny_ruse_amt': '위안화재사용금액', + 'cny_ruse_ord_psbl_amt': '위안화재사용주문가능금액', + 'usd_gnrl_ord_psbl_amt': '미화일반주문가능금액', + 'usd_itgr_ord_psbl_amt': '미화통합주문가능금액', + 'hkd_gnrl_ord_psbl_amt': '홍콩달러일반주문가능금액', + 'hkd_itgr_ord_psbl_amt': '홍콩달러통합주문가능금액', + 'jpy_gnrl_ord_psbl_amt': '엔화일반주문가능금액', + 'jpy_itgr_ord_psbl_amt': '엔화통합주문가능금액', + 'cny_gnrl_ord_psbl_amt': '위안화일반주문가능금액', + 'cny_itgr_ord_psbl_amt': '위안화통합주문가능금액', + 'stck_itgr_cash20_ord_psbl_amt': '주식통합현금20주문가능금액', + 'stck_itgr_cash30_ord_psbl_amt': '주식통합현금30주문가능금액', + 'stck_itgr_cash40_ord_psbl_amt': '주식통합현금40주문가능금액', + 'stck_itgr_cash50_ord_psbl_amt': '주식통합현금50주문가능금액', + 'stck_itgr_cash60_ord_psbl_amt': '주식통합현금60주문가능금액', + 'stck_itgr_cash100_ord_psbl_amt': '주식통합현금100주문가능금액', + 'stck_itgr_100_ord_psbl_amt': '주식통합100주문가능금액', + 'stck_itgr_fncg45_ord_psbl_amt': '주식통합융자45주문가능금액', + 'stck_itgr_fncg50_ord_psbl_amt': '주식통합융자50주문가능금액', + 'stck_itgr_fncg60_ord_psbl_amt': '주식통합융자60주문가능금액', + 'stck_itgr_fncg70_ord_psbl_amt': '주식통합융자70주문가능금액', + 'stck_itgr_stln_ord_psbl_amt': '주식통합대주주문가능금액', + 'bond_itgr_ord_psbl_amt': '채권통합주문가능금액', + 'stck_cash_ovrs_use_amt': '주식현금해외사용금액', + 'stck_sbst_ovrs_use_amt': '주식대용해외사용금액', + 'stck_evlu_ovrs_use_amt': '주식평가해외사용금액', + 'stck_re_use_amt_ovrs_use_amt': '주식재사용금액해외사용금액', + 'stck_fund_rpch_ovrs_use_amt': '주식펀드환매해외사용금액', + 'stck_fncg_rdpt_ovrs_use_amt': '주식융자상환해외사용금액', + 'bond_re_use_ovrs_use_amt': '채권재사용해외사용금액', + 'usd_oth_mket_use_amt': '미화타시장사용금액', + 'jpy_oth_mket_use_amt': '엔화타시장사용금액', + 'cny_oth_mket_use_amt': '위안화타시장사용금액', + 'hkd_oth_mket_use_amt': '홍콩달러타시장사용금액', + 'usd_re_use_oth_mket_use_amt': '미화재사용타시장사용금액', + 'jpy_re_use_oth_mket_use_amt': '엔화재사용타시장사용금액', + 'cny_re_use_oth_mket_use_amt': '위안화재사용타시장사용금액', + 'hkd_re_use_oth_mket_use_amt': '홍콩달러재사용타시장사용금액', + 'hgkg_cny_re_use_amt': '홍콩위안화재사용금액', + 'usd_frst_bltn_exrt': '미국달러최초고시환율', + 'hkd_frst_bltn_exrt': '홍콩달러최초고시환율', + 'jpy_frst_bltn_exrt': '일본엔화최초고시환율', + 'cny_frst_bltn_exrt': '중국위안화최초고시환율' +} + +NUMERIC_COLUMNS = [ + '계좌증거금율', + '주식현금대상금액', + '주식대용대상금액', + '주식평가대상금액', + '주식재사용가능대상금액', + '주식펀드환매대금대상금액', + '주식융자상환금대상금액', + '채권재사용가능대상금액', + '주식현금사용금액', + '주식대용사용금액', + '주식평가사용금액', + '주식재사용가능금사용금액', + '주식펀드환매대금사용금액', + '주식융자상환금사용금액', + '채권재사용가능금사용금액', + '주식현금주문가능금액', + '주식대용주문가능금액', + '주식평가주문가능금액', + '주식재사용가능주문가능금액', + '주식펀드환매주문가능금액', + '채권재사용가능주문가능금액', + '미수금액', + '주식대출보증금재사용가능금액', + '주식현금20최대주문가능금액', + '주식현금30최대주문가능금액', + '주식현금40최대주문가능금액', + '주식현금50최대주문가능금액', + '주식현금60최대주문가능금액', + '주식현금100최대주문가능금액', + '주식재사용불가100최대주문가능', + '채권최대주문가능금액', + '주식융자45최대주문가능금액', + '주식융자50최대주문가능금액', + '주식융자60최대주문가능금액', + '주식융자70최대주문가능금액', + '주식대주최대주문가능금액', + '한도금액', + '미화대상금액', + '미화사용금액', + '미화주문가능금액', + '홍콩달러대상금액', + '홍콩달러사용금액', + '홍콩달러주문가능금액', + '엔화대상금액', + '엔화사용금액', + '엔화주문가능금액', + '위안화대상금액', + '위안화사용금액', + '위안화주문가능금액', + '미화재사용대상금액', + '미화재사용금액', + '미화재사용주문가능금액', + '홍콩달러재사용대상금액', + '홍콩달러재사용금액', + '홍콩달러재사용주문가능금액', + '엔화재사용대상금액', + '엔화재사용금액', + '엔화재사용주문가능금액', + '위안화재사용대상금액', + '위안화재사용금액', + '위안화재사용주문가능금액', + '미화일반주문가능금액', + '미화통합주문가능금액', + '홍콩달러일반주문가능금액', + '홍콩달러통합주문가능금액', + '엔화일반주문가능금액', + '엔화통합주문가능금액', + '위안화일반주문가능금액', + '위안화통합주문가능금액', + '주식통합현금20주문가능금액', + '주식통합현금30주문가능금액', + '주식통합현금40주문가능금액', + '주식통합현금50주문가능금액', + '주식통합현금60주문가능금액', + '주식통합현금100주문가능금액', + '주식통합100주문가능금액', + '주식통합융자45주문가능금액', + '주식통합융자50주문가능금액', + '주식통합융자60주문가능금액', + '주식통합융자70주문가능금액', + '주식통합대주주문가능금액', + '채권통합주문가능금액', + '주식현금해외사용금액', + '주식대용해외사용금액', + '주식평가해외사용금액', + '주식재사용금액해외사용금액', + '주식펀드환매해외사용금액', + '주식융자상환해외사용금액', + '채권재사용해외사용금액', + '미화타시장사용금액', + '엔화타시장사용금액', + '위안화타시장사용금액', + '홍콩달러타시장사용금액', + '미화재사용타시장사용금액', + '엔화재사용타시장사용금액', + '위안화재사용타시장사용금액', + '홍콩달러재사용타시장사용금액', + '홍콩위안화재사용금액', + '미국달러최초고시환율', + '홍콩달러최초고시환율', + '일본엔화최초고시환율', + '중국위안화최초고시환율' +] + + +def main(): + """ + 주식통합증거금 현황 조회 테스트 함수 + + 이 함수는 주식통합증거금 현황 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = intgr_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, cma_evlu_amt_icld_yn="N", wcrc_frcr_dvsn_cd="01", + fwex_ctrt_frcr_dvsn_cd="01") + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/intgr_margin.py b/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/intgr_margin.py new file mode 100644 index 0000000..bb3525e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intgr_margin/intgr_margin.py @@ -0,0 +1,85 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식통합증거금 현황 [국내주식-191] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/intgr-margin" + +def intgr_margin( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + cma_evlu_amt_icld_yn: str, # [필수] CMA평가금액포함여부 (ex. Y: 포함, N: 미포함) + wcrc_frcr_dvsn_cd: str, # [필수] 원화외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + fwex_ctrt_frcr_dvsn_cd: str # [필수] 선도환계약외화구분코드 (ex. 01: 외화기준, 02: 원화기준) +) -> pd.DataFrame: + """ + 주식통합증거금 현황 API입니다. + 한국투자 HTS(eFriend Plus) > [0867] 통합증거금조회 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 해당 화면은 일반계좌와 통합증거금 신청계좌에 대해서 국내 및 해외 주문가능금액을 간단하게 조회하는 화면입니다. + ※ 해외 국가별 상세한 증거금현황을 원하시면 [해외주식] 주문/계좌 > 해외증거금 통화별조회 API를 이용하여 주시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y: 포함, N: 미포함) + wcrc_frcr_dvsn_cd (str): [필수] 원화외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + fwex_ctrt_frcr_dvsn_cd (str): [필수] 선도환계약외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + + Returns: + pd.DataFrame: 주식통합증거금 현황 데이터 + + Example: + >>> df = intgr_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, cma_evlu_amt_icld_yn="N", wcrc_frcr_dvsn_cd="01", fwex_ctrt_frcr_dvsn_cd="01") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y' or 'N')") + + if wcrc_frcr_dvsn_cd == "": + raise ValueError("wcrc_frcr_dvsn_cd is required (e.g. '01' or '02')") + + if fwex_ctrt_frcr_dvsn_cd == "": + raise ValueError("fwex_ctrt_frcr_dvsn_cd is required (e.g. '01' or '02')") + + tr_id = "TTTC0869R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "FWEX_CTRT_FRCR_DVSN_CD": fwex_ctrt_frcr_dvsn_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/chk_intstock_grouplist.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/chk_intstock_grouplist.py new file mode 100644 index 0000000..c88aa87 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/chk_intstock_grouplist.py @@ -0,0 +1,73 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from intstock_grouplist import intstock_grouplist + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹조회 [국내주식-204] +############################################################################################## + +COLUMN_MAPPING = { + 'date': '일자', + 'trnm_hour': '전송 시간', + 'data_rank': '데이터 순위', + 'inter_grp_code': '관심 그룹 코드', + 'inter_grp_name': '관심 그룹 명', + 'ask_cnt': '요청 개수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 관심종목 그룹조회 테스트 함수 + + 이 함수는 관심종목 그룹조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result = intstock_grouplist(type="1", fid_etc_cls_code="00", user_id=trenv.my_htsid) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/intstock_grouplist.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/intstock_grouplist.py new file mode 100644 index 0000000..50f3d86 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_grouplist/intstock_grouplist.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹조회 [국내주식-204] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/intstock-grouplist" + +def intstock_grouplist( + type: str, # [필수] 관심종목구분코드 (ex. 1) + fid_etc_cls_code: str, # [필수] FID 기타 구분 코드 (ex. 00) + user_id: str # [필수] 사용자 ID +) -> pd.DataFrame: + """ + 관심종목 그룹조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + type (str): [필수] 관심종목구분코드 (ex. 1) + fid_etc_cls_code (str): [필수] FID 기타 구분 코드 (ex. 00) + user_id (str): [필수] 사용자 ID + + Returns: + pd.DataFrame: 관심종목 그룹 정보를 담은 DataFrame + + Example: + >>> df = intstock_grouplist(type="1", fid_etc_cls_code="00", user_id=trenv.my_htsid) + >>> print(df) + """ + + if type == "": + raise ValueError("type is required (e.g. '1')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '00')") + + if user_id == "": + raise ValueError("user_id is required") + + tr_id = "HHKCM113004C7" # 관심종목 그룹조회 + + params = { + "TYPE": type, # 관심종목구분코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code, # FID 기타 구분 코드 + "USER_ID": user_id # 사용자 ID + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/chk_intstock_multprice.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/chk_intstock_multprice.py new file mode 100644 index 0000000..d2e5fba --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/chk_intstock_multprice.py @@ -0,0 +1,103 @@ +""" +Created on 20250101 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from intstock_multprice import intstock_multprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목(멀티종목) 시세조회 [국내주식-205] +############################################################################################## + +COLUMN_MAPPING = { + 'kospi_kosdaq_cls_name': '코스피 코스닥 구분 명', + 'mrkt_trtm_cls_name': '시장 조치 구분 명', + 'hour_cls_code': '시간 구분 코드', + 'inter_shrn_iscd': '관심 단축 종목코드', + 'inter_kor_isnm': '관심 한글 종목명', + 'inter2_prpr': '관심2 현재가', + 'inter2_prdy_vrss': '관심2 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'inter2_oprc': '관심2 시가', + 'inter2_hgpr': '관심2 고가', + 'inter2_lwpr': '관심2 저가', + 'inter2_llam': '관심2 하한가', + 'inter2_mxpr': '관심2 상한가', + 'inter2_askp': '관심2 매도호가', + 'inter2_bidp': '관심2 매수호가', + 'seln_rsqn': '매도 잔량', + 'shnu_rsqn': '매수2 잔량', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'acml_tr_pbmn': '누적 거래 대금', + 'inter2_prdy_clpr': '관심2 전일 종가', + 'oprc_vrss_hgpr_rate': '시가 대비 최고가 비율', + 'intr_antc_cntg_vrss': '관심 예상 체결 대비', + 'intr_antc_cntg_vrss_sign': '관심 예상 체결 대비 부호', + 'intr_antc_cntg_prdy_ctrt': '관심 예상 체결 전일 대비율', + 'intr_antc_vol': '관심 예상 거래량', + 'inter2_sdpr': '관심2 기준가' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 관심종목(멀티종목) 시세조회 테스트 함수 + + 이 함수는 관심종목(멀티종목) 시세조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 419530, 092070을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = intstock_multprice( + fid_cond_mrkt_div_code_1="J", + fid_input_iscd_1="419530", + fid_cond_mrkt_div_code_2="J", + fid_input_iscd_2="092070" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/intstock_multprice.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/intstock_multprice.py new file mode 100644 index 0000000..8da7768 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_multprice/intstock_multprice.py @@ -0,0 +1,309 @@ +""" +Created on 20250101 +""" + + +import sys +import logging +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목(멀티종목) 시세조회 [국내주식-205] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/intstock-multprice" + +def intstock_multprice( + fid_cond_mrkt_div_code_1: str, # [필수] 조건 시장 분류 코드1 (ex. J) + fid_input_iscd_1: str, # [필수] 입력 종목코드1 (ex. 123456) + fid_cond_mrkt_div_code_2: Optional[str] = None, # 조건 시장 분류 코드2 + fid_input_iscd_2: Optional[str] = None, # 입력 종목코드2 + fid_cond_mrkt_div_code_3: Optional[str] = None, # 조건 시장 분류 코드3 + fid_input_iscd_3: Optional[str] = None, # 입력 종목코드3 + fid_cond_mrkt_div_code_4: Optional[str] = None, # 조건 시장 분류 코드4 + fid_input_iscd_4: Optional[str] = None, # 입력 종목코드4 + fid_cond_mrkt_div_code_5: Optional[str] = None, # 조건 시장 분류 코드5 + fid_input_iscd_5: Optional[str] = None, # 입력 종목코드5 + fid_cond_mrkt_div_code_6: Optional[str] = None, # 조건 시장 분류 코드6 + fid_input_iscd_6: Optional[str] = None, # 입력 종목코드6 + fid_cond_mrkt_div_code_7: Optional[str] = None, # 조건 시장 분류 코드7 + fid_input_iscd_7: Optional[str] = None, # 입력 종목코드7 + fid_cond_mrkt_div_code_8: Optional[str] = None, # 조건 시장 분류 코드8 + fid_input_iscd_8: Optional[str] = None, # 입력 종목코드8 + fid_cond_mrkt_div_code_9: Optional[str] = None, # 조건 시장 분류 코드9 + fid_input_iscd_9: Optional[str] = None, # 입력 종목코드9 + fid_cond_mrkt_div_code_10: Optional[str] = None, # 조건 시장 분류 코드10 + fid_input_iscd_10: Optional[str] = None, # 입력 종목코드10 + fid_cond_mrkt_div_code_11: Optional[str] = None, # 조건 시장 분류 코드11 + fid_input_iscd_11: Optional[str] = None, # 입력 종목코드11 + fid_cond_mrkt_div_code_12: Optional[str] = None, # 조건 시장 분류 코드12 + fid_input_iscd_12: Optional[str] = None, # 입력 종목코드12 + fid_cond_mrkt_div_code_13: Optional[str] = None, # 조건 시장 분류 코드13 + fid_input_iscd_13: Optional[str] = None, # 입력 종목코드13 + fid_cond_mrkt_div_code_14: Optional[str] = None, # 조건 시장 분류 코드14 + fid_input_iscd_14: Optional[str] = None, # 입력 종목코드14 + fid_cond_mrkt_div_code_15: Optional[str] = None, # 조건 시장 분류 코드15 + fid_input_iscd_15: Optional[str] = None, # 입력 종목코드15 + fid_cond_mrkt_div_code_16: Optional[str] = None, # 조건 시장 분류 코드16 + fid_input_iscd_16: Optional[str] = None, # 입력 종목코드16 + fid_cond_mrkt_div_code_17: Optional[str] = None, # 조건 시장 분류 코드17 + fid_input_iscd_17: Optional[str] = None, # 입력 종목코드17 + fid_cond_mrkt_div_code_18: Optional[str] = None, # 조건 시장 분류 코드18 + fid_input_iscd_18: Optional[str] = None, # 입력 종목코드18 + fid_cond_mrkt_div_code_19: Optional[str] = None, # 조건 시장 분류 코드19 + fid_input_iscd_19: Optional[str] = None, # 입력 종목코드19 + fid_cond_mrkt_div_code_20: Optional[str] = None, # 조건 시장 분류 코드20 + fid_input_iscd_20: Optional[str] = None, # 입력 종목코드20 + fid_cond_mrkt_div_code_21: Optional[str] = None, # 조건 시장 분류 코드21 + fid_input_iscd_21: Optional[str] = None, # 입력 종목코드21 + fid_cond_mrkt_div_code_22: Optional[str] = None, # 조건 시장 분류 코드22 + fid_input_iscd_22: Optional[str] = None, # 입력 종목코드22 + fid_cond_mrkt_div_code_23: Optional[str] = None, # 조건 시장 분류 코드23 + fid_input_iscd_23: Optional[str] = None, # 입력 종목코드23 + fid_cond_mrkt_div_code_24: Optional[str] = None, # 조건 시장 분류 코드24 + fid_input_iscd_24: Optional[str] = None, # 입력 종목코드24 + fid_cond_mrkt_div_code_25: Optional[str] = None, # 조건 시장 분류 코드25 + fid_input_iscd_25: Optional[str] = None, # 입력 종목코드25 + fid_cond_mrkt_div_code_26: Optional[str] = None, # 조건 시장 분류 코드26 + fid_input_iscd_26: Optional[str] = None, # 입력 종목코드26 + fid_cond_mrkt_div_code_27: Optional[str] = None, # 조건 시장 분류 코드27 + fid_input_iscd_27: Optional[str] = None, # 입력 종목코드27 + fid_cond_mrkt_div_code_28: Optional[str] = None, # 조건 시장 분류 코드28 + fid_input_iscd_28: Optional[str] = None, # 입력 종목코드28 + fid_cond_mrkt_div_code_29: Optional[str] = None, # 조건 시장 분류 코드29 + fid_input_iscd_29: Optional[str] = None, # 입력 종목코드29 + fid_cond_mrkt_div_code_30: Optional[str] = None, # 조건 시장 분류 코드30 + fid_input_iscd_30: Optional[str] = None # 입력 종목코드30 +) -> pd.DataFrame: + """ + 관심종목(멀티종목) 시세조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + 그룹별종목조회 결과를 아래와 같이 입력하셔서 총 30종목까지 복수종목 조회 가능합니다.(아래 Example 참고) + . fid_mrkt_cls_code(시장구분) → FID_COND_MRKT_DIV_CODE_1 + . jong_code(종목코드) 1 → FID_INPUT_ISCD_1 + ... + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + fid_cond_mrkt_div_code_1 (str): [필수] 조건 시장 분류 코드1 (J:KRX, NX:NXT) + fid_input_iscd_1 (str): [필수] 입력 종목코드1 (ex. 123456) + fid_cond_mrkt_div_code_2 (Optional[str]): 조건 시장 분류 코드2 + fid_input_iscd_2 (Optional[str]): 입력 종목코드2 + fid_cond_mrkt_div_code_3 (Optional[str]): 조건 시장 분류 코드3 + fid_input_iscd_3 (Optional[str]): 입력 종목코드3 + fid_cond_mrkt_div_code_4 (Optional[str]): 조건 시장 분류 코드4 + fid_input_iscd_4 (Optional[str]): 입력 종목코드4 + fid_cond_mrkt_div_code_5 (Optional[str]): 조건 시장 분류 코드5 + fid_input_iscd_5 (Optional[str]): 입력 종목코드5 + fid_cond_mrkt_div_code_6 (Optional[str]): 조건 시장 분류 코드6 + fid_input_iscd_6 (Optional[str]): 입력 종목코드6 + fid_cond_mrkt_div_code_7 (Optional[str]): 조건 시장 분류 코드7 + fid_input_iscd_7 (Optional[str]): 입력 종목코드7 + fid_cond_mrkt_div_code_8 (Optional[str]): 조건 시장 분류 코드8 + fid_input_iscd_8 (Optional[str]): 입력 종목코드8 + fid_cond_mrkt_div_code_9 (Optional[str]): 조건 시장 분류 코드9 + fid_input_iscd_9 (Optional[str]): 입력 종목코드9 + fid_cond_mrkt_div_code_10 (Optional[str]): 조건 시장 분류 코드10 + fid_input_iscd_10 (Optional[str]): 입력 종목코드10 + fid_cond_mrkt_div_code_11 (Optional[str]): 조건 시장 분류 코드11 + fid_input_iscd_11 (Optional[str]): 입력 종목코드11 + fid_cond_mrkt_div_code_12 (Optional[str]): 조건 시장 분류 코드12 + fid_input_iscd_12 (Optional[str]): 입력 종목코드12 + fid_cond_mrkt_div_code_13 (Optional[str]): 조건 시장 분류 코드13 + fid_input_iscd_13 (Optional[str]): 입력 종목코드13 + fid_cond_mrkt_div_code_14 (Optional[str]): 조건 시장 분류 코드14 + fid_input_iscd_14 (Optional[str]): 입력 종목코드14 + fid_cond_mrkt_div_code_15 (Optional[str]): 조건 시장 분류 코드15 + fid_input_iscd_15 (Optional[str]): 입력 종목코드15 + fid_cond_mrkt_div_code_16 (Optional[str]): 조건 시장 분류 코드16 + fid_input_iscd_16 (Optional[str]): 입력 종목코드16 + fid_cond_mrkt_div_code_17 (Optional[str]): 조건 시장 분류 코드17 + fid_input_iscd_17 (Optional[str]): 입력 종목코드17 + fid_cond_mrkt_div_code_18 (Optional[str]): 조건 시장 분류 코드18 + fid_input_iscd_18 (Optional[str]): 입력 종목코드18 + fid_cond_mrkt_div_code_19 (Optional[str]): 조건 시장 분류 코드19 + fid_input_iscd_19 (Optional[str]): 입력 종목코드19 + fid_cond_mrkt_div_code_20 (Optional[str]): 조건 시장 분류 코드20 + fid_input_iscd_20 (Optional[str]): 입력 종목코드20 + fid_cond_mrkt_div_code_21 (Optional[str]): 조건 시장 분류 코드21 + fid_input_iscd_21 (Optional[str]): 입력 종목코드21 + fid_cond_mrkt_div_code_22 (Optional[str]): 조건 시장 분류 코드22 + fid_input_iscd_22 (Optional[str]): 입력 종목코드22 + fid_cond_mrkt_div_code_23 (Optional[str]): 조건 시장 분류 코드23 + fid_input_iscd_23 (Optional[str]): 입력 종목코드23 + fid_cond_mrkt_div_code_24 (Optional[str]): 조건 시장 분류 코드24 + fid_input_iscd_24 (Optional[str]): 입력 종목코드24 + fid_cond_mrkt_div_code_25 (Optional[str]): 조건 시장 분류 코드25 + fid_input_iscd_25 (Optional[str]): 입력 종목코드25 + fid_cond_mrkt_div_code_26 (Optional[str]): 조건 시장 분류 코드26 + fid_input_iscd_26 (Optional[str]): 입력 종목코드26 + fid_cond_mrkt_div_code_27 (Optional[str]): 조건 시장 분류 코드27 + fid_input_iscd_27 (Optional[str]): 입력 종목코드27 + fid_cond_mrkt_div_code_28 (Optional[str]): 조건 시장 분류 코드28 + fid_input_iscd_28 (Optional[str]): 입력 종목코드28 + fid_cond_mrkt_div_code_29 (Optional[str]): 조건 시장 분류 코드29 + fid_input_iscd_29 (Optional[str]): 입력 종목코드29 + fid_cond_mrkt_div_code_30 (Optional[str]): 조건 시장 분류 코드30 + fid_input_iscd_30 (Optional[str]): 입력 종목코드30 + + Returns: + pd.DataFrame: 관심종목(멀티종목) 시세 데이터 + + Example: + >>> df = intstock_multprice(fid_cond_mrkt_div_code_1="J", fid_input_iscd_1="419530") + >>> print(df) + """ + + if fid_cond_mrkt_div_code_1 == "": + raise ValueError("fid_cond_mrkt_div_code_1 is required (e.g. 'J')") + + if fid_input_iscd_1 == "": + raise ValueError("fid_input_iscd_1 is required (e.g. '123456')") + + tr_id = "FHKST11300006" # 관심종목(멀티종목) 시세조회 + + params = { + "FID_COND_MRKT_DIV_CODE_1": fid_cond_mrkt_div_code_1, + "FID_INPUT_ISCD_1": fid_input_iscd_1 + } + + # 옵션 파라미터 처리 + if fid_cond_mrkt_div_code_2 is not None: + params["FID_COND_MRKT_DIV_CODE_2"] = fid_cond_mrkt_div_code_2 + if fid_input_iscd_2 is not None: + params["FID_INPUT_ISCD_2"] = fid_input_iscd_2 + if fid_cond_mrkt_div_code_3 is not None: + params["FID_COND_MRKT_DIV_CODE_3"] = fid_cond_mrkt_div_code_3 + if fid_input_iscd_3 is not None: + params["FID_INPUT_ISCD_3"] = fid_input_iscd_3 + if fid_cond_mrkt_div_code_4 is not None: + params["FID_COND_MRKT_DIV_CODE_4"] = fid_cond_mrkt_div_code_4 + if fid_input_iscd_4 is not None: + params["FID_INPUT_ISCD_4"] = fid_input_iscd_4 + if fid_cond_mrkt_div_code_5 is not None: + params["FID_COND_MRKT_DIV_CODE_5"] = fid_cond_mrkt_div_code_5 + if fid_input_iscd_5 is not None: + params["FID_INPUT_ISCD_5"] = fid_input_iscd_5 + if fid_cond_mrkt_div_code_6 is not None: + params["FID_COND_MRKT_DIV_CODE_6"] = fid_cond_mrkt_div_code_6 + if fid_input_iscd_6 is not None: + params["FID_INPUT_ISCD_6"] = fid_input_iscd_6 + if fid_cond_mrkt_div_code_7 is not None: + params["FID_COND_MRKT_DIV_CODE_7"] = fid_cond_mrkt_div_code_7 + if fid_input_iscd_7 is not None: + params["FID_INPUT_ISCD_7"] = fid_input_iscd_7 + if fid_cond_mrkt_div_code_8 is not None: + params["FID_COND_MRKT_DIV_CODE_8"] = fid_cond_mrkt_div_code_8 + if fid_input_iscd_8 is not None: + params["FID_INPUT_ISCD_8"] = fid_input_iscd_8 + if fid_cond_mrkt_div_code_9 is not None: + params["FID_COND_MRKT_DIV_CODE_9"] = fid_cond_mrkt_div_code_9 + if fid_input_iscd_9 is not None: + params["FID_INPUT_ISCD_9"] = fid_input_iscd_9 + if fid_cond_mrkt_div_code_10 is not None: + params["FID_COND_MRKT_DIV_CODE_10"] = fid_cond_mrkt_div_code_10 + if fid_input_iscd_10 is not None: + params["FID_INPUT_ISCD_10"] = fid_input_iscd_10 + if fid_cond_mrkt_div_code_11 is not None: + params["FID_COND_MRKT_DIV_CODE_11"] = fid_cond_mrkt_div_code_11 + if fid_input_iscd_11 is not None: + params["FID_INPUT_ISCD_11"] = fid_input_iscd_11 + if fid_cond_mrkt_div_code_12 is not None: + params["FID_COND_MRKT_DIV_CODE_12"] = fid_cond_mrkt_div_code_12 + if fid_input_iscd_12 is not None: + params["FID_INPUT_ISCD_12"] = fid_input_iscd_12 + if fid_cond_mrkt_div_code_13 is not None: + params["FID_COND_MRKT_DIV_CODE_13"] = fid_cond_mrkt_div_code_13 + if fid_input_iscd_13 is not None: + params["FID_INPUT_ISCD_13"] = fid_input_iscd_13 + if fid_cond_mrkt_div_code_14 is not None: + params["FID_COND_MRKT_DIV_CODE_14"] = fid_cond_mrkt_div_code_14 + if fid_input_iscd_14 is not None: + params["FID_INPUT_ISCD_14"] = fid_input_iscd_14 + if fid_cond_mrkt_div_code_15 is not None: + params["FID_COND_MRKT_DIV_CODE_15"] = fid_cond_mrkt_div_code_15 + if fid_input_iscd_15 is not None: + params["FID_INPUT_ISCD_15"] = fid_input_iscd_15 + if fid_cond_mrkt_div_code_16 is not None: + params["FID_COND_MRKT_DIV_CODE_16"] = fid_cond_mrkt_div_code_16 + if fid_input_iscd_16 is not None: + params["FID_INPUT_ISCD_16"] = fid_input_iscd_16 + if fid_cond_mrkt_div_code_17 is not None: + params["FID_COND_MRKT_DIV_CODE_17"] = fid_cond_mrkt_div_code_17 + if fid_input_iscd_17 is not None: + params["FID_INPUT_ISCD_17"] = fid_input_iscd_17 + if fid_cond_mrkt_div_code_18 is not None: + params["FID_COND_MRKT_DIV_CODE_18"] = fid_cond_mrkt_div_code_18 + if fid_input_iscd_18 is not None: + params["FID_INPUT_ISCD_18"] = fid_input_iscd_18 + if fid_cond_mrkt_div_code_19 is not None: + params["FID_COND_MRKT_DIV_CODE_19"] = fid_cond_mrkt_div_code_19 + if fid_input_iscd_19 is not None: + params["FID_INPUT_ISCD_19"] = fid_input_iscd_19 + if fid_cond_mrkt_div_code_20 is not None: + params["FID_COND_MRKT_DIV_CODE_20"] = fid_cond_mrkt_div_code_20 + if fid_input_iscd_20 is not None: + params["FID_INPUT_ISCD_20"] = fid_input_iscd_20 + if fid_cond_mrkt_div_code_21 is not None: + params["FID_COND_MRKT_DIV_CODE_21"] = fid_cond_mrkt_div_code_21 + if fid_input_iscd_21 is not None: + params["FID_INPUT_ISCD_21"] = fid_input_iscd_21 + if fid_cond_mrkt_div_code_22 is not None: + params["FID_COND_MRKT_DIV_CODE_22"] = fid_cond_mrkt_div_code_22 + if fid_input_iscd_22 is not None: + params["FID_INPUT_ISCD_22"] = fid_input_iscd_22 + if fid_cond_mrkt_div_code_23 is not None: + params["FID_COND_MRKT_DIV_CODE_23"] = fid_cond_mrkt_div_code_23 + if fid_input_iscd_23 is not None: + params["FID_INPUT_ISCD_23"] = fid_input_iscd_23 + if fid_cond_mrkt_div_code_24 is not None: + params["FID_COND_MRKT_DIV_CODE_24"] = fid_cond_mrkt_div_code_24 + if fid_input_iscd_24 is not None: + params["FID_INPUT_ISCD_24"] = fid_input_iscd_24 + if fid_cond_mrkt_div_code_25 is not None: + params["FID_COND_MRKT_DIV_CODE_25"] = fid_cond_mrkt_div_code_25 + if fid_input_iscd_25 is not None: + params["FID_INPUT_ISCD_25"] = fid_input_iscd_25 + if fid_cond_mrkt_div_code_26 is not None: + params["FID_COND_MRKT_DIV_CODE_26"] = fid_cond_mrkt_div_code_26 + if fid_input_iscd_26 is not None: + params["FID_INPUT_ISCD_26"] = fid_input_iscd_26 + if fid_cond_mrkt_div_code_27 is not None: + params["FID_COND_MRKT_DIV_CODE_27"] = fid_cond_mrkt_div_code_27 + if fid_input_iscd_27 is not None: + params["FID_INPUT_ISCD_27"] = fid_input_iscd_27 + if fid_cond_mrkt_div_code_28 is not None: + params["FID_COND_MRKT_DIV_CODE_28"] = fid_cond_mrkt_div_code_28 + if fid_input_iscd_28 is not None: + params["FID_INPUT_ISCD_28"] = fid_input_iscd_28 + if fid_cond_mrkt_div_code_29 is not None: + params["FID_COND_MRKT_DIV_CODE_29"] = fid_cond_mrkt_div_code_29 + if fid_input_iscd_29 is not None: + params["FID_INPUT_ISCD_29"] = fid_input_iscd_29 + if fid_cond_mrkt_div_code_30 is not None: + params["FID_COND_MRKT_DIV_CODE_30"] = fid_cond_mrkt_div_code_30 + if fid_input_iscd_30 is not None: + params["FID_INPUT_ISCD_30"] = fid_input_iscd_30 + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/chk_intstock_stocklist_by_group.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/chk_intstock_stocklist_by_group.py new file mode 100644 index 0000000..6b2e18d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/chk_intstock_stocklist_by_group.py @@ -0,0 +1,106 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from intstock_stocklist_by_group import intstock_stocklist_by_group + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹별 종목조회 [국내주식-203] +############################################################################################## + +COLUMN_MAPPING = { + 'fid_mrkt_cls_code': 'FID 시장 구분 코드', + 'data_rank': '데이터 순위', + 'exch_code': '거래소코드', + 'jong_code': '종목코드', + 'color_code': '생상 코드', + 'memo': '메모', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'fxdt_ntby_qty': '기준일 순매수 수량', + 'cntg_unpr': '체결단가', + 'cntg_cls_code': '체결 구분 코드' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 관심종목 그룹별 종목조회 테스트 함수 + + 이 함수는 관심종목 그룹별 종목조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # case1 테스트 + logging.info("=== case1 테스트 ===") + try: + result1, result2 = intstock_stocklist_by_group( + type="1", + user_id=trenv.my_htsid, + inter_grp_code="001", + fid_etc_cls_code="4" + ) + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + # output1 블록 + logging.info("사용 가능한 컬럼 (output1): %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'inter_grp_name': '관심 그룹 명' + } + + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 표시 (메타데이터에 number 타입 필드 없음) + NUMERIC_COLUMNS = [] + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과 (output1):") + print(result1) + + # output2 블록 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 표시 (메타데이터에 number 타입 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과 (output2):") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/intstock_stocklist_by_group.py b/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/intstock_stocklist_by_group.py new file mode 100644 index 0000000..20d2986 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/intstock_stocklist_by_group/intstock_stocklist_by_group.py @@ -0,0 +1,103 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹별 종목조회 [국내주식-203] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/intstock-stocklist-by-group" + +def intstock_stocklist_by_group( + type: str, # 관심종목구분코드 (ex. 1) + user_id: str, # 사용자 ID + inter_grp_code: str, # 관심 그룹 코드 (ex. 001) + fid_etc_cls_code: str, # 기타 구분 코드 (ex. 4) + data_rank: str = "", # 데이터 순위 + inter_grp_name: str = "", # 관심 그룹 명 + hts_kor_isnm: str = "", # HTS 한글 종목명 + cntg_cls_code: str = "" # 체결 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 관심종목 그룹별 종목조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + type (str): [필수] 관심종목구분코드 (ex. 1) + user_id (str): [필수] 사용자 ID + inter_grp_code (str): [필수] 관심 그룹 코드 (ex. 001) + fid_etc_cls_code (str): [필수] 기타 구분 코드 (ex. 4) + data_rank (str): 데이터 순위 + inter_grp_name (str): 관심 그룹 명 + hts_kor_isnm (str): HTS 한글 종목명 + cntg_cls_code (str): 체결 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = intstock_stocklist_by_group( + ... type="1", user_id=trenv.my_htsid, inter_grp_code="001", fid_etc_cls_code="4" + ... ) + >>> print(df1) + >>> print(df2) + """ + + if type == "": + raise ValueError("type is required (e.g. '1')") + + if user_id == "": + raise ValueError("user_id is required") + + if inter_grp_code == "": + raise ValueError("inter_grp_code is required (e.g. '001')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '4')") + + tr_id = "HHKCM113004C6" # 관심종목 그룹별 종목조회 + + params = { + "TYPE": type, # 관심종목구분코드 + "USER_ID": user_id, # 사용자 ID + "INTER_GRP_CODE": inter_grp_code, # 관심 그룹 코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code, # 기타 구분 코드 + "DATA_RANK": data_rank, # 데이터 순위 + "INTER_GRP_NAME": inter_grp_name, # 관심 그룹 명 + "HTS_KOR_ISNM": hts_kor_isnm, # HTS 한글 종목명 + "CNTG_CLS_CODE": cntg_cls_code # 체결 구분 코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 데이터프레임 생성 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 데이터프레임 생성 + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/chk_invest_opbysec.py b/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/chk_invest_opbysec.py new file mode 100644 index 0000000..058fecf --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/chk_invest_opbysec.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from invest_opbysec import invest_opbysec + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 증권사별 투자의견[국내주식-189] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'stck_shrn_iscd': '주식단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'invt_opnn': '투자의견', + 'invt_opnn_cls_code': '투자의견구분코드', + 'rgbf_invt_opnn': '직전투자의견', + 'rgbf_invt_opnn_cls_code': '직전투자의견구분코드', + 'stck_prpr': '주식현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'hts_goal_prc': 'HTS목표가격', + 'stck_prdy_clpr': '주식전일종가', + 'stft_esdg': '주식선물괴리도', + 'dprt': '괴리율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 국내주식 증권사별 투자의견[국내주식-189] + + 국내주식 증권사별 투자의견 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (J(시장 구분 코드)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (16634(Primary key)) + - fid_input_iscd (str): 입력종목코드 (회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조)) + - fid_div_cls_code (str): 분류구분코드 (전체(0) 매수(1) 중립(2) 매도(3)) + - fid_input_date_1 (str): 입력날짜1 (이후 ~) + - fid_input_date_2 (str): 입력날짜2 (~ 이전) + Returns: + - DataFrame: 국내주식 증권사별 투자의견 결과 + + Example: + >>> df = invest_opbysec(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="16634", fid_input_iscd="005930", fid_div_cls_code="0", fid_input_date_1="20250101", fid_input_date_2="20250131") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = invest_opbysec( + fid_cond_mrkt_div_code="J", # 조건시장분류코드 + fid_cond_scr_div_code="16634", # 조건화면분류코드 + fid_input_iscd="005930", # 입력종목코드 + fid_div_cls_code="0", # 분류구분코드 + fid_input_date_1="20250101", # 입력날짜1 + fid_input_date_2="20250131", # 입력날짜2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 증권사별 투자의견 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/invest_opbysec.py b/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/invest_opbysec.py new file mode 100644 index 0000000..ce201fa --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/invest_opbysec/invest_opbysec.py @@ -0,0 +1,158 @@ +# [국내주식] 종목정보 - 국내주식 증권사별 투자의견 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 증권사별 투자의견[국내주식-189] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/invest-opbysec" + +def invest_opbysec( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_div_cls_code: str, # 분류구분코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 증권사별 투자의견[국내주식-189] + 국내주식 증권사별 투자의견 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J(시장 구분 코드) + fid_cond_scr_div_code (str): 16634(Primary key) + fid_input_iscd (str): 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조) + fid_div_cls_code (str): 전체(0) 매수(1) 중립(2) 매도(3) + fid_input_date_1 (str): 이후 ~ + fid_input_date_2 (str): ~ 이전 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 증권사별 투자의견 데이터 + + Example: + >>> df = invest_opbysec( + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="16634", + ... fid_input_iscd="005930", + ... fid_div_cls_code="0", + ... fid_input_date_1="20230101", + ... fid_input_date_2="20231231" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '16634')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '16634')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20230101')") + raise ValueError("fid_input_date_1 is required. (e.g. '20230101')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20231231')") + raise ValueError("fid_input_date_2 is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHKST663400C0" + + # API 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return invest_opbysec( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_date_1, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/chk_invest_opinion.py b/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/chk_invest_opinion.py new file mode 100644 index 0000000..44f3bdf --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/chk_invest_opinion.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from invest_opinion import invest_opinion + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목투자의견[국내주식-188] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'invt_opnn': '투자의견', + 'invt_opnn_cls_code': '투자의견구분코드', + 'rgbf_invt_opnn': '직전투자의견', + 'rgbf_invt_opnn_cls_code': '직전투자의견구분코드', + 'hts_goal_prc': 'HTS목표가격', + 'stck_prdy_clpr': '주식전일종가', + 'stck_nday_esdg': '주식N일괴리도', + 'nday_dprt': 'N일괴리율', + 'stft_esdg': '주식선물괴리도', + 'dprt': '괴리율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 국내주식 종목투자의견[국내주식-188] + + 국내주식 종목투자의견 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (J(시장 구분 코드)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (16633(Primary key)) + - fid_input_iscd (str): 입력종목코드 (종목코드(ex) 005930(삼성전자))) + - fid_input_date_1 (str): 입력날짜1 (이후 ~(ex) 0020231113)) + - fid_input_date_2 (str): 입력날짜2 (~ 이전(ex) 0020240513)) + Returns: + - DataFrame: 국내주식 종목투자의견 결과 + + Example: + >>> df = invest_opinion(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="16633", fid_input_iscd="005930", fid_input_date_1="20231113", fid_input_date_2="20240513") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = invest_opinion( + fid_cond_mrkt_div_code="J", # 조건시장분류코드 + fid_cond_scr_div_code="16633", # 조건화면분류코드 + fid_input_iscd="005930", # 입력종목코드 + fid_input_date_1="20250101", # 입력날짜1 + fid_input_date_2="20250617", # 입력날짜2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 종목투자의견 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/invest_opinion.py b/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/invest_opinion.py new file mode 100644 index 0000000..b30c5a8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/invest_opinion/invest_opinion.py @@ -0,0 +1,150 @@ +# [국내주식] 종목정보 - 국내주식 종목투자의견 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목투자의견[국내주식-188] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/invest-opinion" + +def invest_opinion( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 종목투자의견[국내주식-188] + 국내주식 종목투자의견 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J(시장 구분 코드) + fid_cond_scr_div_code (str): 16633(Primary key) + fid_input_iscd (str): 종목코드(ex) 005930(삼성전자)) + fid_input_date_1 (str): 이후 ~(ex) 0020231113) + fid_input_date_2 (str): ~ 이전(ex) 0020240513) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 종목투자의견 데이터 + + Example: + >>> df = invest_opinion( + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="16633", + ... fid_input_iscd="005930", + ... fid_input_date_1="20231113", + ... fid_input_date_2="20240513" + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '16633')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '16633')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20231113')") + raise ValueError("fid_input_date_1 is required. (e.g. '20231113')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20240513')") + raise ValueError("fid_input_date_2 is required. (e.g. '20240513')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHKST663300C0" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return invest_opinion( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/chk_investor_program_trade_today.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/chk_investor_program_trade_today.py new file mode 100644 index 0000000..55cc0a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/chk_investor_program_trade_today.py @@ -0,0 +1,88 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from investor_program_trade_today import investor_program_trade_today + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 투자자매매동향(당일) [국내주식-116] +############################################################################################## + +COLUMN_MAPPING = { + 'invr_cls_code': '투자자코드', + 'all_seln_qty': '전체매도수량', + 'all_seln_amt': '전체매도대금', + 'invr_cls_name': '투자자 구분 명', + 'all_shnu_qty': '전체매수수량', + 'all_shnu_amt': '전체매수대금', + 'all_ntby_amt': '전체순매수대금', + 'arbt_seln_qty': '차익매도수량', + 'all_ntby_qty': '전체순매수수량', + 'arbt_shnu_qty': '차익매수수량', + 'arbt_ntby_qty': '차익순매수수량', + 'arbt_seln_amt': '차익매도대금', + 'arbt_shnu_amt': '차익매수대금', + 'arbt_ntby_amt': '차익순매수대금', + 'nabt_seln_qty': '비차익매도수량', + 'nabt_shnu_qty': '비차익매수수량', + 'nabt_ntby_qty': '비차익순매수수량', + 'nabt_seln_amt': '비차익매도대금', + 'nabt_shnu_amt': '비차익매수대금', + 'nabt_ntby_amt': '비차익순매수대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 프로그램매매 투자자매매동향(당일) 조회 테스트 함수 + + 이 함수는 프로그램매매 투자자매매동향(당일) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # Case 1: 코스피 조회 + logging.info("=== Case 1: 코스피 조회 ===") + try: + result = investor_program_trade_today(mrkt_div_cls_code="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 컬럼 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/investor_program_trade_today.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/investor_program_trade_today.py new file mode 100644 index 0000000..d001c64 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_program_trade_today/investor_program_trade_today.py @@ -0,0 +1,58 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 투자자매매동향(당일) [국내주식-116] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/investor-program-trade-today" + +def investor_program_trade_today( + mrkt_div_cls_code: str # [필수] 시장 구분 코드 (ex. 1:코스피, 4:코스닥) +) -> pd.DataFrame: + """ + 프로그램매매 투자자매매동향(당일) API입니다. + 한국투자 HTS(eFriend Plus) > [0466] 프로그램매매 투자자별 동향 화면 의 "당일동향" 표의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + mrkt_div_cls_code (str): [필수] 시장 구분 코드 (ex. 1:코스피, 4:코스닥) + + Returns: + pd.DataFrame: 프로그램매매 투자자매매동향 데이터 + + Example: + >>> df = investor_program_trade_today(mrkt_div_cls_code="1") + >>> print(df) + """ + + if mrkt_div_cls_code == "": + raise ValueError("mrkt_div_cls_code is required (e.g. '1' or '4')") + + tr_id = "HHPPG046600C1" + + params = { + "MRKT_DIV_CLS_CODE": mrkt_div_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/chk_investor_trade_by_stock_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/chk_investor_trade_by_stock_daily.py new file mode 100644 index 0000000..552224b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/chk_investor_trade_by_stock_daily.py @@ -0,0 +1,247 @@ +""" +Created on 2025-08-21 + +""" + +import sys +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 + +import logging +import pandas as pd +import kis_auth as ka +from investor_trade_by_stock_daily import investor_trade_by_stock_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +######################################################################################## +# [국내주식] 시세분석 > 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] +######################################################################################## + +COLUMN_MAPPING = { + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'rprs_mrkt_kor_name': '대표 시장 한글 명', + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'frgn_ntby_qty': '외국인 순매수 수량', + 'frgn_reg_ntby_qty': '외국인 등록 순매수 수량', + 'frgn_nreg_ntby_qty': '외국인 비등록 순매수 수량', + 'prsn_ntby_qty': '개인 순매수 수량', + 'orgn_ntby_qty': '기관계 순매수 수량', + 'scrt_ntby_qty': '증권 순매수 수량', + 'ivtr_ntby_qty': '투자신탁 순매수 수량', + 'pe_fund_ntby_vol': '사모 펀드 순매수 거래량', + 'bank_ntby_qty': '은행 순매수 수량', + 'insu_ntby_qty': '보험 순매수 수량', + 'mrbn_ntby_qty': '종금 순매수 수량', + 'fund_ntby_qty': '기금 순매수 수량', + 'etc_ntby_qty': '기타 순매수 수량', + 'etc_corp_ntby_vol': '기타 법인 순매수 거래량', + 'etc_orgt_ntby_vol': '기타 단체 순매수 거래량', + 'frgn_reg_ntby_pbmn': '외국인 등록 순매수 대금', + 'frgn_ntby_tr_pbmn': '외국인 순매수 거래 대금', + 'frgn_nreg_ntby_pbmn': '외국인 비등록 순매수 대금', + 'prsn_ntby_tr_pbmn': '개인 순매수 거래 대금', + 'orgn_ntby_tr_pbmn': '기관계 순매수 거래 대금', + 'scrt_ntby_tr_pbmn': '증권 순매수 거래 대금', + 'pe_fund_ntby_tr_pbmn': '사모 펀드 순매수 거래 대금', + 'ivtr_ntby_tr_pbmn': '투자신탁 순매수 거래 대금', + 'bank_ntby_tr_pbmn': '은행 순매수 거래 대금', + 'insu_ntby_tr_pbmn': '보험 순매수 거래 대금', + 'mrbn_ntby_tr_pbmn': '종금 순매수 거래 대금', + 'fund_ntby_tr_pbmn': '기금 순매수 거래 대금', + 'etc_ntby_tr_pbmn': '기타 순매수 거래 대금', + 'etc_corp_ntby_tr_pbmn': '기타 법인 순매수 거래 대금', + 'etc_orgt_ntby_tr_pbmn': '기타 단체 순매수 거래 대금', + 'frgn_seln_vol': '외국인 매도 거래량', + 'frgn_shnu_vol': '외국인 매수2 거래량', + 'frgn_seln_tr_pbmn': '외국인 매도 거래 대금', + 'frgn_shnu_tr_pbmn': '외국인 매수2 거래 대금', + 'frgn_reg_askp_qty': '외국인 등록 매도 수량', + 'frgn_reg_bidp_qty': '외국인 등록 매수 수량', + 'frgn_reg_askp_pbmn': '외국인 등록 매도 대금', + 'frgn_reg_bidp_pbmn': '외국인 등록 매수 대금', + 'frgn_nreg_askp_qty': '외국인 비등록 매도 수량', + 'frgn_nreg_bidp_qty': '외국인 비등록 매수 수량', + 'frgn_nreg_askp_pbmn': '외국인 비등록 매도 대금', + 'frgn_nreg_bidp_pbmn': '외국인 비등록 매수 대금', + 'prsn_seln_vol': '개인 매도 거래량', + 'prsn_shnu_vol': '개인 매수2 거래량', + 'prsn_seln_tr_pbmn': '개인 매도 거래 대금', + 'prsn_shnu_tr_pbmn': '개인 매수2 거래 대금', + 'orgn_seln_vol': '기관계 매도 거래량', + 'orgn_shnu_vol': '기관계 매수2 거래량', + 'orgn_seln_tr_pbmn': '기관계 매도 거래 대금', + 'orgn_shnu_tr_pbmn': '기관계 매수2 거래 대금', + 'scrt_seln_vol': '증권 매도 거래량', + 'scrt_shnu_vol': '증권 매수2 거래량', + 'scrt_seln_tr_pbmn': '증권 매도 거래 대금', + 'scrt_shnu_tr_pbmn': '증권 매수2 거래 대금', + 'ivtr_seln_vol': '투자신탁 매도 거래량', + 'ivtr_shnu_vol': '투자신탁 매수2 거래량', + 'ivtr_seln_tr_pbmn': '투자신탁 매도 거래 대금', + 'ivtr_shnu_tr_pbmn': '투자신탁 매수2 거래 대금', + 'pe_fund_seln_tr_pbmn': '사모 펀드 매도 거래 대금', + 'pe_fund_seln_vol': '사모 펀드 매도 거래량', + 'pe_fund_shnu_tr_pbmn': '사모 펀드 매수2 거래 대금', + 'pe_fund_shnu_vol': '사모 펀드 매수2 거래량', + 'bank_seln_vol': '은행 매도 거래량', + 'bank_shnu_vol': '은행 매수2 거래량', + 'bank_seln_tr_pbmn': '은행 매도 거래 대금', + 'bank_shnu_tr_pbmn': '은행 매수2 거래 대금', + 'insu_seln_vol': '보험 매도 거래량', + 'insu_shnu_vol': '보험 매수2 거래량', + 'insu_seln_tr_pbmn': '보험 매도 거래 대금', + 'insu_shnu_tr_pbmn': '보험 매수2 거래 대금', + 'mrbn_seln_vol': '종금 매도 거래량', + 'mrbn_shnu_vol': '종금 매수2 거래량', + 'mrbn_seln_tr_pbmn': '종금 매도 거래 대금', + 'mrbn_shnu_tr_pbmn': '종금 매수2 거래 대금', + 'fund_seln_vol': '기금 매도 거래량', + 'fund_shnu_vol': '기금 매수2 거래량', + 'fund_seln_tr_pbmn': '기금 매도 거래 대금', + 'fund_shnu_tr_pbmn': '기금 매수2 거래 대금', + 'etc_seln_vol': '기타 매도 거래량', + 'etc_shnu_vol': '기타 매수2 거래량', + 'etc_seln_tr_pbmn': '기타 매도 거래 대금', + 'etc_shnu_tr_pbmn': '기타 매수2 거래 대금', + 'etc_orgt_seln_vol': '기타 단체 매도 거래량', + 'etc_orgt_shnu_vol': '기타 단체 매수2 거래량', + 'etc_orgt_seln_tr_pbmn': '기타 단체 매도 거래 대금', + 'etc_orgt_shnu_tr_pbmn': '기타 단체 매수2 거래 대금', + 'etc_corp_seln_vol': '기타 법인 매도 거래량', + 'etc_corp_shnu_vol': '기타 법인 매수2 거래량', + 'etc_corp_seln_tr_pbmn': '기타 법인 매도 거래 대금', + 'etc_corp_shnu_tr_pbmn': '기타 법인 매수2 거래 대금', + 'bold_yn': 'BOLD 여부' +} + +NUMERIC_COLUMNS = [ + '주식 현재가', '전일 대비', '전일 대비율', '누적 거래량', '전일 거래량', '주식 종가', '누적 거래 대금', + '주식 시가2', '주식 최고가', '주식 최저가', '외국인 순매수 수량', '외국인 등록 순매수 수량', '외국인 비등록 순매수 수량', + '개인 순매수 수량', '기관계 순매수 수량', '증권 순매수 수량', '투자신탁 순매수 수량', '사모 펀드 순매수 거래량', + '은행 순매수 수량', '보험 순매수 수량', '종금 순매수 수량', '기금 순매수 수량', '기타 순매수 수량', '기타 법인 순매수 거래량', + '기타 단체 순매수 거래량', '외국인 등록 순매수 대금', '외국인 순매수 거래 대금', '외국인 비등록 순매수 대금', + '개인 순매수 거래 대금', '기관계 순매수 거래 대금', '증권 순매수 거래 대금', '사모 펀드 순매수 거래 대금', + '투자신탁 순매수 거래 대금', '은행 순매수 거래 대금', '보험 순매수 거래 대금', '종금 순매수 거래 대금', + '기금 순매수 거래 대금', '기타 순매수 거래 대금', '기타 법인 순매수 거래 대금', '기타 단체 순매수 거래 대금', + '외국인 매도 거래량', '외국인 매수2 거래량', '외국인 매도 거래 대금', '외국인 매수2 거래 대금', '외국인 등록 매도 수량', + '외국인 등록 매수 수량', '외국인 등록 매도 대금', '외국인 등록 매수 대금', '외국인 비등록 매도 수량', + '외국인 비등록 매수 수량', '외국인 비등록 매도 대금', '외국인 비등록 매수 대금', '개인 매도 거래량', '개인 매수2 거래량', + '개인 매도 거래 대금', '개인 매수2 거래 대금', '기관계 매도 거래량', '기관계 매수2 거래량', '기관계 매도 거래 대금', + '기관계 매수2 거래 대금', '증권 매도 거래량', '증권 매수2 거래량', '증권 매도 거래 대금', '증권 매수2 거래 대금', + '투자신탁 매도 거래량', '투자신탁 매수2 거래량', '투자신탁 매도 거래 대금', '투자신탁 매수2 거래 대금', + '사모 펀드 매도 거래 대금', '사모 펀드 매도 거래량', '사모 펀드 매수2 거래 대금', '사모 펀드 매수2 거래량', + '은행 매도 거래량', '은행 매수2 거래량', '은행 매도 거래 대금', '은행 매수2 거래 대금', '보험 매도 거래량', + '보험 매수2 거래량', '보험 매도 거래 대금', '보험 매수2 거래 대금', '종금 매도 거래량', '종금 매수2 거래량', + '종금 매도 거래 대금', '종금 매수2 거래 대금', '기금 매도 거래량', '기금 매수2 거래량', '기금 매도 거래 대금', + '기금 매수2 거래 대금', '기타 매도 거래량', '기타 매수2 거래량', '기타 매도 거래 대금', '기타 매수2 거래 대금', + '기타 단체 매도 거래량', '기타 단체 매수2 거래량', '기타 단체 매도 거래 대금', '기타 단체 매수2 거래 대금', + '기타 법인 매도 거래량', '기타 법인 매수2 거래량', '기타 법인 매도 거래 대금', '기타 법인 매수2 거래 대금' +] + +def main(): + """ + [국내주식] 시세분석 + 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] + + 종목별 투자자매매동향(일별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + - fid_input_iscd (str): 입력 종목코드 (종목번호 (6자리)) + - fid_input_date_1 (str): 입력 날짜1 (입력 날짜(20250812)) + - fid_org_adj_prc (str): 수정주가 원주가 가격 (공란 입력) + - fid_etc_cls_code (str): 기타 구분 코드 (공란 입력) + + Returns: + - DataFrame: 종목별 투자자매매동향(일별) 결과 + + Example: + >>> df1, df2 = investor_trade_by_stock_daily(fid_cond_mrkt_div_code="J", fid_input_iscd="005930", fid_input_date_1="20250812", fid_org_adj_prc="", fid_etc_cls_code="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 및 다중 output 결과 처리 + logger.info("API 호출 시작: 종목별 투자자매매동향(일별)") + result1, result2 = investor_trade_by_stock_daily( + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_input_iscd="005930", # 입력 종목코드 + fid_input_date_1="20250812", # 입력 날짜1 + fid_org_adj_prc="", # 수정주가 원주가 가격 + fid_etc_cls_code="", # 기타 구분 코드 + ) + + if result1 is None or result2 is None: + logger.error("API 호출 결과가 None입니다.") + return + + # output1 결과 처리 + logger.info("=== output1 결과 ===") + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 안전한 컬럼명 매핑 + available_cols1 = {k: v for k, v in COLUMN_MAPPING.items() if k in result1.columns} + result1 = result1.rename(columns=available_cols1) + + # 숫자형 컬럼 변환 및 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + try: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + except Exception as e: + logger.warning("컬럼 %s 변환 실패: %s", col, str(e)) + + logger.info("결과:") + print(result1) + + # output2 결과 처리 + logger.info("=== output2 결과 ===") + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 안전한 컬럼명 매핑 + available_cols2 = {k: v for k, v in COLUMN_MAPPING.items() if k in result2.columns} + result2 = result2.rename(columns=available_cols2) + + # 숫자형 컬럼 변환 및 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + try: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + except Exception as e: + logger.warning("컬럼 %s 변환 실패: %s", col, str(e)) + + logger.info("결과(output2):") + print(result2) + + return result1, result2 + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/investor_trade_by_stock_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/investor_trade_by_stock_daily.py new file mode 100644 index 0000000..9b970af --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_trade_by_stock_daily/investor_trade_by_stock_daily.py @@ -0,0 +1,156 @@ +""" +Created on 2025-08-21 + +""" + +import logging +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +######################################################################################## +# [국내주식] 시세분석 > 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] +######################################################################################## + +API_URL = "/uapi/domestic-stock/v1/quotations/investor-trade-by-stock-daily" + +def investor_trade_by_stock_daily( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_input_date_1: str, # 입력 날짜1 + fid_org_adj_prc: str, # 수정주가 원주가 가격 + fid_etc_cls_code: str, # 기타 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 시세분석 + 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] + 종목별 투자자매매동향(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J:KRX, NX:NXT, UN:통합 + fid_input_iscd (str): 종목번호 (6자리) + fid_input_date_1 (str): 입력 날짜(20250812) + fid_org_adj_prc (str): 공란 입력 + fid_etc_cls_code (str): 공란 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 종목별 투자자매매동향(일별) 데이터 + + Example: + >>> df1, df2 = investor_trade_by_stock_daily( + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_date_1="20250812", + ... fid_org_adj_prc="", + ... fid_etc_cls_code="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20250812')") + raise ValueError("fid_input_date_1 is required. (e.g. '20250812')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPTJ04160001" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_ORG_ADJ_PRC": fid_org_adj_prc, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return investor_trade_by_stock_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_org_adj_prc, + fid_etc_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/chk_investor_trend_estimate.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/chk_investor_trend_estimate.py new file mode 100644 index 0000000..8f02e1f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/chk_investor_trend_estimate.py @@ -0,0 +1,73 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from investor_trend_estimate import investor_trend_estimate + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외인기관 추정가집계[v1_국내주식-046] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_hour_gb': '입력구분', + 'frgn_fake_ntby_qty': '외국인수량(가집계)', + 'orgn_fake_ntby_qty': '기관수량(가집계)', + 'sum_fake_ntby_qty': '합산수량(가집계)' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별 외인기관 추정가집계 조회 테스트 함수 + + 이 함수는 종목별 외인기관 추정가집계 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + logging.info("=== 종목별 외인기관 추정가집계 조회 ===") + try: + result = investor_trend_estimate(mksc_shrn_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/investor_trend_estimate.py b/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/investor_trend_estimate.py new file mode 100644 index 0000000..45c3bf6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/investor_trend_estimate/investor_trend_estimate.py @@ -0,0 +1,63 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외인기관 추정가집계[v1_국내주식-046] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/investor-trend-estimate" + +def investor_trend_estimate( + mksc_shrn_iscd: str # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 종목별 외국인, 기관 추정가집계 API입니다. + + 한국투자 MTS > 국내 현재가 > 투자자 > 투자자동향 탭 > 왼쪽구분을 '추정(주)'로 선택 시 확인 가능한 데이터를 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 증권사 직원이 장중에 집계/입력한 자료를 단순 누계한 수치로서, + 입력시간은 외국인 09:30, 11:20, 13:20, 14:30 / 기관종합 10:00, 11:20, 13:20, 14:30 이며, 사정에 따라 변동될 수 있습니다. + + Args: + mksc_shrn_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 종목별 외인기관 추정가집계 데이터 + + Example: + >>> df = investor_trend_estimate(mksc_shrn_iscd="005930") + >>> print(df) + """ + + if mksc_shrn_iscd == "": + raise ValueError("mksc_shrn_iscd is required (ex. '123456')") + + tr_id = "HHPTJ04160200" + + params = { + "MKSC_SHRN_ISCD": mksc_shrn_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/chk_ksdinfo_bonus_issue.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/chk_ksdinfo_bonus_issue.py new file mode 100644 index 0000000..2c2c294 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/chk_ksdinfo_bonus_issue.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_bonus_issue import ksdinfo_bonus_issue + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(무상증자일정)[국내주식-144] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'fix_rate': '확정배정율', + 'odd_rec_price': '단주기준가', + 'right_dt': '권리락일', + 'odd_pay_dt': '단주대금지급일', + 'list_date': '상장/등록일', + 'tot_issue_stk_qty': '발행주식', + 'issue_stk_qty': '발행할주식', + 'stk_kind': '주식종류' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(무상증자일정)[국내주식-144] + + 예탁원정보(무상증자일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + Returns: + - DataFrame: 예탁원정보(무상증자일정) 결과 + + Example: + >>> df = ksdinfo_bonus_issue(cts="", f_dt="20250101", t_dt="20250131", sht_cd="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_bonus_issue( + cts="", # CTS + f_dt="20250101", # 조회일자From + t_dt="20250131", # 조회일자To + sht_cd="", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(무상증자일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/ksdinfo_bonus_issue.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/ksdinfo_bonus_issue.py new file mode 100644 index 0000000..ac20ed6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_bonus_issue/ksdinfo_bonus_issue.py @@ -0,0 +1,124 @@ +# [국내주식] 종목정보 - 예탁원정보(무상증자일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(무상증자일정)[국내주식-144] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/bonus-issue" + +def ksdinfo_bonus_issue( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(무상증자일정)[국내주식-144] + 예탁원정보(무상증자일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(무상증자일정) 데이터 + + Example: + >>> df = ksdinfo_bonus_issue(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669101C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_bonus_issue( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/chk_ksdinfo_cap_dcrs.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/chk_ksdinfo_cap_dcrs.py new file mode 100644 index 0000000..cdbb250 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/chk_ksdinfo_cap_dcrs.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka + +from ksdinfo_cap_dcrs import ksdinfo_cap_dcrs + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(자본감소일정) [국내주식-149] +############################################################################################## + +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'stk_kind': '주식종류', + 'reduce_cap_type': '감자구분', + 'reduce_cap_rate': '감자배정율', + 'comp_way': '계산방법', + 'td_stop_dt': '매매거래정지기간', + 'list_dt': '상장/등록일' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(자본감소일정)[국내주식-149] + + 예탁원정보(자본감소일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + Returns: + - DataFrame: 예탁원정보(자본감소일정) 결과 + + Example: + >>> df = ksdinfo_cap_dcrs(cts="", f_dt="20250101", t_dt="20250131", sht_cd="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_cap_dcrs( + cts="", # CTS + f_dt="20250101", # 조회일자From + t_dt="20250131", # 조회일자To + sht_cd="", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(자본감소일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/ksdinfo_cap_dcrs.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/ksdinfo_cap_dcrs.py new file mode 100644 index 0000000..02923f7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_cap_dcrs/ksdinfo_cap_dcrs.py @@ -0,0 +1,120 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(자본감소일정) [국내주식-149] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/cap-dcrs" + +def ksdinfo_cap_dcrs( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(자본감소일정)[국내주식-149] + 예탁원정보(자본감소일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(자본감소일정) 데이터 + + Example: + >>> df = ksdinfo_cap_dcrs(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669106C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_cap_dcrs( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/chk_ksdinfo_dividend.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/chk_ksdinfo_dividend.py new file mode 100644 index 0000000..695c1d0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/chk_ksdinfo_dividend.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_dividend import ksdinfo_dividend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(배당일정)[국내주식-145] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'divi_kind': '배당종류', + 'face_val': '액면가', + 'per_sto_divi_amt': '현금배당금', + 'divi_rate': '현금배당률(%)', + 'stk_divi_rate': '주식배당률(%)', + 'divi_pay_dt': '배당금지급일', + 'stk_div_pay_dt': '주식배당지급일', + 'odd_pay_dt': '단주대금지급일', + 'stk_kind': '주식종류', + 'high_divi_gb': '고배당종목여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(배당일정)[국내주식-145] + + 예탁원정보(배당일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - gb1 (str): 조회구분 (0:배당전체, 1:결산배당, 2:중간배당) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - high_gb (str): 고배당여부 (공백) + Returns: + - DataFrame: 예탁원정보(배당일정) 결과 + + Example: + >>> df = ksdinfo_dividend(cts="", gb1="0", f_dt="20250101", t_dt="20250131", sht_cd="", high_gb="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_dividend( + cts="", # CTS + gb1="0", # 조회구분 + f_dt="20250101", # 조회일자From + t_dt="20250131", # 조회일자To + sht_cd="", # 종목코드 + high_gb="", # 고배당여부 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(배당일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/ksdinfo_dividend.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/ksdinfo_dividend.py new file mode 100644 index 0000000..7025d09 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_dividend/ksdinfo_dividend.py @@ -0,0 +1,138 @@ +# [국내주식] 종목정보 - 예탁원정보(배당일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(배당일정)[국내주식-145] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/dividend" + +def ksdinfo_dividend( + cts: str, # CTS + gb1: str, # 조회구분 + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + high_gb: str, # 고배당여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(배당일정)[국내주식-145] + 예탁원정보(배당일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + gb1 (str): 0:배당전체, 1:결산배당, 2:중간배당 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + high_gb (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(배당일정) 데이터 + + Example: + >>> df = ksdinfo_dividend(" ", "0", "20230101", "20231231", " ", " ") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '0')") + raise ValueError("gb1 is required. (e.g. '0')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669102C0" + + params = { + "CTS": cts, + "GB1": gb1, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + "HIGH_GB": high_gb, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_dividend( + cts, + gb1, + f_dt, + t_dt, + sht_cd, + high_gb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/chk_ksdinfo_forfeit.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/chk_ksdinfo_forfeit.py new file mode 100644 index 0000000..874002c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/chk_ksdinfo_forfeit.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_forfeit import ksdinfo_forfeit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(실권주일정)[국내주식-152] +############################################################################################## + +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'subscr_dt': '청약일', + 'subscr_price': '공모가', + 'subscr_stk_qty': '공모주식수', + 'refund_dt': '환불일', + 'list_dt': '상장/등록일', + 'lead_mgr': '주간사' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(실권주일정)[국내주식-152] + + 예탁원정보(실권주일정) 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - t_dt (str): 조회일자To (~ 일자) + - f_dt (str): 조회일자From (일자 ~) + - cts (str): CTS (공백) + Returns: + - DataFrame: 예탁원정보(실권주일정) 결과 + + Example: + >>> df = ksdinfo_forfeit(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_forfeit( + sht_cd="", # 종목코드 + t_dt="20250617", # 조회일자To + f_dt="20240101", # 조회일자From + cts="", # CTS + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(실권주일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/ksdinfo_forfeit.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/ksdinfo_forfeit.py new file mode 100644 index 0000000..9178695 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_forfeit/ksdinfo_forfeit.py @@ -0,0 +1,123 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(실권주일정)[국내주식-152] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/forfeit" + +def ksdinfo_forfeit( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(실권주일정)[국내주식-152] + 예탁원정보(실권주일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(실권주일정) 데이터 + + Example: + >>> df = ksdinfo_forfeit("001440", "20240315", "20240314", " ") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20240315')") + raise ValueError("t_dt is required. (e.g. '20240315')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20240314')") + raise ValueError("f_dt is required. (e.g. '20240314')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669109C0" + + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_forfeit( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/chk_ksdinfo_list_info.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/chk_ksdinfo_list_info.py new file mode 100644 index 0000000..ac7b0fd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/chk_ksdinfo_list_info.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka + +from ksdinfo_list_info import ksdinfo_list_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(상장정보일정)[국내주식-150] +############################################################################################## + +COLUMN_MAPPING = { + 'list_dt': '상장/등록일', + 'sht_cd': '종목코드', + 'stk_kind': '주식종류', + 'issue_type': '사유', + 'issue_stk_qty': '상장주식수', + 'tot_issue_stk_qty': '총발행주식수', + 'issue_price': '발행가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(상장정보일정)[국내주식-150] + + 예탁원정보(상장정보일정) 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - t_dt (str): 조회일자To (~ 일자) + - f_dt (str): 조회일자From (일자 ~) + - cts (str): CTS (공백) + Returns: + - DataFrame: 예탁원정보(상장정보일정) 결과 + + Example: + >>> df = ksdinfo_list_info(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_list_info( + sht_cd="", # 종목코드 + t_dt="20250131", # 조회일자To + f_dt="20250101", # 조회일자From + cts="", # CTS + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(상장정보일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/ksdinfo_list_info.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/ksdinfo_list_info.py new file mode 100644 index 0000000..4e9c08f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_list_info/ksdinfo_list_info.py @@ -0,0 +1,124 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(상장정보일정)[국내주식-150] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/list-info" + +def ksdinfo_list_info( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(상장정보일정)[국내주식-150] + 예탁원정보(상장정보일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(상장정보일정) 데이터 + + Example: + >>> df = ksdinfo_list_info("000660", "20231010", "20231001", "") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20231010')") + raise ValueError("t_dt is required. (e.g. '20231010')") + if not f_dt: + logger.error("f_dt is required. (e.g. '20231001')") + raise ValueError("f_dt is required. (e.g. '20231001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 ID 설정 + + tr_id = "HHKDB669107C0" + + # 요청 파라미터 설정 + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_list_info( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/chk_ksdinfo_mand_deposit.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/chk_ksdinfo_mand_deposit.py new file mode 100644 index 0000000..2c7c837 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/chk_ksdinfo_mand_deposit.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_mand_deposit import ksdinfo_mand_deposit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(의무예치일정) [국내주식-153] +############################################################################################## + +COLUMN_MAPPING = { + 'sht_cd': '종목코드', + 'stk_qty': '주식수', + 'depo_date': '예치일', + 'depo_reason': '사유', + 'tot_issue_qty_per_rate': '총발행주식수대비비율(%)' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(의무예치일정)[국내주식-153] + + 예탁원정보(의무예치일정) 테스트 함수 + + Parameters: + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - f_dt (str): 조회일자From (일자 ~) + - cts (str): CTS (공백) + Returns: + - DataFrame: 예탁원정보(의무예치일정) 결과 + + Example: + >>> df = ksdinfo_mand_deposit(t_dt="20250131", sht_cd="", f_dt="20250101", cts="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_mand_deposit( + t_dt="20250131", # 조회일자To + sht_cd="", # 종목코드 + f_dt="20250101", # 조회일자From + cts="", # CTS + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(의무예치일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/ksdinfo_mand_deposit.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/ksdinfo_mand_deposit.py new file mode 100644 index 0000000..64ffafd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_mand_deposit/ksdinfo_mand_deposit.py @@ -0,0 +1,128 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(의무예치일정) [국내주식-153] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/mand-deposit" + +def ksdinfo_mand_deposit( + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(의무예치일정)[국내주식-153] + 예탁원정보(의무예치일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + t_dt (str): 조회 종료 일자 (예: '20230301') + sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + f_dt (str): 조회 시작 일자 (예: '20230101') + cts (str): CTS (공백) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(의무예치일정) 데이터 + + Example: + >>> df = ksdinfo_mand_deposit('20230301', '005930', '20230101', '') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20230301')") + raise ValueError("t_dt is required. (e.g. '20230301')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "HHKDB669110C0" + + # 요청 파라미터 설정 + params = { + "T_DT": t_dt, + "SHT_CD": sht_cd, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_mand_deposit( + t_dt, + sht_cd, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/chk_ksdinfo_merger_split.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/chk_ksdinfo_merger_split.py new file mode 100644 index 0000000..bcee422 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/chk_ksdinfo_merger_split.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_merger_split import ksdinfo_merger_split + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(합병_분할일정)[국내주식-147] +############################################################################################## + +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'opp_cust_cd': '피합병(피분할)회사코드', + 'opp_cust_nm': '피합병(피분할)회사명', + 'cust_cd': '합병(분할)회사코드', + 'cust_nm': '합병(분할)회사명', + 'merge_type': '합병사유', + 'merge_rate': '비율', + 'td_stop_dt': '매매거래정지기간', + 'list_dt': '상장/등록일', + 'odd_amt_pay_dt': '단주대금지급일', + 'tot_issue_stk_qty': '발행주식', + 'issue_stk_qty': '발행할주식', + 'seq': '연번' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(합병_분할일정)[국내주식-147] + + 예탁원정보(합병_분할일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + Returns: + - DataFrame: 예탁원정보(합병_분할일정) 결과 + + Example: + >>> df = ksdinfo_merger_split(cts="", f_dt="20230101", t_dt="20231231", sht_cd="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_merger_split( + cts="", # CTS + f_dt="20230101", # 조회일자From + t_dt="20231231", # 조회일자To + sht_cd="", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(합병_분할일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/ksdinfo_merger_split.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/ksdinfo_merger_split.py new file mode 100644 index 0000000..e87dbc7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_merger_split/ksdinfo_merger_split.py @@ -0,0 +1,122 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(합병_분할일정)[국내주식-147] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/merger-split" + +def ksdinfo_merger_split( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(합병_분할일정)[국내주식-147] + 예탁원정보(합병_분할일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(합병_분할일정) 데이터 + + Example: + >>> df = ksdinfo_merger_split(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669104C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_merger_split( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/chk_ksdinfo_paidin_capin.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/chk_ksdinfo_paidin_capin.py new file mode 100644 index 0000000..006372d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/chk_ksdinfo_paidin_capin.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_paidin_capin import ksdinfo_paidin_capin + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(유상증자일정)[국내주식-143] +############################################################################################## + +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'tot_issue_stk_qty': '발행주식', + 'issue_stk_qty': '발행할주식', + 'fix_rate': '확정배정율', + 'disc_rate': '할인율', + 'fix_price': '발행예정가', + 'right_dt': '권리락일', + 'sub_term_ft': '청약기간', + 'sub_term': '청약기간', + 'list_date': '상장/등록일', + 'stk_kind': '주식종류' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(유상증자일정)[국내주식-143] + + 예탁원정보(유상증자일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - gb1 (str): 조회구분 (1(청약일별), 2(기준일별)) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백(전체), 특정종목 조회시(종목코드)) + Returns: + - DataFrame: 예탁원정보(유상증자일정) 결과 + + Example: + >>> df = ksdinfo_paidin_capin(cts="", gb1="1", f_dt="20250101", t_dt="20250101", sht_cd="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_paidin_capin( + cts="", # CTS + gb1="1", # 조회구분 + f_dt="20230301", # 조회일자From + t_dt="20240326", # 조회일자To + sht_cd="", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(유상증자일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/ksdinfo_paidin_capin.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/ksdinfo_paidin_capin.py new file mode 100644 index 0000000..a5bdb59 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_paidin_capin/ksdinfo_paidin_capin.py @@ -0,0 +1,126 @@ +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(유상증자일정)[국내주식-143] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/paidin-capin" + +def ksdinfo_paidin_capin( + cts: str, # CTS + gb1: str, # 조회구분 + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(유상증자일정)[국내주식-143] + 예탁원정보(유상증자일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + gb1 (str): 1(청약일별), 2(기준일별) + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백(전체), 특정종목 조회시(종목코드) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(유상증자일정) 데이터 + + Example: + >>> df = ksdinfo_paidin_capin(" ", "1", "20230101", "20231231", " ") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '1')") + raise ValueError("gb1 is required. (e.g. '1')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669100C0" + + params = { + "CTS": cts, + "GB1": gb1, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_paidin_capin( + cts, + gb1, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/chk_ksdinfo_pub_offer.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/chk_ksdinfo_pub_offer.py new file mode 100644 index 0000000..e9f6f63 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/chk_ksdinfo_pub_offer.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_pub_offer import ksdinfo_pub_offer + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(공모주청약일정)[국내주식-151] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'fix_subscr_pri': '공모가', + 'face_value': '액면가', + 'subscr_dt': '청약기간', + 'pay_dt': '납입일', + 'refund_dt': '환불일', + 'list_dt': '상장/등록일', + 'lead_mgr': '주간사', + 'pub_bf_cap': '공모전자본금', + 'pub_af_cap': '공모후자본금', + 'assign_stk_qty': '당사배정물량' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(공모주청약일정)[국내주식-151] + + 예탁원정보(공모주청약일정) 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + Returns: + - DataFrame: 예탁원정보(공모주청약일정) 결과 + + Example: + >>> df = ksdinfo_pub_offer(sht_cd="", cts="", f_dt="20250101", t_dt="20250131") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_pub_offer( + sht_cd="", # 종목코드 + cts="", # CTS + f_dt="20250101", # 조회일자From + t_dt="20250131", # 조회일자To + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(공모주청약일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/ksdinfo_pub_offer.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/ksdinfo_pub_offer.py new file mode 100644 index 0000000..c6fdd69 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_pub_offer/ksdinfo_pub_offer.py @@ -0,0 +1,121 @@ +# [국내주식] 종목정보 - 예탁원정보(공모주청약일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(공모주청약일정)[국내주식-151] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/pub-offer" + +def ksdinfo_pub_offer( + sht_cd: str, # 종목코드 + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(공모주청약일정)[국내주식-151] + 예탁원정보(공모주청약일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(공모주청약일정) 데이터 + + Example: + >>> df = ksdinfo_pub_offer("000000", "", "20230101", "20231231") + >>> print(df) + """ + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669108C0" + + params = { + "SHT_CD": sht_cd, + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_pub_offer( + sht_cd, + cts, + f_dt, + t_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/chk_ksdinfo_purreq.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/chk_ksdinfo_purreq.py new file mode 100644 index 0000000..43669ca --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/chk_ksdinfo_purreq.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_purreq import ksdinfo_purreq + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주식매수청구일정)[국내주식-146] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'stk_kind': '주식종류', + 'opp_opi_rcpt_term': '반대의사접수시한', + 'buy_req_rcpt_term': '매수청구접수시한', + 'buy_req_price': '매수청구가격', + 'buy_amt_pay_dt': '매수대금지급일', + 'meet_dt': '주총일' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(주식매수청구일정)[국내주식-146] + + 예탁원정보(주식매수청구일정) 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - t_dt (str): 조회일자To (~ 일자) + - f_dt (str): 조회일자From (일자 ~) + - cts (str): CTS (공백) + Returns: + - DataFrame: 예탁원정보(주식매수청구일정) 결과 + + Example: + >>> df = ksdinfo_purreq(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_purreq( + sht_cd="", # 종목코드 + t_dt="20250131", # 조회일자To + f_dt="20250101", # 조회일자From + cts="", # CTS + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(주식매수청구일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/ksdinfo_purreq.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/ksdinfo_purreq.py new file mode 100644 index 0000000..6156f62 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_purreq/ksdinfo_purreq.py @@ -0,0 +1,126 @@ +# [국내주식] 종목정보 - 예탁원정보(주식매수청구일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주식매수청구일정)[국내주식-146] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/purreq" + +def ksdinfo_purreq( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(주식매수청구일정)[국내주식-146] + 예탁원정보(주식매수청구일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(주식매수청구일정) 데이터 + + Example: + >>> df = ksdinfo_purreq("005930", "20231010", "20231001", "") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20231010')") + raise ValueError("t_dt is required. (e.g. '20231010')") + if not f_dt: + logger.error("f_dt is required. (e.g. '20231001')") + raise ValueError("f_dt is required. (e.g. '20231001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669103C0" + + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_purreq( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/chk_ksdinfo_rev_split.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/chk_ksdinfo_rev_split.py new file mode 100644 index 0000000..f8eb3c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/chk_ksdinfo_rev_split.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_rev_split import ksdinfo_rev_split + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(액면교체일정)[국내주식-148] +############################################################################################## + +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'inter_bf_face_amt': '변경전액면가', + 'inter_af_face_amt': '변경후액면가', + 'td_stop_dt': '매매거래정지기간', + 'list_dt': '상장/등록일' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(액면교체일정)[국내주식-148] + + 예탁원정보(액면교체일정) 테스트 함수 + + Parameters: + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - market_gb (str): 시장구분 (0:전체, 1:코스피, 2:코스닥) + Returns: + - DataFrame: 예탁원정보(액면교체일정) 결과 + + Example: + >>> df = ksdinfo_rev_split(sht_cd="", cts="", f_dt="20250101", t_dt="20250131", market_gb="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_rev_split( + sht_cd="", # 종목코드 + cts="", # CTS + f_dt="20250101", # 조회일자From + t_dt="20250131", # 조회일자To + market_gb="0", # 시장구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(액면교체일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/ksdinfo_rev_split.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/ksdinfo_rev_split.py new file mode 100644 index 0000000..d8d8a56 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_rev_split/ksdinfo_rev_split.py @@ -0,0 +1,132 @@ +# [국내주식] 종목정보 - 예탁원정보(액면교체일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(액면교체일정)[국내주식-148] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/rev-split" + +def ksdinfo_rev_split( + sht_cd: str, # 종목코드 + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + market_gb: str, # 시장구분 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(액면교체일정)[국내주식-148] + 예탁원정보(액면교체일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + market_gb (str): 0:전체, 1:코스피, 2:코스닥 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(액면교체일정) 데이터 + + Example: + >>> df = ksdinfo_rev_split("001390", "", "20230101", "20231231", "0") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + if market_gb not in ["0", "1", "2"]: + logger.error("market_gb must be one of ['0', '1', '2'].") + raise ValueError("market_gb must be one of ['0', '1', '2'].") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669105C0" + + params = { + "SHT_CD": sht_cd, + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "MARKET_GB": market_gb, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_rev_split( + sht_cd, + cts, + f_dt, + t_dt, + market_gb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/chk_ksdinfo_sharehld_meet.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/chk_ksdinfo_sharehld_meet.py new file mode 100644 index 0000000..d415c43 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/chk_ksdinfo_sharehld_meet.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from ksdinfo_sharehld_meet import ksdinfo_sharehld_meet + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주주총회일정)[국내주식-154] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'record_date': '기준일', + 'sht_cd': '종목코드', + 'gen_meet_dt': '주총일자', + 'gen_meet_type': '주총사유', + 'agenda': '주총의안', + 'vote_tot_qty': '의결권주식총수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 예탁원정보(주주총회일정)[국내주식-154] + + 예탁원정보(주주총회일정) 테스트 함수 + + Parameters: + - cts (str): CTS (공백) + - f_dt (str): 조회일자From (일자 ~) + - t_dt (str): 조회일자To (~ 일자) + - sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + Returns: + - DataFrame: 예탁원정보(주주총회일정) 결과 + + Example: + >>> df = ksdinfo_sharehld_meet(cts="", f_dt="20230101", t_dt="20231231", sht_cd="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result = ksdinfo_sharehld_meet( + cts="", # CTS + f_dt="20230101", # 조회일자From + t_dt="20231231", # 조회일자To + sht_cd="", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 예탁원정보(주주총회일정) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/ksdinfo_sharehld_meet.py b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/ksdinfo_sharehld_meet.py new file mode 100644 index 0000000..8118fac --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/ksdinfo_sharehld_meet/ksdinfo_sharehld_meet.py @@ -0,0 +1,122 @@ +# [국내주식] 종목정보 - 예탁원정보(주주총회일정) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주주총회일정)[국내주식-154] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ksdinfo/sharehld-meet" + +def ksdinfo_sharehld_meet( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(주주총회일정)[국내주식-154] + 예탁원정보(주주총회일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(주주총회일정) 데이터 + + Example: + >>> df = ksdinfo_sharehld_meet(" ", "20230101", "20231231", " ") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "HHKDB669111C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_sharehld_meet( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/chk_lendable_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/chk_lendable_by_company.py new file mode 100644 index 0000000..8c037dc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/chk_lendable_by_company.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from lendable_by_company import lendable_by_company + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 당사 대주가능 종목 [국내주식-195] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'papr': '액면가', + 'bfdy_clpr': '전일종가', + 'sbst_prvs': '대용가', + 'lmt_qty1': '한도수량1', + 'use_qty1': '사용수량1', + 'trad_psbl_qty2': '매매가능수량2', + 'rght_type_cd': '권리유형코드', + 'bass_dt': '기준일자', + 'psbl_yn': '가능여부', + 'tot_stup_lmt_qty': '총설정한도수량', + 'brch_lmt_qty': '지점한도수량', + 'rqst_psbl_qty': '신청가능수량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 종목정보 + 당사 대주가능 종목[국내주식-195] + + 당사 대주가능 종목 테스트 함수 + + Parameters: + - excg_dvsn_cd (str): 거래소구분코드 (00(전체), 02(거래소), 03(코스닥)) + - pdno (str): 상품번호 (공백 : 전체조회, 종목코드 입력 시 해당종목만 조회) + - thco_stln_psbl_yn (str): 당사대주가능여부 (Y) + - inqr_dvsn_1 (str): 조회구분1 (0 : 전체조회, 1: 종목코드순 정렬) + - ctx_area_fk200 (str): 연속조회검색조건200 (미입력 (다음조회 불가)) + - ctx_area_nk100 (str): 연속조회키100 (미입력 (다음조회 불가)) + + Returns: + - Tuple[DataFrame, ...]: 당사 대주가능 종목 결과 + + Example: + >>> df1, df2 = lendable_by_company(excg_dvsn_cd="00", pdno="", thco_stln_psbl_yn="Y", inqr_dvsn_1="0", ctx_area_fk200="", ctx_area_nk100="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = lendable_by_company( + excg_dvsn_cd="00", # 거래소구분코드 + pdno="", # 상품번호 + thco_stln_psbl_yn="Y", # 당사대주가능여부 + inqr_dvsn_1="0", # 조회구분1 + ctx_area_fk200="", # 연속조회검색조건200 + ctx_area_nk100="", # 연속조회키100 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/lendable_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/lendable_by_company.py new file mode 100644 index 0000000..579f788 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/lendable_by_company/lendable_by_company.py @@ -0,0 +1,166 @@ +# [국내주식] 종목정보 - 당사 대주가능 종목 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 당사 대주가능 종목 [국내주식-195] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/lendable-by-company" + +def lendable_by_company( + excg_dvsn_cd: str, # 거래소구분코드 + pdno: str, # 상품번호 + thco_stln_psbl_yn: str, # 당사대주가능여부 + inqr_dvsn_1: str, # 조회구분1 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk100: str, # 연속조회키100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 종목정보 + 당사 대주가능 종목[국내주식-195] + 당사 대주가능 종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excg_dvsn_cd (str): 00(전체), 02(거래소), 03(코스닥) + pdno (str): 공백 : 전체조회, 종목코드 입력 시 해당종목만 조회 + thco_stln_psbl_yn (str): Y + inqr_dvsn_1 (str): 0 : 전체조회, 1: 종목코드순 정렬 + ctx_area_fk200 (str): 미입력 (다음조회 불가) + ctx_area_nk100 (str): 미입력 (다음조회 불가) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 당사 대주가능 종목 데이터 + + Example: + >>> df1, df2 = lendable_by_company('00', '', 'Y', '0', '', '') + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excg_dvsn_cd: + logger.error("excg_dvsn_cd is required. (e.g. '00')") + raise ValueError("excg_dvsn_cd is required. (e.g. '00')") + + if not thco_stln_psbl_yn: + logger.error("thco_stln_psbl_yn is required. (e.g. 'Y')") + raise ValueError("thco_stln_psbl_yn is required. (e.g. 'Y')") + + if not inqr_dvsn_1: + logger.error("inqr_dvsn_1 is required. (e.g. '0')") + raise ValueError("inqr_dvsn_1 is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTSC2702R" + + params = { + "EXCG_DVSN_CD": excg_dvsn_cd, + "PDNO": pdno, + "THCO_STLN_PSBL_YN": thco_stln_psbl_yn, + "INQR_DVSN_1": inqr_dvsn_1, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK100": ctx_area_nk100, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return lendable_by_company( + excg_dvsn_cd, + pdno, + thco_stln_psbl_yn, + inqr_dvsn_1, + ctx_area_fk200, + ctx_area_nk100, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_cap/chk_market_cap.py b/한국투자증권(API)/examples_llm/domestic_stock/market_cap/chk_market_cap.py new file mode 100644 index 0000000..5f0b452 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_cap/chk_market_cap.py @@ -0,0 +1,93 @@ +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from market_cap import market_cap + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시가총액 상위 [v1_국내주식-091] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'lstn_stcn': '상장 주수', + 'stck_avls': '시가 총액', + 'mrkt_whol_avls_rlim': '시장 전체 시가총액 비중' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 시가총액 상위[v1_국내주식-091] + + 국내주식 시가총액 상위 테스트 함수 + + Parameters: + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20174 )) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체, 1:보통주, 2:우선주) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + Returns: + - DataFrame: 국내주식 시가총액 상위 결과 + + Example: + >>> df = market_cap(fid_input_price_2="1000000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20174", fid_div_cls_code="0", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="50000", fid_vol_cnt="1000") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + # API 호출 + result = market_cap( + fid_input_price_2="1000000", # 입력 가격2, + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드, + fid_cond_scr_div_code="20174", # 조건 화면 분류 코드, + fid_div_cls_code="0", # 분류 구분 코드, + fid_input_iscd="0000", # 입력 종목코드, + fid_trgt_cls_code="0", # 대상 구분 코드, + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드, + fid_input_price_1="50000", # 입력 가격1, + fid_vol_cnt="1000", # 거래량 수 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 시가총액 상위 결과 ===") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_cap/market_cap.py b/한국투자증권(API)/examples_llm/domestic_stock/market_cap/market_cap.py new file mode 100644 index 0000000..1bbd719 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_cap/market_cap.py @@ -0,0 +1,133 @@ +# DOMSTK_RANK - 국내주식 시가총액 상위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시가총액 상위 [v1_국내주식-091] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/market-cap" + +def market_cap( + fid_input_price_2: str, # 입력 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시가총액 상위[v1_국내주식-091] + 국내주식 시가총액 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20174 ) + fid_div_cls_code (str): 0: 전체, 1:보통주, 2:우선주 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 시가총액 상위 데이터 + + Example: + >>> df = market_cap( + ... fid_input_price_2="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20174", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_vol_cnt="" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20174": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01740000" + + params = { + "fid_input_price_2": fid_input_price_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_vol_cnt": fid_vol_cnt, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + current_data = pd.DataFrame(res.getBody().output) if hasattr(res.getBody(), 'output') else pd.DataFrame() + + # 기존 데이터프레임과 병합 + dataframe = pd.concat([dataframe, current_data], ignore_index=True) if dataframe is not None else current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return market_cap( + fid_input_price_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_vol_cnt, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 출력 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/chk_market_status_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/chk_market_status_krx.py new file mode 100644 index 0000000..054de79 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/chk_market_status_krx.py @@ -0,0 +1,100 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from market_status_krx import market_status_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보 (KRX) [실시간-049] +############################################################################################## + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "trht_yn": "거래정지여부", + "tr_susp_reas_cntt": "거래정지사유내용", + "mkop_cls_code": "장운영구분코드", + "antc_mkop_cls_code": "예상장운영구분코드", + "mrkt_trtm_cls_code": "임의연장구분코드", + "divi_app_cls_code": "동시호가배분처리구분코드", + "iscd_stat_cls_code": "종목상태구분코드", + "vi_cls_code": "VI적용구분코드", + "ovtm_vi_cls_code": "시간외단일가VI적용구분코드", + "EXCH_CLS_CODE": "거래소구분코드" +} +NUMERIC_COLUMNS = ["유가증권단축종목코드"] # 예시로 숫자형 변환이 필요한 컬럼 추가 + +def main(): + """ + 국내주식 장운영정보 (KRX) + + 국내주식 장운영정보 연결 시, 연결종목의 VI 발동 시와 VI 해제 시에 데이터 수신됩니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=market_status_krx, data=["417450","308100"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/market_status_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/market_status_krx.py new file mode 100644 index 0000000..d2c2f16 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_krx/market_status_krx.py @@ -0,0 +1,73 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보 (KRX) [실시간-049] +############################################################################################## + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +def market_status_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (KRX)[H0STMKO0] 실시간 데이터 구독 함수 + 이 함수는 국내주식 장운영정보를 실시간으로 구독하거나 구독 해제합니다. + 연결된 종목의 VI 발동 시와 VI 해제 시에 데이터가 수신됩니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 서버로부터 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_krx("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STMKO0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", # 유가증권단축종목코드 + "trht_yn", # 거래정지여부 + "tr_susp_reas_cntt", # 거래정지사유내용 + "mkop_cls_code", # 장운영구분코드 + "antc_mkop_cls_code", # 예상장운영구분코드 + "mrkt_trtm_cls_code", # 임의연장구분코드 + "divi_app_cls_code", # 동시호가배분처리구분코드 + "iscd_stat_cls_code", # 종목상태구분코드 + "vi_cls_code", # VI적용구분코드 + "ovtm_vi_cls_code", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소구분코드 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/chk_market_status_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/chk_market_status_nxt.py new file mode 100644 index 0000000..7941de7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/chk_market_status_nxt.py @@ -0,0 +1,82 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from market_status_nxt import market_status_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(NXT) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "종목코드", + "TRHT_YN": "거래정지 여부", + "TR_SUSP_REAS_CNTT": "거래 정지 사유 내용", + "MKOP_CLS_CODE": "장운영 구분 코드", + "ANTC_MKOP_CLS_CODE": "예상 장운영 구분 코드", + "MRKT_TRTM_CLS_CODE": "임의연장구분코드", + "DIVI_APP_CLS_CODE": "동시호가배분처리구분코드", + "ISCD_STAT_CLS_CODE": "종목상태구분코드", + "VI_CLS_CODE": "VI적용구분코드", + "OVTM_VI_CLS_CODE": "시간외단일가VI적용구분코드", + "EXCH_CLS_CODE": "거래소 구분코드" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 장운영정보 (NXT) + + 국내주식 장운영정보 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=market_status_nxt, data=["006220"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/market_status_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/market_status_nxt.py new file mode 100644 index 0000000..db20578 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_nxt/market_status_nxt.py @@ -0,0 +1,74 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(NXT) +############################################################################################## + +def market_status_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (NXT)[H0NXMKO0] + 실시간으로 국내주식 장운영정보를 구독하거나 구독 해제하는 웹소켓 API입니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 서버로부터 실시간 데이터가 지속적으로 전송됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXMKO0" + + params = { + "tr_key": tr_key, + } + + # 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 종목코드 + "TRHT_YN", # 거래정지 여부 + "TR_SUSP_REAS_CNTT", # 거래 정지 사유 내용 + "MKOP_CLS_CODE", # 장운영 구분 코드 + "ANTC_MKOP_CLS_CODE", # 예상 장운영 구분 코드 + "MRKT_TRTM_CLS_CODE", # 임의연장구분코드 + "DIVI_APP_CLS_CODE", # 동시호가배분처리구분코드 + "ISCD_STAT_CLS_CODE", # 종목상태구분코드 + "VI_CLS_CODE", # VI적용구분코드 + "OVTM_VI_CLS_CODE", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소 구분코드 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/chk_market_status_total.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/chk_market_status_total.py new file mode 100644 index 0000000..2a34a84 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/chk_market_status_total.py @@ -0,0 +1,80 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from market_status_total import market_status_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(통합) +############################################################################################## + +COLUMN_MAPPING = { + "TRHT_YN": "거래정지 여부", + "TR_SUSP_REAS_CNTT": "거래 정지 사유 내용", + "MKOP_CLS_CODE": "장운영 구분 코드", + "ANTC_MKOP_CLS_CODE": "예상 장운영 구분 코드", + "MRKT_TRTM_CLS_CODE": "임의연장구분코드", + "DIVI_APP_CLS_CODE": "동시호가배분처리구분코드", + "ISCD_STAT_CLS_CODE": "종목상태구분코드", + "VI_CLS_CODE": "VI적용구분코드", + "OVTM_VI_CLS_CODE": "시간외단일가VI적용구분코드", + "EXCH_CLS_CODE": "거래소 구분코드" +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 장운영정보 (통합) + + 국내주식 장운영정보 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=market_status_total, data=["158430"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/market_status_total.py b/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/market_status_total.py new file mode 100644 index 0000000..ec7d8f9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_status_total/market_status_total.py @@ -0,0 +1,73 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(통합) +############################################################################################## + +def market_status_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (통합)[H0UNMKO0] 실시간 데이터 구독 함수 + 이 함수는 웹소켓을 통해 실시간으로 국내주식 장운영정보를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 구독할 종목의 고유 코드 + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 수신된 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독하므로, 지속적인 데이터 수신이 가능합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UNMKO0" + + params = { + "tr_key": tr_key, + } + + # kis 모듈을 사용하여 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "TRHT_YN", # 거래정지 여부 + "TR_SUSP_REAS_CNTT", # 거래 정지 사유 내용 + "MKOP_CLS_CODE", # 장운영 구분 코드 + "ANTC_MKOP_CLS_CODE", # 예상 장운영 구분 코드 + "MRKT_TRTM_CLS_CODE", # 임의연장구분코드 + "DIVI_APP_CLS_CODE", # 동시호가배분처리구분코드 + "ISCD_STAT_CLS_CODE", # 종목상태구분코드 + "VI_CLS_CODE", # VI적용구분코드 + "OVTM_VI_CLS_CODE", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소 구분코드 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_time/chk_market_time.py b/한국투자증권(API)/examples_llm/domestic_stock/market_time/chk_market_time.py new file mode 100644 index 0000000..d1333dc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_time/chk_market_time.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from market_time import market_time + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160] +############################################################################################## + +COLUMN_MAPPING = { + 'date1': '영업일1', + 'date2': '영업일2', + 'date3': '영업일3', + 'date4': '영업일4', + 'date5': '영업일5', + 'today': '오늘일자', + 'time': '현재시간', + 's_time': '장시작시간', + 'e_time': '장마감시간' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 국내선물 영업일조회 테스트 함수 + + 이 함수는 국내선물 영업일조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = market_time() + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_time/market_time.py b/한국투자증권(API)/examples_llm/domestic_stock/market_time/market_time.py new file mode 100644 index 0000000..9c5aee4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_time/market_time.py @@ -0,0 +1,48 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/market-time" + +def market_time() -> pd.DataFrame: + """ + 국내선물 영업일조회 API입니다. + API호출 시 body 혹은 params로 입력하는 사항이 없습니다. + + Returns: + pd.DataFrame: 국내선물 영업일조회 데이터 + + Example: + >>> df = market_time() + >>> print(df) + """ + + tr_id = "HHMCM000002C0" # 국내선물 영업일조회 + + params = {} + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + result = pd.DataFrame([res.getBody().output1]) + return result + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_value/chk_market_value.py b/한국투자증권(API)/examples_llm/domestic_stock/market_value/chk_market_value.py new file mode 100644 index 0000000..1a1788f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_value/chk_market_value.py @@ -0,0 +1,110 @@ +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from market_value import market_value + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시장가치 순위[v1_국내주식-096] +############################################################################################## + +COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'per': 'PER', + 'pbr': 'PBR', + 'pcr': 'PCR', + 'psr': 'PSR', + 'eps': 'EPS', + 'eva': 'EVA', + 'ebitda': 'EBITDA', + 'pv_div_ebitda': 'PV DIV EBITDA', + 'ebitda_div_fnnc_expn': 'EBITDA DIV 금융비용', + 'stac_month': '결산 월', + 'stac_month_cls_code': '결산 월 구분 코드', + 'iqry_csnu': '조회 건수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 시장가치 순위[v1_국내주식-096] + + 국내주식 시장가치 순위 테스트 함수 + + Parameters: + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20179 )) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보톧주, 7:우선주) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_input_option_1 (str): 입력 옵션1 (회계연도 입력 (ex 2023)) + - fid_input_option_2 (str): 입력 옵션2 (0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 ('가치분석(23:PER, 24:PBR, 25:PCR, 26:PSR, 27: EPS, 28:EVA, 29: EBITDA, 30: EV/EBITDA, 31:EBITDA/금융비율') + - fid_blng_cls_code (str): 소속 구분 코드 (0 : 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + Returns: + - DataFrame: 국내주식 시장가치 순위 결과 + + Example: + >>> df = market_value(fid_trgt_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20179", fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="0", fid_rank_sort_cls_code="23", fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + # API 호출 + result = market_value( + fid_trgt_cls_code="0", # 대상 구분 코드, + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드, + fid_cond_scr_div_code="20179", # 조건 화면 분류 코드, + fid_input_iscd="0000", # 입력 종목코드, + fid_div_cls_code="0", # 분류 구분 코드, + fid_input_price_1="", # 입력 가격1, + fid_input_price_2="", # 입력 가격2, + fid_vol_cnt="", # 거래량 수, + fid_input_option_1="2023", # 입력 옵션1, + fid_input_option_2="0", # 입력 옵션2, + fid_rank_sort_cls_code="23", # 순위 정렬 구분 코드, + fid_blng_cls_code="0", # 소속 구분 코드, + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 시장가치 순위 결과 ===") + print(result) + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/market_value/market_value.py b/한국투자증권(API)/examples_llm/domestic_stock/market_value/market_value.py new file mode 100644 index 0000000..f3d4118 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/market_value/market_value.py @@ -0,0 +1,167 @@ +# DOMSTK_RANK - 국내주식 시장가치 순위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시장가치 순위[v1_국내주식-096] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/market-value" + +def market_value( + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시장가치 순위[v1_국내주식-096] + 국내주식 시장가치 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_cls_code (str): 0 : 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20179 ) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_div_cls_code (str): 0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_input_option_1 (str): 회계연도 입력 (ex 2023) + fid_input_option_2 (str): 0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산 + fid_rank_sort_cls_code (str): '가치분석(23:PER, 24:PBR, 25:PCR, 26:PSR, 27: EPS, 28:EVA, 29: EBITDA, 30: EV/EBITDA, 31:EBITDA/금융비율' + fid_blng_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 시장가치 순위 데이터 + + Example: + >>> df = market_value( + ... fid_trgt_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20179", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="3", + ... fid_rank_sort_cls_code="23", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_trgt_cls_code not in ["0"]: + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_mrkt_div_code not in ["J"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20179": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["23", "24", "25", "26", "27", "28", "29", "30", "31"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code not in ["0"]: + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code not in ["0"]: + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01790000" + + params = { + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return market_value( + fid_trgt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_krx/chk_member_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/member_krx/chk_member_krx.py new file mode 100644 index 0000000..841e646 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_krx/chk_member_krx.py @@ -0,0 +1,191 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from member_krx import member_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (KRX) [실시간-047] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "seln2_mbcr_name1": "매도2회원사명1", + "seln2_mbcr_name2": "매도2회원사명2", + "seln2_mbcr_name3": "매도2회원사명3", + "seln2_mbcr_name4": "매도2회원사명4", + "seln2_mbcr_name5": "매도2회원사명5", + "byov_mbcr_name1": "매수회원사명1", + "byov_mbcr_name2": "매수회원사명2", + "byov_mbcr_name3": "매수회원사명3", + "byov_mbcr_name4": "매수회원사명4", + "byov_mbcr_name5": "매수회원사명5", + "total_seln_qty1": "총매도수량1", + "total_seln_qty2": "총매도수량2", + "total_seln_qty3": "총매도수량3", + "total_seln_qty4": "총매도수량4", + "total_seln_qty5": "총매도수량5", + "total_shnu_qty1": "총매수2수량1", + "total_shnu_qty2": "총매수2수량2", + "total_shnu_qty3": "총매수2수량3", + "total_shnu_qty4": "총매수2수량4", + "total_shnu_qty5": "총매수2수량5", + "seln_mbcr_glob_yn_1": "매도거래원구분1", + "seln_mbcr_glob_yn_2": "매도거래원구분2", + "seln_mbcr_glob_yn_3": "매도거래원구분3", + "seln_mbcr_glob_yn_4": "매도거래원구분4", + "seln_mbcr_glob_yn_5": "매도거래원구분5", + "shnu_mbcr_glob_yn_1": "매수거래원구분1", + "shnu_mbcr_glob_yn_2": "매수거래원구분2", + "shnu_mbcr_glob_yn_3": "매수거래원구분3", + "shnu_mbcr_glob_yn_4": "매수거래원구분4", + "shnu_mbcr_glob_yn_5": "매수거래원구분5", + "seln_mbcr_no1": "매도거래원코드1", + "seln_mbcr_no2": "매도거래원코드2", + "seln_mbcr_no3": "매도거래원코드3", + "seln_mbcr_no4": "매도거래원코드4", + "seln_mbcr_no5": "매도거래원코드5", + "shnu_mbcr_no1": "매수거래원코드1", + "shnu_mbcr_no2": "매수거래원코드2", + "shnu_mbcr_no3": "매수거래원코드3", + "shnu_mbcr_no4": "매수거래원코드4", + "shnu_mbcr_no5": "매수거래원코드5", + "seln_mbcr_rlim1": "매도회원사비중1", + "seln_mbcr_rlim2": "매도회원사비중2", + "seln_mbcr_rlim3": "매도회원사비중3", + "seln_mbcr_rlim4": "매도회원사비중4", + "seln_mbcr_rlim5": "매도회원사비중5", + "shnu_mbcr_rlim1": "매수2회원사비중1", + "shnu_mbcr_rlim2": "매수2회원사비중2", + "shnu_mbcr_rlim3": "매수2회원사비중3", + "shnu_mbcr_rlim4": "매수2회원사비중4", + "shnu_mbcr_rlim5": "매수2회원사비중5", + "seln_qty_icdc1": "매도수량증감1", + "seln_qty_icdc2": "매도수량증감2", + "seln_qty_icdc3": "매도수량증감3", + "seln_qty_icdc4": "매도수량증감4", + "seln_qty_icdc5": "매도수량증감5", + "shnu_qty_icdc1": "매수2수량증감1", + "shnu_qty_icdc2": "매수2수량증감2", + "shnu_qty_icdc3": "매수2수량증감3", + "shnu_qty_icdc4": "매수2수량증감4", + "shnu_qty_icdc5": "매수2수량증감5", + "glob_total_seln_qty": "외국계총매도수량", + "glob_total_shnu_qty": "외국계총매수2수량", + "glob_total_seln_qty_icdc": "외국계총매도수량증감", + "glob_total_shnu_qty_icdc": "외국계총매수2수량증감", + "glob_ntby_qty": "외국계순매수수량", + "glob_seln_rlim": "외국계매도비중", + "glob_shnu_rlim": "외국계매수2비중", + "seln2_mbcr_eng_name1": "매도2영문회원사명1", + "seln2_mbcr_eng_name2": "매도2영문회원사명2", + "seln2_mbcr_eng_name3": "매도2영문회원사명3", + "seln2_mbcr_eng_name4": "매도2영문회원사명4", + "seln2_mbcr_eng_name5": "매도2영문회원사명5", + "byov_mbcr_eng_name1": "매수영문회원사명1", + "byov_mbcr_eng_name2": "매수영문회원사명2", + "byov_mbcr_eng_name3": "매수영문회원사명3", + "byov_mbcr_eng_name4": "매수영문회원사명4", + "byov_mbcr_eng_name5": "매수영문회원사명5" +} + +# 숫자형 컬럼 리스트 (문자열 컬럼 제외) +NUMERIC_COLUMNS = [ + "total_seln_qty1", "total_seln_qty2", "total_seln_qty3", "total_seln_qty4", "total_seln_qty5", + "total_shnu_qty1", "total_shnu_qty2", "total_shnu_qty3", "total_shnu_qty4", "total_shnu_qty5", + "seln_mbcr_rlim1", "seln_mbcr_rlim2", "seln_mbcr_rlim3", "seln_mbcr_rlim4", "seln_mbcr_rlim5", + "shnu_mbcr_rlim1", "shnu_mbcr_rlim2", "shnu_mbcr_rlim3", "shnu_mbcr_rlim4", "shnu_mbcr_rlim5", + "seln_qty_icdc1", "seln_qty_icdc2", "seln_qty_icdc3", "seln_qty_icdc4", "seln_qty_icdc5", + "shnu_qty_icdc1", "shnu_qty_icdc2", "shnu_qty_icdc3", "shnu_qty_icdc4", "shnu_qty_icdc5", + "glob_total_seln_qty", "glob_total_shnu_qty", "glob_total_seln_qty_icdc", "glob_total_shnu_qty_icdc", + "glob_ntby_qty", "glob_seln_rlim", "glob_shnu_rlim" +] + + +def main(): + """ + 국내주식 실시간회원사 (KRX) + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=member_krx, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 안전한 컬럼명 매핑 (존재하는 컬럼에 대해서만 한글명 적용) + if not result.empty: + # 컬럼명 매핑 + existing_columns = {col: COLUMN_MAPPING[col] for col in result.columns if col in COLUMN_MAPPING} + if existing_columns: + result = result.rename(columns=existing_columns) + logging.info(f"컬럼명 매핑 완료: {len(existing_columns)}개 컬럼") + + # 안전한 숫자형 컬럼 변환 (존재하는 컬럼에 대해서만 적용) + NUMERIC_COLUMNS_to_convert = [col for col in NUMERIC_COLUMNS if col in result.columns] + if NUMERIC_COLUMNS_to_convert: + for col in NUMERIC_COLUMNS_to_convert: + try: + # 한글명으로 변환된 컬럼이 있는지 확인 + tarcol = COLUMN_MAPPING.get(col, col) + if tarcol in result.columns: + result[tarcol] = pd.to_numeric(result[tarcol], errors='coerce') + except Exception as e: + logging.warning(f"컬럼 '{col}' 숫자 변환 실패: {e}") + logging.info(f"숫자형 변환 완료: {len(NUMERIC_COLUMNS_to_convert)}개 컬럼") + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_krx/member_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/member_krx/member_krx.py new file mode 100644 index 0000000..eefbf75 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_krx/member_krx.py @@ -0,0 +1,143 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (KRX) [실시간-047] +############################################################################################## + +def member_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간 회원사 (KRX) 데이터 구독 함수 [H0STMBC0] + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내주식 회원사 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제를 지원합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 구독 요청에 대한 응답 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = member_krx("1", "005930") + >>> print(msg, columns) + + Note: + 실시간 데이터는 웹소켓을 통해 지속적으로 수신됩니다. 구독 해제를 원할 경우, tr_type을 "0"으로 설정하여 호출하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STMBC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "seln2_mbcr_name1", + "seln2_mbcr_name2", + "seln2_mbcr_name3", + "seln2_mbcr_name4", + "seln2_mbcr_name5", + "byov_mbcr_name1", + "byov_mbcr_name2", + "byov_mbcr_name3", + "byov_mbcr_name4", + "byov_mbcr_name5", + "total_seln_qty1", + "total_seln_qty2", + "total_seln_qty3", + "total_seln_qty4", + "total_seln_qty5", + "total_shnu_qty1", + "total_shnu_qty2", + "total_shnu_qty3", + "total_shnu_qty4", + "total_shnu_qty5", + "seln_mbcr_glob_yn_1", + "seln_mbcr_glob_yn_2", + "seln_mbcr_glob_yn_3", + "seln_mbcr_glob_yn_4", + "seln_mbcr_glob_yn_5", + "shnu_mbcr_glob_yn_1", + "shnu_mbcr_glob_yn_2", + "shnu_mbcr_glob_yn_3", + "shnu_mbcr_glob_yn_4", + "shnu_mbcr_glob_yn_5", + "seln_mbcr_no1", + "seln_mbcr_no2", + "seln_mbcr_no3", + "seln_mbcr_no4", + "seln_mbcr_no5", + "shnu_mbcr_no1", + "shnu_mbcr_no2", + "shnu_mbcr_no3", + "shnu_mbcr_no4", + "shnu_mbcr_no5", + "seln_mbcr_rlim1", + "seln_mbcr_rlim2", + "seln_mbcr_rlim3", + "seln_mbcr_rlim4", + "seln_mbcr_rlim5", + "shnu_mbcr_rlim1", + "shnu_mbcr_rlim2", + "shnu_mbcr_rlim3", + "shnu_mbcr_rlim4", + "shnu_mbcr_rlim5", + "seln_qty_icdc1", + "seln_qty_icdc2", + "seln_qty_icdc3", + "seln_qty_icdc4", + "seln_qty_icdc5", + "shnu_qty_icdc1", + "shnu_qty_icdc2", + "shnu_qty_icdc3", + "shnu_qty_icdc4", + "shnu_qty_icdc5", + "glob_total_seln_qty", + "glob_total_shnu_qty", + "glob_total_seln_qty_icdc", + "glob_total_shnu_qty_icdc", + "glob_ntby_qty", + "glob_seln_rlim", + "glob_shnu_rlim", + "seln2_mbcr_eng_name1", + "seln2_mbcr_eng_name2", + "seln2_mbcr_eng_name3", + "seln2_mbcr_eng_name4", + "seln2_mbcr_eng_name5", + "byov_mbcr_eng_name1", + "byov_mbcr_eng_name2", + "byov_mbcr_eng_name3", + "byov_mbcr_eng_name4", + "byov_mbcr_eng_name5", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/chk_member_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/chk_member_nxt.py new file mode 100644 index 0000000..e870d01 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/chk_member_nxt.py @@ -0,0 +1,159 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from member_nxt import member_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (NXT) +############################################################################################## + + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "SELN2_MBCR_NAME1": "매도2 회원사명1", + "SELN2_MBCR_NAME2": "매도2 회원사명2", + "SELN2_MBCR_NAME3": "매도2 회원사명3", + "SELN2_MBCR_NAME4": "매도2 회원사명4", + "SELN2_MBCR_NAME5": "매도2 회원사명5", + "BYOV_MBCR_NAME1": "매수 회원사명1", + "BYOV_MBCR_NAME2": "매수 회원사명2", + "BYOV_MBCR_NAME3": "매수 회원사명3", + "BYOV_MBCR_NAME4": "매수 회원사명4", + "BYOV_MBCR_NAME5": "매수 회원사명5", + "TOTAL_SELN_QTY1": "총 매도 수량1", + "TOTAL_SELN_QTY2": "총 매도 수량2", + "TOTAL_SELN_QTY3": "총 매도 수량3", + "TOTAL_SELN_QTY4": "총 매도 수량4", + "TOTAL_SELN_QTY5": "총 매도 수량5", + "TOTAL_SHNU_QTY1": "총 매수2 수량1", + "TOTAL_SHNU_QTY2": "총 매수2 수량2", + "TOTAL_SHNU_QTY3": "총 매수2 수량3", + "TOTAL_SHNU_QTY4": "총 매수2 수량4", + "TOTAL_SHNU_QTY5": "총 매수2 수량5", + "SELN_MBCR_GLOB_YN_1": "매도거래원구분1", + "SELN_MBCR_GLOB_YN_2": "매도거래원구분2", + "SELN_MBCR_GLOB_YN_3": "매도거래원구분3", + "SELN_MBCR_GLOB_YN_4": "매도거래원구분4", + "SELN_MBCR_GLOB_YN_5": "매도거래원구분5", + "SHNU_MBCR_GLOB_YN_1": "매수거래원구분1", + "SHNU_MBCR_GLOB_YN_2": "매수거래원구분2", + "SHNU_MBCR_GLOB_YN_3": "매수거래원구분3", + "SHNU_MBCR_GLOB_YN_4": "매수거래원구분4", + "SHNU_MBCR_GLOB_YN_5": "매수거래원구분5", + "SELN_MBCR_NO1": "매도거래원코드1", + "SELN_MBCR_NO2": "매도거래원코드2", + "SELN_MBCR_NO3": "매도거래원코드3", + "SELN_MBCR_NO4": "매도거래원코드4", + "SELN_MBCR_NO5": "매도거래원코드5", + "SHNU_MBCR_NO1": "매수거래원코드1", + "SHNU_MBCR_NO2": "매수거래원코드2", + "SHNU_MBCR_NO3": "매수거래원코드3", + "SHNU_MBCR_NO4": "매수거래원코드4", + "SHNU_MBCR_NO5": "매수거래원코드5", + "SELN_MBCR_RLIM1": "매도 회원사 비중1", + "SELN_MBCR_RLIM2": "매도 회원사 비중2", + "SELN_MBCR_RLIM3": "매도 회원사 비중3", + "SELN_MBCR_RLIM4": "매도 회원사 비중4", + "SELN_MBCR_RLIM5": "매도 회원사 비중5", + "SHNU_MBCR_RLIM1": "매수2 회원사 비중1", + "SHNU_MBCR_RLIM2": "매수2 회원사 비중2", + "SHNU_MBCR_RLIM3": "매수2 회원사 비중3", + "SHNU_MBCR_RLIM4": "매수2 회원사 비중4", + "SHNU_MBCR_RLIM5": "매수2 회원사 비중5", + "SELN_QTY_ICDC1": "매도 수량 증감1", + "SELN_QTY_ICDC2": "매도 수량 증감2", + "SELN_QTY_ICDC3": "매도 수량 증감3", + "SELN_QTY_ICDC4": "매도 수량 증감4", + "SELN_QTY_ICDC5": "매도 수량 증감5", + "SHNU_QTY_ICDC1": "매수2 수량 증감1", + "SHNU_QTY_ICDC2": "매수2 수량 증감2", + "SHNU_QTY_ICDC3": "매수2 수량 증감3", + "SHNU_QTY_ICDC4": "매수2 수량 증감4", + "SHNU_QTY_ICDC5": "매수2 수량 증감5", + "GLOB_TOTAL_SELN_QTY": "외국계 총 매도 수량", + "GLOB_TOTAL_SHNU_QTY": "외국계 총 매수2 수량", + "GLOB_TOTAL_SELN_QTY_ICDC": "외국계 총 매도 수량 증감", + "GLOB_TOTAL_SHNU_QTY_ICDC": "외국계 총 매수2 수량 증감", + "GLOB_NTBY_QTY": "외국계 순매수 수량", + "GLOB_SELN_RLIM": "외국계 매도 비중", + "GLOB_SHNU_RLIM": "외국계 매수2 비중", + "SELN2_MBCR_ENG_NAME1": "매도2 영문회원사명1", + "SELN2_MBCR_ENG_NAME2": "매도2 영문회원사명2", + "SELN2_MBCR_ENG_NAME3": "매도2 영문회원사명3", + "SELN2_MBCR_ENG_NAME4": "매도2 영문회원사명4", + "SELN2_MBCR_ENG_NAME5": "매도2 영문회원사명5", + "BYOV_MBCR_ENG_NAME1": "매수 영문회원사명1", + "BYOV_MBCR_ENG_NAME2": "매수 영문회원사명2", + "BYOV_MBCR_ENG_NAME3": "매수 영문회원사명3", + "BYOV_MBCR_ENG_NAME4": "매수 영문회원사명4", + "BYOV_MBCR_ENG_NAME5": "매수 영문회원사명5" +} + +NUMERIC_COLUMNS = [ + "총 매도 수량1", "총 매도 수량2", "총 매도 수량3", "총 매도 수량4", "총 매도 수량5", + "총 매수2 수량1", "총 매수2 수량2", "총 매수2 수량3", "총 매수2 수량4", "총 매수2 수량5", + "매도 수량 증감1", "매도 수량 증감2", "매도 수량 증감3", "매도 수량 증감4", "매도 수량 증감5", + "매수2 수량 증감1", "매수2 수량 증감2", "매수2 수량 증감3", "매수2 수량 증감4", "매수2 수량 증감5", + "외국계 총 매도 수량", "외국계 총 매수2 수량", "외국계 총 매도 수량 증감", "외국계 총 매수2 수량 증감", + "외국계 순매수 수량" +] + + +def main(): + """ + 국내주식 실시간회원사 (NXT) + + 국내주식 실시간회원사 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=member_nxt, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + + # 컬럼명 매핑 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/member_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/member_nxt.py new file mode 100644 index 0000000..e00ec5c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_nxt/member_nxt.py @@ -0,0 +1,142 @@ +""" +Created on 2025-07-08 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (NXT) +############################################################################################## + +def member_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간회원사 (NXT)[H0NXMBC0] + 국내주식 실시간회원사 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 빈 문자열이 아니어야 함 + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = member_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXMBC0" + + params = { + "tr_key": tr_key, + } + + # 실시간 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "SELN2_MBCR_NAME1", + "SELN2_MBCR_NAME2", + "SELN2_MBCR_NAME3", + "SELN2_MBCR_NAME4", + "SELN2_MBCR_NAME5", + "BYOV_MBCR_NAME1", + "BYOV_MBCR_NAME2", + "BYOV_MBCR_NAME3", + "BYOV_MBCR_NAME4", + "BYOV_MBCR_NAME5", + "TOTAL_SELN_QTY1", + "TOTAL_SELN_QTY2", + "TOTAL_SELN_QTY3", + "TOTAL_SELN_QTY4", + "TOTAL_SELN_QTY5", + "TOTAL_SHNU_QTY1", + "TOTAL_SHNU_QTY2", + "TOTAL_SHNU_QTY3", + "TOTAL_SHNU_QTY4", + "TOTAL_SHNU_QTY5", + "SELN_MBCR_GLOB_YN_1", + "SELN_MBCR_GLOB_YN_2", + "SELN_MBCR_GLOB_YN_3", + "SELN_MBCR_GLOB_YN_4", + "SELN_MBCR_GLOB_YN_5", + "SHNU_MBCR_GLOB_YN_1", + "SHNU_MBCR_GLOB_YN_2", + "SHNU_MBCR_GLOB_YN_3", + "SHNU_MBCR_GLOB_YN_4", + "SHNU_MBCR_GLOB_YN_5", + "SELN_MBCR_NO1", + "SELN_MBCR_NO2", + "SELN_MBCR_NO3", + "SELN_MBCR_NO4", + "SELN_MBCR_NO5", + "SHNU_MBCR_NO1", + "SHNU_MBCR_NO2", + "SHNU_MBCR_NO3", + "SHNU_MBCR_NO4", + "SHNU_MBCR_NO5", + "SELN_MBCR_RLIM1", + "SELN_MBCR_RLIM2", + "SELN_MBCR_RLIM3", + "SELN_MBCR_RLIM4", + "SELN_MBCR_RLIM5", + "SHNU_MBCR_RLIM1", + "SHNU_MBCR_RLIM2", + "SHNU_MBCR_RLIM3", + "SHNU_MBCR_RLIM4", + "SHNU_MBCR_RLIM5", + "SELN_QTY_ICDC1", + "SELN_QTY_ICDC2", + "SELN_QTY_ICDC3", + "SELN_QTY_ICDC4", + "SELN_QTY_ICDC5", + "SHNU_QTY_ICDC1", + "SHNU_QTY_ICDC2", + "SHNU_QTY_ICDC3", + "SHNU_QTY_ICDC4", + "SHNU_QTY_ICDC5", + "GLOB_TOTAL_SELN_QTY", + "GLOB_TOTAL_SHNU_QTY", + "GLOB_TOTAL_SELN_QTY_ICDC", + "GLOB_TOTAL_SHNU_QTY_ICDC", + "GLOB_NTBY_QTY", + "GLOB_SELN_RLIM", + "GLOB_SHNU_RLIM", + "SELN2_MBCR_ENG_NAME1", + "SELN2_MBCR_ENG_NAME2", + "SELN2_MBCR_ENG_NAME3", + "SELN2_MBCR_ENG_NAME4", + "SELN2_MBCR_ENG_NAME5", + "BYOV_MBCR_ENG_NAME1", + "BYOV_MBCR_ENG_NAME2", + "BYOV_MBCR_ENG_NAME3", + "BYOV_MBCR_ENG_NAME4", + "BYOV_MBCR_ENG_NAME5", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_total/chk_member_total.py b/한국투자증권(API)/examples_llm/domestic_stock/member_total/chk_member_total.py new file mode 100644 index 0000000..0890f16 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_total/chk_member_total.py @@ -0,0 +1,154 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from member_total import member_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (통합) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "SELN2_MBCR_NAME1": "매도2 회원사명1", + "SELN2_MBCR_NAME2": "매도2 회원사명2", + "SELN2_MBCR_NAME3": "매도2 회원사명3", + "SELN2_MBCR_NAME4": "매도2 회원사명4", + "SELN2_MBCR_NAME5": "매도2 회원사명5", + "BYOV_MBCR_NAME1": "매수 회원사명1", + "BYOV_MBCR_NAME2": "매수 회원사명2", + "BYOV_MBCR_NAME3": "매수 회원사명3", + "BYOV_MBCR_NAME4": "매수 회원사명4", + "BYOV_MBCR_NAME5": "매수 회원사명5", + "TOTAL_SELN_QTY1": "총 매도 수량1", + "TOTAL_SELN_QTY2": "총 매도 수량2", + "TOTAL_SELN_QTY3": "총 매도 수량3", + "TOTAL_SELN_QTY4": "총 매도 수량4", + "TOTAL_SELN_QTY5": "총 매도 수량5", + "TOTAL_SHNU_QTY1": "총 매수2 수량1", + "TOTAL_SHNU_QTY2": "총 매수2 수량2", + "TOTAL_SHNU_QTY3": "총 매수2 수량3", + "TOTAL_SHNU_QTY4": "총 매수2 수량4", + "TOTAL_SHNU_QTY5": "총 매수2 수량5", + "SELN_MBCR_GLOB_YN_1": "매도거래원구분1", + "SELN_MBCR_GLOB_YN_2": "매도거래원구분2", + "SELN_MBCR_GLOB_YN_3": "매도거래원구분3", + "SELN_MBCR_GLOB_YN_4": "매도거래원구분4", + "SELN_MBCR_GLOB_YN_5": "매도거래원구분5", + "SHNU_MBCR_GLOB_YN_1": "매수거래원구분1", + "SHNU_MBCR_GLOB_YN_2": "매수거래원구분2", + "SHNU_MBCR_GLOB_YN_3": "매수거래원구분3", + "SHNU_MBCR_GLOB_YN_4": "매수거래원구분4", + "SHNU_MBCR_GLOB_YN_5": "매수거래원구분5", + "SELN_MBCR_NO1": "매도거래원코드1", + "SELN_MBCR_NO2": "매도거래원코드2", + "SELN_MBCR_NO3": "매도거래원코드3", + "SELN_MBCR_NO4": "매도거래원코드4", + "SELN_MBCR_NO5": "매도거래원코드5", + "SHNU_MBCR_NO1": "매수거래원코드1", + "SHNU_MBCR_NO2": "매수거래원코드2", + "SHNU_MBCR_NO3": "매수거래원코드3", + "SHNU_MBCR_NO4": "매수거래원코드4", + "SHNU_MBCR_NO5": "매수거래원코드5", + "SELN_MBCR_RLIM1": "매도 회원사 비중1", + "SELN_MBCR_RLIM2": "매도 회원사 비중2", + "SELN_MBCR_RLIM3": "매도 회원사 비중3", + "SELN_MBCR_RLIM4": "매도 회원사 비중4", + "SELN_MBCR_RLIM5": "매도 회원사 비중5", + "SHNU_MBCR_RLIM1": "매수2 회원사 비중1", + "SHNU_MBCR_RLIM2": "매수2 회원사 비중2", + "SHNU_MBCR_RLIM3": "매수2 회원사 비중3", + "SHNU_MBCR_RLIM4": "매수2 회원사 비중4", + "SHNU_MBCR_RLIM5": "매수2 회원사 비중5", + "SELN_QTY_ICDC1": "매도 수량 증감1", + "SELN_QTY_ICDC2": "매도 수량 증감2", + "SELN_QTY_ICDC3": "매도 수량 증감3", + "SELN_QTY_ICDC4": "매도 수량 증감4", + "SELN_QTY_ICDC5": "매도 수량 증감5", + "SHNU_QTY_ICDC1": "매수2 수량 증감1", + "SHNU_QTY_ICDC2": "매수2 수량 증감2", + "SHNU_QTY_ICDC3": "매수2 수량 증감3", + "SHNU_QTY_ICDC4": "매수2 수량 증감4", + "SHNU_QTY_ICDC5": "매수2 수량 증감5", + "GLOB_TOTAL_SELN_QTY": "외국계 총 매도 수량", + "GLOB_TOTAL_SHNU_QTY": "외국계 총 매수2 수량", + "GLOB_TOTAL_SELN_QTY_ICDC": "외국계 총 매도 수량 증감", + "GLOB_TOTAL_SHNU_QTY_ICDC": "외국계 총 매수2 수량 증감", + "GLOB_NTBY_QTY": "외국계 순매수 수량", + "GLOB_SELN_RLIM": "외국계 매도 비중", + "GLOB_SHNU_RLIM": "외국계 매수2 비중", + "SELN2_MBCR_ENG_NAME1": "매도2 영문회원사명1", + "SELN2_MBCR_ENG_NAME2": "매도2 영문회원사명2", + "SELN2_MBCR_ENG_NAME3": "매도2 영문회원사명3", + "SELN2_MBCR_ENG_NAME4": "매도2 영문회원사명4", + "SELN2_MBCR_ENG_NAME5": "매도2 영문회원사명5", + "BYOV_MBCR_ENG_NAME1": "매수 영문회원사명1", + "BYOV_MBCR_ENG_NAME2": "매수 영문회원사명2", + "BYOV_MBCR_ENG_NAME3": "매수 영문회원사명3", + "BYOV_MBCR_ENG_NAME4": "매수 영문회원사명4", + "BYOV_MBCR_ENG_NAME5": "매수 영문회원사명5" +} + +NUMERIC_COLUMNS = [ + "총 매도 수량1", "총 매도 수량2", "총 매도 수량3", "총 매도 수량4", "총 매도 수량5", + "총 매수2 수량1", "총 매수2 수량2", "총 매수2 수량3", "총 매수2 수량4", "총 매수2 수량5", + "외국계 총 매도 수량", "외국계 총 매수2 수량", "외국계 총 매도 수량 증감", "외국계 총 매수2 수량 증감", + "외국계 순매수 수량" +] + + +def main(): + """ + 국내주식 실시간회원사 (통합) + + 국내주식 실시간회원사 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=member_total, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/member_total/member_total.py b/한국투자증권(API)/examples_llm/domestic_stock/member_total/member_total.py new file mode 100644 index 0000000..012916a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/member_total/member_total.py @@ -0,0 +1,138 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (통합) +############################################################################################## + +def member_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간회원사 (통합)[H0UNMBC0] + 국내주식 실시간회원사 (통합) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 빈 문자열이 아니어야 함 + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Example: + >>> msg, columns = member_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 실시간 데이터를 처리하기 위해 웹소켓을 사용합니다. 구독을 등록하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UNMBC0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "SELN2_MBCR_NAME1", + "SELN2_MBCR_NAME2", + "SELN2_MBCR_NAME3", + "SELN2_MBCR_NAME4", + "SELN2_MBCR_NAME5", + "BYOV_MBCR_NAME1", + "BYOV_MBCR_NAME2", + "BYOV_MBCR_NAME3", + "BYOV_MBCR_NAME4", + "BYOV_MBCR_NAME5", + "TOTAL_SELN_QTY1", + "TOTAL_SELN_QTY2", + "TOTAL_SELN_QTY3", + "TOTAL_SELN_QTY4", + "TOTAL_SELN_QTY5", + "TOTAL_SHNU_QTY1", + "TOTAL_SHNU_QTY2", + "TOTAL_SHNU_QTY3", + "TOTAL_SHNU_QTY4", + "TOTAL_SHNU_QTY5", + "SELN_MBCR_GLOB_YN_1", + "SELN_MBCR_GLOB_YN_2", + "SELN_MBCR_GLOB_YN_3", + "SELN_MBCR_GLOB_YN_4", + "SELN_MBCR_GLOB_YN_5", + "SHNU_MBCR_GLOB_YN_1", + "SHNU_MBCR_GLOB_YN_2", + "SHNU_MBCR_GLOB_YN_3", + "SHNU_MBCR_GLOB_YN_4", + "SHNU_MBCR_GLOB_YN_5", + "SELN_MBCR_NO1", + "SELN_MBCR_NO2", + "SELN_MBCR_NO3", + "SELN_MBCR_NO4", + "SELN_MBCR_NO5", + "SHNU_MBCR_NO1", + "SHNU_MBCR_NO2", + "SHNU_MBCR_NO3", + "SHNU_MBCR_NO4", + "SHNU_MBCR_NO5", + "SELN_MBCR_RLIM1", + "SELN_MBCR_RLIM2", + "SELN_MBCR_RLIM3", + "SELN_MBCR_RLIM4", + "SELN_MBCR_RLIM5", + "SHNU_MBCR_RLIM1", + "SHNU_MBCR_RLIM2", + "SHNU_MBCR_RLIM3", + "SHNU_MBCR_RLIM4", + "SHNU_MBCR_RLIM5", + "SELN_QTY_ICDC1", + "SELN_QTY_ICDC2", + "SELN_QTY_ICDC3", + "SELN_QTY_ICDC4", + "SELN_QTY_ICDC5", + "SHNU_QTY_ICDC1", + "SHNU_QTY_ICDC2", + "SHNU_QTY_ICDC3", + "SHNU_QTY_ICDC4", + "SHNU_QTY_ICDC5", + "GLOB_TOTAL_SELN_QTY", + "GLOB_TOTAL_SHNU_QTY", + "GLOB_TOTAL_SELN_QTY_ICDC", + "GLOB_TOTAL_SHNU_QTY_ICDC", + "GLOB_NTBY_QTY", + "GLOB_SELN_RLIM", + "GLOB_SHNU_RLIM", + "SELN2_MBCR_ENG_NAME1", + "SELN2_MBCR_ENG_NAME2", + "SELN2_MBCR_ENG_NAME3", + "SELN2_MBCR_ENG_NAME4", + "SELN2_MBCR_ENG_NAME5", + "BYOV_MBCR_ENG_NAME1", + "BYOV_MBCR_ENG_NAME2", + "BYOV_MBCR_ENG_NAME3", + "BYOV_MBCR_ENG_NAME4", + "BYOV_MBCR_ENG_NAME5", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/chk_mktfunds.py b/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/chk_mktfunds.py new file mode 100644 index 0000000..0150ace --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/chk_mktfunds.py @@ -0,0 +1,85 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from mktfunds import mktfunds + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내 증시자금 종합 [국내주식-193] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_date': '영업일자', + 'bstp_nmix_prpr': '업종지수현재가', + 'bstp_nmix_prdy_vrss': '업종지수전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'hts_avls': 'HTS시가총액', + 'cust_dpmn_amt': '고객예탁금금액', + 'cust_dpmn_amt_prdy_vrss': '고객예탁금금액전일대비', + 'amt_tnrt': '금액회전율', + 'uncl_amt': '미수금액', + 'crdt_loan_rmnd': '신용융자잔고', + 'futs_tfam_amt': '선물예수금금액', + 'sttp_amt': '주식형금액', + 'mxtp_amt': '혼합형금액', + 'bntp_amt': '채권형금액', + 'mmf_amt': 'MMF금액', + 'secu_lend_amt': '담보대출잔고금액' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내 증시자금 종합 조회 테스트 함수 + + 이 함수는 국내 증시자금 종합 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = mktfunds(fid_input_date_1="") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/mktfunds.py b/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/mktfunds.py new file mode 100644 index 0000000..71e702f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/mktfunds/mktfunds.py @@ -0,0 +1,59 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내 증시자금 종합 [국내주식-193] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/mktfunds" + + +def mktfunds( + fid_input_date_1: str = "" +) -> pd.DataFrame: + """ + 국내 증시자금 종합 API입니다. + 한국투자 HTS(eFriend Plus) > [0470] 증시자금 종합 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. (단위: 억원) + + ※ 해당자료는 금융투자협회의 자료를 제공하고 있으며, 오류와 지연이 발생할 수 있습니다. + ※ 위 정보에 의한 투자판단의 최종책임은 정보이용자에게 있으며, 당사와 한국금융투자협회는 어떠한 법적인 책임도 지지 않사오니 투자에 참고로만 이용하시기 바랍니다. + + Args: + fid_input_date_1 (str): [입력날짜] + + Returns: + pd.DataFrame: 국내 증시자금 종합 데이터 + + Example: + >>> df = mktfunds() + >>> print(df) + """ + + tr_id = "FHKST649100C0" + + params = { + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/chk_near_new_highlow.py b/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/chk_near_new_highlow.py new file mode 100644 index 0000000..f4ecfdc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/chk_near_new_highlow.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-13 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from near_new_highlow import near_new_highlow + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신고_신저근접종목 상위[v1_국내주식-105] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'askp': '매도호가', + 'askp_rsqn1': '매도호가 잔량1', + 'bidp': '매수호가', + 'bidp_rsqn1': '매수호가 잔량1', + 'acml_vol': '누적 거래량', + 'new_hgpr': '신 최고가', + 'hprc_near_rate': '고가 근접 비율', + 'new_lwpr': '신 최저가', + 'lwpr_near_rate': '저가 근접 비율', + 'stck_sdpr': '주식 기준가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 신고_신저근접종목 상위[v1_국내주식-105] + + 국내주식 신고_신저근접종목 상위 테스트 함수 + + Parameters: + - fid_aply_rang_vol (str): 적용 범위 거래량 (0: 전체, 100: 100주 이상) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20187)) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체, 1:관리종목, 2:투자주의, 3:투자경고) + - fid_input_cnt_1 (str): 입력 수1 (괴리율 최소) + - fid_input_cnt_2 (str): 입력 수2 (괴리율 최대) + - fid_prc_cls_code (str): 가격 구분 코드 (0:신고근접, 1:신저근접) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_trgt_cls_code (str): 대상 구분 코드 (0: 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + - fid_aply_rang_prc_1 (str): 적용 범위 가격1 (가격 ~) + - fid_aply_rang_prc_2 (str): 적용 범위 가격2 (~ 가격) + Returns: + - DataFrame: 국내주식 신고_신저근접종목 상위 결과 + + Example: + >>> df = near_new_highlow(fid_aply_rang_vol="100", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20187", fid_div_cls_code="0", fid_input_cnt_1="0", fid_input_cnt_2="10", fid_prc_cls_code="0", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_aply_rang_prc_1="10000", fid_aply_rang_prc_2="50000") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # 국내주식 신고_신저근접종목 상위 파라미터 설정 + # API 호출 + result = near_new_highlow( + fid_aply_rang_vol="100", # 적용 범위 거래량 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20187", # 조건 화면 분류 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_cnt_1="0", # 입력 수1 + fid_input_cnt_2="10", # 입력 수2 + fid_prc_cls_code="0", # 가격 구분 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_aply_rang_prc_1="10000", # 적용 범위 가격1 + fid_aply_rang_prc_2="50000", # 적용 범위 가격2 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 신고_신저근접종목 상위 결과 ===") + print(result) + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/near_new_highlow.py b/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/near_new_highlow.py new file mode 100644 index 0000000..08c830b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/near_new_highlow/near_new_highlow.py @@ -0,0 +1,160 @@ +# DOMSTK_RANK - 국내주식 신고/신저근접종목 상위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신고_신저근접종목 상위[v1_국내주식-105] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/near-new-highlow" + +def near_new_highlow( + fid_aply_rang_vol: str, # 적용 범위 거래량 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_cnt_1: str, # 입력 수1 + fid_input_cnt_2: str, # 입력 수2 + fid_prc_cls_code: str, # 가격 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 신고_신저근접종목 상위[v1_국내주식-105] + 국내주식 신고_신저근접종목 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_vol (str): 0: 전체, 100: 100주 이상 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20187) + fid_div_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고 + fid_input_cnt_1 (str): 괴리율 최소 + fid_input_cnt_2 (str): 괴리율 최대 + fid_prc_cls_code (str): 0:신고근접, 1:신저근접 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_trgt_cls_code (str): 0: 전체 + fid_trgt_exls_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_aply_rang_prc_1 (str): 가격 ~ + fid_aply_rang_prc_2 (str): ~ 가격 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 신고_신저근접종목 상위 데이터 + + Example: + >>> df = near_new_highlow( + ... fid_aply_rang_vol="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20187", + ... fid_div_cls_code="0", + ... fid_input_cnt_1="0", + ... fid_input_cnt_2="100", + ... fid_prc_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_aply_rang_prc_1="0", + ... fid_aply_rang_prc_2="1000000" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_aply_rang_vol not in ["0", "100"]: + raise ValueError("적용 범위 거래량 확인요망!!!") + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20187": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2", "3"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_prc_cls_code not in ["0", "1"]: + raise ValueError("가격 구분 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001", "4001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01870000" + + params = { + "fid_aply_rang_vol": fid_aply_rang_vol, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + "fid_input_cnt_2": fid_input_cnt_2, + "fid_prc_cls_code": fid_prc_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return near_new_highlow( + fid_aply_rang_vol, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_cnt_1, + fid_input_cnt_2, + fid_prc_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 발생 시 처리 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/news_title/chk_news_title.py b/한국투자증권(API)/examples_llm/domestic_stock/news_title/chk_news_title.py new file mode 100644 index 0000000..2986da4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/news_title/chk_news_title.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from news_title import news_title + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 종합 시황/공시(제목) [국내주식-141] +############################################################################################## + +COLUMN_MAPPING = { + 'output1': '응답상세', + 'cntt_usiq_srno': '내용 조회용 일련번호', + 'news_ofer_entp_code': '뉴스 제공 업체 코드', + 'data_dt': '작성일자', + 'data_tm': '작성시간', + 'hts_pbnt_titl_cntt': 'HTS 공시 제목 내용', + 'news_lrdv_code': '뉴스 대구분', + 'dorg': '자료원', + 'iscd1': '종목 코드1', + 'iscd2': '종목 코드2', + 'iscd3': '종목 코드3', + 'iscd4': '종목 코드4', + 'iscd5': '종목 코드5' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 업종/기타 + 종합 시황_공시(제목)[국내주식-141] + + 종합 시황_공시(제목) 테스트 함수 + + Parameters: + - fid_news_ofer_entp_code (str): 뉴스 제공 업체 코드 (공백) + - fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 (공백) + - fid_input_iscd (str): 입력 종목코드 (공백: 전체, 종목코드 : 해당코드가 등록된 뉴스) + - fid_titl_cntt (str): 제목 내용 (공백) + - fid_input_date_1 (str): 입력 날짜 (공백: 현재기준, 조회일자(ex 00YYYYMMDD)) + - fid_input_hour_1 (str): 입력 시간 (공백: 현재기준, 조회시간(ex 0000HHMMSS)) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (공백) + - fid_input_srno (str): 입력 일련번호 (공백) + Returns: + - DataFrame: 종합 시황_공시(제목) 결과 + + Example: + >>> df = news_title(fid_news_ofer_entp_code="", fid_cond_mrkt_cls_code="", fid_input_iscd="", fid_titl_cntt="", fid_input_date_1="", fid_input_hour_1="", fid_rank_sort_cls_code="", fid_input_srno="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = news_title( + fid_news_ofer_entp_code="", # 뉴스 제공 업체 코드 + fid_cond_mrkt_cls_code="", # 조건 시장 구분 코드 + fid_input_iscd="", # 입력 종목코드 + fid_titl_cntt="", # 제목 내용 + fid_input_date_1="", # 입력 날짜 + fid_input_hour_1="", # 입력 시간 + fid_rank_sort_cls_code="", # 순위 정렬 구분 코드 + fid_input_srno="", # 입력 일련번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 종합 시황_공시(제목) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/news_title/news_title.py b/한국투자증권(API)/examples_llm/domestic_stock/news_title/news_title.py new file mode 100644 index 0000000..ef158d2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/news_title/news_title.py @@ -0,0 +1,141 @@ +# [국내주식] 업종/기타 - 종합 시황/공시(제목) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- + +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 종합 시황/공시(제목) [국내주식-141] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/news-title" + +def news_title( + fid_news_ofer_entp_code: str, # 뉴스 제공 업체 코드 + fid_cond_mrkt_cls_code: str, # 조건 시장 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_titl_cntt: str, # 제목 내용 + fid_input_date_1: str, # 입력 날짜 + fid_input_hour_1: str, # 입력 시간 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_srno: str, # 입력 일련번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 종합 시황_공시(제목)[국내주식-141] + 종합 시황_공시(제목) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_news_ofer_entp_code (str): 뉴스 제공 업체 코드 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + fid_input_iscd (str): 입력 종목코드 + fid_titl_cntt (str): 제목 내용 + fid_input_date_1 (str): 입력 날짜 + fid_input_hour_1 (str): 입력 시간 + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 + fid_input_srno (str): 입력 일련번호 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 종합 시황_공시(제목) 데이터 + + Example: + >>> df = news_title( + ... fid_news_ofer_entp_code='2', + ... fid_cond_mrkt_cls_code='00', + ... fid_input_iscd='005930', + ... fid_titl_cntt='', + ... fid_input_date_1='20231010', + ... fid_input_hour_1='090000', + ... fid_rank_sort_cls_code='01', + ... fid_input_srno='1' + ... ) + >>> print(df) + """ + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API URL 및 거래 ID 설정 + tr_id = "FHKST01011800" + + # 요청 파라미터 설정 + params = { + "FID_NEWS_OFER_ENTP_CODE": fid_news_ofer_entp_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TITL_CNTT": fid_titl_cntt, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_SRNO": fid_input_srno, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return news_title( + fid_news_ofer_entp_code, + fid_cond_mrkt_cls_code, + fid_input_iscd, + fid_titl_cntt, + fid_input_date_1, + fid_input_hour_1, + fid_rank_sort_cls_code, + fid_input_srno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_cash/chk_order_cash.py b/한국투자증권(API)/examples_llm/domestic_stock/order_cash/chk_order_cash.py new file mode 100644 index 0000000..d422ce0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_cash/chk_order_cash.py @@ -0,0 +1,75 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_cash import order_cash + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(현금)[v1_국내주식-001] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '거래소코드', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시간' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식주문(현금) 조회 테스트 함수 + + 이 함수는 주식주문(현금) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_cash(env_dv="real", ord_dv="sell", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", + ord_dvsn="00", ord_qty="1", ord_unpr="2000", excg_id_dvsn_cd="SOR") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_cash/order_cash.py b/한국투자증권(API)/examples_llm/domestic_stock/order_cash/order_cash.py new file mode 100644 index 0000000..f422cf4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_cash/order_cash.py @@ -0,0 +1,139 @@ +""" +Created on 20250112 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(현금)[v1_국내주식-001] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-cash" + +def order_cash( + env_dv: str, # 실전모의구분 (real:실전, demo:모의) + ord_dv: str, # 매도매수구분 (buy:매수, sell:매도) + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 (종목코드) + ord_dvsn: str, # 주문구분 + ord_qty: str, # 주문수량 + ord_unpr: str, # 주문단가 + excg_id_dvsn_cd: str, # 거래소ID구분코드 + sll_type: str = "", # 매도유형 (매도주문 시) + cndt_pric: str = "" # 조건가격 +) -> pd.DataFrame: + """ + 국내주식주문(현금) API 입니다. + + ※ TTC0802U(현금매수) 사용하셔서 미수매수 가능합니다. 단, 거래하시는 계좌가 증거금40%계좌로 신청이 되어있어야 가능합니다. + ※ 신용매수는 별도의 API가 준비되어 있습니다. + + ※ ORD_QTY(주문수량), ORD_UNPR(주문단가) 등을 String으로 전달해야 함에 유의 부탁드립니다. + + ※ ORD_UNPR(주문단가)가 없는 주문은 상한가로 주문금액을 선정하고 이후 체결이되면 체결금액로 정산됩니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (buy:매수, sell:매도) + cano (str): [필수] 종합계좌번호 (종합계좌번호) + acnt_prdt_cd (str): [필수] 계좌상품코드 (상품유형코드) + pdno (str): [필수] 상품번호 (종목코드(6자리) , ETN의 경우 7자리 입력) + ord_dvsn (str): [필수] 주문구분 + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + excg_id_dvsn_cd (str): [필수] 거래소ID구분코드 (KRX) + sll_type (str): 매도유형 (매도주문 시) (01:일반매도,02:임의매매,05:대차매도) + cndt_pric (str): 조건가격 (스탑지정가호가 주문 시 사용) + + Returns: + pd.DataFrame: 주식주문 결과 데이터 + + Example: + >>> df = order_cash(env_dv="demo", ord_dv="buy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_dvsn="00", ord_qty="1", ord_unpr="70000", excg_id_dvsn_cd="KRX") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if ord_dv == "" or ord_dv is None: + raise ValueError("ord_dv is required (e.g. 'buy:매수, sell:매도')") + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '종합계좌번호')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '상품유형코드')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '종목코드(6자리) , ETN의 경우 7자리 입력')") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required (e.g. '')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required (e.g. '')") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required (e.g. '')") + + if excg_id_dvsn_cd == "" or excg_id_dvsn_cd is None: + raise ValueError("excg_id_dvsn_cd is required (e.g. 'KRX')") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "sell": + tr_id = "TTTC0011U" + elif ord_dv == "buy": + tr_id = "TTTC0012U" + else: + raise ValueError("ord_dv can only be sell or buy") + elif env_dv == "demo": + if ord_dv == "sell": + tr_id = "VTTC0011U" + elif ord_dv == "buy": + tr_id = "VTTC0012U" + else: + raise ValueError("ord_dv can only be sell or buy") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "PDNO": pdno, # 상품번호 + "ORD_DVSN": ord_dvsn, # 주문구분 + "ORD_QTY": ord_qty, # 주문수량 + "ORD_UNPR": ord_unpr, # 주문단가 + "EXCG_ID_DVSN_CD": excg_id_dvsn_cd, # 거래소ID구분코드 + "SLL_TYPE": sll_type, # 매도유형 + "CNDT_PRIC": cndt_pric # 조건가격 + } + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_credit/chk_order_credit.py b/한국투자증권(API)/examples_llm/domestic_stock/order_credit/chk_order_credit.py new file mode 100644 index 0000000..caf7733 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_credit/chk_order_credit.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_credit import order_credit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(신용)[v1_국내주식-002] +############################################################################################## + +COLUMN_MAPPING = { + 'krx_fwdg_ord_orgno': '한국거래소전송주문조직번호', + 'odno': '주문번호', + 'ord_tmd': '주문시간' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식주문(신용) 조회 테스트 함수 + + 이 함수는 주식주문(신용) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930) 신용매수 주문을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_credit( + ord_dv="buy", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="005930", + crdt_type="21", + loan_dt="20220810", + ord_dvsn="00", + ord_qty="1", + ord_unpr="55000" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_credit/order_credit.py b/한국투자증권(API)/examples_llm/domestic_stock/order_credit/order_credit.py new file mode 100644 index 0000000..cebeb42 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_credit/order_credit.py @@ -0,0 +1,182 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(신용)[v1_국내주식-002] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-credit" + +def order_credit( + ord_dv: str, # 매수매도구분 (buy:매수, sell:매도) + cano: str, # 종합계좌번호 (12345678) + acnt_prdt_cd: str, # 계좌상품코드 (01) + pdno: str, # 상품번호 (123456) + crdt_type: str, # 신용유형 + loan_dt: str, # 대출일자 + ord_dvsn: str, # 주문구분 + ord_qty: str, # 주문수량 + ord_unpr: str, # 주문단가 + excg_id_dvsn_cd: str = "", # 거래소ID구분코드 (KRX:한국거래소, NXT:넥스트레이드, SOR:SOR) + sll_type: str = "", # 매도유형 + rsvn_ord_yn: str = "", # 예약주문여부 (Y: 예약주문, N: 신용주문) + emgc_ord_yn: str = "", # 비상주문여부 + pgtr_dvsn: str = "", # 프로그램매매구분 + mgco_aptm_odno: str = "", # 운용사지정주문번호 + lqty_tr_ngtn_dtl_no: str = "", # 대량거래협상상세번호 + lqty_tr_agmt_no: str = "", # 대량거래협정번호 + lqty_tr_ngtn_id: str = "", # 대량거래협상자Id + lp_ord_yn: str = "", # LP주문여부 + mdia_odno: str = "", # 매체주문번호 + ord_svr_dvsn_cd: str = "", # 주문서버구분코드 + pgm_nmpr_stmt_dvsn_cd: str = "", # 프로그램호가신고구분코드 + cvrg_slct_rson_cd: str = "", # 반대매매선정사유코드 + cvrg_seq: str = "", # 반대매매순번 + cndt_pric: str = "" # 조건가격 +) -> pd.DataFrame: + """ + 국내주식주문(신용) API입니다. + ※ 모의투자는 사용 불가합니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + ord_dv (str): [필수] 매수매도구분 (ex. buy:매수, sell:매도) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + pdno (str): [필수] 상품번호 (ex. 123456) + crdt_type (str): [필수] 신용유형 (ex. [매도] 22:유통대주신규, 24:자기대주신규, 25:자기융자상환, 27:유통융자상환 / [매수] 21:자기융자신규, 23:유통융자신규 , 26:유통대주상환, 28:자기대주상환) + loan_dt (str): [필수] 대출일자 (ex. [신용매수] 오늘날짜(yyyyMMdd), [신용매도] 매도할 종목의 대출일자(yyyyMMdd)) + ord_dvsn (str): [필수] 주문구분 + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + excg_id_dvsn_cd (str): 거래소ID구분코드 (ex. KRX:한국거래소, NXT:넥스트레이드, SOR:SOR) + sll_type (str): 매도유형 + rsvn_ord_yn (str): 예약주문여부 (ex. Y: 예약주문, N: 신용주문) + emgc_ord_yn (str): 비상주문여부 + pgtr_dvsn (str): 프로그램매매구분 + mgco_aptm_odno (str): 운용사지정주문번호 + lqty_tr_ngtn_dtl_no (str): 대량거래협상상세번호 + lqty_tr_agmt_no (str): 대량거래협정번호 + lqty_tr_ngtn_id (str): 대량거래협상자Id + lp_ord_yn (str): LP주문여부 + mdia_odno (str): 매체주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + pgm_nmpr_stmt_dvsn_cd (str): 프로그램호가신고구분코드 + cvrg_slct_rson_cd (str): 반대매매선정사유코드 + cvrg_seq (str): 반대매매순번 + cndt_pric (str): 조건가격 + + Returns: + pd.DataFrame: 주식주문(신용) 결과 데이터 + + Example: + >>> df = order_credit(ord_dv="buy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", crdt_type="21", loan_dt="20220810", ord_dvsn="00", ord_qty="1", ord_unpr="55000") + >>> print(df) + """ + + # 필수 파라미터 검증 + if ord_dv == "" or ord_dv is None: + raise ValueError("ord_dv is required (e.g. 'buy:매수, sell:매도')") + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '123456')") + + if crdt_type == "" or crdt_type is None: + raise ValueError("crdt_type is required (e.g. '[매도] 22:유통대주신규, 24:자기대주신규, 25:자기융자상환, 27:유통융자상환 / [매수] 21:자기융자신규, 23:유통융자신규 , 26:유통대주상환, 28:자기대주상환')") + + if loan_dt == "" or loan_dt is None: + raise ValueError("loan_dt is required (e.g. '[신용매수] 오늘날짜(yyyyMMdd), [신용매도] 매도할 종목의 대출일자(yyyyMMdd)')") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required") + + # tr_id 설정 + if ord_dv == "buy": + tr_id = "TTTC0052U" + elif ord_dv == "sell": + tr_id = "TTTC0051U" + else: + raise ValueError("ord_dv can only be buy or sell") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "CRDT_TYPE": crdt_type, + "LOAN_DT": loan_dt, + "ORD_DVSN": ord_dvsn, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr + } + + # 옵션 파라미터 추가 + if excg_id_dvsn_cd: + params["EXCG_ID_DVSN_CD"] = excg_id_dvsn_cd + if sll_type: + params["SLL_TYPE"] = sll_type + if rsvn_ord_yn: + params["RSVN_ORD_YN"] = rsvn_ord_yn + if emgc_ord_yn: + params["EMGC_ORD_YN"] = emgc_ord_yn + if pgtr_dvsn: + params["PGTR_DVSN"] = pgtr_dvsn + if mgco_aptm_odno: + params["MGCO_APTM_ODNO"] = mgco_aptm_odno + if lqty_tr_ngtn_dtl_no: + params["LQTY_TR_NGTN_DTL_NO"] = lqty_tr_ngtn_dtl_no + if lqty_tr_agmt_no: + params["LQTY_TR_AGMT_NO"] = lqty_tr_agmt_no + if lqty_tr_ngtn_id: + params["LQTY_TR_NGTN_ID"] = lqty_tr_ngtn_id + if lp_ord_yn: + params["LP_ORD_YN"] = lp_ord_yn + if mdia_odno: + params["MDIA_ODNO"] = mdia_odno + if ord_svr_dvsn_cd: + params["ORD_SVR_DVSN_CD"] = ord_svr_dvsn_cd + if pgm_nmpr_stmt_dvsn_cd: + params["PGM_NMPR_STMT_DVSN_CD"] = pgm_nmpr_stmt_dvsn_cd + if cvrg_slct_rson_cd: + params["CVRG_SLCT_RSON_CD"] = cvrg_slct_rson_cd + if cvrg_seq: + params["CVRG_SEQ"] = cvrg_seq + if cndt_pric: + params["CNDT_PRIC"] = cndt_pric + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv/chk_order_resv.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv/chk_order_resv.py new file mode 100644 index 0000000..d84d7d6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv/chk_order_resv.py @@ -0,0 +1,73 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_resv import order_resv + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문[v1_국내주식-017] +############################################################################################## + +COLUMN_MAPPING = { + 'RSVN_ORD_SEQ': '예약주문 순번' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식예약주문 테스트 함수 + + 이 함수는 주식예약주문 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_resv(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_qty="1", ord_unpr="55000", + sll_buy_dvsn_cd="02", ord_dvsn_cd="00", ord_objt_cblc_dvsn_cd="10") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv/order_resv.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv/order_resv.py new file mode 100644 index 0000000..dfc7e04 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv/order_resv.py @@ -0,0 +1,145 @@ +""" +Created on 20250112 +""" + + +import sys +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문[v1_국내주식-017] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-resv" + +def order_resv( + cano: str, + acnt_prdt_cd: str, + pdno: str, + ord_qty: str, + ord_unpr: str, + sll_buy_dvsn_cd: str, + ord_dvsn_cd: str, + ord_objt_cblc_dvsn_cd: str, + loan_dt: Optional[str] = "", + rsvn_ord_end_dt: Optional[str] = "", + ldng_dt: Optional[str] = "" +) -> pd.DataFrame: + """ + 국내주식 예약주문 매수/매도 API 입니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 유의사항 + 1. 예약주문 가능시간 : 15시 40분 ~ 다음 영업일 7시 30분 + (단, 서버 초기화 작업 시 예약주문 불가 : 23시 40분 ~ 00시 10분) + ※ 예약주문 처리내역은 통보되지 않으므로 주문처리일 장 시작전에 반드시 주문처리 결과를 확인하시기 바랍니다. + + 2. 예약주문 안내 + - 예약종료일 미입력 시 일반예약주문으로 최초 도래하는 영업일에 주문 전송됩니다. + - 예약종료일 입력 시 기간예약주문으로 최초 예약주문수량 중 미체결 된 수량에 대해 예약종료일까지 매 영업일 주문이 + 실행됩니다. (예약종료일은 익영업일부터 달력일 기준으로 공휴일 포함하여 최대 30일이 되는 일자까지 입력가능) + - 예약주문 접수 처리순서는 일반/기간예약주문 중 신청일자가 빠른 주문이 우선합니다. + 단, 기간예약주문 자동배치시간(약 15시35분 ~ 15시55분)사이 접수되는 주문의 경우 당일에 한해 순서와 상관없이 + 처리될 수 있습니다. + - 기간예약주문 자동배치시간(약 15시35분 ~ 15시55분)에는 예약주문 조회가 제한 될 수 있습니다. + - 기간예약주문은 계좌 당 주문건수 최대 1,000건으로 제한됩니다. + + 3. 예약주문 접수내역 중 아래의 사유 등으로 인해 주문이 거부될 수 있사오니, 주문처리일 장 시작전에 반드시 + 주문처리 결과를 확인하시기 바랍니다. + * 주문처리일 기준 : 매수가능금액 부족, 매도가능수량 부족, 주문수량/호가단위 오류, 대주 호가제한, + 신용/대주가능종목 변경, 상/하한폭 변경, 시가형성 종목(신규상장 등)의 시장가, 거래서비스 미신청 등 + + 4. 익일 예상 상/하한가는 조회시점의 현재가로 계산되며 익일의 유/무상증자, 배당, 감자, 합병, 액면변경 등에 의해 + 변동될 수 있으며 이로 인해 상/하한가를 벗어나 주문이 거부되는 경우가 발생할 수 있사오니, 주문처리일 장 시작전에 + 반드시 주문처리결과를 확인하시기 바랍니다. + + 5. 정리매매종목, ELW, 신주인수권증권, 신주인수권증서 등은 가격제한폭(상/하한가) 적용 제외됩니다. + + 6. 영업일 장 시작 후 [기간예약주문] 내역 취소는 해당시점 이후의 예약주문이 취소되는 것으로, + 일반주문으로 이미 전환된 주문에는 영향을 미치지 않습니다. 반드시 장 시작전 주문처리결과를 확인하시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + pdno (str): [필수] 종목코드(6자리) + ord_qty (str): [필수] 주문수량 (주0문주식수) + ord_unpr (str): [필수] 주문단가 (1주당 가격, 시장가/장전 시간외는 0 입력) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (01 : 매도, 02 : 매수) + ord_dvsn_cd (str): [필수] 주문구분코드 (00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외) + ord_objt_cblc_dvsn_cd (str): [필수] 주문대상잔고구분코드 (10: 현금, 12~28: 각종 대출/상환코드) + loan_dt (Optional[str]): 대출일자 + rsvn_ord_end_dt (Optional[str]): 예약주문종료일자 (YYYYMMDD, 익영업일부터 최대 30일 이내) + ldng_dt (Optional[str]): 대여일자 + + Returns: + pd.DataFrame: 예약주문 결과 데이터 + + Example: + >>> df = order_resv(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_qty="1", ord_unpr="55000", sll_buy_dvsn_cd="02", ord_dvsn_cd="00", ord_objt_cblc_dvsn_cd="10") + >>> print(df) + """ + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '종목코드(6자리)')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required (e.g. '주0문주식수')") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required (e.g. '1주당 가격, 시장가/장전 시간외는 0 입력')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01 : 매도, 02 : 매수')") + + if ord_dvsn_cd == "" or ord_dvsn_cd is None: + raise ValueError("ord_dvsn_cd is required (e.g. '00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외')") + + if ord_objt_cblc_dvsn_cd == "" or ord_objt_cblc_dvsn_cd is None: + raise ValueError("ord_objt_cblc_dvsn_cd is required (e.g. '10: 현금, 12~28: 각종 대출/상환코드')") + + tr_id = "CTSC0008U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "ORD_DVSN_CD": ord_dvsn_cd, + "ORD_OBJT_CBLC_DVSN_CD": ord_objt_cblc_dvsn_cd + } + + if loan_dt: + params["LOAN_DT"] = loan_dt + if rsvn_ord_end_dt: + params["RSVN_ORD_END_DT"] = rsvn_ord_end_dt + if ldng_dt: + params["LDNG_DT"] = ldng_dt + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/chk_order_resv_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/chk_order_resv_ccnl.py new file mode 100644 index 0000000..94467e2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/chk_order_resv_ccnl.py @@ -0,0 +1,101 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_resv_ccnl import order_resv_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] +############################################################################################## + +COLUMN_MAPPING = { + 'rsvn_ord_seq': '예약주문 순번', + 'rsvn_ord_ord_dt': '예약주문주문일자', + 'rsvn_ord_rcit_dt': '예약주문접수일자', + 'pdno': '상품번호', + 'ord_dvsn_cd': '주문구분코드', + 'ord_rsvn_qty': '주문예약수량', + 'tot_ccld_qty': '총체결수량', + 'cncl_ord_dt': '취소주문일자', + 'ord_tmd': '주문시각', + 'ctac_tlno': '연락전화번호', + 'rjct_rson2': '거부사유2', + 'odno': '주문번호', + 'rsvn_ord_rcit_tmd': '예약주문접수시각', + 'kor_item_shtn_name': '한글종목단축명', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'ord_rsvn_unpr': '주문예약단가', + 'tot_ccld_amt': '총체결금액', + 'loan_dt': '대출일자', + 'cncl_rcit_tmd': '취소접수시각', + 'prcs_rslt': '처리결과', + 'ord_dvsn_name': '주문구분명', + 'tmnl_mdia_kind_cd': '단말매체종류코드', + 'rsvn_end_dt': '예약종료일자' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식예약주문조회 테스트 함수 + + 이 함수는 주식예약주문조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_resv_ccnl( + rsvn_ord_ord_dt="20220729", + rsvn_ord_end_dt="20220810", + tmnl_mdia_kind_cd="00", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + prcs_dvsn_cd="0", + cncl_yn="Y" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/order_resv_ccnl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/order_resv_ccnl.py new file mode 100644 index 0000000..cea635b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_ccnl/order_resv_ccnl.py @@ -0,0 +1,154 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-resv-ccnl" + +def order_resv_ccnl( + rsvn_ord_ord_dt: str, # [필수] 예약주문시작일자 + rsvn_ord_end_dt: str, # [필수] 예약주문종료일자 + tmnl_mdia_kind_cd: str, # [필수] 단말매체종류코드 (ex. 00) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + prcs_dvsn_cd: str, # [필수] 처리구분코드 (ex. 0) + cncl_yn: str, # [필수] 취소여부 (ex. Y) + rsvn_ord_seq: str = "", # 예약주문순번 + pdno: str = "", # 상품번호 (ex. 005930) + sll_buy_dvsn_cd: str = "", # 매도매수구분코드 (ex. 01) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 국내예약주문 처리내역 조회 API 입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + rsvn_ord_ord_dt (str): [필수] 예약주문시작일자 + rsvn_ord_end_dt (str): [필수] 예약주문종료일자 + tmnl_mdia_kind_cd (str): [필수] 단말매체종류코드 (ex. 00) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + prcs_dvsn_cd (str): [필수] 처리구분코드 (ex. 0) + cncl_yn (str): [필수] 취소여부 (ex. Y) + rsvn_ord_seq (str): 예약주문순번 + pdno (str): 상품번호 (ex. 005930) + sll_buy_dvsn_cd (str): 매도매수구분코드 (ex. 01) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 주식예약주문조회 데이터 + + Example: + >>> df = order_resv_ccnl( + ... rsvn_ord_ord_dt="20220729", + ... rsvn_ord_end_dt="20220810", + ... tmnl_mdia_kind_cd="00", + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... prcs_dvsn_cd="0", + ... cncl_yn="Y" + ... ) + >>> print(df) + """ + + # 필수 파라미터 검증 + if rsvn_ord_ord_dt == "": + raise ValueError("rsvn_ord_ord_dt is required") + + if rsvn_ord_end_dt == "": + raise ValueError("rsvn_ord_end_dt is required") + + if tmnl_mdia_kind_cd == "": + raise ValueError("tmnl_mdia_kind_cd is required (e.g. '00')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if prcs_dvsn_cd == "": + raise ValueError("prcs_dvsn_cd is required (e.g. '0')") + + if cncl_yn == "": + raise ValueError("cncl_yn is required (e.g. 'Y')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTSC0004R" # 주식예약주문조회 + + params = { + "RSVN_ORD_ORD_DT": rsvn_ord_ord_dt, # 예약주문시작일자 + "RSVN_ORD_END_DT": rsvn_ord_end_dt, # 예약주문종료일자 + "TMNL_MDIA_KIND_CD": tmnl_mdia_kind_cd, # 단말매체종류코드 + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "PRCS_DVSN_CD": prcs_dvsn_cd, # 처리구분코드 + "CNCL_YN": cncl_yn, # 취소여부 + "RSVN_ORD_SEQ": rsvn_ord_seq, # 예약주문순번 + "PDNO": pdno, # 상품번호 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return order_resv_ccnl( + rsvn_ord_ord_dt, rsvn_ord_end_dt, tmnl_mdia_kind_cd, cano, acnt_prdt_cd, + prcs_dvsn_cd, cncl_yn, rsvn_ord_seq, pdno, sll_buy_dvsn_cd, + FK200, NK200, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/chk_order_resv_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/chk_order_resv_rvsecncl.py new file mode 100644 index 0000000..1e095d0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/chk_order_resv_rvsecncl.py @@ -0,0 +1,84 @@ +""" +Created on 20250113 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_resv_rvsecncl import order_resv_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문정정취소[v1_국내주식-018,019] +############################################################################################## + +COLUMN_MAPPING = { + 'nrml_prcs_yn': '정상처리여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식예약주문정정취소 조회 테스트 함수 + + 이 함수는 주식예약주문정정취소 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_resv_rvsecncl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rsvn_ord_seq="88793", + rsvn_ord_orgno="001", + rsvn_ord_ord_dt="20250113", + ord_type="cancel", + pdno="005930", + ord_qty="2", + ord_unpr="55000", + sll_buy_dvsn_cd="02", + ord_dvsn_cd="00", + ord_objt_cblc_dvsn_cd="10" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형이 명시된 필드만 포함) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/order_resv_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/order_resv_rvsecncl.py new file mode 100644 index 0000000..0dfa659 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_resv_rvsecncl/order_resv_rvsecncl.py @@ -0,0 +1,137 @@ +""" +Created on 20250113 +""" + + +import sys +from typing import Optional + +import pandas as pd +import logging + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문정정취소[v1_국내주식-018,019] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-resv-rvsecncl" + +def order_resv_rvsecncl( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + rsvn_ord_seq: str, # [필수] 예약주문순번 + rsvn_ord_orgno: str, # [필수] 예약주문조직번호 + rsvn_ord_ord_dt: str, # [필수] 예약주문주문일자 + ord_type: str, # [필수] 주문구분 (ex. cancel:취소, modify:정정) + pdno: Optional[str] = "", # 종목코드 + ord_qty: Optional[str] = "", # 주문수량 + ord_unpr: Optional[str] = "", # 주문단가 + sll_buy_dvsn_cd: Optional[str] = "", # 매도매수구분코드 (ex. 01:매도, 02:매수) + ord_dvsn_cd: Optional[str] = "", # 주문구분코드 (ex. 00:지정가, 01:시장가, 02:조건부지정가, 05:장전 시간외) + ord_objt_cblc_dvsn_cd: Optional[str] = "", # 주문대상잔고구분코드 (ex. 10 : 현금, 12 : 주식담보대출, ... 28 : 자기대주상환) + loan_dt: Optional[str] = "", # 대출일자 + rsvn_ord_end_dt: Optional[str] = "", # 예약주문종료일자 + ctal_tlno: Optional[str] = "" # 연락전화번호 +) -> pd.DataFrame: + """ + 국내주식 예약주문 정정/취소 API 입니다. + * 정정주문은 취소주문에 비해 필수 입력값이 추가 됩니다. + 하단의 입력값을 참조하시기 바랍니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + rsvn_ord_seq (str): [필수] 예약주문순번 + rsvn_ord_orgno (str): [필수] 예약주문조직번호 + rsvn_ord_ord_dt (str): [필수] 예약주문주문일자 + ord_type (str): [필수] 주문구분 (ex. cancel:취소, modify:정정) + pdno (Optional[str]): 종목코드 + ord_qty (Optional[str]): 주문수량 + ord_unpr (Optional[str]): 주문단가 + sll_buy_dvsn_cd (Optional[str]): 매도매수구분코드 (ex. 01:매도, 02:매수) + ord_dvsn_cd (Optional[str]): 주문구분코드 (ex. 00:지정가, 01:시장가, 02:조건부지정가, 05:장전 시간외) + ord_objt_cblc_dvsn_cd (Optional[str]): 주문대상잔고구분코드 (ex. 10 : 현금, 12 : 주식담보대출, ... 28 : 자기대주상환) + loan_dt (Optional[str]): 대출일자 + rsvn_ord_end_dt (Optional[str]): 예약주문종료일자 + ctal_tlno (Optional[str]): 연락전화번호 + + Returns: + pd.DataFrame: 주식예약주문정정취소 결과 데이터 + + Example: + >>> df = order_resv_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rsvn_ord_seq="88793", rsvn_ord_orgno="123", rsvn_ord_ord_dt="20250113", ord_type="cancel") + >>> print(df) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if rsvn_ord_seq == "" or rsvn_ord_seq is None: + raise ValueError("rsvn_ord_seq is required") + + if rsvn_ord_orgno == "" or rsvn_ord_orgno is None: + raise ValueError("rsvn_ord_orgno is required") + + if rsvn_ord_ord_dt == "" or rsvn_ord_ord_dt is None: + raise ValueError("rsvn_ord_ord_dt is required") + + if ord_type == "" or ord_type is None: + raise ValueError("ord_type is required") + + # tr_id 설정 + if ord_type == "cancel": + tr_id = "CTSC0009U" + elif ord_type == "modify": + tr_id = "CTSC0013U" + else: + raise ValueError("ord_type can only be cancel or modify") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RSVN_ORD_SEQ": rsvn_ord_seq, + "RSVN_ORD_ORGNO": rsvn_ord_orgno, + "RSVN_ORD_ORD_DT": rsvn_ord_ord_dt + } + + # 옵션 파라미터 추가 + if pdno: + params["PDNO"] = pdno + if ord_qty: + params["ORD_QTY"] = ord_qty + if ord_unpr: + params["ORD_UNPR"] = ord_unpr + if sll_buy_dvsn_cd: + params["SLL_BUY_DVSN_CD"] = sll_buy_dvsn_cd + if ord_dvsn_cd: + params["ORD_DVSN_CD"] = ord_dvsn_cd + if ord_objt_cblc_dvsn_cd: + params["ORD_OBJT_CBLC_DVSN_CD"] = ord_objt_cblc_dvsn_cd + if loan_dt: + params["LOAN_DT"] = loan_dt + if rsvn_ord_end_dt: + params["RSVN_ORD_END_DT"] = rsvn_ord_end_dt + if ctal_tlno: + params["CTAL_TLNO"] = ctal_tlno + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/chk_order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/chk_order_rvsecncl.py new file mode 100644 index 0000000..6b06ab0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/chk_order_rvsecncl.py @@ -0,0 +1,87 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_rvsecncl import order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(정정취소)[v1_국내주식-003] +############################################################################################## + +COLUMN_MAPPING = { + 'krx_fwdg_ord_orgno': '한국거래소전송주문조직번호', + 'odno': '주문번호', + 'ord_tmd': '주문시각' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 주식주문(정정취소) 조회 테스트 함수 + + 이 함수는 주식주문(정정취소) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 메타데이터의 case1 정보를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = order_rvsecncl( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + krx_fwdg_ord_orgno="06010", + orgn_odno="0000002101", + ord_dvsn="00", + rvse_cncl_dvsn_cd="02", + ord_qty="1", + ord_unpr="55000", + qty_all_ord_yn="Y", + excg_id_dvsn_cd="KRX" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/order_rvsecncl.py b/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/order_rvsecncl.py new file mode 100644 index 0000000..1c927e1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/order_rvsecncl/order_rvsecncl.py @@ -0,0 +1,136 @@ +""" +Created on 20250112 +""" + + +import sys +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(정정취소)[v1_국내주식-003] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/order-rvsecncl" + +def order_rvsecncl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + krx_fwdg_ord_orgno: str, # [필수] 한국거래소전송주문조직번호 + orgn_odno: str, # [필수] 원주문번호 + ord_dvsn: str, # [필수] 주문구분 + rvse_cncl_dvsn_cd: str, # [필수] 정정취소구분코드 (ex. 01:정정,02:취소) + ord_qty: str, # [필수] 주문수량 + ord_unpr: str, # [필수] 주문단가 + qty_all_ord_yn: str, # [필수] 잔량전부주문여부 (ex. Y:전량, N:일부) + excg_id_dvsn_cd: str, # [필수] 거래소ID구분코드 (ex. KRX: 한국거래소, NXT:대체거래소,SOR:SOR) + cndt_pric: Optional[str] = "" # 조건가격 +) -> pd.DataFrame: + """ + 주문 건에 대하여 정정 및 취소하는 API입니다. 단, 이미 체결된 건은 정정 및 취소가 불가합니다. + + ※ 정정은 원주문에 대한 주문단가 혹은 주문구분을 변경하는 사항으로, 정정이 가능한 수량은 원주문수량을 초과 할 수 없습니다. + + ※ 주식주문(정정취소) 호출 전에 반드시 주식정정취소가능주문조회 호출을 통해 정정취소가능수량(output > psbl_qty)을 확인하신 후 정정취소주문 내시기 바랍니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + krx_fwdg_ord_orgno (str): [필수] 한국거래소전송주문조직번호 + orgn_odno (str): [필수] 원주문번호 + ord_dvsn (str): [필수] 주문구분 + rvse_cncl_dvsn_cd (str): [필수] 정정취소구분코드 (ex. 01:정정,02:취소) + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + qty_all_ord_yn (str): [필수] 잔량전부주문여부 (ex. Y:전량, N:일부) + excg_id_dvsn_cd (str): [필수] 거래소ID구분코드 (ex. KRX: 한국거래소, NXT:대체거래소,SOR:SOR) + cndt_pric (Optional[str]): 조건가격 + + Returns: + pd.DataFrame: 주식주문(정정취소) 결과 데이터 + + Example: + >>> df = order_rvsecncl(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ...) + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if krx_fwdg_ord_orgno == "" or krx_fwdg_ord_orgno is None: + raise ValueError("krx_fwdg_ord_orgno is required") + + if orgn_odno == "" or orgn_odno is None: + raise ValueError("orgn_odno is required") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required") + + if rvse_cncl_dvsn_cd == "" or rvse_cncl_dvsn_cd is None: + raise ValueError("rvse_cncl_dvsn_cd is required (e.g. '01', '02')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required") + + if qty_all_ord_yn == "" or qty_all_ord_yn is None: + raise ValueError("qty_all_ord_yn is required (e.g. 'Y', 'N')") + + if excg_id_dvsn_cd == "" or excg_id_dvsn_cd is None: + raise ValueError("excg_id_dvsn_cd is required (e.g. 'KRX', 'NXT', 'SOR')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC0013U" + elif env_dv == "demo": + tr_id = "VTTC0013U" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "KRX_FWDG_ORD_ORGNO": krx_fwdg_ord_orgno, + "ORGN_ODNO": orgn_odno, + "ORD_DVSN": ord_dvsn, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr, + "QTY_ALL_ORD_YN": qty_all_ord_yn, + "EXCG_ID_DVSN_CD": excg_id_dvsn_cd + } + + # 옵션 파라미터 추가 + if cndt_pric: + params["CNDT_PRIC"] = cndt_pric + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame([res.getBody().output]) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/chk_overtime_asking_price_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/chk_overtime_asking_price_krx.py new file mode 100644 index 0000000..45e00ea --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/chk_overtime_asking_price_krx.py @@ -0,0 +1,161 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from overtime_asking_price_krx import overtime_asking_price_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간호가 (KRX) [실시간-025] +############################################################################################## + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "bsop_hour": "영업시간", + "hour_cls_code": "시간구분코드", + "askp1": "매도호가1", + "askp2": "매도호가2", + "askp3": "매도호가3", + "askp4": "매도호가4", + "askp5": "매도호가5", + "askp6": "매도호가6", + "askp7": "매도호가7", + "askp8": "매도호가8", + "askp9": "매도호가9", + "bidp1": "매수호가1", + "bidp2": "매수호가2", + "bidp3": "매수호가3", + "bidp4": "매수호가4", + "bidp5": "매수호가5", + "bidp6": "매수호가6", + "bidp7": "매수호가7", + "bidp8": "매수호가8", + "bidp9": "매수호가9", + "askp_rsqn1": "매도호가잔량1", + "askp_rsqn2": "매도호가잔량2", + "askp_rsqn3": "매도호가잔량3", + "askp_rsqn4": "매도호가잔량4", + "askp_rsqn5": "매도호가잔량5", + "askp_rsqn6": "매도호가잔량6", + "askp_rsqn7": "매도호가잔량7", + "askp_rsqn8": "매도호가잔량8", + "askp_rsqn9": "매도호가잔량9", + "bidp_rsqn1": "매수호가잔량1", + "bidp_rsqn2": "매수호가잔량2", + "bidp_rsqn3": "매수호가잔량3", + "bidp_rsqn4": "매수호가잔량4", + "bidp_rsqn5": "매수호가잔량5", + "bidp_rsqn6": "매수호가잔량6", + "bidp_rsqn7": "매수호가잔량7", + "bidp_rsqn8": "매수호가잔량8", + "bidp_rsqn9": "매수호가잔량9", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "ovtm_total_askp_rsqn": "시간외총매도호가잔량", + "ovtm_total_bidp_rsqn": "시간외총매수호가잔량", + "antc_cnpr": "예상체결가", + "antc_cnqn": "예상체결량", + "antc_vol": "예상거래량", + "antc_cntg_vrss": "예상체결대비", + "antc_cntg_vrss_sign": "예상체결대비부호", + "antc_cntg_prdy_ctrt": "예상체결전일대비율", + "acml_vol": "누적거래량", + "total_askp_rsqn_icdc": "총매도호가잔량증감", + "total_bidp_rsqn_icdc": "총매수호가잔량증감", + "ovtm_total_askp_icdc": "시간외총매도호가증감", + "ovtm_total_bidp_icdc": "시간외총매수호가증감" +} + +NUMERIC_COLUMNS = [ + "매도호가1", "매도호가2", "매도호가3", "매도호가4", "매도호가5", + "매도호가6", "매도호가7", "매도호가8", "매도호가9", + "매수호가1", "매수호가2", "매수호가3", "매수호가4", "매수호가5", + "매수호가6", "매수호가7", "매수호가8", "매수호가9", + "매도호가잔량1", "매도호가잔량2", "매도호가잔량3", "매도호가잔량4", + "매도호가잔량5", "매도호가잔량6", "매도호가잔량7", "매도호가잔량8", + "매도호가잔량9", "매수호가잔량1", "매수호가잔량2", "매수호가잔량3", + "매수호가잔량4", "매수호가잔량5", "매수호가잔량6", "매수호가잔량7", + "매수호가잔량8", "매수호가잔량9", "총매도호가잔량", "총매수호가잔량", + "시간외총매도호가잔량", "시간외총매수호가잔량", "예상체결가", "예상체결량", + "예상거래량", "예상체결대비", "예상체결전일대비율", "누적거래량", + "총매도호가잔량증감", "총매수호가잔량증감", "시간외총매도호가증감", + "시간외총매수호가증감" +] + + +def main(): + """ + 국내주식 시간외 실시간호가 (KRX) + + 국내주식 시간외 실시간호가 API입니다. +국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간호가 데이터 확인 가능합니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=overtime_asking_price_krx, data=["023460"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼명 매핑 적용 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/overtime_asking_price_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/overtime_asking_price_krx.py new file mode 100644 index 0000000..ce3d0d0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_asking_price_krx/overtime_asking_price_krx.py @@ -0,0 +1,115 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간호가 (KRX) [실시간-025] +############################################################################################## + + +def overtime_asking_price_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간호가 (KRX)[H0STOAA0] + 국내주식 시간외 실시간호가 API입니다. + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간호가 데이터 확인 가능합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = subscribe_overtime_asking_price_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신됩니다. 구독을 해제하지 않으면 데이터가 계속 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STOAA0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "bsop_hour", + "hour_cls_code", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "total_askp_rsqn", + "total_bidp_rsqn", + "ovtm_total_askp_rsqn", + "ovtm_total_bidp_rsqn", + "antc_cnpr", + "antc_cnqn", + "antc_vol", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "acml_vol", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc", + "ovtm_total_askp_icdc", + "ovtm_total_bidp_icdc", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/chk_overtime_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/chk_overtime_ccnl_krx.py new file mode 100644 index 0000000..e9314d3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/chk_overtime_ccnl_krx.py @@ -0,0 +1,144 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from overtime_ccnl_krx import overtime_ccnl_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간체결가 (KRX) [실시간-042] +############################################################################################## + + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비구분", + "prdy_vrss": "전일대비", + "prdy_ctrt": "등락율", + "wghn_avrg_stck_prc": "가중평균주식가격", + "stck_oprc": "시가", + "stck_hgpr": "고가", + "stck_lwpr": "저가", + "askp1": "매도호가", + "bidp1": "매수호가", + "cntg_vol": "거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "cttr": "체결강도", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "cntg_cls_code": "체결구분", + "shnu_rate": "매수비율", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가대비구분", + "oprc_vrss_prpr": "시가대비", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "고가대비구분", + "hgpr_vrss_prpr": "고가대비", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "저가대비구분", + "lwpr_vrss_prpr": "저가대비", + "bsop_date": "영업일자", + "new_mkop_cls_code": "신장운영구분코드", + "trht_yn": "거래정지여부", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "vol_tnrt": "거래량회전율", + "prdy_smns_hour_acml_vol": "전일동시간누적거래량", + "prdy_smns_hour_acml_vol_rate": "전일동시간누적거래량비율" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "등락율", "가중평균주식가격", "시가", "고가", "저가", + "매도호가", "매수호가", "거래량", "누적거래량", "누적거래대금", "매도체결건수", + "매수체결건수", "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수비율", + "전일거래량대비등락율", "시가대비", "고가대비", "저가대비", "매도호가잔량1", + "매수호가잔량1", "총매도호가잔량", "총매수호가잔량", "거래량회전율", + "전일동시간누적거래량", "전일동시간누적거래량비율" +] + + +def main(): + """ + 국내주식 시간외 실시간체결가 (KRX) + + 국내주식 시간외 실시간체결가 API입니다. +국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간체결가 데이터 확인 가능합니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=overtime_ccnl_krx, data=["023460", "199480", "462860", "440790", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/overtime_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/overtime_ccnl_krx.py new file mode 100644 index 0000000..9e2e6dc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_ccnl_krx/overtime_ccnl_krx.py @@ -0,0 +1,109 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간체결가 (KRX) [실시간-042] +############################################################################################## + +def overtime_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간체결가 (KRX)[H0STOUP0] + 국내주식 시간외 실시간체결가 API입니다. + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간체결가 데이터 확인 가능합니다. + + 실시간 데이터 구독을 위한 웹소켓 함수입니다. + tr_type은 구독 등록("1") 또는 해제("0") 여부를 나타내며, + tr_key는 구독할 종목의 코드를 나타냅니다. + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 구독할 종목의 코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = overtime_ccnl_krx("1", "005930") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STOUP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/chk_overtime_exp_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/chk_overtime_exp_ccnl_krx.py new file mode 100644 index 0000000..80c1f56 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/chk_overtime_exp_ccnl_krx.py @@ -0,0 +1,144 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from overtime_exp_ccnl_krx import overtime_exp_ccnl_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간예상체결 (KRX) [실시간-024] +############################################################################################## + + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비구분", + "prdy_vrss": "전일대비", + "prdy_ctrt": "등락율", + "wghn_avrg_stck_prc": "가중평균주식가격", + "stck_oprc": "시가", + "stck_hgpr": "고가", + "stck_lwpr": "저가", + "askp1": "매도호가", + "bidp1": "매수호가", + "cntg_vol": "거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "cttr": "체결강도", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "cntg_cls_code": "체결구분", + "shnu_rate": "매수비율", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가대비구분", + "oprc_vrss_prpr": "시가대비", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "고가대비구분", + "hgpr_vrss_prpr": "고가대비", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "저가대비구분", + "lwpr_vrss_prpr": "저가대비", + "bsop_date": "영업일자", + "new_mkop_cls_code": "신장운영구분코드", + "trht_yn": "거래정지여부", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "vol_tnrt": "거래량회전율", + "prdy_smns_hour_acml_vol": "전일동시간누적거래량", + "prdy_smns_hour_acml_vol_rate": "전일동시간누적거래량비율" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "등락율", "가중평균주식가격", "시가", "고가", "저가", + "매도호가", "매수호가", "거래량", "누적거래량", "누적거래대금", "매도체결건수", + "매수체결건수", "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수비율", + "전일거래량대비등락율", "시가대비", "고가대비", "저가대비", "매도호가잔량1", + "매수호가잔량1", "총매도호가잔량", "총매수호가잔량", "거래량회전율", + "전일동시간누적거래량", "전일동시간누적거래량비율" +] + + +def main(): + """ + 국내주식 시간외 실시간예상체결 (KRX) + + 국내주식 시간외 실시간예상체결 API입니다. +국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간예상체결 데이터 확인 가능합니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=overtime_exp_ccnl_krx, data=["023460"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/overtime_exp_ccnl_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/overtime_exp_ccnl_krx.py new file mode 100644 index 0000000..14633c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_ccnl_krx/overtime_exp_ccnl_krx.py @@ -0,0 +1,106 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간예상체결 (KRX) [실시간-024] +############################################################################################## + + +def overtime_exp_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간예상체결 (KRX)[H0STOAC0] + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간예상체결 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = subscribe_overtime_exp_ccnl_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 수신되며, 구독이 성공적으로 등록되면 실시간으로 데이터를 받을 수 있습니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STOAC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/chk_overtime_exp_trans_fluct.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/chk_overtime_exp_trans_fluct.py new file mode 100644 index 0000000..94dc47a --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/chk_overtime_exp_trans_fluct.py @@ -0,0 +1,87 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from overtime_exp_trans_fluct import overtime_exp_trans_fluct + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 시간외예상체결등락률 [국내주식-140] +############################################################################################## + +COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'iscd_stat_cls_code': '종목 상태 구분 코드', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'ovtm_untp_antc_cnpr': '시간외 단일가 예상 체결가', + 'ovtm_untp_antc_cntg_vrss': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_vrsssign': '시간외 단일가 예상 체결 대비', + 'ovtm_untp_antc_cntg_ctrt': '시간외 단일가 예상 체결 대비율', + 'ovtm_untp_askp_rsqn1': '시간외 단일가 매도호가 잔량1', + 'ovtm_untp_bidp_rsqn1': '시간외 단일가 매수호가 잔량1', + 'ovtm_untp_antc_cnqn': '시간외 단일가 예상 체결량', + 'itmt_vol': '장중 거래량', + 'stck_prpr': '주식 현재가' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 시간외예상체결등락률 조회 테스트 함수 + + 이 함수는 국내주식 시간외예상체결등락률 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = overtime_exp_trans_fluct( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11186", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_div_cls_code="0" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/overtime_exp_trans_fluct.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/overtime_exp_trans_fluct.py new file mode 100644 index 0000000..6a137a9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_exp_trans_fluct/overtime_exp_trans_fluct.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 시간외예상체결등락률 [국내주식-140] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/overtime-exp-trans-fluct" + +def overtime_exp_trans_fluct( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:주식) + fid_cond_scr_div_code: str, # [필수] 조건 화면 분류 코드 (ex. 11186) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_rank_sort_cls_code: str, # [필수] 순위 정렬 구분 코드 (ex. 0:상승률, 1:상승폭, 2:보합, 3:하락률, 4:하락폭) + fid_div_cls_code: str, # [필수] 분류 구분 코드 (ex. 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + fid_input_price_1: str = "", # 입력 가격1 + fid_input_price_2: str = "", # 입력 가격2 + fid_input_vol_1: str = "" # 입력 거래량 +) -> pd.DataFrame: + """ + 국내주식 시간외예상체결등락률 API입니다. + 한국투자 HTS(eFriend Plus) > [0236] 시간외 예상체결등락률 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:주식) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 11186) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_rank_sort_cls_code (str): [필수] 순위 정렬 구분 코드 (ex. 0:상승률, 1:상승폭, 2:보합, 3:하락률, 4:하락폭) + fid_div_cls_code (str): [필수] 분류 구분 코드 (ex. 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + fid_input_price_1 (str): 입력 가격1 + fid_input_price_2 (str): 입력 가격2 + fid_input_vol_1 (str): 입력 거래량 + + Returns: + pd.DataFrame: 국내주식 시간외예상체결등락률 데이터 + + Example: + >>> df = overtime_exp_trans_fluct("J", "11186", "0000", "0", "0") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11186')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0')") + + tr_id = "FHKST11860000" # 국내주식 시간외예상체결등락률 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/chk_overtime_fluctuation.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/chk_overtime_fluctuation.py new file mode 100644 index 0000000..3cd5338 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/chk_overtime_fluctuation.py @@ -0,0 +1,154 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from overtime_fluctuation import overtime_fluctuation + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시간외등락율순위[국내주식-138] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'ovtm_untp_uplm_issu_cnt': '시간외 단일가 상한 종목 수', + 'ovtm_untp_ascn_issu_cnt': '시간외 단일가 상승 종목 수', + 'ovtm_untp_stnr_issu_cnt': '시간외 단일가 보합 종목 수', + 'ovtm_untp_lslm_issu_cnt': '시간외 단일가 하한 종목 수', + 'ovtm_untp_down_issu_cnt': '시간외 단일가 하락 종목 수', + 'ovtm_untp_acml_vol': '시간외 단일가 누적 거래량', + 'ovtm_untp_acml_tr_pbmn': '시간외 단일가 누적 거래대금', + 'ovtm_untp_exch_vol': '시간외 단일가 거래소 거래량', + 'ovtm_untp_exch_tr_pbmn': '시간외 단일가 거래소 거래대금', + 'ovtm_untp_kosdaq_vol': '시간외 단일가 KOSDAQ 거래량', + 'ovtm_untp_kosdaq_tr_pbmn': '시간외 단일가 KOSDAQ 거래대금', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_askp1': '시간외 단일가 매도호가1', + 'ovtm_untp_seln_rsqn': '시간외 단일가 매도 잔량', + 'ovtm_untp_bidp1': '시간외 단일가 매수호가1', + 'ovtm_untp_shnu_rsqn': '시간외 단일가 매수 잔량', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'ovtm_vrss_acml_vol_rlim': '시간외 대비 누적 거래량 비중', + 'stck_prpr': '주식 현재가', + 'acml_vol': '누적 거래량', + 'bidp': '매수호가', + 'askp': '매도호가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 시간외등락율순위[국내주식-138] + + 국내주식 시간외등락율순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (J: 주식)) + - fid_mrkt_cls_code (str): 시장 구분 코드 (공백 입력) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20234)) + - fid_input_iscd (str): 입력 종목코드 (0000(전체), 0001(코스피), 1001(코스닥)) + - fid_div_cls_code (str): 분류 구분 코드 (1(상한가), 2(상승률), 3(보합),4(하한가),5(하락률)) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_trgt_cls_code (str): 대상 구분 코드 (공백 입력) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (공백 입력) + + Returns: + - Tuple[DataFrame, ...]: 국내주식 시간외등락율순위 결과 + + Example: + >>> df1, df2 = overtime_fluctuation(fid_cond_mrkt_div_code="J", fid_mrkt_cls_code="", fid_cond_scr_div_code="20234", fid_input_iscd="0000", fid_div_cls_code="1", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_trgt_cls_code="", fid_trgt_exls_cls_code="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = overtime_fluctuation( + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_mrkt_cls_code="", # 시장 구분 코드 + fid_cond_scr_div_code="20234", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_div_cls_code="2", # 분류 구분 코드 + fid_input_price_1="", # 입력 가격1 + fid_input_price_2="", # 입력 가격2 + fid_vol_cnt="", # 거래량 수 + fid_trgt_cls_code="", # 대상 구분 코드 + fid_trgt_exls_cls_code="", # 대상 제외 구분 코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/overtime_fluctuation.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/overtime_fluctuation.py new file mode 100644 index 0000000..32bea94 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_fluctuation/overtime_fluctuation.py @@ -0,0 +1,172 @@ +# DOMSTK_RANK - 국내주식 시간외등락율순위 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시간외등락율순위[국내주식-138] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/overtime-fluctuation" + +def overtime_fluctuation( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_mrkt_cls_code: str, # 시장 구분 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외등락율순위[국내주식-138] + 국내주식 시간외등락율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (J: 주식) + fid_mrkt_cls_code (str): 공백 입력 + fid_cond_scr_div_code (str): Unique key(20234) + fid_input_iscd (str): 0000(전체), 0001(코스피), 1001(코스닥) + fid_div_cls_code (str): 1(상한가), 2(상승률), 3(보합),4(하한가),5(하락률) + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_trgt_cls_code (str): 공백 입력 + fid_trgt_exls_cls_code (str): 공백 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 시간외등락율순위 데이터 + + Example: + >>> df1, df2 = overtime_fluctuation( + ... fid_cond_mrkt_div_code='J', + ... fid_mrkt_cls_code='', + ... fid_cond_scr_div_code='20234', + ... fid_input_iscd='0000', + ... fid_div_cls_code='1', + ... fid_input_price_1='', + ... fid_input_price_2='', + ... fid_vol_cnt='', + ... fid_trgt_cls_code='', + ... fid_trgt_exls_cls_code='' + ... ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20234')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20234')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHPST02340000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return overtime_fluctuation( + fid_cond_mrkt_div_code, + fid_mrkt_cls_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/chk_overtime_volume.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/chk_overtime_volume.py new file mode 100644 index 0000000..a8d79c6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/chk_overtime_volume.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from overtime_volume import overtime_volume + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 국내주식 > 국내주식 시간외거래량순위[국내주식-139] +############################################################################################## + +# 통합 컬럼 매핑 (모든 output에서 공통 사용) +COLUMN_MAPPING = { + 'ovtm_untp_exch_vol': '시간외 단일가 거래소 거래량', + 'ovtm_untp_exch_tr_pbmn': '시간외 단일가 거래소 거래대금', + 'ovtm_untp_kosdaq_vol': '시간외 단일가 KOSDAQ 거래량', + 'ovtm_untp_kosdaq_tr_pbmn': '시간외 단일가 KOSDAQ 거래대금', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'ovtm_untp_prpr': '시간외 단일가 현재가', + 'ovtm_untp_prdy_vrss': '시간외 단일가 전일 대비', + 'ovtm_untp_prdy_vrss_sign': '시간외 단일가 전일 대비 부호', + 'ovtm_untp_prdy_ctrt': '시간외 단일가 전일 대비율', + 'ovtm_untp_seln_rsqn': '시간외 단일가 매도 잔량', + 'ovtm_untp_shnu_rsqn': '시간외 단일가 매수 잔량', + 'ovtm_untp_vol': '시간외 단일가 거래량', + 'ovtm_vrss_acml_vol_rlim': '시간외 대비 누적 거래량 비중', + 'stck_prpr': '주식 현재가', + 'acml_vol': '누적 거래량', + 'bidp': '매수호가', + 'askp': '매도호가' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 시간외거래량순위[국내주식-139] + + 국내주식 시간외거래량순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (J: 주식)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20235)) + - fid_input_iscd (str): 입력 종목코드 (0000(전체), 0001(코스피), 1001(코스닥)) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0(매수잔량), 1(매도잔량), 2(거래량)) + - fid_input_price_1 (str): 입력 가격1 (가격 ~) + - fid_input_price_2 (str): 입력 가격2 (~ 가격) + - fid_vol_cnt (str): 거래량 수 (거래량 ~) + - fid_trgt_cls_code (str): 대상 구분 코드 (공백) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (공백) + + Returns: + - Tuple[DataFrame, ...]: 국내주식 시간외거래량순위 결과 + + Example: + >>> df1, df2 = overtime_volume(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20235", fid_input_iscd="0000", fid_rank_sort_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_trgt_cls_code="", fid_trgt_exls_cls_code="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + result1, result2 = overtime_volume( + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20235", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_input_price_1="", # 입력 가격1 + fid_input_price_2="", # 입력 가격2 + fid_vol_cnt="", # 거래량 수 + fid_trgt_cls_code="", # 대상 구분 코드 + fid_trgt_exls_cls_code="", # 대상 제외 구분 코드 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/overtime_volume.py b/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/overtime_volume.py new file mode 100644 index 0000000..c87d751 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/overtime_volume/overtime_volume.py @@ -0,0 +1,172 @@ +# [국내주식] 순위분석 - 국내주식 시간외거래량순위 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 국내주식 > 국내주식 시간외거래량순위[국내주식-139] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/overtime-volume" + +def overtime_volume( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외거래량순위[국내주식-139] + 국내주식 시간외거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (J: 주식) + fid_cond_scr_div_code (str): Unique key(20235) + fid_input_iscd (str): 0000(전체), 0001(코스피), 1001(코스닥) + fid_rank_sort_cls_code (str): 0(매수잔량), 1(매도잔량), 2(거래량) + fid_input_price_1 (str): 가격 ~ + fid_input_price_2 (str): ~ 가격 + fid_vol_cnt (str): 거래량 ~ + fid_trgt_cls_code (str): 공백 + fid_trgt_exls_cls_code (str): 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 시간외거래량순위 데이터 + + Example: + >>> df1, df2 = overtime_volume( + fid_cond_mrkt_div_code='J', + fid_cond_scr_div_code='20235', + fid_input_iscd='0000', + fid_rank_sort_cls_code='2', + fid_input_price_1='', + fid_input_price_2='', + fid_vol_cnt='', + fid_trgt_cls_code='', + fid_trgt_exls_cls_code='' + ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20235')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20235')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '2')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '2')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + tr_id = "FHPST02350000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return overtime_volume( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/chk_pbar_tratio.py b/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/chk_pbar_tratio.py new file mode 100644 index 0000000..831bb8d --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/chk_pbar_tratio.py @@ -0,0 +1,105 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pbar_tratio import pbar_tratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 매물대/거래비중 [국내주식-196] +############################################################################################## + +COLUMN_MAPPING = { + 'rprs_mrkt_kor_name': '대표시장한글명', + 'stck_shrn_iscd': '주식단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'stck_prpr': '주식현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'prdy_vol': '전일거래량', + 'wghn_avrg_stck_prc': '가중평균주식가격', + 'lstn_stcn': '상장주수', + 'data_rank': '데이터순위', + 'stck_prpr': '주식현재가', + 'cntg_vol': '체결거래량', + 'acml_vol_rlim': '누적거래량비중' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 국내주식 매물대/거래비중 조회 테스트 함수 + + 이 함수는 국내주식 매물대/거래비중 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = pbar_tratio( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_cond_scr_div_code="20113" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/pbar_tratio.py b/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/pbar_tratio.py new file mode 100644 index 0000000..d8fb0de --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pbar_tratio/pbar_tratio.py @@ -0,0 +1,81 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 매물대/거래비중 [국내주식-196] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/pbar-tratio" + +def pbar_tratio( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 20113) + fid_input_hour_1: str = "", # 입력시간 (기본값: "") +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 매물대/거래비중 API입니다. + 한국투자 HTS(eFriend Plus) > [0113] 당일가격대별 매물대 화면의 데이터 중 일부를 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 20113) + fid_input_hour_1 (str): 입력시간 (기본값: "") + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = pbar_tratio("J", "005930", "20113") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20113')") + + tr_id = "FHPST01130000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) - 단일 객체를 DataFrame으로 변환 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) - 배열을 DataFrame으로 변환 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/chk_pension_inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/chk_pension_inquire_balance.py new file mode 100644 index 0000000..ea67401 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/chk_pension_inquire_balance.py @@ -0,0 +1,129 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pension_inquire_balance import pension_inquire_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 잔고조회[v1_국내주식-036] +############################################################################################## + +COLUMN_MAPPING = { + 'cblc_dvsn_name': '잔고구분명', + 'prdt_name': '상품명', + 'pdno': '상품번호', + 'item_dvsn_name': '종목구분명', + 'thdt_buyqty': '금일매수수량', + 'thdt_sll_qty': '금일매도수량', + 'hldg_qty': '보유수량', + 'ord_psbl_qty': '주문가능수량', + 'pchs_avg_pric': '매입평균가격', + 'pchs_amt': '매입금액', + 'prpr': '현재가', + 'evlu_amt': '평가금액', + 'evlu_pfls_amt': '평가손익금액', + 'evlu_erng_rt': '평가수익율', + 'dnca_tot_amt': '예수금총금액', + 'nxdy_excc_amt': '익일정산금액', + 'prvs_rcdl_excc_amt': '가수도정산금액', + 'thdt_buy_amt': '금일매수금액', + 'thdt_sll_amt': '금일매도금액', + 'thdt_tlex_amt': '금일제비용금액', + 'scts_evlu_amt': '유가평가금액', + 'tot_evlu_amt': '총평가금액' +} + +NUMERIC_COLUMNS = [ + '금일매수수량', + '금일매도수량', + '보유수량', + '주문가능수량', + '매입평균가격', + '매입금액', + '현재가', + '평가금액', + '평가손익금액', + '평가수익율', + '예수금총금액', + '익일정산금액', + '가수도정산금액', + '금일매수금액', + '금일매도금액', + '금일제비용금액', + '유가평가금액', + '총평가금액' +] + + +def main(): + """ + 퇴직연금 잔고조회 테스트 함수 + + 이 함수는 퇴직연금 잔고조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = pension_inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00", + inqr_dvsn="00") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/pension_inquire_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/pension_inquire_balance.py new file mode 100644 index 0000000..7efef9e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_balance/pension_inquire_balance.py @@ -0,0 +1,130 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 잔고조회[v1_국내주식-036] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/pension/inquire-balance" + +def pension_inquire_balance( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd: str, # [필수] 적립금구분코드 (ex. 00) + inqr_dvsn: str, # [필수] 조회구분 (ex. 00) + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속 거래 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식, ETF, ETN만 조회 가능하며 펀드는 조회 불가합니다. + + ​※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + inqr_dvsn (str): [필수] 조회구분 (ex. 00) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 퇴직연금 잔고 데이터 + + Example: + >>> df1, df2 = pension_inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00", inqr_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if acca_dvsn_cd == "" or acca_dvsn_cd is None: + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + if inqr_dvsn == "" or inqr_dvsn is None: + raise ValueError("inqr_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC2208R" # 퇴직연금 잔고조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ACCA_DVSN_CD": acca_dvsn_cd, # 적립금구분코드 + "INQR_DVSN": inqr_dvsn, # 조회구분 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return pension_inquire_balance( + cano, acnt_prdt_cd, acca_dvsn_cd, inqr_dvsn, FK100, NK100, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/chk_pension_inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/chk_pension_inquire_daily_ccld.py new file mode 100644 index 0000000..bb35e5e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/chk_pension_inquire_daily_ccld.py @@ -0,0 +1,87 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pension_inquire_daily_ccld import pension_inquire_daily_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_gno_brno': '주문채번지점번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'trad_dvsn_name': '매매구분명', + 'odno': '주문번호', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'ord_unpr': '주문단가', + 'ord_qty': '주문수량', + 'tot_ccld_qty': '총체결수량', + 'nccs_qty': '미체결수량', + 'ord_dvsn_cd': '주문구분코드', + 'ord_dvsn_name': '주문구분명', + 'orgn_odno': '원주문번호', + 'ord_tmd': '주문시각', + 'objt_cust_dvsn_name': '대상고객구분명', + 'pchs_avg_pric': '매입평균가격' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 퇴직연금 미체결내역 조회 테스트 함수 + + 이 함수는 퇴직연금 미체결내역 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = pension_inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="%%", sll_buy_dvsn_cd="00", + ccld_nccs_dvsn="%%", inqr_dvsn_3="00") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/pension_inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/pension_inquire_daily_ccld.py new file mode 100644 index 0000000..3b0cefc --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_daily_ccld/pension_inquire_daily_ccld.py @@ -0,0 +1,129 @@ +""" +Created on 20250112 +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/pension/inquire-daily-ccld" + +def pension_inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + user_dvsn_cd: str, # 사용자구분코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + inqr_dvsn_3: str, # 조회구분3 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + user_dvsn_cd (str): [필수] 사용자구분코드 (ex. %%) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00: 전체, 01: 매도, 02: 매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. %%: 전체, 01: 체결, 02: 미체결) + inqr_dvsn_3 (str): [필수] 조회구분3 (ex. 00: 전체) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 퇴직연금 미체결내역 데이터 + + Example: + >>> df = pension_inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="%%", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="%%", inqr_dvsn_3="00") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if user_dvsn_cd == "": + raise ValueError("user_dvsn_cd is required (e.g. '%%')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00: 전체, 01: 매도, 02: 매수')") + + if ccld_nccs_dvsn == "": + raise ValueError("ccld_nccs_dvsn is required (e.g. '%%: 전체, 01: 체결, 02: 미체결')") + + if inqr_dvsn_3 == "": + raise ValueError("inqr_dvsn_3 is required (e.g. '00: 전체')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTC2201R" # 퇴직연금 미체결내역 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "USER_DVSN_CD": user_dvsn_cd, # 사용자구분코드 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, # 체결미체결구분 + "INQR_DVSN_3": inqr_dvsn_3, # 조회구분3 + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return pension_inquire_daily_ccld( + cano, acnt_prdt_cd, user_dvsn_cd, sll_buy_dvsn_cd, ccld_nccs_dvsn, inqr_dvsn_3, FK100, NK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/chk_pension_inquire_deposit.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/chk_pension_inquire_deposit.py new file mode 100644 index 0000000..ee62148 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/chk_pension_inquire_deposit.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pension_inquire_deposit import pension_inquire_deposit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 예수금조회[v1_국내주식-035] +############################################################################################## + +COLUMN_MAPPING = { + 'dnca_tota': '예수금총액', + 'nxdy_excc_amt': '익일정산액', + 'nxdy_sttl_amt': '익일결제금액', + 'nx2_day_sttl_amt': '2익일결제금액' +} + +NUMERIC_COLUMNS = ['예수금총액', '익일정산액', '익일결제금액', '2익일결제금액'] + + +def main(): + """ + 퇴직연금 예수금조회 테스트 함수 + + 이 함수는 퇴직연금 예수금조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = pension_inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/pension_inquire_deposit.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/pension_inquire_deposit.py new file mode 100644 index 0000000..e08244e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_deposit/pension_inquire_deposit.py @@ -0,0 +1,70 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 예수금조회[v1_국내주식-035] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/pension/inquire-deposit" + +def pension_inquire_deposit( + cano: str, # 종합계좌번호 (12345678) + acnt_prdt_cd: str, # 계좌상품코드 (29) + acca_dvsn_cd: str # 적립금구분코드 (00) +) -> pd.DataFrame: + """ + ​※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + + Returns: + pd.DataFrame: 퇴직연금 예수금 데이터 + + Example: + >>> df = pension_inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if acca_dvsn_cd == "": + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + tr_id = "TTTC0506R" # 퇴직연금 예수금조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ACCA_DVSN_CD": acca_dvsn_cd # 적립금구분코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/chk_pension_inquire_present_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/chk_pension_inquire_present_balance.py new file mode 100644 index 0000000..620022f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/chk_pension_inquire_present_balance.py @@ -0,0 +1,111 @@ +""" +Created on 20250115 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pension_inquire_present_balance import pension_inquire_present_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] +############################################################################################## + +COLUMN_MAPPING = { + 'cblc_dvsn': '잔고구분', + 'cblc_dvsn_name': '잔고구분명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'hldg_qty': '보유수량', + 'slpsb_qty': '매도가능수량', + 'pchs_avg_pric': '매입평균가격', + 'evlu_pfls_amt': '평가손익금액', + 'evlu_pfls_rt': '평가손익율', + 'prpr': '현재가', + 'evlu_amt': '평가금액', + 'pchs_amt': '매입금액', + 'cblc_weit': '잔고비중', + 'pchs_amt_smtl_amt': '매입금액합계금액', + 'evlu_amt_smtl_amt': '평가금액합계금액', + 'evlu_pfls_smtl_amt': '평가손익합계금액', + 'trad_pfls_smtl': '매매손익합계', + 'thdt_tot_pfls_amt': '당일총손익금액', + 'pftrt': '수익률' +} + +NUMERIC_COLUMNS = ['보유수량', '매도가능수량', '매입평균가격', '평가손익금액', + '평가손익율', '현재가', '평가금액', '매입금액', '잔고비중', '매입금액합계금액', '평가금액합계금액', '평가손익합계금액', + '매매손익합계', '당일총손익금액', '수익률'] + + +def main(): + """ + 퇴직연금 체결기준잔고 조회 테스트 함수 + + 이 함수는 퇴직연금 체결기준잔고 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # Case 1: 퇴직연금 체결기준잔고 조회 + logging.info("=== 퇴직연금 체결기준잔고 조회 ===") + try: + result1, result2 = pension_inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + user_dvsn_cd="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 (보유종목 정보) ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 (계좌 요약 정보) ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/pension_inquire_present_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/pension_inquire_present_balance.py new file mode 100644 index 0000000..4712311 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_present_balance/pension_inquire_present_balance.py @@ -0,0 +1,86 @@ +""" +Created on 20250115 +""" + +import sys +from typing import Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/pension/inquire-present-balance" + + +def pension_inquire_present_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + user_dvsn_cd: str, # 상품번호 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "" # 연속조회키100 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] + + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. '12345678') + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. '29') + user_dvsn_cd (str): [필수] 상품번호 (ex. '00') + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = pension_inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="00") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if user_dvsn_cd == "": + raise ValueError("user_dvsn_cd is required (e.g. '00')") + + tr_id = "TTTC2202R" # 퇴직연금 체결기준잔고 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "USER_DVSN_CD": user_dvsn_cd, # 상품번호 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (array) - 보유종목 정보 + output1_data = pd.DataFrame(res.getBody().output1) + + # output2 (array) - 계좌 요약 정보 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/chk_pension_inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/chk_pension_inquire_psbl_order.py new file mode 100644 index 0000000..5a981b7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/chk_pension_inquire_psbl_order.py @@ -0,0 +1,83 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from pension_inquire_psbl_order import pension_inquire_psbl_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] +############################################################################################## + +COLUMN_MAPPING = { + 'ord_psbl_cash': '주문가능현금', + 'ruse_psbl_amt': '재사용가능금액', + 'psbl_qty_calc_unpr': '가능수량계산단가', + 'max_buy_amt': '최대매수금액', + 'max_buy_qty': '최대매수수량' +} + +NUMERIC_COLUMNS = ['주문가능현금', '재사용가능금액', '가능수량계산단가', '최대매수금액', '최대매수수량'] + + +def main(): + """ + 퇴직연금 매수가능조회 테스트 함수 + + 이 함수는 퇴직연금 매수가능조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = pension_inquire_psbl_order( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="069500", + acca_dvsn_cd="00", + cma_evlu_amt_icld_yn="Y", + ord_unpr="30800", + ord_dvsn="00" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/pension_inquire_psbl_order.py b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/pension_inquire_psbl_order.py new file mode 100644 index 0000000..ecc6f9f --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/pension_inquire_psbl_order/pension_inquire_psbl_order.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/pension/inquire-psbl-order" + +def pension_inquire_psbl_order( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 29) + pdno: str, # [필수] 상품번호 (ex. 123456) + acca_dvsn_cd: str, # [필수] 적립금구분코드 (ex. 00) + cma_evlu_amt_icld_yn: str, # [필수] CMA평가금액포함여부 (ex. Y:포함, N:미포함) + ord_unpr: str, # [필수] 주문단가 + ord_dvsn: str # [필수] 주문구분 (ex. 00: 지정가, 01: 시장가) +) -> pd.DataFrame: + """ + [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] + + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + pdno (str): [필수] 상품번호 (ex. 123456) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y:포함, N:미포함) + ord_unpr (str): [필수] 주문단가 + ord_dvsn (str): [필수] 주문구분 (ex. 00: 지정가, 01: 시장가) + + Returns: + pd.DataFrame: 퇴직연금 매수가능조회 데이터 + + Example: + >>> df = pension_inquire_psbl_order( + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... pdno="069500", + ... acca_dvsn_cd="00", + ... cma_evlu_amt_icld_yn="Y", + ... ord_unpr="30800", + ... ord_dvsn="00" + ... ) + >>> print(df) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '123456')") + + if acca_dvsn_cd == "": + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y:포함, N:미포함')") + + if ord_unpr == "": + raise ValueError("ord_unpr is required") + + if ord_dvsn == "": + raise ValueError("ord_dvsn is required (e.g. '00: 지정가, 01: 시장가')") + + tr_id = "TTTC0503R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ACCA_DVSN_CD": acca_dvsn_cd, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "ORD_UNPR": ord_unpr, + "ORD_DVSN": ord_dvsn + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/period_rights/chk_period_rights.py b/한국투자증권(API)/examples_llm/domestic_stock/period_rights/chk_period_rights.py new file mode 100644 index 0000000..576e4fd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/period_rights/chk_period_rights.py @@ -0,0 +1,116 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from period_rights import period_rights + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별계좌권리현황조회 [국내주식-211] +############################################################################################## + +COLUMN_MAPPING = { + 'acno10': '계좌번호10', + 'rght_type_cd': '권리유형코드', + 'bass_dt': '기준일자', + 'rght_cblc_type_cd': '권리잔고유형코드', + 'rptt_pdno': '대표상품번호', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'shtn_pdno': '단축상품번호', + 'prdt_name': '상품명', + 'cblc_qty': '잔고수량', + 'last_alct_qty': '최종배정수량', + 'excs_alct_qty': '초과배정수량', + 'tot_alct_qty': '총배정수량', + 'last_ftsk_qty': '최종단수주수량', + 'last_alct_amt': '최종배정금액', + 'last_ftsk_chgs': '최종단수주대금', + 'rdpt_prca': '상환원금', + 'dlay_int_amt': '지연이자금액', + 'lstg_dt': '상장일자', + 'sbsc_end_dt': '청약종료일자', + 'cash_dfrm_dt': '현금지급일자', + 'rqst_qty': '신청수량', + 'rqst_amt': '신청금액', + 'rqst_dt': '신청일자', + 'rfnd_dt': '환불일자', + 'rfnd_amt': '환불금액', + 'lstg_stqt': '상장주수', + 'tax_amt': '세금금액', + 'sbsc_unpr': '청약단가' +} + +NUMERIC_COLUMNS = [ + '잔고수량', + '최종배정수량', + '초과배정수량', + '총배정수량', + '최종단수주수량', + '최종배정금액', + '최종단수주대금', + '상환원금', + '지연이자금액', + '신청수량', + '신청금액', + '환불금액', + '상장주수', + '세금금액', + '청약단가' +] + + +def main(): + """ + 기간별계좌권리현황조회 테스트 함수 + + 이 함수는 기간별계좌권리현황조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # 기간별계좌권리현황조회 + logging.info("=== 기간별계좌권리현황조회 ===") + try: + result = period_rights(inqr_dvsn="03", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", + inqr_end_dt="20250103") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/period_rights/period_rights.py b/한국투자증권(API)/examples_llm/domestic_stock/period_rights/period_rights.py new file mode 100644 index 0000000..3f61c41 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/period_rights/period_rights.py @@ -0,0 +1,140 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별계좌권리현황조회 [국내주식-211] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/trading/period-rights" + +def period_rights( + inqr_dvsn: str, # [필수] 조회구분 (ex. 03) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01 or 22) + inqr_strt_dt: str, # [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt: str, # [필수] 조회종료일자 (ex. 20250103) + cust_rncno25: str = "", # 고객실명확인번호25 + hmid: str = "", # 홈넷ID + rght_type_cd: str = "", # 권리유형코드 + pdno: str = "", # 상품번호 + prdt_type_cd: str = "", # 상품유형코드 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 기간별계좌권리현황조회 API입니다. + 한국투자 HTS(eFriend Plus) > [7344] 권리유형별 현황조회 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + inqr_dvsn (str): [필수] 조회구분 (ex. 03) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01 or 22) + inqr_strt_dt (str): [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt (str): [필수] 조회종료일자 (ex. 20250103) + cust_rncno25 (str): 고객실명확인번호25 + hmid (str): 홈넷ID + rght_type_cd (str): 권리유형코드 + pdno (str): 상품번호 + prdt_type_cd (str): 상품유형코드 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 기간별계좌권리현황 데이터 + + Example: + >>> df = period_rights(inqr_dvsn="03", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", inqr_end_dt="20250103") + >>> print(df) + """ + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '03')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01' or '22')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20250103')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTRGA011R" # 기간별계좌권리현황조회 + + params = { + "INQR_DVSN": inqr_dvsn, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "CUST_RNCNO25": cust_rncno25, + "HMID": hmid, + "RGHT_TYPE_CD": rght_type_cd, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "CTX_AREA_NK100": NK100, + "CTX_AREA_FK100": FK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return period_rights( + inqr_dvsn, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + cust_rncno25, hmid, rght_type_cd, pdno, prdt_type_cd, + NK100, FK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/chk_prefer_disparate_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/chk_prefer_disparate_ratio.py new file mode 100644 index 0000000..de624bd --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/chk_prefer_disparate_ratio.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from prefer_disparate_ratio import prefer_disparate_ratio + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 우선주_괴리율 상위[v1_국내주식-094] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'acml_vol': '누적 거래량', + 'prst_iscd': '우선주 종목코드', + 'prst_kor_isnm': '우선주 한글 종목명', + 'prst_prpr': '우선주 현재가', + 'prst_prdy_vrss': '우선주 전일대비', + 'prst_prdy_vrss_sign': '우선주 전일 대비 부호', + 'prst_acml_vol': '우선주 누적 거래량', + 'diff_prpr': '차이 현재가', + 'dprt': '괴리율', + 'prdy_ctrt': '전일 대비율', + 'prst_prdy_ctrt': '우선주 전일 대비율' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 순위분석 + 국내주식 우선주_괴리율 상위[v1_국내주식-094] + + 국내주식 우선주_괴리율 상위 테스트 함수 + + Parameters: + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20177 )) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + Returns: + - DataFrame: 국내주식 우선주_괴리율 상위 결과 + + Example: + >>> df = prefer_disparate_ratio(fid_vol_cnt="1000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20177", fid_div_cls_code="0", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="10000", fid_input_price_2="50000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = prefer_disparate_ratio( + fid_vol_cnt="1000", # 거래량 수 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20177", # 조건 화면 분류 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_input_price_1="10000", # 입력 가격1 + fid_input_price_2="50000", # 입력 가격2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 우선주_괴리율 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/prefer_disparate_ratio.py b/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/prefer_disparate_ratio.py new file mode 100644 index 0000000..efd29fe --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/prefer_disparate_ratio/prefer_disparate_ratio.py @@ -0,0 +1,156 @@ +# DOMSTK_RANK - 국내주식 우선주/괴리율 상위 +# Generated by KIS API Generator (Single API Mode) +import sys + +import logging +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 우선주_괴리율 상위[v1_국내주식-094] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/prefer-disparate-ratio" + +def prefer_disparate_ratio( + fid_vol_cnt: str, # 거래량 수 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 우선주_괴리율 상위[v1_국내주식-094] + 국내주식 우선주_괴리율 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20177 ) + fid_div_cls_code (str): 0: 전체 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 우선주_괴리율 상위 데이터 + + Example: + >>> df = prefer_disparate_ratio( + ... fid_vol_cnt="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20177", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20177')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20177')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01770000" + + params = { + "fid_vol_cnt": fid_vol_cnt, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return prefer_disparate_ratio( + fid_vol_cnt, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/chk_profit_asset_index.py b/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/chk_profit_asset_index.py new file mode 100644 index 0000000..fa7ef99 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/chk_profit_asset_index.py @@ -0,0 +1,111 @@ +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from profit_asset_index import profit_asset_index + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 수익자산지표 순위[v1_국내주식-090] +############################################################################################## + +COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'prdy_vrss_sign': '전일 대비 부호', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'sale_totl_prfi': '매출 총 이익', + 'bsop_prti': '영업 이익', + 'op_prfi': '경상 이익', + 'thtr_ntin': '당기순이익', + 'total_aset': '자산총계', + 'total_lblt': '부채총계', + 'total_cptl': '자본총계', + 'stac_month': '결산 월', + 'stac_month_cls_code': '결산 월 구분 코드', + 'iqry_csnu': '조회 건수' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 순위분석 + 국내주식 수익자산지표 순위[v1_국내주식-090] + + 국내주식 수익자산지표 순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_trgt_cls_code (str): 대상 구분 코드 (0:전체) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20173 )) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_input_option_1 (str): 입력 옵션1 (회계연도 (2023)) + - fid_input_option_2 (str): 입력 옵션2 (0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0:매출이익 1:영업이익 2:경상이익 3:당기순이익 4:자산총계 5:부채총계 6:자본총계) + - fid_blng_cls_code (str): 소속 구분 코드 (0:전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0:전체) + Returns: + - DataFrame: 국내주식 수익자산지표 순위 결과 + + Example: + >>> df = profit_asset_index(fid_cond_mrkt_div_code="J", fid_trgt_cls_code="0", fid_cond_scr_div_code="20173", fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="0", fid_rank_sort_cls_code="0", fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + result = profit_asset_index( + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드, + fid_trgt_cls_code="0", # 대상 구분 코드, + fid_cond_scr_div_code="20173", # 조건 화면 분류 코드, + fid_input_iscd="0000", # 입력 종목코드, + fid_div_cls_code="0", # 분류 구분 코드, + fid_input_price_1="", # 입력 가격1, + fid_input_price_2="", # 입력 가격2, + fid_vol_cnt="", # 거래량 수, + fid_input_option_1="2023", # 입력 옵션1, + fid_input_option_2="0", # 입력 옵션2, + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드, + fid_blng_cls_code="0", # 소속 구분 코드, + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 수익자산지표 순위 결과 ===") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/profit_asset_index.py b/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/profit_asset_index.py new file mode 100644 index 0000000..f56115c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/profit_asset_index/profit_asset_index.py @@ -0,0 +1,169 @@ +# DOMSTK_RANK - 국내주식 수익자산지표 순위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 수익자산지표 순위[v1_국내주식-090] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/profit-asset-index" + +def profit_asset_index( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 수익자산지표 순위[v1_국내주식-090] + 국내주식 수익자산지표 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (필수) (J:KRX, NX:NXT) + fid_trgt_cls_code (str): 대상 구분 코드 (필수) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (필수) + fid_input_iscd (str): 입력 종목코드 (필수) + fid_div_cls_code (str): 분류 구분 코드 (필수) + fid_input_price_1 (str): 입력 가격1 (필수) + fid_input_price_2 (str): 입력 가격2 (필수) + fid_vol_cnt (str): 거래량 수 (필수) + fid_input_option_1 (str): 입력 옵션1 (필수) + fid_input_option_2 (str): 입력 옵션2 (필수) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (필수) + fid_blng_cls_code (str): 소속 구분 코드 (필수) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + + Returns: + Optional[pd.DataFrame]: 국내주식 수익자산지표 순위 데이터 + + Example: + >>> df = profit_asset_index( + ... fid_cond_mrkt_div_code="J", + ... fid_trgt_cls_code="0", + ... fid_cond_scr_div_code="20173", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="0", + ... fid_rank_sort_cls_code="0", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_scr_div_code != "20173": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_1 != "2023": + raise ValueError("입력 옵션1 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["0", "1", "2", "3", "4", "5", "6"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code != "0": + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01730000" + + params = { + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return profit_asset_index( + fid_cond_mrkt_div_code, + fid_trgt_cls_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/chk_program_trade_by_stock.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/chk_program_trade_by_stock.py new file mode 100644 index 0000000..525b282 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/chk_program_trade_by_stock.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from program_trade_by_stock import program_trade_by_stock + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(체결)[v1_국내주식-044] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_hour': '영업 시간', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'whol_smtn_seln_vol': '전체 합계 매도 거래량', + 'whol_smtn_shnu_vol': '전체 합계 매수2 거래량', + 'whol_smtn_ntby_qty': '전체 합계 순매수 수량', + 'whol_smtn_seln_tr_pbmn': '전체 합계 매도 거래 대금', + 'whol_smtn_shnu_tr_pbmn': '전체 합계 매수2 거래 대금', + 'whol_smtn_ntby_tr_pbmn': '전체 합계 순매수 거래 대금', + 'whol_ntby_vol_icdc': '전체 순매수 거래량 증감', + 'whol_ntby_tr_pbmn_icdc': '전체 순매수 거래 대금 증감' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별 프로그램매매추이(체결) 조회 테스트 함수 + + 이 함수는 종목별 프로그램매매추이(체결) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # 종목별 프로그램매매추이 조회 + logging.info("=== 종목별 프로그램매매추이(체결) 조회 ===") + try: + result = program_trade_by_stock(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 자료형 명시 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/program_trade_by_stock.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/program_trade_by_stock.py new file mode 100644 index 0000000..afa96df --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock/program_trade_by_stock.py @@ -0,0 +1,66 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(체결)[v1_국내주식-044] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/program-trade-by-stock" + +def program_trade_by_stock( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd: str # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 종목별 프로그램매매추이(체결) API입니다. + + 한국투자 HTS(eFriend Plus) > [0465] 종목별 프로그램 매매추이 화면(혹은 한국투자 MTS > 국내 현재가 > 기타수급 > 프로그램) 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 종목별 프로그램매매추이 데이터 + + Example: + >>> df = program_trade_by_stock(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (ex. J:KRX,NX:NXT,UN:통합)") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (ex. 123456)") + + tr_id = "FHPPG04650101" # 종목별 프로그램매매추이(체결) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd # 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/chk_program_trade_by_stock_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/chk_program_trade_by_stock_daily.py new file mode 100644 index 0000000..ac3a7df --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/chk_program_trade_by_stock_daily.py @@ -0,0 +1,83 @@ +""" +Created on 20250601 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from program_trade_by_stock_daily import program_trade_by_stock_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(일별) [국내주식-113] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'whol_smtn_seln_vol': '전체 합계 매도 거래량', + 'whol_smtn_shnu_vol': '전체 합계 매수2 거래량', + 'whol_smtn_ntby_qty': '전체 합계 순매수 수량', + 'whol_smtn_seln_tr_pbmn': '전체 합계 매도 거래 대금', + 'whol_smtn_shnu_tr_pbmn': '전체 합계 매수2 거래 대금', + 'whol_smtn_ntby_tr_pbmn': '전체 합계 순매수 거래 대금', + 'whol_ntby_vol_icdc': '전체 순매수 거래량 증감', + 'whol_ntby_tr_pbmn_icdc2': '전체 순매수 거래 대금 증감2' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목별 프로그램매매추이(일별) 조회 테스트 함수 + + 이 함수는 종목별 프로그램매매추이(일별) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = program_trade_by_stock_daily(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/program_trade_by_stock_daily.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/program_trade_by_stock_daily.py new file mode 100644 index 0000000..bec4b9b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_by_stock_daily/program_trade_by_stock_daily.py @@ -0,0 +1,67 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(일별) [국내주식-113] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/program-trade-by-stock-daily" + +def program_trade_by_stock_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_input_date_1: str = "" # [필수] 입력날짜 (초기값: "") +) -> pd.DataFrame: + """ + 국내주식 종목별 프로그램매매추이(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0465] 종목별 프로그램 매매추이 화면(혹은 한국투자 MTS > 국내 현재가 > 기타수급 > 프로그램) 의 "일자별" 클릭 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_date_1 (str): [필수] 입력날짜 (초기값: "") + + Returns: + pd.DataFrame: 종목별 프로그램매매추이(일별) 데이터 + + Example: + >>> df = program_trade_by_stock_daily("J", "005930") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (ex. J:KRX,NX:NXT,UN:통합)") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (ex. 123456)") + + tr_id = "FHPPG04650201" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/chk_program_trade_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/chk_program_trade_krx.py new file mode 100644 index 0000000..5f4092e --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/chk_program_trade_krx.py @@ -0,0 +1,103 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from program_trade_krx import program_trade_krx + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (KRX) [실시간-048] +############################################################################################## + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "seln_cnqn": "매도체결량", + "seln_tr_pbmn": "매도거래대금", + "shnu_cnqn": "매수2체결량", + "shnu_tr_pbmn": "매수2거래대금", + "ntby_cnqn": "순매수체결량", + "ntby_tr_pbmn": "순매수거래대금", + "seln_rsqn": "매도호가잔량", + "shnu_rsqn": "매수호가잔량", + "whol_ntby_qty": "전체순매수호가잔량" +} + +NUMERIC_COLUMNS = [ + "매도체결량", "매도거래대금", "매수2체결량", "매수2거래대금", + "순매수체결량", "순매수거래대금", "매도호가잔량", "매수호가잔량", "전체순매수호가잔량" +] + + +def main(): + """ + 국내주식 실시간프로그램매매 (KRX) + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=program_trade_krx, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/program_trade_krx.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/program_trade_krx.py new file mode 100644 index 0000000..ae67091 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_krx/program_trade_krx.py @@ -0,0 +1,77 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (KRX) [실시간-048] +############################################################################################## + +def program_trade_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (KRX)[H0STPGM0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내 주식의 프로그램 매매 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제를 지원합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 웹소켓을 통해 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = program_trade_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신되며, 구독 해제 요청을 보내기 전까지 계속됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # 거래 ID 설정 + tr_id = "H0STPGM0" + + # 요청 파라미터 설정 + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", # 유가증권단축종목코드 + "stck_cntg_hour", # 주식체결시간 + "seln_cnqn", # 매도체결량 + "seln_tr_pbmn", # 매도거래대금 + "shnu_cnqn", # 매수2체결량 + "shnu_tr_pbmn", # 매수2거래대금 + "ntby_cnqn", # 순매수체결량 + "ntby_tr_pbmn", # 순매수거래대금 + "seln_rsqn", # 매도호가잔량 + "shnu_rsqn", # 매수호가잔량 + "whol_ntby_qty", # 전체순매수호가잔량 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/chk_program_trade_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/chk_program_trade_nxt.py new file mode 100644 index 0000000..e027429 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/chk_program_trade_nxt.py @@ -0,0 +1,86 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from program_trade_nxt import program_trade_nxt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (NXT) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "STCK_CNTG_HOUR": "주식 체결 시간", + "SELN_CNQN": "매도 체결량", + "SELN_TR_PBMN": "매도 거래 대금", + "SHNU_CNQN": "매수2 체결량", + "SHNU_TR_PBMN": "매수2 거래 대금", + "NTBY_CNQN": "순매수 체결량", + "NTBY_TR_PBMN": "순매수 거래 대금", + "SELN_RSQN": "매도호가잔량", + "SHNU_RSQN": "매수호가잔량", + "WHOL_NTBY_QTY": "전체순매수호가잔량" +} + +NUMERIC_COLUMNS = [ + "매도 체결량", "매도 거래 대금", "매수2 체결량", + "매수2 거래 대금", "순매수 체결량", "순매수 거래 대금", + "매도호가잔량", "매수호가잔량", "전체순매수호가잔량" +] + + +def main(): + """ + 국내주식 실시간프로그램매매 (NXT) + + 국내주식 실시간프로그램매매 (NXT) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=program_trade_nxt, data=["032640", "010950"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/program_trade_nxt.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/program_trade_nxt.py new file mode 100644 index 0000000..78985bf --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_nxt/program_trade_nxt.py @@ -0,0 +1,73 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (NXT) +############################################################################################## + +def program_trade_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (NXT)[H0NXPGM0] + 국내주식 실시간프로그램매매 (NXT) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Example: + >>> msg, columns = program_trade_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트됩니다. 구독을 해제하지 않으면 데이터 스트림이 계속 유지됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # 거래 ID 설정 + tr_id = "H0NXPGM0" + + # 요청 파라미터 설정 + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 유가증권 단축 종목코드 + "STCK_CNTG_HOUR", # 주식 체결 시간 + "SELN_CNQN", # 매도 체결량 + "SELN_TR_PBMN", # 매도 거래 대금 + "SHNU_CNQN", # 매수2 체결량 + "SHNU_TR_PBMN", # 매수2 거래 대금 + "NTBY_CNQN", # 순매수 체결량 + "NTBY_TR_PBMN", # 순매수 거래 대금 + "SELN_RSQN", # 매도호가잔량 + "SHNU_RSQN", # 매수호가잔량 + "WHOL_NTBY_QTY", # 전체순매수호가잔량 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/chk_program_trade_total.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/chk_program_trade_total.py new file mode 100644 index 0000000..db8c4af --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/chk_program_trade_total.py @@ -0,0 +1,85 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from program_trade_total import program_trade_total + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (통합) +############################################################################################## + +COLUMN_MAPPING = { + "MKSC_SHRN_ISCD": "유가증권 단축 종목코드", + "STCK_CNTG_HOUR": "주식 체결 시간", + "SELN_CNQN": "매도 체결량", + "SELN_TR_PBMN": "매도 거래 대금", + "SHNU_CNQN": "매수2 체결량", + "SHNU_TR_PBMN": "매수2 거래 대금", + "NTBY_CNQN": "순매수 체결량", + "NTBY_TR_PBMN": "순매수 거래 대금", + "SELN_RSQN": "매도호가잔량", + "SHNU_RSQN": "매수호가잔량", + "WHOL_NTBY_QTY": "전체순매수호가잔량" +} + +NUMERIC_COLUMNS = [ + "매도 체결량", "매도 거래 대금", "매수2 체결량", "매수2 거래 대금", + "순매수 체결량", "순매수 거래 대금", "매도호가잔량", "매수호가잔량", "전체순매수호가잔량" +] + + +def main(): + """ + 국내주식 실시간프로그램매매 (통합) + + 국내주식 실시간프로그램매매 (통합) API입니다. + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=program_trade_total, data=["005930", "000660"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 컬럼 매핑 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 변환 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/program_trade_total.py b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/program_trade_total.py new file mode 100644 index 0000000..e691489 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/program_trade_total/program_trade_total.py @@ -0,0 +1,75 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (통합) +############################################################################################## + +def program_trade_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (통합)[H0UNPGM0] + 국내주식 실시간프로그램매매 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = program_trade_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. + 구독을 시작하려면 tr_type을 "1"로 설정하고, 해제하려면 "0"으로 설정하세요. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0UNPGM0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 유가증권 단축 종목코드 + "STCK_CNTG_HOUR", # 주식 체결 시간 + "SELN_CNQN", # 매도 체결량 + "SELN_TR_PBMN", # 매도 거래 대금 + "SHNU_CNQN", # 매수2 체결량 + "SHNU_TR_PBMN", # 매수2 거래 대금 + "NTBY_CNQN", # 순매수 체결량 + "NTBY_TR_PBMN", # 순매수 거래 대금 + "SELN_RSQN", # 매도호가잔량 + "SHNU_RSQN", # 매수호가잔량 + "WHOL_NTBY_QTY", # 전체순매수호가잔량 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/chk_psearch_result.py b/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/chk_psearch_result.py new file mode 100644 index 0000000..7b48f2c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/chk_psearch_result.py @@ -0,0 +1,93 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from psearch_result import psearch_result + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색조회 [국내주식-039] +############################################################################################## + +COLUMN_MAPPING = { + 'code': '종목코드', + 'name': '종목명', + 'daebi': '전일대비부호', + 'price': '현재가', + 'chgrate': '등락율', + 'acml_vol': '거래량', + 'trade_amt': '거래대금', + 'change': '전일대비', + 'cttr': '체결강도', + 'open': '시가', + 'high': '고가', + 'low': '저가', + 'high52': '52주최고가', + 'low52': '52주최저가', + 'expprice': '예상체결가', + 'expchange': '예상대비', + 'expchggrate': '예상등락률', + 'expcvol': '예상체결수량', + 'chgrate2': '전일거래량대비율', + 'expdaebi': '예상대비부호', + 'recprice': '기준가', + 'uplmtprice': '상한가', + 'dnlmtprice': '하한가', + 'stotprice': '시가총액' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목조건검색조회 테스트 함수 + + 이 함수는 종목조건검색조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = psearch_result(user_id=trenv.my_htsid, seq="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/psearch_result.py b/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/psearch_result.py new file mode 100644 index 0000000..a60a0b4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/psearch_result/psearch_result.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색조회 [국내주식-039] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/psearch-result" + +def psearch_result( + user_id: str, # 사용자 HTS ID + seq: str # 사용자조건 키값 +) -> pd.DataFrame: + """ + HTS(efriend Plus) [0110] 조건검색에서 등록 및 서버저장한 나의 조건 목록을 확인할 수 있는 API입니다. + 종목조건검색 목록조회 API(/uapi/domestic-stock/v1/quotations/psearch-title)의 output인 'seq'을 종목조건검색조회 API(/uapi/domestic-stock/v1/quotations/psearch-result)의 input으로 사용하시면 됩니다. + + ※ 시스템 안정성을 위해 API로 제공되는 조건검색 결과의 경우 조건당 100건으로 제한을 둔 점 양해 부탁드립니다. + + ※ [0110] 화면의 '대상변경' 설정사항은 HTS [0110] 사용자 조건검색 화면에만 적용됨에 유의 부탁드립니다. + + ※ '조회가 계속 됩니다. (다음을 누르십시오.)' 오류 발생 시 해결방법 + → HTS(efriend Plus) [0110] 조건검색 화면에서 조건을 등록하신 후, 왼쪽 하단의 "사용자조건 서버저장" 클릭하셔서 등록한 조건들을 서버로 보낸 후 다시 API 호출 시도 부탁드립니다. + + ※ {"rt_cd":"1","msg_cd":"MCA05918","msg1":"종목코드 오류입니다."} 메시지 발생 이유 + → 조건검색 결과 검색된 종목이 0개인 경우 위 응답값을 수신하게 됩니다. + + Args: + user_id (str): [필수] 사용자 HTS ID + seq (str): [필수] 사용자조건 키값 (종목조건검색 목록조회 API의 output인 'seq'을 이용) + + Returns: + pd.DataFrame: 종목조건검색조회 데이터 + + Example: + >>> df = psearch_result(user_id=trenv.my_htsid, seq="0") + >>> print(df) + """ + + if user_id == "": + raise ValueError("user_id is required") + + if seq == "": + raise ValueError("seq is required (e.g. '종목조건검색 목록조회 API의 output인 'seq'을 이용')") + + tr_id = "HHKST03900400" # 종목조건검색조회 + + params = { + "user_id": user_id, # 사용자 HTS ID + "seq": seq # 사용자조건 키값 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/chk_psearch_title.py b/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/chk_psearch_title.py new file mode 100644 index 0000000..cdae42b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/chk_psearch_title.py @@ -0,0 +1,74 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from psearch_title import psearch_title + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] +############################################################################################## + +COLUMN_MAPPING = { + 'user_id': 'HTS ID', + 'seq': '조건키값', + 'grp_nm': '그룹명', + 'condition_nm': '조건명' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + 종목조건검색 목록조회 테스트 함수 + + 이 함수는 종목조건검색 목록조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 메타데이터의 case1을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = psearch_title(user_id=trenv.my_htsid) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/psearch_title.py b/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/psearch_title.py new file mode 100644 index 0000000..d087776 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/psearch_title/psearch_title.py @@ -0,0 +1,67 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/psearch-title" + +def psearch_title( + user_id: str # [필수] 사용자 HTS ID (ex. U:업종) +) -> pd.DataFrame: + """ + [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] + HTS(efriend Plus) [0110] 조건검색에서 등록 및 서버저장한 나의 조건 목록을 확인할 수 있는 API입니다. + 종목조건검색 목록조회 API(/uapi/domestic-stock/v1/quotations/psearch-title)의 output인 'seq'을 종목조건검색조회 API(/uapi/domestic-stock/v1/quotations/psearch-result)의 input으로 사용하시면 됩니다. + + ※ 시스템 안정성을 위해 API로 제공되는 조건검색 결과의 경우 조건당 100건으로 제한을 둔 점 양해 부탁드립니다. + + ※ [0110] 화면의 '대상변경' 설정사항은 HTS [0110] 사용자 조건검색 화면에만 적용됨에 유의 부탁드립니다. + + ※ '조회가 계속 됩니다. (다음을 누르십시오.)' 오류 발생 시 해결방법 + → HTS(efriend Plus) [0110] 조건검색 화면에서 조건을 등록하신 후, 왼쪽 하단의 "사용자조건 서버저장" 클릭하셔서 등록한 조건들을 서버로 보낸 후 다시 API 호출 시도 부탁드립니다. + + Args: + user_id (str): [필수] 사용자 HTS ID (ex. U:업종) + + Returns: + pd.DataFrame: 종목조건검색 목록 데이터 + + Example: + >>> df = psearch_title(user_id=trenv.my_htsid) + >>> print(df) + """ + + if user_id == "": + raise ValueError("user_id is required (e.g. 'U:업종')") + + tr_id = "HHKST03900300" # 종목조건검색 목록조회 + + params = { + "user_id": user_id # 사용자 HTS ID + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/chk_quote_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/chk_quote_balance.py new file mode 100644 index 0000000..77c0267 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/chk_quote_balance.py @@ -0,0 +1,99 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from quote_balance import quote_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 호가잔량 순위[국내주식-089] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'total_askp_rsqn': '총 매도호가 잔량', + 'total_bidp_rsqn': '총 매수호가 잔량', + 'total_ntsl_bidp_rsqn': '총 순 매수호가 잔량', + 'shnu_rsqn_rate': '매수 잔량 비율', + 'seln_rsqn_rate': '매도 잔량 비율' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 호가잔량 순위[국내주식-089] + + 국내주식 호가잔량 순위 테스트 함수 + + Parameters: + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20172 )) + - fid_input_iscd (str): 입력 종목코드 (0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0: 순매수잔량순, 1:순매도잔량순, 2:매수비율순, 3:매도비율순) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체) + - fid_trgt_cls_code (str): 대상 구분 코드 (0:전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0:전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + Returns: + - DataFrame: 국내주식 호가잔량 순위 결과 + + Example: + >>> df = quote_balance(fid_vol_cnt="1000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20172", fid_input_iscd="0001", fid_rank_sort_cls_code="0", fid_div_cls_code="0", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="50000", fid_input_price_2="100000") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + result = quote_balance( + fid_vol_cnt="1000", # 거래량 수, + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드, + fid_cond_scr_div_code="20172", # 조건 화면 분류 코드, + fid_input_iscd="0001", # 입력 종목코드, + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드, + fid_div_cls_code="0", # 분류 구분 코드, + fid_trgt_cls_code="0", # 대상 구분 코드, + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드, + fid_input_price_1="50000", # 입력 가격1, + fid_input_price_2="100000", # 입력 가격2 + ) + + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 호가잔량 순위 결과 ===") + print(result) + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/quote_balance.py b/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/quote_balance.py new file mode 100644 index 0000000..b490457 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/quote_balance/quote_balance.py @@ -0,0 +1,148 @@ +# DOMSTK_RANK - 국내주식 호가잔량 순위 +# Generated by KIS API Generator (Single API Mode) +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 호가잔량 순위[국내주식-089] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/quote-balance" + +def quote_balance( + fid_vol_cnt: str, # 거래량 수 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 호가잔량 순위[국내주식-089] + 국내주식 호가잔량 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20172 ) + fid_input_iscd (str): 0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001) + fid_rank_sort_cls_code (str): 0: 순매수잔량순, 1:순매도잔량순, 2:매수비율순, 3:매도비율순 + fid_div_cls_code (str): 0:전체 + fid_trgt_cls_code (str): 0:전체 + fid_trgt_exls_cls_code (str): 0:전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 호가잔량 순위 데이터 + + Example: + >>> df = quote_balance( + ... fid_vol_cnt="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20172", + ... fid_input_iscd="0000", + ... fid_rank_sort_cls_code="0", + ... fid_div_cls_code="0", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20172": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_rank_sort_cls_code not in ["0", "1", "2", "3"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01720000" + + params = { + "fid_vol_cnt": fid_vol_cnt, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return quote_balance( + fid_vol_cnt, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 출력 + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/search_info/chk_search_info.py b/한국투자증권(API)/examples_llm/domestic_stock/search_info/chk_search_info.py new file mode 100644 index 0000000..4cb2aee --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/search_info/chk_search_info.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from search_info import search_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 상품기본조회[v1_국내주식-029] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'std_pdno': '표준상품번호', + 'shtn_pdno': '단축상품번호', + 'prdt_sale_stat_cd': '상품판매상태코드', + 'prdt_risk_grad_cd': '상품위험등급코드', + 'prdt_clsf_cd': '상품분류코드', + 'sale_strt_dt': '판매시작일자', + 'sale_end_dt': '판매종료일자', + 'wrap_asst_type_cd': '랩어카운트자산유형코드', + 'ivst_prdt_type_cd': '투자상품유형코드', + 'frst_erlm_dt': '최초등록일자' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 상품기본조회[v1_국내주식-029] + + 상품기본조회 테스트 함수 + + Parameters: + - pdno (str): 상품번호 ('주식(하이닉스) : 000660 (코드 : 300) 선물(101S12) : KR4101SC0009 (코드 : 301) 미국(AAPL) : AAPL (코드 : 512)') + - prdt_type_cd (str): 상품유형코드 ('300 주식 301 선물옵션 302 채권 512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 515 일본 501 홍콩 / 543 홍콩CNY / 558 홍콩USD 507 베트남 하노이 / 508 베트남 호치민 551 중국 상해A / 552 중국 심천A') + Returns: + - DataFrame: 상품기본조회 결과 + + Example: + >>> df = search_info(pdno="000660", prdt_type_cd="300") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = search_info( + pdno="000660", # pdno = "AAPL", # 상품번호 + prdt_type_cd="300", # prdt_type_cd = "512", # 상품유형코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 상품기본조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/search_info/search_info.py b/한국투자증권(API)/examples_llm/domestic_stock/search_info/search_info.py new file mode 100644 index 0000000..39c04e7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/search_info/search_info.py @@ -0,0 +1,121 @@ +# [국내주식] 종목정보 - 상품기본조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 상품기본조회[v1_국내주식-029] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/search-info" + +def search_info( + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 상품기본조회[v1_국내주식-029] + 상품기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 상품번호 (예: '000660', 'KR4101SC0009', 'AAPL') + prdt_type_cd (str): 상품유형코드 (예: '300', '301', '512') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 상품기본조회 데이터 + + Example: + >>> df = search_info('AAPL', '512') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '300')") + raise ValueError("prdt_type_cd is required. (e.g. '300')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "CTPF1604R" + + # 요청 파라미터 설정 + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/chk_search_stock_info.py b/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/chk_search_stock_info.py new file mode 100644 index 0000000..25570ce --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/chk_search_stock_info.py @@ -0,0 +1,154 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from search_stock_info import search_stock_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 주식기본조회[v1_국내주식-067] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'prdt_name': '상품명', + 'prdt_name120': '상품명(120자)', + 'prdt_abrv_name': '상품약어명', + 'prdt_eng_name': '상품영문명', + 'prdt_eng_name120': '상품영문명(120자)', + 'prdt_eng_abrv_name': '상품영문약어명', + 'mket_id_cd': '시장ID코드', + 'scty_grp_id_cd': '증권그룹ID코드', + 'excg_dvsn_cd': '거래소구분코드', + 'setl_mmdd': '결산월일', + 'lstg_stqt': '상장주수', + 'lstg_cptl_amt': '상장자본금액', + 'cpta': '자본금', + 'papr': '액면가', + 'issu_pric': '발행가격', + 'kospi200_item_yn': '코스피200종목여부', + 'scts_mket_lstg_dt': '유가증권시장상장일자', + 'scts_mket_lstg_abol_dt': '유가증권시장상장폐지일자', + 'kosdaq_mket_lstg_dt': '코스닥시장상장일자', + 'kosdaq_mket_lstg_abol_dt': '코스닥시장상장폐지일자', + 'frbd_mket_lstg_dt': '프리보드시장상장일자', + 'frbd_mket_lstg_abol_dt': '프리보드시장상장폐지일자', + 'reits_kind_cd': '리츠종류코드', + 'etf_dvsn_cd': 'ETF구분코드', + 'oilf_fund_yn': '유전펀드여부', + 'idx_bztp_lcls_cd': '지수업종대분류코드', + 'idx_bztp_mcls_cd': '지수업종중분류코드', + 'idx_bztp_scls_cd': '지수업종소분류코드', + 'idx_bztp_lcls_cd_name': '지수업종대분류코드명', + 'idx_bztp_mcls_cd_name': '지수업종중분류코드명', + 'idx_bztp_scls_cd_name': '지수업종소분류코드명', + 'stck_kind_cd': '주식종류코드', + 'mfnd_opng_dt': '뮤추얼펀드개시일자', + 'mfnd_end_dt': '뮤추얼펀드종료일자', + 'dpsi_erlm_cncl_dt': '예탁등록취소일자', + 'etf_cu_qty': 'ETFCU수량', + 'std_pdno': '표준상품번호', + 'dpsi_aptm_erlm_yn': '예탁지정등록여부', + 'etf_txtn_type_cd': 'ETF과세유형코드', + 'etf_type_cd': 'ETF유형코드', + 'lstg_abol_dt': '상장폐지일자', + 'nwst_odst_dvsn_cd': '신주구주구분코드', + 'sbst_pric': '대용가격', + 'thco_sbst_pric': '당사대용가격', + 'thco_sbst_pric_chng_dt': '당사대용가격변경일자', + 'tr_stop_yn': '거래정지여부', + 'admn_item_yn': '관리종목여부', + 'thdt_clpr': '당일종가', + 'bfdy_clpr': '전일종가', + 'clpr_chng_dt': '종가변경일자', + 'std_idst_clsf_cd': '표준산업분류코드', + 'std_idst_clsf_cd_name': '표준산업분류코드명', + 'ocr_no': 'OCR번호', + 'crfd_item_yn': '크라우드펀딩종목여부', + 'elec_scty_yn': '전자증권여부', + 'issu_istt_cd': '발행기관코드', + 'etf_chas_erng_rt_dbnb': 'ETF추적수익율배수', + 'etf_etn_ivst_heed_item_yn': 'ETFETN투자유의종목여부', + 'stln_int_rt_dvsn_cd': '대주이자율구분코드', + 'frnr_psnl_lmt_rt': '외국인개인한도비율', + 'lstg_rqsr_issu_istt_cd': '상장신청인발행기관코드', + 'lstg_rqsr_item_cd': '상장신청인종목코드', + 'trst_istt_issu_istt_cd': '신탁기관발행기관코드', + 'cptt_trad_tr_psbl_yn': 'NXT 거래종목여부', + 'nxt_tr_stop_yn': 'NXT 거래정지여부' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 종목정보 + 주식기본조회[v1_국내주식-067] + + 주식기본조회 테스트 함수 + + Parameters: + - prdt_type_cd (str): 상품유형코드 (300: 주식, ETF, ETN, ELW 301 : 선물옵션 302 : 채권 306 : ELS') + - pdno (str): 상품번호 (종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001)) + Returns: + - DataFrame: 주식기본조회 결과 + + Example: + >>> df = search_stock_info(prdt_type_cd="300", pdno="005930") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = search_stock_info( + prdt_type_cd="300", # 상품유형코드 + pdno="005930", # 상품번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 주식기본조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/search_stock_info.py b/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/search_stock_info.py new file mode 100644 index 0000000..67473d7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/search_stock_info/search_stock_info.py @@ -0,0 +1,117 @@ +# [국내주식] 종목정보 - 주식기본조회 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-17 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 종목정보 > 주식기본조회[v1_국내주식-067] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/search-stock-info" + +def search_stock_info( + prdt_type_cd: str, # 상품유형코드 + pdno: str, # 상품번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 주식기본조회[v1_국내주식-067] + 주식기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prdt_type_cd (str): 300: 주식, ETF, ETN, ELW 301 : 선물옵션 302 : 채권 306 : ELS' + pdno (str): 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 주식기본조회 데이터 + + Example: + >>> df = search_stock_info("300", "000660") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '300')") + raise ValueError("prdt_type_cd is required. (e.g. '300')") + + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1002R" + + params = { + "PRDT_TYPE_CD": prdt_type_cd, + "PDNO": pdno, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_stock_info( + prdt_type_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/short_sale/chk_short_sale.py b/한국투자증권(API)/examples_llm/domestic_stock/short_sale/chk_short_sale.py new file mode 100644 index 0000000..1d1b26b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/short_sale/chk_short_sale.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from short_sale import short_sale + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 공매도 상위종목[국내주식-133] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'ssts_cntg_qty': '공매도 체결 수량', + 'ssts_vol_rlim': '공매도 거래량 비중', + 'ssts_tr_pbmn': '공매도 거래 대금', + 'ssts_tr_pbmn_rlim': '공매도 거래대금 비중', + 'stnd_date1': '기준 일자1', + 'stnd_date2': '기준 일자2', + 'avrg_prc': '평균가격' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 공매도 상위종목[국내주식-133] + + 국내주식 공매도 상위종목 테스트 함수 + + Parameters: + - fid_aply_rang_vol (str): FID 적용 범위 거래량 (공백) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20482)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100, 3003: 코스닥150) + - fid_period_div_code (str): 조회구분 (일/월) (조회구분 (일/월) D: 일, M:월) + - fid_input_cnt_1 (str): 조회가간(일수 ('조회가간(일수): 조회구분(D) 0:1일, 1:2일, 2:3일, 3:4일, 4:1주일, 9:2주일, 14:3주일, 조회구분(M) 1:1개월, 2:2개월, 3:3개월') + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (공백) + - fid_trgt_cls_code (str): FID 대상 구분 코드 (공백) + - fid_aply_rang_prc_1 (str): FID 적용 범위 가격1 (가격 ~) + - fid_aply_rang_prc_2 (str): FID 적용 범위 가격2 (~ 가격) + Returns: + - DataFrame: 국내주식 공매도 상위종목 결과 + + Example: + >>> df = short_sale(fid_aply_rang_vol="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20482", fid_input_iscd="0000", fid_period_div_code="D", fid_input_cnt_1="0", fid_trgt_exls_cls_code="", fid_trgt_cls_code="", fid_aply_rang_prc_1="0", fid_aply_rang_prc_2="1000000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = short_sale( + fid_aply_rang_vol="", # FID 적용 범위 거래량 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20482", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_period_div_code="D", # 조회구분 (일/월) + fid_input_cnt_1="0", # 조회가간(일수 + fid_trgt_exls_cls_code="", # 대상 제외 구분 코드 + fid_trgt_cls_code="", # FID 대상 구분 코드 + fid_aply_rang_prc_1="0", # FID 적용 범위 가격1 + fid_aply_rang_prc_2="1000000", # FID 적용 범위 가격2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 공매도 상위종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/short_sale/short_sale.py b/한국투자증권(API)/examples_llm/domestic_stock/short_sale/short_sale.py new file mode 100644 index 0000000..bfc859c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/short_sale/short_sale.py @@ -0,0 +1,160 @@ +# DOMSTK_RANK - 국내주식 공매도 상위종목 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 공매도 상위종목[국내주식-133] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/short-sale" + +def short_sale( + fid_aply_rang_vol: str, # FID 적용 범위 거래량 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_period_div_code: str, # 조회구분 (일/월) + fid_input_cnt_1: str, # 조회가간(일수) + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # FID 대상 구분 코드 + fid_aply_rang_prc_1: str, # FID 적용 범위 가격1 + fid_aply_rang_prc_2: str, # FID 적용 범위 가격2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 공매도 상위종목[국내주식-133] + 국내주식 공매도 상위종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_vol (str): FID 적용 범위 거래량 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20482) + fid_input_iscd (str): 0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100, 3003: 코스닥150 + fid_period_div_code (str): 조회구분 (일/월) D: 일, M:월 + fid_input_cnt_1 (str): 조회가간(일수): 조회구분(D) 0:1일, 1:2일, 2:3일, 3:4일, 4:1주일, 9:2주일, 14:3주일, 조회구분(M) 1:1개월, 2:2개월, 3:3개월 + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 + fid_trgt_cls_code (str): FID 대상 구분 코드 + fid_aply_rang_prc_1 (str): FID 적용 범위 가격1 + fid_aply_rang_prc_2 (str): FID 적용 범위 가격2 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 공매도 상위종목 데이터 + + Example: + >>> df = short_sale( + ... fid_aply_rang_vol="1000", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20482", + ... fid_input_iscd="0000", + ... fid_period_div_code="D", + ... fid_input_cnt_1="0", + ... fid_trgt_exls_cls_code="", + ... fid_trgt_cls_code="", + ... fid_aply_rang_prc_1="1000", + ... fid_aply_rang_prc_2="5000" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + return None + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20482')") + return None + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + return None + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + return None + if not fid_input_cnt_1: + logger.error("fid_input_cnt_1 is required. (e.g. '0')") + return None + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST04820000" + + params = { + "FID_APLY_RANG_VOL": fid_aply_rang_vol, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_INPUT_CNT_1": fid_input_cnt_1, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_APLY_RANG_PRC_1": fid_aply_rang_prc_1, + "FID_APLY_RANG_PRC_2": fid_aply_rang_prc_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return short_sale( + fid_aply_rang_vol, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_period_div_code, + fid_input_cnt_1, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/chk_top_interest_stock.py b/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/chk_top_interest_stock.py new file mode 100644 index 0000000..8b23d25 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/chk_top_interest_stock.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from top_interest_stock import top_interest_stock + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 관심종목등록 상위[v1_국내주식-102] +############################################################################################## + +COLUMN_MAPPING = { + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'askp': '매도호가', + 'bidp': '매수호가', + 'data_rank': '데이터 순위', + 'inter_issu_reg_csnu': '관심 종목 등록 건수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 관심종목등록 상위[v1_국내주식-102] + + 국내주식 관심종목등록 상위 테스트 함수 + + Parameters: + - fid_input_iscd_2 (str): 입력 종목코드2 (000000 : 필수입력값) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20180)) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체 1: 관리종목 2: 투자주의 3: 투자경고 4: 투자위험예고 5: 투자위험 6: 보통주 7: 우선주) + - fid_input_cnt_1 (str): 입력 수1 (순위검색 입력값(1: 1위부터, 10:10위부터)) + Returns: + - DataFrame: 국내주식 관심종목등록 상위 결과 + + Example: + >>> df = top_interest_stock(fid_input_iscd_2="000000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20180", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="0", fid_input_price_2="0", fid_vol_cnt="0", fid_div_cls_code="0", fid_input_cnt_1="1") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = top_interest_stock( + fid_input_iscd_2="000000", # 입력 종목코드2 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20180", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_input_price_1="0", # 입력 가격1 + fid_input_price_2="0", # 입력 가격2 + fid_vol_cnt="0", # 거래량 수 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_cnt_1="1", # 입력 수1 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 관심종목등록 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/top_interest_stock.py b/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/top_interest_stock.py new file mode 100644 index 0000000..43e14c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/top_interest_stock/top_interest_stock.py @@ -0,0 +1,160 @@ +# DOMSTK_RANK - 국내주식 관심종목등록 상위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 관심종목등록 상위[v1_국내주식-102] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/top-interest-stock" + +def top_interest_stock( + fid_input_iscd_2: str, # 입력 종목코드2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_cnt_1: str, # 입력 수1 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 관심종목등록 상위[v1_국내주식-102] + 국내주식 관심종목등록 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd_2 (str): 000000 : 필수입력값 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(20180) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_div_cls_code (str): 0: 전체 1: 관리종목 2: 투자주의 3: 투자경고 4: 투자위험예고 5: 투자위험 6: 보통주 7: 우선주 + fid_input_cnt_1 (str): 순위검색 입력값(1: 1위부터, 10:10위부터) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 관심종목등록 상위 데이터 + + Example: + >>> df = top_interest_stock( + ... fid_input_iscd_2="000000", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20180", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_div_cls_code="0", + ... fid_input_cnt_1="1" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '000000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '000000')") + if fid_cond_mrkt_div_code not in ['J']: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20180')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20180')") + if fid_input_iscd not in ['0000', '0001', '1001', '2001']: + logger.error("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001')") + raise ValueError("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001')") + if fid_div_cls_code not in ['0', '1', '2', '3', '4', '5', '6', '7']: + logger.error("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + raise ValueError("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01800000" + + params = { + "fid_input_iscd_2": fid_input_iscd_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return top_interest_stock( + fid_input_iscd_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_div_cls_code, + fid_input_cnt_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/chk_traded_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/chk_traded_by_company.py new file mode 100644 index 0000000..eb567a3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/chk_traded_by_company.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from traded_by_company import traded_by_company + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 당사매매종목 상위[v1_국내주식-104] +############################################################################################## + +COLUMN_MAPPING = { + 'data_rank': '데이터 순위', + 'mksc_shrn_iscd': '유가증권 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'seln_cnqn_smtn': '매도 체결량 합계', + 'shnu_cnqn_smtn': '매수2 체결량 합계', + 'ntby_cnqn': '순매수 체결량' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 당사매매종목 상위[v1_국내주식-104] + + 국내주식 당사매매종목 상위 테스트 함수 + + Parameters: + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0: 전체) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key(20186)) + - fid_div_cls_code (str): 분류 구분 코드 (0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + - fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0:매도상위,1:매수상위) + - fid_input_date_1 (str): 입력 날짜1 (기간~) + - fid_input_date_2 (str): 입력 날짜2 (~기간) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + - fid_trgt_cls_code (str): 대상 구분 코드 (0: 전체) + - fid_aply_rang_vol (str): 적용 범위 거래량 (0: 전체, 100: 100주 이상) + - fid_aply_rang_prc_2 (str): 적용 범위 가격2 (~ 가격) + - fid_aply_rang_prc_1 (str): 적용 범위 가격1 (가격 ~) + Returns: + - DataFrame: 국내주식 당사매매종목 상위 결과 + + Example: + >>> df = traded_by_company(fid_trgt_exls_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20186", fid_div_cls_code="0", fid_rank_sort_cls_code="1", fid_input_date_1="20230101", fid_input_date_2="20231231", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_aply_rang_vol="100", fid_aply_rang_prc_2="100000", fid_aply_rang_prc_1="50000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = traded_by_company( + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20186", # 조건 화면 분류 코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_rank_sort_cls_code="0", # 순위 정렬 구분 코드 + fid_input_date_1="20250613", # 입력 날짜1 + fid_input_date_2="20250614", # 입력 날짜2 + fid_input_iscd="0000", # 입력 종목코드 + fid_trgt_cls_code="0", # 대상 구분 코드 + fid_aply_rang_vol="0", # 적용 범위 거래량 + fid_aply_rang_prc_2="0", # 적용 범위 가격2 + fid_aply_rang_prc_1="0", # 적용 범위 가격1 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 당사매매종목 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/traded_by_company.py b/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/traded_by_company.py new file mode 100644 index 0000000..19fca72 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/traded_by_company/traded_by_company.py @@ -0,0 +1,182 @@ +# DOMSTK_RANK - 국내주식 당사매매종목 상위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 당사매매종목 상위[v1_국내주식-104] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/traded-by-company" + +def traded_by_company( + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_date_1: str, # 입력 날짜1 + fid_input_date_2: str, # 입력 날짜2 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_aply_rang_vol: str, # 적용 범위 거래량 + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 당사매매종목 상위[v1_국내주식-104] + 국내주식 당사매매종목 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_exls_cls_code (str): 0: 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(20186) + fid_div_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_rank_sort_cls_code (str): 0:매도상위,1:매수상위 + fid_input_date_1 (str): 기간~ + fid_input_date_2 (str): ~기간 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_trgt_cls_code (str): 0: 전체 + fid_aply_rang_vol (str): 0: 전체, 100: 100주 이상 + fid_aply_rang_prc_2 (str): ~ 가격 + fid_aply_rang_prc_1 (str): 가격 ~ + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 당사매매종목 상위 데이터 + + Example: + >>> df = traded_by_company( + ... fid_trgt_exls_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20186", + ... fid_div_cls_code="0", + ... fid_rank_sort_cls_code="0", + ... fid_input_date_1="20240314", + ... fid_input_date_2="20240315", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_aply_rang_vol="0", + ... fid_aply_rang_prc_2="", + ... fid_aply_rang_prc_1="" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + return None + if fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + return None + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20186')") + return None + if fid_div_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + logger.error("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + return None + if fid_rank_sort_cls_code not in ["0", "1"]: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0', '1')") + return None + if not fid_input_date_1: + logger.error("fid_input_date_1 is required.") + return None + if not fid_input_date_2: + logger.error("fid_input_date_2 is required.") + return None + if fid_input_iscd not in ["0000", "0001", "1001", "2001", "4001"]: + logger.error("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001', '4001')") + return None + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + return None + if fid_aply_rang_vol not in ["0", "100"]: + logger.error("fid_aply_rang_vol is required. (e.g. '0', '100')") + return None + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01860000" + + params = { + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_input_date_1": fid_input_date_1, + "fid_input_date_2": fid_input_date_2, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_aply_rang_vol": fid_aply_rang_vol, + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return traded_by_company( + fid_trgt_exls_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_rank_sort_cls_code, + fid_input_date_1, + fid_input_date_2, + fid_input_iscd, + fid_trgt_cls_code, + fid_aply_rang_vol, + fid_aply_rang_prc_2, + fid_aply_rang_prc_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/chk_tradprt_byamt.py b/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/chk_tradprt_byamt.py new file mode 100644 index 0000000..aa7e55c --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/chk_tradprt_byamt.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from tradprt_byamt import tradprt_byamt + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 체결금액별 매매비중 [국내주식-192] +############################################################################################## + +COLUMN_MAPPING = { + 'prpr_name': '가격명', + 'smtn_avrg_prpr': '합계 평균가격', + 'acml_vol': '합계 거래량', + 'whol_ntby_qty_rate': '합계 순매수비율', + 'ntby_cntg_csnu': '합계 순매수건수', + 'seln_cnqn_smtn': '매도 거래량', + 'whol_seln_vol_rate': '매도 거래량비율', + 'seln_cntg_csnu': '매도 건수', + 'shnu_cnqn_smtn': '매수 거래량', + 'whol_shun_vol_rate': '매수 거래량비율', + 'shnu_cntg_csnu': '매수 건수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 국내주식 체결금액별 매매비중 조회 테스트 함수 + + 이 함수는 국내주식 체결금액별 매매비중 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = tradprt_byamt(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="11119", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number 타입 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/tradprt_byamt.py b/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/tradprt_byamt.py new file mode 100644 index 0000000..fe5f9c2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/tradprt_byamt/tradprt_byamt.py @@ -0,0 +1,70 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 체결금액별 매매비중 [국내주식-192] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/tradprt-byamt" + +def tradprt_byamt( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11119) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 체결금액별 매매비중 API입니다. + 한국투자 HTS(eFriend Plus) > [0135] 체결금액별 매매비중 화면의 "상단 표" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11119) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 국내주식 체결금액별 매매비중 데이터 + + Example: + >>> df = tradprt_byamt("J", "11119", "005930") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11119')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHKST111900C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/domestic_stock/volume_power/chk_volume_power.py b/한국투자증권(API)/examples_llm/domestic_stock/volume_power/chk_volume_power.py new file mode 100644 index 0000000..7d1579b --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/volume_power/chk_volume_power.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-16 + +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volume_power import volume_power + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 체결강도 상위[v1_국내주식-101] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_shrn_iscd': '주식 단축 종목코드', + 'data_rank': '데이터 순위', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'tday_rltv': '당일 체결강도', + 'seln_cnqn_smtn': '매도 체결량 합계', + 'shnu_cnqn_smtn': '매수2 체결량 합계' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] 순위분석 + 국내주식 체결강도 상위[v1_국내주식-101] + + 국내주식 체결강도 상위 테스트 함수 + + Parameters: + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (시장구분코드 (주식 J)) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key( 20168 )) + - fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + - fid_div_cls_code (str): 분류 구분 코드 (0: 전체, 1: 보통주 2: 우선주) + - fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체 (가격 ~)) + - fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체 (~ 가격)) + - fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체 (거래량 ~)) + - fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + Returns: + - DataFrame: 국내주식 체결강도 상위 결과 + + Example: + >>> df = volume_power(fid_trgt_exls_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20168", fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="0", fid_trgt_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + # API 호출 + result = volume_power( + fid_trgt_exls_cls_code="0", # 대상 제외 구분 코드 + fid_cond_mrkt_div_code="J", # 조건 시장 분류 코드 + fid_cond_scr_div_code="20168", # 조건 화면 분류 코드 + fid_input_iscd="0000", # 입력 종목코드 + fid_div_cls_code="0", # 분류 구분 코드 + fid_input_price_1="0", # 입력 가격1 + fid_input_price_2="1000000", # 입력 가격2 + fid_vol_cnt="0", # 거래량 수 + fid_trgt_cls_code="0", # 대상 구분 코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 국내주식 체결강도 상위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/volume_power/volume_power.py b/한국투자증권(API)/examples_llm/domestic_stock/volume_power/volume_power.py new file mode 100644 index 0000000..b6a0660 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/volume_power/volume_power.py @@ -0,0 +1,155 @@ +# DOMSTK_RANK - 국내주식 체결강도 상위 +# Generated by KIS API Generator (Single API Mode) +import logging +import sys +import time +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 체결강도 상위[v1_국내주식-101] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/ranking/volume-power" + +def volume_power( + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 체결강도 상위[v1_국내주식-101] + 국내주식 체결강도 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20168 ) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_div_cls_code (str): 0: 전체, 1: 보통주 2: 우선주 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_trgt_cls_code (str): 0 : 전체 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 체결강도 상위 데이터 + + Example: + >>> df = volume_power( + ... fid_trgt_exls_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20168", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_trgt_cls_code="0" + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + if fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code must be 'J'.") + raise ValueError("fid_cond_mrkt_div_code must be 'J'.") + if fid_cond_scr_div_code != "20168": + logger.error("fid_cond_scr_div_code must be '20168'.") + raise ValueError("fid_cond_scr_div_code must be '20168'.") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + logger.error("fid_input_iscd must be one of ['0000', '0001', '1001', '2001'].") + raise ValueError("fid_input_iscd must be one of ['0000', '0001', '1001', '2001'].") + if fid_div_cls_code not in ["0", "1", "2"]: + logger.error("fid_div_cls_code must be one of ['0', '1', '2'].") + raise ValueError("fid_div_cls_code must be one of ['0', '1', '2'].") + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + tr_id = "FHPST01680000" + + params = { + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_trgt_cls_code": fid_trgt_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volume_power( + fid_trgt_exls_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/chk_volume_rank.py b/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/chk_volume_rank.py new file mode 100644 index 0000000..c57b9f9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/chk_volume_rank.py @@ -0,0 +1,111 @@ +import sys + +import pandas as pd +import logging + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volume_rank import volume_rank + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 거래량순위[v1_국내주식-047] +############################################################################################## + +# 통합 컬럼 매핑 +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS 한글 종목명', + 'mksc_shrn_iscd': '가중권 단축 종목코드', + 'data_rank': '데이터 순위', + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'lstn_stcn': '상장 주식수', + 'avrg_vol': '평균 거래량', + 'n_befr_clpr_vrss_prpr_rate': '전일종가대비현재가(%)', + 'vol_inrt': '거래량증가율', + 'vol_tnrt': '거래량회전율', + 'nday_vol_tnrt': 'N일 거래량회전율', + 'avrg_tr_pbmn': '평균 거래 대금', + 'tr_pbmn_tnrt': '거래대금회전율', + 'nday_tr_pbmn_tnrt': 'N일 거래대금회전율', + 'acml_tr_pbmn': '누적 거래 대금' +} + +NUMERIC_COLUMNS = [] + + +def main(): + """ + [국내주식] 순위분석 + 순위분석[v1_국내주식-047] + + 국내주식 순위분석 조회 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 ("J": KRX, "NX": NXT, "UN": 통합, "W": ELW) + - fid_cond_scr_div_code (str): 조건 화면 분류 코드 ("20171") + - fid_input_iscd (str): 입력 종목코드 ("0000": 전체, 기타: 업종코드) + - fid_div_cls_code (str): 분류 구분 코드 ("0": 전체, "1": 보통주, "2": 우선주) + - fid_blng_cls_code (str): 소속 구분 코드 ("0": 평균거래량, "1": 거래증가율, "2": 평균거래회전율, "3": 거래금액순, "4": 평균거래금액회전율) + - fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%) + - fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + - fid_input_price_1 (str): 입력 가격1 (가격 ~, 전체 가격 대상 조회 시 공란) + - fid_input_price_2 (str): 입력 가격2 (~ 가격, 전체 가격 대상 조회 시 공란) + - fid_vol_cnt (str): 거래량 수 (거래량 ~, 전체 거래량 대상 조회 시 공란) + - fid_input_date_1 (str): 입력 날짜1 (공란) + - tr_cont (str): 연속 거래 여부 + - dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + - DataFrame: 국내주식 순위분석 조회 결과 + + Example: + >>> df = volume_rank(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20171", fid_input_iscd="0000", fid_div_cls_code="0", fid_blng_cls_code="0", fid_trgt_cls_code="111111111", fid_trgt_exls_cls_code="0000000000", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_input_date_1="") + """ + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + result = volume_rank( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="20171", + fid_input_iscd="0002", + fid_div_cls_code="0", + fid_blng_cls_code="0", + fid_trgt_cls_code="111111111", + fid_trgt_exls_cls_code="000000", + fid_input_price_1="0", + fid_input_price_2="0", + fid_vol_cnt="0", + fid_input_date_1="0", + ) + # 컬럼명 출력 + print("\n=== 사용 가능한 컬럼 목록 ===") + print(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + print("\n=== 국내주식 거래량순위 조회 결과 ===") + print(result) + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/volume_rank.py b/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/volume_rank.py new file mode 100644 index 0000000..6f81e83 --- /dev/null +++ b/한국투자증권(API)/examples_llm/domestic_stock/volume_rank/volume_rank.py @@ -0,0 +1,135 @@ +# DOMSTK_RANK - 거래량순위 +# Generated by KIS API Generator (Single API Mode) +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 + +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 순위분석 > 거래량순위[v1_국내주식-047] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/domestic-stock/v1/quotations/volume-rank" + +def volume_rank( + fid_cond_mrkt_div_code: str, # 필수, 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 필수, 조건 화면 분류 코드 + fid_input_iscd: str, # 필수, 입력 종목코드 + fid_div_cls_code: str, # 필수, 분류 구분 코드 + fid_blng_cls_code: str, # 필수, 소속 구분 코드 + fid_trgt_cls_code: str, # 필수, 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 필수, 대상 제외 구분 코드 + fid_input_price_1: str, # 필수, 입력 가격1 + fid_input_price_2: str, # 필수, 입력 가격2 + fid_vol_cnt: str, # 필수, 거래량 수 + fid_input_date_1: str, # 필수, 입력 날짜1 + tr_cont: str = "", # 선택, 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 선택, 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 순위분석[v1_국내주식-047] + 순위분석 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 ("J": KRX, "NX": NXT, "UN": 통합, "W": ELW) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 ("20171") + fid_input_iscd (str): 입력 종목코드 ("0000": 전체, 기타: 업종코드) + fid_div_cls_code (str): 분류 구분 코드 ("0": 전체, "1": 보통주, "2": 우선주) + fid_blng_cls_code (str): 소속 구분 코드 ("0": 평균거래량, "1": 거래증가율, "2": 평균거래회전율, "3": 거래금액순, "4": 평균거래금액회전율) + fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + fid_input_price_1 (str): 입력 가격1 (가격 ~, 전체 가격 대상 조회 시 공란) + fid_input_price_2 (str): 입력 가격2 (~ 가격, 전체 가격 대상 조회 시 공란) + fid_vol_cnt (str): 거래량 수 (거래량 ~, 전체 거래량 대상 조회 시 공란) + fid_input_date_1 (str): 입력 날짜1 (공란) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + pd.DataFrame: 순위분석 데이터 + + Example: + >>> df = volume_rank(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20171", fid_input_iscd="0000", fid_div_cls_code="0", fid_blng_cls_code="0", fid_trgt_cls_code="111111111", fid_trgt_exls_cls_code="0000000000", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_input_date_1="") + >>> print(df) + """ + if fid_cond_mrkt_div_code not in ["J", "NX", "UN", "W"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + + if fid_cond_scr_div_code != "20171": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + + if fid_input_iscd == "": # "0000"은 전체를 의미하므로 유효한 값 + raise ValueError("입력 종목코드 확인요망!!!") + + if fid_div_cls_code not in ["0", "1", "2"]: + raise ValueError("분류 구분 코드 확인요망!!!") + + if fid_blng_cls_code not in ["0", "1", "2", "3", "4"]: + raise ValueError("소속 구분 코드 확인요망!!!") + + # To fix: description에 나와있는 자릿수와 다름(0 6개 입력해야 나옴) + # if len(fid_trgt_cls_code) != 9 or not (all(c == '0' for c in fid_trgt_cls_code) or all(c == '1' for c in fid_trgt_cls_code)): + # raise ValueError("대상 구분 코드 확인요망!!!") + + # if len(fid_trgt_exls_cls_code) != 10 or not (all(c == '0' for c in fid_trgt_exls_cls_code) or all(c == '1' for c in fid_trgt_exls_cls_code)): + # raise ValueError("대상 제외 구분 코드 확인요망!!!") + + + tr_id = "FHPST01710000" # 거래량순위 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": # 다음 페이지 존재 + print("Call Next") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_rank( + fid_cond_mrkt_div_code, fid_cond_scr_div_code, fid_input_iscd, + fid_div_cls_code, fid_blng_cls_code, fid_trgt_cls_code, + fid_trgt_exls_cls_code, fid_input_price_1, fid_input_price_2, + fid_vol_cnt, fid_input_date_1, "N", dataframe + ) + else: + print("The End") + return dataframe + else: + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/compare_stocks/chk_compare_stocks.py b/한국투자증권(API)/examples_llm/elw/compare_stocks/chk_compare_stocks.py new file mode 100644 index 0000000..e571508 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/compare_stocks/chk_compare_stocks.py @@ -0,0 +1,87 @@ +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from compare_stocks import compare_stocks + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 비교대상종목조회[국내주식-183] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_kor_isnm': 'ELW한글종목명' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [국내주식] ELW시세 + ELW 비교대상종목조회[국내주식-183] + + ELW 비교대상종목조회 테스트 함수 + + Parameters: + - fid_cond_scr_div_code (str): 조건화면분류코드 (11517(Primary key)) + - fid_input_iscd (str): 입력종목코드 (종목코드(ex)005930(삼성전자))) + Returns: + - DataFrame: ELW 비교대상종목조회 결과 + + Example: + >>> df = compare_stocks(fid_cond_scr_div_code="11517", fid_input_iscd="005930") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # 인라인 코드로 파라미터 직접 전달 + logger.info("API 호출 ") + result = compare_stocks(fid_cond_scr_div_code="11517", fid_input_iscd="005930") + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 비교대상종목조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/compare_stocks/compare_stocks.py b/한국투자증권(API)/examples_llm/elw/compare_stocks/compare_stocks.py new file mode 100644 index 0000000..f879189 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/compare_stocks/compare_stocks.py @@ -0,0 +1,111 @@ +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 비교대상종목조회[국내주식-183] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/compare-stocks" + +def compare_stocks( + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 비교대상종목조회[국내주식-183] + ELW 비교대상종목조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 조건화면분류코드 (예: '11517') + fid_input_iscd (str): 입력종목코드 (예: '005930') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 비교대상종목조회 데이터 + + Example: + >>> df = compare_stocks('11517', '005930') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11517')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11517')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKEW151701C0" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return compare_stocks( + fid_cond_scr_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/cond_search/chk_cond_search.py b/한국투자증권(API)/examples_llm/elw/cond_search/chk_cond_search.py new file mode 100644 index 0000000..4e4c641 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/cond_search/chk_cond_search.py @@ -0,0 +1,251 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from cond_search import cond_search + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 종목검색[국내주식-166] +############################################################################################## + +COLUMN_MAPPING = { + 'bond_shrn_iscd': '채권단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'rght_type_name': '권리유형명', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'acpr': '행사가', + 'stck_cnvr_rate': '주식전환비율', + 'stck_lstn_date': '주식상장일자', + 'stck_last_tr_date': '주식최종거래일자', + 'hts_rmnn_dynu': 'HTS잔존일수', + 'unas_isnm': '기초자산종목명', + 'unas_prpr': '기초자산현재가', + 'unas_prdy_vrss': '기초자산전일대비', + 'unas_prdy_vrss_sign': '기초자산전일대비부호', + 'unas_prdy_ctrt': '기초자산전일대비율', + 'unas_acml_vol': '기초자산누적거래량', + 'moneyness': 'MONEYNESS', + 'atm_cls_name': 'ATM구분명', + 'prit': '패리티', + 'delta_val': '델타값', + 'hts_ints_vltl': 'HTS내재변동성', + 'tmvl_val': '시간가치값', + 'gear': '기어링', + 'lvrg_val': '레버리지값', + 'prls_qryr_rate': '손익분기비율', + 'cfp': '자본지지점', + 'lstn_stcn': '상장주수', + 'pblc_co_name': '발행회사명', + 'lp_mbcr_name': 'LP회원사명', + 'lp_hldn_rate': 'LP보유비율', + 'elw_rght_form': 'ELW권리형태', + 'elw_ko_barrier': '조기종료발생기준가격', + 'apprch_rate': '접근도', + 'unas_shrn_iscd': '기초자산단축종목코드', + 'mtrt_date': '만기일자', + 'prmm_val': '프리미엄값', + 'stck_lp_fin_date': '주식LP종료일자', + 'tick_conv_prc': '틱환산가', + 'prls_qryr_stpr_prc': '손익분기주가가격', + 'lp_hvol': 'LP보유량' +} + +NUMERIC_COLUMNS = [ + 'elw_prpr', 'prdy_ctrt', 'acml_vol', 'acpr', 'stck_cnvr_rate', + 'hts_rmnn_dynu', 'unas_prpr', 'unas_prdy_ctrt', 'unas_acml_vol', + 'moneyness', 'prit', 'delta_val', 'hts_ints_vltl', 'tmvl_val', + 'gear', 'lvrg_val', 'prls_qryr_rate', 'cfp', 'lstn_stcn', 'pblc_co_name', 'lp_mbcr_name', 'lp_hldn_rate', 'elw_rght_form', 'elw_ko_barrier', 'apprch_rate', 'unas_shrn_iscd', 'mtrt_date', 'prmm_val', 'stck_lp_fin_date', 'tick_conv_prc', 'prls_qryr_stpr_prc', 'lp_hvol' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 종목검색[국내주식-166] + + ELW 종목검색 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (ELW(W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (화면번호(11510)) + - fid_rank_sort_cls_code (str): 순위정렬구분코드 ('정렬1정렬안함(0)종목코드(1)현재가(2)대비율(3)거래량(4)행사가격(5) 전환비율(6)상장일(7)만기일(8)잔존일수(9)레버리지(10)') + - fid_input_cnt_1 (str): 입력수1 (정렬1기준 - 상위(1)하위(2)) + - fid_rank_sort_cls_code_2 (str): 순위정렬구분코드2 (정렬2) + - fid_input_cnt_2 (str): 입력수2 (정렬2기준 - 상위(1)하위(2)) + - fid_rank_sort_cls_code_3 (str): 순위정렬구분코드3 (정렬3) + - fid_input_cnt_3 (str): 입력수3 (정렬3기준 - 상위(1)하위(2)) + - fid_trgt_cls_code (str): 대상구분코드 (0:발행회사종목코드,1:기초자산종목코드,2:FID시장구분코드,3:FID입력날짜1(상장일), 4:FID입력날짜2(만기일),5:LP회원사종목코드,6:행사가기초자산비교>=(1) <=(2), 7:잔존일 이상 이하, 8:현재가, 9:전일대비율, 10:거래량, 11:최종거래일, 12:레버리지) + - fid_input_iscd (str): 입력종목코드 (발행사종목코드전체(00000)) + - fid_unas_input_iscd (str): 기초자산입력종목코드 () + - fid_mrkt_cls_code (str): 시장구분코드 (권리유형전체(A)콜(CO)풋(PO)) + - fid_input_date_1 (str): 입력날짜1 (상장일전체(0)금일(1)7일이하(2)8~30일(3)31~90일(4)) + - fid_input_date_2 (str): 입력날짜2 (만기일전체(0)1개월(1)1~2(2)2~3(3)3~6(4)6~9(5)9~12(6)12이상(7)) + - fid_input_iscd_2 (str): 입력종목코드2 () + - fid_etc_cls_code (str): 기타구분코드 (행사가전체(0)>=(1)) + - fid_input_rmnn_dynu_1 (str): 입력잔존일수1 (잔존일이상) + - fid_input_rmnn_dynu_2 (str): 입력잔존일수2 (잔존일이하) + - fid_prpr_cnt1 (str): 현재가수1 (현재가이상) + - fid_prpr_cnt2 (str): 현재가수2 (현재가이하) + - fid_rsfl_rate1 (str): 등락비율1 (전일대비율이상) + - fid_rsfl_rate2 (str): 등락비율2 (전일대비율이하) + - fid_vol1 (str): 거래량1 (거래량이상) + - fid_vol2 (str): 거래량2 (거래량이하) + - fid_aply_rang_prc_1 (str): 적용범위가격1 (최종거래일from) + - fid_aply_rang_prc_2 (str): 적용범위가격2 (최종거래일to) + - fid_lvrg_val1 (str): 레버리지값1 () + - fid_lvrg_val2 (str): 레버리지값2 () + - fid_vol3 (str): 거래량3 (LP종료일from) + - fid_vol4 (str): 거래량4 (LP종료일to) + - fid_ints_vltl1 (str): 내재변동성1 (내재변동성이상) + - fid_ints_vltl2 (str): 내재변동성2 (내재변동성이하) + - fid_prmm_val1 (str): 프리미엄값1 (프리미엄이상) + - fid_prmm_val2 (str): 프리미엄값2 (프리미엄이하) + - fid_gear1 (str): 기어링1 (기어링이상) + - fid_gear2 (str): 기어링2 (기어링이하) + - fid_prls_qryr_rate1 (str): 손익분기비율1 (손익분기이상) + - fid_prls_qryr_rate2 (str): 손익분기비율2 (손익분기이하) + - fid_delta1 (str): 델타1 (델타이상) + - fid_delta2 (str): 델타2 (델타이하) + - fid_acpr1 (str): 행사가1 () + - fid_acpr2 (str): 행사가2 () + - fid_stck_cnvr_rate1 (str): 주식전환비율1 (전환비율이상) + - fid_stck_cnvr_rate2 (str): 주식전환비율2 (전환비율이하) + - fid_div_cls_code (str): 분류구분코드 (0:전체,1:일반,2:조기종료) + - fid_prit1 (str): 패리티1 (패리티이상) + - fid_prit2 (str): 패리티2 (패리티이하) + - fid_cfp1 (str): 자본지지점1 (배리어이상) + - fid_cfp2 (str): 자본지지점2 (배리어이하) + - fid_input_nmix_price_1 (str): 지수가격1 (LP보유비율이상) + - fid_input_nmix_price_2 (str): 지수가격2 (LP보유비율이하) + - fid_egea_val1 (str): E기어링값1 (접근도이상) + - fid_egea_val2 (str): E기어링값2 (접근도이하) + - fid_input_dvdn_ert (str): 배당수익율 (손익분기점이상) + - fid_input_hist_vltl (str): 역사적변동성 (손익분기점이하) + - fid_theta1 (str): 세타1 (MONEYNESS이상) + - fid_theta2 (str): 세타2 (MONEYNESS이하) + Returns: + - DataFrame: ELW 종목검색 결과 + + Example: + >>> df = cond_search(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11510", fid_rank_sort_cls_code="0", fid_input_cnt_1="100") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # api 호출 + logger.info("API 호출 ") + result = cond_search( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="11510", # 조건화면분류코드 + fid_rank_sort_cls_code="0", # 순위정렬구분코드 + fid_input_cnt_1="100", # 입력수1 + fid_rank_sort_cls_code_2="", # 순위정렬구분코드2 + fid_input_cnt_2="", # 입력수2 + fid_rank_sort_cls_code_3="", # 순위정렬구분코드3 + fid_input_cnt_3="", # 입력수3 + fid_trgt_cls_code="", # 대상구분코드 + fid_input_iscd="", # 입력종목코드 + fid_unas_input_iscd="", # 기초자산입력종목코드 + fid_mrkt_cls_code="", # 시장구분코드 + fid_input_date_1="", # 입력날짜1 + fid_input_date_2="", # 입력날짜2 + fid_input_iscd_2="", # 입력종목코드2 + fid_etc_cls_code="", # 기타구분코드 + fid_input_rmnn_dynu_1="", # 입력잔존일수1 + fid_input_rmnn_dynu_2="", # 입력잔존일수2 + fid_prpr_cnt1="", # 현재가수1 + fid_prpr_cnt2="", # 현재가수2 + fid_rsfl_rate1="", # 등락비율1 + fid_rsfl_rate2="", # 등락비율2 + fid_vol1="", # 거래량1 + fid_vol2="", # 거래량2 + fid_aply_rang_prc_1="", # 적용범위가격1 + fid_aply_rang_prc_2="", # 적용범위가격2 + fid_lvrg_val1="", # 레버리지값1 + fid_lvrg_val2="", # 레버리지값2 + fid_vol3="", # 거래량3 + fid_vol4="", # 거래량4 + fid_ints_vltl1="", # 내재변동성1 + fid_ints_vltl2="", # 내재변동성2 + fid_prmm_val1="", # 프리미엄값1 + fid_prmm_val2="", # 프리미엄값2 + fid_gear1="", # 기어링1 + fid_gear2="", # 기어링2 + fid_prls_qryr_rate1="", # 손익분기비율1 + fid_prls_qryr_rate2="", # 손익분기비율2 + fid_delta1="", # 델타1 + fid_delta2="", # 델타2 + fid_acpr1="", # 행사가1 + fid_acpr2="", # 행사가2 + fid_stck_cnvr_rate1="", # 주식전환비율1 + fid_stck_cnvr_rate2="", # 주식전환비율2 + fid_div_cls_code="", # 분류구분코드 + fid_prit1="", # 패리티1 + fid_prit2="", # 패리티2 + fid_cfp1="", # 자본지지점1 + fid_cfp2="", # 자본지지점2 + fid_input_nmix_price_1="", # 지수가격1 + fid_input_nmix_price_2="", # 지수가격2 + fid_egea_val1="", # E기어링값1 + fid_egea_val2="", # E기어링값2 + fid_input_dvdn_ert="", # 배당수익율 + fid_input_hist_vltl="", # 역사적변동성 + fid_theta1="", # 세타1 + fid_theta2="", # 세타2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 결과 출력 + logger.info("=== ELW 종목검색 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/elw/cond_search/cond_search.py b/한국투자증권(API)/examples_llm/elw/cond_search/cond_search.py new file mode 100644 index 0000000..3fda343 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/cond_search/cond_search.py @@ -0,0 +1,349 @@ +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 종목검색[국내주식-166] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/cond-search" + + +def cond_search( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 (필수) + fid_cond_scr_div_code: str, # 조건화면분류코드 (필수) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 (필수) + fid_input_cnt_1: str, # 입력수1 (필수) + fid_rank_sort_cls_code_2: Optional[str] = "", # 순위정렬구분코드2 (선택) + fid_input_cnt_2: Optional[str] = "", # 입력수2 (선택) + fid_rank_sort_cls_code_3: Optional[str] = "", # 순위정렬구분코드3 (선택) + fid_input_cnt_3: Optional[str] = "", # 입력수3 (선택) + fid_trgt_cls_code: Optional[str] = "", # 대상구분코드 (선택) + fid_input_iscd: Optional[str] = "", # 입력종목코드 (선택 - 전체 허용) + fid_unas_input_iscd: Optional[str] = "", # 기초자산입력종목코드 (선택) + fid_mrkt_cls_code: Optional[str] = "", # 시장구분코드 (선택 - 전체 허용) + fid_input_date_1: Optional[str] = "", # 입력날짜1 (선택 - 전체 허용) + fid_input_date_2: Optional[str] = "", # 입력날짜2 (선택 - 전체 허용) + fid_input_iscd_2: Optional[str] = "", # 입력종목코드2 (선택) + fid_etc_cls_code: Optional[str] = "", # 기타구분코드 (선택 - 전체 허용) + fid_input_rmnn_dynu_1: Optional[str] = "", # 입력잔존일수1 (선택 - 이상값) + fid_input_rmnn_dynu_2: Optional[str] = "", # 입력잔존일수2 (선택 - 이하값) + fid_prpr_cnt1: Optional[str] = "", # 현재가수1 (선택 - 이상값) + fid_prpr_cnt2: Optional[str] = "", # 현재가수2 (선택 - 이하값) + fid_rsfl_rate1: Optional[str] = "", # 등락비율1 (선택 - 이상값) + fid_rsfl_rate2: Optional[str] = "", # 등락비율2 (선택 - 이하값) + fid_vol1: Optional[str] = "", # 거래량1 (선택 - 이상값) + fid_vol2: Optional[str] = "", # 거래량2 (선택 - 이하값) + fid_aply_rang_prc_1: Optional[str] = "", # 적용범위가격1 (선택) + fid_aply_rang_prc_2: Optional[str] = "", # 적용범위가격2 (선택) + fid_lvrg_val1: Optional[str] = "", # 레버리지값1 (선택) + fid_lvrg_val2: Optional[str] = "", # 레버리지값2 (선택) + fid_vol3: Optional[str] = "", # 거래량3 (선택) + fid_vol4: Optional[str] = "", # 거래량4 (선택) + fid_ints_vltl1: Optional[str] = "", # 내재변동성1 (선택 - 이상값) + fid_ints_vltl2: Optional[str] = "", # 내재변동성2 (선택 - 이하값) + fid_prmm_val1: Optional[str] = "", # 프리미엄값1 (선택 - 이상값) + fid_prmm_val2: Optional[str] = "", # 프리미엄값2 (선택 - 이하값) + fid_gear1: Optional[str] = "", # 기어링1 (선택 - 이상값) + fid_gear2: Optional[str] = "", # 기어링2 (선택 - 이하값) + fid_prls_qryr_rate1: Optional[str] = "", # 손익분기비율1 (선택 - 이상값) + fid_prls_qryr_rate2: Optional[str] = "", # 손익분기비율2 (선택 - 이하값) + fid_delta1: Optional[str] = "", # 델타1 (선택 - 이상값) + fid_delta2: Optional[str] = "", # 델타2 (선택 - 이하값) + fid_acpr1: Optional[str] = "", # 행사가1 (선택) + fid_acpr2: Optional[str] = "", # 행사가2 (선택) + fid_stck_cnvr_rate1: Optional[str] = "", # 주식전환비율1 (선택 - 이상값) + fid_stck_cnvr_rate2: Optional[str] = "", # 주식전환비율2 (선택 - 이하값) + fid_div_cls_code: Optional[str] = "", # 분류구분코드 (선택) + fid_prit1: Optional[str] = "", # 패리티1 (선택 - 이상값) + fid_prit2: Optional[str] = "", # 패리티2 (선택 - 이하값) + fid_cfp1: Optional[str] = "", # 자본지지점1 (선택 - 이상값) + fid_cfp2: Optional[str] = "", # 자본지지점2 (선택 - 이하값) + fid_input_nmix_price_1: Optional[str] = "", # 지수가격1 (선택 - 이상값) + fid_input_nmix_price_2: Optional[str] = "", # 지수가격2 (선택 - 이하값) + fid_egea_val1: Optional[str] = "", # E기어링값1 (선택 - 이상값) + fid_egea_val2: Optional[str] = "", # E기어링값2 (선택 - 이하값) + fid_input_dvdn_ert: Optional[str] = "", # 배당수익율 (선택 - 이상값) + fid_input_hist_vltl: Optional[str] = "", # 역사적변동성 (선택 - 이하값) + fid_theta1: Optional[str] = "", # 세타1 (선택 - 이상값) + fid_theta2: Optional[str] = "", # 세타2 (선택 - 이하값) + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> pd.DataFrame: + """ + ELW 종목검색 API를 호출하여 조건에 맞는 ELW 종목 정보를 조회합니다. + + 한국투자 HTS(eFriend Plus) > [0291] ELW 종목검색 화면의 기능을 API로 구현한 함수입니다. + 다양한 조건을 설정하여 ELW 종목을 검색하고, 한 번의 호출에 최대 100건까지 조회 가능합니다. + 연속 조회를 통해 전체 데이터를 수집할 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (ELW의 경우 "W" 입력) + fid_cond_scr_div_code (str): 조건화면분류코드 (화면번호 "11510" 입력) + fid_rank_sort_cls_code (str): 순위정렬구분코드 + - 0: 정렬안함, 1: 종목코드, 2: 현재가, 3: 대비율, 4: 거래량 + - 5: 행사가격, 6: 전환비율, 7: 상장일, 8: 만기일, 9: 잔존일수, 10: 레버리지 + fid_input_cnt_1 (str): 정렬1기준 (1: 상위, 2: 하위) + 나머지 파라미터들: 대부분 선택사항으로 빈 문자열("")로 설정 가능 + tr_cont (str): 연속 거래 여부 (초기 조회시 공백, 연속 조회시 "N") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (재귀 호출용) + depth (int): 현재 재귀 깊이 (재귀 호출 횟수 추적) + max_depth (int): 최대 재귀 깊이 (무한 재귀 방지, 기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 종목검색 결과 데이터프레임 + - 성공시: ELW 종목 정보가 포함된 DataFrame 반환 + - 실패시: 빈 DataFrame 반환 + - API 오류시: None 반환 + + Raises: + ValueError: 필수 파라미터가 누락되거나 잘못된 값이 입력된 경우 + + Example: + >>> # 기본 ELW 검색 (전체 종목) + >>> df = cond_search( + ... fid_cond_mrkt_div_code="W", + ... fid_cond_scr_div_code="11510", + ... fid_rank_sort_cls_code="0", + ... fid_input_cnt_1="1", + ... fid_rank_sort_cls_code_2="", + ... fid_input_cnt_2="", + ... fid_rank_sort_cls_code_3="", + ... fid_input_cnt_3="", + ... fid_trgt_cls_code="", + ... fid_input_iscd="", + ... fid_unas_input_iscd="", + ... fid_mrkt_cls_code="", + ... fid_input_date_1="", + ... fid_input_date_2="", + ... fid_input_iscd_2="", + ... fid_etc_cls_code="", + ... # 나머지 모든 파라미터는 빈 문자열 + ... **{param: "" for param in [ + ... "fid_input_rmnn_dynu_1", "fid_input_rmnn_dynu_2", + ... "fid_prpr_cnt1", "fid_prpr_cnt2", "fid_rsfl_rate1", "fid_rsfl_rate2", + ... "fid_vol1", "fid_vol2", "fid_aply_rang_prc_1", "fid_aply_rang_prc_2", + ... "fid_lvrg_val1", "fid_lvrg_val2", "fid_vol3", "fid_vol4", + ... "fid_ints_vltl1", "fid_ints_vltl2", "fid_prmm_val1", "fid_prmm_val2", + ... "fid_gear1", "fid_gear2", "fid_prls_qryr_rate1", "fid_prls_qryr_rate2", + ... "fid_delta1", "fid_delta2", "fid_acpr1", "fid_acpr2", + ... "fid_stck_cnvr_rate1", "fid_stck_cnvr_rate2", "fid_div_cls_code", + ... "fid_prit1", "fid_prit2", "fid_cfp1", "fid_cfp2", + ... "fid_input_nmix_price_1", "fid_input_nmix_price_2", + ... "fid_egea_val1", "fid_egea_val2", "fid_input_dvdn_ert", + ... "fid_input_hist_vltl", "fid_theta1", "fid_theta2" + ... ]} + ... ) + >>> print(df.head()) + """ + + # 필수 파라미터 검증 (최소한으로 축소) + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11510')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11510')") + + if fid_rank_sort_cls_code is None: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_cnt_1: + logger.error("fid_input_cnt_1 is required. (e.g. '1')") + raise ValueError("fid_input_cnt_1 is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 (무한 재귀 방지) + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 정보 설정 + tr_id = "FHKEW15100000" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_CNT_1": fid_input_cnt_1, + "FID_RANK_SORT_CLS_CODE_2": fid_rank_sort_cls_code_2, + "FID_INPUT_CNT_2": fid_input_cnt_2, + "FID_RANK_SORT_CLS_CODE_3": fid_rank_sort_cls_code_3, + "FID_INPUT_CNT_3": fid_input_cnt_3, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_RMNN_DYNU_2": fid_input_rmnn_dynu_2, + "FID_PRPR_CNT1": fid_prpr_cnt1, + "FID_PRPR_CNT2": fid_prpr_cnt2, + "FID_RSFL_RATE1": fid_rsfl_rate1, + "FID_RSFL_RATE2": fid_rsfl_rate2, + "FID_VOL1": fid_vol1, + "FID_VOL2": fid_vol2, + "FID_APLY_RANG_PRC_1": fid_aply_rang_prc_1, + "FID_APLY_RANG_PRC_2": fid_aply_rang_prc_2, + "FID_LVRG_VAL1": fid_lvrg_val1, + "FID_LVRG_VAL2": fid_lvrg_val2, + "FID_VOL3": fid_vol3, + "FID_VOL4": fid_vol4, + "FID_INTS_VLTL1": fid_ints_vltl1, + "FID_INTS_VLTL2": fid_ints_vltl2, + "FID_PRMM_VAL1": fid_prmm_val1, + "FID_PRMM_VAL2": fid_prmm_val2, + "FID_GEAR1": fid_gear1, + "FID_GEAR2": fid_gear2, + "FID_PRLS_QRYR_RATE1": fid_prls_qryr_rate1, + "FID_PRLS_QRYR_RATE2": fid_prls_qryr_rate2, + "FID_DELTA1": fid_delta1, + "FID_DELTA2": fid_delta2, + "FID_ACPR1": fid_acpr1, + "FID_ACPR2": fid_acpr2, + "FID_STCK_CNVR_RATE1": fid_stck_cnvr_rate1, + "FID_STCK_CNVR_RATE2": fid_stck_cnvr_rate2, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_PRIT1": fid_prit1, + "FID_PRIT2": fid_prit2, + "FID_CFP1": fid_cfp1, + "FID_CFP2": fid_cfp2, + "FID_INPUT_NMIX_PRICE_1": fid_input_nmix_price_1, + "FID_INPUT_NMIX_PRICE_2": fid_input_nmix_price_2, + "FID_EGEA_VAL1": fid_egea_val1, + "FID_EGEA_VAL2": fid_egea_val2, + "FID_INPUT_DVDN_ERT": fid_input_dvdn_ert, + "FID_INPUT_HIST_VLTL": fid_input_hist_vltl, + "FID_THETA1": fid_theta1, + "FID_THETA2": fid_theta2, + } + + # API 호출 정보 로그 + logger.info("ELW 종목검색 API 호출 시작 (depth: %d)", depth) + + # API 호출 실행 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + # 단일 객체인 경우 리스트로 변환 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + logger.info("API 호출 성공: %d건의 데이터를 수신했습니다.", len(current_data)) + else: + current_data = pd.DataFrame() + logger.warning("API 응답에서 output 데이터를 찾을 수 없습니다.") + + # 데이터프레임 누적 처리 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 조회 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 연속 데이터가 있는 경우 재귀 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() # API 호출 간격 조절 + return cond_search( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_input_cnt_1, + fid_rank_sort_cls_code_2, + fid_input_cnt_2, + fid_rank_sort_cls_code_3, + fid_input_cnt_3, + fid_trgt_cls_code, + fid_input_iscd, + fid_unas_input_iscd, + fid_mrkt_cls_code, + fid_input_date_1, + fid_input_date_2, + fid_input_iscd_2, + fid_etc_cls_code, + fid_input_rmnn_dynu_1, + fid_input_rmnn_dynu_2, + fid_prpr_cnt1, + fid_prpr_cnt2, + fid_rsfl_rate1, + fid_rsfl_rate2, + fid_vol1, + fid_vol2, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + fid_lvrg_val1, + fid_lvrg_val2, + fid_vol3, + fid_vol4, + fid_ints_vltl1, + fid_ints_vltl2, + fid_prmm_val1, + fid_prmm_val2, + fid_gear1, + fid_gear2, + fid_prls_qryr_rate1, + fid_prls_qryr_rate2, + fid_delta1, + fid_delta2, + fid_acpr1, + fid_acpr2, + fid_stck_cnvr_rate1, + fid_stck_cnvr_rate2, + fid_div_cls_code, + fid_prit1, + fid_prit2, + fid_cfp1, + fid_cfp2, + fid_input_nmix_price_1, + fid_input_nmix_price_2, + fid_egea_val1, + fid_egea_val2, + fid_input_dvdn_ert, + fid_input_hist_vltl, + fid_theta1, + fid_theta2, + "N", dataframe, depth + 1, max_depth + ) + else: + # 데이터 수집 완료 + logger.info("Data fetch complete.") + total_records = len(dataframe) if dataframe is not None else 0 + logger.info("총 %d건의 ELW 종목 데이터를 수집했습니다.", total_records) + return dataframe + else: + # API 호출 실패 처리 + error_code = res.getErrorCode() + error_message = res.getErrorMessage() + logger.error("API call failed: %s - %s", error_code, error_message) + res.printError(API_URL) + return pd.DataFrame() # 빈 데이터프레임 반환 diff --git a/한국투자증권(API)/examples_llm/elw/elw_asking_price/chk_elw_asking_price.py b/한국투자증권(API)/examples_llm/elw/elw_asking_price/chk_elw_asking_price.py new file mode 100644 index 0000000..20e4b56 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_asking_price/chk_elw_asking_price.py @@ -0,0 +1,193 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from elw_asking_price import elw_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간호가[실시간-062] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "bsop_hour": "영업시간", + "hour_cls_code": "시간구분코드", + "askp1": "매도호가1", + "askp2": "매도호가2", + "askp3": "매도호가3", + "askp4": "매도호가4", + "askp5": "매도호가5", + "askp6": "매도호가6", + "askp7": "매도호가7", + "askp8": "매도호가8", + "askp9": "매도호가9", + "askp10": "매도호가10", + "bidp1": "매수호가1", + "bidp2": "매수호가2", + "bidp3": "매수호가3", + "bidp4": "매수호가4", + "bidp5": "매수호가5", + "bidp6": "매수호가6", + "bidp7": "매수호가7", + "bidp8": "매수호가8", + "bidp9": "매수호가9", + "bidp10": "매수호가10", + "askp_rsqn1": "매도호가잔량1", + "askp_rsqn2": "매도호가잔량2", + "askp_rsqn3": "매도호가잔량3", + "askp_rsqn4": "매도호가잔량4", + "askp_rsqn5": "매도호가잔량5", + "askp_rsqn6": "매도호가잔량6", + "askp_rsqn7": "매도호가잔량7", + "askp_rsqn8": "매도호가잔량8", + "askp_rsqn9": "매도호가잔량9", + "askp_rsqn10": "매도호가잔량10", + "bidp_rsqn1": "매수호가잔량1", + "bidp_rsqn2": "매수호가잔량2", + "bidp_rsqn3": "매수호가잔량3", + "bidp_rsqn4": "매수호가잔량4", + "bidp_rsqn5": "매수호가잔량5", + "bidp_rsqn6": "매수호가잔량6", + "bidp_rsqn7": "매수호가잔량7", + "bidp_rsqn8": "매수호가잔량8", + "bidp_rsqn9": "매수호가잔량9", + "bidp_rsqn10": "매수호가잔량10", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "antc_cnpr": "예상체결가", + "antc_cnqn": "예상체결량", + "antc_cntg_vrss_sign": "예상체결대비부호", + "antc_cntg_vrss": "예상체결대비", + "antc_cntg_prdy_ctrt": "예상체결전일대비율", + "lp_askp_rsqn1": "LP매도호가잔량1", + "lp_askp_rsqn2": "LP매도호가잔량2", + "lp_askp_rsqn3": "LP매도호가잔량3", + "lp_bidp_rsqn4": "LP매수호가잔량4", + "lp_askp_rsqn4": "LP매도호가잔량4", + "lp_bidp_rsqn5": "LP매수호가잔량5", + "lp_askp_rsqn5": "LP매도호가잔량5", + "lp_bidp_rsqn6": "LP매수호가잔량6", + "lp_askp_rsqn6": "LP매도호가잔량6", + "lp_bidp_rsqn7": "LP매수호가잔량7", + "lp_askp_rsqn7": "LP매도호가잔량7", + "lp_askp_rsqn8": "LP매도호가잔량8", + "lp_bidp_rsqn8": "LP매수호가잔량8", + "lp_askp_rsqn9": "LP매도호가잔량9", + "lp_bidp_rsqn9": "LP매수호가잔량9", + "lp_askp_rsqn10": "LP매도호가잔량10", + "lp_bidp_rsqn10": "LP매수호가잔량10", + "lp_bidp_rsqn1": "LP매수호가잔량1", + "lp_total_askp_rsqn": "LP총매도호가잔량", + "lp_bidp_rsqn2": "LP매수호가잔량2", + "lp_total_bidp_rsqn": "LP총매수호가잔량", + "lp_bidp_rsqn3": "LP매수호가잔량3", + "antc_vol": "예상거래량" +} + +# 숫자형 컬럼 리스트 (문자열 컬럼 제외) +NUMERIC_COLUMNS = [ + "매도호가1", "매도호가2", "매도호가3", "매도호가4", "매도호가5", "매도호가6", "매도호가7", "매도호가8", "매도호가9", "매도호가10", + "매수호가1", "매수호가2", "매수호가3", "매수호가4", "매수호가5", "매수호가6", "매수호가7", "매수호가8", "매수호가9", "매수호가10", + "매도호가잔량1", "매도호가잔량2", "매도호가잔량3", "매도호가잔량4", "매도호가잔량5", + "매도호가잔량6", "매도호가잔량7", "매도호가잔량8", "매도호가잔량9", "매도호가잔량10", + "매수호가잔량1", "매수호가잔량2", "매수호가잔량3", "매수호가잔량4", "매수호가잔량5", + "매수호가잔량6", "매수호가잔량7", "매수호가잔량8", "매수호가잔량9", "매수호가잔량10", + "총매도호가잔량", "총매수호가잔량", "예상체결가", "예상체결량", "예상체결대비", "예상체결전일대비율", + "LP매도호가잔량1", "LP매도호가잔량2", "LP매도호가잔량3", "LP매수호가잔량4", "LP매도호가잔량4", + "LP매수호가잔량5", "LP매도호가잔량5", "LP매수호가잔량6", "LP매도호가잔량6", "LP매수호가잔량7", + "LP매도호가잔량7", "LP매도호가잔량8", "LP매수호가잔량8", "LP매도호가잔량9", "LP매수호가잔량9", + "LP매도호가잔량10", "LP매수호가잔량10", "LP매수호가잔량1", "LP총매도호가잔량", "LP매수호가잔량2", + "LP총매수호가잔량", "LP매수호가잔량3", "예상거래량" +] + + +def main(): + """ + [국내주식] ELW시세 + ELW 실시간호가[H0EWASP0] + + ELW 실시간 호가 정보를 실시간으로 구독하는 웹소켓 API입니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + ka.auth_ws() + logger.info("토큰 발급 완료") + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # API 호출 + logger.info("API 호출 ") + kws.subscribe(request=elw_asking_price, data=["57LA24","57L739","57L650","57L966","52L181","57LB38"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 안전한 컬럼명 매핑 (존재하는 컬럼에 대해서만 한글명 적용) + if not result.empty: + # 컬럼명 매핑 + existing_columns = {col: COLUMN_MAPPING[col] for col in result.columns if col in COLUMN_MAPPING} + if existing_columns: + result = result.rename(columns=existing_columns) + logging.info(f"컬럼명 매핑 완료: {len(existing_columns)}개 컬럼") + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + # 원본 컬럼명 확인 + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + # 한글명으로 변환된 컬럼명 확인 + elif COLUMN_MAPPING.get(col) in result.columns: + result[COLUMN_MAPPING[col]] = pd.to_numeric(result[COLUMN_MAPPING[col]], errors='coerce').round(2) + + logger.info("=== ELW 실시간호가 결과 ===") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/elw/elw_asking_price/elw_asking_price.py b/한국투자증권(API)/examples_llm/elw/elw_asking_price/elw_asking_price.py new file mode 100644 index 0000000..af443c3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_asking_price/elw_asking_price.py @@ -0,0 +1,137 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간호가[실시간-062] +############################################################################################## + +def elw_asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간호가[H0EWASP0] + ELW 실시간 호가 정보를 실시간으로 구독하는 웹소켓 API입니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 응답 메시지. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = elw_asking_price("1", "005930") + >>> print(msg, columns) + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0EWASP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "bsop_hour", + "hour_cls_code", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "askp10", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "bidp10", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10", + "total_askp_rsqn", + "total_bidp_rsqn", + "antc_cnpr", + "antc_cnqn", + "antc_cntg_vrss_sign", + "antc_cntg_vrss", + "antc_cntg_prdy_ctrt", + "lp_askp_rsqn1", + "lp_askp_rsqn2", + "lp_askp_rsqn3", + "lp_bidp_rsqn4", + "lp_askp_rsqn4", + "lp_bidp_rsqn5", + "lp_askp_rsqn5", + "lp_bidp_rsqn6", + "lp_askp_rsqn6", + "lp_bidp_rsqn7", + "lp_askp_rsqn7", + "lp_askp_rsqn8", + "lp_bidp_rsqn8", + "lp_askp_rsqn9", + "lp_bidp_rsqn9", + "lp_askp_rsqn10", + "lp_bidp_rsqn10", + "lp_bidp_rsqn1", + "lp_total_askp_rsqn", + "lp_bidp_rsqn2", + "lp_total_bidp_rsqn", + "lp_bidp_rsqn3", + "antc_vol", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/elw/elw_ccnl/chk_elw_ccnl.py b/한국투자증권(API)/examples_llm/elw/elw_ccnl/chk_elw_ccnl.py new file mode 100644 index 0000000..fee0028 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_ccnl/chk_elw_ccnl.py @@ -0,0 +1,169 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from elw_ccnl import elw_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간체결가[실시간-061] +############################################################################################## + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비부호", + "prdy_vrss": "전일대비", + "prdy_ctrt": "전일대비율", + "wghn_avrg_stck_prc": "가중평균주식가격", + "stck_oprc": "주식시가2", + "stck_hgpr": "주식최고가", + "stck_lwpr": "주식최저가", + "askp1": "매도호가1", + "bidp1": "매수호가1", + "cntg_vol": "체결거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "cttr": "체결강도", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "cntg_cls_code": "체결구분코드", + "shnu_rate": "매수2비율", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가2대비현재가부호", + "oprc_vrss_prpr": "시가2대비현재가", + "hgpr_vrss_prpr_sign": "최고가대비현재가부호", + "hgpr_vrss_prpr": "최고가대비현재가", + "lwpr_vrss_prpr_sign": "최저가대비현재가부호", + "lwpr_vrss_prpr": "최저가대비현재가", + "bsop_date": "기준일자", + "new_mkop_cls_code": "신규시장분류코드", + "trht_yn": "거래정지여부", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "vol_rate": "거래량비율", + "prdy_vrss_vol_rate": "전일대비거래량비율", + "askp_rsqn_icdc": "매도호가잔량증감", + "bidp_rsqn_icdc": "매수호가잔량증감", + "hour_cls_code": "시간구분코드", + "mrkt_trtm_cls_code": "시장거래시간구분코드", + "vi_cls_code": "VI구분코드", + "timr_val": "시간가치값", + "parity": "패리티", + "prm_val": "프리미엄값", + "gear": "기어링", + "bep_rate": "손익분기비율", + "itmv_val": "내재가치값", + "prm_rate": "프리미엄비율", + "sppt_pnt": "자본지지점", + "lvrg_val": "레버리지값", + "delta": "델타", + "gamma": "감마", + "vega": "베가", + "theta": "세타", + "rho": "로우", + "hts_antc_vol": "HTS내재변동성", + "hts_theo_prc": "HTS이론가", + "vol_tnrt": "거래량회전율", + "prdy_smns_hour_acml_vol": "전일동시간누적거래량", + "prdy_smns_hour_acml_vol_rate": "전일동시간누적거래량비율", + "apprch_rate": "접근도", + "lp_hvol": "LP보유량", + "lp_hldn_rate": "LP보유비율", + "lp_ntby_qty": "LP순매도량" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "전일대비율", "가중평균주식가격", "주식시가2", "주식최고가", "주식최저가", + "매도호가1", "매수호가1", "체결거래량", "누적거래량", "누적거래대금", "매도체결건수", "매수체결건수", + "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수2비율", "전일거래량대비등락율", + "시가2대비현재가", "최고가대비현재가", "최저가대비현재가", "매도호가잔량1", "매수호가잔량1", + "총매도호가잔량", "총매수호가잔량", "시간가치값", "패리티", "프리미엄값", "기어링", "손익분기비율", + "내재가치값", "프리미엄비율", "자본지지점", "레버리지값", "델타", "감마", "베가", "세타", "로우", + "HTS내재변동성", "HTS이론가", "거래량회전율", "전일동시간누적거래량", "전일동시간누적거래량비율", + "접근도", "LP보유량", "LP보유비율", "LP순매도량" +] + +def main(): + """ + ELW 실시간체결가 + + ELW 실시간체결가 API입니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # API 호출 + logger.info("API 호출") + kws.subscribe(request=elw_ccnl, data=["57LA24","57L739","57L650","57L966","52L181","57LB38"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/elw/elw_ccnl/elw_ccnl.py b/한국투자증권(API)/examples_llm/elw/elw_ccnl/elw_ccnl.py new file mode 100644 index 0000000..e888ce6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_ccnl/elw_ccnl.py @@ -0,0 +1,77 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간체결가[실시간-061] +############################################################################################## + +def elw_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간체결가[H0EWCNT0] 구독 함수 + ELW 실시간체결가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드를 입력합니다. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 실시간 데이터의 컬럼 정보 + + Example: + >>> msg, columns = elw_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0EWCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", "stck_cntg_hour", "stck_prpr", "prdy_vrss_sign", + "prdy_vrss", "prdy_ctrt", "wghn_avrg_stck_prc", "stck_oprc", + "stck_hgpr", "stck_lwpr", "askp1", "bidp1", "cntg_vol", "acml_vol", + "acml_tr_pbmn", "seln_cntg_csnu", "shnu_cntg_csnu", "ntby_cntg_csnu", + "cttr", "seln_cntg_smtn", "shnu_cntg_smtn", "cntg_cls_code", + "shnu_rate", "prdy_vol_vrss_acml_vol_rate", "oprc_hour", + "oprc_vrss_prpr_sign", "oprc_vrss_prpr", "hgpr_hour", + "hgpr_vrss_prpr_sign", "hgpr_vrss_prpr", "lwpr_hour", + "lwpr_vrss_prpr_sign", "lwpr_vrss_prpr", "bsop_date", + "new_mkop_cls_code", "trht_yn", "askp_rsqn1", "bidp_rsqn1", + "total_askp_rsqn", "total_bidp_rsqn", "tmvl_val", "prit", "prmm_val", + "gear", "prls_qryr_rate", "invl_val", "prmm_rate", "cfp", "lvrg_val", + "delta", "gama", "vega", "theta", "rho", "hts_ints_vltl", "hts_thpr", + "vol_tnrt", "prdy_smns_hour_acml_vol", "prdy_smns_hour_acml_vol_rate", + "apprch_rate", "lp_hvol", "lp_hldn_rate", "lp_ntby_qty" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/chk_elw_exp_ccnl.py b/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/chk_elw_exp_ccnl.py new file mode 100644 index 0000000..77bc055 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/chk_elw_exp_ccnl.py @@ -0,0 +1,159 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from elw_exp_ccnl import elw_exp_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간예상체결[실시간-063] +############################################################################################## + +COLUMN_MAPPING = { + "mksc_shrn_iscd": "유가증권단축종목코드", + "stck_cntg_hour": "주식체결시간", + "stck_prpr": "주식현재가", + "prdy_vrss_sign": "전일대비부호", + "prdy_vrss": "전일대비", + "prdy_ctrt": "전일대비율", + "wghn_avrg_stck_prc": "가중평균주식가격", + "stck_oprc": "주식시가2", + "stck_hgpr": "주식최고가", + "stck_lwpr": "주식최저가", + "askp1": "매도호가1", + "bidp1": "매수호가1", + "cntg_vol": "체결거래량", + "acml_vol": "누적거래량", + "acml_tr_pbmn": "누적거래대금", + "seln_cntg_csnu": "매도체결건수", + "shnu_cntg_csnu": "매수체결건수", + "ntby_cntg_csnu": "순매수체결건수", + "cttr": "체결강도", + "seln_cntg_smtn": "총매도수량", + "shnu_cntg_smtn": "총매수수량", + "cntg_cls_code": "체결구분코드", + "shnu_rate": "매수2비율", + "prdy_vol_vrss_acml_vol_rate": "전일거래량대비등락율", + "oprc_hour": "시가시간", + "oprc_vrss_prpr_sign": "시가2대비현재가부호", + "oprc_vrss_prpr": "시가2대비현재가", + "hgpr_hour": "최고가시간", + "hgpr_vrss_prpr_sign": "최고가대비현재가부호", + "hgpr_vrss_prpr": "최고가대비현재가", + "lwpr_hour": "최저가시간", + "lwpr_vrss_prpr_sign": "최저가대비현재가부호", + "lwpr_vrss_prpr": "최저가대비현재가", + "bsop_date": "영업일자", + "new_mkop_cls_code": "신장운영구분코드", + "trht_yn": "거래정지여부", + "askp_rsqn1": "매도호가잔량1", + "bidp_rsqn1": "매수호가잔량1", + "total_askp_rsqn": "총매도호가잔량", + "total_bidp_rsqn": "총매수호가잔량", + "tmvl_val": "시간가치값", + "prit": "패리티", + "prmm_val": "프리미엄값", + "gear": "기어링", + "prls_qryr_rate": "손익분기비율", + "invl_val": "내재가치값", + "prmm_rate": "프리미엄비율", + "cfp": "자본지지점", + "lvrg_val": "레버리지값", + "delta": "델타", + "gama": "감마", + "vega": "베가", + "theta": "세타", + "rho": "로우", + "hts_ints_vltl": "HTS내재변동성", + "hts_thpr": "HTS이론가", + "vol_tnrt": "거래량회전율", + "lp_hvol": "LP보유량", + "lp_hldn_rate": "LP보유비율" +} + +NUMERIC_COLUMNS = [ + "주식현재가", "전일대비", "전일대비율", "가중평균주식가격", "주식시가2", "주식최고가", "주식최저가", + "매도호가1", "매수호가1", "체결거래량", "누적거래량", "누적거래대금", "매도체결건수", "매수체결건수", + "순매수체결건수", "체결강도", "총매도수량", "총매수수량", "매수2비율", "전일거래량대비등락율", + "시가2대비현재가", "최고가대비현재가", "최저가대비현재가", "매도호가잔량1", "매수호가잔량1", + "총매도호가잔량", "총매수호가잔량", "시간가치값", "패리티", "프리미엄값", "기어링", "손익분기비율", + "내재가치값", "프리미엄비율", "자본지지점", "레버리지값", "델타", "감마", "베가", "세타", "로우", + "HTS내재변동성", "HTS이론가", "거래량회전율", "LP보유량", "LP보유비율" +] + +def main(): + """ + ELW 실시간예상체결 + + ELW 실시간예상체결 API입니다. + +[참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + +[호출 데이터] +헤더와 바디 값을 합쳐 JSON 형태로 전송합니다. + +[응답 데이터] +1. 정상 등록 여부 (JSON) +- JSON["body"]["msg1"] - 정상 응답 시, SUBSCRIBE SUCCESS +- JSON["body"]["output"]["iv"] - 실시간 결과 복호화에 필요한 AES256 IV (Initialize Vector) +- JSON["body"]["output"]["key"] - 실시간 결과 복호화에 필요한 AES256 Key + +2. 실시간 결과 응답 ( | 로 구분되는 값) +ex) 0|H0STCNT0|004|005930^123929^73100^5^... +- 암호화 유무 : 0 암호화 되지 않은 데이터 / 1 암호화된 데이터 +- TR_ID : 등록한 tr_id (ex. H0STCNT0) +- 데이터 건수 : (ex. 001 인 경우 데이터 건수 1건, 004인 경우 데이터 건수 4건) +- 응답 데이터 : 아래 response 데이터 참조 ( ^로 구분됨) + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # API 호출 + logger.info("API 호출") + kws.subscribe(request=elw_exp_ccnl, data=["57LA24","57L739","57L650","57L966","52L181","57LB38"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + logging.info("결과:") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/elw_exp_ccnl.py b/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/elw_exp_ccnl.py new file mode 100644 index 0000000..21d2566 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/elw_exp_ccnl/elw_exp_ccnl.py @@ -0,0 +1,121 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간예상체결[실시간-063] +############################################################################################## + +def elw_exp_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간예상체결[H0EWANC0] + ELW 실시간예상체결 API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = elw_exp_ccnl("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0EWANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "tmvl_val", + "prit", + "prmm_val", + "gear", + "prls_qryr_rate", + "invl_val", + "prmm_rate", + "cfp", + "lvrg_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "hts_thpr", + "vol_tnrt", + "lp_hvol", + "lp_hldn_rate", + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/elw/expiration_stocks/chk_expiration_stocks.py b/한국투자증권(API)/examples_llm/elw/expiration_stocks/chk_expiration_stocks.py new file mode 100644 index 0000000..7df6fac --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/expiration_stocks/chk_expiration_stocks.py @@ -0,0 +1,128 @@ +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from expiration_stocks import expiration_stocks + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 만기예정/만기종목[국내주식-184] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_kor_isnm': 'ELW한글종목명', + 'unas_isnm': '기초자산종목명', + 'unas_prpr': '기초자산현재가', + 'acpr': '행사가', + 'stck_cnvr_rate': '주식전환비율', + 'elw_prpr': 'ELW현재가', + 'stck_lstn_date': '주식상장일자', + 'stck_last_tr_date': '주식최종거래일자', + 'total_rdmp_amt': '총상환금액', + 'rdmp_amt': '상환금액', + 'lstn_stcn': '상장주수', + 'lp_hvol': 'LP보유량', + 'ccls_paym_prc': '확정지급2가격', + 'mtrt_vltn_amt': '만기평가금액', + 'evnt_prd_fin_date': '행사2기간종료일자', + 'stlm_date': '결제일자', + 'pblc_prc': '발행가격', + 'unas_shrn_iscd': '기초자산단축종목코드', + 'stnd_iscd': '표준종목코드', + 'rdmp_ask_amt': '상환청구금액' +} + +NUMERIC_COLUMNS = [ + '기초자산현재가', '행사가', '주식전환비율', 'ELW현재가', '총상환금액', '상환금액', + '상장주수', 'LP보유량', '확정지급2가격', '만기평가금액', '발행가격', '상환청구금액' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 만기예정_만기종목[국내주식-184] + + ELW 만기예정_만기종목 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (W 입력) + - fid_cond_scr_div_code (str): 조건화면분류코드 (11547 입력) + - fid_input_date_1 (str): 입력날짜1 (입력날짜 ~ (ex) 20240402)) + - fid_input_date_2 (str): 입력날짜2 (~입력날짜 (ex) 20240408)) + - fid_div_cls_code (str): 분류구분코드 (0(콜),1(풋),2(전체)) + - fid_etc_cls_code (str): 기타구분코드 (공백 입력) + - fid_unas_input_iscd (str): 기초자산입력종목코드 (000000(전체), 2001(KOSPI 200), 기초자산코드(종목코드 ex. 삼성전자-005930)) + - fid_input_iscd_2 (str): 발행회사코드 (00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권)) + - fid_blng_cls_code (str): 결제방법 (0(전체),1(일반),2(조기종료)) + - fid_input_option_1 (str): 입력옵션1 (공백 입력) + Returns: + - DataFrame: ELW 만기예정_만기종목 결과 + + Example: + >>> df = expiration_stocks(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11547", fid_input_date_1="20240402", fid_input_date_2="20240408", fid_div_cls_code="2", fid_etc_cls_code="", fid_unas_input_iscd="000000", fid_input_iscd_2="00000", fid_blng_cls_code="0", fid_input_option_1="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = expiration_stocks( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="11547", # 조건화면분류코드 + fid_input_date_1="20250101", # 입력날짜1 + fid_input_date_2="20250930", # 입력날짜2 + fid_div_cls_code="2", # 분류구분코드 + fid_etc_cls_code="", # 기타구분코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd_2="00000", # 발행회사코드 + fid_blng_cls_code="0", # 결제방법 + fid_input_option_1="", # 입력옵션1 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 만기예정_만기종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/expiration_stocks/expiration_stocks.py b/한국투자증권(API)/examples_llm/elw/expiration_stocks/expiration_stocks.py new file mode 100644 index 0000000..f17f2ab --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/expiration_stocks/expiration_stocks.py @@ -0,0 +1,179 @@ +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 만기예정/만기종목[국내주식-184] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/expiration-stocks" + +def expiration_stocks( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + fid_div_cls_code: str, # 분류구분코드 + fid_etc_cls_code: str, # 기타구분코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd_2: str, # 발행회사코드 + fid_blng_cls_code: str, # 결제방법 + fid_input_option_1: str, # 입력옵션1 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 만기예정_만기종목[국내주식-184] + ELW 만기예정_만기종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): W 입력 + fid_cond_scr_div_code (str): 11547 입력 + fid_input_date_1 (str): 입력날짜 ~ (ex) 20240402) + fid_input_date_2 (str): ~입력날짜 (ex) 20240408) + fid_div_cls_code (str): 0(콜),1(풋),2(전체) + fid_etc_cls_code (str): 공백 입력 + fid_unas_input_iscd (str): 000000(전체), 2001(KOSPI 200), 기초자산코드(종목코드 ex. 삼성전자-005930) + fid_input_iscd_2 (str): 00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권) + fid_blng_cls_code (str): 0(전체),1(일반),2(조기종료) + fid_input_option_1 (str): 공백 입력 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 만기예정_만기종목 데이터 + + Example: + >>> df = expiration_stocks( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11547', + ... fid_input_date_1='20240402', + ... fid_input_date_2='20240408', + ... fid_div_cls_code='0', + ... fid_etc_cls_code='', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd_2='00000', + ... fid_blng_cls_code='0', + ... fid_input_option_1='', + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11547')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11547')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240402')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240402')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20240408')") + raise ValueError("fid_input_date_2 is required. (e.g. '20240408')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '00000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '00000')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKEW154700C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_OPTION_1": fid_input_option_1, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return expiration_stocks( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_date_1, + fid_input_date_2, + fid_div_cls_code, + fid_etc_cls_code, + fid_unas_input_iscd, + fid_input_iscd_2, + fid_blng_cls_code, + fid_input_option_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/indicator/chk_indicator.py b/한국투자증권(API)/examples_llm/elw/indicator/chk_indicator.py new file mode 100644 index 0000000..72d5f9f --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator/chk_indicator.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from indicator import indicator + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 지표순위[국내주식-169] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_kor_isnm': 'ELW한글종목명', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'stck_cnvr_rate': '주식전환비율', + 'lvrg_val': '레버리지값', + 'acpr': '행사가', + 'tmvl_val': '시간가치값', + 'invl_val': '내재가치값', + 'elw_ko_barrier': '조기종료발생기준가격' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '주식전환비율', + '레버리지값', '행사가', '시간가치값', '내재가치값', '조기종료발생기준가격' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 지표순위[국내주식-169] + + ELW 지표순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Unique key(20279)) + - fid_unas_input_iscd (str): 기초자산입력종목코드 ('000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ') + - fid_input_iscd (str): 발행사 ('00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_div_cls_code (str): 콜풋구분코드 (0(전체), 1(콜), 2(풋)) + - fid_input_price_1 (str): 가격(이상) () + - fid_input_price_2 (str): 가격(이하) () + - fid_input_vol_1 (str): 거래량(이상) () + - fid_input_vol_2 (str): 거래량(이하) () + - fid_rank_sort_cls_code (str): 순위정렬구분코드 (0(전환비율), 1(레버리지), 2(행사가 ), 3(내재가치), 4(시간가치)) + - fid_blng_cls_code (str): 결재방법 (0(전체), 1(일반), 2(조기종료)) + Returns: + - DataFrame: ELW 지표순위 결과 + + Example: + >>> df = indicator(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20279", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_rank_sort_cls_code="0", fid_blng_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = indicator( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="20279", # 조건화면분류코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd="00000", # 발행사 + fid_div_cls_code="0", # 콜풋구분코드 + fid_input_price_1="", # 가격(이상) + fid_input_price_2="", # 가격(이하) + fid_input_vol_1="", # 거래량(이상) + fid_input_vol_2="", # 거래량(이하) + fid_rank_sort_cls_code="0", # 순위정렬구분코드 + fid_blng_cls_code="0", # 결재방법 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 지표순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/indicator/indicator.py b/한국투자증권(API)/examples_llm/elw/indicator/indicator.py new file mode 100644 index 0000000..a7e0ed4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator/indicator.py @@ -0,0 +1,180 @@ +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 지표순위[국내주식-169] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/ranking/indicator" + +def indicator( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 지표순위[국내주식-169] + ELW 지표순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_unas_input_iscd (str): 기초자산입력종목코드 (필수) + fid_input_iscd (str): 발행사 (필수) + fid_div_cls_code (str): 콜풋구분코드 (필수) + fid_input_price_1 (str): 가격(이상) (필수) + fid_input_price_2 (str): 가격(이하) (필수) + fid_input_vol_1 (str): 거래량(이상) (필수) + fid_input_vol_2 (str): 거래량(이하) (필수) + fid_rank_sort_cls_code (str): 순위정렬구분코드 (필수) + fid_blng_cls_code (str): 결재방법 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + depth (int): 현재 재귀 깊이 (옵션) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 지표순위 데이터 + + Example: + >>> df = indicator( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20279', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_div_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='1000', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20279')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20279')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02790000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/chk_indicator_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/chk_indicator_trend_ccnl.py new file mode 100644 index 0000000..1764c29 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/chk_indicator_trend_ccnl.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from indicator_trend_ccnl import indicator_trend_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(체결)[국내주식-172] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식체결시간', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'lvrg_val': '레버리지값', + 'gear': '기어링', + 'tmvl_val': '시간가치값', + 'invl_val': '내재가치값', + 'prit': '패리티', + 'apprch_rate': '접근도' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '레버리지값', + '기어링', '시간가치값', '내재가치값', '패리티', '접근도' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 투자지표추이(체결)[국내주식-172] + + ELW 투자지표추이(체결) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + Returns: + - DataFrame: ELW 투자지표추이(체결) 결과 + + Example: + >>> df = indicator_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = indicator_trend_ccnl( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 투자지표추이(체결) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/indicator_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/indicator_trend_ccnl.py new file mode 100644 index 0000000..5faf06d --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_ccnl/indicator_trend_ccnl.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(체결)[국내주식-172] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/indicator-trend-ccnl" + +def indicator_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(체결)[국내주식-172] + ELW 투자지표추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(체결) 데이터 + + Example: + >>> df = indicator_trend_ccnl("W", "58J297") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02740100" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/chk_indicator_trend_daily.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/chk_indicator_trend_daily.py new file mode 100644 index 0000000..8918c0b --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/chk_indicator_trend_daily.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from indicator_trend_daily import indicator_trend_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(일별)[국내주식-173] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'lvrg_val': '레버리지값', + 'gear': '기어링', + 'tmvl_val': '시간가치값', + 'invl_val': '내재가치값', + 'prit': '패리티', + 'elw_oprc': 'ELW시가2', + 'elw_hgpr': 'ELW최고가', + 'elw_lwpr': 'ELW최저가', + 'apprch_rate': '접근도' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '레버리지값', '기어링', + '시간가치값', '내재가치값', '패리티', 'ELW시가2', 'ELW최고가', 'ELW최저가', '접근도' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 투자지표추이(일별)[국내주식-173] + + ELW 투자지표추이(일별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 시장 분류 코드 (예: 'W') + - fid_input_iscd (str): 종목코드 (6자리, 예: '57K281') + Returns: + - DataFrame: ELW 투자지표추이(일별) 결과 + + Example: + >>> df = indicator_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="57K281") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = indicator_trend_daily( + fid_cond_mrkt_div_code="W", # 시장 분류 코드 + fid_input_iscd="57K281", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 결과 출력 + logger.info("=== ELW 투자지표추이(일별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/indicator_trend_daily.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/indicator_trend_daily.py new file mode 100644 index 0000000..9e5efe5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_daily/indicator_trend_daily.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(일별)[국내주식-173] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/indicator-trend-daily" + +def indicator_trend_daily( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 (예: 'W') + fid_input_iscd: str, # 종목코드 (6자리) + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(일별)[국내주식-173] + ELW 투자지표추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장 분류 코드 (예: 'W') + fid_input_iscd (str): 종목코드 (6자리, 예: '57K281') + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(일별) 데이터 + + Example: + >>> df = indicator_trend_daily('W', '57K281') + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '57K281')") + raise ValueError("fid_input_iscd is required. (e.g. '57K281')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02740200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/chk_indicator_trend_minute.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/chk_indicator_trend_minute.py new file mode 100644 index 0000000..7086e20 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/chk_indicator_trend_minute.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from indicator_trend_minute import indicator_trend_minute + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(분별)[국내주식-174] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'stck_cntg_hour': '주식체결시간', + 'elw_prpr': 'ELW현재가', + 'elw_oprc': 'ELW시가2', + 'elw_hgpr': 'ELW최고가', + 'elw_lwpr': 'ELW최저가', + 'lvrg_val': '레버리지값', + 'gear': '기어링', + 'prmm_val': '프리미엄값', + 'invl_val': '내재가치값', + 'prit': '패리티', + 'acml_vol': '누적거래량', + 'cntg_vol': '체결거래량' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', 'ELW시가2', 'ELW최고가', 'ELW최저가', '레버리지값', '기어링', + '프리미엄값', '내재가치값', '패리티', '누적거래량', '체결거래량' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 투자지표추이(분별)[국내주식-174] + + ELW 투자지표추이(분별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + - fid_hour_cls_code (str): 시간구분코드 ('60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분), 7200(60분) ') + - fid_pw_data_incu_yn (str): 과거데이터 포함 여부 (N(과거데이터포함X),Y(과거데이터포함O)) + Returns: + - DataFrame: ELW 투자지표추이(분별) 결과 + + Example: + >>> df = indicator_trend_minute(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297", fid_hour_cls_code="60", fid_pw_data_incu_yn="N") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = indicator_trend_minute( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + fid_hour_cls_code="60", # 시간구분코드 + fid_pw_data_incu_yn="N", # 과거데이터 포함 여부 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 투자지표추이(분별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/indicator_trend_minute.py b/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/indicator_trend_minute.py new file mode 100644 index 0000000..bad1219 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/indicator_trend_minute/indicator_trend_minute.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(분별)[국내주식-174] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/indicator-trend-minute" + +def indicator_trend_minute( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_hour_cls_code: str, # 시간구분코드 + fid_pw_data_incu_yn: str, # 과거데이터 포함 여부 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(분별)[국내주식-174] + ELW 투자지표추이(분별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_input_iscd (str): 입력종목코드 예시: 58J297(KBJ297삼성전자콜) + fid_hour_cls_code (str): 시간구분코드 예시: '60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분), 7200(60분)' + fid_pw_data_incu_yn (str): 과거데이터 포함 여부 예시: N(과거데이터포함X), Y(과거데이터포함O) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(분별) 데이터 + + Example: + >>> df = indicator_trend_minute( + ... fid_cond_mrkt_div_code='W', + ... fid_input_iscd='58J297', + ... fid_hour_cls_code='60', + ... fid_pw_data_incu_yn='N' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '60')") + raise ValueError("fid_hour_cls_code is required. (e.g. '60')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'N')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + url = API_URL + tr_id = "FHPEW02740300" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + # API 호출 + res = ka._url_fetch(url, tr_id, tr_cont, params) + + # API 호출 성공 여부 확인 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_minute( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/lp_trade_trend/chk_lp_trade_trend.py b/한국투자증권(API)/examples_llm/elw/lp_trade_trend/chk_lp_trade_trend.py new file mode 100644 index 0000000..9c27d22 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/lp_trade_trend/chk_lp_trade_trend.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +import lp_trade_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW LP매매추이[국내주식-182] +############################################################################################## + +COLUMN_MAPPING = { + 'cntg_hour': '체결시간', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'acml_tr_pbmn': '누적거래대금', + 'lp_buy_qty': 'LP매수수량', + 'lp_sell_qty': 'LP매도수량', + 'lp_ntby_qty': 'LP순매수수량', + 'lp_buy_amt': 'LP매수금액', + 'lp_sell_amt': 'LP매도금액', + 'lp_ntby_amt': 'LP순매수금액', + 'inst_deal_qty': '기관매매수량', + 'frgn_deal_qty': '외국인매매수량', + 'prsn_deal_qty': '개인매매수량', + 'apprch_rate': '접근도' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '누적거래대금', + 'LP매수수량', 'LP매도수량', 'LP순매수수량', 'LP매수금액', 'LP매도금액', + 'LP순매수금액', '기관매매수량', '외국인매매수량', '개인매매수량', '접근도' +] + +def main(): + """ + [국내주식] ELW시세 + ELW LP매매추이[국내주식-182] + + ELW LP매매추이 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분(W)) + - fid_input_iscd (str): 입력종목코드 (입력종목코드(ex 52K577(미래 K577KOSDAQ150콜)) + + Returns: + - Tuple[DataFrame, ...]: ELW LP매매추이 결과 + + Example: + >>> df1, df2 = lp_trade_trend(fid_cond_mrkt_div_code="W", fid_input_iscd="52K577") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result1, result2 = lp_trade_trend.lp_trade_trend( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="52K577", # 입력종목코드 + ) + + # 첫 번째 결과 처리 + if result1 is None or result1.empty: + logger.warning("첫 번째 조회된 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("첫 번째 결과 사용 가능한 컬럼 목록:") + logger.info(result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + # 결과 출력 (output1) + logger.info("=== output1 ===") + logger.info("조회된 데이터 건수: %d", len(result1)) + print("output1:") + print(result1) + + # 두 번째 결과 처리 + if result2 is None or result2.empty: + logger.warning("두 번째 조회된 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("두 번째 결과 사용 가능한 컬럼 목록:") + logger.info(result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + # 결과 출력 (output2) + logger.info("=== output2 ===") + logger.info("조회된 데이터 건수: %d", len(result2)) + print("output2:") + print(result2) + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/lp_trade_trend/lp_trade_trend.py b/한국투자증권(API)/examples_llm/elw/lp_trade_trend/lp_trade_trend.py new file mode 100644 index 0000000..fefb720 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/lp_trade_trend/lp_trade_trend.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW LP매매추이[국내주식-182] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/lp-trade-trend" + +def lp_trade_trend( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[Optional[pd.DataFrame], Optional[pd.DataFrame]]: + """ + [국내주식] ELW시세 + ELW LP매매추이[국내주식-182] + ELW LP매매추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분(W) + fid_input_iscd (str): 입력종목코드(ex 52K577(미래 K577KOSDAQ150콜) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: ELW LP매매추이 데이터 + + Example: + >>> df1, df2 = lp_trade_trend("W", "52K577") + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '52K577')") + raise ValueError("fid_input_iscd is required. (e.g. '52K577')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPEW03760000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return lp_trade_trend( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/newly_listed/chk_newly_listed.py b/한국투자증권(API)/examples_llm/elw/newly_listed/chk_newly_listed.py new file mode 100644 index 0000000..b5751bc --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/newly_listed/chk_newly_listed.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from newly_listed import newly_listed + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 신규상장종목[국내주식-181] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'unas_isnm': '기초자산종목명', + 'lstn_stcn': '상장주수', + 'acpr': '행사가', + 'stck_last_tr_date': '주식최종거래일자', + 'elw_ko_barrier': '조기종료발생기준가격' +} + +NUMERIC_COLUMNS = [ + '상장주수', '행사가' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 신규상장종목[국내주식-181] + + ELW 신규상장종목 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Unique key(11548)) + - fid_div_cls_code (str): 분류구분코드 (전체(02), 콜(00), 풋(01)) + - fid_unas_input_iscd (str): 기초자산입력종목코드 ('ex) 000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ') + - fid_input_iscd_2 (str): 입력종목코드2 ('00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권)') + - fid_input_date_1 (str): 입력날짜1 (날짜 (ex) 20240402)) + - fid_blng_cls_code (str): 결재방법 (0(전체), 1(일반), 2(조기종료)) + Returns: + - DataFrame: ELW 신규상장종목 결과 + + Example: + >>> df = newly_listed(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11548", fid_div_cls_code="02", fid_unas_input_iscd="000000", fid_input_iscd_2="00003", fid_input_date_1="20240402", fid_blng_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = newly_listed( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="11548", # 조건화면분류코드 + fid_div_cls_code="02", # 분류구분코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd_2="00003", # 입력종목코드2 + fid_input_date_1="20250601", # 입력날짜1 + fid_blng_cls_code="0", # 결제방법 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 신규상장종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/newly_listed/newly_listed.py b/한국투자증권(API)/examples_llm/elw/newly_listed/newly_listed.py new file mode 100644 index 0000000..d1930e0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/newly_listed/newly_listed.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 신규상장종목[국내주식-181] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/newly-listed" + +def newly_listed( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_div_cls_code: str, # 분류구분코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd_2: str, # 입력종목코드2 + fid_input_date_1: str, # 입력날짜1 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 신규상장종목[국내주식-181] + ELW 신규상장종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_cond_scr_div_code (str): Unique key(11548) + fid_div_cls_code (str): 전체(02), 콜(00), 풋(01) + fid_unas_input_iscd (str): 'ex) 000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ' + fid_input_iscd_2 (str): '00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권)' + fid_input_date_1 (str): 날짜 (ex) 20240402) + fid_blng_cls_code (str): 0(전체), 1(일반), 2(조기종료) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 신규상장종목 데이터 + + Example: + >>> df = newly_listed( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11548', + ... fid_div_cls_code='02', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd_2='00003', + ... fid_input_date_1='20240402', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11548')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11548')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '02')") + raise ValueError("fid_div_cls_code is required. (e.g. '02')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '00003')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '00003')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240402')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240402')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKEW154800C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return newly_listed( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_unas_input_iscd, + fid_input_iscd_2, + fid_input_date_1, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/quick_change/chk_quick_change.py b/한국투자증권(API)/examples_llm/elw/quick_change/chk_quick_change.py new file mode 100644 index 0000000..f17de7a --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/quick_change/chk_quick_change.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from quick_change import quick_change + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 당일급변종목[국내주식-171] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_kor_isnm': 'ELW한글종목명', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_vrss': '전일대비', + 'prdy_ctrt': '전일대비율', + 'askp': '매도호가', + 'bidp': '매수호가', + 'total_askp_rsqn': '총매도호가잔량', + 'total_bidp_rsqn': '총매수호가잔량', + 'acml_vol': '누적거래량', + 'stnd_val': '기준값', + 'stnd_val_vrss': '기준값대비', + 'stnd_val_ctrt': '기준값대비율' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '누적거래대금', + '기준값', '기준값대비', '기준값대비율' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 당일급변종목[국내주식-171] + + ELW 당일급변종목 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Unique key(20287)) + - fid_unas_input_iscd (str): 기초자산입력종목코드 ('000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ') + - fid_input_iscd (str): 발행사 ('00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_mrkt_cls_code (str): 시장구분코드 (Unique key(A)) + - fid_input_price_1 (str): 가격(이상) () + - fid_input_price_2 (str): 가격(이하) () + - fid_input_vol_1 (str): 거래량(이상) () + - fid_input_vol_2 (str): 거래량(이하) () + - fid_hour_cls_code (str): 시간구분코드 (1(분), 2(일)) + - fid_input_hour_1 (str): 입력 일 또는 분 () + - fid_input_hour_2 (str): 기준시간(분 선택 시) () + - fid_rank_sort_cls_code (str): 순위정렬구분코드 ('1(가격급등), 2(가격급락), 3(거래량급증) , 4(매수잔량급증), 5(매도잔량급증)') + - fid_blng_cls_code (str): 결재방법 (0(전체), 1(일반), 2(조기종료)) + Returns: + - DataFrame: ELW 당일급변종목 결과 + + Example: + >>> df = quick_change(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20287", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_mrkt_cls_code="A", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_hour_cls_code="1", fid_input_hour_1="", fid_input_hour_2="", fid_rank_sort_cls_code="1", fid_blng_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = quick_change( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="20287", # 조건화면분류코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd="00000", # 발행사 + fid_mrkt_cls_code="A", # 시장구분코드 + fid_input_price_1="", # 가격(이상) + fid_input_price_2="", # 가격(이하) + fid_input_vol_1="", # 거래량(이상) + fid_input_vol_2="", # 거래량(이하) + fid_hour_cls_code="1", # 시간구분코드 + fid_input_hour_1="0", # 입력 일 또는 분 + fid_input_hour_2="", # 기준시간(분 선택 시) + fid_rank_sort_cls_code="1", # 순위정렬구분코드 + fid_blng_cls_code="0" # 결재방법 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 당일급변종목 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/quick_change/quick_change.py b/한국투자증권(API)/examples_llm/elw/quick_change/quick_change.py new file mode 100644 index 0000000..c79f867 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/quick_change/quick_change.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 당일급변종목[국내주식-171] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/ranking/quick-change" + +def quick_change( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_hour_cls_code: str, # 시간구분코드 + fid_input_hour_1: str, # 입력 일 또는 분 + fid_input_hour_2: str, # 기준시간(분 선택 시) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 당일급변종목[국내주식-171] + ELW 당일급변종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_unas_input_iscd (str): 기초자산입력종목코드 (필수) + fid_input_iscd (str): 발행사 (필수) + fid_mrkt_cls_code (str): 시장구분코드 (필수) + fid_input_price_1 (str): 가격(이상) (필수) + fid_input_price_2 (str): 가격(이하) (필수) + fid_input_vol_1 (str): 거래량(이상) (필수) + fid_input_vol_2 (str): 거래량(이하) (필수) + fid_hour_cls_code (str): 시간구분코드 (필수) + fid_input_hour_1 (str): 입력 일 또는 분 (필수) + fid_input_hour_2 (str): 기준시간(분 선택 시) (필수) + fid_rank_sort_cls_code (str): 순위정렬구분코드 (필수) + fid_blng_cls_code (str): 결재방법 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + depth (int): 현재 재귀 깊이 (옵션) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 당일급변종목 데이터 + + Example: + >>> df = quick_change( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20287', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_mrkt_cls_code='A', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='10000', + ... fid_input_vol_2='50000', + ... fid_hour_cls_code='1', + ... fid_input_hour_1='10', + ... fid_input_hour_2='30', + ... fid_rank_sort_cls_code='1', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20287')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20287')") + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '1')") + raise ValueError("fid_hour_cls_code is required. (e.g. '1')") + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02870000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_HOUR_2": fid_input_hour_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return quick_change( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_mrkt_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_hour_cls_code, + fid_input_hour_1, + fid_input_hour_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity/chk_sensitivity.py b/한국투자증권(API)/examples_llm/elw/sensitivity/chk_sensitivity.py new file mode 100644 index 0000000..0a5c28f --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity/chk_sensitivity.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from sensitivity import sensitivity + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 순위[국내주식-170] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_kor_isnm': 'ELW한글종목명', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'hts_thpr': 'HTS이론가', + 'delta_val': '델타값', + 'gama': '감마', + 'theta': '세타', + 'vega': '베가', + 'rho': '로우', + 'hts_ints_vltl': 'HTS내재변동성', + 'd90_hist_vltl': '90일역사적변동성' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', 'HTS이론가', + '델타값', '감마', '세타', '베가', '로우', 'HTS내재변동성', '90일역사적변동성' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 민감도 순위[국내주식-170] + + ELW 민감도 순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Unique key(20285)) + - fid_unas_input_iscd (str): 기초자산입력종목코드 ('000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ') + - fid_input_iscd (str): 입력종목코드 ('00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_div_cls_code (str): 콜풋구분코드 (0(전체), 1(콜), 2(풋)) + - fid_input_price_1 (str): 가격(이상) () + - fid_input_price_2 (str): 가격(이하) () + - fid_input_vol_1 (str): 거래량(이상) () + - fid_input_vol_2 (str): 거래량(이하) () + - fid_rank_sort_cls_code (str): 순위정렬구분코드 ('0(이론가), 1(델타), 2(감마), 3(로), 4(베가) , 5(로) , 6(내재변동성), 7(90일변동성)') + - fid_input_rmnn_dynu_1 (str): 잔존일수(이상) () + - fid_input_date_1 (str): 조회기준일 () + - fid_blng_cls_code (str): 결재방법 (0(전체), 1(일반), 2(조기종료)) + Returns: + - DataFrame: ELW 민감도 순위 결과 + + Example: + >>> df = sensitivity(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20285", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_rank_sort_cls_code="0", fid_input_rmnn_dynu_1="", fid_input_date_1="", fid_blng_cls_code="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = sensitivity( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="20285", # 조건화면분류코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd="00000", # 입력종목코드 + fid_div_cls_code="0", # 콜풋구분코드 + fid_input_price_1="", # 가격(이상) + fid_input_price_2="", # 가격(이하) + fid_input_vol_1="", # 거래량(이상) + fid_input_vol_2="", # 거래량(이하) + fid_rank_sort_cls_code="0", # 순위정렬구분코드 + fid_input_rmnn_dynu_1="", # 잔존일수(이상) + fid_input_date_1="", # 조회기준일 + fid_blng_cls_code="0" # 결재방법 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 민감도 순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity/sensitivity.py b/한국투자증권(API)/examples_llm/elw/sensitivity/sensitivity.py new file mode 100644 index 0000000..44a3375 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity/sensitivity.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 순위[국내주식-170] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/ranking/sensitivity" + +def sensitivity( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 입력종목코드 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_input_rmnn_dynu_1: str, # 잔존일수(이상) + fid_input_date_1: str, # 조회기준일 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 순위[국내주식-170] + ELW 민감도 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 + fid_cond_scr_div_code (str): 조건화면분류코드 + fid_unas_input_iscd (str): 기초자산입력종목코드 + fid_input_iscd (str): 입력종목코드 + fid_div_cls_code (str): 콜풋구분코드 + fid_input_price_1 (str): 가격(이상) + fid_input_price_2 (str): 가격(이하) + fid_input_vol_1 (str): 거래량(이상) + fid_input_vol_2 (str): 거래량(이하) + fid_rank_sort_cls_code (str): 순위정렬구분코드 + fid_input_rmnn_dynu_1 (str): 잔존일수(이상) + fid_input_date_1 (str): 조회기준일 + fid_blng_cls_code (str): 결재방법 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 순위 데이터 + + Example: + >>> df = sensitivity( + fid_cond_mrkt_div_code='W', + fid_cond_scr_div_code='20285', + fid_unas_input_iscd='000000', + fid_input_iscd='00000', + fid_div_cls_code='0', + fid_input_price_1='0', + fid_input_price_2='100000', + fid_input_vol_1='0', + fid_input_vol_2='1000000', + fid_rank_sort_cls_code='0', + fid_input_rmnn_dynu_1='0', + fid_input_date_1='20230101', + fid_blng_cls_code='0' + ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20285')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20285')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02850000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_rank_sort_cls_code, + fid_input_rmnn_dynu_1, + fid_input_date_1, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/chk_sensitivity_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/chk_sensitivity_trend_ccnl.py new file mode 100644 index 0000000..da20a7d --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/chk_sensitivity_trend_ccnl.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from sensitivity_trend_ccnl import sensitivity_trend_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(체결)[국내주식-175] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식체결시간', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'hts_thpr': 'hts 이론가', + 'delta_val': '델타 값', + 'gama': '감마', + 'theta': '세타', + 'vega': '베가', + 'rho': '로우' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', 'hts 이론가', '델타 값', + '감마', '세타', '베가', '로우' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 민감도 추이(체결)[국내주식-175] + + ELW 민감도 추이(체결) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + Returns: + - DataFrame: ELW 민감도 추이(체결) 결과 + + Example: + >>> df = sensitivity_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = sensitivity_trend_ccnl( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 민감도 추이(체결) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/sensitivity_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/sensitivity_trend_ccnl.py new file mode 100644 index 0000000..d9486e8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_ccnl/sensitivity_trend_ccnl.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(체결)[국내주식-175] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/sensitivity-trend-ccnl" + +def sensitivity_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 추이(체결)[국내주식-175] + ELW 민감도 추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 추이(체결) 데이터 + + Example: + >>> df = sensitivity_trend_ccnl('W', '58J297') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02830100" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/chk_sensitivity_trend_daily.py b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/chk_sensitivity_trend_daily.py new file mode 100644 index 0000000..6fc71d3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/chk_sensitivity_trend_daily.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from sensitivity_trend_daily import sensitivity_trend_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(일별)[국내주식-176] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식영업일자', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'hts_thpr': 'HTS이론가', + 'delta_val': '델타값', + 'gama': '감마', + 'theta': '세타', + 'vega': '베가', + 'rho': '로우' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', 'HTS이론가', '델타값', + '감마', '세타', '베가', '로우' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 민감도 추이(일별)[국내주식-176] + + ELW 민감도 추이(일별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_input_iscd (str): 입력종목코드 (ex)(58J438(KBJ438삼성전자풋)) + Returns: + - DataFrame: ELW 민감도 추이(일별) 결과 + + Example: + >>> df = sensitivity_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="58J438") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = sensitivity_trend_daily( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="58J438", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 민감도 추이(일별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/sensitivity_trend_daily.py b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/sensitivity_trend_daily.py new file mode 100644 index 0000000..8a9ae08 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/sensitivity_trend_daily/sensitivity_trend_daily.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(일별)[국내주식-176] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/sensitivity-trend-daily" + +def sensitivity_trend_daily( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 추이(일별)[국내주식-176] + ELW 민감도 추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 추이(일별) 데이터 + + Example: + >>> df = sensitivity_trend_daily("W", "58J438") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J438')") + raise ValueError("fid_input_iscd is required. (e.g. '58J438')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + tr_id = "FHPEW02830200" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/udrl_asset_list/chk_udrl_asset_list.py b/한국투자증권(API)/examples_llm/elw/udrl_asset_list/chk_udrl_asset_list.py new file mode 100644 index 0000000..d634b8b --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/udrl_asset_list/chk_udrl_asset_list.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from udrl_asset_list import udrl_asset_list + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산 목록조회[국내주식-185] +############################################################################################## + +COLUMN_MAPPING = { + 'unas_shrn_iscd': '기초자산단축종목코드', + 'unas_isnm': '기초자산종목명', + 'unas_prpr': '기초자산현재가', + 'unas_prdy_vrss': '기초자산전일대비', + 'unas_prdy_vrss_sign': '기초자산전일대비부호', + 'unas_prdy_ctrt': '기초자산전일대비율' +} + +NUMERIC_COLUMNS = [ + '기초자산현재가', '기초자산전일대비', '기초자산전일대비율' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 기초자산 목록조회[국내주식-185] + + ELW 기초자산 목록조회 테스트 함수 + + Parameters: + - fid_cond_scr_div_code (str): 조건화면분류코드 (11541(Primary key)) + - fid_rank_sort_cls_code (str): 순위정렬구분코드 (0(종목명순), 1(콜발행종목순), 2(풋발행종목순), 3(전일대비 상승율순), 4(전일대비 하락율순), 5(현재가 크기순), 6(종목코드순)) + - fid_input_iscd (str): 입력종목코드 (00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋)) + Returns: + - DataFrame: ELW 기초자산 목록조회 결과 + + Example: + >>> df = udrl_asset_list(fid_cond_scr_div_code="11541", fid_rank_sort_cls_code="0", fid_input_iscd="00000") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = udrl_asset_list( + fid_cond_scr_div_code="11541", # 조건화면분류코드 + fid_rank_sort_cls_code="0", # 순위정렬구분코드 + fid_input_iscd="00000", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 기초자산 목록조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/udrl_asset_list/udrl_asset_list.py b/한국투자증권(API)/examples_llm/elw/udrl_asset_list/udrl_asset_list.py new file mode 100644 index 0000000..63d4326 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/udrl_asset_list/udrl_asset_list.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-19 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산 목록조회[국내주식-185] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/udrl-asset-list" + +def udrl_asset_list( + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 기초자산 목록조회[국내주식-185] + ELW 기초자산 목록조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 조건화면분류코드, 예: '11541' + fid_rank_sort_cls_code (str): 순위정렬구분코드, 예: '0', '1', '2', '3', '4', '5', '6' + fid_input_iscd (str): 입력종목코드, 예: '00000', '00003', '00017', '00005' + tr_cont (str): 연속 거래 여부, 기본값은 공백 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 기초자산 목록조회 데이터 + + Example: + >>> df = udrl_asset_list('11541', '0', '00000') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11541')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11541')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKEW154100C0" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return udrl_asset_list( + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/udrl_asset_price/chk_udrl_asset_price.py b/한국투자증권(API)/examples_llm/elw/udrl_asset_price/chk_udrl_asset_price.py new file mode 100644 index 0000000..fc5fa31 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/udrl_asset_price/chk_udrl_asset_price.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from udrl_asset_price import udrl_asset_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산별 종목시세[국내주식-186] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_shrn_iscd': 'ELW단축종목코드', + 'hts_kor_isnm': 'HTS한글종목명', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'acpr': '행사가', + 'prls_qryr_stpr_prc': '손익분기주가가격', + 'hts_rmnn_dynu': 'HTS잔존일수', + 'hts_ints_vltl': 'HTS내재변동성', + 'stck_cnvr_rate': '주식전환비율', + 'lp_hvol': 'LP보유량', + 'lp_rlim': 'LP비중', + 'lvrg_val': '레버리지값', + 'gear': '기어링', + 'delta_val': '델타값', + 'gama': '감마', + 'vega': '베가', + 'theta': '세타', + 'prls_qryr_rate': '손익분기비율', + 'cfp': '자본지지점', + 'prit': '패리티', + 'invl_val': '내재가치값', + 'tmvl_val': '시간가치값', + 'hts_thpr': 'HTS이론가', + 'stck_lstn_date': '주식상장일자', + 'stck_last_tr_date': '주식최종거래일자', + 'lp_ntby_qty': 'LP순매도량' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '행사가', '손익분기주가가격', + 'HTS잔존일수', 'HTS내재변동성', '주식전환비율', 'LP보유량', 'LP비중', '레버리지값', + '기어링', '델타값', '감마', '베가', '세타', '손익분기비율', '자본지지점', '패리티', + '내재가치값', '시간가치값', 'HTS이론가', 'LP순매도량' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 기초자산별 종목시세[국내주식-186] + + ELW 기초자산별 종목시세 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분(W)) + - fid_cond_scr_div_code (str): 조건화면분류코드 (Uniquekey(11541)) + - fid_mrkt_cls_code (str): 시장구분코드 (전체(A),콜(C),풋(P)) + - fid_input_iscd (str): 입력종목코드 ('00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_unas_input_iscd (str): 기초자산입력종목코드 () + - fid_vol_cnt (str): 거래량수 (전일거래량(정수량미만)) + - fid_trgt_exls_cls_code (str): 대상제외구분코드 (거래불가종목제외(0:미체크,1:체크)) + - fid_input_price_1 (str): 입력가격1 (가격~원이상) + - fid_input_price_2 (str): 입력가격2 (가격~월이하) + - fid_input_vol_1 (str): 입력거래량1 (거래량~계약이상) + - fid_input_vol_2 (str): 입력거래량2 (거래량~계약이하) + - fid_input_rmnn_dynu_1 (str): 입력잔존일수1 (잔존일(~일이상)) + - fid_input_rmnn_dynu_2 (str): 입력잔존일수2 (잔존일(~일이하)) + - fid_option (str): 옵션 (옵션상태(0:없음,1:ATM,2:ITM,3:OTM)) + - fid_input_option_1 (str): 입력옵션1 () + - fid_input_option_2 (str): 입력옵션2 () + Returns: + - DataFrame: ELW 기초자산별 종목시세 결과 + + Example: + >>> df = udrl_asset_price(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11541", fid_mrkt_cls_code="A", fid_input_iscd="00000", fid_unas_input_iscd="005930", fid_vol_cnt="1000", fid_trgt_exls_cls_code="0", fid_input_price_1="1000", fid_input_price_2="5000", fid_input_vol_1="100", fid_input_vol_2="1000", fid_input_rmnn_dynu_1="30", fid_input_rmnn_dynu_2="90", fid_option="0", fid_input_option_1="", fid_input_option_2="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = udrl_asset_price( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="11541", # 조건화면분류코드 + fid_mrkt_cls_code="A", # 시장구분코드 + fid_input_iscd="00000", # 입력종목코드 + fid_unas_input_iscd="005930", # 기초자산입력종목코드 + fid_vol_cnt="", # 거래량수 + fid_trgt_exls_cls_code="0", # 대상제외구분코드 + fid_input_price_1="", # 입력가격1 + fid_input_price_2="", # 입력가격2 + fid_input_vol_1="", # 입력거래량1 + fid_input_vol_2="", # 입력거래량2 + fid_input_rmnn_dynu_1="", # 입력잔존일수1 + fid_input_rmnn_dynu_2="", # 입력잔존일수2 + fid_option="0", # 옵션 + fid_input_option_1="", # 입력옵션1 + fid_input_option_2="", # 입력옵션2 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 기초자산별 종목시세 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/udrl_asset_price/udrl_asset_price.py b/한국투자증권(API)/examples_llm/elw/udrl_asset_price/udrl_asset_price.py new file mode 100644 index 0000000..8b6199a --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/udrl_asset_price/udrl_asset_price.py @@ -0,0 +1,209 @@ +# [국내주식] ELW시세 - ELW 기초자산별 종목시세 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산별 종목시세[국내주식-186] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/udrl-asset-price" + +def udrl_asset_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_input_iscd: str, # 입력종목코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_vol_cnt: str, # 거래량수 + fid_trgt_exls_cls_code: str, # 대상제외구분코드 + fid_input_price_1: str, # 입력가격1 + fid_input_price_2: str, # 입력가격2 + fid_input_vol_1: str, # 입력거래량1 + fid_input_vol_2: str, # 입력거래량2 + fid_input_rmnn_dynu_1: str, # 입력잔존일수1 + fid_input_rmnn_dynu_2: str, # 입력잔존일수2 + fid_option: str, # 옵션 + fid_input_option_1: str, # 입력옵션1 + fid_input_option_2: str, # 입력옵션2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 기초자산별 종목시세[국내주식-186] + ELW 기초자산별 종목시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분(W) + fid_cond_scr_div_code (str): Uniquekey(11541) + fid_mrkt_cls_code (str): 전체(A),콜(C),풋(P) + fid_input_iscd (str): '00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)' + fid_unas_input_iscd (str): 기초자산입력종목코드 + fid_vol_cnt (str): 전일거래량(정수량미만) + fid_trgt_exls_cls_code (str): 거래불가종목제외(0:미체크,1:체크) + fid_input_price_1 (str): 가격~원이상 + fid_input_price_2 (str): 가격~월이하 + fid_input_vol_1 (str): 거래량~계약이상 + fid_input_vol_2 (str): 거래량~계약이하 + fid_input_rmnn_dynu_1 (str): 잔존일(~일이상) + fid_input_rmnn_dynu_2 (str): 잔존일(~일이하) + fid_option (str): 옵션상태(0:없음,1:ATM,2:ITM,3:OTM) + fid_input_option_1 (str): 입력옵션1 + fid_input_option_2 (str): 입력옵션2 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 기초자산별 종목시세 데이터 + + Example: + >>> df = udrl_asset_price( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11541', + ... fid_mrkt_cls_code='A', + ... fid_input_iscd='00000', + ... fid_unas_input_iscd='005930', + ... fid_vol_cnt='1000', + ... fid_trgt_exls_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='500', + ... fid_input_rmnn_dynu_1='10', + ... fid_input_rmnn_dynu_2='20', + ... fid_option='0', + ... fid_input_option_1='', + ... fid_input_option_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11541')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11541')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '00001')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '00001')") + + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + if not fid_option: + logger.error("fid_option is required. (e.g. '0')") + raise ValueError("fid_option is required. (e.g. '0')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKEW154101C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_RMNN_DYNU_2": fid_input_rmnn_dynu_2, + "FID_OPTION": fid_option, + "FID_INPUT_OPTION_1": fid_input_option_1, + "FID_INPUT_OPTION_2": fid_input_option_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return udrl_asset_price( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_input_iscd, + fid_unas_input_iscd, + fid_vol_cnt, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_rmnn_dynu_1, + fid_input_rmnn_dynu_2, + fid_option, + fid_input_option_1, + fid_input_option_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/updown_rate/chk_updown_rate.py b/한국투자증권(API)/examples_llm/elw/updown_rate/chk_updown_rate.py new file mode 100644 index 0000000..08c8dbb --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/updown_rate/chk_updown_rate.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from updown_rate import updown_rate + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 상승률순위[국내주식-167] +############################################################################################## + +COLUMN_MAPPING = { + 'hts_kor_isnm': 'HTS한글종목명', + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'acml_vol': '누적거래량', + 'stck_sdpr': '주식기준가', + 'sdpr_vrss_prpr_sign': '기준가대비현재가부호', + 'sdpr_vrss_prpr': '기준가대비현재가', + 'sdpr_vrss_prpr_rate': '기준가대비현재가비율', + 'stck_oprc': '주식시가2', + 'oprc_vrss_prpr_sign': '시가2대비현재가부호', + 'oprc_vrss_prpr': '시가2대비현재가', + 'oprc_vrss_prpr_rate': '시가2대비현재가비율', + 'stck_hgpr': '주식최고가', + 'stck_lwpr': '주식최저가', + 'prd_rsfl_sign': '기간등락부호', + 'prd_rsfl': '기간등락', + 'prd_rsfl_rate': '기간등락비율', + 'stck_cnvr_rate': '주식전환비율', + 'hts_rmnn_dynu': 'HTS잔존일수', + 'acpr': '행사가', + 'unas_isnm': '기초자산명', + 'unas_shrn_iscd': '기초자산코드', + 'lp_hldn_rate': 'LP보유비율', + 'prit': '패리티', + 'prls_qryr_stpr_prc': '손익분기주가가격', + 'delta_val': '델타값', + 'theta': '세타', + 'prls_qryr_rate': '손익분기비율', + 'stck_lstn_date': '주식상장일자', + 'stck_last_tr_date': '주식최종거래일자', + 'hts_ints_vltl': 'HTS내재변동성', + 'lvrg_val': '레버리지값' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '누적거래량', '주식기준가', '기준가대비현재가', '기준가대비현재가비율', + '주식시가2', '시가2대비현재가', '시가2대비현재가비율', '주식최고가', '주식최저가', '기간등락', '기간등락비율', + '주식전환비율', 'HTS잔존일수', '행사가', 'LP보유비율', '패리티', '손익분기주가가격', '델타값', '세타', '손익분기비율', + 'HTS내재변동성', '레버리지값' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 상승률순위[국내주식-167] + + ELW 상승률순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 사용자권한정보 (시장구분코드 (W)) + - fid_cond_scr_div_code (str): 거래소코드 (Unique key(20277)) + - fid_unas_input_iscd (str): 상승율/하락율 구분 ('000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ') + - fid_input_iscd (str): N일자값 ('00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_input_rmnn_dynu_1 (str): 거래량조건 ('0(전체), 1(1개월이하), 2(1개월~2개월), 3(2개월~3개월), 4(3개월~6개월), 5(6개월~9개월),6(9개월~12개월), 7(12개월이상)') + - fid_div_cls_code (str): NEXT KEY BUFF (0(전체), 1(콜), 2(풋)) + - fid_input_price_1 (str): 사용자권한정보 () + - fid_input_price_2 (str): 거래소코드 () + - fid_input_vol_1 (str): 상승율/하락율 구분 () + - fid_input_vol_2 (str): N일자값 () + - fid_input_date_1 (str): 거래량조건 () + - fid_rank_sort_cls_code (str): NEXT KEY BUFF ('0(상승율), 1(하락율), 2(시가대비상승율) , 3(시가대비하락율), 4(변동율)') + - fid_blng_cls_code (str): 사용자권한정보 (0(전체)) + - fid_input_date_2 (str): 거래소코드 () + Returns: + - DataFrame: ELW 상승률순위 결과 + + Example: + >>> df = updown_rate(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20277", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_input_rmnn_dynu_1="0", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_input_date_1="", fid_rank_sort_cls_code="0", fid_blng_cls_code="0", fid_input_date_2="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = updown_rate( + fid_cond_mrkt_div_code="W", # 사용자권한정보 + fid_cond_scr_div_code="20277", # 거래소코드 + fid_unas_input_iscd="000000", # 상승율/하락율 구분 + fid_input_iscd="00000", # N일자값 + fid_input_rmnn_dynu_1="0", # 거래량조건 + fid_div_cls_code="0", # NEXT KEY BUFF + fid_input_price_1="", # 사용자권한정보 + fid_input_price_2="", # 거래소코드 + fid_input_vol_1="", # 상승율/하락율 구분 + fid_input_vol_2="", # N일자값 + fid_input_date_1="1", # 거래량조건 + fid_rank_sort_cls_code="0", # NEXT KEY BUFF + fid_blng_cls_code="0", # 사용자권한정보 + fid_input_date_2="", # 거래소코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 상승률순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/updown_rate/updown_rate.py b/한국투자증권(API)/examples_llm/elw/updown_rate/updown_rate.py new file mode 100644 index 0000000..735af6e --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/updown_rate/updown_rate.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 상승률순위[국내주식-167] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/ranking/updown-rate" + +def updown_rate( + fid_cond_mrkt_div_code: str, # 사용자권한정보 + fid_cond_scr_div_code: str, # 거래소코드 + fid_unas_input_iscd: str, # 상승율/하락율 구분 + fid_input_iscd: str, # N일자값 + fid_input_rmnn_dynu_1: str, # 거래량조건 + fid_div_cls_code: str, # NEXT KEY BUFF + fid_input_price_1: str, # 사용자권한정보 + fid_input_price_2: str, # 거래소코드 + fid_input_vol_1: str, # 상승율/하락율 구분 + fid_input_vol_2: str, # N일자값 + fid_input_date_1: str, # 거래량조건 + fid_rank_sort_cls_code: str, # NEXT KEY BUFF + fid_blng_cls_code: str, # 사용자권한정보 + fid_input_date_2: str, # 거래소코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 상승률순위[국내주식-167] + ELW 상승률순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_cond_scr_div_code (str): Unique key(20277) + fid_unas_input_iscd (str): '000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ' + fid_input_iscd (str): '00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)' + fid_input_rmnn_dynu_1 (str): '0(전체), 1(1개월이하), 2(1개월~2개월), 3(2개월~3개월), 4(3개월~6개월), 5(6개월~9개월),6(9개월~12개월), 7(12개월이상)' + fid_div_cls_code (str): 0(전체), 1(콜), 2(풋) + fid_input_price_1 (str): + fid_input_price_2 (str): + fid_input_vol_1 (str): + fid_input_vol_2 (str): + fid_input_date_1 (str): + fid_rank_sort_cls_code (str): '0(상승율), 1(하락율), 2(시가대비상승율) , 3(시가대비하락율), 4(변동율)' + fid_blng_cls_code (str): 0(전체) + fid_input_date_2 (str): + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 상승률순위 데이터 + + Example: + >>> df = updown_rate( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20277', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_input_rmnn_dynu_1='0', + ... fid_div_cls_code='0', + ... fid_input_price_1='', + ... fid_input_price_2='', + ... fid_input_vol_1='', + ... fid_input_vol_2='', + ... fid_input_date_1='1', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0', + ... fid_input_date_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20277')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20277')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_input_rmnn_dynu_1: + logger.error("fid_input_rmnn_dynu_1 is required. (e.g. '0')") + raise ValueError("fid_input_rmnn_dynu_1 is required. (e.g. '0')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02770000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return updown_rate( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_input_rmnn_dynu_1, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_date_1, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/chk_volatility_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/chk_volatility_trend_ccnl.py new file mode 100644 index 0000000..71b410d --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/chk_volatility_trend_ccnl.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volatility_trend_ccnl import volatility_trend_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(체결)[국내주식-177] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_cntg_hour': '주식체결시간', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'bidp': '매수호가', + 'askp': '매도호가', + 'acml_vol': '누적거래량', + 'hts_ints_vltl': 'HTS내재변동성' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '매수호가', '매도호가', '누적거래량', 'HTS내재변동성' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 변동성추이(체결)[국내주식-177] + + ELW 변동성추이(체결) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (W(Unique key)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + Returns: + - DataFrame: ELW 변동성추이(체결) 결과 + + Example: + >>> df = volatility_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = volatility_trend_ccnl( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 변동성추이(체결) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/volatility_trend_ccnl.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/volatility_trend_ccnl.py new file mode 100644 index 0000000..c83157e --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_ccnl/volatility_trend_ccnl.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(체결)[국내주식-177] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/volatility-trend-ccnl" + +def volatility_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성추이(체결)[국내주식-177] + ELW 변동성추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성추이(체결) 데이터 + + Example: + >>> df = volatility_trend_ccnl("W", "58J297") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + url = API_URL + tr_id = "FHPEW02840100" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/chk_volatility_trend_daily.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/chk_volatility_trend_daily.py new file mode 100644 index 0000000..6951aec --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/chk_volatility_trend_daily.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volatility_trend_daily import volatility_trend_daily + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성 추이(일별)[국내주식-178] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'elw_prpr': 'ELW 현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'elw_oprc': 'elw 시가2', + 'elw_hgpr': 'elw 최고가', + 'elw_lwpr': 'elw 최저가', + 'acml_vol': '누적 거래량', + 'd10_hist_vltl': '10일 역사적 변동성', + 'd20_hist_vltl': '20일 역사적 변동성', + 'd30_hist_vltl': '30일 역사적 변동성', + 'd60_hist_vltl': '60일 역사적 변동성', + 'd90_hist_vltl': '90일 역사적 변동성', + 'hts_ints_vltl': 'HTS 내재 변동성' +} + +NUMERIC_COLUMNS = [ + 'ELW 현재가', '전일대비', '전일대비율', 'elw 시가2', 'elw 최고가', 'elw 최저가', '누적 거래량', + '10일 역사적 변동성', '20일 역사적 변동성', '30일 역사적 변동성', '60일 역사적 변동성', + '90일 역사적 변동성', 'HTS 내재 변동성' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 변동성 추이(일별)[국내주식-178] + + ELW 변동성 추이(일별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (시장구분코드 (W)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + Returns: + - DataFrame: ELW 변동성 추이(일별) 결과 + + Example: + >>> df = volatility_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = volatility_trend_daily( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="58J297", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 변동성 추이(일별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/volatility_trend_daily.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/volatility_trend_daily.py new file mode 100644 index 0000000..a615d49 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_daily/volatility_trend_daily.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(일별)[국내주식-178] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/volatility-trend-daily" + +def volatility_trend_daily( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(일별)[국내주식-178] + ELW 변동성 추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(일별) 데이터 + + Example: + >>> df = volatility_trend_daily('W', '58J297') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPEW02840200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/chk_volatility_trend_minute.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/chk_volatility_trend_minute.py new file mode 100644 index 0000000..a3959b8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/chk_volatility_trend_minute.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volatility_trend_minute import volatility_trend_minute + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성 추이(분별)[국내주식-179] +############################################################################################## + +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'stck_prpr': '주식 현재가', + 'elw_oprc': 'ELW 시가2', + 'elw_hgpr': 'ELW 최고가', + 'elw_lwpr': 'ELW 최저가', + 'hts_ints_vltl': 'HTS 내재 변동성', + 'hist_vltl': '역사적 변동성' +} + +NUMERIC_COLUMNS = [ + '주식 현재가', 'ELW 시가2', 'ELW 최고가', 'ELW 최저가', 'HTS 내재 변동성', '역사적 변동성' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 변동성 추이(분별)[국내주식-179] + + ELW 변동성 추이(분별) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (W(Unique key)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + - fid_hour_cls_code (str): 시간구분코드 ('60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분) ') + - fid_pw_data_incu_yn (str): 과거데이터 포함 여부 (N(과거데이터포함X),Y(과거데이터포함O)) + Returns: + - DataFrame: ELW 변동성 추이(분별) 결과 + + Example: + >>> df = volatility_trend_minute(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297", fid_hour_cls_code="60", fid_pw_data_incu_yn="N") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = volatility_trend_minute( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + fid_hour_cls_code="60", # 시간구분코드 + fid_pw_data_incu_yn="N", # 과거데이터 포함 여부 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 변동성 추이(분별) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/volatility_trend_minute.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/volatility_trend_minute.py new file mode 100644 index 0000000..d2ee06c --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_minute/volatility_trend_minute.py @@ -0,0 +1,142 @@ +# [국내주식] ELW시세 - ELW 변동성 추이(분별) +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(분별)[국내주식-179] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/volatility-trend-minute" + +def volatility_trend_minute( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_hour_cls_code: str, # 시간구분코드 + fid_pw_data_incu_yn: str, # 과거데이터 포함 여부 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(분별)[국내주식-179] + ELW 변동성 추이(분별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + fid_hour_cls_code (str): 시간구분코드 (예: '60', '180', '300', '600', '1800', '3600') + fid_pw_data_incu_yn (str): 과거데이터 포함 여부 ('N' 또는 'Y') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(분별) 데이터 + + Example: + >>> df = volatility_trend_minute( + ... fid_cond_mrkt_div_code='W', + ... fid_input_iscd='58J297', + ... fid_hour_cls_code='60', + ... fid_pw_data_incu_yn='N' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '60')") + raise ValueError("fid_hour_cls_code is required. (e.g. '60')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'N')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + url = API_URL + tr_id = "FHPEW02840300" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + # API 호출 + res = ka._url_fetch(url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_minute( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/chk_volatility_trend_tick.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/chk_volatility_trend_tick.py new file mode 100644 index 0000000..ccf78d7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/chk_volatility_trend_tick.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volatility_trend_tick import volatility_trend_tick + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성 추이(틱)[국내주식-180] +############################################################################################## + +COLUMN_MAPPING = { + 'bsop_date': '주식영업일자', + 'stck_cntg_hour': 'ELW현재가', + 'elw_prpr': '전일대비', + 'hts_ints_vltl': '전일대비부호' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 변동성 추이(틱)[국내주식-180] + + ELW 변동성 추이(틱) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (W(Unique key)) + - fid_input_iscd (str): 입력종목코드 (ex) 58J297(KBJ297삼성전자콜)) + Returns: + - DataFrame: ELW 변동성 추이(틱) 결과 + + Example: + >>> df = volatility_trend_tick(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = volatility_trend_tick( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_input_iscd="57LA50", # 입력종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 변동성 추이(틱) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/volatility_trend_tick.py b/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/volatility_trend_tick.py new file mode 100644 index 0000000..889da34 --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volatility_trend_tick/volatility_trend_tick.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(틱)[국내주식-180] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/quotations/volatility-trend-tick" + +def volatility_trend_tick( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(틱)[국내주식-180] + ELW 변동성 추이(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(틱) 데이터 + + Example: + >>> df = volatility_trend_tick('W', '58J297') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + url = API_URL + tr_id = "FHPEW02840400" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_tick( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/elw/volume_rank/chk_volume_rank.py b/한국투자증권(API)/examples_llm/elw/volume_rank/chk_volume_rank.py new file mode 100644 index 0000000..cfa0c1c --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volume_rank/chk_volume_rank.py @@ -0,0 +1,162 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from volume_rank import volume_rank + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 거래량순위[국내주식-168] +############################################################################################## + +COLUMN_MAPPING = { + 'elw_kor_isnm': 'ELW한글종목명', + 'elw_shrn_iscd': 'ELW단축종목코드', + 'elw_prpr': 'ELW현재가', + 'prdy_vrss': '전일대비', + 'prdy_vrss_sign': '전일대비부호', + 'prdy_ctrt': '전일대비율', + 'lstn_stcn': '상장주수', + 'acml_vol': '누적거래량', + 'n_prdy_vol': 'N전일거래량', + 'n_prdy_vol_vrss': 'N전일거래량대비', + 'vol_inrt': '거래량증가율', + 'vol_tnrt': '거래량회전율', + 'nday_vol_tnrt': 'N일거래량회전율', + 'acml_tr_pbmn': '누적거래대금', + 'n_prdy_tr_pbmn': 'N전일거래대금', + 'n_prdy_tr_pbmn_vrss': 'N전일거래대금대비', + 'total_askp_rsqn': '총매도호가잔량', + 'total_bidp_rsqn': '총매수호가잔량', + 'ntsl_rsqn': '순매도잔량', + 'ntby_rsqn': '순매수잔량', + 'seln_rsqn_rate': '매도잔량비율', + 'shnu_rsqn_rate': '매수2잔량비율', + 'stck_cnvr_rate': '주식전환비율', + 'hts_rmnn_dynu': 'HTS잔존일수', + 'invl_val': '내재가치값', + 'tmvl_val': '시간가치값', + 'acpr': '행사가', + 'unas_isnm': '기초자산명', + 'stck_last_tr_date': '최종거래일', + 'unas_shrn_iscd': '기초자산코드', + 'prdy_vol': '전일거래량', + 'lp_hldn_rate': 'LP보유비율', + 'prit': '패리티', + 'prls_qryr_stpr_prc': '손익분기주가가격', + 'delta_val': '델타값', + 'theta': '세타', + 'prls_qryr_rate': '손익분기비율', + 'stck_lstn_date': '주식상장일자', + 'hts_ints_vltl': 'HTS내재변동성', + 'lvrg_val': '레버리지값', + 'lp_ntby_qty': 'LP순매도량' +} + +NUMERIC_COLUMNS = [ + 'ELW현재가', '전일대비', '전일대비율', '상장주수', '누적거래량', 'N전일거래량', 'N전일거래량대비', + '거래량증가율', '거래량회전율', 'N일거래량회전율', '누적거래대금', 'N전일거래대금', 'N전일거래대금대비', + '총매도호가잔량', '총매수호가잔량', '순매도잔량', '순매수잔량', '매도잔량비율', '매수2잔량비율', + '주식전환비율', 'HTS잔존일수', '내재가치값', '시간가치값', '행사가', '전일거래량', 'LP보유비율', + '패리티', '손익분기주가가격', '델타값', '세타', '손익분기비율', 'HTS내재변동성', '레버리지값', 'LP순매도량' +] + +def main(): + """ + [국내주식] ELW시세 + ELW 거래량순위[국내주식-168] + + ELW 거래량순위 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건시장분류코드 (W) + - fid_cond_scr_div_code (str): 조건화면분류코드 (20278) + - fid_unas_input_iscd (str): 기초자산입력종목코드 (000000) + - fid_input_iscd (str): 발행사 (00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)') + - fid_input_rmnn_dynu_1 (str): 입력잔존일수 () + - fid_div_cls_code (str): 콜풋구분코드 (0(전체), 1(콜), 2(풋)) + - fid_input_price_1 (str): 가격(이상) (거래가격1(이상)) + - fid_input_price_2 (str): 가격(이하) (거래가격1(이하)) + - fid_input_vol_1 (str): 거래량(이상) (거래량1(이상)) + - fid_input_vol_2 (str): 거래량(이하) (거래량1(이하)) + - fid_input_date_1 (str): 조회기준일 (입력날짜(기준가 조회기준)) + - fid_rank_sort_cls_code (str): 순위정렬구분코드 (0: 거래량순 1: 평균거래증가율 2: 평균거래회전율 3:거래금액순 4: 순매수잔량순 5: 순매도잔량순) + - fid_blng_cls_code (str): 소속구분코드 (0: 전체) + - fid_input_iscd_2 (str): LP발행사 (0000) + - fid_input_date_2 (str): 만기일-최종거래일조회 (공백) + Returns: + - DataFrame: ELW 거래량순위 결과 + + Example: + >>> df = volume_rank(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20278", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_input_rmnn_dynu_1="", fid_div_cls_code="0", fid_input_price_1="0", fid_input_price_2="100000", fid_input_vol_1="0", fid_input_vol_2="1000000", fid_input_date_1="20250101", fid_rank_sort_cls_code="0", fid_blng_cls_code="0", fid_input_iscd_2="0000", fid_input_date_2="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = volume_rank( + fid_cond_mrkt_div_code="W", # 조건시장분류코드 + fid_cond_scr_div_code="20278", # 조건화면분류코드 + fid_unas_input_iscd="000000", # 기초자산입력종목코드 + fid_input_iscd="00000", # 발행사 + fid_input_rmnn_dynu_1="0", # 입력잔존일수 + fid_div_cls_code="0", # 콜풋구분코드 + fid_input_price_1="", # 가격(이상) + fid_input_price_2="", # 가격(이하) + fid_input_vol_1="", # 거래량(이상) + fid_input_vol_2="", # 거래량(이하) + fid_input_date_1="", # 조회기준일 + fid_rank_sort_cls_code="0", # 순위정렬구분코드 + fid_blng_cls_code="0", # 소속구분코드 + fid_input_iscd_2="0000", # LP발행사 + fid_input_date_2="", # 만기일-최종거래일조회 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== ELW 거래량순위 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/elw/volume_rank/volume_rank.py b/한국투자증권(API)/examples_llm/elw/volume_rank/volume_rank.py new file mode 100644 index 0000000..460030f --- /dev/null +++ b/한국투자증권(API)/examples_llm/elw/volume_rank/volume_rank.py @@ -0,0 +1,203 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-18 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 거래량순위[국내주식-168] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/elw/v1/ranking/volume-rank" + +def volume_rank( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_input_rmnn_dynu_1: str, # 입력잔존일수 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_input_date_1: str, # 조회기준일 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 소속구분코드 + fid_input_iscd_2: str, # LP발행사 + fid_input_date_2: str, # 만기일-최종거래일조회 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 거래량순위[국내주식-168] + ELW 거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_cond_scr_div_code (str): 조건화면분류코드 (예: '20278') + fid_unas_input_iscd (str): 기초자산입력종목코드 (예: '000000') + fid_input_iscd (str): 발행사 (예: '00000') + fid_input_rmnn_dynu_1 (str): 입력잔존일수 + fid_div_cls_code (str): 콜풋구분코드 (예: '0') + fid_input_price_1 (str): 가격(이상) + fid_input_price_2 (str): 가격(이하) + fid_input_vol_1 (str): 거래량(이상) + fid_input_vol_2 (str): 거래량(이하) + fid_input_date_1 (str): 조회기준일 + fid_rank_sort_cls_code (str): 순위정렬구분코드 (예: '0') + fid_blng_cls_code (str): 소속구분코드 (예: '0') + fid_input_iscd_2 (str): LP발행사 (예: '0000') + fid_input_date_2 (str): 만기일-최종거래일조회 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 거래량순위 데이터 + + Example: + >>> df = volume_rank( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20278', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_input_rmnn_dynu_1='', + ... fid_div_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='1000', + ... fid_input_date_1='20230101', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0', + ... fid_input_iscd_2='0000', + ... fid_input_date_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20278')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20278')") + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '0000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + url = API_URL + tr_id = "FHPEW02780000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volume_rank( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_input_rmnn_dynu_1, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_date_1, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_input_iscd_2, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/chk_etf_nav_trend.py b/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/chk_etf_nav_trend.py new file mode 100644 index 0000000..57665db --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/chk_etf_nav_trend.py @@ -0,0 +1,84 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from etf_nav_trend import etf_nav_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내ETF NAV추이[실시간-051] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "rt_cd": "성공 실패 여부", + "msg_cd": "응답코드", + "mksc_shrn_iscd": "유가증권단축종목코드", + "nav": "NAV", + "nav_prdy_vrss_sign": "NAV전일대비부호", + "nav_prdy_vrss": "NAV전일대비", + "nav_prdy_ctrt": "NAV전일대비율", + "oprc_nav": "NAV시가", + "hprc_nav": "NAV고가", + "lprc_nav": "NAV저가" +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ["NAV", "NAV전일대비", "NAV전일대비율", "NAV시가", "NAV고가", "NAV저가"] + +def main(): + """ + 국내ETF NAV추이 + + [참고자료] +종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=etf_nav_trend, data=["069500"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + try: + # 한글 컬럼명으로 변환 + result.rename(columns=COLUMN_MAPPING, inplace=True) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("API 호출") + print(result) + except Exception as e: + logging.error(f"결과 처리 중 오류: {e}") + logging.error(f"받은 데이터: {result}") + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/etf_nav_trend.py b/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/etf_nav_trend.py new file mode 100644 index 0000000..8401eeb --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/etf_nav_trend/etf_nav_trend.py @@ -0,0 +1,75 @@ +""" +Created on 2025-07-09 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내ETF NAV추이[실시간-051] +############################################################################################## + +def etf_nav_trend( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내ETF NAV추이[H0STNAV0] 실시간 데이터 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 실시간으로 국내 ETF의 NAV 추이를 구독합니다. + 구독을 시작하거나 해제할 수 있으며, 실시간 데이터를 수신합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 수신된 메시지 데이터 + columns (list[str]): 수신된 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = etf_nav_trend("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STNAV0" + + params = { + "tr_key": tr_key, + } + + # 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 컬럼 정보 + columns = [ + "rt_cd", # 성공 실패 여부 + "msg_cd", # 응답코드 + "output1", # 응답상세 + "msg1", # 응답메세지 + "mksc_shrn_iscd", # 유가증권단축종목코드 + "nav", # NAV + "nav_prdy_vrss_sign", # NAV전일대비부호 + "nav_prdy_vrss", # NAV전일대비 + "nav_prdy_ctrt", # NAV전일대비율 + "oprc_nav", # NAV시가 + "hprc_nav", # NAV고가 + "lprc_nav", # NAV저가 + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/chk_inquire_component_stock_price.py b/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/chk_inquire_component_stock_price.py new file mode 100644 index 0000000..79c1161 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/chk_inquire_component_stock_price.py @@ -0,0 +1,116 @@ +""" +Created on 20250114 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_component_stock_price import inquire_component_stock_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > ETF 구성종목시세[국내주식-073] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'stck_prpr': '매매 일자', + 'prdy_vrss': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비', + 'etf_cnfg_issu_avls': '전일 대비율', + 'nav': '누적 거래량', + 'nav_prdy_vrss_sign': '결제 일자', + 'nav_prdy_vrss': '전체 융자 신규 주수', + 'nav_prdy_ctrt': '전체 융자 상환 주수', + 'etf_ntas_ttam': '전체 융자 잔고 주수', + 'prdy_clpr_nav': '전체 융자 신규 금액', + 'oprc_nav': '전체 융자 상환 금액', + 'hprc_nav': '전체 융자 잔고 금액', + 'lprc_nav': '전체 융자 잔고 비율', + 'etf_cu_unit_scrt_cnt': '전체 융자 공여율', + 'etf_cnfg_issu_cnt': '전체 대주 신규 주수', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'tday_rsfl_rate': '당일 등락 비율', + 'prdy_vrss_vol': '전일 대비 거래량', + 'tr_pbmn_tnrt': '거래대금회전율', + 'hts_avls': 'HTS 시가총액', + 'etf_vltn_amt': 'ETF구성종목내평가금액', + 'etf_cnfg_issu_rlim': 'ETF구성종목비중' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['주식 현재가', '전일 대비', '전일 대비율', '누적 거래량', '전체 융자 신규 주수', + '전체 융자 상환 주수', '전체 융자 잔고 주수', '전체 융자 신규 금액', '전체 융자 상환 금액', + '전체 융자 잔고 금액', '전체 융자 잔고 비율', '전체 융자 공여율', '전체 대주 신규 주수', + '누적 거래 대금', '당일 등락 비율', '전일 대비 거래량', '거래대금회전율', 'HTS 시가총액', + 'ETF구성종목시가총액', 'ETF구성종목비중', 'ETF구성종목내평가금액'] + +def main(): + """ + ETF 구성종목시세 조회 테스트 함수 + + 이 함수는 ETF 구성종목시세 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 KODEX 200 ETF(069500)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = inquire_component_stock_price(fid_cond_mrkt_div_code="J", fid_input_iscd="069500", fid_cond_scr_div_code="11216") + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 조회 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 조회 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/inquire_component_stock_price.py b/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/inquire_component_stock_price.py new file mode 100644 index 0000000..4147b62 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/inquire_component_stock_price/inquire_component_stock_price.py @@ -0,0 +1,85 @@ +""" +Created on 20250114 +""" + +import logging +import sys +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +# 상수 정의 +API_URL = "/uapi/etfetn/v1/quotations/inquire-component-stock-price" + +############################################################################################## +# [국내주식] 기본시세 > ETF 구성종목시세[국내주식-073] +############################################################################################## + +def inquire_component_stock_price( + fid_cond_mrkt_div_code: str, + fid_input_iscd: str, + fid_cond_scr_div_code: str +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + ETF 구성종목시세 API입니다. + 한국투자 HTS(eFriend Plus) > [0245] ETF/ETN 구성종목시세 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J: 주식/ETF/ETN) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11216) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Examples: + >>> df1, df2 = inquire_component_stock_price("J", "069500", "11216") + >>> print(df1) # ETF 기본 정보 + >>> print(df2) # ETF 구성종목 상세정보 + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J: 주식/ETF/ETN')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11216')") + + # API 호출 설정 + tr_id = "FHKST121600C0" + + # 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame 변환 + output1_data = res.getBody().output1 + df1 = pd.DataFrame([output1_data]) if output1_data else pd.DataFrame() + + # output2 (array) -> DataFrame 변환 + output2_data = res.getBody().output2 + df2 = pd.DataFrame(output2_data) if output2_data else pd.DataFrame() + + return df1, df2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/inquire_price/chk_inquire_price.py b/한국투자증권(API)/examples_llm/etfetn/inquire_price/chk_inquire_price.py new file mode 100644 index 0000000..83a3ddb --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/inquire_price/chk_inquire_price.py @@ -0,0 +1,128 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_price import inquire_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > ETF/ETN 현재가[v1_국내주식-068] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'stck_prpr': '주식 현재가', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_vrss': '전일 대비', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'prdy_vol': '전일 거래량', + 'stck_mxpr': '주식 상한가', + 'stck_llam': '주식 하한가', + 'stck_prdy_clpr': '주식 전일 종가', + 'stck_oprc': '주식 시가2', + 'prdy_clpr_vrss_oprc_rate': '전일 종가 대비 시가2 비율', + 'stck_hgpr': '주식 최고가', + 'prdy_clpr_vrss_hgpr_rate': '전일 종가 대비 최고가 비율', + 'stck_lwpr': '주식 최저가', + 'prdy_clpr_vrss_lwpr_rate': '전일 종가 대비 최저가 비율', + 'prdy_last_nav': '전일 최종 NAV', + 'nav': 'NAV', + 'nav_prdy_vrss': 'NAV 전일 대비', + 'nav_prdy_vrss_sign': 'NAV 전일 대비 부호', + 'nav_prdy_ctrt': 'NAV 전일 대비율', + 'trc_errt': '추적 오차율', + 'stck_sdpr': '주식 기준가', + 'stck_sspr': '주식 대용가', + 'nmix_ctrt': '지수 대비율', + 'etf_crcl_stcn': 'ETF 유통 주수', + 'etf_ntas_ttam': 'ETF 순자산 총액', + 'etf_frcr_ntas_ttam': 'ETF 외화 순자산 총액', + 'frgn_limt_rate': '외국인 한도 비율', + 'frgn_oder_able_qty': '외국인 주문 가능 수량', + 'etf_cu_unit_scrt_cnt': 'ETF CU 단위 증권 수', + 'etf_cnfg_issu_cnt': 'ETF 구성 종목 수', + 'etf_dvdn_cycl': 'ETF 배당 주기', + 'crcd': '통화 코드', + 'etf_crcl_ntas_ttam': 'ETF 유통 순자산 총액', + 'etf_frcr_crcl_ntas_ttam': 'ETF 외화 유통 순자산 총액', + 'etf_frcr_last_ntas_wrth_val': 'ETF 외화 최종 순자산 가치 값', + 'lp_oder_able_cls_code': 'LP 주문 가능 구분 코드', + 'stck_dryy_hgpr': '주식 연중 최고가', + 'dryy_hgpr_vrss_prpr_rate': '연중 최고가 대비 현재가 비율', + 'dryy_hgpr_date': '연중 최고가 일자', + 'stck_dryy_lwpr': '주식 연중 최저가', + 'dryy_lwpr_vrss_prpr_rate': '연중 최저가 대비 현재가 비율', + 'dryy_lwpr_date': '연중 최저가 일자', + 'bstp_kor_isnm': '업종 한글 종목명', + 'vi_cls_code': 'VI적용구분코드', + 'lstn_stcn': '상장 주수', + 'frgn_hldn_qty': '외국인 보유 수량', + 'frgn_hldn_qty_rate': '외국인 보유 수량 비율', + 'etf_trc_ert_mltp': 'ETF 추적 수익률 배수', + 'dprt': '괴리율', + 'mbcr_name': '회원사 명', + 'stck_lstn_date': '주식 상장 일자', + 'mtrt_date': '만기 일자', + 'shrg_type_code': '분배금형태코드', + 'lp_hldn_rate': 'LP 보유 비율', + 'etf_trgt_nmix_bstp_code': 'ETF대상지수업종코드', + 'etf_div_name': 'ETF 분류 명', + 'etf_rprs_bstp_kor_isnm': 'ETF 대표 업종 한글 종목명', + 'lp_hldn_vol': 'ETN LP 보유량' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + ETF/ETN 현재가 조회 테스트 함수 + + 이 함수는 ETF/ETN 현재가 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 삼성전자(005930)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("API 호출") + try: + result = inquire_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/inquire_price/inquire_price.py b/한국투자증권(API)/examples_llm/etfetn/inquire_price/inquire_price.py new file mode 100644 index 0000000..1da428b --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/inquire_price/inquire_price.py @@ -0,0 +1,64 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > ETF/ETN 현재가[v1_국내주식-068] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/etfetn/v1/quotations/inquire-price" + +def inquire_price( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 +) -> pd.DataFrame: + """ + ETF/ETN 현재가 API입니다. + 한국투자 HTS(eFriend Plus) > [0240] ETF/ETN 현재가 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: ETF/ETN 현재가 데이터 + + Example: + >>> df = inquire_price("J", "123456") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST02400000" # ETF/ETN 현재가 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/chk_nav_comparison_daily_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/chk_nav_comparison_daily_trend.py new file mode 100644 index 0000000..014c365 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/chk_nav_comparison_daily_trend.py @@ -0,0 +1,82 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from nav_comparison_daily_trend import nav_comparison_daily_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(일)[v1_국내주식-071] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'stck_bsop_date': '주식 영업 일자', + 'stck_clpr': '주식 종가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'cntg_vol': '체결 거래량', + 'dprt': '괴리율', + 'nav_vrss_prpr': 'NAV 대비 현재가', + 'nav': 'NAV', + 'nav_prdy_vrss_sign': 'NAV 전일 대비 부호', + 'nav_prdy_vrss': 'NAV 전일 대비', + 'nav_prdy_ctrt': 'NAV 전일 대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['전일 대비', '전일 대비율', 'NAV 전일 대비율'] + +def main(): + """ + NAV 비교추이(일) 조회 테스트 함수 + + 이 함수는 NAV 비교추이(일) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 KODEX 200 ETF(069500)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("API 호출") + try: + result = nav_comparison_daily_trend(fid_cond_mrkt_div_code="J", fid_input_iscd="069500", fid_input_date_1="20240101", fid_input_date_2="20240220") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/nav_comparison_daily_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/nav_comparison_daily_trend.py new file mode 100644 index 0000000..f431c1b --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_daily_trend/nav_comparison_daily_trend.py @@ -0,0 +1,79 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(일)[v1_국내주식-071] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/etfetn/v1/quotations/nav-comparison-daily-trend" + +def nav_comparison_daily_trend( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_input_date_1: str, # 조회시작일자 + fid_input_date_2: str # 조회종료일자 +) -> pd.DataFrame: + """ + NAV 비교추이(일) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면 "일별" 비교추이 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_input_date_1 (str): [필수] 조회시작일자 (ex. 20240101) + fid_input_date_2 (str): [필수] 조회종료일자 (ex. 20240220) + + Returns: + pd.DataFrame: NAV 비교추이(일) 데이터 + + Example: + >>> df = nav_comparison_daily_trend("J", "069500", "20240101", "20240220") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20240101')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20240220')") + + tr_id = "FHPST02440200" # NAV 비교추이(일) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건시장분류코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력종목코드 + "FID_INPUT_DATE_1": fid_input_date_1, # 조회시작일자 + "FID_INPUT_DATE_2": fid_input_date_2 # 조회종료일자 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/chk_nav_comparison_time_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/chk_nav_comparison_time_trend.py new file mode 100644 index 0000000..6052984 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/chk_nav_comparison_time_trend.py @@ -0,0 +1,81 @@ +""" +Created on 20250115 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from nav_comparison_time_trend import nav_comparison_time_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(분)[v1_국내주식-070] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'bsop_hour': '영업 시간', + 'nav': 'NAV', + 'nav_prdy_vrss_sign': 'NAV 전일 대비 부호', + 'nav_prdy_vrss': 'NAV 전일 대비', + 'nav_prdy_ctrt': 'NAV 전일 대비율', + 'nav_vrss_prpr': 'NAV 대비 현재가', + 'dprt': '괴리율', + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'cntg_vol': '체결 거래량' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['NAV 전일 대비', 'NAV 전일 대비율', '전일 대비', '전일 대비율'] + +def main(): + """ + NAV 비교추이(분) 조회 테스트 함수 + + 이 함수는 NAV 비교추이(분) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("API 호출") + try: + result = nav_comparison_time_trend(fid_cond_mrkt_div_code="E", fid_input_iscd="069500", fid_hour_cls_code="60") + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/nav_comparison_time_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/nav_comparison_time_trend.py new file mode 100644 index 0000000..6703f03 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_time_trend/nav_comparison_time_trend.py @@ -0,0 +1,73 @@ +""" +Created on 20250115 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(분)[v1_국내주식-070] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/etfetn/v1/quotations/nav-comparison-time-trend" + +def nav_comparison_time_trend( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. E) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456) + fid_hour_cls_code: str # [필수] 시간구분코드 (ex. 60:1분,180:3분,...,7200:120분) +) -> pd.DataFrame: + """ + NAV 비교추이(분) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면 "분별" 비교추이 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 실전계좌의 경우, 한 번의 호출에 최근 30건까지 확인 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. E) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_hour_cls_code (str): [필수] 시간구분코드 (ex. 60:1분,180:3분,...,7200:120분) + + Returns: + pd.DataFrame: NAV 비교추이(분) 데이터 + + Example: + >>> df = nav_comparison_time_trend("E", "069500", "60") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'E')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_hour_cls_code == "" or fid_hour_cls_code is None: + raise ValueError("fid_hour_cls_code is required (e.g. '60:1분,180:3분,...,7200:120분')") + + tr_id = "FHPST02440100" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # output (array) -> pd.DataFrame + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/chk_nav_comparison_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/chk_nav_comparison_trend.py new file mode 100644 index 0000000..9608bd3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/chk_nav_comparison_trend.py @@ -0,0 +1,107 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from nav_comparison_trend import nav_comparison_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(종목)[v1_국내주식-069] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'stck_prpr': '주식 현재가', + 'prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'acml_vol': '누적 거래량', + 'acml_tr_pbmn': '누적 거래 대금', + 'stck_prdy_clpr': '주식 전일 종가', + 'stck_oprc': '주식 시가2', + 'stck_hgpr': '주식 최고가', + 'stck_lwpr': '주식 최저가', + 'stck_mxpr': '주식 상한가', + 'stck_llam': '주식 하한가', + 'nav': 'NAV', + 'nav_prdy_vrss_sign': 'NAV 전일 대비 부호', + 'nav_prdy_vrss': 'NAV 전일 대비', + 'nav_prdy_ctrt': 'NAV 전일 대비율', + 'prdy_clpr_nav': 'NAV전일종가', + 'oprc_nav': 'NAV시가', + 'hprc_nav': 'NAV고가', + 'lprc_nav': 'NAV저가' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['주식 현재가', '전일 대비', '전일 대비율', '누적 거래량', '누적 거래 대금', '주식 전일 종가', '주식 시가2', '주식 최고가', '주식 최저가', + '주식 상한가', '주식 하한가', 'NAV', 'NAV 전일 대비', 'NAV 전일 대비율', 'NAV전일종가', 'NAV시가', 'NAV고가', 'NAV저가'] + +def main(): + """ + NAV 비교추이(종목) 조회 테스트 함수 + + 이 함수는 NAV 비교추이(종목) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 KODEX 200 ETF(069500)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== Case1: KODEX 200 ETF(069500) 조회 ===") + try: + result1, result2 = nav_comparison_trend(fid_cond_mrkt_div_code="J", fid_input_iscd="069500") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 데이터 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("output1 결과:") + print(result1) + + # output2 데이터 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("output2 결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/nav_comparison_trend.py b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/nav_comparison_trend.py new file mode 100644 index 0000000..842bb05 --- /dev/null +++ b/한국투자증권(API)/examples_llm/etfetn/nav_comparison_trend/nav_comparison_trend.py @@ -0,0 +1,69 @@ +""" +Created on 20250112 +""" + + +import sys +import logging +from typing import Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(종목)[v1_국내주식-069] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/etfetn/v1/quotations/nav-comparison-trend" + +def nav_comparison_trend( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # [필수] 입력 종목코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + NAV 비교추이(종목) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: output1, output2 데이터프레임 + + Example: + >>> output1, output2 = nav_comparison_trend("J", "069500") + >>> print(output1) + >>> print(output2) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + tr_id = "FHPST02440000" # NAV 비교추이(종목) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + output2_data = pd.DataFrame(res.getBody().output2, index=[0]) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/kis_auth.py b/한국투자증권(API)/examples_llm/kis_auth.py new file mode 100644 index 0000000..cfd1a75 --- /dev/null +++ b/한국투자증권(API)/examples_llm/kis_auth.py @@ -0,0 +1,799 @@ +# -*- coding: utf-8 -*- +# ====| (REST) 접근 토큰 / (Websocket) 웹소켓 접속키 발급 에 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +# ====| API 호출 공통 함수 포함 |===================== + +import asyncio +import copy +import json +import logging +import os +import time +from base64 import b64decode +from collections import namedtuple +from collections.abc import Callable +from datetime import datetime +from io import StringIO + +import pandas as pd + +# pip install requests (패키지설치) +import requests + +# 웹 소켓 모듈을 선언한다. +import websockets + +# pip install PyYAML (패키지설치) +import yaml +from Crypto.Cipher import AES + +# pip install pycryptodome +from Crypto.Util.Padding import unpad + +clearConsole = lambda: os.system("cls" if os.name in ("nt", "dos") else "clear") + +key_bytes = 32 +config_root = os.path.join(os.path.expanduser("~"), "KIS", "config") +# config_root = "$HOME/KIS/config/" # 토큰 파일이 저장될 폴더, 제3자가 찾기 어렵도록 경로 설정하시기 바랍니다. +# token_tmp = config_root + 'KIS000000' # 토큰 로컬저장시 파일 이름 지정, 파일이름을 토큰값이 유추가능한 파일명은 삼가바랍니다. +# token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d%H%M%S") # 토큰 로컬저장시 파일명 년월일시분초 +token_tmp = os.path.join( + config_root, f"KIS{datetime.today().strftime("%Y%m%d")}" +) # 토큰 로컬저장시 파일명 년월일 + +# 접근토큰 관리하는 파일 존재여부 체크, 없으면 생성 +if os.path.exists(token_tmp) == False: + f = open(token_tmp, "w+") + +# 앱키, 앱시크리트, 토큰, 계좌번호 등 저장관리, 자신만의 경로와 파일명으로 설정하시기 바랍니다. +# pip install PyYAML (패키지설치) +with open(os.path.join(config_root, "kis_devlp.yaml"), encoding="UTF-8") as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) + +_TRENV = tuple() +_last_auth_time = datetime.now() +_autoReAuth = False +_DEBUG = False +_isPaper = False +_smartSleep = 0.1 + +# 기본 헤더값 정의 +_base_headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8", + "User-Agent": _cfg["my_agent"], +} + + +# 토큰 발급 받아 저장 (토큰값, 토큰 유효시간,1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def save_token(my_token, my_expired): + # print(type(my_expired), my_expired) + valid_date = datetime.strptime(my_expired, "%Y-%m-%d %H:%M:%S") + # print('Save token date: ', valid_date) + with open(token_tmp, "w", encoding="utf-8") as f: + f.write(f"token: {my_token}\n") + f.write(f"valid-date: {valid_date}\n") + + +# 토큰 확인 (토큰값, 토큰 유효시간_1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def read_token(): + try: + # 토큰이 저장된 파일 읽기 + with open(token_tmp, encoding="UTF-8") as f: + tkg_tmp = yaml.load(f, Loader=yaml.FullLoader) + + # 토큰 만료 일,시간 + exp_dt = datetime.strftime(tkg_tmp["valid-date"], "%Y-%m-%d %H:%M:%S") + # 현재일자,시간 + now_dt = datetime.today().strftime("%Y-%m-%d %H:%M:%S") + + # print('expire dt: ', exp_dt, ' vs now dt:', now_dt) + # 저장된 토큰 만료일자 체크 (만료일시 > 현재일시 인경우 보관 토큰 리턴) + if exp_dt > now_dt: + return tkg_tmp["token"] + else: + # print('Need new token: ', tkg_tmp['valid-date']) + return None + except Exception: + # print('read token error: ', e) + return None + + +# 토큰 유효시간 체크해서 만료된 토큰이면 재발급처리 +def _getBaseHeader(): + if _autoReAuth: + reAuth() + return copy.deepcopy(_base_headers) + + +# 가져오기 : 앱키, 앱시크리트, 종합계좌번호(계좌번호 중 숫자8자리), 계좌상품코드(계좌번호 중 숫자2자리), 토큰, 도메인 +def _setTRENV(cfg): + nt1 = namedtuple( + "KISEnv", + ["my_app", "my_sec", "my_acct", "my_prod", "my_htsid", "my_token", "my_url", "my_url_ws"], + ) + d = { + "my_app": cfg["my_app"], # 앱키 + "my_sec": cfg["my_sec"], # 앱시크리트 + "my_acct": cfg["my_acct"], # 종합계좌번호(8자리) + "my_prod": cfg["my_prod"], # 계좌상품코드(2자리) + "my_htsid": cfg["my_htsid"], # HTS ID + "my_token": cfg["my_token"], # 토큰 + "my_url": cfg[ + "my_url" + ], # 실전 도메인 (https://openapi.koreainvestment.com:9443) + "my_url_ws": cfg["my_url_ws"], + } # 모의 도메인 (https://openapivts.koreainvestment.com:29443) + + # print(cfg['my_app']) + global _TRENV + _TRENV = nt1(**d) + + +def isPaperTrading(): # 모의투자 매매 + return _isPaper + + +# 실전투자면 'prod', 모의투자면 'vps'를 셋팅 하시기 바랍니다. +def changeTREnv(token_key, svr="prod", product=_cfg["my_prod"]): + cfg = dict() + + global _isPaper + if svr == "prod": # 실전투자 + ak1 = "my_app" # 실전투자용 앱키 + ak2 = "my_sec" # 실전투자용 앱시크리트 + _isPaper = False + _smartSleep = 0.05 + elif svr == "vps": # 모의투자 + ak1 = "paper_app" # 모의투자용 앱키 + ak2 = "paper_sec" # 모의투자용 앱시크리트 + _isPaper = True + _smartSleep = 0.5 + + cfg["my_app"] = _cfg[ak1] + cfg["my_sec"] = _cfg[ak2] + + if svr == "prod" and product == "01": # 실전투자 주식투자, 위탁계좌, 투자계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "prod" and product == "03": # 실전투자 선물옵션(파생) + cfg["my_acct"] = _cfg["my_acct_future"] + elif svr == "prod" and product == "08": # 실전투자 해외선물옵션(파생) + cfg["my_acct"] = _cfg["my_acct_future"] + elif svr == "prod" and product == "22": # 실전투자 개인연금저축계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "prod" and product == "29": # 실전투자 퇴직연금계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "vps" and product == "01": # 모의투자 주식투자, 위탁계좌, 투자계좌 + cfg["my_acct"] = _cfg["my_paper_stock"] + elif svr == "vps" and product == "03": # 모의투자 선물옵션(파생) + cfg["my_acct"] = _cfg["my_paper_future"] + + cfg["my_prod"] = product + cfg["my_htsid"] = _cfg["my_htsid"] + cfg["my_url"] = _cfg[svr] + + try: + my_token = _TRENV.my_token + except AttributeError: + my_token = "" + cfg["my_token"] = my_token if token_key else token_key + cfg["my_url_ws"] = _cfg["ops" if svr == "prod" else "vops"] + + # print(cfg) + _setTRENV(cfg) + + +def _getResultObject(json_data): + _tc_ = namedtuple("res", json_data.keys()) + + return _tc_(**json_data) + + +# Token 발급, 유효기간 1일, 6시간 이내 발급시 기존 token값 유지, 발급시 알림톡 무조건 발송 +# 모의투자인 경우 svr='vps', 투자계좌(01)이 아닌경우 product='XX' 변경하세요 (계좌번호 뒤 2자리) +def auth(svr="prod", product=_cfg["my_prod"], url=None): + p = { + "grant_type": "client_credentials", + } + # 개인 환경파일 "kis_devlp.yaml" 파일을 참조하여 앱키, 앱시크리트 정보 가져오기 + # 개인 환경파일명과 위치는 고객님만 아는 위치로 설정 바랍니다. + if svr == "prod": # 실전투자 + ak1 = "my_app" # 앱키 (실전투자용) + ak2 = "my_sec" # 앱시크리트 (실전투자용) + elif svr == "vps": # 모의투자 + ak1 = "paper_app" # 앱키 (모의투자용) + ak2 = "paper_sec" # 앱시크리트 (모의투자용) + + # 앱키, 앱시크리트 가져오기 + p["appkey"] = _cfg[ak1] + p["appsecret"] = _cfg[ak2] + + # 기존 발급된 토큰이 있는지 확인 + saved_token = read_token() # 기존 발급 토큰 확인 + # print("saved_token: ", saved_token) + if saved_token is None: # 기존 발급 토큰 확인이 안되면 발급처리 + url = f"{_cfg[svr]}/oauth2/tokenP" + res = requests.post( + url, data=json.dumps(p), headers=_getBaseHeader() + ) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + my_token = _getResultObject(res.json()).access_token # 토큰값 가져오기 + my_expired = _getResultObject( + res.json() + ).access_token_token_expired # 토큰값 만료일시 가져오기 + save_token(my_token, my_expired) # 새로 발급 받은 토큰 저장 + else: + print("Get Authentification token fail!\nYou have to restart your app!!!") + return + else: + my_token = saved_token # 기존 발급 토큰 확인되어 기존 토큰 사용 + + # 발급토큰 정보 포함해서 헤더값 저장 관리, API 호출시 필요 + changeTREnv(my_token, svr, product) + + _base_headers["authorization"] = f"Bearer {my_token}" + _base_headers["appkey"] = _TRENV.my_app + _base_headers["appsecret"] = _TRENV.my_sec + + global _last_auth_time + _last_auth_time = datetime.now() + + if _DEBUG: + print(f"[{_last_auth_time}] => get AUTH Key completed!") + + +# end of initialize, 토큰 재발급, 토큰 발급시 유효시간 1일 +# 프로그램 실행시 _last_auth_time에 저장하여 유효시간 체크, 유효시간 만료시 토큰 발급 처리 +def reAuth(svr="prod", product=_cfg["my_prod"]): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: # 유효시간 1일 + auth(svr, product) + + +def getEnv(): + return _cfg + + +def smart_sleep(): + if _DEBUG: + print(f"[RateLimit] Sleeping {_smartSleep}s ") + + time.sleep(_smartSleep) + + +def getTREnv(): + return _TRENV + + +# 주문 API에서 사용할 hash key값을 받아 header에 설정해 주는 함수 +# 현재는 hash key 필수 사항아님, 생략가능, API 호출과정에서 변조 우려를 하는 경우 사용 +# Input: HTTP Header, HTTP post param +# Output: None +def set_order_hash_key(h, p): + url = f"{getTREnv().my_url}/uapi/hashkey" # hashkey 발급 API URL + + res = requests.post(url, data=json.dumps(p), headers=h) + rescode = res.status_code + if rescode == 200: + h["hashkey"] = _getResultObject(res.json()).HASH + else: + print("Error:", rescode) + + +# API 호출 응답에 필요한 처리 공통 함수 +class APIResp: + def __init__(self, resp): + self._rescode = resp.status_code + self._resp = resp + self._header = self._setHeader() + self._body = self._setBody() + self._err_code = self._body.msg_cd + self._err_message = self._body.msg1 + + def getResCode(self): + return self._rescode + + def _setHeader(self): + fld = dict() + for x in self._resp.headers.keys(): + if x.islower(): + fld[x] = self._resp.headers.get(x) + _th_ = namedtuple("header", fld.keys()) + + return _th_(**fld) + + def _setBody(self): + _tb_ = namedtuple("body", self._resp.json().keys()) + + return _tb_(**self._resp.json()) + + def getHeader(self): + return self._header + + def getBody(self): + return self._body + + def getResponse(self): + return self._resp + + def isOK(self): + try: + if self.getBody().rt_cd == "0": + return True + else: + return False + except: + return False + + def getErrorCode(self): + return self._err_code + + def getErrorMessage(self): + return self._err_message + + def printAll(self): + print("
") + for x in self.getHeader()._fields: + print(f"\t-{x}: {getattr(self.getHeader(), x)}") + print("") + for x in self.getBody()._fields: + print(f"\t-{x}: {getattr(self.getBody(), x)}") + + def printError(self, url): + print( + "-------------------------------\nError in response: ", + self.getResCode(), + " url=", + url, + ) + print( + "rt_cd : ", + self.getBody().rt_cd, + "/ msg_cd : ", + self.getErrorCode(), + "/ msg1 : ", + self.getErrorMessage(), + ) + print("-------------------------------") + + # end of class APIResp + + +class APIRespError(APIResp): + def __init__(self, status_code, error_text): + # 부모 생성자 호출하지 않고 직접 초기화 + self.status_code = status_code + self.error_text = error_text + self._error_code = str(status_code) + self._error_message = error_text + + def isOK(self): + return False + + def getErrorCode(self): + return self._error_code + + def getErrorMessage(self): + return self._error_message + + def getBody(self): + # 빈 객체 리턴 (속성 접근 시 AttributeError 방지) + class EmptyBody: + def __getattr__(self, name): + return None + + return EmptyBody() + + def getHeader(self): + # 빈 객체 리턴 + class EmptyHeader: + tr_cont = "" + + def __getattr__(self, name): + return "" + + return EmptyHeader() + + def printAll(self): + print(f"=== ERROR RESPONSE ===") + print(f"Status Code: {self.status_code}") + print(f"Error Message: {self.error_text}") + print(f"======================") + + def printError(self, url=""): + print(f"Error Code : {self.status_code} | {self.error_text}") + if url: + print(f"URL: {url}") + + +########### API call wrapping : API 호출 공통 + + +def _url_fetch( + api_url, ptr_id, tr_cont, params, appendHeaders=None, postFlag=False, hashFlag=True +): + url = f"{getTREnv().my_url}{api_url}" + + headers = _getBaseHeader() # 기본 header 값 정리 + + # 추가 Header 설정 + tr_id = ptr_id + if ptr_id[0] in ("T", "J", "C"): # 실전투자용 TR id 체크 + if isPaperTrading(): # 모의투자용 TR id 식별 + tr_id = "V" + ptr_id[1:] + + headers["tr_id"] = tr_id # 트랜젝션 TR id + headers["custtype"] = "P" # 일반(개인고객,법인고객) "P", 제휴사 "B" + headers["tr_cont"] = tr_cont # 트랜젝션 TR id + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if _DEBUG: + print("< Sending Info >") + print(f"URL: {url}, TR: {tr_id}") + print(f"
\n{headers}") + print(f"\n{params}") + + if postFlag: + # if (hashFlag): set_order_hash_key(headers, params) + res = requests.post(url, headers=headers, data=json.dumps(params)) + else: + res = requests.get(url, headers=headers, params=params) + + if res.status_code == 200: + ar = APIResp(res) + if _DEBUG: + ar.printAll() + return ar + else: + print("Error Code : " + str(res.status_code) + " | " + res.text) + return APIRespError(res.status_code, res.text) + + +# auth() +# print("Pass through the end of the line") + + +########### New - websocket 대응 + +_base_headers_ws = { + "content-type": "utf-8", +} + + +def _getBaseHeader_ws(): + if _autoReAuth: + reAuth_ws() + + return copy.deepcopy(_base_headers_ws) + + +def auth_ws(svr="prod", product=_cfg["my_prod"]): + p = {"grant_type": "client_credentials"} + if svr == "prod": + ak1 = "my_app" + ak2 = "my_sec" + elif svr == "vps": + ak1 = "paper_app" + ak2 = "paper_sec" + + p["appkey"] = _cfg[ak1] + p["secretkey"] = _cfg[ak2] + + url = f"{_cfg[svr]}/oauth2/Approval" + res = requests.post(url, data=json.dumps(p), headers=_getBaseHeader()) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + approval_key = _getResultObject(res.json()).approval_key + else: + print("Get Approval token fail!\nYou have to restart your app!!!") + return + + changeTREnv(None, svr, product) + + _base_headers_ws["approval_key"] = approval_key + + global _last_auth_time + _last_auth_time = datetime.now() + + if _DEBUG: + print(f"[{_last_auth_time}] => get AUTH Key completed!") + + +def reAuth_ws(svr="prod", product=_cfg["my_prod"]): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: + auth_ws(svr, product) + + +def data_fetch(tr_id, tr_type, params, appendHeaders=None) -> dict: + headers = _getBaseHeader_ws() # 기본 header 값 정리 + + headers["tr_type"] = tr_type + headers["custtype"] = "P" + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if _DEBUG: + print("< Sending Info >") + print(f"TR: {tr_id}") + print(f"
\n{headers}") + + inp = { + "tr_id": tr_id, + } + inp.update(params) + + return {"header": headers, "body": {"input": inp}} + + +# iv, ekey, encrypt 는 각 기능 메소드 파일에 저장할 수 있도록 dict에서 return 하도록 +def system_resp(data): + isPingPong = False + isUnSub = False + isOk = False + tr_msg = None + tr_key = None + encrypt, iv, ekey = None, None, None + + rdic = json.loads(data) + + tr_id = rdic["header"]["tr_id"] + if tr_id != "PINGPONG": + tr_key = rdic["header"]["tr_key"] + encrypt = rdic["header"]["encrypt"] + if rdic.get("body", None) is not None: + isOk = True if rdic["body"]["rt_cd"] == "0" else False + tr_msg = rdic["body"]["msg1"] + # 복호화를 위한 key 를 추출 + if "output" in rdic["body"]: + iv = rdic["body"]["output"]["iv"] + ekey = rdic["body"]["output"]["key"] + isUnSub = True if tr_msg[:5] == "UNSUB" else False + else: + isPingPong = True if tr_id == "PINGPONG" else False + + nt2 = namedtuple( + "SysMsg", + [ + "isOk", + "tr_id", + "tr_key", + "isUnSub", + "isPingPong", + "tr_msg", + "iv", + "ekey", + "encrypt", + ], + ) + d = { + "isOk": isOk, + "tr_id": tr_id, + "tr_key": tr_key, + "tr_msg": tr_msg, + "isUnSub": isUnSub, + "isPingPong": isPingPong, + "iv": iv, + "ekey": ekey, + "encrypt": encrypt, + } + + return nt2(**d) + + +def aes_cbc_base64_dec(key, iv, cipher_text): + if key is None or iv is None: + raise AttributeError("key and iv cannot be None") + + cipher = AES.new(key.encode("utf-8"), AES.MODE_CBC, iv.encode("utf-8")) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +##### +open_map: dict = {} + + +def add_open_map( + name: str, + request: Callable[[str, str, ...], (dict, list[str])], + data: str | list[str], + kwargs: dict = None, +): + if open_map.get(name, None) is None: + open_map[name] = { + "func": request, + "items": [], + "kwargs": kwargs, + } + + if type(data) is list: + open_map[name]["items"] += data + elif type(data) is str: + open_map[name]["items"].append(data) + + +data_map: dict = {} + + +def add_data_map( + tr_id: str, + columns: list = None, + encrypt: str = None, + key: str = None, + iv: str = None, +): + if data_map.get(tr_id, None) is None: + data_map[tr_id] = {"columns": [], "encrypt": False, "key": None, "iv": None} + + if columns is not None: + data_map[tr_id]["columns"] = columns + + if encrypt is not None: + data_map[tr_id]["encrypt"] = encrypt + + if key is not None: + data_map[tr_id]["key"] = key + + if iv is not None: + data_map[tr_id]["iv"] = iv + + +class KISWebSocket: + api_url: str = "" + on_result: Callable[ + [websockets.ClientConnection, str, pd.DataFrame, dict], None + ] = None + result_all_data: bool = False + + retry_count: int = 0 + amx_retries: int = 0 + + # init + def __init__(self, api_url: str, max_retries: int = 3): + self.api_url = api_url + self.max_retries = max_retries + + # private + async def __subscriber(self, ws: websockets.ClientConnection): + async for raw in ws: + logging.info("received message >> %s" % raw) + show_result = False + + df = pd.DataFrame() + + if raw[0] in ["0", "1"]: + d1 = raw.split("|") + if len(d1) < 4: + raise ValueError("data not found...") + + tr_id = d1[1] + + dm = data_map[tr_id] + d = d1[3] + if dm.get("encrypt", None) == "Y": + d = aes_cbc_base64_dec(dm["key"], dm["iv"], d) + + df = pd.read_csv( + StringIO(d), header=None, sep="^", names=dm["columns"], dtype=object + ) + + show_result = True + + else: + rsp = system_resp(raw) + + tr_id = rsp.tr_id + add_data_map( + tr_id=rsp.tr_id, encrypt=rsp.encrypt, key=rsp.ekey, iv=rsp.iv + ) + + if rsp.isPingPong: + print(f"### RECV [PINGPONG] [{raw}]") + await ws.pong(raw) + print(f"### SEND [PINGPONG] [{raw}]") + + if self.result_all_data: + show_result = True + + if show_result is True and self.on_result is not None: + self.on_result(ws, tr_id, df, data_map[tr_id]) + + async def __runner(self): + if len(open_map.keys()) > 40: + raise ValueError("Subscription's max is 40") + + url = f"{getTREnv().my_url_ws}{self.api_url}" + + while self.retry_count < self.max_retries: + try: + async with websockets.connect(url) as ws: + # request subscribe + for name, obj in open_map.items(): + await self.send_multiple( + ws, obj["func"], "1", obj["items"], obj["kwargs"] + ) + + # subscriber + await asyncio.gather( + self.__subscriber(ws), + ) + except Exception as e: + print("Connection exception >> ", e) + self.retry_count += 1 + await asyncio.sleep(1) + + # func + @classmethod + async def send( + cls, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + tr_type: str, + data: str, + kwargs: dict = None, + ): + k = {} if kwargs is None else kwargs + msg, columns = request(tr_type, data, **k) + + add_data_map(tr_id=msg["body"]["input"]["tr_id"], columns=columns) + + logging.info("send message >> %s" % json.dumps(msg)) + + await ws.send(json.dumps(msg)) + smart_sleep() + + async def send_multiple( + self, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + tr_type: str, + data: list | str, + kwargs: dict = None, + ): + if type(data) is str: + await self.send(ws, request, tr_type, data, kwargs) + elif type(data) is list: + for d in data: + await self.send(ws, request, tr_type, d, kwargs) + else: + raise ValueError("data must be str or list") + + @classmethod + def subscribe( + cls, + request: Callable[[str, str, ...], (dict, list[str])], + data: list | str, + kwargs: dict = None, + ): + add_open_map(request.__name__, request, data, kwargs) + + def unsubscribe( + self, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + data: list | str, + ): + self.send_multiple(ws, request, "2", data) + + # start + def start( + self, + on_result: Callable[ + [websockets.ClientConnection, str, pd.DataFrame, dict], None + ], + result_all_data: bool = False, + ): + self.on_result = on_result + self.result_all_data = result_all_data + try: + asyncio.run(self.__runner()) + except KeyboardInterrupt: + print("Closing by KeyboardInterrupt") diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/asking_price.py new file mode 100644 index 0000000..c2d2f32 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/asking_price.py @@ -0,0 +1,99 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] +############################################################################################## + +def asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] + + ※ CME, SGX 실시간시세 유료시세 신청 필수 (KIS포털 > FAQ > 자주 묻는 질문 > 해외선물옵션 API 유료시세 신청방법(CME, SGX 거래소)) + - CME, SGX 거래소 실시간시세는 유료시세 신청 후 이용하시는 모든 계좌에 대해서 접근토큰발급 API 호출하셔야 하며, + 접근토큰발급 이후 2시간 이내로 신청정보가 동기화되어 유료시세 수신이 가능해집니다. + - CME, SGX 거래소 종목은 유료시세 신청되어 있지 않으면 실시간시세 종목등록이 불가하며, + 등록 시도 시 "SUBSCRIBE ERROR : mci send failed" 에러가 발생합니다. + + (중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = asking_price("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF010" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "series_cd", + "recv_date", + "recv_time", + "prev_price", + "bid_qntt_1", + "bid_num_1", + "bid_price_1", + "ask_qntt_1", + "ask_num_1", + "ask_price_1", + "bid_qntt_2", + "bid_num_2", + "bid_price_2", + "ask_qntt_2", + "ask_num_2", + "ask_price_2", + "bid_qntt_3", + "bid_num_3", + "bid_price_3", + "ask_qntt_3", + "ask_num_3", + "ask_price_3", + "bid_qntt_4", + "bid_num_4", + "bid_price_4", + "ask_qntt_4", + "ask_num_4", + "ask_price_4", + "bid_qntt_5", + "bid_num_5", + "bid_price_5", + "ask_qntt_5", + "ask_num_5", + "ask_price_5", + "sttl_price" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/chk_asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/chk_asking_price.py new file mode 100644 index 0000000..7eaf6a5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/asking_price/chk_asking_price.py @@ -0,0 +1,105 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from asking_price import asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + "series_cd": "종목코드", + "recv_date": "수신일자", + "recv_time": "수신시각", + "prev_price": "전일종가", + "bid_qntt_1": "매수1수량", + "bid_num_1": "매수1번호", + "bid_price_1": "매수1호가", + "ask_qntt_1": "매도1수량", + "ask_num_1": "매도1번호", + "ask_price_1": "매도1호가", + "bid_qntt_2": "매수2수량", + "bid_num_2": "매수2번호", + "bid_price_2": "매수2호가", + "ask_qntt_2": "매도2수량", + "ask_num_2": "매도2번호", + "ask_price_2": "매도2호가", + "bid_qntt_3": "매수3수량", + "bid_num_3": "매수3번호", + "bid_price_3": "매수3호가", + "ask_qntt_3": "매도3수량", + "ask_num_3": "매도3번호", + "ask_price_3": "매도3호가", + "bid_qntt_4": "매수4수량", + "bid_num_4": "매수4번호", + "bid_price_4": "매수4호가", + "ask_qntt_4": "매도4수량", + "ask_num_4": "매도4번호", + "ask_price_4": "매도4호가", + "bid_qntt_5": "매수5수량", + "bid_num_5": "매수5번호", + "bid_price_5": "매수5호가", + "ask_qntt_5": "매도5수량", + "ask_num_5": "매도5번호", + "ask_price_5": "매도5호가", + "sttl_price": "전일정산가" +} + +NUMERIC_COLUMNS = ["전일종가", "매수1수량", "매수1호가", "매도1수량", "매도1호가", + "매수2수량", "매수2호가", "매도2수량", "매도2호가", + "매수3수량", "매수3호가", "매도3수량", "매도3호가", + "매수4수량", "매수4호가", "매도4수량", "매도4호가", + "매수5수량", "매수5호가", "매도5수량", "매도5호가", "전일정산가"] + +def main(): + """ + 해외선물옵션 실시간호가 테스트 함수 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=asking_price, data=["SPIU25"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/ccnl.py new file mode 100644 index 0000000..3f3af7e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/ccnl.py @@ -0,0 +1,85 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결가[실시간-017] +############################################################################################## + +def ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ※ CME, SGX 실시간시세 유료시세 신청 필수 (KIS포털 > FAQ > 자주 묻는 질문 > 해외선물옵션 API 유료시세 신청방법(CME, SGX 거래소)) + - CME, SGX 거래소 실시간시세는 유료시세 신청 후 이용하시는 모든 계좌에 대해서 접근토큰발급 API 호출하셔야 하며, + 접근토큰발급 이후 2시간 이내로 신청정보가 동기화되어 유료시세 수신이 가능해집니다. + - CME, SGX 거래소 종목은 유료시세 신청되어 있지 않으면 실시간시세 종목등록이 불가하며, + 등록 시도 시 "SUBSCRIBE ERROR : mci send failed" 에러가 발생합니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF020" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "series_cd", + "bsns_date", + "mrkt_open_date", + "mrkt_open_time", + "mrkt_close_date", + "mrkt_close_time", + "prev_price", + "recv_date", + "recv_time", + "active_flag", + "last_price", + "last_qntt", + "prev_diff_price", + "prev_diff_rate", + "open_price", + "high_price", + "low_price", + "vol", + "prev_sign", + "quotsign", + "recv_time2", + "psttl_price", + "psttl_sign", + "psttl_diff_price", + "psttl_diff_rate" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/chk_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/chk_ccnl.py new file mode 100644 index 0000000..274d760 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl/chk_ccnl.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl import ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결가[실시간-017] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + "series_cd": "종목코드", + "bsns_date": "영업일자", + "mrkt_open_date": "장개시일자", + "mrkt_open_time": "장개시시각", + "mrkt_close_date": "장종료일자", + "mrkt_close_time": "장종료시각", + "prev_price": "전일종가", + "recv_date": "수신일자", + "recv_time": "수신시각", + "active_flag": "본장_전산장구분", + "last_price": "체결가격", + "last_qntt": "체결수량", + "prev_diff_price": "전일대비가", + "prev_diff_rate": "등락률", + "open_price": "시가", + "high_price": "고가", + "low_price": "저가", + "vol": "누적거래량", + "prev_sign": "전일대비부호", + "quotsign": "체결구분", + "recv_time2": "수신시각2 만분의일초", + "psttl_price": "전일정산가", + "psttl_sign": "전일정산가대비", + "psttl_diff_price": "전일정산가대비가격", + "psttl_diff_rate": "전일정산가대비율" +} + +NUMERIC_COLUMNS = ["전일종가", "체결가격", "체결수량", "전일대비가", "등락률", "시가", "고가", "저가", + "누적거래량", "전일정산가", "전일정산가대비가격", "전일정산가대비율"] + +def main(): + """ + 해외선물옵션 실시간체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl, data=["1OZQ25"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/ccnl_notice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/ccnl_notice.py new file mode 100644 index 0000000..a621da3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/ccnl_notice.py @@ -0,0 +1,88 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결내역통보[실시간-020] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외선물옵션 실시간체결내역통보 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF2C0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "acct_no", + "ord_dt", + "odno", + "orgn_ord_dt", + "orgn_odno", + "series", + "rvse_cncl_dvsn_cd", + "sll_buy_dvsn_cd", + "cplx_ord_dvsn_cd", + "prce_tp", + "fm_excg_rcit_dvsn_cd", + "ord_qty", + "fm_lmt_pric", + "fm_stop_ord_pric", + "tot_ccld_qty", + "tot_ccld_uv", + "ord_remq", + "fm_ord_grp_dt", + "ord_grp_stno", + "ord_dtl_dtime", + "oprt_dtl_dtime", + "work_empl", + "ccld_dt", + "ccno", + "api_ccno", + "ccld_qty", + "fm_ccld_pric", + "crcy_cd", + "trst_fee", + "ord_mdia_online_yn", + "fm_ccld_amt", + "fuop_item_dvsn_cd" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/chk_ccnl_notice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/chk_ccnl_notice.py new file mode 100644 index 0000000..f9be60a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/ccnl_notice/chk_ccnl_notice.py @@ -0,0 +1,100 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_notice import ccnl_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결내역통보[실시간-020] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + "acct_no": "계좌번호", + "ord_dt": "주문일자", + "odno": "주문번호", + "orgn_ord_dt": "원주문일자", + "orgn_odno": "원주문번호", + "series": "종목명", + "rvse_cncl_dvsn_cd": "정정취소구분코드", + "sll_buy_dvsn_cd": "매도매수구분코드", + "cplx_ord_dvsn_cd": "복합주문구분코드", + "prce_tp": "가격구분코드", + "fm_excg_rcit_dvsn_cd": "FM거래소접수구분코드", + "ord_qty": "주문수량", + "fm_lmt_pric": "FMLIMIT가격", + "fm_stop_ord_pric": "FMSTOP주문가격", + "tot_ccld_qty": "총체결수량", + "tot_ccld_uv": "총체결단가", + "ord_remq": "잔량", + "fm_ord_grp_dt": "FM주문그룹일자", + "ord_grp_stno": "주문그룹번호", + "ord_dtl_dtime": "주문상세일시", + "oprt_dtl_dtime": "조작상세일시", + "work_empl": "주문자", + "ccld_dt": "체결일자", + "ccno": "체결번호", + "api_ccno": "API 체결번호", + "ccld_qty": "체결수량", + "fm_ccld_pric": "FM체결가격", + "crcy_cd": "통화코드", + "trst_fee": "위탁수수료", + "ord_mdia_online_yn": "주문매체온라인여부", + "fm_ccld_amt": "FM체결금액", + "fuop_item_dvsn_cd": "선물옵션종목구분코드" +} + +NUMERIC_COLUMNS = ["주문수량", "FMLIMIT가격", "FMSTOP주문가격", "총체결수량", "총체결단가", "잔량", + "체결수량", "FM체결가격", "위탁수수료", "FM체결금액"] + +def main(): + """ + 해외선물옵션 실시간체결내역통보 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/chk_daily_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/chk_daily_ccnl.py new file mode 100644 index 0000000..c6845ca --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/chk_daily_ccnl.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from daily_ccnl import daily_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간) [해외선물-018] +############################################################################################## + +COLUMN_MAPPING = { + 'tret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량', + '전일대비가격', '전일대비율'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(일간)[해외선물-018] + + 해외선물 체결추이(일간) 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (예) 6AM24) + - exch_cd (str): 거래소코드 (예) CME) + - start_date_time (str): 조회시작일시 (공백) + - close_date_time (str): 조회종료일시 (예) 20240402) + - qry_tp (str): 조회구분 (Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시) + - qry_cnt (str): 요청개수 (예) 30 (최대 40)) + - qry_gap (str): 묶음개수 (공백 (분만 사용)) + - index_key (str): 이전조회KEY (공백) + + Returns: + - DataFrame: 해외선물 체결추이(일간) 결과 + + Example: + >>> df1, df2 = daily_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + logger.info("API 호출") + result1, result2 = daily_ccnl( + srs_cd="DXM24", + exch_cd="ICE", + start_date_time="", + close_date_time="20250630", + qry_tp="Q", + qry_cnt="30", + qry_gap="", + index_key="" + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/daily_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/daily_ccnl.py new file mode 100644 index 0000000..aae35d8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/daily_ccnl/daily_ccnl.py @@ -0,0 +1,186 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간) [해외선물-018] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/daily-ccnl" + +def daily_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(일간)[해외선물-018] + 해외선물 체결추이(일간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: 6AM24) + exch_cd (str): 거래소코드 (예: CME) + start_date_time (str): 조회시작일시 (공백) + close_date_time (str): 조회종료일시 (예: 20240402) + qry_tp (str): 조회구분 (Q: 최초조회시, P: 다음키(INDEX_KEY) 입력하여 조회시) + qry_cnt (str): 요청개수 (예: 30, 최대 40) + qry_gap (str): 묶음개수 (공백, 분만 사용) + index_key (str): 이전조회KEY (공백) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(일간) 데이터 + + Example: + >>> df1, df2 = daily_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. (e.g. 'Q')") + raise ValueError("qry_tp is required. (e.g. 'Q')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020100" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return daily_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/chk_inquire_asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/chk_inquire_asking_price.py new file mode 100644 index 0000000..5ae49bf --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/chk_inquire_asking_price.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_asking_price import inquire_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'open_price': '시가', + 'high_price': '고가', + 'lowp_rice': '저가', + 'last_price': '현재가', + 'prev_price': '전일종가', + 'vol': '거래량', + 'prev_diff_price': '전일대비가', + 'prev_diff_rate': '전일대비율', + 'quot_date': '호가수신일자', + 'quot_time': '호가수신시각', + 'bid_qntt': '매수수량', + 'bid_num': '매수번호', + 'bid_price': '매수호가', + 'ask_qntt': '매도수량', + 'ask_num': '매도번호', + 'ask_price': '매도호가' +} + +NUMERIC_COLUMNS = ['시가', '고가', '저가', '현재가', '전일종가', '거래량', '전일대비가', '전일대비율', + '매수수량', '매수호가', '매도수량', '매도호가'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 호가[해외선물-031] + + 해외선물 호가 테스트 함수 + + Parameters: + - srs_cd (str): 종목명 (종목코드) + + Returns: + - DataFrame: 해외선물 호가 결과 + + Example: + >>> df1, df2 = inquire_asking_price(srs_cd="ESZ23") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + logger.info("API 호출") + result1, result2 = inquire_asking_price(srs_cd="ESZ25") + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/inquire_asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/inquire_asking_price.py new file mode 100644 index 0000000..8183495 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_asking_price/inquire_asking_price.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/inquire-asking-price" + +def inquire_asking_price( + srs_cd: str, # 종목명 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 호가[해외선물-031] + 해외선물 호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 호가 데이터 + + Example: + >>> df1, df2 = inquire_asking_price(srs_cd="EXAMPLE_SRS_CD") + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'EXAMPLE_SRS_CD')") + raise ValueError("srs_cd is required. (e.g. 'EXAMPLE_SRS_CD')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC86000000" + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + srs_cd, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/chk_inquire_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/chk_inquire_ccld.py new file mode 100644 index 0000000..ac4f5a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/chk_inquire_ccld.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_ccld import inquire_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 당일주문내역조회 [v1_해외선물-004] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'orgn_ord_dt': '원주문일자', + 'orgn_odno': '원주문번호', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'rcit_dvsn_cd': '접수구분코드', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'trad_stgy_dvsn_cd': '매매전략구분코드', + 'bass_pric_type_cd': '기준가격유형코드', + 'ord_stat_cd': '주문상태코드', + 'fm_ord_qty': 'FM주문수량', + 'fm_ord_pric': 'FM주문가격', + 'fm_stop_ord_pric': 'FMSTOP주문가격', + 'rsvn_dvsn': '예약구분', + 'fm_ccld_qty': 'FM체결수량', + 'fm_ccld_pric': 'FM체결가격', + 'fm_ord_rmn_qty': 'FM주문잔여수량', + 'ord_grp_name': '주문그룹명', + 'erlm_dtl_dtime': '등록상세일시', + 'ccld_dtl_dtime': '체결상세일시', + 'ord_stfno': '주문직원번호', + 'rmks1': '비고1', + 'new_lqd_dvsn_cd': '신규청산구분코드', + 'fm_lqd_lmt_ord_pric': 'FM청산LIMIT주문가격', + 'fm_lqd_stop_pric': 'FM청산STOP가격', + 'ccld_cndt_cd': '체결조건코드', + 'noti_vald_dt': '게시유효일자', + 'acnt_type_cd': '계좌유형코드', + 'fuop_dvsn': '선물옵션구분' +} + +NUMERIC_COLUMNS = ['FM주문수량', 'FM주문가격', 'FMSTOP주문가격', 'FM체결수량', 'FM체결가격', 'FM주문잔여수량', + 'FM청산LIMIT주문가격', 'FM청산STOP가격'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 당일주문내역조회[v1_해외선물-004] + + 해외선물옵션 당일주문내역조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ccld_nccs_dvsn (str): 체결미체결구분 (01:전체 / 02:체결 / 03:미체결) + - sll_buy_dvsn_cd (str): 매도매수구분코드 (%%:전체 / 01:매도 / 02:매수) + - fuop_dvsn (str): 선물옵션구분 (00:전체 / 01:선물 / 02:옵션) + - ctx_area_fk200 (str): 연속조회검색조건200 () + - ctx_area_nk200 (str): 연속조회키200 () + + Returns: + - DataFrame: 해외선물옵션 당일주문내역조회 결과 + + Example: + >>> df = inquire_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ccld_nccs_dvsn="01", sll_buy_dvsn_cd="%%", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = inquire_ccld( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + ccld_nccs_dvsn="01", + sll_buy_dvsn_cd="%%", + fuop_dvsn="00", + ctx_area_fk200="", + ctx_area_nk200="" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 당일주문내역조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/inquire_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/inquire_ccld.py new file mode 100644 index 0000000..9fff6aa --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_ccld/inquire_ccld.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 당일주문내역조회 [v1_해외선물-004] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-ccld" + +def inquire_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 당일주문내역조회[v1_해외선물-004] + 해외선물옵션 당일주문내역조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ccld_nccs_dvsn (str): 01:전체 / 02:체결 / 03:미체결 + sll_buy_dvsn_cd (str): %%:전체 / 01:매도 / 02:매수 + fuop_dvsn (str): 00:전체 / 01:선물 / 02:옵션 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 당일주문내역조회 데이터 + + Example: + >>> df = inquire_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ccld_nccs_dvsn="01", + ... sll_buy_dvsn_cd="01", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '01')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '01')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3116R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccld( + cano, + acnt_prdt_cd, + ccld_nccs_dvsn, + sll_buy_dvsn_cd, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/chk_inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/chk_inquire_daily_ccld.py new file mode 100644 index 0000000..901a720 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/chk_inquire_daily_ccld.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_ccld import inquire_daily_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별체결내역[해외선물-011] +############################################################################################## + +COLUMN_MAPPING = { + 'fm_tot_ccld_qty': 'FM총체결수량', + 'fm_tot_futr_agrm_amt': 'FM총선물약정금액', + 'fm_tot_opt_agrm_amt': 'FM총옵션약정금액', + 'fm_fee_smtl': 'FM수수료합계', + 'dt': '일자', + 'ccno': '체결번호', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'fm_ccld_qty': 'FM체결수량', + 'fm_ccld_amt': 'FM체결금액', + 'fm_futr_ccld_amt': 'FM선물체결금액', + 'fm_opt_ccld_amt': 'FM옵션체결금액', + 'crcy_cd': '통화코드', + 'fm_fee': 'FM수수료', + 'fm_futr_pure_agrm_amt': 'FM선물순약정금액', + 'fm_opt_pure_agrm_amt': 'FM옵션순약정금액', + 'ccld_dtl_dtime': '체결상세일시', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'ord_mdia_dvsn_name': '주문매체구분명' +} + +NUMERIC_COLUMNS = ['FM총체결수량', 'FM총선물약정금액', 'FM총옵션약정금액', 'FM수수료합계', 'FM체결수량', 'FM체결금액', 'FM선물체결금액', + 'FM옵션체결금액', 'FM수수료', 'FM선물순약정금액', 'FM옵션순약정금액'] + + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 체결내역[해외선물-011] + + 해외선물옵션 일별 체결내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - strt_dt (str): 시작일자 (시작일자(YYYYMMDD)) + - end_dt (str): 종료일자 (종료일자(YYYYMMDD)) + - fuop_dvsn_cd (str): 선물옵션구분코드 (00:전체 / 01:선물 / 02:옵션) + - fm_pdgr_cd (str): FM상품군코드 (공란(Default)) + - crcy_cd (str): 통화코드 (%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남) + - fm_item_ftng_yn (str): FM종목합산여부 ("N"(Default)) + - sll_buy_dvsn_cd (str): 매도매수구분코드 (%%: 전체 / 01 : 매도 / 02 : 매수) + - ctx_area_fk200 (str): 연속조회검색조건200 () + - ctx_area_nk200 (str): 연속조회키200 () + + Returns: + - DataFrame: 해외선물옵션 일별 체결내역 결과 + + Example: + >>> df1, df2 = inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_dt="20250101", end_dt="20250131", fuop_dvsn_cd="00", fm_pdgr_cd="", crcy_cd="%%%", fm_item_ftng_yn="N", sll_buy_dvsn_cd="%%", ctx_area_fk200="", ctx_area_nk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 일별 체결내역") + result1, result2 = inquire_daily_ccld( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + strt_dt="20250601", # 시작일자 + end_dt="20250702", # 종료일자 + fuop_dvsn_cd="00", # 선물옵션구분코드 + fm_pdgr_cd="", # FM상품군코드 + crcy_cd="%%%", # 통화코드 + fm_item_ftng_yn="N", # FM종목합산여부 + sll_buy_dvsn_cd="%%", # 매도매수구분코드 + ctx_area_fk200="", # 연속조회검색조건200 + ctx_area_nk200="", # 연속조회키200 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/inquire_daily_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/inquire_daily_ccld.py new file mode 100644 index 0000000..fc45703 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_ccld/inquire_daily_ccld.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별체결내역[해외선물-011] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-daily-ccld" + +def inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_dt: str, # 시작일자 + end_dt: str, # 종료일자 + fuop_dvsn_cd: str, # 선물옵션구분코드 + fm_pdgr_cd: str, # FM상품군코드 + crcy_cd: str, # 통화코드 + fm_item_ftng_yn: str, # FM종목합산여부 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 체결내역[해외선물-011] + 해외선물옵션 일별 체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + strt_dt (str): 시작일자(YYYYMMDD) + end_dt (str): 종료일자(YYYYMMDD) + fuop_dvsn_cd (str): 00:전체 / 01:선물 / 02:옵션 + fm_pdgr_cd (str): 공란(Default) + crcy_cd (str): %%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남 + fm_item_ftng_yn (str): "N"(Default) + sll_buy_dvsn_cd (str): %%: 전체 / 01 : 매도 / 02 : 매수 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물옵션 일별 체결내역 데이터 + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... strt_dt="20221010", + ... end_dt="20221216", + ... fuop_dvsn_cd="00", + ... fm_pdgr_cd="", + ... crcy_cd="%%%", + ... fm_item_ftng_yn="N", + ... sll_buy_dvsn_cd="%%", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not strt_dt: + logger.error("strt_dt is required. (e.g. '20221010')") + raise ValueError("strt_dt is required. (e.g. '20221010')") + if not end_dt: + logger.error("end_dt is required. (e.g. '20221216')") + raise ValueError("end_dt is required. (e.g. '20221216')") + if fuop_dvsn_cd not in ['00', '01', '02']: + logger.error("fuop_dvsn_cd is required. (e.g. '00', '01', '02')") + raise ValueError("fuop_dvsn_cd is required. (e.g. '00', '01', '02')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%',KRW, USD, EUR..)") + raise ValueError("crcy_cd is required. (e.g. '%%%',KRW, USD, EUR..)") + if not fm_item_ftng_yn: + logger.error("fm_item_ftng_yn is required. (e.g. 'N')") + raise ValueError("fm_item_ftng_yn is required. (e.g. 'N')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '%%')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '%%')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "OTFM3122R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_DT": strt_dt, + "END_DT": end_dt, + "FUOP_DVSN_CD": fuop_dvsn_cd, + "FM_PDGR_CD": fm_pdgr_cd, + "CRCY_CD": crcy_cd, + "FM_ITEM_FTNG_YN": fm_item_ftng_yn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output1 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont, ctx_area_fk200, ctx_area_nk200 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_ccld( + cano, + acnt_prdt_cd, + strt_dt, + end_dt, + fuop_dvsn_cd, + fm_pdgr_cd, + crcy_cd, + fm_item_ftng_yn, + sll_buy_dvsn_cd, + ctx_area_fk200, + ctx_area_nk200, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/chk_inquire_daily_order.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/chk_inquire_daily_order.py new file mode 100644 index 0000000..90bfbca --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/chk_inquire_daily_order.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_daily_order import inquire_daily_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역 [해외선물-013] +############################################################################################## + +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'dt': '일자', + 'ord_dt': '주문일자', + 'odno': '주문번호', + 'orgn_ord_dt': '원주문일자', + 'orgn_odno': '원주문번호', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'rvse_cncl_dvsn_cd': '정정취소구분코드', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'cplx_ord_dvsn_cd': '복합주문구분코드', + 'pric_dvsn_cd': '가격구분코드', + 'rcit_dvsn_cd': '접수구분코드', + 'fm_ord_qty': 'FM주문수량', + 'fm_ord_pric': 'FM주문가격', + 'fm_stop_ord_pric': 'FMSTOP주문가격', + 'ecis_rsvn_ord_yn': '행사예약주문여부', + 'fm_ccld_qty': 'FM체결수량', + 'fm_ccld_pric': 'FM체결가격', + 'fm_ord_rmn_qty': 'FM주문잔여수량', + 'ord_grp_name': '주문그룹명', + 'rcit_dtl_dtime': '접수상세일시', + 'ccld_dtl_dtime': '체결상세일시', + 'ordr_emp_no': '주문자사원번호', + 'rjct_rson_name': '거부사유명', + 'ccld_cndt_cd': '체결조건코드', + 'trad_end_dt': '매매종료일자' +} + +NUMERIC_COLUMNS = ['FM주문수량', 'FM주문가격', 'FMSTOP주문가격', 'FM체결수량', 'FM체결가격', 'FM주문잔여수량'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 주문내역[해외선물-013] + + 해외선물옵션 일별 주문내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - strt_dt (str): 시작일자 () + - end_dt (str): 종료일자 () + - fm_pdgr_cd (str): FM상품군코드 () + - ccld_nccs_dvsn (str): 체결미체결구분 (01:전체 / 02:체결 / 03:미체결) + - sll_buy_dvsn_cd (str): 매도매수구분코드 (%%전체 / 01 : 매도 / 02 : 매수) + - fuop_dvsn (str): 선물옵션구분 (00:전체 / 01:선물 / 02:옵션) + - ctx_area_fk200 (str): 연속조회검색조건200 () + - ctx_area_nk200 (str): 연속조회키200 () + + Returns: + - DataFrame: 해외선물옵션 일별 주문내역 결과 + + Example: + >>> df = inquire_daily_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_dt="20250601", end_dt="20250703", fm_pdgr_cd="", ccld_nccs_dvsn="01", sll_buy_dvsn_cd="%%", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 일별 주문내역") + result = inquire_daily_order( + cano=trenv.my_acct, # 종합계좌번호 (자동 설정) + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + strt_dt="20250601", # 시작일자 + end_dt="20250703", # 종료일자 + fm_pdgr_cd="", # FM상품군코드 + ccld_nccs_dvsn="01", # 체결미체결구분 + sll_buy_dvsn_cd="%%", # 매도매수구분코드 + fuop_dvsn="00", # 선물옵션구분 + ctx_area_fk200="", # 연속조회검색조건200 + ctx_area_nk200="" # 연속조회키200 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 일별 주문내역 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/inquire_daily_order.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/inquire_daily_order.py new file mode 100644 index 0000000..1e806f1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_daily_order/inquire_daily_order.py @@ -0,0 +1,166 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역 [해외선물-013] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-daily-order" + +def inquire_daily_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_dt: str, # 시작일자 + end_dt: str, # 종료일자 + fm_pdgr_cd: str, # FM상품군코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 주문내역[해외선물-013] + 해외선물옵션 일별 주문내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + strt_dt (str): 시작일자 (YYYYMMDD) + end_dt (str): 종료일자 (YYYYMMDD) + fm_pdgr_cd (str): FM상품군코드 + ccld_nccs_dvsn (str): 체결미체결구분 (01:전체 / 02:체결 / 03:미체결) + sll_buy_dvsn_cd (str): 매도매수구분코드 (%%전체 / 01:매도 / 02:매수) + fuop_dvsn (str): 선물옵션구분 (00:전체 / 01:선물 / 02:옵션) + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 일별 주문내역 데이터 + + Example: + >>> df = inquire_daily_order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... strt_dt="20220101", + ... end_dt="20221214", + ... fm_pdgr_cd="", + ... ccld_nccs_dvsn="01", + ... sll_buy_dvsn_cd="%%", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not strt_dt: + logger.error("strt_dt is required. (e.g. '20220101')") + raise ValueError("strt_dt is required. (e.g. '20220101')") + if not end_dt: + logger.error("end_dt is required. (e.g. '20221214')") + raise ValueError("end_dt is required. (e.g. '20221214')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '01')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '01')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '%%')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '%%')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3120R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_DT": strt_dt, + "END_DT": end_dt, + "FM_PDGR_CD": fm_pdgr_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_order( + cano, + acnt_prdt_cd, + strt_dt, + end_dt, + fm_pdgr_cd, + ccld_nccs_dvsn, + sll_buy_dvsn_cd, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/chk_inquire_deposit.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/chk_inquire_deposit.py new file mode 100644 index 0000000..98a1997 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/chk_inquire_deposit.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_deposit import inquire_deposit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황 [해외선물-012] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'fm_nxdy_dncl_amt': 'FM익일예수금액', + 'fm_tot_asst_evlu_amt': 'FM총자산평가금액', + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'crcy_cd': '통화코드', + 'resp_dt': '응답일자', + 'fm_dnca_rmnd': 'FM예수금잔액', + 'fm_lqd_pfls_amt': 'FM청산손익금액', + 'fm_fee': 'FM수수료', + 'fm_fuop_evlu_pfls_amt': 'FM선물옵션평가손익금액', + 'fm_rcvb_amt': 'FM미수금액', + 'fm_brkg_mgn_amt': 'FM위탁증거금액', + 'fm_mntn_mgn_amt': 'FM유지증거금액', + 'fm_add_mgn_amt': 'FM추가증거금액', + 'fm_risk_rt': 'FM위험율', + 'fm_ord_psbl_amt': 'FM주문가능금액', + 'fm_drwg_psbl_amt': 'FM출금가능금액', + 'fm_echm_rqrm_amt': 'FM환전요청금액', + 'fm_drwg_prar_amt': 'FM출금예정금액', + 'fm_opt_tr_chgs': 'FM옵션거래대금', + 'fm_opt_icld_asst_evlu_amt': 'FM옵션포함자산평가금액', + 'fm_opt_evlu_amt': 'FM옵션평가금액', + 'fm_crcy_sbst_amt': 'FM통화대용금액', + 'fm_crcy_sbst_use_amt': 'FM통화대용사용금액', + 'fm_crcy_sbst_stup_amt': 'FM통화대용설정금액' +} +NUMERIC_COLUMNS = ['FM총자산평가금액', 'FM예수금잔액', 'FM청산손익금액', 'FM수수료', 'FM선물옵션평가손익금액', 'FM미수금액', 'FM위탁증거금액', 'FM유지증거금액', 'FM추가증거금액', + 'FM위험율', 'FM주문가능금액', 'FM출금가능금액', 'FM환전요청금액', 'FM출금예정금액', 'FM옵션거래대금', 'FM옵션포함자산평가금액', 'FM옵션평가금액', 'FM통화대용금액', 'FM통화대용사용금액', 'FM통화대용설정금액'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 예수금현황[해외선물-012] + + 해외선물옵션 예수금현황 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - crcy_cd (str): 통화코드 (TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남) + - inqr_dt (str): 조회일자 () + + Returns: + - DataFrame: 해외선물옵션 예수금현황 결과 + + Example: + >>> df = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="TUS", inqr_dt="20250630") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 예수금현황") + result = inquire_deposit( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + crcy_cd="TUS", # 통화코드 + inqr_dt="20250630", # 조회일자 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + # 결과 출력 + logger.info("=== 해외선물옵션 예수금현황 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/inquire_deposit.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/inquire_deposit.py new file mode 100644 index 0000000..4ad8e97 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_deposit/inquire_deposit.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황 [해외선물-012] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-deposit" + +def inquire_deposit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + inqr_dt: str, # 조회일자 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 예수금현황[해외선물-012] + 해외선물옵션 예수금현황 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + crcy_cd (str): TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남 + inqr_dt (str): 조회일자 (YYYYMMDD 형식) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 예수금현황 데이터 + + Example: + >>> df = inquire_deposit( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="KRW", + ... inqr_dt="20221214" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'KRW')") + raise ValueError("crcy_cd is required. (e.g. 'KRW')") + if not inqr_dt: + logger.error("inqr_dt is required. (e.g. '20221214')") + raise ValueError("inqr_dt is required. (e.g. '20221214')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM1411R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "INQR_DT": inqr_dt, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_deposit( + cano, + acnt_prdt_cd, + crcy_cd, + inqr_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/chk_inquire_period_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/chk_inquire_period_ccld.py new file mode 100644 index 0000000..93099aa --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/chk_inquire_period_ccld.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_period_ccld import inquire_period_ccld + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별 [해외선물-010] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'crcy_cd': '통화코드', + 'fm_buy_qty': 'FM매수수량', + 'fm_sll_qty': 'FM매도수량', + 'fm_lqd_pfls_amt': 'FM청산손익금액', + 'fm_fee': 'FM수수료', + 'fm_net_pfls_amt': 'FM순손익금액', + 'fm_ustl_buy_qty': 'FM미결제매수수량', + 'fm_ustl_sll_qty': 'FM미결제매도수량', + 'fm_ustl_evlu_pfls_amt': 'FM미결제평가손익금액', + 'fm_ustl_evlu_pfls_amt2': 'FM미결제평가손익금액2', + 'fm_ustl_evlu_pfls_icdc_amt': 'FM미결제평가손익증감금액', + 'fm_ustl_agrm_amt': 'FM미결제약정금액', + 'fm_opt_lqd_amt': 'FM옵션청산금액', + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'crcy_cd': '통화코드', + 'fm_buy_qty': 'FM매수수량', + 'fm_sll_qty': 'FM매도수량', + 'fm_lqd_pfls_amt': 'FM청산손익금액', + 'fm_fee': 'FM수수료', + 'fm_net_pfls_amt': 'FM순손익금액', + 'fm_ustl_buy_qty': 'FM미결제매수수량', + 'fm_ustl_sll_qty': 'FM미결제매도수량', + 'fm_ustl_evlu_pfls_amt': 'FM미결제평가손익금액', + 'fm_ustl_evlu_pfls_amt2': 'FM미결제평가손익금액2', + 'fm_ustl_evlu_pfls_icdc_amt': 'FM미결제평가손익증감금액', + 'fm_ccld_avg_pric': 'FM체결평균가격', + 'fm_ustl_agrm_amt': 'FM미결제약정금액', + 'fm_opt_lqd_amt': 'FM옵션청산금액' +} +NUMERIC_COLUMNS = ['FM매수수량', 'FM매도수량', 'FM청산손익금액', 'FM수수료', 'FM순손익금액', 'FM미결제매수수량', 'FM미결제매도수량', 'FM미결제평가손익금액', + 'FM미결제평가손익금액2', 'FM미결제평가손익증감금액', 'FM미결제약정금액', 'FM옵션청산금액', 'FM체결평균가격'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌손익 일별[해외선물-010] + + 해외선물옵션 기간계좌손익 일별 테스트 함수 + + Parameters: + - inqr_term_from_dt (str): 조회기간FROM일자 () + - inqr_term_to_dt (str): 조회기간TO일자 () + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - crcy_cd (str): 통화코드 ('%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본') + - whol_trsl_yn (str): 전체환산여부 (N) + - fuop_dvsn (str): 선물옵션구분 (00:전체 / 01:선물 / 02:옵션) + - ctx_area_fk200 (str): 연속조회검색조건200 () + - ctx_area_nk200 (str): 연속조회키200 () + + Returns: + - DataFrame: 해외선물옵션 기간계좌손익 일별 결과 + + Example: + >>> df1, df2 = inquire_period_ccld(inqr_term_from_dt="20250601", inqr_term_to_dt="20250630", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="%%%", whol_trsl_yn="N", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 기간계좌손익 일별") + result1, result2 = inquire_period_ccld( + inqr_term_from_dt="20250601", # 조회기간FROM일자 + inqr_term_to_dt="20250630", # 조회기간TO일자 + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + crcy_cd="%%%", # 통화코드 + whol_trsl_yn="N", # 전체환산여부 + fuop_dvsn="00", # 선물옵션구분 + ctx_area_fk200="", # 연속조회검색조건200 + ctx_area_nk200="", # 연속조회키200 + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/inquire_period_ccld.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/inquire_period_ccld.py new file mode 100644 index 0000000..c571032 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_ccld/inquire_period_ccld.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별 [해외선물-010] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-period-ccld" + +def inquire_period_ccld( + inqr_term_from_dt: str, # 조회기간FROM일자 + inqr_term_to_dt: str, # 조회기간TO일자 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + whol_trsl_yn: str, # 전체환산여부 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌손익 일별[해외선물-010] + 해외선물옵션 기간계좌손익 일별 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_term_from_dt (str): 조회기간FROM일자 + inqr_term_to_dt (str): 조회기간TO일자 + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + crcy_cd (str): '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본' + whol_trsl_yn (str): 전체환산여부 + fuop_dvsn (str): 00:전체 / 01:선물 / 02:옵션 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물옵션 기간계좌손익 일별 데이터 + + Example: + >>> df1, df2 = inquire_period_ccld( + ... inqr_term_from_dt="20250601", + ... inqr_term_to_dt="20250630", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="%%%", + ... whol_trsl_yn="N", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not inqr_term_from_dt: + logger.error("inqr_term_from_dt is required. (e.g. '20250601')") + raise ValueError("inqr_term_from_dt is required. (e.g. '20250601')") + if not inqr_term_to_dt: + logger.error("inqr_term_to_dt is required. (e.g. '20250630')") + raise ValueError("inqr_term_to_dt is required. (e.g. '20250630')") + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%')") + raise ValueError("crcy_cd is required. (e.g. '%%%')") + if not whol_trsl_yn: + logger.error("whol_trsl_yn is required. (e.g. 'N')") + raise ValueError("whol_trsl_yn is required. (e.g. 'N')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "OTFM3118R" + + params = { + "INQR_TERM_FROM_DT": inqr_term_from_dt, + "INQR_TERM_TO_DT": inqr_term_to_dt, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "WHOL_TRSL_YN": whol_trsl_yn, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_ccld( + inqr_term_from_dt, + inqr_term_to_dt, + cano, + acnt_prdt_cd, + crcy_cd, + whol_trsl_yn, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/chk_inquire_period_trans.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/chk_inquire_period_trans.py new file mode 100644 index 0000000..1ae915e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/chk_inquire_period_trans.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_period_trans import inquire_period_trans + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역 [해외선물-014] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'bass_dt': '기준일자', + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'fm_ldgr_inog_seq': 'FM원장출납순번', + 'crcy_cd': '통화코드', + 'fm_iofw_amt': 'FM입출금액', + 'fm_fee': 'FM수수료', + 'fm_tax_amt': 'FM세금금액', + 'fm_sttl_amt': 'FM결제금액', + 'fm_bf_dncl_amt': 'FM이전예수금액', + 'fm_dncl_amt': 'FM예수금액', + 'fm_rcvb_occr_amt': 'FM미수발생금액', + 'fm_rcvb_pybk_amt': 'FM미수변제금액', + 'ovdu_int_pybk_amt': '연체이자변제금액', + 'rmks_text': '비고내용' +} +NUMERIC_COLUMNS = ['FM입출금액', 'FM수수료', 'FM세금금액', 'FM결제금액', 'FM이전예수금액', 'FM예수금액', 'FM미수발생금액', 'FM미수변제금액', '연체이자변제금액'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌거래내역[해외선물-014] + + 해외선물옵션 기간계좌거래내역 테스트 함수 + + Parameters: + - inqr_term_from_dt (str): 조회기간FROM일자 () + - inqr_term_to_dt (str): 조회기간TO일자 () + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - acnt_tr_type_cd (str): 계좌거래유형코드 (1: 전체, 2:입출금 , 3: 결제) + - crcy_cd (str): 통화코드 ('%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남 ') + - ctx_area_fk100 (str): 연속조회검색조건100 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)) + - ctx_area_nk100 (str): 연속조회키100 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)) + - pwd_chk_yn (str): 비밀번호체크여부 (공란(Default)) + + Returns: + - DataFrame: 해외선물옵션 기간계좌거래내역 결과 + + Example: + >>> df = inquire_period_trans(inqr_term_from_dt="20250101", inqr_term_to_dt="20250131", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acnt_tr_type_cd="1", crcy_cd="%%%", ctx_area_fk100="", ctx_area_nk100="", pwd_chk_yn="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 기간계좌거래내역") + result = inquire_period_trans( + inqr_term_from_dt="20250601", # 조회기간FROM일자 + inqr_term_to_dt="20250630", # 조회기간TO일자 + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + acnt_tr_type_cd="1", # 계좌거래유형코드 + crcy_cd="%%%", # 통화코드 + ctx_area_fk100="", # 연속조회검색조건100 + ctx_area_nk100="", # 연속조회키100 + pwd_chk_yn="N", # 비밀번호체크여부 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 기간계좌거래내역 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/inquire_period_trans.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/inquire_period_trans.py new file mode 100644 index 0000000..df7e78e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_period_trans/inquire_period_trans.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역 [해외선물-014] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-period-trans" + +def inquire_period_trans( + inqr_term_from_dt: str, # 조회기간FROM일자 + inqr_term_to_dt: str, # 조회기간TO일자 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + acnt_tr_type_cd: str, # 계좌거래유형코드 + crcy_cd: str, # 통화코드 + ctx_area_fk100: str, # 연속조회검색조건100 + ctx_area_nk100: str, # 연속조회키100 + pwd_chk_yn: str, # 비밀번호체크여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌거래내역[해외선물-014] + 해외선물옵션 기간계좌거래내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_term_from_dt (str): 조회기간FROM일자 (예: '20220101') + inqr_term_to_dt (str): 조회기간TO일자 (예: '20221214') + cano (str): 계좌번호 체계(8-2)의 앞 8자리 (예: '80012345') + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 (예: '08') + acnt_tr_type_cd (str): 계좌거래유형코드 (1: 전체, 2:입출금 , 3: 결제) + crcy_cd (str): 통화코드 ('%%%': 전체, 'TUS': TOT_USD, 'TKR': TOT_KRW, 'KRW': 한국, 'USD': 미국, 'EUR': EUR, 'HKD': 홍콩, 'CNY': 중국, 'JPY': 일본, 'VND': 베트남) + ctx_area_fk100 (str): 연속조회검색조건100 + ctx_area_nk100 (str): 연속조회키100 + pwd_chk_yn (str): 비밀번호체크여부 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 기간계좌거래내역 데이터 + + Example: + >>> df = inquire_period_trans( + ... inqr_term_from_dt="20220101", + ... inqr_term_to_dt="20221214", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... acnt_tr_type_cd="%%", + ... crcy_cd="%%%", + ... ctx_area_fk100="", + ... ctx_area_nk100="", + ... pwd_chk_yn="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not inqr_term_from_dt: + logger.error("inqr_term_from_dt is required. (e.g. '20220101')") + raise ValueError("inqr_term_from_dt is required. (e.g. '20220101')") + if not inqr_term_to_dt: + logger.error("inqr_term_to_dt is required. (e.g. '20221214')") + raise ValueError("inqr_term_to_dt is required. (e.g. '20221214')") + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not acnt_tr_type_cd: + logger.error("acnt_tr_type_cd is required. (e.g. '%%')") + raise ValueError("acnt_tr_type_cd is required. (e.g. '%%')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%')") + raise ValueError("crcy_cd is required. (e.g. '%%%')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + tr_id = "OTFM3114R" + + params = { + "INQR_TERM_FROM_DT": inqr_term_from_dt, + "INQR_TERM_TO_DT": inqr_term_to_dt, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ACNT_TR_TYPE_CD": acnt_tr_type_cd, + "CRCY_CD": crcy_cd, + "CTX_AREA_FK100": ctx_area_fk100, + "CTX_AREA_NK100": ctx_area_nk100, + "PWD_CHK_YN": pwd_chk_yn, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_trans( + inqr_term_from_dt, + inqr_term_to_dt, + cano, + acnt_prdt_cd, + acnt_tr_type_cd, + crcy_cd, + ctx_area_fk100, + ctx_area_nk100, + pwd_chk_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/chk_inquire_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/chk_inquire_price.py new file mode 100644 index 0000000..0c28a3f --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/chk_inquire_price.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_price import inquire_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목현재가 [v1_해외선물-009] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'proc_date': '최종처리일자', + 'high_price': '고가', + 'proc_time': '최종처리시각', + 'open_price': '시가', + 'trst_mgn': '증거금', + 'low_price': '저가', + 'last_price': '현재가', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율', + 'bid_qntt': '매수1수량', + 'bid_price': '매수1호가', + 'ask_qntt': '매도1수량', + 'ask_price': '매도1호가', + 'prev_price': '전일종가', + 'exch_cd': '거래소코드', + 'crc_cd': '거래통화', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'last_qntt': '체결량', + 'tot_ask_qntt': '총매도잔량', + 'tot_bid_qntt': '총매수잔량', + 'tick_size': '틱사이즈', + 'open_date': '장개시일자', + 'open_time': '장개시시각', + 'close_date': '장종료일자', + 'close_time': '장종료시각', + 'sbsnsdate': '영업일자', + 'sttl_price': '정산가' +} + +NUMERIC_COLUMNS = ['고가', '시가', '저가', '현재가', '누적거래수량', '전일대비가격', '전일대비율', '매수1수량', '매수1호가', '매도1수량', '매도1호가', + '전일종가', '증거금', '체결량', '총매도잔량', '총매수잔량', '틱사이즈', '정산가'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물종목현재가[v1_해외선물-009] + + 해외선물종목현재가 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (ex) BONU25 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고) + + Returns: + - DataFrame: 해외선물종목현재가 결과 + + Example: + >>> df = inquire_price(srs_cd="BONU25") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # 해외선물종목현재가 파라미터 설정 + logger.info("API 파라미터 설정 중...") + srs_cd = "BONU25" # 종목코드 + + + # API 호출 + logger.info("API 호출 시작: 해외선물종목현재가") + result = inquire_price( + srs_cd=srs_cd, # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물종목현재가 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/inquire_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/inquire_price.py new file mode 100644 index 0000000..2472578 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_price/inquire_price.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목현재가 [v1_해외선물-009] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/inquire-price" + +def inquire_price( + srs_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물종목현재가[v1_해외선물-009] + 해외선물종목현재가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: CNHU24) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물종목현재가 데이터 + + Example: + >>> df = inquire_price(srs_cd="CNHU24") + >>> print(df) + """ + # 필수 파라미터 검증 + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'CNHU24')") + raise ValueError("srs_cd is required. (e.g. 'CNHU24')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55010000" + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_price( + srs_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/chk_inquire_psamount.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/chk_inquire_psamount.py new file mode 100644 index 0000000..5b37fa6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/chk_inquire_psamount.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_psamount import inquire_psamount + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 [v1_해외선물-006] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'crcy_cd': '통화코드', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'fm_ustl_qty': 'FM미결제수량', + 'fm_lqd_psbl_qty': 'FM청산가능수량', + 'fm_new_ord_psbl_qty': 'FM신규주문가능수량', + 'fm_tot_ord_psbl_qty': 'FM총주문가능수량', + 'fm_mkpr_tot_ord_psbl_qty': 'FM시장가총주문가능수량' +} +NUMERIC_COLUMNS = ['FM미결제수량', 'FM청산가능수량', 'FM신규주문가능수량', 'FM총주문가능수량', 'FM시장가총주문가능수량'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문가능조회[v1_해외선물-006] + + 해외선물옵션 주문가능조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_futr_fx_pdno (str): 해외선물FX상품번호 () + - sll_buy_dvsn_cd (str): 매도매수구분코드 (01 : 매도 / 02 : 매수) + - fm_ord_pric (str): FM주문가격 (N) + - ecis_rsvn_ord_yn (str): 행사예약주문여부 (N) + + Returns: + - DataFrame: 해외선물옵션 주문가능조회 결과 + + Example: + >>> df = inquire_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_futr_fx_pdno="6AU22", sll_buy_dvsn_cd="02", fm_ord_pric="", ecis_rsvn_ord_yn="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출 시작: 해외선물옵션 주문가능조회") + result = inquire_psamount( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_futr_fx_pdno="6AU22", # 해외선물FX상품번호 + sll_buy_dvsn_cd="02", # 매도매수구분코드 + fm_ord_pric="", # FM주문가격 + ecis_rsvn_ord_yn="", # 행사예약주문여부 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 주문가능조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/inquire_psamount.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/inquire_psamount.py new file mode 100644 index 0000000..0106c14 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_psamount/inquire_psamount.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 [v1_해외선물-006] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-psamount" + +def inquire_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_futr_fx_pdno: str, # 해외선물FX상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fm_ord_pric: str, # FM주문가격 + ecis_rsvn_ord_yn: str, # 행사예약주문여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문가능조회[v1_해외선물-006] + 해외선물옵션 주문가능조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_futr_fx_pdno (str): 해외선물FX상품번호 + sll_buy_dvsn_cd (str): 01 : 매도 / 02 : 매수 + fm_ord_pric (str): FM주문가격 + ecis_rsvn_ord_yn (str): 행사예약주문여부 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 주문가능조회 데이터 + + Example: + >>> df = inquire_psamount( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_futr_fx_pdno="6AU22", + ... sll_buy_dvsn_cd="02", + ... fm_ord_pric="", + ... ecis_rsvn_ord_yn="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ovrs_futr_fx_pdno: + logger.error("ovrs_futr_fx_pdno is required. (e.g. '6AU22')") + raise ValueError("ovrs_futr_fx_pdno is required. (e.g. '6AU22')") + if sll_buy_dvsn_cd not in ["01", "02"]: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01' or '02')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01' or '02')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3304R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_FUTR_FX_PDNO": ovrs_futr_fx_pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FM_ORD_PRIC": fm_ord_pric, + "ECIS_RSVN_ORD_YN": ecis_rsvn_ord_yn, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psamount( + cano, + acnt_prdt_cd, + ovrs_futr_fx_pdno, + sll_buy_dvsn_cd, + fm_ord_pric, + ecis_rsvn_ord_yn, + dataframe, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/chk_inquire_time_futurechartprice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/chk_inquire_time_futurechartprice.py new file mode 100644 index 0000000..6eed573 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/chk_inquire_time_futurechartprice.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_futurechartprice import inquire_time_futurechartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 분봉조회[해외선물-016] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} +NUMERIC_COLUMNS = ['전일대비구분', '전일대비가격', '전일대비율', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 분봉조회[해외선물-016] + + 해외선물 분봉조회 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (ex) BONU25 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고) + - exch_cd (str): 거래소코드 (EUREX) + - start_date_time (str): 조회시작일시 (공백) + - close_date_time (str): 조회종료일시 (ex) 20230823) + - qry_tp (str): 조회구분 (Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시) + - qry_cnt (str): 요청개수 (120 (조회갯수)) + - qry_gap (str): 묶음개수 (5 (분간격)) + - index_key (str): 이전조회KEY (다음조회(QRY_TP를 P로 입력) 시, 이전 호출의 "output1 > index_key" 기입하여 조회) + + Returns: + - DataFrame: 해외선물 분봉조회 결과 + + Example: + >>> df1, df2 = inquire_time_futurechartprice(srs_cd="BONU25", exch_cd="EUREX", start_date_time="20250101", close_date_time="20250702", qry_tp="", qry_cnt="120", qry_gap="5", index_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + + # API 호출 + logger.info("API 호출 시작: 해외선물 분봉조회") + result1, result2 = inquire_time_futurechartprice( + srs_cd="BONU25", # 종목코드 + exch_cd="EUREX", # 거래소코드 + start_date_time="20250101", # 조회시작일시 + close_date_time="20250701", # 조회종료일시 + qry_tp="Q", # 조회구분 + qry_cnt="120", # 요청개수 + qry_gap="1", # 묶음개수 + index_key="", # 이전조회KEY + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/inquire_time_futurechartprice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/inquire_time_futurechartprice.py new file mode 100644 index 0000000..5906a13 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_futurechartprice/inquire_time_futurechartprice.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 분봉조회[해외선물-016] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice" + +def inquire_time_futurechartprice( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 분봉조회[해외선물-016] + 해외선물 분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): ex) CNHU24 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고 + exch_cd (str): CME + start_date_time (str): 공백 + close_date_time (str): ex) 20230823 + qry_tp (str): Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시 + qry_cnt (str): 120 (조회갯수) + qry_gap (str): 5 (분간격) + index_key (str): 다음조회(QRY_TP를 P로 입력) 시, 이전 호출의 "output1 > index_key" 기입하여 조회 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_futurechartprice( + ... srs_cd="BONU25", + ... exch_cd="EUREX", + ... start_date_time="20250101", + ... close_date_time="20250702", + ... qry_tp="Q", + ... qry_cnt="120", + ... qry_gap="1", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'BONU25')") + raise ValueError("srs_cd is required. (e.g. 'BONU25')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'EUREX')") + raise ValueError("exch_cd is required. (e.g. 'EUREX')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20250702')") + raise ValueError("close_date_time is required. (e.g. '20250702')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '120')") + raise ValueError("qry_cnt is required. (e.g. '120')") + if not qry_gap: + logger.error("qry_gap is required. (e.g. '1', '5', '10', '15', '30', '60')") + raise ValueError("qry_gap is required. (e.g. '1', '5', '10', '15', '30', '60')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020400" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output2["index_key"] + qry_tp = "P" + + print("index _key", index_key, "//" ) + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_futurechartprice( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/chk_inquire_time_optchartprice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/chk_inquire_time_optchartprice.py new file mode 100644 index 0000000..c820716 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/chk_inquire_time_optchartprice.py @@ -0,0 +1,95 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_time_optchartprice import inquire_time_optchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 분봉조회 [해외선물-040] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시간', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '전일대비구분', '전일대비가격', '전일대비율', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량'] + +def main(): + """ + 해외옵션 분봉조회 테스트 함수 + + 이 함수는 해외옵션 분봉조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 DXM24 (ICE 거래소)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = inquire_time_optchartprice(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + result2 = result2.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/inquire_time_optchartprice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/inquire_time_optchartprice.py new file mode 100644 index 0000000..0e8b9db --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_time_optchartprice/inquire_time_optchartprice.py @@ -0,0 +1,151 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 분봉조회 [해외선물-040] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/inquire-time-optchartprice" + +def inquire_time_optchartprice( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 분봉조회 API입니다. + 한 번의 호출에 120건까지 확인 가능하며, QRY_TP, INDEX_KEY 를 이용하여 다음조회 가능합니다. + + ※ 다음조회 방법 + (처음조회) "QRY_TP":"Q", "QRY_CNT":"120", "INDEX_KEY":"" + (다음조회) "QRY_TP":"P", "QRY_CNT":"120", "INDEX_KEY":"20240902 5" ◀ 이전 호출의 "output1 > index_key" 기입 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 DataFrame, output2 DataFrame) + + Example: + >>> df1, df2 = inquire_time_optchartprice("OESU24 C5500", "CME", "20") + >>> print(df1) + >>> print(df2) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None and dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return (dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame()) + + tr_id = "HHDFO55020100" # 해외옵션 분봉조회 + + params = { + "SRS_CD": srs_cd, # 종목코드 + "EXCH_CD": exch_cd, # 거래소코드 + "QRY_CNT": qry_cnt, # 요청개수 + "START_DATE_TIME": start_date_time, # 조회시작일시 + "CLOSE_DATE_TIME": close_date_time, # 조회종료일시 + "QRY_GAP": qry_gap, # 묶음개수 + "QRY_TP": qry_tp, # 조회구분 + "INDEX_KEY": index_key # 이전조회KEY + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_time_optchartprice( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/chk_inquire_unpd.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/chk_inquire_unpd.py new file mode 100644 index 0000000..ac8492f --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/chk_inquire_unpd.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_unpd import inquire_unpd + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) [v1_해외선물-005] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'ovrs_futr_fx_pdno': '해외선물FX상품번호', + 'prdt_type_cd': '상품유형코드', + 'crcy_cd': '통화코드', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'fm_ustl_qty': 'FM미결제수량', + 'fm_ccld_avg_pric': 'FM체결평균가격', + 'fm_now_pric': 'FM현재가격', + 'fm_evlu_pfls_amt': 'FM평가손익금액', + 'fm_opt_evlu_amt': 'FM옵션평가금액', + 'fm_otp_evlu_pfls_amt': 'FM옵션평가손익금액', + 'fuop_dvsn': '선물옵션구분', + 'ecis_rsvn_ord_yn': '행사예약주문여부', + 'fm_lqd_psbl_qty': 'FM청산가능수량' +} + +NUMERIC_COLUMNS = ['FM미결제수량', 'FM체결평균가격', 'FM현재가격', 'FM평가손익금액', 'FM옵션평가금액', 'FM옵션평가손익금액', 'FM청산가능수량'] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 미결제내역조회(잔고)[v1_해외선물-005] + + 해외선물옵션 미결제내역조회(잔고) 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - fuop_dvsn (str): 선물옵션구분 (00: 전체 / 01:선물 / 02: 옵션) + - ctx_area_fk100 (str): 연속조회검색조건100 () + - ctx_area_nk100 (str): 연속조회키100 () + + Returns: + - DataFrame: 해외선물옵션 미결제내역조회(잔고) 결과 + + Example: + >>> df = inquire_unpd(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, fuop_dvsn="00", ctx_area_fk100="", ctx_area_nk100="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = inquire_unpd( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + fuop_dvsn="00", + ctx_area_fk100="", + ctx_area_nk100="" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 미결제내역조회(잔고) 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/inquire_unpd.py b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/inquire_unpd.py new file mode 100644 index 0000000..431e011 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/inquire_unpd/inquire_unpd.py @@ -0,0 +1,128 @@ +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) [v1_해외선물-005] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/trading/inquire-unpd" + +def inquire_unpd( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk100: str, # 연속조회검색조건100 + ctx_area_nk100: str, # 연속조회키100 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 미결제내역조회(잔고)[v1_해외선물-005] + 해외선물옵션 미결제내역조회(잔고) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + fuop_dvsn (str): 00: 전체 / 01:선물 / 02: 옵션 + ctx_area_fk100 (str): 연속조회검색조건100 + ctx_area_nk100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 미결제내역조회(잔고) 데이터 + + Example: + >>> df = inquire_unpd( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... fuop_dvsn="00", + ... ctx_area_fk100="", + ... ctx_area_nk100="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if fuop_dvsn not in ['00', '01', '02']: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM1412R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK100": ctx_area_fk100, + "CTX_AREA_NK100": ctx_area_nk100, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_unpd( + cano, + acnt_prdt_cd, + fuop_dvsn, + ctx_area_fk100, + ctx_area_nk100, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/chk_investor_unpd_trend.py b/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/chk_investor_unpd_trend.py new file mode 100644 index 0000000..311aff4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/chk_investor_unpd_trend.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from investor_unpd_trend import investor_unpd_trend + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [v1_해외선물-029] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'row_cnt': '응답레코드카운트', + 'prod_iscd': '상품', + 'cftc_iscd': 'CFTC코드', + 'bsop_date': '일자', + 'bidp_spec': '매수투기', + 'askp_spec': '매도투기', + 'spread_spec': '스프레드투기', + 'bidp_hedge': '매수헤지', + 'askp_hedge': '매도헤지', + 'hts_otst_smtn': '미결제합계', + 'bidp_missing': '매수누락', + 'askp_missing': '매도누락', + 'bidp_spec_cust': '매수투기고객', + 'askp_spec_cust': '매도투기고객', + 'spread_spec_cust': '스프레드투기고객', + 'bidp_hedge_cust': '매수헤지고객', + 'askp_hedge_cust': '매도헤지고객', + 'cust_smtn': '고객합계' +} + +NUMERIC_COLUMNS = ['응답레코드카운트', '매수투기', '매도투기', '스프레드투기', '매수헤지', '매도헤지', '미결제합계', + '매수누락', '매도누락', '매수투기고객', '매도투기고객', '스프레드투기고객', '매수헤지고객', + '매도헤지고객', '고객합계'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 미결제추이[해외선물-029] + + 해외선물 미결제추이 테스트 함수 + + Parameters: + - prod_iscd (str): 상품 (금리 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG), 농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX)) + - bsop_date (str): 일자 (기준일(ex)20240513)) + - upmu_gubun (str): 구분 (0(수량), 1(증감)) + - cts_key (str): CTS_KEY (공백) + + Returns: + - DataFrame: 해외선물 미결제추이 결과 + + Example: + >>> df1, df2 = investor_unpd_trend(prod_iscd="GE", bsop_date="20240513", upmu_gubun="0", cts_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + logger.info("API 호출") + result1, result2 = investor_unpd_trend( + prod_iscd="CL", + bsop_date="20250630", + upmu_gubun="0", + cts_key="" + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/investor_unpd_trend.py b/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/investor_unpd_trend.py new file mode 100644 index 0000000..76bb3d3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/investor_unpd_trend/investor_unpd_trend.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [해외선물-029] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/investor-unpd-trend" + +def investor_unpd_trend( + prod_iscd: str, # 상품 + bsop_date: str, # 일자 + upmu_gubun: str, # 구분 + cts_key: str, # CTS_KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 미결제추이[해외선물-029] + 해외선물 미결제추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prod_iscd (str): 금리 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG), 농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX) + bsop_date (str): 기준일(ex)20240513) + upmu_gubun (str): 0(수량), 1(증감) + cts_key (str): 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 미결제추이 데이터 + + Example: + >>> df1, df2 = investor_unpd_trend( + ... prod_iscd="ES", + ... bsop_date="20240624", + ... upmu_gubun="0", + ... cts_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not prod_iscd: + logger.error("prod_iscd is required. (e.g. 'ES')") + raise ValueError("prod_iscd is required. (e.g. 'ES')") + if not bsop_date: + logger.error("bsop_date is required. (e.g. '20240624')") + raise ValueError("bsop_date is required. (e.g. '20240624')") + if not upmu_gubun: + logger.error("upmu_gubun is required. (e.g. '0')") + raise ValueError("upmu_gubun is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDDB95030000" + + params = { + "PROD_ISCD": prod_iscd, + "BSOP_DATE": bsop_date, + "UPMU_GUBUN": upmu_gubun, + "CTS_KEY": cts_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return investor_unpd_trend( + prod_iscd, + bsop_date, + upmu_gubun, + cts_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/chk_margin_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/chk_margin_detail.py new file mode 100644 index 0000000..e5c5d42 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/chk_margin_detail.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from margin_detail import margin_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 증거금상세 [해외선물-032] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'crcy_cd': '통화코드', + 'resp_dt': '응답일자', + 'acnt_net_risk_mgna_aply_yn': '계좌순위험증거금적용여부', + 'fm_ord_psbl_amt': 'FM주문가능금액', + 'fm_add_mgn_amt': 'FM추가증거금액', + 'fm_brkg_mgn_amt': 'FM위탁증거금액', + 'fm_excc_brkg_mgn_amt': 'FM정산위탁증거금액', + 'fm_ustl_mgn_amt': 'FM미결제증거금액', + 'fm_mntn_mgn_amt': 'FM유지증거금액', + 'fm_ord_mgn_amt': 'FM주문증거금액', + 'fm_futr_ord_mgn_amt': 'FM선물주문증거금액', + 'fm_opt_buy_ord_amt': 'FM옵션매수주문금액', + 'fm_opt_sll_ord_mgn_amt': 'FM옵션매도주문증거금액', + 'fm_opt_buy_ord_mgn_amt': 'FM옵션매수주문증거금액', + 'fm_ecis_rsvn_mgn_amt': 'FM행사예약증거금액', + 'fm_span_brkg_mgn_amt': 'FMSPAN위탁증거금액', + 'fm_span_pric_altr_mgn_amt': 'FMSPAN가격변동증거금액', + 'fm_span_term_sprd_mgn_amt': 'FMSPAN기간스프레드증거금액', + 'fm_span_buy_opt_min_mgn_amt': 'FMSPAN옵션가격증거금액', + 'fm_span_opt_min_mgn_amt': 'FMSPAN옵션최소증거금액', + 'fm_span_tot_risk_mgn_amt': 'FMSPAN총위험증거금액', + 'fm_span_mntn_mgn_amt': 'FMSPAN유지증거금액', + 'fm_span_mntn_pric_altr_mgn_amt': 'FMSPAN유지가격변동증거금액', + 'fm_span_mntn_term_sprd_mgn_amt': 'FMSPAN유지기간스프레드증거금액', + 'fm_span_mntn_opt_pric_mgn_amt': 'FMSPAN유지옵션가격증거금액', + 'fm_span_mntn_opt_min_mgn_amt': 'FMSPAN유지옵션최소증거금액', + 'fm_span_mntn_tot_risk_mgn_amt': 'FMSPAN유지총위험증거금액', + 'fm_eurx_brkg_mgn_amt': 'FMEUREX위탁증거금액', + 'fm_eurx_pric_altr_mgn_amt': 'FMEUREX가격변동증거금액', + 'fm_eurx_term_sprd_mgn_amt': 'FMEUREX기간스프레드증거금액', + 'fm_eurx_opt_pric_mgn_amt': 'FMEUREX옵션가격증거금액', + 'fm_eurx_buy_opt_min_mgn_amt': 'FMEUREX매수옵션최소증거금액', + 'fm_eurx_tot_risk_mgn_amt': 'FMEUREX총위험증거금액', + 'fm_eurx_mntn_mgn_amt': 'FMEUREX유지증거금액', + 'fm_eurx_mntn_pric_altr_mgn_amt': 'FMEUREX유지가격변동증거금액', + 'fm_eurx_mntn_term_sprd_mgn_amt': 'FMEUREX기간스프레드증거금액', + 'fm_eurx_mntn_opt_pric_mgn_amt': 'FMEUREX유지옵션가격증거금액', + 'fm_eurx_mntn_tot_risk_mgn_amt': 'FMEUREX유지총위험증거금액', + 'fm_gnrl_brkg_mgn_amt': 'FM일반위탁증거금액', + 'fm_futr_ustl_mgn_amt': 'FM선물미결제증거금액', + 'fm_sll_opt_ustl_mgn_amt': 'FM매도옵션미결제증거금액', + 'fm_buy_opt_ustl_mgn_amt': 'FM매수옵션미결제증거금액', + 'fm_sprd_ustl_mgn_amt': 'FM스프레드미결제증거금액', + 'fm_avg_dsct_mgn_amt': 'FMAVG할인증거금액', + 'fm_gnrl_mntn_mgn_amt': 'FM일반유지증거금액', + 'fm_futr_mntn_mgn_amt': 'FM선물유지증거금액', + 'fm_opt_mntn_mgn_amt': 'FM옵션유지증거금액' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 증거금상세[해외선물-032] + + 해외선물옵션 증거금상세 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + - crcy_cd (str): 통화코드 ('TKR(TOT_KRW), TUS(TOT_USD), USD(미국달러), HKD(홍콩달러), CNY(중국위안화), JPY )일본엔화), VND(베트남동)') + - inqr_dt (str): 조회일자 () + + Returns: + - DataFrame: 해외선물옵션 증거금상세 결과 + + Example: + >>> df = margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="USD", inqr_dt="20250701") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = margin_detail( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + crcy_cd="TKR", + inqr_dt="20250625" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 증거금상세 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/margin_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/margin_detail.py new file mode 100644 index 0000000..8591dcf --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/margin_detail/margin_detail.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 증거금상세 [해외선물-032] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/trading/margin-detail" + +def margin_detail( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + inqr_dt: str, # 조회일자 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 증거금상세[해외선물-032] + 해외선물옵션 증거금상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (8자리) + acnt_prdt_cd (str): 계좌상품코드 (2자리) + crcy_cd (str): 통화코드 ('TKR', 'TUS', 'USD', 'HKD', 'CNY', 'JPY', 'VND') + inqr_dt (str): 조회일자 (8자리, YYYYMMDD 형식) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 증거금상세 데이터 + + Example: + >>> df = margin_detail( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="USD", + ... inqr_dt="20230701" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'USD')") + raise ValueError("crcy_cd is required. (e.g. 'USD')") + if not inqr_dt: + logger.error("inqr_dt is required. (e.g. '20230701')") + raise ValueError("inqr_dt is required. (e.g. '20230701')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3115R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "INQR_DT": inqr_dt, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return margin_detail( + cano, + acnt_prdt_cd, + crcy_cd, + inqr_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/chk_market_time.py b/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/chk_market_time.py new file mode 100644 index 0000000..804504f --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/chk_market_time.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from market_time import market_time + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물옵션 장운영시간 [해외선물-030] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'fm_pdgr_cd': 'FM상품군코드', + 'fm_pdgr_name': 'FM상품군명', + 'fm_excg_cd': 'FM거래소코드', + 'fm_excg_name': 'FM거래소명', + 'fuop_dvsn_name': '선물옵션구분명', + 'fm_clas_cd': 'FM클래스코드', + 'fm_clas_name': 'FM클래스명', + 'am_mkmn_strt_tmd': '오전장운영시작시각', + 'am_mkmn_end_tmd': '오전장운영종료시각', + 'pm_mkmn_strt_tmd': '오후장운영시작시각', + 'pm_mkmn_end_tmd': '오후장운영종료시각', + 'mkmn_nxdy_strt_tmd': '장운영익일시작시각', + 'mkmn_nxdy_end_tmd': '장운영익일종료시각', + 'base_mket_strt_tmd': '기본시장시작시각', + 'base_mket_end_tmd': '기본시장종료시각' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물옵션 장운영시간[해외선물-030] + + 해외선물옵션 장운영시간 테스트 함수 + + Parameters: + - fm_pdgr_cd (str): FM상품군코드 (공백) + - fm_clas_cd (str): FM클래스코드 ('공백(전체), 001(통화), 002(금리), 003(지수), 004(농산물),005(축산물),006(금속),007(에너지)') + - fm_excg_cd (str): FM거래소코드 ('CME(CME), EUREX(EUREX), HKEx(HKEx), ICE(ICE), SGX(SGX), OSE(OSE), ASX(ASX), CBOE(CBOE), MDEX(MDEX), NYSE(NYSE), BMF(BMF),FTX(FTX), HNX(HNX), ETC(기타)') + - opt_yn (str): 옵션여부 (%(전체), N(선물), Y(옵션)) + - ctx_area_nk200 (str): 연속조회키200 () + - ctx_area_fk200 (str): 연속조회검색조건200 () + + Returns: + - DataFrame: 해외선물옵션 장운영시간 결과 + + Example: + >>> df = market_time(fm_pdgr_cd="", fm_clas_cd="", fm_excg_cd="CME", opt_yn="N", ctx_area_nk200="", ctx_area_fk200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + logger.info("API 호출") + result = market_time( + fm_pdgr_cd="", + fm_clas_cd="", + fm_excg_cd="CME", + opt_yn="%", + ctx_area_nk200="", + ctx_area_fk200="" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 장운영시간 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/market_time.py b/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/market_time.py new file mode 100644 index 0000000..77a10f3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/market_time/market_time.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물옵션 장운영시간 [해외선물-030] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/market-time" + +def market_time( + fm_pdgr_cd: str, # FM상품군코드 + fm_clas_cd: str, # FM클래스코드 + fm_excg_cd: str, # FM거래소코드 + opt_yn: str, # 옵션여부 + ctx_area_nk200: str, # 연속조회키200 + ctx_area_fk200: str, # 연속조회검색조건200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물옵션 장운영시간[해외선물-030] + 해외선물옵션 장운영시간 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fm_pdgr_cd (str): FM상품군코드 + fm_clas_cd (str): FM클래스코드 + fm_excg_cd (str): FM거래소코드 + opt_yn (str): 옵션여부 + ctx_area_nk200 (str): 연속조회키200 + ctx_area_fk200 (str): 연속조회검색조건200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 장운영시간 데이터 + + Example: + >>> df = market_time( + ... fm_pdgr_cd="001", + ... fm_clas_cd="003", + ... fm_excg_cd="CME", + ... opt_yn="N", + ... ctx_area_nk200="", + ... ctx_area_fk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not fm_excg_cd: + logger.error("fm_excg_cd is required. (e.g. 'CME')") + raise ValueError("fm_excg_cd is required. (e.g. 'CME')") + if not opt_yn: + logger.error("opt_yn is required. (e.g. 'N')") + raise ValueError("opt_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM2229R" + + params = { + "FM_PDGR_CD": fm_pdgr_cd, + "FM_CLAS_CD": fm_clas_cd, + "FM_EXCG_CD": fm_excg_cd, + "OPT_YN": opt_yn, + "CTX_AREA_NK200": ctx_area_nk200, + "CTX_AREA_FK200": ctx_area_fk200, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, ctx_area_nk200, ctx_area_fk200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return market_time( + fm_pdgr_cd, + fm_clas_cd, + fm_excg_cd, + opt_yn, + ctx_area_nk200, + ctx_area_fk200, + "N", + dataframe, + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/chk_monthly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/chk_monthly_ccnl.py new file mode 100644 index 0000000..88c9608 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/chk_monthly_ccnl.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from monthly_ccnl import monthly_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'tret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '전일대비구분', '전일대비가격', '전일대비율', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량',] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(월간)[해외선물-020] + + 해외선물 체결추이(월간) 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (예) 6AM24) + - exch_cd (str): 거래소코드 (예) CME) + - start_date_time (str): 조회시작일시 (공백) + - close_date_time (str): 조회종료일시 (예) 20240402) + - qry_tp (str): 조회구분 (Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시) + - qry_cnt (str): 요청개수 (예) 30 (최대 40)) + - qry_gap (str): 묶음개수 (공백 (분만 사용)) + - index_key (str): 이전조회KEY (공백) + + Returns: + - DataFrame: 해외선물 체결추이(월간) 결과 + + Example: + >>> df1, df2 = monthly_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + + # API 호출 + logger.info("API 호출 시작: 해외선물 체결추이(월간)") + result1, result2 = monthly_ccnl( + srs_cd="6AM24", # 종목코드 + exch_cd="CME", # 거래소코드 + start_date_time="", # 조회시작일시 + close_date_time="20240402", # 조회종료일시 + qry_tp="Q", # 조회구분 + qry_cnt="30", # 요청개수 + qry_gap="", # 묶음개수 + index_key="", # 이전조회KEY + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/monthly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/monthly_ccnl.py new file mode 100644 index 0000000..5396b9a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/monthly_ccnl/monthly_ccnl.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/monthly-ccnl" + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] +############################################################################################## + +def monthly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(월간)[해외선물-020] + 해외선물 체결추이(월간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: '6AM24') + exch_cd (str): 거래소코드 (예: 'CME') + start_date_time (str): 조회시작일시 (공백 허용) + close_date_time (str): 조회종료일시 (예: '20240402') + qry_tp (str): 조회구분 ('Q': 최초조회, 'P': 다음키 입력하여 조회) + qry_cnt (str): 요청개수 (예: '30', 최대 '40') + qry_gap (str): 묶음개수 (공백 허용) + index_key (str): 이전조회KEY (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(월간) 데이터 + + Example: + >>> df1, df2 = monthly_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. ('Q' or 'P')") + raise ValueError("qry_tp is required. ('Q' or 'P')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + url = API_URL + tr_id = "HHDFC55020300" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return monthly_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/chk_opt_asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/chk_opt_asking_price.py new file mode 100644 index 0000000..7a795ff --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/chk_opt_asking_price.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from opt_asking_price import opt_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'open_price': '시가', + 'high_price': '고가', + 'lowp_rice': '저가', + 'last_price': '현재가', + 'sttl_price': '정산가', + 'vol': '거래량', + 'prev_diff_price': '전일대비가', + 'prev_diff_rate': '전일대비율', + 'quot_date': '호가수신일자', + 'quot_time': '호가수신시각', + 'bid_qntt': '매수수량', + 'bid_num': '매수번호', + 'bid_price': '매수호가', + 'ask_qntt': '매도수량', + 'ask_num': '매도번호', + 'ask_price': '매도호가' +} + +NUMERIC_COLUMNS = ['시가', '고가', '저가', '현재가', '정산가', '거래량', '전일대비가', '전일대비율', + '매수수량', '매수호가', '매도수량', '매도호가'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외옵션 호가[해외선물-033] + + 해외옵션 호가 테스트 함수 + + Parameters: + - srs_cd (str): 종목명 (예)OESM24 C5340) + + Returns: + - DataFrame: 해외옵션 호가 결과 + + Example: + >>> df1, df2 = opt_asking_price(srs_cd="OESM24 C5340") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + ka.auth() + + # API 호출 + logger.info("API 호출") + result1, result2 = opt_asking_price(srs_cd="1ECN25 C5425") + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/opt_asking_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/opt_asking_price.py new file mode 100644 index 0000000..ff87d58 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_asking_price/opt_asking_price.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] +############################################################################################## + +# API 정보 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-asking-price" + +def opt_asking_price( + srs_cd: str, # 종목명 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외옵션 호가[해외선물-033] + 해외옵션 호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목명 (예: 'OTXM24 C22000') + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외옵션 호가 데이터 + + Example: + >>> df1, df2 = opt_asking_price(srs_cd="OTXM24 C22000") + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'OTXM24 C22000')") + raise ValueError("srs_cd is required. (e.g. 'OTXM24 C22000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFO86000000" + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return opt_asking_price( + srs_cd, + dataframe1, dataframe2, tr_cont, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/chk_opt_daily_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/chk_opt_daily_ccnl.py new file mode 100644 index 0000000..6529147 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/chk_opt_daily_ccnl.py @@ -0,0 +1,97 @@ +""" +Created on 20250129 +""" +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_daily_ccnl import opt_daily_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(일간) [해외선물-037] +############################################################################################## + +# 상수 정의 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시간', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량', '전일대비가격', '전일대비율'] + +def main(): + """ + 해외옵션 체결추이(일간) 조회 테스트 함수 + + 이 함수는 해외옵션 체결추이(일간) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = opt_daily_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/opt_daily_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/opt_daily_ccnl.py new file mode 100644 index 0000000..6fad601 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_daily_ccnl/opt_daily_ccnl.py @@ -0,0 +1,137 @@ +""" +Created on 20250129 +""" + +import logging +import sys +import time +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(일간) [해외선물-037] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-daily-ccnl" + +def opt_daily_ccnl( + srs_cd: str, # [필수] 종목코드 (ex. OESU24 C5500) + exch_cd: str, # [필수] 거래소코드 (ex. CME) + qry_cnt: str, # [필수] 요청개수 (ex. 20) + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(일간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. ("QRY_CNT: 119 입력", START_DATE_TIME, CLOSE_DATE_TIME은 공란) + + ※ 호출 시 유의사항 + : START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력, QRY_CNT는 확인 데이터 개수의 -1 개 입력 + ex) "START_DATE_TIME":"","CLOSE_DATE_TIME":"","QRY_CNT":"119" → 최근 120건 데이터 조회 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> result1, result2 = opt_daily_ccnl("OESU24 C5500", "CME", "20") + >>> print(result1) + >>> print(result2) + """ + + # 필수 파라미터 검증 + if srs_cd == "" or srs_cd is None: + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "" or exch_cd is None: + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "" or qry_cnt is None: + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020100" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_daily_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/chk_opt_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/chk_opt_detail.py new file mode 100644 index 0000000..0880a08 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/chk_opt_detail.py @@ -0,0 +1,89 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_detail import opt_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목상세 [해외선물-034] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'exch_cd': '거래소코드', + 'clas_cd': '품목종류', + 'crc_cd': '거래통화', + 'sttl_price': '전일종가', + 'sttl_date': '정산일', + 'trst_mgn': '증거금', + 'disp_digit': '가격표시진법', + 'tick_sz': '틱사이즈', + 'tick_val': '틱가치', + 'mrkt_open_date': '장개시일자', + 'mrkt_open_time': '장개시시각', + 'mrkt_close_date': '장마감일자', + 'mrkt_close_time': '장마감시각', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'stat_tp': '매매여부', + 'ctrt_size': '계약크기', + 'stl_tp': '최종결제구분', + 'frst_noti_date': '최초식별일' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외옵션종목상세 조회 테스트 함수 + + 이 함수는 해외옵션종목상세 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1: SRS_CD: C5500 + logging.info("=== case1 조회 ===") + try: + result = opt_detail(srs_cd="C5500") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/opt_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/opt_detail.py new file mode 100644 index 0000000..7069fbb --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_detail/opt_detail.py @@ -0,0 +1,77 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목상세 [해외선물-034] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-detail" + +def opt_detail( + srs_cd: str # [필수] 종목명 +) -> pd.DataFrame: + """ + 해외옵션종목상세 API입니다. + + (주의) sstl_price 자리에 정산가 X 전일종가 O 가 수신되는 점 유의 부탁드립니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목명 + + Returns: + pd.DataFrame: 해외옵션종목상세 데이터 + + Raises: + ValueError: 필수 파라미터 누락 시 + + Examples: + >>> df = opt_detail("C5500") + >>> print(df) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'C5500')") + + tr_id = "HHDFO55010100" + + params = { + "SRS_CD": srs_cd + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/chk_opt_monthly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/chk_opt_monthly_ccnl.py new file mode 100644 index 0000000..97ae8f0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/chk_opt_monthly_ccnl.py @@ -0,0 +1,100 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_monthly_ccnl import opt_monthly_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(월간) [해외선물-039] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외옵션 체결추이(월간) 조회 테스트 함수 + + 이 함수는 해외옵션 체결추이(월간) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 DXM24 ICE 30건을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = opt_monthly_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 (object) 처리 + logging.info("=== output1 처리 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 (array) 처리 + logging.info("=== output2 처리 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/opt_monthly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/opt_monthly_ccnl.py new file mode 100644 index 0000000..2b97db8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_monthly_ccnl/opt_monthly_ccnl.py @@ -0,0 +1,145 @@ +""" +Created on 20250112 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(월간) [해외선물-039] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-monthly-ccnl" + +def opt_monthly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(월간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. (START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력) + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 (ex. "") + close_date_time (str): 조회종료일시 (ex. "") + qry_gap (str): 묶음개수 (ex. "") + qry_tp (str): 조회구분 (ex. "") + index_key (str): 이전조회KEY (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외옵션 체결추이(월간) 정보 (output1, output2) + + Example: + >>> result1, result2 = opt_monthly_ccnl("OESU24 C5500", "CME", "20") + >>> print(result1) + >>> print(result2) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020300" # 해외옵션 체결추이(월간) + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data1 = pd.DataFrame([res.getBody().output1]) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_monthly_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/chk_opt_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/chk_opt_price.py new file mode 100644 index 0000000..0df83d7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/chk_opt_price.py @@ -0,0 +1,99 @@ +""" +Created on 20250101 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_price import opt_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목현재가 [해외선물-035] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'proc_date': '최종처리일자', + 'proc_time': '최종처리시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '현재가', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율', + 'bid_qntt': '매수1수량', + 'bid_price': '매수1호가', + 'ask_qntt': '매도1수량', + 'ask_price': '매도1호가', + 'trst_mgn': '증거금', + 'exch_cd': '거래소코드', + 'crc_cd': '거래통화', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'last_qntt': '체결량', + 'tot_ask_qntt': '총매도잔량', + 'tot_bid_qntt': '총매수잔량', + 'tick_size': '틱사이즈', + 'open_date': '장개시일자', + 'open_time': '장개시시각', + 'close_date': '장종료일자', + 'close_time': '장종료시각', + 'sbsnsdate': '영업일자', + 'sttl_price': '정산가' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외옵션종목현재가 조회 테스트 함수 + + 이 함수는 해외옵션종목현재가 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # 해외옵션종목현재가 조회 + logging.info("=== 해외옵션종목현재가 조회 ===") + try: + result = opt_price(srs_cd="DXM24") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/opt_price.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/opt_price.py new file mode 100644 index 0000000..7c86f11 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_price/opt_price.py @@ -0,0 +1,72 @@ +""" +Created on 20250101 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목현재가 [해외선물-035] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-price" + +def opt_price( + srs_cd: str # 종목코드 +) -> pd.DataFrame: + """ + 해외옵션종목현재가 API입니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 + + Returns: + pd.DataFrame: 해외옵션종목현재가 데이터 + + Example: + >>> df = opt_price(srs_cd="DXM24") + >>> print(df) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required") + + tr_id = "HHDFO55010000" # 해외옵션종목현재가 + + params = { + "SRS_CD": srs_cd # 종목코드 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/chk_opt_tick_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/chk_opt_tick_ccnl.py new file mode 100644 index 0000000..79be7fb --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/chk_opt_tick_ccnl.py @@ -0,0 +1,100 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_tick_ccnl import opt_tick_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(틱) [해외선물-038] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시간', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' + } + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량', '전일대비가격', '전일대비율'] + +def main(): + """ + 해외옵션 체결추이(틱) 조회 테스트 함수 + + 이 함수는 해외옵션 체결추이(틱) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 DXM24(ICE 거래소)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result1, result2 = opt_tick_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number로 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (메타데이터에 number로 명시된 필드 없음) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/opt_tick_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/opt_tick_ccnl.py new file mode 100644 index 0000000..32dc882 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_tick_ccnl/opt_tick_ccnl.py @@ -0,0 +1,154 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(틱) [해외선물-038] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-tick-ccnl" + +def opt_tick_ccnl( + srs_cd: str, # [필수] 종목코드 + exch_cd: str, # [필수] 거래소코드 + qry_cnt: str, # [필수] 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(틱) API입니다. + 한 번의 호출에 40건까지 확인 가능하며, QRY_TP, INDEX_KEY 를 이용하여 다음조회 가능합니다. + + ※ 다음조회 방법 + (처음조회) "QRY_TP":"Q", "QRY_CNT":"40", "INDEX_KEY":"" + (다음조회) "QRY_TP":"P", "QRY_CNT":"40", "INDEX_KEY":"20240906 221" ◀ 이전 호출의 "output1 > index_key" 기입 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Example: + >>> df1, df2 = opt_tick_ccnl("OESU24 C5500", "CME", "20") + >>> print(df1) # output1 데이터 + >>> print(df2) # output2 데이터 + """ + + # 필수 파라미터 검증 + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020200" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_tick_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/chk_opt_weekly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/chk_opt_weekly_ccnl.py new file mode 100644 index 0000000..9213f22 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/chk_opt_weekly_ccnl.py @@ -0,0 +1,102 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from opt_weekly_ccnl import opt_weekly_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(주간) [해외선물-036] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시간', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [ + 'open_price', 'high_price', 'low_price', 'last_price', 'last_qntt', 'vol', + 'prev_diff_price', 'prev_diff_rate' +] + +def main(): + """ + 해외옵션 체결추이(주간) 조회 테스트 함수 + + 이 함수는 해외옵션 체결추이(주간) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # Case1 조회 + logging.info("=== Case1 조회 ===") + try: + result1, result2 = opt_weekly_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 (통합 매핑 사용) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (통합 리스트 사용) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s" % result2.columns.tolist()) + + # 컬럼명 한글 변환 (통합 매핑 사용) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 (통합 리스트 사용) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/opt_weekly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/opt_weekly_ccnl.py new file mode 100644 index 0000000..8301ffc --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/opt_weekly_ccnl/opt_weekly_ccnl.py @@ -0,0 +1,149 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(주간) [해외선물-036] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/opt-weekly-ccnl" + +def opt_weekly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # output1 누적 데이터프레임 + dataframe2: Optional[pd.DataFrame] = None, # output2 누적 데이터프레임 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(주간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. (START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력) + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): output1 누적 데이터프레임 + dataframe2 (Optional[pd.DataFrame]): output2 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: output1과 output2 데이터프레임 튜플 + + Example: + >>> df1, df2 = opt_weekly_ccnl(srs_cd="OESU24 C5500", exch_cd="CME", qry_cnt="20") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020000" # 해외옵션 체결추이(주간) + + params = { + "SRS_CD": srs_cd, # 종목코드 + "EXCH_CD": exch_cd, # 거래소코드 + "QRY_CNT": qry_cnt, # 요청개수 + "START_DATE_TIME": start_date_time, # 조회시작일시 + "CLOSE_DATE_TIME": close_date_time, # 조회종료일시 + "QRY_GAP": qry_gap, # 묶음개수 + "QRY_TP": qry_tp, # 조회구분 + "INDEX_KEY": index_key # 이전조회KEY + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # 다음 페이지 정보 확인 + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_weekly_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order/chk_order.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order/chk_order.py new file mode 100644 index 0000000..d57c753 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order/chk_order.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order import order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문[v1_해외선물-001] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ORD_DT': '주문일자', + 'ODNO': '주문번호' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문[v1_해외선물-001] + + 해외선물옵션 주문 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_futr_fx_pdno (str): 해외선물FX상품번호 () + - sll_buy_dvsn_cd (str): 매도매수구분코드 (01 : 매도 02 : 매수) + - fm_lqd_ustl_ccld_dt (str): FM청산미결제체결일자 (빈칸 (hedge청산만 이용)) + - fm_lqd_ustl_ccno (str): FM청산미결제체결번호 (빈칸 (hedge청산만 이용)) + - pric_dvsn_cd (str): 가격구분코드 (1.지정, 2. 시장, 3. STOP, 4 S/L) + - fm_limit_ord_pric (str): FMLIMIT주문가격 (지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력) + - fm_stop_ord_pric (str): FMSTOP주문가격 (STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력) + - fm_ord_qty (str): FM주문수량 () + - fm_lqd_lmt_ord_pric (str): FM청산LIMIT주문가격 (빈칸 (hedge청산만 이용)) + - fm_lqd_stop_ord_pric (str): FM청산STOP주문가격 (빈칸 (hedge청산만 이용)) + - ccld_cndt_cd (str): 체결조건코드 (일반적으로 6 (EOD, 지정가) GTD인 경우 5, 시장가인 경우만 2) + - cplx_ord_dvsn_cd (str): 복합주문구분코드 (0 (hedge청산만 이용)) + - ecis_rsvn_ord_yn (str): 행사예약주문여부 (N) + - fm_hdge_ord_scrn_yn (str): FM_HEDGE주문화면여부 (N) + + Returns: + - DataFrame: 해외선물옵션 주문 결과 + + Example: + >>> df = order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_futr_fx_pdno="1AALN25 C10.0", sll_buy_dvsn_cd="02", fm_lqd_ustl_ccld_dt="", fm_lqd_ustl_ccno="", pric_dvsn_cd="1", fm_limit_ord_pric="1.17", fm_stop_ord_pric="", fm_ord_qty="1", fm_lqd_lmt_ord_pric="", fm_lqd_stop_ord_pric="", ccld_cndt_cd="6", cplx_ord_dvsn_cd="0", ecis_rsvn_ord_yn="N", fm_hdge_ord_scrn_yn="N") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = order( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + ovrs_futr_fx_pdno="6NU25", + sll_buy_dvsn_cd="02", + fm_lqd_ustl_ccld_dt="", + fm_lqd_ustl_ccno="", + pric_dvsn_cd="1", + fm_limit_ord_pric="100", + fm_stop_ord_pric="", + fm_ord_qty="1", + fm_lqd_lmt_ord_pric="", + fm_lqd_stop_ord_pric="", + ccld_cndt_cd="6", + cplx_ord_dvsn_cd="0", + ecis_rsvn_ord_yn="N", + fm_hdge_ord_scrn_yn="N" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order/order.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order/order.py new file mode 100644 index 0000000..78ea12d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order/order.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/trading/order" + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문[v1_해외선물-001] +############################################################################################## + +def order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_futr_fx_pdno: str, # 해외선물FX상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fm_lqd_ustl_ccld_dt: str, # FM청산미결제체결일자 + fm_lqd_ustl_ccno: str, # FM청산미결제체결번호 + pric_dvsn_cd: str, # 가격구분코드 + fm_limit_ord_pric: str, # FMLIMIT주문가격 + fm_stop_ord_pric: str, # FMSTOP주문가격 + fm_ord_qty: str, # FM주문수량 + fm_lqd_lmt_ord_pric: str, # FM청산LIMIT주문가격 + fm_lqd_stop_ord_pric: str, # FM청산STOP주문가격 + ccld_cndt_cd: str, # 체결조건코드 + cplx_ord_dvsn_cd: str, # 복합주문구분코드 + ecis_rsvn_ord_yn: str, # 행사예약주문여부 + fm_hdge_ord_scrn_yn: str, # FM_HEDGE주문화면여부 + +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문[v1_해외선물-001] + 해외선물옵션 주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_futr_fx_pdno (str): 해외선물FX상품번호 + sll_buy_dvsn_cd (str): 01 : 매도 02 : 매수 + fm_lqd_ustl_ccld_dt (str): 빈칸 (hedge청산만 이용) + fm_lqd_ustl_ccno (str): 빈칸 (hedge청산만 이용) + pric_dvsn_cd (str): 1.지정, 2. 시장, 3. STOP, 4 S/L + fm_limit_ord_pric (str): 지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력 + fm_stop_ord_pric (str): STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력 + fm_ord_qty (str): FM주문수량 + fm_lqd_lmt_ord_pric (str): 빈칸 (hedge청산만 이용) + fm_lqd_stop_ord_pric (str): 빈칸 (hedge청산만 이용) + ccld_cndt_cd (str): 일반적으로 6 (EOD, 지정가) GTD인 경우 5, 시장가인 경우만 2 + cplx_ord_dvsn_cd (str): 0 (hedge청산만 이용) + ecis_rsvn_ord_yn (str): N + fm_hdge_ord_scrn_yn (str): N + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 주문 데이터 + + Example: + >>> df = order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_futr_fx_pdno="6BZ22", + ... sll_buy_dvsn_cd="02", + ... fm_lqd_ustl_ccld_dt="", + ... fm_lqd_ustl_ccno="", + ... pric_dvsn_cd="1", + ... fm_limit_ord_pric="1.17", + ... fm_stop_ord_pric="", + ... fm_ord_qty="1", + ... fm_lqd_lmt_ord_pric="", + ... fm_lqd_stop_ord_pric="", + ... ccld_cndt_cd="6", + ... cplx_ord_dvsn_cd="0", + ... ecis_rsvn_ord_yn="N", + ... fm_hdge_ord_scrn_yn="N" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81012345')") + raise ValueError("cano is required. (e.g. '81012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ovrs_futr_fx_pdno: + logger.error("ovrs_futr_fx_pdno is required. (e.g. '1AALN25 C10.0')") + raise ValueError("ovrs_futr_fx_pdno is required. (e.g. '1AALN25 C10.0')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '02')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '02')") + if not pric_dvsn_cd: + logger.error("pric_dvsn_cd is required. (e.g. '1')") + raise ValueError("pric_dvsn_cd is required. (e.g. '1')") + if not fm_ord_qty: + logger.error("fm_ord_qty is required. (e.g. '1')") + raise ValueError("fm_ord_qty is required. (e.g. '1')") + if not ccld_cndt_cd: + logger.error("ccld_cndt_cd is required. (e.g. '6')") + raise ValueError("ccld_cndt_cd is required. (e.g. '6')") + + url = API_URL + tr_id = "OTFM3001U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_FUTR_FX_PDNO": ovrs_futr_fx_pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FM_LQD_USTL_CCLD_DT": fm_lqd_ustl_ccld_dt, + "FM_LQD_USTL_CCNO": fm_lqd_ustl_ccno, + "PRIC_DVSN_CD": pric_dvsn_cd, + "FM_LIMIT_ORD_PRIC": fm_limit_ord_pric, + "FM_STOP_ORD_PRIC": fm_stop_ord_pric, + "FM_ORD_QTY": fm_ord_qty, + "FM_LQD_LMT_ORD_PRIC": fm_lqd_lmt_ord_pric, + "FM_LQD_STOP_ORD_PRIC": fm_lqd_stop_ord_pric, + "CCLD_CNDT_CD": ccld_cndt_cd, + "CPLX_ORD_DVSN_CD": cplx_ord_dvsn_cd, + "ECIS_RSVN_ORD_YN": ecis_rsvn_ord_yn, + "FM_HDGE_ORD_SCRN_YN": fm_hdge_ord_scrn_yn, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/chk_order_notice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/chk_order_notice.py new file mode 100644 index 0000000..dbab67f --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/chk_order_notice.py @@ -0,0 +1,100 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_notice import order_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간주문내역통보[실시간-019] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + "acct_no": "계좌번호", + "ord_dt": "주문일자", + "odno": "주문번호", + "orgn_ord_dt": "원주문일자", + "orgn_odno": "원주문번호", + "series": "종목명", + "rvse_cncl_dvsn_cd": "정정취소구분코드", + "sll_buy_dvsn_cd": "매도매수구분코드", + "cplx_ord_dvsn_cd": "복합주문구분코드", + "prce_tp": "가격구분코드", + "fm_excg_rcit_dvsn_cd": "FM거래소접수구분코드", + "ord_qty": "주문수량", + "fm_lmt_pric": "FMLIMIT가격", + "fm_stop_ord_pric": "FMSTOP주문가격", + "tot_ccld_qty": "총체결수량", + "tot_ccld_uv": "총체결단가", + "ord_remq": "잔량", + "fm_ord_grp_dt": "FM주문그룹일자", + "ord_grp_stno": "주문그룹번호", + "ord_dtl_dtime": "주문상세일시", + "oprt_dtl_dtime": "조작상세일시", + "work_empl": "주문자", + "crcy_cd": "통화코드", + "lqd_yn": "청산여부(Y/N)", + "lqd_lmt_pric": "청산LIMIT가격", + "lqd_stop_pric": "청산STOP가격", + "trd_cond": "체결조건코드", + "term_ord_vald_dtime": "기간주문유효상세일시", + "spec_tp": "계좌청산유형구분코드", + "ecis_rsvn_ord_yn": "행사예약주문여부", + "fuop_item_dvsn_cd": "선물옵션종목구분코드", + "auto_ord_dvsn_cd": "자동주문 전략구분" +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ["주문수량", "총체결수량", "총체결단가", "잔량", "청산LIMIT가격", "청산STOP가격"] + +def main(): + """ + 해외선물옵션 실시간주문내역통보 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 case1 + kws.subscribe(request=order_notice, data=[trenv.my_htsid]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + result = result.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/order_notice.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/order_notice.py new file mode 100644 index 0000000..8b9cff4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order_notice/order_notice.py @@ -0,0 +1,91 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간주문내역통보[실시간-019] +############################################################################################## + +def order_notice( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + [참고자료] + + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] HTS ID + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = order_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF1C0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "acct_no", + "ord_dt", + "odno", + "orgn_ord_dt", + "orgn_odno", + "series", + "rvse_cncl_dvsn_cd", + "sll_buy_dvsn_cd", + "cplx_ord_dvsn_cd", + "prce_tp", + "fm_excg_rcit_dvsn_cd", + "ord_qty", + "fm_lmt_pric", + "fm_stop_ord_pric", + "tot_ccld_qty", + "tot_ccld_uv", + "ord_remq", + "fm_ord_grp_dt", + "ord_grp_stno", + "ord_dtl_dtime", + "oprt_dtl_dtime", + "work_empl", + "crcy_cd", + "lqd_yn", + "lqd_lmt_pric", + "lqd_stop_pric", + "trd_cond", + "term_ord_vald_dtime", + "spec_tp", + "ecis_rsvn_ord_yn", + "fuop_item_dvsn_cd", + "auto_ord_dvsn_cd" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/chk_order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/chk_order_rvsecncl.py new file mode 100644 index 0000000..35faeef --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/chk_order_rvsecncl.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order_rvsecncl import order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문[v1_해외선물-002, 003] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ORD_DT': '주문일자', + 'ODNO': '주문번호' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 정정취소주문[v1_해외선물-002, 003] + + 해외선물옵션 정정취소주문 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - ord_dv (str): 주문구분 (0:정정, 1:취소) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - orgn_ord_dt (str): 원주문일자 (원 주문 시 출력되는 ORD_DT 값을 입력 (현지거래일)) + - orgn_odno (str): 원주문번호 (정정/취소시 주문번호(ODNO) 8자리를 문자열처럼 "0"을 포함해서 전송 (원 주문 시 출력된 ODNO 값 활용) (ex. ORGN_ODNO : 00360686)) + - fm_limit_ord_pric (str): FMLIMIT주문가격 (OTFM3002U(해외선물옵션주문정정)만 사용) + - fm_stop_ord_pric (str): FMSTOP주문가격 (OTFM3002U(해외선물옵션주문정정)만 사용) + - fm_lqd_lmt_ord_pric (str): FM청산LIMIT주문가격 (OTFM3002U(해외선물옵션주문정정)만 사용) + - fm_lqd_stop_ord_pric (str): FM청산STOP주문가격 (OTFM3002U(해외선물옵션주문정정)만 사용) + - fm_hdge_ord_scrn_yn (str): FM_HEDGE주문화면여부 (N) + - fm_mkpr_cvsn_yn (str): FM시장가전환여부 (OTFM3003U(해외선물옵션주문취소)만 사용 ※ FM_MKPR_CVSN_YN 항목에 'Y'로 설정하여 취소주문을 접수할 경우, 주문 취소확인이 들어오면 원장에서 시장가주문을 하나 또 내줌) + + Returns: + - DataFrame: 해외선물옵션 정정취소주문 결과 + + Example: + >>> df = order_rvsecncl(cano=trenv.my_acct, ord_dv="0", acnt_prdt_cd=trenv.my_prod, orgn_ord_dt="20250630", orgn_odno="00123456", fm_limit_ord_pric="10.0", fm_stop_ord_pric="", fm_lqd_lmt_ord_pric="", fm_lqd_stop_ord_pric="", fm_hdge_ord_scrn_yn="N", fm_mkpr_cvsn_yn="") # 정정 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = order_rvsecncl( + cano=trenv.my_acct, + ord_dv="1", + acnt_prdt_cd=trenv.my_prod, + orgn_ord_dt="20250703", + orgn_odno="00000398", + fm_limit_ord_pric="", + fm_stop_ord_pric="", + fm_lqd_lmt_ord_pric="", + fm_lqd_stop_ord_pric="", + fm_hdge_ord_scrn_yn="N", + fm_mkpr_cvsn_yn="N" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물옵션 정정취소주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/order_rvsecncl.py new file mode 100644 index 0000000..c66dcf6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/order_rvsecncl/order_rvsecncl.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/trading/order-rvsecncl" + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문[v1_해외선물-002, 003] +############################################################################################## + +def order_rvsecncl( + cano: str, # 종합계좌번호 + ord_dv: str, # 주문구분 + acnt_prdt_cd: str, # 계좌상품코드 + orgn_ord_dt: str, # 원주문일자 + orgn_odno: str, # 원주문번호 + fm_limit_ord_pric: str, # FMLIMIT주문가격 + fm_stop_ord_pric: str, # FMSTOP주문가격 + fm_lqd_lmt_ord_pric: str, # FM청산LIMIT주문가격 + fm_lqd_stop_ord_pric: str, # FM청산STOP주문가격 + fm_hdge_ord_scrn_yn: str, # FM_HEDGE주문화면여부 + fm_mkpr_cvsn_yn: str, # FM시장가전환여부 + +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 정정취소주문[v1_해외선물-002, 003] + 해외선물옵션 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + ord_dv (str): 주문구분 (0:정정, 1:취소) + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + orgn_ord_dt (str): 원 주문 시 출력되는 ORD_DT 값을 입력 (현지거래일) + orgn_odno (str): 정정/취소시 주문번호(ODNO) 8자리를 문자열처럼 "0"을 포함해서 전송 (원 주문 시 출력된 ODNO 값 활용) (ex. ORGN_ODNO : 00360686) + fm_limit_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_stop_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_lqd_lmt_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_lqd_stop_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_hdge_ord_scrn_yn (str): N + fm_mkpr_cvsn_yn (str): OTFM3003U(해외선물옵션주문취소)만 사용 ※ FM_MKPR_CVSN_YN 항목에 'Y'로 설정하여 취소주문을 접수할 경우, 주문 취소확인이 들어오면 원장에서 시장가주문을 하나 또 내줌 + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... ord_dv="0", + ... acnt_prdt_cd=trenv.my_prod, + ... orgn_ord_dt="20250630", + ... orgn_odno="00360686", + ... fm_limit_ord_pric="", + ... fm_stop_ord_pric="", + ... fm_lqd_lmt_ord_pric="", + ... fm_lqd_stop_ord_pric="", + ... fm_hdge_ord_scrn_yn="N", + ... fm_mkpr_cvsn_yn="N" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81012345')") + raise ValueError("cano is required. (e.g. '81012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not orgn_ord_dt: + logger.error("orgn_ord_dt is required. (e.g. '20250630')") + raise ValueError("orgn_ord_dt is required. (e.g. '20250630')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '00360686')") + raise ValueError("orgn_odno is required. (e.g. '00360686')") + + if ord_dv == "0": + tr_id = "OTFM3002U" + elif ord_dv == "1": + tr_id = "OTFM3003U" + else: + logger.error("ord_dv is required. (e.g. '0' or '1')") + raise ValueError("ord_dv is required. (e.g. '0' or '1')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORGN_ORD_DT": orgn_ord_dt, + "ORGN_ODNO": orgn_odno, + "FM_LIMIT_ORD_PRIC": fm_limit_ord_pric, + "FM_STOP_ORD_PRIC": fm_stop_ord_pric, + "FM_LQD_LMT_ORD_PRIC": fm_lqd_lmt_ord_pric, + "FM_LQD_STOP_ORD_PRIC": fm_lqd_stop_ord_pric, + "FM_HDGE_ORD_SCRN_YN": fm_hdge_ord_scrn_yn, + "FM_MKPR_CVSN_YN": fm_mkpr_cvsn_yn, + } + + logger.info("Calling API with parameters: %s", params) + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/chk_search_contract_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/chk_search_contract_detail.py new file mode 100644 index 0000000..7fedfe6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/chk_search_contract_detail.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from search_contract_detail import search_contract_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보[해외선물-023] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'exch_cd': '거래소코드', + 'clas_cd': '품목종류', + 'crc_cd': '거래통화', + 'sttl_price': '정산가', + 'sttl_date': '정산일', + 'trst_mgn': '증거금', + 'disp_digit': '가격표시진법', + 'tick_sz': '틱사이즈', + 'tick_val': '틱가치', + 'mrkt_open_date': '장개시일자', + 'mrkt_open_time': '장개시시각', + 'mrkt_close_date': '장마감일자', + 'mrkt_close_time': '장마감시각', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'stat_tp': '매매여부', + 'ctrt_size': '계약크기', + 'stl_tp': '최종결제구분', + 'frst_noti_date': '최초식별일', + 'sub_exch_nm': '서브거래소코드' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['정산가', '증거금', '틱사이즈', '틱가치', '잔존일수', '계약크기'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 상품기본정보[해외선물-023] + + 해외선물 상품기본정보 테스트 함수 + + Parameters: + - qry_cnt (str): 요청개수 (1~32 사이의 값) + - srs_cd_01 (str): 종목코드 1 (예: BONU25) + - srs_cd_02 (str): 종목코드 2 + - ... + - srs_cd_32 (str): 종목코드 32 (최대 32개 종목코드까지 조회 가능) + + Returns: + - DataFrame: 해외선물 상품기본정보 결과 + + Example: + >>> df = search_contract_detail(qry_cnt="1", srs_cd_01="BONU25", srs_cd_02="BONU25", srs_cd_03="BONU25") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = search_contract_detail( + qry_cnt="3", + srs_cd_01="BONU25", + srs_cd_02="BONU25", + srs_cd_03="BONU25" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물 상품기본정보 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/search_contract_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/search_contract_detail.py new file mode 100644 index 0000000..20fe862 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/search_contract_detail/search_contract_detail.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/search-contract-detail" + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보[해외선물-023] +############################################################################################## + +def search_contract_detail( + qry_cnt: str, # 요청개수 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10, + **kwargs # srs_cd_01, srs_cd_02, ... srs_cd_32 등을 받음 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 상품기본정보[해외선물-023] + 해외선물 상품기본정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + qry_cnt (str): 입력한 코드 개수 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + **kwargs: srs_cd_01, srs_cd_02, ... srs_cd_32 품목종류 코드들 + + Returns: + Optional[pd.DataFrame]: 해외선물 상품기본정보 데이터 + + Example: + >>> df = search_contract_detail( + ... qry_cnt="3", + ... srs_cd_01="SRS001", + ... srs_cd_02="SRS002", + ... srs_cd_03="SRS003" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not 1 <= int(qry_cnt) <= 32: + logger.error("qry_cnt is required. (e.g. '1' ~ '32')") + raise ValueError("qry_cnt is required. (e.g. '1' ~ '32')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55200000" + + # 기본 파라미터 + params = { + "QRY_CNT": qry_cnt, + } + + # SRS_CD_01 ~ SRS_CD_32 파라미터 동적 생성 + for i in range(1, 33): + srs_key = f"srs_cd_{i:02d}" + api_key = f"SRS_CD_{i:02d}" + params[api_key] = kwargs.get(srs_key, "") + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return search_contract_detail( + qry_cnt, "N", dataframe, depth + 1, max_depth, **kwargs + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/chk_search_opt_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/chk_search_opt_detail.py new file mode 100644 index 0000000..54d63df --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/chk_search_opt_detail.py @@ -0,0 +1,90 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from search_opt_detail import search_opt_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 상품기본정보 [해외선물-041] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'exch_cd': '거래소코드', + 'clas_cd': '품목종류', + 'crc_cd': '거래통화', + 'sttl_price': '정산가', + 'sttl_date': '정산일', + 'trst_mgn': '증거금', + 'disp_digit': '가격표시진법', + 'tick_sz': '틱사이즈', + 'tick_val': '틱가치', + 'mrkt_open_date': '장개시일자', + 'mrkt_open_time': '장개시시각', + 'mrkt_close_date': '장마감일자', + 'mrkt_close_time': '장마감시각', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'stat_tp': '매매여부', + 'ctrt_size': '계약크기', + 'stl_tp': '최종결제구분', + 'frst_noti_date': '최초식별일' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외옵션 상품기본정보 조회 테스트 함수 + + 이 함수는 해외옵션 상품기본정보 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 6AM24 종목코드를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = search_opt_detail(qry_cnt="1", srs_cd_01="6AM24") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 메타데이터에 자료형이 명시적으로 'number'로 선언된 필드 없음 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/search_opt_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/search_opt_detail.py new file mode 100644 index 0000000..65bda5a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/search_opt_detail/search_opt_detail.py @@ -0,0 +1,198 @@ +""" +Created on 20250601 +""" + + +import sys +import logging +from typing import Optional + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 상품기본정보 [해외선물-041] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/search-opt-detail" + +def search_opt_detail( + qry_cnt: str, # [필수] 요청개수 (SRS_CD_N 개수) + srs_cd_01: str, # [필수] 종목코드1 + srs_cd_02: Optional[str] = "", # 종목코드2 + srs_cd_03: Optional[str] = "", # 종목코드3 + srs_cd_04: Optional[str] = "", # 종목코드4 + srs_cd_05: Optional[str] = "", # 종목코드5 + srs_cd_06: Optional[str] = "", # 종목코드6 + srs_cd_07: Optional[str] = "", # 종목코드7 + srs_cd_08: Optional[str] = "", # 종목코드8 + srs_cd_09: Optional[str] = "", # 종목코드9 + srs_cd_10: Optional[str] = "", # 종목코드10 + srs_cd_11: Optional[str] = "", # 종목코드11 + srs_cd_12: Optional[str] = "", # 종목코드12 + srs_cd_13: Optional[str] = "", # 종목코드13 + srs_cd_14: Optional[str] = "", # 종목코드14 + srs_cd_15: Optional[str] = "", # 종목코드15 + srs_cd_16: Optional[str] = "", # 종목코드16 + srs_cd_17: Optional[str] = "", # 종목코드17 + srs_cd_18: Optional[str] = "", # 종목코드18 + srs_cd_19: Optional[str] = "", # 종목코드19 + srs_cd_20: Optional[str] = "", # 종목코드20 + srs_cd_21: Optional[str] = "", # 종목코드21 + srs_cd_22: Optional[str] = "", # 종목코드22 + srs_cd_23: Optional[str] = "", # 종목코드23 + srs_cd_24: Optional[str] = "", # 종목코드24 + srs_cd_25: Optional[str] = "", # 종목코드25 + srs_cd_26: Optional[str] = "", # 종목코드26 + srs_cd_27: Optional[str] = "", # 종목코드27 + srs_cd_28: Optional[str] = "", # 종목코드28 + srs_cd_29: Optional[str] = "", # 종목코드29 + srs_cd_30: Optional[str] = "" # 종목코드30 +) -> pd.DataFrame: + """ + 해외옵션 상품기본정보 API입니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + qry_cnt (str): [필수] 요청개수 (ex. SRS_CD_N 개수) + srs_cd_01 (str): [필수] 종목코드1 + srs_cd_02 (Optional[str]): 종목코드2 + srs_cd_03 (Optional[str]): 종목코드3 + srs_cd_04 (Optional[str]): 종목코드4 + srs_cd_05 (Optional[str]): 종목코드5 + srs_cd_06 (Optional[str]): 종목코드6 + srs_cd_07 (Optional[str]): 종목코드7 + srs_cd_08 (Optional[str]): 종목코드8 + srs_cd_09 (Optional[str]): 종목코드9 + srs_cd_10 (Optional[str]): 종목코드10 + srs_cd_11 (Optional[str]): 종목코드11 + srs_cd_12 (Optional[str]): 종목코드12 + srs_cd_13 (Optional[str]): 종목코드13 + srs_cd_14 (Optional[str]): 종목코드14 + srs_cd_15 (Optional[str]): 종목코드15 + srs_cd_16 (Optional[str]): 종목코드16 + srs_cd_17 (Optional[str]): 종목코드17 + srs_cd_18 (Optional[str]): 종목코드18 + srs_cd_19 (Optional[str]): 종목코드19 + srs_cd_20 (Optional[str]): 종목코드20 + srs_cd_21 (Optional[str]): 종목코드21 + srs_cd_22 (Optional[str]): 종목코드22 + srs_cd_23 (Optional[str]): 종목코드23 + srs_cd_24 (Optional[str]): 종목코드24 + srs_cd_25 (Optional[str]): 종목코드25 + srs_cd_26 (Optional[str]): 종목코드26 + srs_cd_27 (Optional[str]): 종목코드27 + srs_cd_28 (Optional[str]): 종목코드28 + srs_cd_29 (Optional[str]): 종목코드29 + srs_cd_30 (Optional[str]): 종목코드30 + + Returns: + pd.DataFrame: 해외옵션 상품기본정보 데이터 + + Example: + >>> df = search_opt_detail(qry_cnt="1", srs_cd_01="6AM24") + >>> print(df) + """ + + # 필수 파라미터 검증 + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. 'SRS_CD_N 개수')") + + if srs_cd_01 == "": + raise ValueError("srs_cd_01 is required") + + tr_id = "HHDFO55200000" # 해외옵션 상품기본정보 + + params = { + "QRY_CNT": qry_cnt, + "SRS_CD_01": srs_cd_01 + } + + # 옵션 파라미터 추가 + if srs_cd_02: + params["SRS_CD_02"] = srs_cd_02 + if srs_cd_03: + params["SRS_CD_03"] = srs_cd_03 + if srs_cd_04: + params["SRS_CD_04"] = srs_cd_04 + if srs_cd_05: + params["SRS_CD_05"] = srs_cd_05 + if srs_cd_06: + params["SRS_CD_06"] = srs_cd_06 + if srs_cd_07: + params["SRS_CD_07"] = srs_cd_07 + if srs_cd_08: + params["SRS_CD_08"] = srs_cd_08 + if srs_cd_09: + params["SRS_CD_09"] = srs_cd_09 + if srs_cd_10: + params["SRS_CD_10"] = srs_cd_10 + if srs_cd_11: + params["SRS_CD_11"] = srs_cd_11 + if srs_cd_12: + params["SRS_CD_12"] = srs_cd_12 + if srs_cd_13: + params["SRS_CD_13"] = srs_cd_13 + if srs_cd_14: + params["SRS_CD_14"] = srs_cd_14 + if srs_cd_15: + params["SRS_CD_15"] = srs_cd_15 + if srs_cd_16: + params["SRS_CD_16"] = srs_cd_16 + if srs_cd_17: + params["SRS_CD_17"] = srs_cd_17 + if srs_cd_18: + params["SRS_CD_18"] = srs_cd_18 + if srs_cd_19: + params["SRS_CD_19"] = srs_cd_19 + if srs_cd_20: + params["SRS_CD_20"] = srs_cd_20 + if srs_cd_21: + params["SRS_CD_21"] = srs_cd_21 + if srs_cd_22: + params["SRS_CD_22"] = srs_cd_22 + if srs_cd_23: + params["SRS_CD_23"] = srs_cd_23 + if srs_cd_24: + params["SRS_CD_24"] = srs_cd_24 + if srs_cd_25: + params["SRS_CD_25"] = srs_cd_25 + if srs_cd_26: + params["SRS_CD_26"] = srs_cd_26 + if srs_cd_27: + params["SRS_CD_27"] = srs_cd_27 + if srs_cd_28: + params["SRS_CD_28"] = srs_cd_28 + if srs_cd_29: + params["SRS_CD_29"] = srs_cd_29 + if srs_cd_30: + params["SRS_CD_30"] = srs_cd_30 + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + # 메타데이터에 따라 output2 (array)를 pd.DataFrame으로 반환 + return pd.DataFrame(res.getBody().output2) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/chk_stock_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/chk_stock_detail.py new file mode 100644 index 0000000..a8779ec --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/chk_stock_detail.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from stock_detail import stock_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목상세[v1_해외선물-008] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'exch_cd': '거래소코드', + 'tick_sz': '틱사이즈', + 'disp_digit': '가격표시진법', + 'trst_mgn': '증거금', + 'sttl_date': '정산일', + 'prev_price': '전일종가', + 'crc_cd': '거래통화', + 'clas_cd': '품목종류', + 'tick_val': '틱가치', + 'mrkt_open_date': '장개시일자', + 'mrkt_open_time': '장개시시각', + 'mrkt_close_date': '장마감일자', + 'mrkt_close_time': '장마감시각', + 'trd_fr_date': '상장일', + 'expr_date': '만기일', + 'trd_to_date': '최종거래일', + 'remn_cnt': '잔존일수', + 'stat_tp': '매매여부', + 'ctrt_size': '계약크기', + 'stl_tp': '최종결제구분', + 'frst_noti_date': '최초식별일', + 'sprd_srs_cd1': '스프레드 종목 #1', + 'sprd_srs_cd2': '스프레드 종목 #2' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물종목상세[v1_해외선물-008] + + 해외선물종목상세 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (ex) BONU25 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고) + + Returns: + - DataFrame: 해외선물종목상세 결과 + + Example: + >>> df = stock_detail(srs_cd="BONU25") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = stock_detail(srs_cd="BONU25") + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외선물종목상세 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/stock_detail.py b/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/stock_detail.py new file mode 100644 index 0000000..b991499 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/stock_detail/stock_detail.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-02 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/stock-detail" + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목상세[v1_해외선물-008] +############################################################################################## + +def stock_detail( + srs_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물종목상세[v1_해외선물-008] + 해외선물종목상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): ex) CNHU24 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물종목상세 데이터 + + Example: + >>> df = stock_detail(srs_cd="6AU22") + >>> print(df) + """ + # 필수 파라미터 검증 + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AU22')") + raise ValueError("srs_cd is required. (e.g. '6AU22')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55010100" + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return stock_detail( + srs_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/chk_tick_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/chk_tick_ccnl.py new file mode 100644 index 0000000..22dc7a0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/chk_tick_ccnl.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from tick_ccnl import tick_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'tret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량', '전일대비가격', '전일대비율'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(틱)[해외선물-019] + + 해외선물 체결추이(틱) 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (예) 6AM24) + - exch_cd (str): 거래소코드 (예) CME) + - start_date_time (str): 조회시작일시 (공백) + - close_date_time (str): 조회종료일시 (예) 20240402) + - qry_tp (str): 조회구분 (Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시) + - qry_cnt (str): 요청개수 (예) 30 (최대 40)) + - qry_gap (str): 묶음개수 (공백 (분만 사용)) + - index_key (str): 이전조회KEY (공백) + + Returns: + - DataFrame: 해외선물 체결추이(틱) 결과 + + Example: + >>> df1, df2 = tick_ccnl(srs_cd="BONU25", exch_cd="EUREX", start_date_time="", close_date_time="20250630", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result1, result2 = tick_ccnl( + srs_cd="BONU25", + exch_cd="EUREX", + start_date_time="", + close_date_time="20250630", + qry_tp="Q", + qry_cnt="30", + qry_gap="", + index_key="" + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/tick_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/tick_ccnl.py new file mode 100644 index 0000000..8637549 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/tick_ccnl/tick_ccnl.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/tick-ccnl" + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] +############################################################################################## + +def tick_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(틱)[해외선물-019] + 해외선물 체결추이(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: '6AM24') + exch_cd (str): 거래소코드 (예: 'CME') + start_date_time (str): 조회시작일시 (공백 허용) + close_date_time (str): 조회종료일시 (예: '20240402') + qry_tp (str): 조회구분 ('Q': 최초조회, 'P': 다음키 입력하여 조회) + qry_cnt (str): 요청개수 (예: '30', 최대 '40') + qry_gap (str): 묶음개수 (공백 허용) + index_key (str): 이전조회KEY (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(틱) 데이터 + + Example: + >>> df1, df2 = tick_ccnl( + ... srs_cd="BONU25", + ... exch_cd="EUREX", + ... start_date_time="", + ... close_date_time="20250630", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. ('Q' or 'P')") + raise ValueError("qry_tp is required. ('Q' or 'P')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020200" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return tick_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/chk_weekly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/chk_weekly_ccnl.py new file mode 100644 index 0000000..5ac4c70 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/chk_weekly_ccnl.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from weekly_ccnl import weekly_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] +############################################################################################## + +# 컬럼명 매핑 +COLUMN_MAPPING = { + 'ret_cnt': '자료개수', + 'last_n_cnt': 'N틱최종개수', + 'index_key': '이전조회KEY', + 'data_date': '일자', + 'data_time': '시각', + 'open_price': '시가', + 'high_price': '고가', + 'low_price': '저가', + 'last_price': '체결가격', + 'last_qntt': '체결수량', + 'vol': '누적거래수량', + 'prev_diff_flag': '전일대비구분', + 'prev_diff_price': '전일대비가격', + 'prev_diff_rate': '전일대비율' +} + +# 숫자형 컬럼 +NUMERIC_COLUMNS = ['자료개수', 'N틱최종개수', '시가', '고가', '저가', '체결가격', '체결수량', '누적거래수량', '전일대비가격', '전일대비율'] + +def main(): + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(주간)[해외선물-017] + + 해외선물 체결추이(주간) 테스트 함수 + + Parameters: + - srs_cd (str): 종목코드 (예) 6AM24) + - exch_cd (str): 거래소코드 (예) CME) + - start_date_time (str): 조회시작일시 (공백) + - close_date_time (str): 조회종료일시 (예) 20240402) + - qry_tp (str): 조회구분 (Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시) + - qry_cnt (str): 요청개수 (예) 30 (최대 40)) + - qry_gap (str): 묶음개수 (공백 (분만 사용)) + - index_key (str): 이전조회KEY (공백) + + Returns: + - DataFrame: 해외선물 체결추이(주간) 결과 + + Example: + >>> df1, df2 = weekly_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result1, result2 = weekly_ccnl( + srs_cd="DXM24", + exch_cd="ICE", + start_date_time="", + close_date_time="20250630", + qry_tp="", + qry_cnt="30", + qry_gap="", + index_key="" + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/weekly_ccnl.py b/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/weekly_ccnl.py new file mode 100644 index 0000000..516854b --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_futureoption/weekly_ccnl/weekly_ccnl.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 상수 정의 +API_URL = "/uapi/overseas-futureoption/v1/quotations/weekly-ccnl" + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] +############################################################################################## + +def weekly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(주간)[해외선물-017] + 해외선물 체결추이(주간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드, 예) 6AM24 + exch_cd (str): 거래소코드, 예) CME + start_date_time (str): 조회시작일시, 공백 + close_date_time (str): 조회종료일시, 예) 20240402 + qry_tp (str): 조회구분, Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시 + qry_cnt (str): 요청개수, 예) 30 (최대 40) + qry_gap (str): 묶음개수, 공백 (분만 사용) + index_key (str): 이전조회KEY, 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(주간) 데이터 + + Example: + >>> df1, df2 = weekly_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020000" + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return weekly_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/algo_ordno.py b/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/algo_ordno.py new file mode 100644 index 0000000..0dccfb4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/algo_ordno.py @@ -0,0 +1,110 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가주문번호조회 [해외주식-071] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/algo-ordno" + +def algo_ordno( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + trad_dt: str, # [필수] 거래일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + TWAP, VWAP 주문에 대한 주문번호를 조회하는 API + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + trad_dt (str): [필수] 거래일자 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 지정가주문번호 데이터 + + Example: + >>> df = algo_ordno(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, trad_dt="20250619") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if trad_dt == "": + raise ValueError("trad_dt is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTS6058R" # 해외주식 지정가주문번호조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "TRAD_DT": trad_dt, # 거래일자 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return algo_ordno( + cano, acnt_prdt_cd, trad_dt, FK200, NK200, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/chk_algo_ordno.py b/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/chk_algo_ordno.py new file mode 100644 index 0000000..9ffefb2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/algo_ordno/chk_algo_ordno.py @@ -0,0 +1,79 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from algo_ordno import algo_ordno + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가주문번호조회 [해외주식-071] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'ODNO': '주문번호', + 'TRAD_DVSN_NAME': '매매구분명', + 'PDNO': '상품번호', + 'ITEM_NAME': '종목명', + 'FT_ORD_QTY': 'FT주문수량', + 'FT_ORD_UNPR3': 'FT주문단가', + 'SPLT_BUY_ATTR_NAME': '분할매수속성명', + 'FT_CCLD_QTY': 'FT체결수량', + 'ORD_GNO_BRNO': '주문채번지점번호' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 지정가주문번호조회 테스트 함수 + + 이 함수는 해외주식 지정가주문번호조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = algo_ordno(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, trad_dt="20250619") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/asking_price/asking_price.py b/한국투자증권(API)/examples_llm/overseas_stock/asking_price/asking_price.py new file mode 100644 index 0000000..6029d46 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/asking_price/asking_price.py @@ -0,0 +1,76 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간호가[실시간-021] +############################################################################################## + +def asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간호가를 이용하여 미국시세 실시간 1호가(매수/매도) 시세가 무료로 제공됩니다. (미국은 유료시세 제공 X) + + 아시아 국가의 경우, HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시, + "해외주식 실시간호가 HDFSASP0" 을 이용하여 아시아국가 유료시세(실시간호가)를 받아보실 수 있습니다. (24.11.29 반영) + (아시아 국가 무료시세는 "해외주식 지연호가(아시아) HDFSASP1" 를 이용하시기 바랍니다.) + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = asking_price("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "symb", + "zdiv", + "xymd", + "xhms", + "kymd", + "khms", + "bvol", + "avol", + "bdvl", + "advl", + "pbid1", + "pask1", + "vbid1", + "vask1", + "dbid1", + "dask1" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/asking_price/chk_asking_price.py b/한국투자증권(API)/examples_llm/overseas_stock/asking_price/chk_asking_price.py new file mode 100644 index 0000000..00c8df4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/asking_price/chk_asking_price.py @@ -0,0 +1,84 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from asking_price import asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간호가[실시간-021] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + "symb": "종목코드", + "zdiv": "소숫점자리수", + "xymd": "현지일자", + "xhms": "현지시간", + "kymd": "한국일자", + "khms": "한국시간", + "bvol": "매수총잔량", + "avol": "매도총잔량", + "bdvl": "매수총잔량대비", + "advl": "매도총잔량대비", + "pbid1": "매수호가1", + "pask1": "매도호가1", + "vbid1": "매수잔량1", + "vask1": "매도잔량1", + "dbid1": "매수잔량대비1", + "dask1": "매도잔량대비1" +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 실시간호가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=asking_price, data=["RBAQAAPL"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/brknews_title.py b/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/brknews_title.py new file mode 100644 index 0000000..bd8200e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/brknews_title.py @@ -0,0 +1,87 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외속보(제목) [해외주식-055] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/brknews-title" + +def brknews_title( + fid_news_ofer_entp_code: str, # [필수] 뉴스제공업체코드 (ex. 0:전체조회) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11801) + fid_cond_mrkt_cls_code: str = "", # 조건시장구분코드 + fid_input_iscd: str = "", # 입력종목코드 + fid_titl_cntt: str = "", # 제목내용 + fid_input_date_1: str = "", # 입력날짜1 + fid_input_hour_1: str = "", # 입력시간1 + fid_rank_sort_cls_code: str = "", # 순위정렬구분코드 + fid_input_srno: str = "" # 입력일련번호 +) -> pd.DataFrame: + """ + 해외속보(제목) API입니다. + 한국투자 HTS(eFriend Plus) > [7704] 해외속보 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 최대 100건까지 조회 가능합니다. + + Args: + fid_news_ofer_entp_code (str): [필수] 뉴스제공업체코드 (ex. 0:전체조회) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11801) + fid_cond_mrkt_cls_code (str): 조건시장구분코드 + fid_input_iscd (str): 입력종목코드 + fid_titl_cntt (str): 제목내용 + fid_input_date_1 (str): 입력날짜1 + fid_input_hour_1 (str): 입력시간1 + fid_rank_sort_cls_code (str): 순위정렬구분코드 + fid_input_srno (str): 입력일련번호 + + Returns: + pd.DataFrame: 해외속보(제목) 데이터 + + Example: + >>> df = brknews_title("0", "11801") + >>> print(df) + """ + + if fid_news_ofer_entp_code == "": + raise ValueError("fid_news_ofer_entp_code is required (e.g. '0')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11801')") + + tr_id = "FHKST01011801" + + params = { + "FID_NEWS_OFER_ENTP_CODE": fid_news_ofer_entp_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TITL_CNTT": fid_titl_cntt, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_SRNO": fid_input_srno + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/chk_brknews_title.py b/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/chk_brknews_title.py new file mode 100644 index 0000000..d6f44d2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/brknews_title/chk_brknews_title.py @@ -0,0 +1,93 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from brknews_title import brknews_title + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외속보(제목) [해외주식-055] +############################################################################################## + +COLUMN_MAPPING = { + 'cntt_usiq_srno': '내용조회용일련번호', + 'news_ofer_entp_code': '뉴스제공업체코드', + 'data_dt': '작성일자', + 'data_tm': '작성시간', + 'hts_pbnt_titl_cntt': 'HTS공시제목내용', + 'news_lrdv_code': '뉴스대구분', + 'dorg': '자료원', + 'iscd1': '종목코드1', + 'iscd2': '종목코드2', + 'iscd3': '종목코드3', + 'iscd4': '종목코드4', + 'iscd5': '종목코드5', + 'iscd6': '종목코드6', + 'iscd7': '종목코드7', + 'iscd8': '종목코드8', + 'iscd9': '종목코드9', + 'iscd10': '종목코드10', + 'kor_isnm1': '한글종목명1', + 'kor_isnm2': '한글종목명2', + 'kor_isnm3': '한글종목명3', + 'kor_isnm4': '한글종목명4', + 'kor_isnm5': '한글종목명5', + 'kor_isnm6': '한글종목명6', + 'kor_isnm7': '한글종목명7', + 'kor_isnm8': '한글종목명8', + 'kor_isnm9': '한글종목명9', + 'kor_isnm10': '한글종목명10' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외속보(제목) 조회 테스트 함수 + + 이 함수는 해외속보(제목) API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = brknews_title(fid_news_ofer_entp_code="0", fid_cond_scr_div_code="11801") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/ccnl_notice.py b/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/ccnl_notice.py new file mode 100644 index 0000000..58d5f68 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/ccnl_notice.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간체결통보[실시간-009] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, + env_dv: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간체결통보 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", trenv.my_htsid, "real") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # tr_id 구분 + if env_dv == "real": + tr_id = "H0GSCNI0" + elif env_dv == "demo": + tr_id = "H0GSCNI9" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "CUST_ID", + "ACNT_NO", + "ODER_NO", + "OODER_NO", + "SELN_BYOV_CLS", + "RCTF_CLS", + "ODER_KIND2", + "STCK_SHRN_ISCD", + "CNTG_QTY", + "CNTG_UNPR", + "STCK_CNTG_HOUR", + "RFUS_YN", + "CNTG_YN", + "ACPT_YN", + "BRNC_NO", + "ODER_QTY", + "ACNT_NAME", + "CNTG_ISNM", + "ODER_COND", + "DEBT_GB", + "DEBT_DATE", + "START_TM", + "END_TM", + "TM_DIV_TP", + "CNTG_UNPR12" + ] + + return msg, columns diff --git a/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/chk_ccnl_notice.py b/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/chk_ccnl_notice.py new file mode 100644 index 0000000..8333218 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/ccnl_notice/chk_ccnl_notice.py @@ -0,0 +1,94 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from ccnl_notice import ccnl_notice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간체결통보[실시간-009] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + "CUST_ID": "고객 ID", + "ACNT_NO": "계좌번호", + "ODER_NO": "주문번호", + "OODER_NO": "원주문번호", + "SELN_BYOV_CLS": "매도매수구분", + "RCTF_CLS": "정정구분", + "ODER_KIND2": "주문종류2", + "STCK_SHRN_ISCD": "주식 단축 종목코드", + "CNTG_QTY": "체결수량", + "CNTG_UNPR": "체결단가", + "STCK_CNTG_HOUR": "주식 체결 시간", + "RFUS_YN": "거부여부", + "CNTG_YN": "체결여부", + "ACPT_YN": "접수여부", + "BRNC_NO": "지점번호", + "ODER_QTY": "주문 수량", + "ACNT_NAME": "계좌명", + "CNTG_ISNM": "체결종목명", + "ODER_COND": "해외종목구분", + "DEBT_GB": "담보유형코드", + "DEBT_DATE": "담보대출일자", + "START_TM": "분할매수/매도 시작시간", + "END_TM": "분할매수/매도 종료시간", + "TM_DIV_TP": "시간분할타입유형", + "CNTG_UNPR": "체결단가12" +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 실시간체결통보 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + trenv = ka.getTREnv() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid], kwargs={"env_dv": "real"}) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/chk_colable_by_company.py b/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/chk_colable_by_company.py new file mode 100644 index 0000000..8626570 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/chk_colable_by_company.py @@ -0,0 +1,95 @@ +""" +Created on 20250101 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from colable_by_company import colable_by_company + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 당사 해외주식담보대출 가능 종목 [해외주식-051] +############################################################################################## + +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'ovrs_item_name': '해외종목명', + 'loan_rt': '대출비율', + 'mgge_mntn_rt': '담보유지비율', + 'mgge_ensu_rt': '담보확보비율', + 'loan_exec_psbl_yn': '대출실행가능여부', + 'stff_name': '직원명', + 'erlm_dt': '등록일자', + 'tr_mket_name': '거래시장명', + 'crcy_cd': '통화코드', + 'natn_kor_name': '국가한글명', + 'ovrs_excg_cd': '해외거래소코드', + 'loan_psbl_item_num': '대출가능종목수' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 당사 해외주식담보대출 가능 종목 조회 테스트 함수 + + 이 함수는 당사 해외주식담보대출 가능 종목 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 AMD 종목을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # 한줄함수호출 -> 컬럼명 한글 변환 -> 숫자형 컬럼 소수점표시 -> 결과 (case1) + logger.info("=== case1 조회 ===") + try: + result1, result2 = colable_by_company(pdno="AMD", natn_cd="840", inqr_sqn_dvsn="01") + except ValueError as e: + logger.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logger.info("=== output1 데이터 ===") + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + result1 = result1.rename(columns=COLUMN_MAPPING) + + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("결과:") + print(result1) + + # output2 처리 + logger.info("=== output2 데이터 ===") + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + result2 = result2.rename(columns=COLUMN_MAPPING) + + + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/colable_by_company.py b/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/colable_by_company.py new file mode 100644 index 0000000..f78f7f7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/colable_by_company/colable_by_company.py @@ -0,0 +1,153 @@ +""" +Created on 20250101 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 당사 해외주식담보대출 가능 종목 [해외주식-051] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/colable-by-company" + +def colable_by_company( + pdno: str, # 상품번호 + natn_cd: str, # 국가코드 + inqr_sqn_dvsn: str, # 조회순서구분 + prdt_type_cd: str = "", # 상품유형코드 + inqr_strt_dt: str = "", # 조회시작일자 + inqr_end_dt: str = "", # 조회종료일자 + inqr_dvsn: str = "", # 조회구분 + rt_dvsn_cd: str = "", # 비율구분코드 + rt: str = "", # 비율 + loan_psbl_yn: str = "", # 대출가능여부 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 당사 해외주식담보대출 가능 종목 API입니다. + 한국투자 HTS(eFriend Plus) > [0497] 당사 해외주식담보대출 가능 종목 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 한 번의 호출에 20건까지 조회가 가능하며 다음조회가 불가하기에, PDNO에 데이터 확인하고자 하는 종목코드를 입력하여 단건조회용으로 사용하시기 바랍니다. + + Args: + pdno (str): [필수] 상품번호 (ex. AMD) + natn_cd (str): [필수] 국가코드 (ex. 840:미국,344:홍콩,156:중국) + inqr_sqn_dvsn (str): [필수] 조회순서구분 (ex. 01:이름순,02:코드순) + prdt_type_cd (str): 상품유형코드 + inqr_strt_dt (str): 조회시작일자 + inqr_end_dt (str): 조회종료일자 + inqr_dvsn (str): 조회구분 + rt_dvsn_cd (str): 비율구분코드 + rt (str): 비율 + loan_psbl_yn (str): 대출가능여부 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = colable_by_company(pdno="AMD", natn_cd="840", inqr_sqn_dvsn="01") + >>> print(df1) # output1 데이터 + >>> print(df2) # output2 데이터 + """ + + # 필수 파라미터 검증 + if pdno == "": + raise ValueError("pdno is required (e.g. 'AMD')") + + if natn_cd == "": + raise ValueError("natn_cd is required (e.g. '840:미국,344:홍콩,156:중국')") + + if inqr_sqn_dvsn == "": + raise ValueError("inqr_sqn_dvsn is required (e.g. '01:이름순,02:코드순')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTLN4050R" + + params = { + "PDNO": pdno, + "NATN_CD": natn_cd, + "INQR_SQN_DVSN": inqr_sqn_dvsn, + "PRDT_TYPE_CD": prdt_type_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "INQR_DVSN": inqr_dvsn, + "RT_DVSN_CD": rt_dvsn_cd, + "RT": rt, + "LOAN_PSBL_YN": loan_psbl_yn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return colable_by_company( + pdno, natn_cd, inqr_sqn_dvsn, prdt_type_cd, inqr_strt_dt, inqr_end_dt, + inqr_dvsn, rt_dvsn_cd, rt, loan_psbl_yn, FK100, NK100, "N", + dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/chk_countries_holiday.py b/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/chk_countries_holiday.py new file mode 100644 index 0000000..238aaef --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/chk_countries_holiday.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from countries_holiday import countries_holiday + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외결제일자조회[해외주식-017] +############################################################################################## + +COLUMN_MAPPING = { + 'prdt_type_cd': '상품유형코드', + 'tr_natn_cd': '거래국가코드', + 'natn_eng_abrv_cd': '국가영문약어코드', + 'tr_mket_cd': '거래시장코드', + 'tr_mket_name': '거래시장명', + 'acpl_sttl_dt': '현지결제일자', + 'dmst_sttl_dt': '국내결제일자' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 기본시세 + 해외결제일자조회[해외주식-017] + + 해외결제일자조회 테스트 함수 + + Parameters: + - trad_dt (str): 기준일자 (기준일자(YYYYMMDD)) + - ctx_area_nk (str): 연속조회키 (공백으로 입력) + - ctx_area_fk (str): 연속조회검색조건 (공백으로 입력) + + Returns: + - DataFrame: 해외결제일자조회 결과 + + Example: + >>> df = countries_holiday(trad_dt="20250131", NK="", FK="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + # API 호출 + logger.info("API 호출 시작: 해외결제일자조회") + result = countries_holiday( + trad_dt="20250131", # 기준일자 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외결제일자조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/countries_holiday.py b/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/countries_holiday.py new file mode 100644 index 0000000..480392d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/countries_holiday/countries_holiday.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-26 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외결제일자조회[해외주식-017] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/quotations/countries-holiday" + +def countries_holiday( + trad_dt: str, # 기준일자 + NK: str = "", # 연속조회키 + FK: str = "", # 연속조회검색조건 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외결제일자조회[해외주식-017] + 해외결제일자조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + trad_dt (str): 기준일자(YYYYMMDD) + ctx_area_nk (str): 공백으로 입력 + ctx_area_fk (str): 공백으로 입력 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외결제일자조회 데이터 + + Example: + >>> df = countries_holiday("20250131", "", "") + >>> print(df) + """ + # 필수 파라미터 검증 + if not trad_dt: + logger.error("trad_dt is required. (e.g. '20250131')") + raise ValueError("trad_dt is required. (e.g. '20250131')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTOS5011R" + + params = { + "TRAD_DT": trad_dt, + "CTX_AREA_NK": NK, + "CTX_AREA_FK": FK, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + NK = res.getBody().ctx_area_nk + FK = res.getBody().ctx_area_fk + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return countries_holiday( + trad_dt, + NK, + FK, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/chk_dailyprice.py b/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/chk_dailyprice.py new file mode 100644 index 0000000..cf51c33 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/chk_dailyprice.py @@ -0,0 +1,140 @@ +""" +Created on 2025-06-26 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from dailyprice import dailyprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 기간별시세[v1_해외주식-010] +############################################################################################## + +COLUMN_MAPPING = { + 'rsym': '실시간조회종목코드', + 'zdiv': '소수점자리수', + 'nrec': '전일종가', + 'xymd': '일자(YYYYMMDD)', + 'clos': '종가', + 'sign': '대비기호', + 'diff': '대비', + 'rate': '등락율', + 'open': '시가', + 'high': '고가', + 'low': '저가', + 'tvol': '거래량', + 'tamt': '거래대금', + 'pbid': '매수호가', + 'vbid': '매수호가잔량', + 'pask': '매도호가', + 'vask': '매도호가잔량' +} +NUMERIC_COLUMNS = ['대비', '등락율', '시가', '고가', '저가', '거래량', '거래대금', '매수호가', '매도호가', '매수호가잔량', '매도호가잔량'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 기간별시세[v1_해외주식-010] + + 해외주식 기간별시세 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 ("" (Null 값 설정)) + - excd (str): 거래소코드 (HKS : 홍콩 NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 TSE : 도쿄 SHS : 상해 SZS : 심천 SHI : 상해지수 SZI : 심천지수 HSX : 호치민 HNX : 하노이) + - symb (str): 종목코드 (종목코드 (ex. TSLA)) + - gubn (str): 일/주/월구분 (0 : 일 1 : 주 2 : 월) + - bymd (str): 조회기준일자 (조회기준일자(YYYYMMDD) ※ 공란 설정 시, 기준일 오늘 날짜로 설정) + - modp (str): 수정주가반영여부 (0 : 미반영 1 : 반영) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 기간별시세 결과 + + Example: + >>> df1, df2 = dailyprice(auth="", excd="NAS", symb="TSLA", gubn="0", bymd="", modp="1", env_dv="real") # 실전투자 + >>> df1, df2 = dailyprice(auth="", excd="NAS", symb="TSLA", gubn="0", bymd="", modp="1", env_dv="demo") # 모의투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 해외주식 기간별시세 (%s)", "실전투자" if env_dv == "real" else "모의투자") + result1, result2 = dailyprice( + auth="", + excd="NAS", + symb="TSLA", + gubn="2", + bymd="", + modp="1", + env_dv=env_dv, + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/dailyprice.py b/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/dailyprice.py new file mode 100644 index 0000000..4c7a883 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/dailyprice/dailyprice.py @@ -0,0 +1,177 @@ +""" +Created on 2025-06-26 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 기간별시세[v1_해외주식-010] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/dailyprice" + +def dailyprice( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + gubn: str, # 일/주/월구분 + bymd: str, # 조회기준일자 + modp: str, # 수정주가반영여부 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 기간별시세[v1_해외주식-010] + 해외주식 기간별시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 (예: "") + excd (str): 거래소코드 (예: "NAS") + symb (str): 종목코드 (예: "TSLA") + gubn (str): 일/주/월구분 (예: "0") + bymd (str): 조회기준일자(YYYYMMDD) (예: "20230101") + modp (str): 수정주가반영여부 (예: "0") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 기간별시세 데이터 + + Example: + >>> df1, df2 = dailyprice("auth_token", "NAS", "TSLA", "0", "20230101", "0", "") + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + if not gubn: + logger.error("gubn is required. (e.g. '0')") + raise ValueError("gubn is required. (e.g. '0')") + if not modp: + logger.error("modp is required. (e.g. '0')") + raise ValueError("modp is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "HHDFS76240000" # 실전/모의투자 공통 TR ID + else: + logger.error("env_dv can only be 'real' or 'demo'") + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + "GUBN": gubn, + "BYMD": bymd, + "MODP": modp, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return dailyprice( + auth, + excd, + symb, + gubn, + bymd, + modp, + env_dv, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/chk_daytime_order.py b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/chk_daytime_order.py new file mode 100644 index 0000000..e233ed1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/chk_daytime_order.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from daytime_order import daytime_order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간주문 [v1_해외주식-026] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 미국주간주문[v1_해외주식-026] + + 해외주식 미국주간주문 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스) + - pdno (str): 상품번호 (종목코드) + - ord_qty (str): 주문수량 (해외거래소 별 최소 주문수량 및 주문단위 확인 필요) + - ovrs_ord_unpr (str): 해외주문단가 (소수점 포함, 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력) + - ctac_tlno (str): 연락전화번호 (" ") + - mgco_aptm_odno (str): 운용사지정주문번호 (" ") + - ord_svr_dvsn_cd (str): 주문서버구분코드 ("0") + - ord_dvsn (str): 주문구분 ([미국 매수/매도 주문] 00 : 지정가 * 주간거래는 지정가만 가능) + + Returns: + - DataFrame: 해외주식 미국주간주문 결과 + + Example: + >>> df = daytime_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, order_dv="buy", ovrs_excg_cd="NASD", pdno="AAPL", ord_qty="10", ovrs_ord_unpr="150.50", ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0", ord_dvsn="00") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = daytime_order( + order_dv="buy", # 주문구분 + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + pdno="AAPL", # 상품번호 + ord_qty="10", # 주문수량 + ovrs_ord_unpr="0.8", # 해외주문단가 + ctac_tlno="", # 연락전화번호 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ord_dvsn="00", # 주문구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 미국주간주문 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/daytime_order.py b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/daytime_order.py new file mode 100644 index 0000000..b74ec95 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order/daytime_order.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간주문 [v1_해외주식-026] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/daytime-order" + +def daytime_order( + order_dv: str, # 주문구분 buy(매수) / sell(매도) + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + ord_dvsn: str, # 주문구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미국주간주문[v1_해외주식-026] + 해외주식 미국주간주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + order_dv (str): 주문구분 buy(매수) / sell(매도) + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스 + pdno (str): 종목코드 + ord_qty (str): 해외거래소 별 최소 주문수량 및 주문단위 확인 필요 + ovrs_ord_unpr (str): 소수점 포함, 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 + ctac_tlno (str): " " + mgco_aptm_odno (str): " " + ord_svr_dvsn_cd (str): "0" + ord_dvsn (str): [미국 매수/매도 주문] 00 : 지정가 * 주간거래는 지정가만 가능 + + Returns: + Optional[pd.DataFrame]: 해외주식 미국주간주문 데이터 + + Example: + >>> df = daytime_order( + ... order_dv="buy", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... ord_qty="10", + ... ovrs_ord_unpr="150.00", + ... ctac_tlno="01012345678", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... ord_dvsn="00" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '10')") + raise ValueError("ord_qty is required. (e.g. '10')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '150.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '150.00')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + if not ord_dvsn: + logger.error("ord_dvsn is required. (e.g. '00')") + raise ValueError("ord_dvsn is required. (e.g. '00')") + + if order_dv == "buy": + tr_id = "TTTS6036U" + elif order_dv == "sell": + tr_id = "TTTS6037U" + else: + logger.error("Invalid order_dv. (e.g. 'buy' or 'sell')") + raise ValueError("Invalid order_dv. (e.g. 'buy' or 'sell')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "ORD_DVSN": ord_dvsn, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/chk_daytime_order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/chk_daytime_order_rvsecncl.py new file mode 100644 index 0000000..19d50ed --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/chk_daytime_order_rvsecncl.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from daytime_order_rvsecncl import daytime_order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간정정취소 [v1_해외주식-027] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'Output1': '응답상세', + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 미국주간정정취소[v1_해외주식-027] + + 해외주식 미국주간정정취소 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스) + - pdno (str): 상품번호 (종목코드) + - orgn_odno (str): 원주문번호 ('정정 또는 취소할 원주문번호(매매 TR의 주문번호) - 해외주식 주문체결내역api (/uapi/overseas-stock/v1/trading/inquire-nccs)에서 odno(주문번호) 참조') + - rvse_cncl_dvsn_cd (str): 정정취소구분코드 ('01 : 정정 02 : 취소') + - ord_qty (str): 주문수량 () + - ovrs_ord_unpr (str): 해외주문단가 (소수점 포함, 1주당 가격) + - ctac_tlno (str): 연락전화번호 (" ") + - mgco_aptm_odno (str): 운용사지정주문번호 (" ") + - ord_svr_dvsn_cd (str): 주문서버구분코드 ("0") + + Returns: + - DataFrame: 해외주식 미국주간정정취소 결과 + + Example: + >>> df = daytime_order_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", pdno="AAPL", orgn_odno="1234567890", rvse_cncl_dvsn_cd="01", ord_qty="10", ovrs_ord_unpr="150.25", ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = daytime_order_rvsecncl( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + pdno="AMZN", # 상품번호 + orgn_odno="0000034439", # 원주문번호 + rvse_cncl_dvsn_cd="02", # 정정취소구분코드 + ord_qty="111", # 주문수량 + ovrs_ord_unpr="0", # 해외주문단가 + ctac_tlno="", # 연락전화번호 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0" # 주문서버구분코드 + ) + + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 미국주간정정취소 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/daytime_order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/daytime_order_rvsecncl.py new file mode 100644 index 0000000..920d46d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/daytime_order_rvsecncl/daytime_order_rvsecncl.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간정정취소 [v1_해외주식-027] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl" + +def daytime_order_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + orgn_odno: str, # 원주문번호 + rvse_cncl_dvsn_cd: str, # 정정취소구분코드 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미국주간정정취소[v1_해외주식-027] + 해외주식 미국주간정정취소 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스 + pdno (str): 종목코드 + orgn_odno (str): 정정 또는 취소할 원주문번호 + rvse_cncl_dvsn_cd (str): 01 : 정정, 02 : 취소 + ord_qty (str): 주문수량 + ovrs_ord_unpr (str): 소수점 포함, 1주당 가격 + ctac_tlno (str): 연락전화번호 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + + Returns: + Optional[pd.DataFrame]: 해외주식 미국주간정정취소 데이터 + + Example: + >>> df = daytime_order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... orgn_odno="1234567890", + ... rvse_cncl_dvsn_cd="01", + ... ord_qty="100", + ... ovrs_ord_unpr="150.00", + ... ctac_tlno="01012345678", + ... mgco_aptm_odno="000000000001", + ... ord_svr_dvsn_cd="0" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '1234567890')") + raise ValueError("orgn_odno is required. (e.g. '1234567890')") + if rvse_cncl_dvsn_cd not in ["01", "02"]: + logger.error("rvse_cncl_dvsn_cd is required. (e.g. '01' or '02')") + raise ValueError("rvse_cncl_dvsn_cd is required. (e.g. '01' or '02')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '100')") + raise ValueError("ord_qty is required. (e.g. '100')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '150.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '150.00')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + + tr_id = "TTTS6038U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/chk_delayed_asking_price_asia.py b/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/chk_delayed_asking_price_asia.py new file mode 100644 index 0000000..06095a0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/chk_delayed_asking_price_asia.py @@ -0,0 +1,87 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from delayed_asking_price_asia import delayed_asking_price_asia + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 지연호가(아시아)[실시간-008] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + "symb": "종목코드", + "zdiv": "소숫점자리수", + "xymd": "현지일자", + "xhms": "현지시간", + "kymd": "한국일자", + "khms": "한국시간", + "bvol": "매수총잔량", + "avol": "매도총잔량", + "bdvl": "매수총잔량대비", + "advl": "매도총잔량대비", + "pbid1": "매수호가1", + "pask1": "매도호가1", + "vbid1": "매수잔량1", + "vask1": "매도잔량1", + "dbid1": "매수잔량대비1", + "dask1": "매도잔량대비1" +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = ["매수호가1", "매도호가1", "매수잔량1", "매도잔량1"] + +def main(): + """ + 해외주식 지연호가(아시아) 조회 테스트 함수 + + 이 함수는 해외주식 지연호가(아시아) API를 호출하여 결과를 출력합니다. + 테스트 데이터로 DHKS00003을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=delayed_asking_price_asia, data=["DHKS00003"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/delayed_asking_price_asia.py b/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/delayed_asking_price_asia.py new file mode 100644 index 0000000..d08b3ef --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/delayed_asking_price_asia/delayed_asking_price_asia.py @@ -0,0 +1,77 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 지연호가(아시아)[실시간-008] +############################################################################################## + +def delayed_asking_price_asia( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 지연호가(아시아)의 경우 아시아 무료시세(지연호가)가 제공됩니다. + + HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시, + "해외주식 실시간호가 HDFSASP0" 을 이용하여 아시아국가 유료시세(실시간호가)를 받아보실 수 있습니다. (24.11.29 반영) + + ※ 지연시세 지연시간 : 홍콩, 베트남, 중국, 일본 - 15분지연 + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = delayed_asking_price_asia("1", "DHKS00003") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSASP1" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "symb", + "zdiv", + "xymd", + "xhms", + "kymd", + "khms", + "bvol", + "avol", + "bdvl", + "advl", + "pbid1", + "pask1", + "vbid1", + "vask1", + "dbid1", + "dask1" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/chk_delayed_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/chk_delayed_ccnl.py new file mode 100644 index 0000000..d0e1790 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/chk_delayed_ccnl.py @@ -0,0 +1,93 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from delayed_ccnl import delayed_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간지연체결가[실시간-007] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + "SYMB": "종목코드", + "ZDIV": "수수점자리수", + "TYMD": "현지영업일자", + "XYMD": "현지일자", + "XHMS": "현지시간", + "KYMD": "한국일자", + "KHMS": "한국시간", + "OPEN": "시가", + "HIGH": "고가", + "LOW": "저가", + "LAST": "현재가", + "SIGN": "대비구분", + "DIFF": "전일대비", + "RATE": "등락율", + "PBID": "매수호가", + "PASK": "매도호가", + "VBID": "매수잔량", + "VASK": "매도잔량", + "EVOL": "체결량", + "TVOL": "거래량", + "TAMT": "거래대금", + "BIVL": "매도체결량", + "ASVL": "매수체결량", + "STRN": "체결강도", + "MTYP": "시장구분" +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = ["시가", "고가", "저가", "현재가", "전일대비", "등락율", "매수호가", "매도호가", "매수잔량", "매도잔량"] + +def main(): + """ + 해외주식 실시간지연체결가 + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + ka.auth_ws() + + # 인증(auth_ws()) 이후에 선언 + kws = ka.KISWebSocket(api_url="/tryitout") + + # 조회 + kws.subscribe(request=delayed_ccnl, data=["DHKS00003"]) + + # 결과 표시 + def on_result(ws, tr_id: str, result: pd.DataFrame, data_map: dict): + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + kws.start(on_result=on_result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/delayed_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/delayed_ccnl.py new file mode 100644 index 0000000..40b9099 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/delayed_ccnl/delayed_ccnl.py @@ -0,0 +1,88 @@ +""" +Created on 20250601 +""" + +import logging +import sys + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간지연체결가[실시간-007] +############################################################################################## + +def delayed_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간지연체결가의 경우 기본적으로 무료시세(지연체결가)가 제공되며, + HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시 API로도 유료시세(실시간체결가)를 받아보실 수 있습니다. (24.11.29 반영) + + ※ 지연시세 지연시간 : 미국 - 실시간무료(0분지연) / 홍콩, 베트남, 중국, 일본 - 15분지연 (중국은 실시간시세 신청 시 무료실시간시세 제공) + 미국의 경우 0분지연시세로 제공되나, 장중 당일 시가는 상이할 수 있으며, 익일 정정 표시됩니다. + + 해당 API로 미국주간거래(10:00~16:00) 시세 조회도 가능합니다. + ※ 미국주간거래 실시간 조회 시, 맨 앞자리(R), tr_key 중 시장구분 값을 다음과 같이 입력 → 나스닥: BAQ, 뉴욕: BAY, 아멕스: BAA + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = delayed_ccnl("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "SYMB", + "ZDIV", + "TYMD", + "XYMD", + "XHMS", + "KYMD", + "KHMS", + "OPEN", + "HIGH", + "LOW", + "LAST", + "SIGN", + "DIFF", + "RATE", + "PBID", + "PASK", + "VBID", + "VASK", + "EVOL", + "TVOL", + "TAMT", + "BIVL", + "ASVL", + "STRN", + "MTYP" + ] + + return msg, columns \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/chk_foreign_margin.py b/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/chk_foreign_margin.py new file mode 100644 index 0000000..8107eab --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/chk_foreign_margin.py @@ -0,0 +1,105 @@ +""" +Created on 2025-06-26 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from foreign_margin import foreign_margin + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 - 해외증거금 통화별조회 [해외주식-035] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'natn_name': '국가명', + 'frcr_dncl_amt1': '외화예수금액', + 'ustl_buy_amt': '미결제매수금액', + 'ustl_sll_amt': '미결제매도금액', + 'frcr_rcvb_amt': '외화미수금액', + 'frcr_mgn_amt': '외화증거금액', + 'frcr_gnrl_ord_psbl_amt': '외화일반주문가능금액', + 'frcr_ord_psbl_amt1': '외화주문가능금액', + 'itgr_ord_psbl_amt': '통합주문가능금액', + 'bass_exrt': '기준환율' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + '외화예수금액', '미결제매수금액', '미결제매도금액', '외화미수금액', '외화증거금액', + '외화일반주문가능금액', '외화주문가능금액', '통합주문가능금액', '기준환율' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외증거금 통화별조회[해외주식-035] + + 해외증거금 통화별조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + + Returns: + - DataFrame: 해외증거금 통화별조회 결과 + + Example: + >>> df = foreign_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = foreign_margin( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외증거금 통화별조회 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/foreign_margin.py b/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/foreign_margin.py new file mode 100644 index 0000000..89fb0fc --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/foreign_margin/foreign_margin.py @@ -0,0 +1,109 @@ +""" +Created on 2025-06-26 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 - 해외증거금 통화별조회 [해외주식-035] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/foreign-margin" + +def foreign_margin( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 (기본값: 10) +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외증거금 통화별조회[해외주식-035] + 해외증거금 통화별조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (필수) + acnt_prdt_cd (str): 계좌상품코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외증거금 통화별조회 데이터 + + Example: + >>> df = foreign_margin("12345678", "01") + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC2101R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + } + + # API 호출 + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return foreign_margin( + cano, + acnt_prdt_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/industry_price/chk_industry_price.py b/한국투자증권(API)/examples_llm/overseas_stock/industry_price/chk_industry_price.py new file mode 100644 index 0000000..1e2d1af --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/industry_price/chk_industry_price.py @@ -0,0 +1,81 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from industry_price import industry_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별코드조회[해외주식-049] +############################################################################################## + +COLUMN_MAPPING = { + 'nrec': 'RecordCount', + 'icod': '업종코드', + 'name': '업종명' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 업종별코드조회 테스트 함수 + 이 함수는 해외주식 업종별코드조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1: EXCD=NAS + logging.info("=== case1: EXCD=NAS ===") + try: + result1, result2 = industry_price(excd="NAS") + except ValueError as e: + logging.error("에러 발생: %s", str(e)) + return + + # output1 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 컬럼명 한글 변환 및 숫자형 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 컬럼명 한글 변환 및 숫자형 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/industry_price/industry_price.py b/한국투자증권(API)/examples_llm/overseas_stock/industry_price/industry_price.py new file mode 100644 index 0000000..5e87028 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/industry_price/industry_price.py @@ -0,0 +1,104 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별코드조회[해외주식-049] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/industry-price" + +def industry_price( + excd: str, # [필수] 거래소명 + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 업종별코드조회 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터 + + Example: + >>> df1, df2 = industry_price(excd="NAS") + >>> print(df1, df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS', 'NAS', 'AMS', 'HKS', 'SHS', 'SZS', 'HSX', 'HNX', 'TSE')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76370100" + + params = { + "EXCD": excd, + "AUTH": auth + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return industry_price( + excd, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/chk_industry_theme.py b/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/chk_industry_theme.py new file mode 100644 index 0000000..0d1461b --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/chk_industry_theme.py @@ -0,0 +1,102 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from industry_theme import industry_theme + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별시세[해외주식-048] +############################################################################################## + +# 컬럼명 한글 변환 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'vask': '매도잔량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'vbid': '매수잔량', + 'seqn': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 업종별시세 조회 테스트 함수 + + 이 함수는 해외주식 업종별시세 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logger.info("=== case1 조회 ===") + try: + result1, result2 = industry_theme(excd="NAS", icod="010", vol_rang="0") + except ValueError as e: + logger.error("에러 발생: %s" % str(e)) + return + + logger.info("output1 사용 가능한 컬럼: %s", result1.columns.tolist()) + + # output1 컬럼명 한글 변환 및 데이터 출력 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # output1 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + + logger.info("output2 사용 가능한 컬럼: %s", result2.columns.tolist()) + + # output2 컬럼명 한글 변환 및 데이터 출력 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # output2 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/industry_theme.py b/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/industry_theme.py new file mode 100644 index 0000000..d4a0b8b --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/industry_theme/industry_theme.py @@ -0,0 +1,120 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별시세[해외주식-048] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/industry-theme" + +def industry_theme( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + icod: str, # [필수] 업종코드 + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 업종별시세 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + icod (str): [필수] 업종코드 + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = industry_theme(excd="NAS", icod="010", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if icod == "": + raise ValueError("icod is required") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76370000" + + params = { + "EXCD": excd, + "ICOD": icod, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return industry_theme( + excd, icod, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/chk_inquire_algo_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/chk_inquire_algo_ccnl.py new file mode 100644 index 0000000..d318d1a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/chk_inquire_algo_ccnl.py @@ -0,0 +1,103 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from inquire_algo_ccnl import inquire_algo_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가체결내역조회 [해외주식-070] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'CCLD_SEQ': '체결순번', + 'CCLD_BTWN': '체결시간', + 'PDNO': '상품번호', + 'ITEM_NAME': '종목명', + 'FT_CCLD_QTY': 'FT체결수량', + 'FT_CCLD_UNPR3': 'FT체결단가', + 'FT_CCLD_AMT3': 'FT체결금액', + 'ODNO': '주문번호', + 'TRAD_DVSN_NAME': '매매구분명', + 'FT_ORD_QTY': 'FT주문수량', + 'FT_ORD_UNPR3': 'FT주문단가', + 'ORD_TMD': '주문시각', + 'SPLT_BUY_ATTR_NAME': '분할매수속성명', + 'TR_CRCY': '거래통화', + 'CCLD_CNT': '체결건수' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 지정가체결내역조회 테스트 함수 + + 이 함수는 해외주식 지정가체결내역조회 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 case1의 파라미터를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # API 호출 + logging.info("API 호출") + try: + result, result3 = inquire_algo_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod,) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output 결과 처리 + logging.info("=== output 결과 ===") + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + + # output3 결과 처리 + logging.info("=== output3 결과 ===") + logging.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 한글 컬럼명으로 변환 + result3 = result3.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logging.info("결과(output3):") + print(result3) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/inquire_algo_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/inquire_algo_ccnl.py new file mode 100644 index 0000000..ad3c6d8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_algo_ccnl/inquire_algo_ccnl.py @@ -0,0 +1,127 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가체결내역조회 [해외주식-070] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-algo-ccnl" + +def inquire_algo_ccnl( + cano: str, # [필수] 계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + ord_dt: str = "", # 주문일자 + ord_gno_brno: str = "", # 주문채번지점번호 + odno: str = "", # 주문번호 (ex. 지정가주문번호 TTTC6058R에서 조회된 주문번호 입력) + ttlz_icld_yn: str = "", # 집계포함여부 + NK200: str = "", # 연속조회키200 + FK200: str = "", # 연속조회조건200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임3 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 TWAP, VWAP 주문에 대한 체결내역 조회 API로 지정가 주문번호조회 API를 수행 후 조회해야합니다 + + Args: + cano (str): [필수] 계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + ord_dt (str): 주문일자 + ord_gno_brno (str): 주문채번지점번호 + odno (str): 주문번호 (ex. 지정가주문번호 TTTC6058R에서 조회된 주문번호 입력) + ttlz_icld_yn (str): 집계포함여부 + NK200 (str): 연속조회키200 + FK200 (str): 연속조회조건200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임3 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output, output3) 체결내역 데이터 + + Example: + >>> result, result3 = inquire_algo_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + >>> print(result) + >>> print(result3) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + dataframe = pd.DataFrame() + if dataframe3 is None: + dataframe3 = pd.DataFrame() + return dataframe, dataframe3 + + tr_id = "TTTS6059R" # 해외주식 지정가체결내역조회 + + params = { + "CANO": cano, # 계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ORD_DT": ord_dt, # 주문일자 + "ORD_GNO_BRNO": ord_gno_brno, # 주문채번지점번호 + "ODNO": odno, # 주문번호 + "TTLZ_ICLD_YN": ttlz_icld_yn, # 집계포함여부 + "CTX_AREA_NK200": NK200, # 연속조회키200 + "CTX_AREA_FK200": FK200 # 연속조회조건200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + current_data3 = pd.DataFrame(res.getBody().output3) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + + tr_cont = res.getHeader().tr_cont + NK200 = res.getBody().ctx_area_nk200 + FK200 = res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_algo_ccnl( + cano, acnt_prdt_cd, ord_dt, ord_gno_brno, odno, ttlz_icld_yn, + NK200, FK200, "N", dataframe, dataframe3, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe, dataframe3 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/chk_inquire_asking_price.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/chk_inquire_asking_price.py new file mode 100644 index 0000000..0bcf308 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/chk_inquire_asking_price.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_asking_price import inquire_asking_price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가 1호가[해외주식-033] +############################################################################################## + +COLUMN_MAPPING = { + 'rsym': '실시간조회종목코드', + 'zdiv': '소수점자리수', + 'curr': '통화', + 'base': '전일종가', + 'open': '시가', + 'high': '고가', + 'low': '저가', + 'last': '현재가', + 'dymd': '호가일자', + 'dhms': '호가시간', + 'bvol': '매수호가총잔량', + 'avol': '매도호가총잔량', + 'bdvl': '매수호가총잔량대비', + 'advl': '매도호가총잔량대비', + 'code': '종목코드', + 'ropen': '시가율', + 'rhigh': '고가율', + 'rlow': '저가율', + 'rclose': '현재가율', + 'pbid1': '매수호가가격1', + 'pask1': '매도호가가격1', + 'vbid1': '매수호가잔량1', + 'vask1': '매도호가잔량1', + 'dbid1': '매수호가대비1', + 'dask1': '매도호가대비1', + 'vstm': 'VCMStart시간', + 'vetm': 'VCMEnd시간', + 'csbp': 'CAS/VCM기준가', + 'cshi': 'CAS/VCMHighprice', + 'cslo': 'CAS/VCMLowprice', + 'iep': 'IEP', + 'iev': 'IEV' +} + +NUMERIC_COLUMNS = ['소수점자리수', '시가율', '고가율', '저가율', '현재가율', '매수호가가격1', '매도호가가격1', '매수호가잔량1', + '매도호가잔량1', '매수호가대비1', '매도호가대비1', 'CAS/VCM기준가', 'CAS/VCMHighprice', 'CAS/VCMLowprice', 'IEP', 'IEV'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 현재가 1호가[해외주식-033] + + 해외주식 현재가 1호가 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 (공백) + - excd (str): 거래소코드 (NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 HKS : 홍콩 SHS : 상해 SZS : 심천 HSX : 호치민 HNX : 하노이 TSE : 도쿄 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간)) + - symb (str): 종목코드 (종목코드 예)TSLA) + + Returns: + - DataFrame: 해외주식 현재가 1호가 결과 + + Example: + >>> df1, df2, df3 = inquire_asking_price(auth="", excd="NAS", symb="TSLA") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 해외주식 현재가 1호가") + result1, result2, result3 = inquire_asking_price( + auth="", # 사용자권한정보 + excd="NAS", # 거래소코드 + symb="TSLA", # 종목코드 + ) + + # 결과 확인 + results = [result1, result2, result3] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + # output1 처리 + if result1 is not None and not result1.empty: + logger.info("=== output1 결과 ===") + logger.info("사용 가능한 컬럼 목록:") + logger.info(result1.columns.tolist()) + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("조회된 데이터 건수: %d", len(result1)) + print("=== output1 ===") + print(result1) + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if result2 is not None and not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("조회된 데이터 건수: %d", len(result2)) + print("=== output2 ===") + print(result2) + + # output3 결과 처리 + logger.info("=== output3 조회 ===") + if result3 is not None and not result3.empty: + logger.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 통합 컬럼명 한글 변환 + result3 = result3.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logger.info("조회된 데이터 건수: %d", len(result3)) + print("=== output3 ===") + print(result3) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/inquire_asking_price.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/inquire_asking_price.py new file mode 100644 index 0000000..64d8046 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_asking_price/inquire_asking_price.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-03 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가 1호가[해외주식-033] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-asking-price" + +def inquire_asking_price( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재가 1호가[해외주식-033] + 해외주식 현재가 1호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소코드 (예: NYS, NAS, AMS, 등) + symb (str): 종목코드 (예: TSLA) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 현재가 1호가 데이터 + + Example: + >>> df1, df2, df3 = inquire_asking_price(auth="your_auth_token", excd="NAS", symb="TSLA") + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + tr_id = "HHDFS76200100" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + auth, + excd, + symb, + "N", dataframe1, dataframe2, dataframe3, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/chk_inquire_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/chk_inquire_balance.py new file mode 100644 index 0000000..c1bd632 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/chk_inquire_balance.py @@ -0,0 +1,134 @@ +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_balance import inquire_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고 [v1_해외주식-006] +############################################################################################## + +COLUMN_MAPPING = { + 'cano': '종합계좌번호', + 'acnt_prdt_cd': '계좌상품코드', + 'prdt_type_cd': '상품유형코드', + 'ovrs_pdno': '해외상품번호', + 'frcr_evlu_pfls_amt': '외화평가손익금액', + 'evlu_pfls_rt': '평가손익율', + 'pchs_avg_pric': '매입평균가격', + 'ovrs_cblc_qty': '해외잔고수량', + 'ord_psbl_qty': '주문가능수량', + 'frcr_pchs_amt1': '외화매입금액1', + 'ovrs_stck_evlu_amt': '해외주식평가금액', + 'now_pric2': '현재가격2', + 'tr_crcy_cd': '거래통화코드', + 'ovrs_excg_cd': '해외거래소코드', + 'loan_type_cd': '대출유형코드', + 'loan_dt': '대출일자', + 'expd_dt': '만기일자', + 'frcr_pchs_amt1': '외화매입금액1', + 'ovrs_rlzt_pfls_amt': '해외실현손익금액', + 'ovrs_tot_pfls': '해외총손익', + 'rlzt_erng_rt': '실현수익율', + 'tot_evlu_pfls_amt': '총평가손익금액', + 'tot_pftrt': '총수익률', + 'frcr_buy_amt_smtl1': '외화매수금액합계1', + 'ovrs_rlzt_pfls_amt2': '해외실현손익금액2', + 'frcr_buy_amt_smtl2': '외화매수금액합계2' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 잔고[해외주식-006] + + 해외주식 잔고 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + - ovrs_excg_cd (str): 해외거래소코드 () + - tr_crcy_cd (str): 거래통화코드 () + - FK200 (str): 연속조회검색조건200 () + - NK200 (str): 연속조회키200 () + + Returns: + - DataFrame: 해외주식 잔고 결과 + + Example: + >>> df = inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", tr_crcy_cd="USD") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result1, result2 = inquire_balance( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + tr_crcy_cd="USD", # 거래통화코드 + FK200="", # 연속조회검색조건200 + NK200="", # 연속조회키200 + ) + + # output1 결과 처리 + logging.info("=== output1 결과 ===") + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output3 결과 처리 + logging.info("=== output2 결과 ===") + logging.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/inquire_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/inquire_balance.py new file mode 100644 index 0000000..8ccf8ac --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_balance/inquire_balance.py @@ -0,0 +1,181 @@ +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고 [v1_해외주식-006] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-balance" + +def inquire_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + tr_crcy_cd: str, # 거래통화코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 잔고[v1_해외주식-006] + 해외주식 잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): [모의] NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [실전] NASD : 미국전체 NAS : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [모의/실전 공통] SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + tr_crcy_cd (str): USD : 미국달러 HKD : 홍콩달러 CNY : 중국위안화 JPY : 일본엔화 VND : 베트남동 + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 잔고 데이터 + + Example: + >>> df1, df2 = inquire_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... tr_crcy_cd="USD", + ... FK200="", + ... NK200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not tr_crcy_cd: + logger.error("tr_crcy_cd is required. (e.g. 'USD')") + raise ValueError("tr_crcy_cd is required. (e.g. 'USD')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3012R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3012R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "TR_CRCY_CD": tr_crcy_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont, FK200, NK200 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_balance( + cano, + acnt_prdt_cd, + ovrs_excg_cd, + tr_crcy_cd, + FK200, + NK200, + env_dv, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/chk_inquire_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/chk_inquire_ccnl.py new file mode 100644 index 0000000..844a8b9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/chk_inquire_ccnl.py @@ -0,0 +1,158 @@ +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_ccnl import inquire_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문체결내역 [v1_해외주식-007] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'ord_dt': '주문일자', + 'ord_gno_brno': '주문채번지점번호', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'sll_buy_dvsn_cd_name': '매도매수구분코드명', + 'rvse_cncl_dvsn': '정정취소구분', + 'rvse_cncl_dvsn_name': '정정취소구분명', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'ft_ord_qty': 'FT주문수량', + 'ft_ord_unpr3': 'FT주문단가3', + 'ft_ccld_qty': 'FT체결수량', + 'ft_ccld_unpr3': 'FT체결단가3', + 'ft_ccld_amt3': 'FT체결금액3', + 'nccs_qty': '미체결수량', + 'prcs_stat_name': '처리상태명', + 'rjct_rson': '거부사유', + 'rjct_rson_name': '거부사유명', + 'ord_tmd': '주문시각', + 'tr_mket_name': '거래시장명', + 'tr_crcy_cd': '거래통화코드', + 'tr_natn': '거래국가', + 'ovrs_excg_cd': '해외거래소코드', + 'tr_natn_name': '거래국가명', + 'dmst_ord_dt': '국내주문일자', + 'thco_ord_tmd': '당사주문시각', + 'loan_type_cd': '대출유형코드', + 'loan_dt': '대출일자', + 'mdia_dvsn_name': '매체구분명', + 'usa_amk_exts_rqst_yn': '미국애프터마켓연장신청여부', + 'splt_buy_attr_name': '분할매수/매도속성명' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [] + + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 주문체결내역[v1_해외주식-007] + + 해외주식 주문체결내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - pdno (str): 상품번호 (전종목일 경우 "%" 입력 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능) + - ord_strt_dt (str): 주문시작일자 (YYYYMMDD 형식 (현지시각 기준)) + - ord_end_dt (str): 주문종료일자 (YYYYMMDD 형식 (현지시각 기준)) + - sll_buy_dvsn (str): 매도매수구분 (00 : 전체 01 : 매도 02 : 매수 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능) + - ccld_nccs_dvsn (str): 체결미체결구분 (00 : 전체 01 : 체결 02 : 미체결 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능) + - ovrs_excg_cd (str): 해외거래소코드 (전종목일 경우 "%" 입력 NASD : 미국시장 전체(나스닥, 뉴욕, 아멕스) NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능) + - sort_sqn (str): 정렬순서 (DS : 정순 AS : 역순 ※ 모의투자계좌의 경우 정렬순서 사용불가(Default : DS(정순))) + - ord_dt (str): 주문일자 ("" (Null 값 설정)) + - ord_gno_brno (str): 주문채번지점번호 ("" (Null 값 설정)) + - odno (str): 주문번호 ("" (Null 값 설정) ※ 주문번호로 검색 불가능합니다. 반드시 ""(Null 값 설정) 바랍니다.) + - NK200 (str): 연속조회키200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터)) + - FK200 (str): 연속조회검색조건200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터)) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 주문체결내역 결과 + + Example: + >>> df = inquire_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="%", ord_strt_dt="20250101", ord_end_dt="20250131", sll_buy_dvsn="00", ccld_nccs_dvsn="00", ovrs_excg_cd="NASD", sort_sqn="DS", ord_dt="", ord_gno_brno="", odno="", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = inquire_ccnl( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + pdno="%", # 상품번호 + ord_strt_dt="20250601", # 주문시작일자 + ord_end_dt="20250630", # 주문종료일자 + sll_buy_dvsn="00", # 매도매수구분 + ccld_nccs_dvsn="00", # 체결미체결구분 + ovrs_excg_cd="NASD", # 해외거래소코드 + sort_sqn="DS", # 정렬순서 + env_dv="real", # 실전모의구분 + ord_dt="", + ord_gno_brno="", + odno="", + ) + + if result is None: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 주문체결내역 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/inquire_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/inquire_ccnl.py new file mode 100644 index 0000000..046fa3a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_ccnl/inquire_ccnl.py @@ -0,0 +1,200 @@ +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문체결내역 [v1_해외주식-007] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-ccnl" + + +def inquire_ccnl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + ord_strt_dt: str, # 주문시작일자 + ord_end_dt: str, # 주문종료일자 + sll_buy_dvsn: str, # 매도매수구분 + ccld_nccs_dvsn: str, # 체결미체결구분 + sort_sqn: str, # 정렬순서 + ord_dt: str, # 주문일자 + ord_gno_brno: str, # 주문채번지점번호 + odno: str, # 주문번호 + ovrs_excg_cd: str = "", # 해외거래소코드 + NK200: str = "", # 연속조회키200 + FK200: str = "", # 연속조회검색조건200 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 주문체결내역[v1_해외주식-007] + 해외주식 주문체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + pdno (str): 전종목일 경우 "%" 입력 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능 + ord_strt_dt (str): YYYYMMDD 형식 (현지시각 기준) + ord_end_dt (str): YYYYMMDD 형식 (현지시각 기준) + sll_buy_dvsn (str): 00 : 전체 01 : 매도 02 : 매수 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + ccld_nccs_dvsn (str): 00 : 전체 01 : 체결 02 : 미체결 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + ovrs_excg_cd (str): 전종목일 경우 "%" 입력 NASD : 미국시장 전체(나스닥, 뉴욕, 아멕스) NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능 + sort_sqn (str): DS : 정순 AS : 역순 ※ 모의투자계좌의 경우 정렬순서 사용불가(Default : DS(정순)) + ord_dt (str): "" (Null 값 설정) + ord_gno_brno (str): "" (Null 값 설정) + odno (str): "" (Null 값 설정) ※ 주문번호로 검색 불가능합니다. 반드시 ""(Null 값 설정) 바랍니다. + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 주문체결내역 데이터 + + Example: + >>> df = inquire_ccnl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="", + ... ord_strt_dt="20250601", + ... ord_end_dt="20250630", + ... sll_buy_dvsn="00", + ... ccld_nccs_dvsn="00", + ... ovrs_excg_cd="%", + ... sort_sqn="DS", + ... ord_dt="", + ... ord_gno_brno="02111", + ... odno="", + ... NK200="", + ... FK200="" + ... ) + >>> print(df) + """ + + + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ord_strt_dt: + logger.error("ord_strt_dt is required. (e.g. '20211027')") + raise ValueError("ord_strt_dt is required. (e.g. '20211027')") + if not ord_end_dt: + logger.error("ord_end_dt is required. (e.g. '20211027')") + raise ValueError("ord_end_dt is required. (e.g. '20211027')") + if not sll_buy_dvsn: + logger.error("sll_buy_dvsn is required. (e.g. '00')") + raise ValueError("sll_buy_dvsn is required. (e.g. '00')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '00')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '00')") + if not sort_sqn: + logger.error("sort_sqn is required. (e.g. 'DS')") + raise ValueError("sort_sqn is required. (e.g. 'DS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3035R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3035R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_STRT_DT": ord_strt_dt, + "ORD_END_DT": ord_end_dt, + "SLL_BUY_DVSN": sll_buy_dvsn, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "OVRS_EXCG_CD": ovrs_excg_cd, + "SORT_SQN": sort_sqn, + "ORD_DT": ord_dt, + "ORD_GNO_BRNO": ord_gno_brno, + "ODNO": odno, + "CTX_AREA_NK200": NK200, + "CTX_AREA_FK200": FK200, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccnl( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + pdno=pdno, + ord_strt_dt=ord_strt_dt, + ord_end_dt=ord_end_dt, + sll_buy_dvsn=sll_buy_dvsn, + ccld_nccs_dvsn=ccld_nccs_dvsn, + ovrs_excg_cd=ovrs_excg_cd, + sort_sqn=sort_sqn, + ord_dt=ord_dt, + ord_gno_brno=ord_gno_brno, + odno=odno, + NK200=NK200, + FK200=FK200, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/chk_inquire_daily_chartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/chk_inquire_daily_chartprice.py new file mode 100644 index 0000000..fbce6f5 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/chk_inquire_daily_chartprice.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_daily_chartprice import inquire_daily_chartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] +############################################################################################## + +COLUMN_MAPPING = { + 'ovrs_nmix_prdy_vrss': '전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'prdy_ctrt': '전일 대비율', + 'ovrs_nmix_prdy_clpr': '전일 종가', + 'acml_vol': '누적 거래량', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'ovrs_nmix_prpr': '현재가', + 'stck_shrn_iscd': '단축 종목코드', + 'prdy_vol': '전일 거래량', + 'ovrs_prod_oprc': '시가', + 'ovrs_prod_hgpr': '최고가', + 'ovrs_prod_lwpr': '최저가', + 'stck_bsop_date': '영업 일자', + 'ovrs_nmix_prpr': '현재가', + 'ovrs_nmix_oprc': '시가', + 'ovrs_nmix_hgpr': '최고가', + 'ovrs_nmix_lwpr': '최저가', + 'acml_vol': '누적 거래량', + 'mod_yn': '변경 여부' +} + +NUMERIC_COLUMNS = ['전일 대비', '전일 대비율', '전일 종가', '누적 거래량', '현재가', '시가', '최고가', '최저가'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] + + 해외주식 종목_지수_환율기간별시세(일_주_월_년) 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (N: 해외지수, X 환율, I: 국채, S:금선물) + - fid_input_iscd (str): FID 입력 종목코드 (종목코드 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드(해외) > 해외지수) ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다.) + - fid_input_date_1 (str): FID 입력 날짜1 (시작일자(YYYYMMDD)) + - fid_input_date_2 (str): FID 입력 날짜2 (종료일자(YYYYMMDD)) + - fid_period_div_code (str): FID 기간 분류 코드 (D:일, W:주, M:월, Y:년) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 종목_지수_환율기간별시세(일_주_월_년) 결과 + + Example: + >>> df1, df2 = inquire_daily_chartprice(fid_cond_mrkt_div_code="N", fid_input_iscd=".DJI", fid_input_date_1="20250101", fid_input_date_2="20250131", fid_period_div_code="D", env_dv="real") # 실전투자 + >>> df1, df2 = inquire_daily_chartprice(fid_cond_mrkt_div_code="N", fid_input_iscd=".DJI", fid_input_date_1="20250101", fid_input_date_2="20250131", fid_period_div_code="D", env_dv="demo") # 모의투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + + + + # API 호출 + logger.info("API 호출 시작: 해외주식 종목_지수_환율기간별시세(일_주_월_년) (%s)", "실전투자" if env_dv == "real" else "모의투자") + result1, result2 = inquire_daily_chartprice( + fid_cond_mrkt_div_code="N", + fid_input_iscd="QQQ", + fid_input_date_1="20250101", + fid_input_date_2="20250131", + fid_period_div_code="D", + env_dv=env_dv, + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/inquire_daily_chartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/inquire_daily_chartprice.py new file mode 100644 index 0000000..e6503eb --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_daily_chartprice/inquire_daily_chartprice.py @@ -0,0 +1,175 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-daily-chartprice" + +def inquire_daily_chartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_date_1: str, # FID 입력 날짜1 + fid_input_date_2: str, # FID 입력 날짜2 + fid_period_div_code: str, # FID 기간 분류 코드 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] + 해외주식 종목_지수_환율기간별시세(일_주_월_년) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): N: 해외지수, X 환율, I: 국채, S:금선물 + fid_input_iscd (str): 종목코드 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드(해외) > 해외지수) ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다. + fid_input_date_1 (str): 시작일자(YYYYMMDD) + fid_input_date_2 (str): 종료일자(YYYYMMDD) + fid_period_div_code (str): D:일, W:주, M:월, Y:년 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 종목_지수_환율기간별시세(일_주_월_년) 데이터 + + Example: + >>> df1, df2 = inquire_daily_chartprice( + ... fid_cond_mrkt_div_code="N", + ... fid_input_iscd=".DJI", + ... fid_input_date_1="20220401", + ... fid_input_date_2="20220613", + ... fid_period_div_code="D", + ... env_dv="real" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'N')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'N')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '.DJI')") + raise ValueError("fid_input_iscd is required. (e.g. '.DJI')") + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20220401')") + raise ValueError("fid_input_date_1 is required. (e.g. '20220401')") + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20220613')") + raise ValueError("fid_input_date_2 is required. (e.g. '20220613')") + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKST03030100" # 실전투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_chartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + fid_period_div_code, + env_dv, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/chk_inquire_nccs.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/chk_inquire_nccs.py new file mode 100644 index 0000000..ca52eb3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/chk_inquire_nccs.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_nccs import inquire_nccs + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미체결내역 [v1_해외주식-005] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'ord_dt': '주문일자', + 'ord_gno_brno': '주문채번지점번호', + 'odno': '주문번호', + 'orgn_odno': '원주문번호', + 'pdno': '상품번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'rvse_cncl_dvsn_cd': '정정취소구분코드', + 'rjct_rson': '거부사유', + 'ord_tmd': '주문시각', + 'tr_crcy_cd': '거래통화코드', + 'natn_cd': '국가코드', + 'ft_ord_qty': 'FT주문수량', + 'ft_ccld_qty': 'FT체결수량', + 'nccs_qty': '미체결수량', + 'ft_ord_unpr3': 'FT주문단가3', + 'ft_ccld_unpr3': 'FT체결단가3', + 'ft_ccld_amt3': 'FT체결금액3', + 'ovrs_excg_cd': '해외거래소코드', + 'loan_type_cd': '대출유형코드', + 'loan_dt': '대출일자', + 'usa_amk_exts_rqst_yn': '미국애프터마켓연장신청여부', +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 미체결내역[v1_해외주식-005] + + 해외주식 미체결내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 * NASD 인 경우만 미국전체로 조회되며 나머지 거래소 코드는 해당 거래소만 조회됨 * 공백 입력 시 다음조회가 불가능하므로, 반드시 거래소코드 입력해야 함) + - sort_sqn (str): 정렬순서 (DS : 정순 그외 : 역순 [header tr_id: TTTS3018R] ""(공란)) + - FK200 (str): 연속조회검색조건200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터)) + - NK200 (str): 연속조회키200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터)) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 미체결내역 결과 + + Example: + >>> df = inquire_nccs(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", sort_sqn="DS", FK200="", NK200="", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = inquire_nccs( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + sort_sqn="DS", # 정렬순서 + FK200="", # 연속조회검색조건200 + NK200="", # 연속조회키200 + env_dv="real", # 실전모의구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 미체결내역 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/inquire_nccs.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/inquire_nccs.py new file mode 100644 index 0000000..6db92e4 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_nccs/inquire_nccs.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미체결내역 [v1_해외주식-005] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-nccs" + +def inquire_nccs( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + sort_sqn: str, # 정렬순서 + FK200: str, # 연속조회검색조건200 + NK200: str, # 연속조회키200 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미체결내역[v1_해외주식-005] + 해외주식 미체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 * NASD 인 경우만 미국전체로 조회되며 나머지 거래소 코드는 해당 거래소만 조회됨 * 공백 입력 시 다음조회가 불가능하므로, 반드시 거래소코드 입력해야 함 + sort_sqn (str): DS : 정순 그외 : 역순 [header tr_id: TTTS3018R] ""(공란) + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 미체결내역 데이터 + + Example: + >>> df = inquire_nccs( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NYSE", + ... sort_sqn="DS", + ... FK200="", + ... NK200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NYSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NYSE')") + if not sort_sqn: + logger.error("sort_sqn is required. (e.g. 'DS')") + raise ValueError("sort_sqn is required. (e.g. 'DS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTS3018R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "SORT_SQN": sort_sqn, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_nccs( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + sort_sqn=sort_sqn, + FK200=FK200, + NK200=NK200, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe is not None and not dataframe.empty: + logger.info("Returning already collected data due to API error.") + return dataframe + else: + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/chk_inquire_paymt_stdr_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/chk_inquire_paymt_stdr_balance.py new file mode 100644 index 0000000..521b265 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/chk_inquire_paymt_stdr_balance.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_paymt_stdr_balance import inquire_paymt_stdr_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 결제기준잔고 [해외주식-064] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'cblc_qty13': '잔고수량13', + 'ord_psbl_qty1': '주문가능수량1', + 'avg_unpr3': '평균단가3', + 'ovrs_now_pric1': '해외현재가격1', + 'frcr_pchs_amt': '외화매입금액', + 'frcr_evlu_amt2': '외화평가금액2', + 'evlu_pfls_amt2': '평가손익금액2', + 'bass_exrt': '기준환율', + 'oprt_dtl_dtime': '조작상세일시', + 'buy_crcy_cd': '매수통화코드', + 'thdt_sll_ccld_qty1': '당일매도체결수량1', + 'thdt_buy_ccld_qty1': '당일매수체결수량1', + 'evlu_pfls_rt1': '평가손익율1', + 'tr_mket_name': '거래시장명', + 'natn_kor_name': '국가한글명', + 'std_pdno': '표준상품번호', + 'mgge_qty': '담보수량', + 'loan_rmnd': '대출잔액', + 'prdt_type_cd': '상품유형코드', + 'ovrs_excg_cd': '해외거래소코드', + 'scts_dvsn_name': '유가증권구분명', + 'ldng_cblc_qty': '대여잔고수량', + 'crcy_cd': '통화코드', + 'crcy_cd_name': '통화코드명', + 'frcr_dncl_amt_2': '외화예수금액2', + 'frst_bltn_exrt': '최초고시환율', + 'frcr_evlu_amt2': '외화평가금액2', + 'pchs_amt_smtl_amt': '매입금액합계금액', + 'tot_evlu_pfls_amt': '총평가손익금액', + 'evlu_erng_rt1': '평가수익율1', + 'tot_dncl_amt': '총예수금액', + 'wcrc_evlu_amt_smtl': '원화평가금액합계', + 'tot_asst_amt2': '총자산금액2', + 'frcr_cblc_wcrc_evlu_amt_smtl': '외화잔고원화평가금액합계', + 'tot_loan_amt': '총대출금액', + 'tot_ldng_evlu_amt': '총대여평가금액' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + '잔고수량13', '주문가능수량1', '평균단가3', '해외현재가격1', '외화매입금액', + '외화평가금액2', '평가손익금액2', '기준환율', '당일매도체결수량1', '당일매수체결수량1', + '평가손익율1', '담보수량', '대출잔액', '대여잔고수량', '외화예수금액2', + '최초고시환율', '매입금액합계금액', '총평가손익금액', '평가수익율1', '총예수금액', + '원화평가금액합계', '총자산금액2', '외화잔고원화평가금액합계', '총대출금액', '총대여평가금액' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 결제기준잔고[해외주식-064] + + 해외주식 결제기준잔고 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 () + - acnt_prdt_cd (str): 계좌상품코드 () + - bass_dt (str): 기준일자 () + - wcrc_frcr_dvsn_cd (str): 원화외화구분코드 (01(원화기준),02(외화기준)) + - inqr_dvsn_cd (str): 조회구분코드 (00(전체), 01(일반), 02(미니스탁)) + + Returns: + - DataFrame: 해외주식 결제기준잔고 결과 + + Example: + >>> df1, df2, df3 = inquire_paymt_stdr_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, bass_dt="20250630", wcrc_frcr_dvsn_cd="01", inqr_dvsn_cd="00") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result1, result2, result3 = inquire_paymt_stdr_balance( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + bass_dt="20250630", # 기준일자 + wcrc_frcr_dvsn_cd="01", # 원화외화구분코드 + inqr_dvsn_cd="00", # 조회구분코드 + ) + + # 결과 확인 + results = [result1, result2, result3] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + # output3 결과 처리 + logger.info("=== output3 조회 ===") + if not result3.empty: + logger.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result3 = result3.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logger.info("output3 결과:") + print(result3) + else: + logger.info("output3 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/inquire_paymt_stdr_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/inquire_paymt_stdr_balance.py new file mode 100644 index 0000000..77d3010 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_paymt_stdr_balance/inquire_paymt_stdr_balance.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 결제기준잔고 [해외주식-064] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance" + +def inquire_paymt_stdr_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + bass_dt: str, # 기준일자 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + inqr_dvsn_cd: str, # 조회구분코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 결제기준잔고[해외주식-064] + 해외주식 결제기준잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + bass_dt (str): 기준일자 + wcrc_frcr_dvsn_cd (str): 원화외화구분코드 (01: 원화기준, 02: 외화기준) + inqr_dvsn_cd (str): 조회구분코드 (00: 전체, 01: 일반, 02: 미니스탁) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 결제기준잔고 데이터 + + Example: + >>> df1, df2, df3 = inquire_paymt_stdr_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... bass_dt="20230630", + ... wcrc_frcr_dvsn_cd="01", + ... inqr_dvsn_cd="00" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not bass_dt: + logger.error("bass_dt is required. (e.g. '20230630')") + raise ValueError("bass_dt is required. (e.g. '20230630')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + if not inqr_dvsn_cd: + logger.error("inqr_dvsn_cd is required. (e.g. '00')") + raise ValueError("inqr_dvsn_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + tr_id = "CTRP6010R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "BASS_DT": bass_dt, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "INQR_DVSN_CD": inqr_dvsn_cd, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_paymt_stdr_balance( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + bass_dt=bass_dt, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + inqr_dvsn_cd=inqr_dvsn_cd, + dataframe1=dataframe1, + dataframe2=dataframe2, + dataframe3=dataframe3, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/chk_inquire_period_profit.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/chk_inquire_period_profit.py new file mode 100644 index 0000000..3032b14 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/chk_inquire_period_profit.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_period_profit import inquire_period_profit + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익 [v1_해외주식-032] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'trad_day': '매매일', + 'ovrs_pdno': '해외상품번호', + 'slcl_qty': '매도청산수량', + 'pchs_avg_pric': '매입평균가격', + 'frcr_pchs_amt1': '외화매입금액1', + 'avg_sll_unpr': '평균매도단가', + 'frcr_sll_amt_smtl1': '외화매도금액합계1', + 'stck_sll_tlex': '주식매도제비용', + 'ovrs_rlzt_pfls_amt': '해외실현손익금액', + 'pftrt': '수익률', + 'exrt': '환율', + 'ovrs_excg_cd': '해외거래소코드', + 'frst_bltn_exrt': '최초고시환율', + 'stck_sll_amt_smtl': '주식매도금액합계', + 'stck_buy_amt_smtl': '주식매수금액합계', + 'smtl_fee1': '합계수수료1', + 'excc_dfrm_amt': '정산지급금액', + 'ovrs_rlzt_pfls_tot_amt': '해외실현손익총금액', + 'tot_pftrt': '총수익률', + 'bass_dt': '기준일자', + 'exrt': '환율' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + 'slcl_qty', 'pchs_avg_pric', 'frcr_pchs_amt1', 'avg_sll_unpr', 'frcr_sll_amt_smtl1', + 'stck_sll_tlex', 'ovrs_rlzt_pfls_amt', 'pftrt', 'exrt', 'frst_bltn_exrt', + 'stck_sll_amt_smtl', 'stck_buy_amt_smtl', 'smtl_fee1', 'excc_dfrm_amt', + 'ovrs_rlzt_pfls_tot_amt', 'tot_pftrt' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 기간손익[v1_해외주식-032] + + 해외주식 기간손익 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (공란 : 전체, NASD : 미국, SEHK : 홍콩, SHAA : 중국, TKSE : 일본, HASE : 베트남) + - natn_cd (str): 국가코드 (공란(Default)) + - crcy_cd (str): 통화코드 (공란 : 전체 USD : 미국달러, HKD : 홍콩달러, CNY : 중국위안화, JPY : 일본엔화, VND : 베트남동) + - pdno (str): 상품번호 (공란 : 전체) + - inqr_strt_dt (str): 조회시작일자 (YYYYMMDD) + - inqr_end_dt (str): 조회종료일자 (YYYYMMDD) + - wcrc_frcr_dvsn_cd (str): 원화외화구분코드 (01 : 외화, 02 : 원화) + - FK200 (str): 연속조회검색조건200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터)) + - NK200 (str): 연속조회키200 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터)) + + Returns: + - DataFrame: 해외주식 기간손익 결과 (output1: 기간손익 목록, output2: 기간손익 요약) + + Example: + >>> df1, df2 = inquire_period_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", natn_cd="", crcy_cd="USD", pdno="", inqr_strt_dt="20230101", inqr_end_dt="20231231", wcrc_frcr_dvsn_cd="01", FK200="", NK200="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result1, result2 = inquire_period_profit( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + natn_cd="", # 국가코드 + crcy_cd="USD", # 통화코드 + pdno="", # 상품번호 + inqr_strt_dt="20240601", # 조회시작일자 + inqr_end_dt="20240630", # 조회종료일자 + wcrc_frcr_dvsn_cd="01", # 원화외화구분코드 + FK200="", # 연속조회검색조건200 + NK200="" # 연속조회키200 + ) + + if result1 is None or result1.empty: + logger.warning("조회된 기간손익 목록 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록 (output1):") + logger.info(result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 기간손익 목록 (output1) ===") + logger.info("조회된 데이터 건수: %d", len(result1)) + print(result1) + + if result2 is None or result2.empty: + logger.warning("조회된 기간손익 요약 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록 (output2):") + logger.info(result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 기간손익 요약 (output2) ===") + logger.info("조회된 데이터 건수: %d", len(result2)) + print(result2) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/inquire_period_profit.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/inquire_period_profit.py new file mode 100644 index 0000000..50bb590 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_profit/inquire_period_profit.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익 [v1_해외주식-032] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-period-profit" + +def inquire_period_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + natn_cd: str, # 국가코드 + crcy_cd: str, # 통화코드 + pdno: str, # 상품번호 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + FK200: str, # 연속조회검색조건200 + NK200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 기간손익[v1_해외주식-032] + 해외주식 기간손익 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): 공란 : 전체, NASD : 미국, SEHK : 홍콩, SHAA : 중국, TKSE : 일본, HASE : 베트남 + natn_cd (str): 공란(Default) + crcy_cd (str): 공란 : 전체 USD : 미국달러, HKD : 홍콩달러, CNY : 중국위안화, JPY : 일본엔화, VND : 베트남동 + pdno (str): 공란 : 전체 + inqr_strt_dt (str): YYYYMMDD + inqr_end_dt (str): YYYYMMDD + wcrc_frcr_dvsn_cd (str): 01 : 외화, 02 : 원화 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 기간손익 데이터 + + Example: + >>> df1, df2 = inquire_period_profit( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... natn_cd="", + ... crcy_cd="USD", + ... pdno="", + ... inqr_strt_dt="20230101", + ... inqr_end_dt="20231231", + ... wcrc_frcr_dvsn_cd="01", + ... FK200="", + ... NK200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'USD')") + raise ValueError("crcy_cd is required. (e.g. 'USD')") + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20231231')") + raise ValueError("inqr_end_dt is required. (e.g. '20231231')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "TTTS3039R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "NATN_CD": natn_cd, + "CRCY_CD": crcy_cd, + "PDNO": pdno, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_profit( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + natn_cd=natn_cd, + crcy_cd=crcy_cd, + pdno=pdno, + inqr_strt_dt=inqr_strt_dt, + inqr_end_dt=inqr_end_dt, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + FK200=FK200, + NK200=NK200, + dataframe1=dataframe1, + dataframe2=dataframe2, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/chk_inquire_period_trans.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/chk_inquire_period_trans.py new file mode 100644 index 0000000..5053dcc --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/chk_inquire_period_trans.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_period_trans import inquire_period_trans + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역 [해외주식-063] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'trad_dt': '매매일자', + 'sttl_dt': '결제일자', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'sll_buy_dvsn_name': '', + 'pdno': '상품번호', + 'ovrs_item_name': '', + 'ccld_qty': '체결수량', + 'amt_unit_ccld_qty': '금액단위체결수량', + 'ft_ccld_unpr2': 'FT체결단가2', + 'ovrs_stck_ccld_unpr': '해외주식체결단가', + 'tr_frcr_amt2': '거래외화금액2', + 'tr_amt': '거래금액', + 'frcr_excc_amt_1': '외화정산금액1', + 'wcrc_excc_amt': '원화정산금액', + 'dmst_frcr_fee1': '국내외화수수료1', + 'frcr_fee1': '외화수수료1', + 'dmst_wcrc_fee': '국내원화수수료', + 'ovrs_wcrc_fee': '해외원화수수료', + 'crcy_cd': '통화코드', + 'std_pdno': '표준상품번호', + 'erlm_exrt': '등록환율', + 'loan_dvsn_cd': '대출구분코드', + 'loan_dvsn_name': '', + 'frcr_buy_amt_smtl': '외화매수금액합계', + 'frcr_sll_amt_smtl': '외화매도금액합계', + 'dmst_fee_smtl': '국내수수료합계', + 'ovrs_fee_smtl': '해외수수료합계' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + 'ccld_qty', 'amt_unit_ccld_qty', 'ft_ccld_unpr2', 'ovrs_stck_ccld_unpr', 'tr_frcr_amt2', + 'tr_amt', 'frcr_excc_amt_1', 'wcrc_excc_amt', 'dmst_frcr_fee1', 'frcr_fee1', + 'dmst_wcrc_fee', 'ovrs_wcrc_fee', 'erlm_exrt', 'frcr_buy_amt_smtl', 'frcr_sll_amt_smtl', + 'dmst_fee_smtl', 'ovrs_fee_smtl' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 일별거래내역[해외주식-063] + + 해외주식 일별거래내역 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - erlm_strt_dt (str): 등록시작일자 (예: 20240420) + - erlm_end_dt (str): 등록종료일자 (예: 20240520) + - ovrs_excg_cd (str): 해외거래소코드 + - pdno (str): 상품번호 + - sll_buy_dvsn_cd (str): 매도매수구분코드 (00: 전체, 01: 매도, 02: 매수) + - loan_dvsn_cd (str): 대출구분코드 + - FK100 (str): 연속조회검색조건100 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)) + - NK100 (str): 연속조회키100 (공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)) + + Returns: + - DataFrame: 해외주식 일별거래내역 결과 (output1: 거래내역 목록, output2: 거래내역 요약) + + Example: + >>> df1, df2 = inquire_period_trans(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, erlm_strt_dt="20240420", erlm_end_dt="20240520", ovrs_excg_cd="NAS", pdno="", sll_buy_dvsn_cd="00", loan_dvsn_cd="", FK100="", NK100="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result1, result2 = inquire_period_trans( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + erlm_strt_dt="20240601", # 등록시작일자 + erlm_end_dt="20240630", # 등록종료일자 + ovrs_excg_cd="NASD", # 해외거래소코드 + pdno="", # 상품번호 + sll_buy_dvsn_cd="00", # 매도매수구분코드 + loan_dvsn_cd="", # 대출구분코드 + FK100="", # 연속조회검색조건100 + NK100="" # 연속조회키100 + ) + + if result1 is None or result1.empty: + logger.warning("조회된 거래내역 목록 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록 (output1):") + logger.info(result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 일별거래내역 목록 (output1) ===") + logger.info("조회된 데이터 건수: %d", len(result1)) + print(result1) + + if result2 is None or result2.empty: + logger.warning("조회된 거래내역 요약 데이터가 없습니다.") + else: + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록 (output2):") + logger.info(result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 일별거래내역 요약 (output2) ===") + logger.info("조회된 데이터 건수: %d", len(result2)) + print(result2) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/inquire_period_trans.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/inquire_period_trans.py new file mode 100644 index 0000000..689a690 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_period_trans/inquire_period_trans.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역 [해외주식-063] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-period-trans" + +def inquire_period_trans( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + erlm_strt_dt: str, # 등록시작일자 + erlm_end_dt: str, # 등록종료일자 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + loan_dvsn_cd: str, # 대출구분코드 + FK100: str, # 연속조회검색조건100 + NK100: str, # 연속조회키100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 일별거래내역[해외주식-063] + 해외주식 일별거래내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + erlm_strt_dt (str): 등록시작일자 (예: 20240420) + erlm_end_dt (str): 등록종료일자 (예: 20240520) + ovrs_excg_cd (str): 해외거래소코드 + pdno (str): 상품번호 + sll_buy_dvsn_cd (str): 매도매수구분코드 (00: 전체, 01: 매도, 02: 매수) + loan_dvsn_cd (str): 대출구분코드 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 일별거래내역 데이터 + + Example: + >>> df1, df2 = inquire_period_trans( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... erlm_strt_dt="20240420", + ... erlm_end_dt="20240520", + ... ovrs_excg_cd="NAS", + ... pdno="", + ... sll_buy_dvsn_cd="00", + ... loan_dvsn_cd="", + ... FK100="", + ... NK100="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not erlm_strt_dt: + logger.error("erlm_strt_dt is required. (e.g. '20240420')") + raise ValueError("erlm_strt_dt is required. (e.g. '20240420')") + if not erlm_end_dt: + logger.error("erlm_end_dt is required. (e.g. '20240520')") + raise ValueError("erlm_end_dt is required. (e.g. '20240520')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NAS')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NAS')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '00')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '00')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTOS4001R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ERLM_STRT_DT": erlm_strt_dt, + "ERLM_END_DT": erlm_end_dt, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "LOAN_DVSN_CD": loan_dvsn_cd, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont, NK100, FK100 = res.getHeader().tr_cont, res.getBody().ctx_area_nk100, res.getBody().ctx_area_fk100 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_trans( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + erlm_strt_dt=erlm_strt_dt, + erlm_end_dt=erlm_end_dt, + ovrs_excg_cd=ovrs_excg_cd, + pdno=pdno, + sll_buy_dvsn_cd=sll_buy_dvsn_cd, + loan_dvsn_cd=loan_dvsn_cd, + FK100=FK100, + NK100=NK100, + dataframe1=dataframe1, + dataframe2=dataframe2, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/chk_inquire_present_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/chk_inquire_present_balance.py new file mode 100644 index 0000000..3bba055 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/chk_inquire_present_balance.py @@ -0,0 +1,223 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_present_balance import inquire_present_balance + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 [v1_해외주식-008] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'cblc_qty13': '잔고수량13', + 'thdt_buy_ccld_qty1': '당일매수체결수량1', + 'thdt_sll_ccld_qty1': '당일매도체결수량1', + 'ccld_qty_smtl1': '체결수량합계1', + 'ord_psbl_qty1': '주문가능수량1', + 'frcr_pchs_amt': '외화매입금액', + 'frcr_evlu_amt2': '외화평가금액2', + 'evlu_pfls_amt2': '평가손익금액2', + 'evlu_pfls_rt1': '평가손익율1', + 'pdno': '상품번호', + 'bass_exrt': '기준환율', + 'buy_crcy_cd': '매수통화코드', + 'ovrs_now_pric1': '해외현재가격1', + 'avg_unpr3': '평균단가3', + 'tr_mket_name': '거래시장명', + 'natn_kor_name': '국가한글명', + 'pchs_rmnd_wcrc_amt': '매입잔액원화금액', + 'thdt_buy_ccld_frcr_amt': '당일매수체결외화금액', + 'thdt_sll_ccld_frcr_amt': '당일매도체결외화금액', + 'unit_amt': '단위금액', + 'std_pdno': '표준상품번호', + 'prdt_type_cd': '상품유형코드', + 'loan_rmnd': '대출잔액', + 'loan_dt': '대출일자', + 'loan_expd_dt': '대출만기일자', + 'ovrs_excg_cd': '해외거래소코드', + 'item_lnkg_excg_cd': '종목연동거래소코드', + 'crcy_cd': '통화코드', + 'frcr_buy_amt_smtl': '외화매수금액합계', + 'frcr_sll_amt_smtl': '외화매도금액합계', + 'frcr_dncl_amt_2': '외화예수금액2', + 'frst_bltn_exrt': '최초고시환율', + 'frcr_buy_mgn_amt': '외화매수증거금액', + 'frcr_etc_mgna': '외화기타증거금', + 'frcr_drwg_psbl_amt_1': '외화출금가능금액1', + 'frcr_evlu_amt2': '출금가능원화금액', + 'acpl_cstd_crcy_yn': '현지보관통화여부', + 'nxdy_frcr_drwg_psbl_amt': '익일외화출금가능금액', + 'output3': '응답상세3', + 'pchs_amt_smtl': '매입금액합계', + 'evlu_amt_smtl': '평가금액합계', + 'evlu_pfls_amt_smtl': '평가손익금액합계', + 'dncl_amt': '예수금액', + 'cma_evlu_amt': 'CMA평가금액', + 'tot_dncl_amt': '총예수금액', + 'etc_mgna': '기타증거금', + 'wdrw_psbl_tot_amt': '인출가능총금액', + 'frcr_evlu_tota': '외화평가총액', + 'evlu_erng_rt1': '평가수익율1', + 'pchs_amt_smtl_amt': '매입금액합계금액', + 'evlu_amt_smtl_amt': '평가금액합계금액', + 'tot_evlu_pfls_amt': '총평가손익금액', + 'tot_asst_amt': '총자산금액', + 'buy_mgn_amt': '매수증거금액', + 'mgna_tota': '증거금총액', + 'frcr_use_psbl_amt': '외화사용가능금액', + 'ustl_sll_amt_smtl': '미결제매도금액합계', + 'ustl_buy_amt_smtl': '미결제매수금액합계', + 'tot_frcr_cblc_smtl': '총외화잔고합계', + 'tot_loan_amt': '총대출금액' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + 'cblc_qty13', 'thdt_buy_ccld_qty1', 'thdt_sll_ccld_qty1', 'ccld_qty_smtl1', 'ord_psbl_qty1', + 'frcr_pchs_amt', 'frcr_evlu_amt2', 'evlu_pfls_amt2', 'evlu_pfls_rt1', 'bass_exrt', + 'ovrs_now_pric1', 'avg_unpr3', 'pchs_rmnd_wcrc_amt', 'thdt_buy_ccld_frcr_amt', 'thdt_sll_ccld_frcr_amt', + 'unit_amt', 'loan_rmnd', 'frcr_buy_amt_smtl', 'frcr_sll_amt_smtl', 'frcr_dncl_amt_2', + 'frst_bltn_exrt', 'frcr_buy_mgn_amt', 'frcr_etc_mgna', 'frcr_drwg_psbl_amt_1', 'frcr_evlu_amt2', + 'nxdy_frcr_drwg_psbl_amt', 'pchs_amt_smtl', 'evlu_amt_smtl', 'evlu_pfls_amt_smtl', 'dncl_amt', + 'cma_evlu_amt', 'tot_dncl_amt', 'etc_mgna', 'wdrw_psbl_tot_amt', 'frcr_evlu_tota', + 'evlu_erng_rt1', 'pchs_amt_smtl_amt', 'evlu_amt_smtl_amt', 'tot_evlu_pfls_amt', 'tot_asst_amt', + 'buy_mgn_amt', 'mgna_tota', 'frcr_use_psbl_amt', 'ustl_sll_amt_smtl', 'ustl_buy_amt_smtl', + 'tot_frcr_cblc_smtl', 'tot_loan_amt' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 체결기준현재잔고[v1_해외주식-008] + + 해외주식 체결기준현재잔고 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - wcrc_frcr_dvsn_cd (str): 원화외화구분코드 (01 : 원화 02 : 외화) + - natn_cd (str): 국가코드 (000 전체 840 미국 344 홍콩 156 중국 392 일본 704 베트남) + - tr_mket_cd (str): 거래시장코드 ([Request body NATN_CD 000 설정] 00 : 전체 [Request body NATN_CD 840 설정] 00 : 전체 01 : 나스닥(NASD) 02 : 뉴욕거래소(NYSE) 03 : 미국(PINK SHEETS) 04 : 미국(OTCBB) 05 : 아멕스(AMEX) [Request body NATN_CD 156 설정] 00 : 전체 01 : 상해B 02 : 심천B 03 : 상해A 04 : 심천A [Request body NATN_CD 392 설정] 01 : 일본 [Request body NATN_CD 704 설정] 01 : 하노이거래 02 : 호치민거래소 [Request body NATN_CD 344 설정] 01 : 홍콩 02 : 홍콩CNY 03 : 홍콩USD) + - inqr_dvsn_cd (str): 조회구분코드 (00 : 전체 01 : 일반해외주식 02 : 미니스탁) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 체결기준현재잔고 결과 + + Example: + >>> df1, df2, df3 = inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, wcrc_frcr_dvsn_cd="02", natn_cd="000", tr_mket_cd="00", inqr_dvsn_cd="00", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + + # API 호출 + logger.info("API 호출") + result1, result2, result3 = inquire_present_balance( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + wcrc_frcr_dvsn_cd="02", # 원화외화구분코드 + natn_cd="000", # 국가코드 + tr_mket_cd="00", # 거래시장코드 + inqr_dvsn_cd="00", # 조회구분코드 + env_dv=env_dv, # 실전모의구분 + ) + + # 결과 확인 + results = [result1, result2, result3] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + # output3 결과 처리 + logger.info("=== output3 조회 ===") + if not result3.empty: + logger.info("사용 가능한 컬럼: %s", result3.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result3 = result3.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result3.columns: + result3[col] = pd.to_numeric(result3[col], errors='coerce').round(2) + + logger.info("output3 결과:") + print(result3) + else: + logger.info("output3 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/inquire_present_balance.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/inquire_present_balance.py new file mode 100644 index 0000000..d71e9b3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_present_balance/inquire_present_balance.py @@ -0,0 +1,215 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 [v1_해외주식-008] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-present-balance" + +def inquire_present_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + natn_cd: str, # 국가코드 + tr_mket_cd: str, # 거래시장코드 + inqr_dvsn_cd: str, # 조회구분코드 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 체결기준현재잔고[v1_해외주식-008] + 해외주식 체결기준현재잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + wcrc_frcr_dvsn_cd (str): 01 : 원화 02 : 외화 + natn_cd (str): 000 전체 840 미국 344 홍콩 156 중국 392 일본 704 베트남 + tr_mket_cd (str): [Request body NATN_CD 000 설정] 00 : 전체 [Request body NATN_CD 840 설정] 00 : 전체 01 : 나스닥(NASD) 02 : 뉴욕거래소(NYSE) 03 : 미국(PINK SHEETS) 04 : 미국(OTCBB) 05 : 아멕스(AMEX) [Request body NATN_CD 156 설정] 00 : 전체 01 : 상해B 02 : 심천B 03 : 상해A 04 : 심천A [Request body NATN_CD 392 설정] 01 : 일본 [Request body NATN_CD 704 설정] 01 : 하노이거래 02 : 호치민거래소 [Request body NATN_CD 344 설정] 01 : 홍콩 02 : 홍콩CNY 03 : 홍콩USD + inqr_dvsn_cd (str): 00 : 전체 01 : 일반해외주식 02 : 미니스탁 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 체결기준현재잔고 데이터 + + Example: + >>> df1, df2, df3 = inquire_present_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... wcrc_frcr_dvsn_cd="01", + ... natn_cd="000", + ... tr_mket_cd="00", + ... inqr_dvsn_cd="00" + ... ) + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + if not natn_cd: + logger.error("natn_cd is required. (e.g. '000')") + raise ValueError("natn_cd is required. (e.g. '000')") + if not tr_mket_cd: + logger.error("tr_mket_cd is required. (e.g. '00')") + raise ValueError("tr_mket_cd is required. (e.g. '00')") + if not inqr_dvsn_cd: + logger.error("inqr_dvsn_cd is required. (e.g. '00')") + raise ValueError("inqr_dvsn_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "CTRP6504R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTRP6504R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "NATN_CD": natn_cd, + "TR_MKET_CD": tr_mket_cd, + "INQR_DVSN_CD": inqr_dvsn_cd, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_present_balance( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + natn_cd=natn_cd, + tr_mket_cd=tr_mket_cd, + inqr_dvsn_cd=inqr_dvsn_cd, + env_dv=env_dv, + dataframe1=dataframe1, + dataframe2=dataframe2, + dataframe3=dataframe3, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/chk_inquire_psamount.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/chk_inquire_psamount.py new file mode 100644 index 0000000..12c2144 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/chk_inquire_psamount.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_psamount import inquire_psamount + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 매수가능금액조회 [v1_해외주식-014] +############################################################################################## + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'tr_crcy_cd': '거래통화코드', + 'ord_psbl_frcr_amt': '주문가능외화금액', + 'sll_ruse_psbl_amt': '매도재사용가능금액', + 'ovrs_ord_psbl_amt': '해외주문가능금액', + 'max_ord_psbl_qty': '최대주문가능수량', + 'echm_af_ord_psbl_amt': '환전이후주문가능금액', + 'echm_af_ord_psbl_qty': '환전이후주문가능수량', + 'ord_psbl_qty': '주문가능수량', + 'exrt': '환율', + 'frcr_ord_psbl_amt1': '외화주문가능금액1', + 'ovrs_max_ord_psbl_qty': '해외최대주문가능수량' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 매수가능금액조회[v1_해외주식-014] + + 해외주식 매수가능금액조회 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD : 나스닥 / NYSE : 뉴욕 / AMEX : 아멕스 SEHK : 홍콩 / SHAA : 중국상해 / SZAA : 중국심천 TKSE : 일본 / HASE : 하노이거래소 / VNSE : 호치민거래소) + - ovrs_ord_unpr (str): 해외주문단가 (해외주문단가 (23.8) 정수부분 23자리, 소수부분 8자리) + - item_cd (str): 종목코드 (종목코드) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 매수가능금액조회 결과 + + Example: + >>> df = inquire_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", ovrs_ord_unpr="1.4", item_cd="QQQ", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = inquire_psamount( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + ovrs_excg_cd="NASD", + ovrs_ord_unpr="1.4", + item_cd="QQQ", + env_dv="real", + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 매수가능금액조회 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/inquire_psamount.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/inquire_psamount.py new file mode 100644 index 0000000..6529945 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_psamount/inquire_psamount.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 매수가능금액조회 [v1_해외주식-014] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/inquire-psamount" + +def inquire_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + ovrs_ord_unpr: str, # 해외주문단가 + item_cd: str, # 종목코드 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 매수가능금액조회[v1_해외주식-014] + 해외주식 매수가능금액조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 / NYSE : 뉴욕 / AMEX : 아멕스 SEHK : 홍콩 / SHAA : 중국상해 / SZAA : 중국심천 TKSE : 일본 / HASE : 하노이거래소 / VNSE : 호치민거래소 + ovrs_ord_unpr (str): 해외주문단가 (23.8) 정수부분 23자리, 소수부분 8자리 + item_cd (str): 종목코드 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 매수가능금액조회 데이터 + + Example: + >>> df = inquire_psamount( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... ovrs_ord_unpr="1.4", + ... item_cd="QQQ" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81019777')") + raise ValueError("cano is required. (e.g. '81019777')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '1.4')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '1.4')") + if not item_cd: + logger.error("item_cd is required. (e.g. 'QQQ')") + raise ValueError("item_cd is required. (e.g. 'QQQ')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3007R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3007R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "ITEM_CD": item_cd, + } + + res = ka._url_fetch(api_url=API_URL, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psamount( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + ovrs_ord_unpr=ovrs_ord_unpr, + item_cd=item_cd, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/chk_inquire_search.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/chk_inquire_search.py new file mode 100644 index 0000000..1ef28e3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/chk_inquire_search.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-27 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_search import inquire_search + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식조건검색[v1_해외주식-015] +############################################################################################## + +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'Record Count', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'last': '현재가', + 'shar': '발행주식', + 'valx': '시가총액', + 'plow': '저가', + 'phigh': '고가', + 'popen': '시가', + 'tvol': '거래량', + 'rate': '등락율', + 'diff': '대비', + 'sign': '기호', + 'avol': '거래대금', + 'eps': 'EPS', + 'per': 'PER', + 'rank': '순위', + 'e_ordyn': '매매가능' +} + +NUMERIC_COLUMNS = ['소수점자리수', '현재가', '발행주식', '시가총액', '저가', '고가', '시가', '거래량', '등락율', '대비', '기호', '거래대금', 'EPS', 'PER', '순위', '매매가능'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식조건검색[v1_해외주식-015] + + 해외주식조건검색 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 ("" (Null 값 설정)) + - excd (str): 거래소코드 (NYS : 뉴욕, NAS : 나스닥, AMS : 아멕스 HKS : 홍콩, SHS : 상해 , SZS : 심천 HSX : 호치민, HNX : 하노이 TSE : 도쿄) + - co_yn_pricecur (str): 현재가선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_pricecur (str): 현재가시작범위가 (단위: 각국통화(JPY, USD, HKD, CNY, VND)) + - co_en_pricecur (str): 현재가끝범위가 (단위: 각국통화(JPY, USD, HKD, CNY, VND)) + - co_yn_rate (str): 등락율선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_rate (str): 등락율시작율 (%) + - co_en_rate (str): 등락율끝율 (%) + - co_yn_valx (str): 시가총액선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_valx (str): 시가총액시작액 (단위: 천) + - co_en_valx (str): 시가총액끝액 (단위: 천) + - co_yn_shar (str): 발행주식수선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_shar (str): 발행주식시작수 (단위: 천) + - co_en_shar (str): 발행주식끝수 (단위: 천) + - co_yn_volume (str): 거래량선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_volume (str): 거래량시작량 (단위: 주) + - co_en_volume (str): 거래량끝량 (단위: 주) + - co_yn_amt (str): 거래대금선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_amt (str): 거래대금시작금 (단위: 천) + - co_en_amt (str): 거래대금끝금 (단위: 천) + - co_yn_eps (str): EPS선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_eps (str): EPS시작 () + - co_en_eps (str): EPS끝 () + - co_yn_per (str): PER선택조건 (해당조건 사용시(1), 미사용시 필수항목아님) + - co_st_per (str): PER시작 () + - co_en_per (str): PER끝 () + - keyb (str): NEXT KEY BUFF ("" 공백 입력) + + Returns: + - DataFrame: 해외주식조건검색 결과 + + Example: + >>> df1, df2 = inquire_search(auth="", excd="NYS", co_yn_pricecur="1", co_st_pricecur="100", co_en_pricecur="200", co_yn_rate="1", co_st_rate="5", co_en_rate="10", co_yn_valx="1", co_st_valx="1000", co_en_valx="5000", co_yn_shar="1", co_st_shar="100", co_en_shar="500", co_yn_volume="1", co_st_volume="1000", co_en_volume="5000", co_yn_amt="1", co_st_amt="1000", co_en_amt="5000", co_yn_eps="1", co_st_eps="1", co_en_eps="5", co_yn_per="1", co_st_per="10", co_en_per="20", keyb="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + + # API 호출 + logger.info("API 호출 시작: 해외주식조건검색") + result1, result2 = inquire_search( + auth = "", + excd = "NAS", + co_yn_pricecur = "1", + co_st_pricecur = "160", + co_en_pricecur = "170", + co_yn_rate = "", + co_st_rate = "", + co_en_rate = "", + co_yn_valx = "", + co_st_valx = "", + co_en_valx = "", + co_yn_shar = "", + co_st_shar = "", + co_en_shar = "", + co_yn_volume = "", + co_st_volume = "", + co_en_volume = "", + co_yn_amt = "", + co_st_amt = "", + co_en_amt = "", + co_yn_eps = "", + co_st_eps = "", + co_en_eps = "", + co_yn_per = "", + co_st_per = "", + co_en_per = "", + keyb = "", + ) + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/inquire_search.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/inquire_search.py new file mode 100644 index 0000000..8ff54c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_search/inquire_search.py @@ -0,0 +1,243 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-27 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식조건검색[v1_해외주식-015] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-search" + +def inquire_search( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + co_yn_pricecur: str, # 현재가선택조건 + co_st_pricecur: str, # 현재가시작범위가 + co_en_pricecur: str, # 현재가끝범위가 + co_yn_rate: str, # 등락율선택조건 + co_st_rate: str, # 등락율시작율 + co_en_rate: str, # 등락율끝율 + co_yn_valx: str, # 시가총액선택조건 + co_st_valx: str, # 시가총액시작액 + co_en_valx: str, # 시가총액끝액 + co_yn_shar: str, # 발행주식수선택조건 + co_st_shar: str, # 발행주식시작수 + co_en_shar: str, # 발행주식끝수 + co_yn_volume: str, # 거래량선택조건 + co_st_volume: str, # 거래량시작량 + co_en_volume: str, # 거래량끝량 + co_yn_amt: str, # 거래대금선택조건 + co_st_amt: str, # 거래대금시작금 + co_en_amt: str, # 거래대금끝금 + co_yn_eps: str, # EPS선택조건 + co_st_eps: str, # EPS시작 + co_en_eps: str, # EPS끝 + co_yn_per: str, # PER선택조건 + co_st_per: str, # PER시작 + co_en_per: str, # PER끝 + keyb: str, # NEXT KEY BUFF + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식조건검색[v1_해외주식-015] + 해외주식조건검색 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): "" (Null 값 설정) + excd (str): NYS : 뉴욕, NAS : 나스닥, AMS : 아멕스 HKS : 홍콩, SHS : 상해 , SZS : 심천 HSX : 호치민, HNX : 하노이 TSE : 도쿄 + co_yn_pricecur (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_pricecur (str): 단위: 각국통화(JPY, USD, HKD, CNY, VND) + co_en_pricecur (str): 단위: 각국통화(JPY, USD, HKD, CNY, VND) + co_yn_rate (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_rate (str): % + co_en_rate (str): % + co_yn_valx (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_valx (str): 단위: 천 + co_en_valx (str): 단위: 천 + co_yn_shar (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_shar (str): 단위: 천 + co_en_shar (str): 단위: 천 + co_yn_volume (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_volume (str): 단위: 주 + co_en_volume (str): 단위: 주 + co_yn_amt (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_amt (str): 단위: 천 + co_en_amt (str): 단위: 천 + co_yn_eps (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_eps (str): + co_en_eps (str): + co_yn_per (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_per (str): + co_en_per (str): + keyb (str): "" 공백 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식조건검색 데이터 + + Example: + >>> df1, df2 = inquire_search( + ... auth="", excd="NAS", co_yn_pricecur="1", co_st_pricecur="160", co_en_pricecur="161", + ... co_yn_rate="", co_st_rate="", co_en_rate="", co_yn_valx="", co_st_valx="", co_en_valx="", + ... co_yn_shar="", co_st_shar="", co_en_shar="", co_yn_volume="", co_st_volume="", co_en_volume="", + ... co_yn_amt="", co_st_amt="", co_en_amt="", co_yn_eps="", co_st_eps="", co_en_eps="", + ... co_yn_per="", co_st_per="", co_en_per="", keyb="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76410000" + + params = { + "AUTH": auth, + "EXCD": excd, + "CO_YN_PRICECUR": co_yn_pricecur, + "CO_ST_PRICECUR": co_st_pricecur, + "CO_EN_PRICECUR": co_en_pricecur, + "CO_YN_RATE": co_yn_rate, + "CO_ST_RATE": co_st_rate, + "CO_EN_RATE": co_en_rate, + "CO_YN_VALX": co_yn_valx, + "CO_ST_VALX": co_st_valx, + "CO_EN_VALX": co_en_valx, + "CO_YN_SHAR": co_yn_shar, + "CO_ST_SHAR": co_st_shar, + "CO_EN_SHAR": co_en_shar, + "CO_YN_VOLUME": co_yn_volume, + "CO_ST_VOLUME": co_st_volume, + "CO_EN_VOLUME": co_en_volume, + "CO_YN_AMT": co_yn_amt, + "CO_ST_AMT": co_st_amt, + "CO_EN_AMT": co_en_amt, + "CO_YN_EPS": co_yn_eps, + "CO_ST_EPS": co_st_eps, + "CO_EN_EPS": co_en_eps, + "CO_YN_PER": co_yn_per, + "CO_ST_PER": co_st_per, + "CO_EN_PER": co_en_per, + "KEYB": keyb, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_search( + auth, + excd, + co_yn_pricecur, + co_st_pricecur, + co_en_pricecur, + co_yn_rate, + co_st_rate, + co_en_rate, + co_yn_valx, + co_st_valx, + co_en_valx, + co_yn_shar, + co_st_shar, + co_en_shar, + co_yn_volume, + co_st_volume, + co_en_volume, + co_yn_amt, + co_st_amt, + co_en_amt, + co_yn_eps, + co_st_eps, + co_en_eps, + co_yn_per, + co_st_per, + co_en_per, + keyb, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py new file mode 100644 index 0000000..6a01d61 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/chk_inquire_time_indexchartprice.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_time_indexchartprice import inquire_time_indexchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외지수분봉조회[v1_해외주식-031] +############################################################################################## + +COLUMN_MAPPING = { + 'ovrs_nmix_prdy_vrss': '해외 지수 전일 대비', + 'prdy_vrss_sign': '전일 대비 부호', + 'hts_kor_isnm': 'HTS 한글 종목명', + 'prdy_ctrt': '전일 대비율', + 'ovrs_nmix_prdy_clpr': '해외 지수 전일 종가', + 'acml_vol': '누적 거래량', + 'ovrs_nmix_prpr': '해외 지수 현재가', + 'stck_shrn_iscd': '주식 단축 종목코드', + 'ovrs_prod_oprc': '해외 상품 시가2', + 'ovrs_prod_hgpr': '해외 상품 최고가', + 'ovrs_prod_lwpr': '해외 상품 최저가', + 'stck_bsop_date': '주식 영업 일자', + 'stck_cntg_hour': '주식 체결 시간', + 'optn_prpr': '옵션 현재가', + 'optn_oprc': '옵션 시가2', + 'optn_hgpr': '옵션 최고가', + 'optn_lwpr': '옵션 최저가', + 'cntg_vol': '체결 거래량' +} +NUMERIC_COLUMNS = ['해외 지수 전일 대비', '전일 대비율', '해외 지수 전일 종가', '누적 거래량', '해외 지수 현재가', '해외 상품 시가2', '해외 상품 최고가', '해외 상품 최저가', + '체결 거래량', '옵션 현재가', '옵션 시가2', '옵션 최고가', '옵션 최저가'] + +def main(): + """ + [해외주식] 기본시세 + 해외지수분봉조회[v1_해외주식-031] + + 해외지수분봉조회 테스트 함수 + + Parameters: + - fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (N 해외지수 X 환율 KX 원화환율) + - fid_input_iscd (str): 입력 종목코드 (종목번호(ex. TSLA)) + - fid_hour_cls_code (str): 시간 구분 코드 (0: 정규장, 1: 시간외) + - fid_pw_data_incu_yn (str): 과거 데이터 포함 여부 (Y/N) + + Returns: + - DataFrame: 해외지수분봉조회 결과 + + Example: + >>> df1, df2 = inquire_time_indexchartprice(fid_cond_mrkt_div_code="N", fid_input_iscd="TSLA", fid_hour_cls_code="0", fid_pw_data_incu_yn="Y") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # 해외지수분봉조회 파라미터 설정 + logger.info("API 파라미터 설정 중...") + fid_cond_mrkt_div_code = "N" # 조건 시장 분류 코드 + fid_input_iscd = "SPX" # 입력 종목코드 + fid_hour_cls_code = "0" # 시간 구분 코드 + fid_pw_data_incu_yn = "Y" # 과거 데이터 포함 여부 + + + # API 호출 + logger.info("API 호출 시작: 해외지수분봉조회") + result1, result2 = inquire_time_indexchartprice( + fid_cond_mrkt_div_code = "N", + fid_input_iscd = "SPX", + fid_hour_cls_code = "0", + fid_pw_data_incu_yn = "Y", + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py new file mode 100644 index 0000000..ddc8bc0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_indexchartprice/inquire_time_indexchartprice.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외지수분봉조회[v1_해외주식-031] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice" + +def inquire_time_indexchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_hour_cls_code: str, # 시간 구분 코드 + fid_pw_data_incu_yn: str, # 과거 데이터 포함 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외지수분봉조회[v1_해외주식-031] + 해외지수분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): N 해외지수 X 환율 KX 원화환율 + fid_input_iscd (str): 종목번호(ex. TSLA) + fid_hour_cls_code (str): 0: 정규장, 1: 시간외 + fid_pw_data_incu_yn (str): Y/N + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외지수분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_indexchartprice( + ... fid_cond_mrkt_div_code="N", + ... fid_input_iscd="SPX", + ... fid_hour_cls_code="0", + ... fid_pw_data_incu_yn="Y" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'N')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'N')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'SPX')") + raise ValueError("fid_input_iscd is required. (e.g. 'SPX')") + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '0')") + raise ValueError("fid_hour_cls_code is required. (e.g. '0')") + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'Y')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'Y')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKST03030200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_indexchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py new file mode 100644 index 0000000..9937616 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/chk_inquire_time_itemchartprice.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from inquire_time_itemchartprice import inquire_time_itemchartprice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식분봉조회[v1_해외주식-030] +############################################################################################## + +COLUMN_MAPPING = { + 'rsym': '실시간종목코드', + 'zdiv': '소수점자리수', + 'stim': '장시작현지시간', + 'etim': '장종료현지시간', + 'sktm': '장시작한국시간', + 'ektm': '장종료한국시간', + 'next': '다음가능여부', + 'more': '추가데이타여부', + 'nrec': '레코드갯수', + 'tymd': '현지영업일자', + 'xymd': '현지기준일자', + 'xhms': '현지기준시간', + 'kymd': '한국기준일자', + 'khms': '한국기준시간', + 'open': '시가', + 'high': '고가', + 'low': '저가', + 'last': '종가', + 'evol': '체결량', + 'eamt': '체결대금' +} + +NUMERIC_COLUMNS = ['소수점자리수', '시가', '고가', '저가', '종가', '체결량', '체결대금'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식분봉조회[v1_해외주식-030] + + 해외주식분봉조회 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 ("" 공백으로 입력) + - excd (str): 거래소코드 (NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 HKS : 홍콩 SHS : 상해 SZS : 심천 HSX : 호치민 HNX : 하노이 TSE : 도쿄 ※ 주간거래는 최대 1일치 분봉만 조회 가능 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간)) + - symb (str): 종목코드 (종목코드(ex. TSLA)) + - nmin (str): 분갭 (분단위(1: 1분봉, 2: 2분봉, ...)) + - pinc (str): 전일포함여부 (0:당일 1:전일포함 ※ 다음조회 시 반드시 "1"로 입력) + - next (str): 다음여부 (처음조회 시, "" 공백 입력 다음조회 시, "1" 입력) + - nrec (str): 요청갯수 (레코드요청갯수 (최대 120)) + - fill (str): 미체결채움구분 ("" 공백으로 입력) + - keyb (str): NEXT KEY BUFF (처음 조회 시, "" 공백 입력 다음 조회 시, 이전 조회 결과의 마지막 분봉 데이터를 이용하여, 1분 전 혹은 n분 전의 시간을 입력 (형식: YYYYMMDDHHMMSS, ex. 20241014140100)) + + Returns: + - DataFrame: 해외주식분봉조회 결과 + + Example: + >>> df1, df2 = inquire_time_itemchartprice(auth="", excd="NAS", symb="TSLA", nmin="5", pinc="1", next="", nrec="120", fill="", keyb="") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + + # API 호출 + logger.info("API 호출 시작: 해외주식분봉조회") + result1, result2 = inquire_time_itemchartprice( + auth="", + excd="NAS", + symb="TSLA", + nmin="5", + pinc="1", + next="", + nrec="120", + fill="", + keyb="", + ) + + # 결과 확인 + results = [result1, result2] + if all(result is None or result.empty for result in results): + logger.warning("조회된 데이터가 없습니다.") + return + + + # output1 결과 처리 + logger.info("=== output1 조회 ===") + if not result1.empty: + logger.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result1 = result1.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + logger.info("output1 결과:") + print(result1) + else: + logger.info("output1 데이터가 없습니다.") + + # output2 결과 처리 + logger.info("=== output2 조회 ===") + if not result2.empty: + logger.info("사용 가능한 컬럼: %s", result2.columns.tolist()) + + # 통합 컬럼명 한글 변환 (필요한 컬럼만 자동 매핑됨) + result2 = result2.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + logger.info("output2 결과:") + print(result2) + else: + logger.info("output2 데이터가 없습니다.") + + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py new file mode 100644 index 0000000..65709af --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/inquire_time_itemchartprice/inquire_time_itemchartprice.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional, Tuple +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식분봉조회[v1_해외주식-030] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice" + +def inquire_time_itemchartprice( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + nmin: str, # 분갭 + pinc: str, # 전일포함여부 + next: str, # 다음여부 + nrec: str, # 요청갯수 + fill: str, # 미체결채움구분 + keyb: str, # NEXT KEY BUFF + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식분봉조회[v1_해외주식-030] + 해외주식분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): "" 공백으로 입력 + excd (str): NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 HKS : 홍콩 SHS : 상해 SZS : 심천 HSX : 호치민 HNX : 하노이 TSE : 도쿄 ※ 주간거래는 최대 1일치 분봉만 조회 가능 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간) + symb (str): 종목코드(ex. TSLA) + nmin (str): 분단위(1: 1분봉, 2: 2분봉, ...) + pinc (str): 0:당일 1:전일포함 ※ 다음조회 시 반드시 "1"로 입력 + next (str): 처음조회 시, "" 공백 입력 다음조회 시, "1" 입력 + nrec (str): 레코드요청갯수 (최대 120) + fill (str): "" 공백으로 입력 + keyb (str): 처음 조회 시, "" 공백 입력 다음 조회 시, 이전 조회 결과의 마지막 분봉 데이터를 이용하여, 1분 전 혹은 n분 전의 시간을 입력 (형식: YYYYMMDDHHMMSS, ex. 20241014140100) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_itemchartprice( + ... auth="", excd="NAS", symb="TSLA", nmin="5", pinc="1", next="1", nrec="120", fill="", keyb="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + if not nmin: + logger.error("nmin is required. (e.g. '5')") + raise ValueError("nmin is required. (e.g. '5')") + if not pinc: + logger.error("pinc is required. (e.g. '1')") + raise ValueError("pinc is required. (e.g. '1')") + if not nrec or int(nrec)>120: + logger.error("nrec is required. (e.g. '120', 최대120개)") + raise ValueError("nrec is required. (e.g. '120', 최대120개)") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76950200" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + "NMIN": nmin, + "PINC": pinc, + "NEXT": next, + "NREC": nrec, + "FILL": fill, + "KEYB": keyb, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_itemchartprice( + auth, + excd, + symb, + nmin, + pinc, + next, + nrec, + fill, + keyb, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame(), pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/market_cap/chk_market_cap.py b/한국투자증권(API)/examples_llm/overseas_stock/market_cap/chk_market_cap.py new file mode 100644 index 0000000..f0342b7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/market_cap/chk_market_cap.py @@ -0,0 +1,105 @@ +""" +Created on 20250114 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from market_cap import market_cap + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 시가총액순위[해외주식-047] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'shar': '상장주식수', + 'tomv': '시가총액', + 'grav': '비중', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'mcap': '시가총액' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 시가총액순위 조회 테스트 함수 + + 이 함수는 해외주식 시가총액순위 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = market_cap(excd="SZS", vol_rang="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼(output1): %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼(output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/market_cap/market_cap.py b/한국투자증권(API)/examples_llm/overseas_stock/market_cap/market_cap.py new file mode 100644 index 0000000..c0eaaaf --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/market_cap/market_cap.py @@ -0,0 +1,112 @@ +""" +Created on 20250114 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 시가총액순위[해외주식-047] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/market-cap" + +def market_cap( + excd: str, # 거래소명 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 시가총액순위 조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF (ex. "") + auth (str): 사용자권한정보 (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 output1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 output2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 시가총액순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = market_cap(excd="SZS", vol_rang="1") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None or dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1, dataframe2 + + tr_id = "HHDFS76350100" # 해외주식 시가총액순위 + + params = { + "EXCD": excd, # 거래소명 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth, # 사용자권한정보 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return market_cap( + excd, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/chk_new_highlow.py b/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/chk_new_highlow.py new file mode 100644 index 0000000..132910c --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/chk_new_highlow.py @@ -0,0 +1,107 @@ +""" +Created on 20250112 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from new_highlow import new_highlow + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'n_base': '기준가', + 'n_diff': '기준가대비', + 'n_rate': '기준가대비율', + 'ename': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'nhgh': '신고가', + 'nlow': '신저가', + 'rank': '순위' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 신고/신저가 조회 테스트 함수 + + 이 함수는 해외주식 신고/신저가 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 AMS 거래소의 신고가 정보를 조회합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = new_highlow(excd="AMS", mixn="0", vol_rang="0", gubn="1", gubn2="1") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/new_highlow.py b/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/new_highlow.py new file mode 100644 index 0000000..5288c7f --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/new_highlow/new_highlow.py @@ -0,0 +1,134 @@ +""" +Created on 20250112 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/new-highlow" + +def new_highlow( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + gubn: str, # [필수] 신고/신저 구분 (ex. 0:신저,1:신고) + gubn2: str, # [필수] 일시돌파/돌파 구분 (ex. 0:일시돌파0, 1:돌파유지1) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] + 해외주식 신고/신저가 정보를 조회하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + gubn (str): [필수] 신고/신저 구분 (ex. 0:신저,1:신고) + gubn2 (str): [필수] 일시돌파/돌파 구분 (ex. 0:일시돌파0, 1:돌파유지1) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 output1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 output2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = new_highlow(excd="AMS", mixn="0", vol_rang="0", gubn="1", gubn2="1") + >>> print(output1) + >>> print(output2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '1')") + + if gubn2 == "": + raise ValueError("gubn2 is required (e.g. '1')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76300000" # 해외주식 신고/신저가 + + params = { + "EXCD": excd, + "MIXN": mixn, + "VOL_RANG": vol_rang, + "GUBN": gubn, + "GUBN2": gubn2, + "KEYB": keyb, + "AUTH": auth + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return new_highlow( + excd, mixn, vol_rang, gubn, gubn2, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/news_title/chk_news_title.py b/한국투자증권(API)/examples_llm/overseas_stock/news_title/chk_news_title.py new file mode 100644 index 0000000..1d784c8 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/news_title/chk_news_title.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from news_title import news_title + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외뉴스종합(제목) [해외주식-053] +############################################################################################## + +COLUMN_MAPPING = { + 'info_gb': '뉴스구분', + 'news_key': '뉴스키', + 'data_dt': '조회일자', + 'data_tm': '조회시간', + 'class_cd': '중분류', + 'class_name': '중분류명', + 'source': '자료원', + 'nation_cd': '국가코드', + 'exchange_cd': '거래소코드', + 'symb': '종목코드', + 'symb_name': '종목명', + 'title': '제목' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외뉴스종합 테스트 함수 + """ + try: + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = news_title( + info_gb="", + class_cd="", + nation_cd="", + exchange_cd="", + symb="", + data_dt="", + data_tm="", + cts="" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외뉴스종합 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/news_title/news_title.py b/한국투자증권(API)/examples_llm/overseas_stock/news_title/news_title.py new file mode 100644 index 0000000..a7b2935 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/news_title/news_title.py @@ -0,0 +1,110 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외뉴스종합(제목) [해외주식-053] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/news-title" + +def news_title( + info_gb: str = "", # [필수] 뉴스구분 + class_cd: str = "", # [필수] 중분류 + nation_cd: str = "", # [필수] 국가코드 (ex. 공백:전체, CN:중국, HK:홍콩, US:미국) + exchange_cd: str = "", # [필수] 거래소코드 + symb: str = "", # [필수] 종목코드 + data_dt: str = "", # [필수] 조회일자 + data_tm: str = "", # [필수] 조회시간 + cts: str = "", # [필수] 다음키 + tr_cont: str = "", # [필수] 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외뉴스종합(제목) API입니다. + 한국투자 HTS(eFriend Plus) > [7702] 해외뉴스종합 화면의 "우측 상단 뉴스목록" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + info_gb (str): [필수] 뉴스구분 + class_cd (str): [필수] 중분류 + nation_cd (str): [필수] 국가코드 (ex. 공백:전체, CN:중국, HK:홍콩, US:미국) + exchange_cd (str): [필수] 거래소코드 + symb (str): [필수] 종목코드 + data_dt (str): [필수] 조회일자 + data_tm (str): [필수] 조회시간 + cts (str): [필수] 다음키 + tr_cont (str): [필수] 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외뉴스종합(제목) 데이터 + + Example: + >>> df = news_title() + >>> print(df) + """ + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "HHPSTH60100C1" # 해외뉴스종합(제목) + + params = { + "INFO_GB": info_gb, # 뉴스구분 + "CLASS_CD": class_cd, # 중분류 + "NATION_CD": nation_cd, # 국가코드 + "EXCHANGE_CD": exchange_cd, # 거래소코드 + "SYMB": symb, # 종목코드 + "DATA_DT": data_dt, # 조회일자 + "DATA_TM": data_tm, # 조회시간 + "CTS": cts # 다음키 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().outblock1) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return news_title( + info_gb, class_cd, nation_cd, exchange_cd, symb, data_dt, data_tm, cts, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order/chk_order.py b/한국투자증권(API)/examples_llm/overseas_stock/order/chk_order.py new file mode 100644 index 0000000..762b84b --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order/chk_order.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order import order + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문 [v1_해외주식-001] +############################################################################################## + +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 주문[v1_해외주식-001] + + 해외주식 주문 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민) + - pdno (str): 상품번호 (종목코드) + - ord_qty (str): 주문수량 (주문수량 (해외거래소 별 최소 주문수량 및 주문단위 확인 필요)) + - ovrs_ord_unpr (str): 해외주문단가 (1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력) + - ord_dv (str): 주문구분 (buy: 매수, sell: 매도) + - ctac_tlno (str): 연락전화번호 () + - mgco_aptm_odno (str): 운용사지정주문번호 () + - ord_svr_dvsn_cd (str): 주문서버구분코드 ("0"(Default)) + - ord_dvsn (str): 주문구분 ([Header tr_id TTTT1002U(미국 매수 주문)] 00 : 지정가 32 : LOO(장개시지정가) 34 : LOC(장마감지정가) * 모의투자 VTTT1002U(미국 매수 주문)로는 00:지정가만 가능 [Header tr_id TTTT1006U(미국 매도 주문)] 00 : 지정가 31 : MOO(장개시시장가) 32 : LOO(장개시지정가) 33 : MOC(장마감시장가) 34 : LOC(장마감지정가) * 모의투자 VTTT1006U(미국 매도 주문)로는 00:지정가만 가능 [Header tr_id TTTS1001U(홍콩 매도 주문)] 00 : 지정가 50 : 단주지정가 * 모의투자 VTTS1001U(홍콩 매도 주문)로는 00:지정가만 가능 [그외 tr_id] 제거) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 주문 결과 + + Example: + >>> df = order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", pdno="AAPL", ord_qty="10", ovrs_ord_unpr="150.00", ord_dv="sell", ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0", ord_dvsn="00", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = order( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + pdno="AAPL", # 상품번호 + ord_qty="10", # 주문수량 + ovrs_ord_unpr="200", # 해외주문단가 + ord_dv="sell", # 주문구분 + ctac_tlno="", # 연락전화번호 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ord_dvsn="00", # 주문구분 + env_dv="real", # 실전모의구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 주문 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order/order.py b/한국투자증권(API)/examples_llm/overseas_stock/order/order.py new file mode 100644 index 0000000..a8b48f1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order/order.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문 [v1_해외주식-001] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/order" + +def order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ord_dv: str, # 주문구분 (buy: 매수, sell: 매도) + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + ord_dvsn: str, # 주문구분 + env_dv: str = "real", # 실전모의구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 주문[v1_해외주식-001] + 해외주식 주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + pdno (str): 종목코드 + ord_qty (str): 주문수량 (해외거래소 별 최소 주문수량 및 주문단위 확인 필요) + ovrs_ord_unpr (str): 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 + ord_dv (str): 주문구분 (buy: 매수, sell: 매도) + ctac_tlno (str): + mgco_aptm_odno (str): + ord_svr_dvsn_cd (str): "0"(Default) + ord_dvsn (str): [Header tr_id TTTT1002U(미국 매수 주문)] 00 : 지정가 32 : LOO(장개시지정가) 34 : LOC(장마감지정가) * 모의투자 VTTT1002U(미국 매수 주문)로는 00:지정가만 가능 [Header tr_id TTTT1006U(미국 매도 주문)] 00 : 지정가 31 : MOO(장개시시장가) 32 : LOO(장개시지정가) 33 : MOC(장마감시장가) 34 : LOC(장마감지정가) * 모의투자 VTTT1006U(미국 매도 주문)로는 00:지정가만 가능 [Header tr_id TTTS1001U(홍콩 매도 주문)] 00 : 지정가 50 : 단주지정가 * 모의투자 VTTS1001U(홍콩 매도 주문)로는 00:지정가만 가능 [그외 tr_id] 제거 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + Optional[pd.DataFrame]: 해외주식 주문 데이터 + + Example: + >>> df = order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... ord_qty="1", + ... ovrs_ord_unpr="145.00", + ... ord_dv="buy", + ... ctac_tlno="", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... ord_dvsn="00", + ... env_dv="real" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '1')") + raise ValueError("ord_qty is required. (e.g. '1')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '145.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '145.00')") + if not ord_dv: + logger.error("ord_dv is required. (e.g. 'buy' or 'sell')") + raise ValueError("ord_dv is required. (e.g. 'buy' or 'sell')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + if not ord_dvsn: + logger.error("ord_dvsn is required. (e.g. '00')") + raise ValueError("ord_dvsn is required. (e.g. '00')") + + # TR ID 설정 (매수/매도 및 거래소별) + if ord_dv == "buy": + if ovrs_excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1002U" # 미국 매수 주문 [모의투자] VTTT1002U + elif ovrs_excg_cd == "SEHK": + tr_id = "TTTS1002U" # 홍콩 매수 주문 [모의투자] VTTS1002U + elif ovrs_excg_cd == "SHAA": + tr_id = "TTTS0202U" # 중국상해 매수 주문 [모의투자] VTTS0202U + elif ovrs_excg_cd == "SZAA": + tr_id = "TTTS0305U" # 중국심천 매수 주문 [모의투자] VTTS0305U + elif ovrs_excg_cd == "TKSE": + tr_id = "TTTS0308U" # 일본 매수 주문 [모의투자] VTTS0308U + elif ovrs_excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0311U" # 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0311U + else: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + sll_type = "" + elif ord_dv == "sell": + if ovrs_excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1006U" # 미국 매도 주문 [모의투자] VTTT1006U + elif ovrs_excg_cd == "SEHK": + tr_id = "TTTS1001U" # 홍콩 매도 주문 [모의투자] VTTS1001U + elif ovrs_excg_cd == "SHAA": + tr_id = "TTTS1005U" # 중국상해 매도 주문 [모의투자] VTTS1005U + elif ovrs_excg_cd == "SZAA": + tr_id = "TTTS0304U" # 중국심천 매도 주문 [모의투자] VTTS0304U + elif ovrs_excg_cd == "TKSE": + tr_id = "TTTS0307U" # 일본 매도 주문 [모의투자] VTTS0307U + elif ovrs_excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0310U" # 베트남(하노이,호치민) 매도 주문 [모의투자] VTTS0310U + else: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + sll_type = "00" + else: + logger.error("ord_dv is required. (e.g. 'buy' or 'sell')") + raise ValueError("ord_dv is required. (e.g. 'buy' or 'sell')") + + # 모의투자인 경우 TR ID 앞에 V 붙이기 + if env_dv == "demo": + tr_id = "V" + tr_id[1:] + elif env_dv != "real": + logger.error("env_dv can only be 'real' or 'demo'") + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "SLL_TYPE": sll_type, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "ORD_DVSN": ord_dvsn, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv/chk_order_resv.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv/chk_order_resv.py new file mode 100644 index 0000000..d04fda2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv/chk_order_resv.py @@ -0,0 +1,75 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_resv import order_resv + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수[v1_해외주식-002] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'ODNO': '한국거래소전송주문조직번호', + 'RSVN_ORD_RCIT_DT': '예약주문접수일자', + 'OVRS_RSVN_ODNO': '해외예약주문번호' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 예약주문접수 조회 테스트 함수 + + 이 함수는 해외주식 예약주문접수 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 TSLA 주식을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # API 호출 + logging.info("API 호출") + try: + result = order_resv(env_dv="real", ord_dv="usBuy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + pdno="TSLA", ovrs_excg_cd="NASD", ft_ord_qty="1", ft_ord_unpr3="900") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv/order_resv.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv/order_resv.py new file mode 100644 index 0000000..30f29e7 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv/order_resv.py @@ -0,0 +1,194 @@ +""" +Created on 20250601 +""" + + +import sys +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수[v1_해외주식-002] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/order-resv" + +def order_resv( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv: str, # [필수] 매도매수구분 (ex. usBuy:미국매수, usSell:미국매도, asia:아시아) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + pdno: str, # [필수] 상품번호 + ovrs_excg_cd: str, # [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + ft_ord_qty: str, # [필수] FT주문수량 + ft_ord_unpr3: str, # [필수] FT주문단가3 + sll_buy_dvsn_cd: Optional[str] = "", # 매도매수구분코드 (ex. 아시아인경우만 사용, 01:매도,02:매수) + rvse_cncl_dvsn_cd: Optional[str] = "", # 정정취소구분코드 (ex. 아시아인경우만 사용, 00:매도/매수) + prdt_type_cd: Optional[str] = "", # 상품유형코드 (ex. 아시아인경우만 사용) + ord_svr_dvsn_cd: Optional[str] = "", # 주문서버구분코드 (ex. 0) + rsvn_ord_rcit_dt: Optional[str] = "", # 예약주문접수일자 (ex. 아시아인경우만 사용) + ord_dvsn: Optional[str] = "", # 주문구분 (ex. 미국 매수/매도인 경우만 사용) + ovrs_rsvn_odno: Optional[str] = "", # 해외예약주문번호 (ex. 아이사인 경우만 사용) + algo_ord_tmd_dvsn_cd: Optional[str] = "" # 알고리즘주문시간구분코드 (ex. TWAP, VWAP 주문에서만 사용, 02로 고정) +) -> pd.DataFrame: + """ + 미국거래소 운영시간 외 미국주식을 예약 매매하기 위한 API입니다. + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + * 아래 각 국가의 시장별 예약주문 접수 가능 시간을 확인하시길 바랍니다. + + 미국 예약주문 접수시간 + 1) 10:00 ~ 23:20 / 10:00 ~ 22:20 (서머타임 시) + 2) 주문제한 : 16:30 ~ 16:45 경까지 (사유 : 시스템 정산작업시간) + 3) 23:30 정규장으로 주문 전송 (서머타임 시 22:30 정규장 주문 전송) + 4) 미국 거래소 운영시간(한국시간 기준) : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) + + 홍콩 예약주문 접수시간 + 1) 09:00 ~ 10:20 접수, 10:30 주문전송 + 2) 10:40 ~ 13:50 접수, 14:00 주문전송 + + 중국 예약주문 접수시간 + 1) 09:00 ~ 10:20 접수, 10:30 주문전송 + 2) 10:40 ~ 13:50 접수, 14:00 주문전송 + + 일본 예약주문 접수시간 + 1) 09:10 ~ 12:20 까지 접수, 12:30 주문전송 + + 베트남 예약주문 접수시간 + 1) 09:00 ~ 11:00 까지 접수, 11:15 주문전송 + 2) 11:20 ~ 14:50 까지 접수, 15:00 주문전송 + + * 예약주문 유의사항 + 1) 예약주문 유효기간 : 당일 + - 미국장 마감 후, 미체결주문은 자동취소 + - 미국휴장 시, 익 영업일로 이전 + (미국예약주문화면에서 취소 가능) + 2) 증거금 및 잔고보유 : 체크 안함 + 3) 주문전송 불가사유 + - 매수증거금 부족: 수수료 포함 매수금액부족, 환전, 시세이용료 출금, 인출에 의한 증거금 부족 + - 기타 매수증거금 부족, 매도가능수량 부족, 주권변경 등 권리발생으로 인한 주문불가사유 발생 + 4) 지정가주문만 가능 + * 단 미국 예약매도주문(TTTT3016U)의 경우, MOO(장개시시장가)로 주문 접수 가능 + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (ex. usBuy:미국매수, usSell:미국매도, asia:아시아) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + pdno (str): [필수] 상품번호 + ovrs_excg_cd (str): [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + ft_ord_qty (str): [필수] FT주문수량 + ft_ord_unpr3 (str): [필수] FT주문단가3 + sll_buy_dvsn_cd (Optional[str]): 매도매수구분코드 (ex. 아시아인경우만 사용, 01:매도,02:매수) + rvse_cncl_dvsn_cd (Optional[str]): 정정취소구분코드 (ex. 아시아인경우만 사용, 00:매도/매수) + prdt_type_cd (Optional[str]): 상품유형코드 (ex. 아시아인경우만 사용) + ord_svr_dvsn_cd (Optional[str]): 주문서버구분코드 (ex. 0) + rsvn_ord_rcit_dt (Optional[str]): 예약주문접수일자 (ex. 아시아인경우만 사용) + ord_dvsn (Optional[str]): 주문구분 (ex. 미국 매수/매도인 경우만 사용) + ovrs_rsvn_odno (Optional[str]): 해외예약주문번호 (ex. 아이사인 경우만 사용) + algo_ord_tmd_dvsn_cd (Optional[str]): 알고리즘주문시간구분코드 (ex. TWAP, VWAP 주문에서만 사용, 02로 고정) + + Returns: + pd.DataFrame: 해외주식 예약주문접수 결과 데이터 + + Example: + >>> df = order_resv(env_dv="real", ord_dv="usBuy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="TSLA", ovrs_excg_cd="NASD", ft_ord_qty="1", ft_ord_unpr3="900") + >>> print(df) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if ord_dv == "": + raise ValueError("ord_dv is required (e.g. 'usBuy', 'usSell', 'asia')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if pdno == "": + raise ValueError("pdno is required") + + if ovrs_excg_cd == "": + raise ValueError("ovrs_excg_cd is required (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + + if ft_ord_qty == "": + raise ValueError("ft_ord_qty is required") + + if ft_ord_unpr3 == "": + raise ValueError("ft_ord_unpr3 is required") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "usBuy": + tr_id = "TTTT3014U" + elif ord_dv == "usSell": + tr_id = "TTTT3016U" + elif ord_dv == "asia": + tr_id = "TTTS3013U" + else: + raise ValueError("ord_dv can only be 'usBuy', 'usSell' or 'asia'") + elif env_dv == "demo": + if ord_dv == "usBuy": + tr_id = "VTTT3014U" + elif ord_dv == "usSell": + tr_id = "VTTT3016U" + elif ord_dv == "asia": + tr_id = "VTTS3013U" + else: + raise ValueError("ord_dv can only be 'usBuy', 'usSell' or 'asia'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "OVRS_EXCG_CD": ovrs_excg_cd, + "FT_ORD_QTY": ft_ord_qty, + "FT_ORD_UNPR3": ft_ord_unpr3 + } + + # 옵션 파라미터 추가 + if sll_buy_dvsn_cd: + params["SLL_BUY_DVSN_CD"] = sll_buy_dvsn_cd + if rvse_cncl_dvsn_cd: + params["RVSE_CNCL_DVSN_CD"] = rvse_cncl_dvsn_cd + if prdt_type_cd: + params["PRDT_TYPE_CD"] = prdt_type_cd + if ord_svr_dvsn_cd: + params["ORD_SVR_DVSN_CD"] = ord_svr_dvsn_cd + if rsvn_ord_rcit_dt: + params["RSVN_ORD_RCIT_DT"] = rsvn_ord_rcit_dt + if ord_dvsn: + params["ORD_DVSN"] = ord_dvsn + if ovrs_rsvn_odno: + params["OVRS_RSVN_ODNO"] = ovrs_rsvn_odno + if algo_ord_tmd_dvsn_cd: + params["ALGO_ORD_TMD_DVSN_CD"] = algo_ord_tmd_dvsn_cd + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/chk_order_resv_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/chk_order_resv_ccnl.py new file mode 100644 index 0000000..2c616a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/chk_order_resv_ccnl.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from order_resv_ccnl import order_resv_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수취소[v1_해외주식-004] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'OVRS_RSVN_ODNO': '해외예약주문번호' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 예약주문접수취소 조회 테스트 함수 + + 이 함수는 해외주식 예약주문접수취소 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + trenv = ka.getTREnv() + + # API 호출 + logging.info("API 호출") + try: + result = order_resv_ccnl( + env_dv="real", + nat_dv="us", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rsvn_ord_rcit_dt="20250610", + ovrs_rsvn_odno="0030008244" + ) + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/order_resv_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/order_resv_ccnl.py new file mode 100644 index 0000000..e6fe9c9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_ccnl/order_resv_ccnl.py @@ -0,0 +1,106 @@ +""" +Created on 20250601 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수취소[v1_해외주식-004] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/order-resv-ccnl" + +def order_resv_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + nat_dv: str, # [필수] 국가구분 (ex. us:미국) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + rsvn_ord_rcit_dt: str, # [필수] 해외주문접수일자 + ovrs_rsvn_odno: str # [필수] 해외예약주문번호 (ex. 해외주식_예약주문접수 API Output ODNO(주문번호) 참고) +) -> pd.DataFrame: + """ + 접수된 미국주식 예약주문을 취소하기 위한 API입니다. + (해외주식 예약주문접수 시 Return 받은 ODNO를 참고하여 API를 호출하세요.) + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + nat_dv (str): [필수] 국가구분 (ex. us:미국) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + rsvn_ord_rcit_dt (str): [필수] 해외주문접수일자 + ovrs_rsvn_odno (str): [필수] 해외예약주문번호 (ex. 해외주식_예약주문접수 API Output ODNO(주문번호) 참고) + + Returns: + pd.DataFrame: 해외주식 예약주문접수취소 결과 데이터 + + Example: + >>> df = order_resv_ccnl(env_dv="real", nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rsvn_ord_rcit_dt="20220810", ovrs_rsvn_odno="0030008244") + >>> print(df) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if nat_dv == "": + raise ValueError("nat_dv is required (e.g. 'us')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if rsvn_ord_rcit_dt == "": + raise ValueError("rsvn_ord_rcit_dt is required") + + if ovrs_rsvn_odno == "": + raise ValueError("ovrs_rsvn_odno is required") + + # tr_id 설정 + if env_dv == "real": + if nat_dv == "us": + tr_id = "TTTT3017U" + else: + raise ValueError("nat_dv can only be 'us'") + elif env_dv == "demo": + if nat_dv == "us": + tr_id = "VTTT3017U" + else: + raise ValueError("nat_dv can only be 'us'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RSVN_ORD_RCIT_DT": rsvn_ord_rcit_dt, + "OVRS_RSVN_ODNO": ovrs_rsvn_odno + } + + res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True) + + if res.isOK(): + # output은 object 자료형이므로 DataFrame으로 변환 + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/chk_order_resv_list.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/chk_order_resv_list.py new file mode 100644 index 0000000..26602d6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/chk_order_resv_list.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +""" +Created on 20250601 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order_resv_list import order_resv_list + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문조회[v1_해외주식-013] +############################################################################################## +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'cncl_yn': '취소여부', + 'rsvn_ord_rcit_dt': '예약주문접수일자', + 'ovrs_rsvn_odno': '해외예약주문번호', + 'ord_dt': '주문일자', + 'ord_gno_brno': '주문채번지점번호', + 'odno': '주문번호', + 'sll_buy_dvsn_cd': '매도매수구분코드', + 'sll_buy_dvsn_cd_name': '매도매수구분명', + 'ovrs_rsvn_ord_stat_cd': '해외예약주문상태코드', + 'ovrs_rsvn_ord_stat_cd_name': '해외예약주문상태코드명', + 'pdno': '상품번호', + 'prdt_type_cd': '상품유형코드', + 'prdt_name': '상품명', + 'ord_rcit_tmd': '주문접수시각', + 'ord_fwdg_tmd': '주문전송시각', + 'tr_dvsn_name': '거래구분명', + 'ovrs_excg_cd': '해외거래소코드', + 'tr_mket_name': '거래시장명', + 'ord_stfno': '주문직원번호', + 'ft_ord_qty': 'FT주문수량', + 'ft_ord_unpr3': 'FT주문단가3', + 'ft_ccld_qty': 'FT체결수량', + 'nprc_rson_text': '미처리사유내용', + 'splt_buy_attr_name': '분할매수속성명' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [ + 'FT주문수량', 'FT주문단가', 'FT체결수량' +] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 예약주문조회[v1_해외주식-013] + + 해외주식 예약주문조회 테스트 함수 + + Parameters: + - nat_dv (str): 국가구분 (us: 미국) + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - inqr_strt_dt (str): 조회시작일자 (YYYYMMDD) + - inqr_end_dt (str): 조회종료일자 (YYYYMMDD) + - inqr_dvsn_cd (str): 조회구분코드 (00: 전체, 01: 예약, 02: 체결, 03: 거부) + - ovrs_excg_cd (str): 해외거래소코드 (NASD: 나스닥, NYSE: 뉴욕, AMEX: 아멕스, SEHK: 홍콩, SHAA: 중국상해, SZAA: 중국심천, TKSE: 일본, HASE: 베트남 하노이, VNSE: 베트남 호치민) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 예약주문조회 결과 + + Example: + >>> df = order_resv_list(nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20220809", inqr_end_dt="20220830", inqr_dvsn_cd="00", ovrs_excg_cd="NASD") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = order_resv_list( + nat_dv="us", # 국가구분 + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + inqr_strt_dt="20220809", # 조회시작일자 + inqr_end_dt="20220830", # 조회종료일자 + inqr_dvsn_cd="00", # 조회구분코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 해외주식 예약주문조회 결과 (실전투자) ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/order_resv_list.py b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/order_resv_list.py new file mode 100644 index 0000000..95c8516 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_resv_list/order_resv_list.py @@ -0,0 +1,148 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문조회[v1_해외주식-013] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/trading/order-resv-list" + +def order_resv_list( + nat_dv: str, # 국가구분코드 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + inqr_dvsn_cd: str, # 조회구분코드 + ovrs_excg_cd: str, # 해외거래소코드 + prdt_type_cd: str = "", # 상품유형코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 예약주문 조회 API입니다. + ※ 모의투자는 사용 불가합니다. + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + Args: + nat_dv (str): [필수] 국가구분코드 (ex. us:미국, asia:아시아) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + inqr_strt_dt (str): [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt (str): [필수] 조회종료일자 (ex. 20251231) + inqr_dvsn_cd (str): [필수] 조회구분코드 (ex. 00:전체, 01:일반해외주식, 02:미니스탁) + ovrs_excg_cd (str): [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + prdt_type_cd (str): 상품유형코드 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 예약주문조회 데이터 + + Example: + >>> df = order_resv_list(nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", inqr_end_dt="20251231", inqr_dvsn_cd="00", ovrs_excg_cd="NASD") + >>> print(df) + """ + + if nat_dv == "": + raise ValueError("nat_dv is required (e.g. 'us' or 'asia')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20251231')") + + if inqr_dvsn_cd == "": + raise ValueError("inqr_dvsn_cd is required (e.g. '00')") + + if ovrs_excg_cd == "": + raise ValueError("ovrs_excg_cd is required (e.g. 'NASD')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + # tr_id 설정 + if nat_dv == "us": + tr_id = "TTTT3039R" + elif nat_dv == "asia": + tr_id = "TTTS3014R" + else: + raise ValueError("nat_dv can only be 'us' or 'asia'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "INQR_DVSN_CD": inqr_dvsn_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PRDT_TYPE_CD": prdt_type_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return order_resv_list( + nat_dv, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + inqr_dvsn_cd, ovrs_excg_cd, prdt_type_cd, FK200, NK200, + "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/chk_order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/chk_order_rvsecncl.py new file mode 100644 index 0000000..1c44249 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/chk_order_rvsecncl.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-07-01 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from order_rvsecncl import order_rvsecncl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +################################################################################ +# [해외주식] 주문/계좌 > 해외주식 정정취소주문[v1_해외주식-003] +################################################################################ + +# 컬럼명 매핑 (한글 변환용) +COLUMN_MAPPING = { + 'KRX_FWDG_ORD_ORGNO': '한국거래소전송주문조직번호', + 'ODNO': '주문번호', + 'ORD_TMD': '주문시각' +} + +# 숫자형 컬럼 정의 (소수점 처리용) +NUMERIC_COLUMNS = [] + +def main(): + """ + [해외주식] 주문/계좌 + 해외주식 정정취소주문[v1_해외주식-003] + + 해외주식 정정취소주문 테스트 함수 + + Parameters: + - cano (str): 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + - acnt_prdt_cd (str): 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + - ovrs_excg_cd (str): 해외거래소코드 (NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민) + - pdno (str): 상품번호 () + - orgn_odno (str): 원주문번호 (정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고)) + - rvse_cncl_dvsn_cd (str): 정정취소구분코드 (01 : 정정 02 : 취소) + - ord_qty (str): 주문수량 () + - ovrs_ord_unpr (str): 해외주문단가 (취소주문 시, "0" 입력) + - mgco_aptm_odno (str): 운용사지정주문번호 () + - ord_svr_dvsn_cd (str): 주문서버구분코드 ("0"(Default)) + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 정정취소주문 결과 + + Example: + >>> df = order_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NYSE", pdno="BA", orgn_odno="1234567890", rvse_cncl_dvsn_cd="01", ord_qty="100", ovrs_ord_unpr="0", mgco_aptm_odno="", ord_svr_dvsn_cd="0", env_dv="real") # 실전투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 (모의투자 지원 로직) + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + trenv = ka.getTREnv() + + # API 호출 + logger.info("API 호출") + result = order_rvsecncl( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ovrs_excg_cd="NASD", # 해외거래소코드 + pdno="AMZN", # 상품번호 + orgn_odno="0030132992", # 원주문번호 + rvse_cncl_dvsn_cd="01", # 정정취소구분코드 + ord_qty="100", # 주문수량 + ovrs_ord_unpr="99", # 해외주문단가 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + env_dv="real", # 실전모의구분 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 변환 (object -> float64) + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 해외주식 정정취소주문 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/order_rvsecncl.py b/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/order_rvsecncl.py new file mode 100644 index 0000000..2f4c4da --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/order_rvsecncl/order_rvsecncl.py @@ -0,0 +1,143 @@ +""" +Created on 2025-07-01 + +""" + +import logging +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +################################################################################ +# [해외주식] 주문/계좌 > 해외주식 정정취소주문[v1_해외주식-003] +################################################################################ + +API_URL = "/uapi/overseas-stock/v1/trading/order-rvsecncl" + +def order_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + orgn_odno: str, # 원주문번호 + rvse_cncl_dvsn_cd: str, # 정정취소구분코드 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + env_dv: str = "real", # 실전모의구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 정정취소주문[v1_해외주식-003] + 해외주식 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + pdno (str): 상품번호 + orgn_odno (str): 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + rvse_cncl_dvsn_cd (str): 01 : 정정 02 : 취소 + ord_qty (str): 주문수량 + ovrs_ord_unpr (str): 취소주문 시, "0" 입력 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): "0"(Default) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + Optional[pd.DataFrame]: 해외주식 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NYSE", + ... pdno="BA", + ... orgn_odno="30135009", + ... rvse_cncl_dvsn_cd="01", + ... ord_qty="1", + ... ovrs_ord_unpr="226.00", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... env_dv="real" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NYSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NYSE')") + if not pdno: + logger.error("pdno is required. (e.g. 'BA')") + raise ValueError("pdno is required. (e.g. 'BA')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '30135009')") + raise ValueError("orgn_odno is required. (e.g. '30135009')") + if not rvse_cncl_dvsn_cd: + logger.error("rvse_cncl_dvsn_cd is required. (e.g. '01')") + raise ValueError("rvse_cncl_dvsn_cd is required. (e.g. '01')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '1')") + raise ValueError("ord_qty is required. (e.g. '1')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '226.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '226.00')") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTT1004U" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTT1004U" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + } + + res = ka._url_fetch(api_url=API_URL, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/period_rights/chk_period_rights.py b/한국투자증권(API)/examples_llm/overseas_stock/period_rights/chk_period_rights.py new file mode 100644 index 0000000..7b7a6b1 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/period_rights/chk_period_rights.py @@ -0,0 +1,92 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from period_rights import period_rights + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 기간별권리조회 [해외주식-052] +############################################################################################## + +COLUMN_MAPPING = { + 'bass_dt': '기준일자', + 'rght_type_cd': '권리유형코드', + 'pdno': '상품번호', + 'prdt_name': '상품명', + 'prdt_type_cd': '상품유형코드', + 'std_pdno': '표준상품번호', + 'acpl_bass_dt': '현지기준일자', + 'sbsc_strt_dt': '청약시작일자', + 'sbsc_end_dt': '청약종료일자', + 'cash_alct_rt': '현금배정비율', + 'stck_alct_rt': '주식배정비율', + 'crcy_cd': '통화코드', + 'crcy_cd2': '통화코드2', + 'crcy_cd3': '통화코드3', + 'crcy_cd4': '통화코드4', + 'alct_frcr_unpr': '배정외화단가', + 'stkp_dvdn_frcr_amt2': '주당배당외화금액2', + 'stkp_dvdn_frcr_amt3': '주당배당외화금액3', + 'stkp_dvdn_frcr_amt4': '주당배당외화금액4', + 'dfnt_yn': '확정여부' +} + +NUMERIC_COLUMNS = ['현금배정비율', '주식배정비율', '배정외화단가', '주당배당외화금액2', '주당배당외화금액3', '주당배당외화금액4'] + +def main(): + """ + 해외주식 기간별권리조회 테스트 함수 + + 이 함수는 해외주식 기간별권리조회 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logger.info("=== case1 조회 ===") + try: + result = period_rights( + rght_type_cd="%%", + inqr_dvsn_cd="02", + inqr_strt_dt="20240417", + inqr_end_dt="20240417" + ) + except ValueError as e: + logger.error("에러 발생: %s" % str(e)) + return + + logger.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + # 컬럼명 한글 변환 및 데이터 출력 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logger.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/period_rights/period_rights.py b/한국투자증권(API)/examples_llm/overseas_stock/period_rights/period_rights.py new file mode 100644 index 0000000..afcfab3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/period_rights/period_rights.py @@ -0,0 +1,128 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 기간별권리조회 [해외주식-052] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/period-rights" + +def period_rights( + rght_type_cd: str, # 권리유형코드 + inqr_dvsn_cd: str, # 조회구분코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + pdno: str = "", # 상품번호 + prdt_type_cd: str = "", # 상품유형코드 + NK50: str = "", # 연속조회키50 + FK50: str = "", # 연속조회검색조건50 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 기간별권리조회 API입니다. + 한국투자 HTS(eFriend Plus) > [7520] 기간별해외증권권리조회 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 확정여부가 '예정'으로 표시되는 경우는 권리정보가 변경될 수 있으니 참고자료로만 활용하시기 바랍니다. + + Args: + rght_type_cd (str): [필수] 권리유형코드 (%%:전체, 01:유상, 02:무상, 03:배당, 11:합병,14:액면분할, 15:액면병합, 17:감자, 54:WR청구,61:원리금상환, 71:WR소멸, 74:배당옵션, 75:특별배당, 76:ISINCODE변경, 77:실권주청약) + inqr_dvsn_cd (str): [필수] 조회구분코드 (02:현지기준일, 03:청약시작일, 04:청약종료일) + inqr_strt_dt (str): [필수] 조회시작일자 (20250101) + inqr_end_dt (str): [필수] 조회종료일자 (20250131) + pdno (str): 상품번호 + prdt_type_cd (str): 상품유형코드 + NK50 (str): 연속조회키50 + FK50 (str): 연속조회검색조건50 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 기간별권리조회 데이터 + + Example: + >>> df = period_rights("%%", "02", "20240417", "20240417") + >>> print(df) + """ + + # 필수 파라미터 검증 + if rght_type_cd == "": + raise ValueError("rght_type_cd is required (e.g. '%%:전체, 01:유상, 02:무상, 03:배당, 11:합병,14:액면분할, 15:액면병합, 17:감자, 54:WR청구,61:원리금상환, 71:WR소멸, 74:배당옵션, 75:특별배당, 76:ISINCODE변경, 77:실권주청약')") + + if inqr_dvsn_cd == "": + raise ValueError("inqr_dvsn_cd is required (e.g. '02:현지기준일, 03:청약시작일, 04:청약종료일')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20250131')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTRGT011R" # 해외주식 기간별권리조회 + + params = { + "RGHT_TYPE_CD": rght_type_cd, # 권리유형코드 + "INQR_DVSN_CD": inqr_dvsn_cd, # 조회구분코드 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "PDNO": pdno, # 상품번호 + "PRDT_TYPE_CD": prdt_type_cd, # 상품유형코드 + "CTX_AREA_NK50": NK50, # 연속조회키50 + "CTX_AREA_FK50": FK50 # 연속조회검색조건50 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + NK50 = res.getBody().ctx_area_nk50 + FK50 = res.getBody().ctx_area_fk50 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return period_rights( + rght_type_cd, inqr_dvsn_cd, inqr_strt_dt, inqr_end_dt, + pdno, prdt_type_cd, NK50, FK50, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price/chk_price.py b/한국투자증권(API)/examples_llm/overseas_stock/price/chk_price.py new file mode 100644 index 0000000..4848912 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price/chk_price.py @@ -0,0 +1,112 @@ +""" +Created on 2025-06-26 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from price import price + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재체결가[v1_해외주식-009] +############################################################################################## + +COLUMN_MAPPING = { + 'rsym': '실시간조회종목코드', + 'zdiv': '소수점자리수', + 'base': '전일종가', + 'pvol': '전일거래량', + 'last': '현재가', + 'sign': '대비기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'tamt': '거래대금', + 'ordy': '매수가능여부' +} + +NUMERIC_COLUMNS = ['소수점자리수', '전일종가', '전일거래량', '현재가', '대비', '등락율', '거래량', '거래대금'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 현재체결가[v1_해외주식-009] + + 해외주식 현재체결가 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 ("" (Null 값 설정)) + - excd (str): 거래소코드 (HKS : 홍콩 NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 TSE : 도쿄 SHS : 상해 SZS : 심천 SHI : 상해지수 SZI : 심천지수 HSX : 호치민 HNX : 하노이 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간)) + - symb (str): 종목코드 () + - env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + - DataFrame: 해외주식 현재체결가 결과 + + Example: + >>> df = price(auth="", excd="NAS", symb="AAPL", env_dv="real") # 실전투자 + >>> df = price(auth="", excd="NAS", symb="AAPL", env_dv="demo") # 모의투자 + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 실전/모의투자 선택 (모의투자 지원 로직) + env_dv = "real" # "real": 실전투자, "demo": 모의투자 + logger.info("투자 환경: %s", "실전투자" if env_dv == "real" else "모의투자") + + # 토큰 발급 + logger.info("토큰 발급 중...") + if env_dv == "real": + ka.auth(svr='prod') # 실전투자용 토큰 + elif env_dv == "demo": + ka.auth(svr='vps') # 모의투자용 토큰 + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출 시작: 해외주식 현재체결가 (%s)", "실전투자" if env_dv == "real" else "모의투자") + result = price( + auth="", + excd="NAS", + symb="AAPL", + env_dv="real" + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 현재체결가 결과 (%s) ===", "실전투자" if env_dv == "real" else "모의투자") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price/price.py b/한국투자증권(API)/examples_llm/overseas_stock/price/price.py new file mode 100644 index 0000000..5c316f0 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price/price.py @@ -0,0 +1,127 @@ +# [해외주식] 기본시세 - 해외주식 현재체결가 +# Generated by KIS API Generator (Single API Mode) +# -*- coding: utf-8 -*- +""" +Created on 2025-06-26 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재체결가[v1_해외주식-009] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/price" + +def price( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재체결가[v1_해외주식-009] + 해외주식 현재체결가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소코드 (예: "NAS") + symb (str): 종목코드 (예: "AAPL") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 현재체결가 데이터 + + Example: + >>> df = price("", "NAS", "AAPL") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + + if not symb: + logger.error("symb is required. (e.g. 'AAPL')") + raise ValueError("symb is required. (e.g. 'AAPL')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "HHDFS00000300" # 실전투자, 모의투자 공통 TR ID + else: + logger.error("Invalid env_dv value: %s. Must be 'real' or 'demo'.", env_dv) + raise ValueError("env_dv must be 'real' or 'demo'") + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + # API 호출 + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return price( + auth, + excd, + symb, + env_dv, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price_detail/chk_price_detail.py b/한국투자증권(API)/examples_llm/overseas_stock/price_detail/chk_price_detail.py new file mode 100644 index 0000000..d94a34d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price_detail/chk_price_detail.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from price_detail import price_detail + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가상세[v1_해외주식-029] +############################################################################################## + +COLUMN_MAPPING = { + 'rsym': '실시간조회종목코드', + 'pvol': '전일거래량', + 'open': '시가', + 'high': '고가', + 'low': '저가', + 'last': '현재가', + 'base': '전일종가', + 'tomv': '시가총액', + 'pamt': '전일거래대금', + 'uplp': '상한가', + 'dnlp': '하한가', + 'h52p': '52주최고가', + 'h52d': '52주최고일자', + 'l52p': '52주최저가', + 'l52d': '52주최저일자', + 'perx': 'PER', + 'pbrx': 'PBR', + 'epsx': 'EPS', + 'bpsx': 'BPS', + 'shar': '상장주수', + 'mcap': '자본금', + 'curr': '통화', + 'zdiv': '소수점자리수', + 'vnit': '매매단위', + 't_xprc': '원환산당일가격', + 't_xdif': '원환산당일대비', + 't_xrat': '원환산당일등락', + 'p_xprc': '원환산전일가격', + 'p_xdif': '원환산전일대비', + 'p_xrat': '원환산전일등락', + 't_rate': '당일환율', + 'p_rate': '전일환율', + 't_xsgn': '원환산당일기호', + 'p_xsng': '원환산전일기호', + 'e_ordyn': '거래가능여부', + 'e_hogau': '호가단위', + 'e_icod': '업종(섹터)', + 'e_parp': '액면가', + 'tvol': '거래량', + 'tamt': '거래대금', + 'etyp_nm': 'ETP 분류명' +} + +NUMERIC_COLUMNS = ['소수점자리수', '전일거래량', '시가', '고가', '저가', '현재가', '전일종가', '시가총액', '전일거래대금', '상한가', '하한가', '52주최고가', + '52주최저가', 'PER', 'PBR', 'EPS', 'BPS', '원환산당일가격', '원환산당일대비', '원환산당일등락', '원환산전일가격', '원환산전일대비', '원환산전일등락', '당일환율', '전일환율', '액면가', '거래량', '거래대금'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 현재가상세[v1_해외주식-029] + + 해외주식 현재가상세 테스트 함수 + + Parameters: + - auth (str): 사용자권한정보 () + - excd (str): 거래소명 (HKS : 홍콩 NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 TSE : 도쿄 SHS : 상해 SZS : 심천 SHI : 상해지수 SZI : 심천지수 HSX : 호치민 HNX : 하노이 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간)) + - symb (str): 종목코드 () + + Returns: + - DataFrame: 해외주식 현재가상세 결과 + + Example: + >>> df = price_detail(auth="", excd="NAS", symb="TSLA") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # API 호출 + logger.info("API 호출") + result = price_detail( + auth="", # 사용자권한정보 + excd="NAS", # 거래소명 + symb="TSLA", # 종목코드 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + # 결과 출력 + logger.info("=== 해외주식 현재가상세 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price_detail/price_detail.py b/한국투자증권(API)/examples_llm/overseas_stock/price_detail/price_detail.py new file mode 100644 index 0000000..9f8db7d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price_detail/price_detail.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가상세[v1_해외주식-029] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/price-detail" + +def price_detail( + auth: str, # 사용자권한정보 + excd: str, # 거래소명 + symb: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재가상세[v1_해외주식-029] + 해외주식 현재가상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소명 (예: HKS, NYS, NAS, AMS, TSE, SHS, SZS, SHI, SZI, HSX, HNX, BAY, BAQ, BAA) + symb (str): 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 현재가상세 데이터 + + Example: + >>> df = price_detail(auth="your_auth_token", excd="NAS", symb="TSLA") + >>> print(df) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFS76200200" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return price_detail( + auth, + excd, + symb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/chk_price_fluct.py b/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/chk_price_fluct.py new file mode 100644 index 0000000..f550cae --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/chk_price_fluct.py @@ -0,0 +1,106 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from price_fluct import price_fluct + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'knam': '종목명', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'n_base': '기준가격', + 'n_diff': '기준가격대비', + 'n_rate': '기준가격대비율', + 'enam': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'n_last': '기준현재가' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 가격급등락 조회 테스트 함수 + + 이 함수는 해외주식 가격급등락 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 나스닥 급락 1분전 전체 조건을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = price_fluct(excd="NAS", gubn="0", mixn="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 결과 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/price_fluct.py b/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/price_fluct.py new file mode 100644 index 0000000..7882ad2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/price_fluct/price_fluct.py @@ -0,0 +1,126 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/price-fluct" + +def price_fluct( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + gubn: str, # [필수] 급등/급락구분 (ex. 0:급락, 1:급등) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] + 해외주식 가격급등락 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + gubn (str): [필수] 급등/급락구분 (ex. 0:급락, 1:급등) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 가격급등락 데이터 (output1, output2) + + Example: + >>> df1, df2 = price_fluct(excd="NAS", gubn="0", mixn="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '0' or '1')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76260000" # 해외주식 가격급등락 + + params = { + "EXCD": excd, + "GUBN": gubn, + "MIXN": mixn, + "VOL_RANG": vol_rang, + "KEYB": keyb, + "AUTH": auth + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return price_fluct( + excd, gubn, mixn, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/chk_quot_inquire_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/chk_quot_inquire_ccnl.py new file mode 100644 index 0000000..677e0fa --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/chk_quot_inquire_ccnl.py @@ -0,0 +1,78 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from quot_inquire_ccnl import quot_inquire_ccnl + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 체결추이[해외주식-037] +############################################################################################## + +COLUMN_MAPPING = { + 'vpow': '체결강도', + 'evol': '체결량', + 'khms': '한국기준시간', + 'tvol': '거래량', + 'last': '체결가', + 'mtyp': '시장구분', + 'sign': '기호', + 'pbid': '매수호가', + 'diff': '대비', + 'pask': '매도호가', + 'rate': '등락율' +} + +NUMERIC_COLUMNS = ['체결강도', '체결량', '거래량', '대비', '등락율', '매수호가', '매도호가'] + +def main(): + """ + 해외주식 체결추이 조회 테스트 함수 + + 이 함수는 해외주식 체결추이 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 TSLA를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = quot_inquire_ccnl(excd="NAS", tday="0", symb="TSLA") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/quot_inquire_ccnl.py b/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/quot_inquire_ccnl.py new file mode 100644 index 0000000..9604985 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/quot_inquire_ccnl/quot_inquire_ccnl.py @@ -0,0 +1,110 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 체결추이[해외주식-037] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/inquire-ccnl" + +def quot_inquire_ccnl( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + tday: str, # [필수] 당일전일구분 (ex. 0:전일, 1:당일) + symb: str, # [필수] 종목코드 (ex. 해외종목코드) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 체결추이 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + tday (str): [필수] 당일전일구분 (ex. 0:전일, 1:당일) + symb (str): [필수] 종목코드 (ex. 해외종목코드) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 체결추이 데이터 + + Example: + >>> df = quot_inquire_ccnl(excd="NAS", tday="0", symb="TSLA") + >>> print(df) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if tday == "": + raise ValueError("tday is required (e.g. '0' or '1')") + + if symb == "": + raise ValueError("symb is required (e.g. 'TSLA')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "HHDFS76200300" + + params = { + "EXCD": excd, + "TDAY": tday, + "SYMB": symb, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + keyb = res.getBody().keyb if hasattr(res.getBody(), 'keyb') else "" + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return quot_inquire_ccnl( + excd, tday, symb, auth, keyb, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/chk_rights_by_ice.py b/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/chk_rights_by_ice.py new file mode 100644 index 0000000..91446a6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/chk_rights_by_ice.py @@ -0,0 +1,79 @@ +""" +Created on 20250113 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from rights_by_ice import rights_by_ice + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 권리종합 [해외주식-050] +############################################################################################## + +COLUMN_MAPPING = { + 'anno_dt': 'ICE공시일', + 'ca_title': '권리유형', + 'div_lock_dt': '배당락일', + 'pay_dt': '지급일', + 'record_dt': '기준일', + 'validity_dt': '효력일자', + 'local_end_dt': '현지지시마감일', + 'lock_dt': '권리락일', + 'delist_dt': '상장폐지일', + 'redempt_dt': '상환일자', + 'early_redempt_dt': '조기상환일자', + 'effective_dt': '적용일' +} + +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 권리종합 조회 테스트 함수 + + 이 함수는 해외주식 권리종합 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 NVDL(US) 종목을 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # case1 조회 + logging.info("=== case1 조회 ===") + try: + result = rights_by_ice(ncod="US", symb="NVDL") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + logging.info("사용 가능한 컬럼: %s", result.columns.tolist()) + + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce').round(2) + + logging.info("결과:") + print(result) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/rights_by_ice.py b/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/rights_by_ice.py new file mode 100644 index 0000000..44b49ae --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/rights_by_ice/rights_by_ice.py @@ -0,0 +1,77 @@ +""" +Created on 20250113 +""" + + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 권리종합 [해외주식-050] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/rights-by-ice" + +def rights_by_ice( + ncod: str, # 국가코드 (CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남) + symb: str, # 종목코드 + st_ymd: str = "", # 일자시작일 (미입력시 3개월전) + ed_ymd: str = "" # 일자종료일 (미입력시 3개월후) +) -> pd.DataFrame: + """ + 해외주식 권리종합 API입니다. + 한국투자 HTS(eFriend Plus) > [7833] 해외주식 권리(ICE제공) 화면의 "전체" 탭 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 조회기간 기준일 입력시 참고 - 상환: 상환일자, 조기상환: 조기상환일자, 티커변경: 적용일, 그 외: 발표일 + + Args: + ncod (str): [필수] 국가코드 (ex. CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남) + symb (str): [필수] 종목코드 + st_ymd (str): 일자시작일 (ex. 미입력시 3개월전) + ed_ymd (str): 일자종료일 (ex. 미입력시 3개월후) + + Returns: + pd.DataFrame: 해외주식 권리종합 정보 + + Raises: + ValueError: 필수 파라미터가 누락되었을 때 + + Example: + >>> df = rights_by_ice("US", "NVDL") + >>> print(df) + """ + + # 필수 파라미터 검증 + if ncod == "": + raise ValueError("ncod is required (e.g. 'CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남')") + + if symb == "": + raise ValueError("symb is required") + + tr_id = "HHDFS78330900" + + params = { + "NCOD": ncod, # 국가코드 + "SYMB": symb, # 종목코드 + "ST_YMD": st_ymd, # 일자시작일 + "ED_YMD": ed_ymd # 일자종료일 + } + + res = ka._url_fetch(API_URL, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=API_URL) + return pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/search_info/chk_search_info.py b/한국투자증권(API)/examples_llm/overseas_stock/search_info/chk_search_info.py new file mode 100644 index 0000000..e8f98ae --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/search_info/chk_search_info.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) # kis_auth 파일 경로 추가 +import kis_auth as ka +from search_info import search_info + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상품기본정보[v1_해외주식-034] +############################################################################################## + +COLUMN_MAPPING = { + 'std_pdno': '표준상품번호', + 'prdt_eng_name': '상품영문명', + 'natn_cd': '국가코드', + 'natn_name': '국가명', + 'tr_mket_cd': '거래시장코드', + 'tr_mket_name': '거래시장명', + 'ovrs_excg_cd': '해외거래소코드', + 'ovrs_excg_name': '해외거래소명', + 'tr_crcy_cd': '거래통화코드', + 'ovrs_papr': '해외액면가', + 'crcy_name': '통화명', + 'ovrs_stck_dvsn_cd': '해외주식구분코드', + 'prdt_clsf_cd': '상품분류코드', + 'prdt_clsf_name': '상품분류명', + 'sll_unit_qty': '매도단위수량', + 'buy_unit_qty': '매수단위수량', + 'tr_unit_amt': '거래단위금액', + 'lstg_stck_num': '상장주식수', + 'lstg_dt': '상장일자', + 'ovrs_stck_tr_stop_dvsn_cd': '해외주식거래정지구분코드', + 'lstg_abol_item_yn': '상장폐지종목여부', + 'ovrs_stck_prdt_grp_no': '해외주식상품그룹번호', + 'lstg_yn': '상장여부', + 'tax_levy_yn': '세금징수여부', + 'ovrs_stck_erlm_rosn_cd': '해외주식등록사유코드', + 'ovrs_stck_hist_rght_dvsn_cd': '해외주식이력권리구분코드', + 'chng_bf_pdno': '변경전상품번호', + 'prdt_type_cd_2': '상품유형코드2', + 'ovrs_item_name': '해외종목명', + 'sedol_no': 'SEDOL번호', + 'blbg_tckr_text': '블름버그티커내용', + 'ovrs_stck_etf_risk_drtp_cd': '해외주식ETF위험지표코드', + 'etp_chas_erng_rt_dbnb': 'ETP추적수익율배수', + 'istt_usge_isin_cd': '기관용도ISIN코드', + 'mint_svc_yn': 'MINT서비스여부', + 'mint_svc_yn_chng_dt': 'MINT서비스여부변경일자', + 'prdt_name': '상품명', + 'lei_cd': 'LEI코드', + 'ovrs_stck_stop_rson_cd': '해외주식정지사유코드', + 'lstg_abol_dt': '상장폐지일자', + 'mini_stk_tr_stat_dvsn_cd': '미니스탁거래상태구분코드', + 'mint_frst_svc_erlm_dt': 'MINT최초서비스등록일자', + 'mint_dcpt_trad_psbl_yn': 'MINT소수점매매가능여부', + 'mint_fnum_trad_psbl_yn': 'MINT정수매매가능여부', + 'mint_cblc_cvsn_ipsb_yn': 'MINT잔고전환불가여부', + 'ptp_item_yn': 'PTP종목여부', + 'ptp_item_trfx_exmt_yn': 'PTP종목양도세면제여부', + 'ptp_item_trfx_exmt_strt_dt': 'PTP종목양도세면제시작일자', + 'ptp_item_trfx_exmt_end_dt': 'PTP종목양도세면제종료일자', + 'dtm_tr_psbl_yn': '주간거래가능여부', + 'sdrf_stop_ecls_yn': '급등락정지제외여부', + 'sdrf_stop_ecls_erlm_dt': '급등락정지제외등록일자', + 'memo_text1': '메모내용1', + 'ovrs_now_pric1': '해외현재가격1', + 'last_rcvg_dtime': '최종수신일시' +} + +NUMERIC_COLUMNS = ['해외액면가', '매도단위수량', '매수단위수량', '거래단위금액', '상장주식수', 'ETP추적수익율배수', '해외현재가격1'] + +def main(): + """ + [해외주식] 기본시세 + 해외주식 상품기본정보[v1_해외주식-034] + + 해외주식 상품기본정보 테스트 함수 + + Parameters: + - prdt_type_cd (str): 상품유형코드 (512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 515 일본 501 홍콩 / 543 홍콩CNY / 558 홍콩USD 507 베트남 하노이 / 508 베트남 호치민 551 중국 상해A / 552 중국 심천A) + - pdno (str): 상품번호 (예) AAPL (애플)) + + Returns: + - DataFrame: 해외주식 상품기본정보 결과 + + Example: + >>> df = search_info(prdt_type_cd="512", pdno="AAPL") + """ + try: + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 토큰 발급 + logger.info("토큰 발급 중...") + ka.auth() + logger.info("토큰 발급 완료") + + # 해외주식 상품기본정보 파라미터 설정 + logger.info("API 파라미터 설정 중...") + prdt_type_cd = "512" # 상품유형코드 + pdno = "AAPL" # 상품번호 + + + # API 호출 + logger.info("API 호출 시작: 해외주식 상품기본정보") + result = search_info( + prdt_type_cd=prdt_type_cd, # 상품유형코드 + pdno=pdno, # 상품번호 + ) + + if result is None or result.empty: + logger.warning("조회된 데이터가 없습니다.") + return + + # 컬럼명 출력 + logger.info("사용 가능한 컬럼 목록:") + logger.info(result.columns.tolist()) + + # 한글 컬럼명으로 변환 + result = result.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 처리 + for col in NUMERIC_COLUMNS: + if col in result.columns: + result[col] = pd.to_numeric(result[col], errors='coerce') + + # 결과 출력 + logger.info("=== 해외주식 상품기본정보 결과 ===") + logger.info("조회된 데이터 건수: %d", len(result)) + print(result) + + except Exception as e: + logger.error("에러 발생: %s", str(e)) + raise + +if __name__ == "__main__": + main() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/search_info/search_info.py b/한국투자증권(API)/examples_llm/overseas_stock/search_info/search_info.py new file mode 100644 index 0000000..2b8f534 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/search_info/search_info.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +""" +Created on 2025-06-30 + +""" + +import logging +import time +from typing import Optional +import sys + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상품기본정보[v1_해외주식-034] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-price/v1/quotations/search-info" + + +def search_info( + prdt_type_cd: str, # 상품유형코드 + pdno: str, # 상품번호 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 상품기본정보[v1_해외주식-034] + 해외주식 상품기본정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prdt_type_cd (str): 512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 515 일본 501 홍콩 / 543 홍콩CNY / 558 홍콩USD 507 베트남 하노이 / 508 베트남 호치민 551 중국 상해A / 552 중국 심천A + pdno (str): 예) AAPL (애플) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 상품기본정보 데이터 + + Example: + >>> df = search_info(prdt_type_cd="512", pdno="AAPL") + >>> print(df) + """ + # [필수 파라미터 검증] + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '512')") + raise ValueError("prdt_type_cd is required. (e.g. '512')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1702R" + + params = { + "PRDT_TYPE_CD": prdt_type_cd, + "PDNO": pdno, + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_info( + prdt_type_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(API_URL) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/chk_trade_growth.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/chk_trade_growth.py new file mode 100644 index 0000000..493d31e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/chk_trade_growth.py @@ -0,0 +1,106 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from trade_growth import trade_growth + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래증가율순위[해외주식-045] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'pask': '매도호가', + 'pbid': '매수호가', + 'tvol': '거래량', + 'n_tvol': '평균거래량', + 'n_rate': '증가율', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'n_diff': '증가량' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 거래증가율순위 조회 테스트 함수 + + 이 함수는 해외주식 거래증가율순위 API를 호출하여 결과를 출력합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = trade_growth(excd="NAS", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼(output1): %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼(output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/trade_growth.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/trade_growth.py new file mode 100644 index 0000000..7988223 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_growth/trade_growth.py @@ -0,0 +1,120 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래증가율순위[해외주식-045] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/trade-growth" + +def trade_growth( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 > 해외주식 거래증가율순위[해외주식-045] + 해외주식 거래증가율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = trade_growth(excd="NAS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if nday == "": + raise ValueError("nday is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76330000" # 해외주식 거래증가율순위 + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_growth( + excd, nday, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/chk_trade_pbmn.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/chk_trade_pbmn.py new file mode 100644 index 0000000..719d9d9 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/chk_trade_pbmn.py @@ -0,0 +1,105 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from trade_pbmn import trade_pbmn + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래대금순위[해외주식-044] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'pask': '매도호가', + 'pbid': '매수호가', + 'tvol': '거래량', + 'tamt': '거래대금', + 'a_tamt': '평균거래대금', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 거래대금순위 조회 테스트 함수 + + 이 함수는 해외주식 거래대금순위 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 나스닥 거래소를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = trade_pbmn(excd="NAS", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/trade_pbmn.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/trade_pbmn.py new file mode 100644 index 0000000..25f380e --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_pbmn/trade_pbmn.py @@ -0,0 +1,127 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래대금순위[해외주식-044] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/trade-pbmn" + +def trade_pbmn( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + prc1: str = "", # 현재가 필터범위 시작 + prc2: str = "", # 현재가 필터범위 끝 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 거래대금순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + prc1 (str): 현재가 필터범위 시작 + prc2 (str): 현재가 필터범위 끝 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 거래대금순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = trade_pbmn(excd="NAS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None or dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1, dataframe2 + + tr_id = "HHDFS76320010" # 해외주식 거래대금순위 + + params = { + "EXCD": excd, # 거래소명 + "NDAY": nday, # N일자값 + "VOL_RANG": vol_rang, # 거래량조건 + "AUTH": auth, # 사용자권한정보 + "KEYB": keyb, # NEXT KEY BUFF + "PRC1": prc1, # 현재가 필터범위 시작 + "PRC2": prc2, # 현재가 필터범위 끝 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + keyb = res.getBody().keyb if hasattr(res.getBody(), 'keyb') else "" + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_pbmn( + excd, nday, vol_rang, auth, keyb, prc1, prc2, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/chk_trade_turnover.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/chk_trade_turnover.py new file mode 100644 index 0000000..e11ec73 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/chk_trade_turnover.py @@ -0,0 +1,108 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from trade_turnover import trade_turnover + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'n_tvol': '평균거래량', + 'shar': '상장주식수', + 'tover': '회전율', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'trat': '회전율' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 거래회전율순위 조회 테스트 함수 + + 이 함수는 해외주식 거래회전율순위 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 상해거래소 데이터를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = trade_turnover(excd="SHS", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 결과 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 결과 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/trade_turnover.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/trade_turnover.py new file mode 100644 index 0000000..45bf926 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_turnover/trade_turnover.py @@ -0,0 +1,122 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/trade-turnover" + +def trade_turnover( + excd: str, # 거래소명 + nday: str, # N분전콤보값 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] + 해외주식 거래회전율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N분전콤보값 (ex. 0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 해외주식 거래회전율순위 데이터 + + Example: + >>> result1, result2 = trade_turnover(excd="SHS", nday="0", vol_rang="0") + >>> print(result1) + >>> print(result2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError("excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76340000" # 해외주식 거래회전율순위 + + params = { + "EXCD": excd, # 거래소명 + "NDAY": nday, # N분전콤보값 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth # 사용자권한정보 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_turnover( + excd, nday, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/chk_trade_vol.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/chk_trade_vol.py new file mode 100644 index 0000000..04ff63d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/chk_trade_vol.py @@ -0,0 +1,105 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from trade_vol import trade_vol + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'pask': '매도호가', + 'pbid': '매수호가', + 'tvol': '거래량', + 'tamt': '거래대금', + 'a_tvol': '평균거래량', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 거래량순위 조회 테스트 함수 + + 이 함수는 해외주식 거래량순위 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 하노이 거래소(HNX), 당일(0), 전체(0)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = trade_vol(excd="HNX", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/trade_vol.py b/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/trade_vol.py new file mode 100644 index 0000000..f4956f3 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/trade_vol/trade_vol.py @@ -0,0 +1,127 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/trade-vol" + +def trade_vol( + excd: str, # 거래소명 + nday: str, # N분전콤보값 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + prc1: str = "", # 가격 필터 시작 + prc2: str = "", # 가격 필터 종료 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] + 해외주식 거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N분전콤보값 (ex. 0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF (ex. "") + auth (str): 사용자권한정보 (ex. "") + prc1 (str): 가격 필터 시작 (ex. "") + prc2 (str): 가격 필터 종료 (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 거래량순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = trade_vol(excd="NYS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError("excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76310010" # 해외주식 거래량순위 + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "KEYB": keyb, + "AUTH": auth, + "PRC1": prc1, + "PRC2": prc2 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_vol( + excd, nday, vol_rang, keyb, auth, prc1, prc2, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/chk_updown_rate.py b/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/chk_updown_rate.py new file mode 100644 index 0000000..15e6d3a --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/chk_updown_rate.py @@ -0,0 +1,107 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from updown_rate import updown_rate + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 등락율순위[해외주식-041] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태정보', + 'crec': '현재조회종목수', + 'trec': '전체조회종목수', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'n_base': '기준가격', + 'n_diff': '기준가격대비', + 'n_rate': '기준가격대비율', + 'rank': '순위', + 'ename': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 등락율순위 조회 테스트 함수 + + 이 함수는 해외주식 등락율순위 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 상해거래소 급등 당일 전체를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = updown_rate(excd="SHS", gubn="1", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/updown_rate.py b/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/updown_rate.py new file mode 100644 index 0000000..0f7acc6 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/updown_rate/updown_rate.py @@ -0,0 +1,125 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상승률/하락률[해외주식-041] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/updown-rate" + +def updown_rate( + excd: str, # [필수] 거래소명 + nday: str, # [필수] N일자값 + gubn: str, # [필수] 상승율/하락율 구분 + vol_rang: str, # [필수] 거래량조건 + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 상승률/하락률 순위를 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + gubn (str): [필수] 상승율/하락율 구분 (ex. 0:하락율, 1:상승율) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 상승률/하락률 순위 데이터 + + Example: + >>> df1, df2 = updown_rate(excd="NYS", nday="0", gubn="1", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError("excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '0:하락율, 1:상승율')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None and dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76290000" + + params = { + "EXCD": excd, + "NDAY": nday, + "GUBN": gubn, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return updown_rate( + excd, nday, gubn, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/volume_power/chk_volume_power.py b/한국투자증권(API)/examples_llm/overseas_stock/volume_power/chk_volume_power.py new file mode 100644 index 0000000..fdaff33 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/volume_power/chk_volume_power.py @@ -0,0 +1,107 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from volume_power import volume_power + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'knam': '종목명', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'tpow': '당일체결강도', + 'powx': '체결강도', + 'enam': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'bivl': '매도체결량', + 'asvl': '매수체결량', + 'strn': '체결강도' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 매수체결강도상위 조회 테스트 함수 + + 이 함수는 해외주식 매수체결강도상위 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 홍콩거래소(HKS)를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = volume_power(excd="HKS", nday="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼 (output1): %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과(output1):") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/volume_power/volume_power.py b/한국투자증권(API)/examples_llm/overseas_stock/volume_power/volume_power.py new file mode 100644 index 0000000..9134f04 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/volume_power/volume_power.py @@ -0,0 +1,121 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/volume-power" + +def volume_power( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # output1 누적 데이터프레임 + dataframe2: Optional[pd.DataFrame] = None, # output2 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] + + 해외주식 매수 체결강도 상위 종목을 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): output1 누적 데이터프레임 + dataframe2 (Optional[pd.DataFrame]): output2 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = volume_power(excd="HKS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'HKS')") + + if nday == "": + raise ValueError("nday is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76280000" + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_power( + excd, nday, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/chk_volume_surge.py b/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/chk_volume_surge.py new file mode 100644 index 0000000..1f6073d --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/chk_volume_surge.py @@ -0,0 +1,106 @@ +""" +Created on 20250601 +""" + +import sys +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka +from volume_surge import volume_surge + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] +############################################################################################## + +# 컬럼 매핑 정의 +COLUMN_MAPPING = { + 'zdiv': '소수점자리수', + 'stat': '거래상태', + 'nrec': 'RecordCount', + 'rsym': '실시간조회심볼', + 'excd': '거래소코드', + 'symb': '종목코드', + 'knam': '종목명', + 'name': '종목명', + 'last': '현재가', + 'sign': '기호', + 'diff': '대비', + 'rate': '등락율', + 'tvol': '거래량', + 'pask': '매도호가', + 'pbid': '매수호가', + 'n_tvol': '기준거래량', + 'n_diff': '증가량', + 'n_rate': '증가율', + 'enam': '영문종목명', + 'e_ordyn': '매매가능', + 'tamt': '거래대금', + 'trat': '거래량비율' +} + +# 숫자형 컬럼 정의 +NUMERIC_COLUMNS = [] + +def main(): + """ + 해외주식 거래량급증 조회 테스트 함수 + + 이 함수는 해외주식 거래량급증 API를 호출하여 결과를 출력합니다. + 테스트 데이터로 뉴욕거래소(NYS) 데이터를 사용합니다. + + Returns: + None + """ + + # pandas 출력 옵션 설정 + pd.set_option('display.max_columns', None) # 모든 컬럼 표시 + pd.set_option('display.width', None) # 출력 너비 제한 해제 + pd.set_option('display.max_rows', None) # 모든 행 표시 + + # 인증 토큰 발급 + ka.auth() + + # API 호출 + logging.info("API 호출") + try: + result1, result2 = volume_surge(excd="NYS", mixn="0", vol_rang="0") + except ValueError as e: + logging.error("에러 발생: %s" % str(e)) + return + + # output1 처리 + logging.info("사용 가능한 컬럼: %s", result1.columns.tolist()) + + # 한글 컬럼명으로 변환 + result1 = result1.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result1.columns: + result1[col] = pd.to_numeric(result1[col], errors='coerce').round(2) + + logging.info("결과:") + print(result1) + + # output2 처리 + logging.info("사용 가능한 컬럼 (output2): %s", result2.columns.tolist()) + + # 한글 컬럼명으로 변환 + result2 = result2.rename(columns=COLUMN_MAPPING) + + # 숫자형 컬럼 소수점 둘째자리까지 표시 + for col in NUMERIC_COLUMNS: + if col in result2.columns: + result2[col] = pd.to_numeric(result2[col], errors='coerce').round(2) + + logging.info("결과(output2):") + print(result2) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/volume_surge.py b/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/volume_surge.py new file mode 100644 index 0000000..6d655a2 --- /dev/null +++ b/한국투자증권(API)/examples_llm/overseas_stock/volume_surge/volume_surge.py @@ -0,0 +1,120 @@ +""" +Created on 20250601 +""" + + +import sys +import time +from typing import Optional, Tuple +import logging + +import pandas as pd + +sys.path.extend(['../..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] +############################################################################################## + +# 상수 정의 +API_URL = "/uapi/overseas-stock/v1/ranking/volume-surge" + +def volume_surge( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] + 해외주식 거래량급증 정보를 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = volume_surge(excd="NYS", mixn="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76270000" # 해외주식 거래량급증 + + params = { + "EXCD": excd, # 거래소명 + "MIXN": mixn, # N분전콤보값 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth # 사용자권한정보 + } + + res = ka._url_fetch(API_URL, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_surge( + excd, mixn, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=API_URL) + return pd.DataFrame(), pd.DataFrame() \ No newline at end of file diff --git a/한국투자증권(API)/examples_user/auth/auth_examples.py b/한국투자증권(API)/examples_user/auth/auth_examples.py new file mode 100644 index 0000000..e0d5a27 --- /dev/null +++ b/한국투자증권(API)/examples_user/auth/auth_examples.py @@ -0,0 +1,31 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from auth_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [인증] OAuth 접근토큰 발급 +############################################################################################## + +df = auth_token(grant_type="client_credentials", appkey=trenv.my_app, appsecret=trenv.my_sec, env_dv="real") +print(df) + +############################################################################################## +# [인증] WebSocket 웹소켓 접속키 발급 +############################################################################################## + +df = auth_ws_token(grant_type="client_credentials", appkey=trenv.my_app, appsecret=trenv.my_sec, env_dv="real") +print(df) + diff --git a/한국투자증권(API)/examples_user/auth/auth_functions.py b/한국투자증권(API)/examples_user/auth/auth_functions.py new file mode 100644 index 0000000..9894925 --- /dev/null +++ b/한국투자증권(API)/examples_user/auth/auth_functions.py @@ -0,0 +1,216 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd +import requests +import json + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [인증] OAuth 접근토큰 발급 +############################################################################################## + +def auth_token( + grant_type: str, + appkey: str, + appsecret: str, + env_dv: str +) -> pd.DataFrame: + """ + OAuth 접근토큰 발급 API를 호출하여 DataFrame으로 반환합니다. + + Args: + grant_type (str): [필수] 권한부여 Type (client_credentials) + appkey (str): [필수] 앱키 (한국투자증권 홈페이지에서 발급받은 appkey) + appsecret (str): [필수] 앱시크릿키 (한국투자증권 홈페이지에서 발급받은 appsecret) + env_dv (str): [필수] 환경구분 (real: 실전, demo: 모의) + + Returns: + pd.DataFrame: OAuth 토큰 발급 결과 + + Example: + >>> df = auth_token( + ... grant_type="client_credentials", + ... appkey=trenv.my_app, + ... appsecret=trenv.my_sec, + ... env_dv="real" + ... ) + >>> print(df) + """ + api_url = "/oauth2/tokenP" + # 필수 파라미터 검증 + if not grant_type: + logger.error("grant_type is required. (e.g. 'client_credentials')") + raise ValueError("grant_type is required. (e.g. 'client_credentials')") + + if not appkey: + logger.error("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + raise ValueError("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + + if not appsecret: + logger.error("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + raise ValueError("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + + if not env_dv: + logger.error("env_dv is required. (real: 실전, demo: 모의)") + raise ValueError("env_dv is required. (real: 실전, demo: 모의)") + + # 환경 구분에 따른 서버 URL 설정 + config = ka.getEnv() + if env_dv == "real": + base_url = config.get("prod", "") + elif env_dv == "demo": + base_url = config.get("vps", "") + else: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + url = f"{base_url}{api_url}" + + # 헤더 설정 + headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8" + } + + # 요청 데이터 + data = { + "grant_type": grant_type, + "appkey": appkey, + "appsecret": appsecret, + } + + try: + # POST 방식으로 직접 API 호출 + response = requests.post(url, data=json.dumps(data), headers=headers) + + if response.status_code == 200: + # 응답 데이터를 DataFrame으로 반환 (1개 row) + response_data = response.json() + current_data = pd.DataFrame([response_data]) + + logger.info("OAuth 토큰 발급 성공") + return current_data + else: + logger.error("API call failed: %s - %s", response.status_code, response.text) + return pd.DataFrame() + + except requests.RequestException as e: + logger.error("Request failed: %s", str(e)) + return pd.DataFrame() + except json.JSONDecodeError as e: + logger.error("JSON decode failed: %s", str(e)) + return pd.DataFrame() + +############################################################################################## +# [인증] WebSocket 웹소켓 접속키 발급 +############################################################################################## + +def auth_ws_token( + grant_type: str, + appkey: str, + appsecret: str, + env_dv: str, + token: Optional[str] = "" +) -> pd.DataFrame: + """ + WebSocket 웹소켓 접속키 발급 API를 호출하여 DataFrame으로 반환합니다. + + Args: + grant_type (str): [필수] 권한부여 Type (client_credentials) + appkey (str): [필수] 고객 앱Key (한국투자증권 홈페이지에서 발급받은 appkey) + appsecret (str): [필수] 고객 앱Secret (한국투자증권 홈페이지에서 발급받은 appsecret) + env_dv (str): [필수] 환경구분 (real: 실전, demo: 모의) + token (Optional[str]): 접근토큰 (OAuth 토큰이 필요한 API 경우 발급한 Access token) + + Returns: + pd.DataFrame: WebSocket 접속키 발급 결과 + + Example: + >>> df = auth_ws_token( + ... grant_type="client_credentials", + ... appkey=trenv.my_app, + ... appsecret=trenv.my_sec, + ... env_dv="real" + ... ) + >>> print(df) + """ + api_url = "/oauth2/Approval" + # 필수 파라미터 검증 + if not grant_type: + logger.error("grant_type is required. (e.g. 'client_credentials')") + raise ValueError("grant_type is required. (e.g. 'client_credentials')") + + if not appkey: + logger.error("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + raise ValueError("appkey is required. (한국투자증권 홈페이지에서 발급받은 appkey)") + + if not appsecret: + logger.error("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + raise ValueError("appsecret is required. (한국투자증권 홈페이지에서 발급받은 appsecret)") + + if not env_dv: + logger.error("env_dv is required. (real: 실전, demo: 모의)") + raise ValueError("env_dv is required. (real: 실전, demo: 모의)") + + # 환경 구분에 따른 서버 URL 설정 + config = ka.getEnv() + if env_dv == "real": + base_url = config.get("prod", "") + elif env_dv == "demo": + base_url = config.get("vps", "") + else: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + url = f"{base_url}{api_url}" + + # 헤더 설정 + headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8" + } + + # 요청 데이터 + data = { + "grant_type": grant_type, + "appkey": appkey, + "secretkey": appsecret, + } + + # token이 있는 경우에만 data에 추가 + if token: + data["token"] = token + + try: + # POST 방식으로 직접 API 호출 + response = requests.post(url, data=json.dumps(data), headers=headers) + + if response.status_code == 200: + # 응답 데이터를 DataFrame으로 반환 (1개 row) + response_data = response.json() + current_data = pd.DataFrame([response_data]) + + logger.info("WebSocket 접속키 발급 성공") + return current_data + else: + logger.error("API call failed: %s - %s", response.status_code, response.text) + return pd.DataFrame() + + except requests.RequestException as e: + logger.error("Request failed: %s", str(e)) + return pd.DataFrame() + except json.JSONDecodeError as e: + logger.error("JSON decode failed: %s", str(e)) + return pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples.py b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples.py new file mode 100644 index 0000000..9aad751 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples.py @@ -0,0 +1,165 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_bond_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 평균단가조회 [국내채권-158] +############################################################################################## + +df1, df2, df3 = avg_unit(inqr_strt_dt="20250101", inqr_end_dt="20250131", pdno="KR2033022D33", prdt_type_cd="302", vrfc_kind_cd="00") +print(df1) +print(df2) +print(df3) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수주문 [국내주식-124] +############################################################################################## + +result = buy( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + pdno="KR6095572D81", # 상품번호 + ord_qty2="10", # 주문수량 + bond_ord_unpr="9900", # 채권주문단가 + samt_mket_ptci_yn="N", # 소액시장참여여부 + bond_rtl_mket_yn="N", # 채권소매시장여부 + idcr_stfno="", # 유치자직원번호 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ctac_tlno="", # 연락전화번호 + ) +print(result) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(호가) [국내주식-132] +############################################################################################## + +df = inquire_asking_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 잔고조회 [국내주식-198] +############################################################################################## + +df = inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_cndt="00", pdno="", buy_dt="") +print(df) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(체결) [국내주식-201] +############################################################################################## + +df = inquire_ccnl(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 일별체결조회 [국내주식-127] +############################################################################################## + +df1, df2 = inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250601", inqr_end_dt="20250630", sll_buy_dvsn_cd="%", sort_sqn_dvsn="01", pdno="", nccs_yn="N", ctx_area_nk200="", ctx_area_fk200="") +print(df1) +print(df2) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기간별시세(일) [국내주식-159] +############################################################################################## + +df = inquire_daily_itemchartprice(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") +print(df) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(일별) [국내주식-202] +############################################################################################## + +df = inquire_daily_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") +print(df) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(시세) [국내주식-200] +############################################################################################## + +df = inquire_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수가능조회 [국내주식-199] +############################################################################################## + +df = inquire_psbl_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="KR2033022D33", bond_ord_unpr="1000") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 채권정정취소가능주문조회 [국내주식-126] +############################################################################################## + +df = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ord_dt="20250601", odno="", ctx_area_fk200="", ctx_area_nk200="") +print(df) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 발행정보 [국내주식-156] +############################################################################################## + +df = issue_info(pdno="KR6449111CB8", prdt_type_cd="302") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 정정취소주문 [국내주식-125] +############################################################################################## + +result = order_rvsecncl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="KR6095572D81", + orgn_odno="0004357900", # 실제 테스트 시 유효한 원주문번호로 변경해야 합니다. + ord_qty2="1", # 정정/취소 수량 + bond_ord_unpr="10470", # 정정 단가 + qty_all_ord_yn="Y", # 잔량 전부 주문 여부 + rvse_cncl_dvsn_cd="01", # 01: 정정, 02: 취소 + mgco_aptm_odno="", + ord_svr_dvsn_cd="0", + ctac_tlno="", + ) +print(result) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기본조회 [국내주식-129] +############################################################################################## + +df = search_bond_info(pdno="KR2033022D33", prdt_type_cd="302") +print(df) + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매도주문 [국내주식-123] +############################################################################################## + +result = sell( + cano=trenv.my_acct, # 종합계좌번호 + acnt_prdt_cd=trenv.my_prod, # 계좌상품코드 + ord_dvsn="01", # 주문구분 + pdno="KR6095572D81", # 상품번호 + ord_qty2="1", # 주문수량 + bond_ord_unpr="10000.0", # 채권주문단가 + sprx_yn="N", # 분리과세여부 + buy_dt="", # 매수일자 + buy_seq="", # 매수순번 + samt_mket_ptci_yn="N", # 소액시장참여여부 + sll_agco_opps_sll_yn="N", # 매도대행사반대매도여부 + bond_rtl_mket_yn="N", # 채권소매시장여부 + mgco_aptm_odno="", # 운용사지정주문번호 + ord_svr_dvsn_cd="0", # 주문서버구분코드 + ctac_tlno="", # 연락전화번호 + ) +print(result) + diff --git a/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples_ws.py b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples_ws.py new file mode 100644 index 0000000..eb15d65 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_examples_ws.py @@ -0,0 +1,53 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_bond_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간호가 [실시간-053] +############################################################################################## + +kws.subscribe(request=bond_asking_price, data=["KR103502GA34", "KR6095572D81"]) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간체결가 [실시간-052] +############################################################################################## + +kws.subscribe(request=bond_ccnl, data=["KR103502GA34", "KR6095572D81"]) + +############################################################################################## +# [장내채권] 실시간시세 > 채권지수 실시간체결가 [실시간-060] +############################################################################################## + +kws.subscribe(request=bond_index_ccnl, data=[ + # 한경채권지수 + "KBPR01", "KBPR02", "KBPR03", "KBPR04", + # KIS채권지수 + "KISR01", "MSBI07", "KTBL10", "MSBI09", "MSBI10", "CDIX01", + # 매경채권지수 + "MKFR01", "MSBI01", "MSBI03", "MSBI10", "CORP01" +]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions.py b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions.py new file mode 100644 index 0000000..f732631 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions.py @@ -0,0 +1,1685 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 평균단가조회 [국내채권-158] +############################################################################################## + +def avg_unit( + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + vrfc_kind_cd: str, # 검증종류코드 + NK30: str = "", # 연속조회키30 + FK100: str = "", # 연속조회검색조건100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 평균단가조회[국내주식-158] + 장내채권 평균단가조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_strt_dt (str): 조회 시작 일자 (예: '20230101') + inqr_end_dt (str): 조회 종료 일자 (예: '20230131') + pdno (str): 상품번호, 공백: 전체, 특정종목 조회시 : 종목코드 + prdt_type_cd (str): 상품유형코드 (예: '302') + vrfc_kind_cd (str): 검증종류코드 (예: '00') + NK30 (str): 연속조회키30, 공백 허용 + FK100 (str): 연속조회검색조건100, 공백 허용 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 장내채권 평균단가조회 데이터 + + Example: + >>> df1, df2, df3 = avg_unit( + ... inqr_strt_dt='20230101', + ... inqr_end_dt='20230131', + ... pdno='KR2033022D33', + ... prdt_type_cd='302', + ... vrfc_kind_cd='00', + ... ) + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # 필수 파라미터 검증 + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20230131')") + raise ValueError("inqr_end_dt is required. (e.g. '20230131')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + if not vrfc_kind_cd: + logger.error("vrfc_kind_cd is required. (e.g. '00')") + raise ValueError("vrfc_kind_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame(), + dataframe3 if dataframe3 is not None else pd.DataFrame() + ) + + tr_id = "CTPF2005R" + + + api_url = "/uapi/domestic-bond/v1/quotations/avg-unit" + + + + params = { + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "VRFC_KIND_CD": vrfc_kind_cd, + "CTX_AREA_NK30": NK30, + "CTX_AREA_FK100": FK100, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 연속조회 정보 업데이트 + tr_cont = res.getHeader().tr_cont + NK30 = res.getBody().ctx_area_nk30 + FK100 = res.getBody().ctx_area_fk100 + + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # output3 데이터 처리 + current_data3 = pd.DataFrame(res.getBody().output3) + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logger.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return avg_unit( + inqr_strt_dt, + inqr_end_dt, + pdno, + prdt_type_cd, + vrfc_kind_cd, + NK30, + FK100, + dataframe1, + dataframe2, + dataframe3, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수주문 [국내주식-124] +############################################################################################## + +def buy( + cano: str, + acnt_prdt_cd: str, + pdno: str, + ord_qty2: str, + bond_ord_unpr: str, + samt_mket_ptci_yn: str, + bond_rtl_mket_yn: str, + idcr_stfno: str = "", + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매수주문[국내주식-124] + 장내채권 매수주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (8자리) + acnt_prdt_cd (str): 계좌상품코드 (2자리) + pdno (str): 상품번호 (12자리) + ord_qty2 (str): 주문수량2 (19자리) + bond_ord_unpr (str): 채권주문단가 (182자리) + samt_mket_ptci_yn (str): 소액시장참여여부 ('Y' or 'N') + bond_rtl_mket_yn (str): 채권소매시장여부 ('Y' or 'N') + idcr_stfno (str, optional): 유치자직원번호 (6자리). Defaults to "". + mgco_aptm_odno (str, optional): 운용사지정주문번호 (12자리). Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 매수주문 데이터 + + Example: + >>> df = buy( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="KR1234567890", + ... ord_qty2="10", + ... bond_ord_unpr="10000", + ... samt_mket_ptci_yn="N", + ... bond_rtl_mket_yn="Y" + ... ) + >>> print(df) + """ + tr_id = "TTTC0952U" + + + api_url = "/uapi/domestic-bond/v1/trading/buy" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "SAMT_MKET_PTCI_YN": samt_mket_ptci_yn, + "BOND_RTL_MKET_YN": bond_rtl_mket_yn, + "IDCR_STFNO": idcr_stfno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(호가) [국내주식-132] +############################################################################################## + +def inquire_asking_price( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + fid_input_iscd: str, # 채권종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(호가)[국내주식-132] + 장내채권현재가(호가) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장 분류 코드 (B 입력) + fid_input_iscd (str): 채권종목코드 (ex KR2033022D33) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(호가) 데이터 + + Example: + >>> df = inquire_asking_price(fid_cond_mrkt_div_code="B", fid_input_iscd="KR2033022D33") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773401C0" + + + api_url = "/uapi/domestic-bond/v1/quotations/inquire-asking-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 잔고조회 [국내주식-198] +############################################################################################## + +def inquire_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_cndt: str, # 조회조건 + pdno: str, # 상품번호 + buy_dt: str, # 매수일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 잔고조회[국내주식-198] + 장내채권 잔고조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + inqr_cndt (str): 조회조건 (00: 전체, 01: 상품번호단위) + pdno (str): 상품번호 (공백 허용) + buy_dt (str): 매수일자 (공백 허용) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 잔고조회 데이터 + + Example: + >>> df = inquire_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... inqr_cndt='00', + ... pdno='', + ... buy_dt='', + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not inqr_cndt: + logger.error("inqr_cndt is required. (e.g. '00')") + raise ValueError("inqr_cndt is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTSC8407R" + + + api_url = "/uapi/domestic-bond/v1/trading/inquire-balance" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_CNDT": inqr_cndt, + "PDNO": pdno, + "BUY_DT": buy_dt, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + NK200 = res.getBody().ctx_area_nk200 + FK200 = res.getBody().ctx_area_fk200 + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_balance( + cano, + acnt_prdt_cd, + inqr_cndt, + pdno, + buy_dt, + FK200, + NK200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(체결) [국내주식-201] +############################################################################################## + +def inquire_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(체결)[국내주식-201] + 장내채권현재가(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(체결) 데이터 + + Example: + >>> df = inquire_ccnl('B', 'KR2033022D33') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773403C0" + + # API 요청 파라미터 설정 + + api_url = "/uapi/domestic-bond/v1/quotations/inquire-ccnl" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 일별체결조회 [국내주식-127] +############################################################################################## + +def inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + sort_sqn_dvsn: str, # 정렬순서구분 + pdno: str, # 상품번호 + nccs_yn: str, # 미체결여부 + ctx_area_nk200: str, # 연속조회키200 + ctx_area_fk200: str, # 연속조회검색조건200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 주문체결내역[국내주식-127] + 장내채권 주문체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + inqr_strt_dt (str): 조회시작일자 (1주일 이내) + inqr_end_dt (str): 조회종료일자 (조회 당일) + sll_buy_dvsn_cd (str): 매도매수구분코드 (%(전체), 01(매도), 02(매수)) + sort_sqn_dvsn (str): 정렬순서구분 (01(주문순서), 02(주문역순)) + pdno (str): 상품번호 + nccs_yn (str): 미체결여부 (N(전체), C(체결), Y(미체결)) + ctx_area_nk200 (str): 연속조회키200 + ctx_area_fk200 (str): 연속조회검색조건200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 장내채권 주문체결내역 데이터 + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... inqr_strt_dt='20230101', + ... inqr_end_dt='20230107', + ... sll_buy_dvsn_cd='01', + ... sort_sqn_dvsn='01', + ... pdno='000000000001', + ... nccs_yn='N', + ... ctx_area_nk200='', + ... ctx_area_fk200='' + ... ) + >>> print(df1) + >>> print(df2) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20230107')") + raise ValueError("inqr_end_dt is required. (e.g. '20230107')") + if not sll_buy_dvsn_cd in ["%", "01", "02"]: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01')") + if not sort_sqn_dvsn in ["01", "02"]: + logger.error("sort_sqn_dvsn is required. (e.g. '01')") + raise ValueError("sort_sqn_dvsn is required. (e.g. '01')") + if not nccs_yn in ["N", "C", "Y"]: + logger.error("nccs_yn is required. (e.g. 'N')") + raise ValueError("nccs_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTSC8013R" + + + api_url = "/uapi/domestic-bond/v1/trading/inquire-daily-ccld" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "SORT_SQN_DVSN": sort_sqn_dvsn, + "PDNO": pdno, + "NCCS_YN": nccs_yn, + "CTX_AREA_NK200": ctx_area_nk200, + "CTX_AREA_FK200": ctx_area_fk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + ctx_area_nk200 = res.getBody().ctx_area_nk200 + ctx_area_fk200 = res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_ccld( + cano, + acnt_prdt_cd, + inqr_strt_dt, + inqr_end_dt, + sll_buy_dvsn_cd, + sort_sqn_dvsn, + pdno, + nccs_yn, + ctx_area_nk200, + ctx_area_fk200, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기간별시세(일) [국내주식-159] +############################################################################################## + +def inquire_daily_itemchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 기간별시세(일)[국내주식-159] + 장내채권 기간별시세(일) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 구분 코드 (필수) + fid_input_iscd (str): 입력 종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 기간별시세(일) 데이터 + + Example: + >>> df = inquire_daily_itemchartprice("B", "KR2033022D33") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773701C0" + + + api_url = "/uapi/domestic-bond/v1/quotations/inquire-daily-itemchartprice" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_itemchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 일별시세 [국내주식-202] +############################################################################################## + +def inquire_daily_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(일별)[국내주식-202] + 장내채권현재가(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(일별) 데이터 + + Example: + >>> df = inquire_daily_price('B', 'KR2033022D33') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773404C0" + + + api_url = "/uapi/domestic-bond/v1/quotations/inquire-daily-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권현재가(시세) [국내주식-200] +############################################################################################## + +def inquire_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권현재가(시세)[국내주식-200] + 장내채권현재가(시세) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'B') + fid_input_iscd (str): 입력종목코드 (예: 'KR2033022D33') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권현재가(시세) 데이터 + + Example: + >>> df = inquire_price('B', 'KR2033022D33') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'B')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'B')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'KR2033022D33')") + raise ValueError("fid_input_iscd is required. (e.g. 'KR2033022D33')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKBJ773400C0" + + + api_url = "/uapi/domestic-bond/v1/quotations/inquire-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매수가능조회 [국내주식-199] +############################################################################################## + +def inquire_psbl_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + bond_ord_unpr: str, # 채권주문단가 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매수가능조회[국내주식-199] + 장내채권 매수가능조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (필수) + acnt_prdt_cd (str): 계좌상품코드 (필수) + pdno (str): 채권종목코드(ex KR2033022D33) + bond_ord_unpr (str): 채권주문단가 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 매수가능조회 데이터 + + Example: + >>> df = inquire_psbl_order("12345678", "01", "KR2033022D33", "1000") + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '1234567890')") + raise ValueError("cano is required. (e.g. '1234567890')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not pdno: + logger.error("pdno is required. (e.g. 'KR2033022D33')") + raise ValueError("pdno is required. (e.g. 'KR2033022D33')") + + if not bond_ord_unpr: + logger.error("bond_ord_unpr is required. (e.g. '1000')") + raise ValueError("bond_ord_unpr is required. (e.g. '1000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC8910R" + + + api_url = "/uapi/domestic-bond/v1/trading/inquire-psbl-order" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "BOND_ORD_UNPR": bond_ord_unpr, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_order( + cano, + acnt_prdt_cd, + pdno, + bond_ord_unpr, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 채권정정취소가능주문조회 [국내주식-126] +############################################################################################## + +def inquire_psbl_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ord_dt: str, # 주문일자 + odno: str, # 주문번호 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 채권정정취소가능주문조회[국내주식-126] + 채권정정취소가능주문조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (예: '12345678') + acnt_prdt_cd (str): 계좌상품코드 (예: '01') + ord_dt (str): 주문일자 (예: '20230101') + odno (str): 주문번호 (예: '0000000001') + ctx_area_fk200 (str): 연속조회검색조건200 (예: '조건값') + ctx_area_nk200 (str): 연속조회키200 (예: '키값') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 채권정정취소가능주문조회 데이터 + + Example: + >>> df = inquire_psbl_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ord_dt='20230101', + ... odno='0000000001', + ... ctx_area_fk200='조건값', + ... ctx_area_nk200='키값' + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTSC8035R" + + + api_url = "/uapi/domestic-bond/v1/trading/inquire-psbl-rvsecncl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORD_DT": ord_dt, + "ODNO": odno, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + ctx_area_nk200 = res.getBody().ctx_area_nk200 + ctx_area_fk200 = res.getBody().ctx_area_fk200 + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_rvsecncl( + cano, + acnt_prdt_cd, + ord_dt, + odno, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 발행정보 [국내주식-156] +############################################################################################## + +def issue_info( + pdno: str, # 사용자권한정보 + prdt_type_cd: str, # 거래소코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 발행정보[국내주식-156] + 장내채권 발행정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 채권 종목번호(ex. KR6449111CB8) + prdt_type_cd (str): Unique key(302) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 발행정보 데이터 + + Example: + >>> df = issue_info("KR6449111CB8", "302") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. 'KR6449111CB8')") + raise ValueError("pdno is required. (e.g. 'KR6449111CB8')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + tr_id = "CTPF1101R" + + # 요청 파라미터 설정 + + api_url = "/uapi/domestic-bond/v1/quotations/issue-info" + + + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 여부 확인 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return issue_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 정정취소주문 [국내주식-125] +############################################################################################## + +def order_rvsecncl( + cano: str, + acnt_prdt_cd: str, + pdno: str, + orgn_odno: str, + ord_qty2: str, + bond_ord_unpr: str, + qty_all_ord_yn: str, + rvse_cncl_dvsn_cd: str, + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "0", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 정정취소주문[국내주식-125] + 장내채권 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + pdno (str): 상품번호 + orgn_odno (str): 원주문번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + qty_all_ord_yn (str): 잔량전부주문여부 + rvse_cncl_dvsn_cd (str): 정정취소구분코드 + mgco_aptm_odno (str, optional): 운용사지정주문번호. Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "0". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="KR6095572D81", + ... orgn_odno="0000015402", + ... ord_qty2="2", + ... bond_ord_unpr="10460", + ... qty_all_ord_yn="Y", + ... rvse_cncl_dvsn_cd="01" + ... ) + >>> print(df) + """ + tr_id = "TTTC0953U" + + + api_url = "/uapi/domestic-bond/v1/trading/order-rvsecncl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "QTY_ALL_ORD_YN": qty_all_ord_yn, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 기본시세 > 장내채권 기본조회 [국내주식-129] +############################################################################################## + +def search_bond_info( + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [장내채권] 기본시세 + 장내채권 기본조회[국내주식-129] + 장내채권 기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 상품번호 (필수) + prdt_type_cd (str): 상품유형코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 장내채권 기본조회 데이터 + + Example: + >>> df = search_bond_info("KR2033022D33", "302") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. 'KR2033022D33')") + raise ValueError("pdno is required. (e.g. 'KR2033022D33')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '302')") + raise ValueError("prdt_type_cd is required. (e.g. '302')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1114R" + + + api_url = "/uapi/domestic-bond/v1/quotations/search-bond-info" + + + + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_bond_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [장내채권] 주문/계좌 > 장내채권 매도주문 [국내주식-123] +############################################################################################## + +def sell( + cano: str, + acnt_prdt_cd: str, + ord_dvsn: str, + pdno: str, + ord_qty2: str, + bond_ord_unpr: str, + sprx_yn: str, + samt_mket_ptci_yn: str, + sll_agco_opps_sll_yn: str, + bond_rtl_mket_yn: str, + buy_dt: str = "", + buy_seq: str = "", + mgco_aptm_odno: str = "", + ord_svr_dvsn_cd: str = "0", + ctac_tlno: str = "" +) -> Optional[pd.DataFrame]: + """ + [장내채권] 주문/계좌 + 장내채권 매도주문[국내주식-123] + 장내채권 매도주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + ord_dvsn (str): 주문구분 + pdno (str): 상품번호 + ord_qty2 (str): 주문수량2 + bond_ord_unpr (str): 채권주문단가 + sprx_yn (str): 분리과세여부 + samt_mket_ptci_yn (str): 소액시장참여여부 + sll_agco_opps_sll_yn (str): 매도대행사반대매도여부 + bond_rtl_mket_yn (str): 채권소매시장여부 + buy_dt (str, optional): 매수일자. Defaults to "". + buy_seq (str, optional): 매수순번. Defaults to "". + mgco_aptm_odno (str, optional): 운용사지정주문번호. Defaults to "". + ord_svr_dvsn_cd (str, optional): 주문서버구분코드. Defaults to "0". + ctac_tlno (str, optional): 연락전화번호. Defaults to "". + + Returns: + Optional[pd.DataFrame]: 장내채권 매도주문 데이터 + + Example: + >>> df = sell( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ord_dvsn="01", + ... pdno="KR6095572D81", + ... ord_qty2="1", + ... bond_ord_unpr="10000.0", + ... sprx_yn="N", + ... samt_mket_ptci_yn="N", + ... sll_agco_opps_sll_yn="N", + ... bond_rtl_mket_yn="N" + ... ) + >>> print(df) + """ + tr_id = "TTTC0958U" + + + api_url = "/uapi/domestic-bond/v1/trading/sell" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORD_DVSN": ord_dvsn, + "PDNO": pdno, + "ORD_QTY2": ord_qty2, + "BOND_ORD_UNPR": bond_ord_unpr, + "SPRX_YN": sprx_yn, + "BUY_DT": buy_dt, + "BUY_SEQ": buy_seq, + "SAMT_MKET_PTCI_YN": samt_mket_ptci_yn, + "SLL_AGCO_OPPS_SLL_YN": sll_agco_opps_sll_yn, + "BOND_RTL_MKET_YN": bond_rtl_mket_yn, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "CTAC_TLNO": ctac_tlno + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions_ws.py b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions_ws.py new file mode 100644 index 0000000..61cac92 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_bond/domestic_bond_functions_ws.py @@ -0,0 +1,233 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간호가 [실시간-053] +############################################################################################## + +def bond_asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 일반채권 실시간호가[실시간-053] + 일반채권 실시간호가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 메시지. + columns (list[str]): 응답 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = bond_asking_price("1", "005930") + >>> print(msg, columns) + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 > API문서 > 종목정보파일 > 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0BJASP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "stnd_iscd", + "stck_cntg_hour", + "askp_ert1", + "bidp_ert1", + "askp1", + "bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "askp_ert2", + "bidp_ert2", + "askp2", + "bidp2", + "askp_rsqn2", + "bidp_rsqn2", + "askp_ert3", + "bidp_ert3", + "askp3", + "bidp3", + "askp_rsqn3", + "bidp_rsqn3", + "askp_ert4", + "bidp_ert4", + "askp4", + "bidp4", + "askp_rsqn4", + "bidp_rsqn4", + "askp_ert5", + "bidp_ert5", + "askp5", + "bidp5", + "askp_rsqn52", + "bidp_rsqn53", + "total_askp_rsqn", + "total_bidp_rsqn", + ] + + return msg, columns + +############################################################################################## +# [장내채권] 실시간시세 > 일반채권 실시간체결가 [실시간-052] +############################################################################################## + +def bond_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 일반채권 실시간체결가[H0BJCNT0] 구독 함수 + 한국투자증권 웹소켓 API를 통해 일반채권의 실시간 체결가 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 구독 결과 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = bond_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 > API문서 > 종목정보파일 > 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0BJCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "stnd_iscd", # 표준종목코드 + "bond_isnm", # 채권종목명 + "stck_cntg_hour", # 주식체결시간 + "prdy_vrss_sign", # 전일대비부호 + "prdy_vrss", # 전일대비 + "prdy_ctrt", # 전일대비율 + "stck_prpr", # 현재가 + "cntg_vol", # 체결거래량 + "stck_oprc", # 시가 + "stck_hgpr", # 고가 + "stck_lwpr", # 저가 + "stck_prdy_clpr", # 전일종가 + "bond_cntg_ert", # 현재수익률 + "oprc_ert", # 시가수익률 + "hgpr_ert", # 고가수익률 + "lwpr_ert", # 저가수익률 + "acml_vol", # 누적거래량 + "prdy_vol", # 전일거래량 + "cntg_type_cls_code", # 체결유형코드 + ] + + return msg, columns + +############################################################################################## +# [장내채권] 실시간시세 > 채권지수 실시간체결가 [실시간-060] +############################################################################################## + +def bond_index_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 채권지수 실시간체결가[H0BICNT0] + 채권지수 실시간체결가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 구독할 종목코드. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 구독 요청에 대한 응답 메시지. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = bond_index_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 채권 종목코드 마스터파일은 "KIS포털 > API문서 > 종목정보파일 > 장내채권 - 채권코드" 참고 부탁드립니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0BICNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "nmix_id", # 지수ID + "stnd_date1", # 기준일자1 + "trnm_hour", # 전송시간 + "totl_ernn_nmix_oprc", # 총수익지수시가지수 + "totl_ernn_nmix_hgpr", # 총수익지수최고가 + "totl_ernn_nmix_lwpr", # 총수익지수최저가 + "totl_ernn_nmix", # 총수익지수 + "prdy_totl_ernn_nmix", # 전일총수익지수 + "totl_ernn_nmix_prdy_vrss", # 총수익지수전일대비 + "totl_ernn_nmix_prdy_vrss_sign", # 총수익지수전일대비부호 + "totl_ernn_nmix_prdy_ctrt", # 총수익지수전일대비율 + "clen_prc_nmix", # 순가격지수 + "mrkt_prc_nmix", # 시장가격지수 + "bond_call_rnvs_nmix", # Call재투자지수 + "bond_zero_rnvs_nmix", # Zero재투자지수 + "bond_futs_thpr", # 선물이론가격 + "bond_avrg_drtn_val", # 평균듀레이션 + "bond_avrg_cnvx_val", # 평균컨벡서티 + "bond_avrg_ytm_val", # 평균YTM + "bond_avrg_frdl_ytm_val", # 평균선도YTM + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples.py b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples.py new file mode 100644 index 0000000..098266d --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples.py @@ -0,0 +1,296 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_futureoption_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_콜풋[국내선물-022] +############################################################################################## + +result1, result2 = display_board_callput( + fid_cond_mrkt_div_code="O", + fid_cond_scr_div_code="20503", + fid_mrkt_cls_code="CO", + fid_mtrt_cnt="202508", + fid_mrkt_cls_code1="PO" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_선물[국내선물-023] +############################################################################################## + +result = display_board_futures( + fid_cond_mrkt_div_code="F", + fid_cond_scr_div_code="20503", + fid_cond_mrkt_cls_code="MKI" + ) +print(result) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_옵션월물리스트[국내선물-020] +############################################################################################## + +result = display_board_option_list(fid_cond_scr_div_code="509") +print(result) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내선물 기초자산 시세[국내선물-021] +############################################################################################## + +output1, output2 = display_board_top(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09") +print(output1) +print(output2) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 일중예상체결추이[국내선물-018] +############################################################################################## + +result1, result2 = exp_price_trend(fid_input_iscd="101W09", fid_cond_mrkt_div_code="F") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세호가[v1_국내선물-007] +############################################################################################## + +result1, result2 = inquire_asking_price(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09", env_dv="real") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고현황[v1_국내선물-004] +############################################################################################## + +result1, result2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", + excc_stat_cd="1") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고정산손익내역[v1_국내선물-013] +############################################################################################## + +result1, result2 = inquire_balance_settlement_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dt="20230906") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고평가손익내역[v1_국내선물-015] +############################################################################################## + +result1, result2 = inquire_balance_valuation_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", + excc_stat_cd="1") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문체결내역조회[v1_국내선물-003] +############################################################################################## + +result1, result2 = inquire_ccnl( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + strt_ord_dt="20220730", + end_ord_dt="20220830", + sll_buy_dvsn_cd="00", + ccld_nccs_dvsn="00", + sort_sqn="DS" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 기준일체결내역[v1_국내선물-016] +############################################################################################## + +result1, result2 = inquire_ccnl_bstime( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + ord_dt="20230920", + fuop_tr_strt_tmd="000000", + fuop_tr_end_tmd="240000" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션기간약정수수료일별[v1_국내선물-017] +############################################################################################## + +result1, result2 = inquire_daily_amount_fee( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_day="20240401", + inqr_end_day="20240625" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션기간별시세(일/주/월/년)[v1_국내선물-008] +############################################################################################## + +output1, output2 = inquire_daily_fuopchartprice( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101W09", + fid_input_date_1="20250301", + fid_input_date_2="20250810", + fid_period_div_code="D", + env_dv="real" + ) +print(output1) +print(output2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 총자산현황[v1_국내선물-014] +############################################################################################## + +result = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) +print(result) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +############################################################################################## + +result1, result2 = inquire_ngt_balance( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + mgna_dvsn="01", + excc_stat_cd="1" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] +############################################################################################## + +result1, result2 = inquire_ngt_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20250610", + end_ord_dt="20250613", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00") +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세[v1_국내선물-006] +############################################################################################## + +result1, result2, result3 = inquire_price( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101W09", + env_dv="real" + ) +print(result1) +print(result2) +print(result3) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +############################################################################################## + +result = inquire_psbl_ngt_order( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="101W09", + prdt_type_cd="301", + sll_buy_dvsn_cd="02", + unit_price="322", + ord_dvsn_cd="01" + ) +print(result) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문가능[v1_국내선물-005] +############################################################################################## + +result = inquire_psbl_order( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="101W09", + sll_buy_dvsn_cd="02", + unit_price="1", + ord_dvsn_cd="01" + ) +print(result) + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 분봉조회[v1_국내선물-012] +############################################################################################## + +result1, result2 = inquire_time_fuopchartprice( + fid_cond_mrkt_div_code="F", + fid_input_iscd="101T12", + fid_hour_cls_code="60", + fid_pw_data_incu_yn="Y", + fid_fake_tick_incu_yn="N", + fid_input_date_1="20230901", + fid_input_hour_1="100000" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 증거금 상세 [국내선물-024] +############################################################################################## + +result1, result2, result3 = ngt_margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn_cd="01") +print(result1) +print(result2) +print(result3) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] +############################################################################################## + +result = order( + env_dv="real", + ord_dv="day", + ord_prcs_dvsn_cd="02", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + sll_buy_dvsn_cd="02", + shtn_pdno="101W09", + ord_qty="1", + unit_price="0", + nmpr_type_cd="02", + krx_nmpr_cndt_cd="0", + ord_dvsn_cd="02" + ) +print(result) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] +############################################################################################## + +result = order_rvsecncl( + env_dv="real", + day_dv="day", + ord_prcs_dvsn_cd="02", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rvse_cncl_dvsn_cd="02", + orgn_odno="0000004018", + ord_qty="0", + unit_price="0", + nmpr_type_cd="02", + krx_nmpr_cndt_cd="0", + rmn_qty_yn="Y", + ord_dvsn_cd="01" + ) +print(result) + diff --git a/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples_ws.py b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples_ws.py new file mode 100644 index 0000000..b431e73 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_examples_ws.py @@ -0,0 +1,148 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_futureoption_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간체결가[실시간-022] +############################################################################################## + +kws.subscribe(request=commodity_futures_realtime_conclusion, data=["165W09"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간호가[실시간-023] +############################################################################################## + +kws.subscribe(request=commodity_futures_realtime_quote, data=["165W09"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 선물옵션 실시간체결통보[실시간-012] +############################################################################################## + +kws.subscribe(request=fuopt_ccnl_notice, data=[trenv.my_htsid]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] +############################################################################################## + +kws.subscribe(request=futures_exp_ccnl, data=["111W07"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간체결가[실시간-010] +############################################################################################## + +kws.subscribe(request=index_futures_realtime_conclusion, data=["101W09"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간호가[실시간-011] +############################################################################################## + +kws.subscribe(request=index_futures_realtime_quote, data=["101W09"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간체결가[실시간-014] +############################################################################################## + +kws.subscribe(request=index_option_realtime_conclusion, data=["201W08427"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간호가[실시간-015] +############################################################################################## + +kws.subscribe(request=index_option_realtime_quote, data=["201W08427"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간호가 [실시간-065] +############################################################################################## + +kws.subscribe(request=krx_ngt_futures_asking_price, data=["101W09"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간종목체결 [실시간-064] +############################################################################################## + +kws.subscribe(request=krx_ngt_futures_ccnl, data=["101W9000"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간체결통보 [실시간-066] +############################################################################################## + +kws.subscribe(request=krx_ngt_futures_ccnl_notice, data=[trenv.my_htsid]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간호가 [실시간-033] +############################################################################################## + +kws.subscribe(request=krx_ngt_option_asking_price, data=["101W9000"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간체결가 [실시간-032] +############################################################################################## + +kws.subscribe(request=krx_ngt_option_ccnl, data=["101W9000"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간예상체결 [실시간-034] +############################################################################################## + +kws.subscribe(request=krx_ngt_option_exp_ccnl, data=["101W9000"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간체결통보 [실시간-067] +############################################################################################## + +kws.subscribe(request=krx_ngt_option_notice, data=[trenv.my_htsid]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간예상체결 [실시간-046] +############################################################################################## + +kws.subscribe(request=option_exp_ccnl, data=["339W08088"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간체결가 [실시간-029] +############################################################################################## + +kws.subscribe(request=stock_futures_realtime_conclusion, data=["111W08"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간호가 [실시간-030] +############################################################################################## + +kws.subscribe(request=stock_futures_realtime_quote, data=["111W08"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간호가 [실시간-045] +############################################################################################## + +kws.subscribe(request=stock_option_asking_price, data=["239W08090"]) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간체결가 [실시간-044] +############################################################################################## + +kws.subscribe(request=stock_option_ccnl, data=["339W08088"]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions.py b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions.py new file mode 100644 index 0000000..12d59d9 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions.py @@ -0,0 +1,2165 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_콜풋[국내선물-022] +############################################################################################## + +def display_board_callput( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. O: 옵션) + fid_cond_scr_div_code: str, # [필수] 조건 화면 분류 코드 (ex. 20503) + fid_mrkt_cls_code: str, # [필수] 시장 구분 코드 (ex. CO: 콜옵션) + fid_mtrt_cnt: str, # [필수] 만기 수 (ex. 202508) + fid_mrkt_cls_code1: str, # [필수] 시장 구분 코드 (ex. PO: 풋옵션) + fid_cond_mrkt_cls_code: str = "" # 조건 시장 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내옵션전광판_콜풋 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "중앙" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ output1, output2 각각 100건까지만 확인이 가능합니다. (FY25년도 서비스 개선 예정) + ※ 조회시간이 긴 API인 점 참고 부탁드리며, 잦은 호출을 삼가해주시기 바랍니다. (1초당 최대 1건 권장) + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. O: 옵션) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 20503) + fid_mrkt_cls_code (str): [필수] 시장 구분 코드 (ex. CO: 콜옵션) + fid_mtrt_cnt (str): [필수] 만기 수 (ex. 202508) + fid_mrkt_cls_code1 (str): [필수] 시장 구분 코드 (ex. PO: 풋옵션) + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 DataFrame, output2 DataFrame) + + Example: + >>> df1, df2 = display_board_callput("O", "20503", "CO", "202508", "PO") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'O')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20503')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'CO')") + + if fid_mtrt_cnt == "": + raise ValueError("fid_mtrt_cnt is required (e.g. '202508')") + + if fid_mrkt_cls_code1 == "": + raise ValueError("fid_mrkt_cls_code1 is required (e.g. 'PO')") + + tr_id = "FHPIF05030100" + + + api_url = "/uapi/domestic-futureoption/v1/quotations/display-board-callput" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_MTRT_CNT": fid_mtrt_cnt, + "FID_MRKT_CLS_CODE1": fid_mrkt_cls_code1, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output1_df = pd.DataFrame(res.getBody().output1) + output2_df = pd.DataFrame(res.getBody().output2) + return output1_df, output2_df + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_선물[국내선물-023] +############################################################################################## + +def display_board_futures( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_cond_mrkt_cls_code: str # 조건 시장 구분 코드 +) -> pd.DataFrame: + """ + 국내옵션전광판_선물 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "하단" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 20503) + fid_cond_mrkt_cls_code (str): [필수] 조건 시장 구분 코드 (ex. MKI) + + Returns: + pd.DataFrame: 국내선물옵션 선물전광판 데이터 + + Example: + >>> df = display_board_futures("F", "20503", "MKI") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20503')") + + if fid_cond_mrkt_cls_code == "": + raise ValueError("fid_cond_mrkt_cls_code is required (e.g. 'MKI')") + + tr_id = "FHPIF05030200" + + + api_url = "/uapi/domestic-futureoption/v1/quotations/display-board-futures" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내옵션전광판_옵션월물리스트[국내선물-020] +############################################################################################## + +def display_board_option_list( + fid_cond_scr_div_code: str, + fid_cond_mrkt_div_code: str = "", + fid_cond_mrkt_cls_code: str = "" +) -> pd.DataFrame: + """ + 국내옵션전광판_옵션월물리스트 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "월물리스트 목록 확인" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 509) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + pd.DataFrame: 국내옵션전광판_옵션월물리스트 데이터 + + Example: + >>> df = display_board_option_list(fid_cond_scr_div_code="509") + >>> print(df) + """ + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '509')") + + tr_id = "FHPIO056104C0" + + + api_url = "/uapi/domestic-futureoption/v1/quotations/display-board-option-list" + + + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 국내선물 기초자산 시세[국내선물-021] +############################################################################################## + +def display_board_top( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. F) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code1: str = "", # 조건 시장 분류 코드 + fid_cond_scr_div_code: str = "", # 조건 화면 분류 코드 + fid_mtrt_cnt: str = "", # 만기 수 + fid_cond_mrkt_cls_code: str = "" # 조건 시장 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내선물 기초자산 시세 API입니다. + 한국투자 HTS(eFriend Plus) > [0503] 선물옵션 종합시세(Ⅰ) 화면의 "상단 바" 기능을 API로 개발한 사항입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code1 (str): 조건 시장 분류 코드 + fid_cond_scr_div_code (str): 조건 화면 분류 코드 + fid_mtrt_cnt (str): 만기 수 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> output1, output2 = display_board_top(fid_cond_mrkt_div_code="F", fid_input_iscd="101W09") + >>> print(output1) + >>> print(output2) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101V06')") + + tr_id = "FHPIF05030000" + + + api_url = "/uapi/domestic-futureoption/v1/quotations/display-board-top" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE1": fid_cond_mrkt_div_code1, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MTRT_CNT": fid_mtrt_cnt, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output1 = pd.DataFrame(res.getBody().output1, index=[0]) + output2 = pd.DataFrame(res.getBody().output2) + + return output1, output2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 일중예상체결추이[국내선물-018] +############################################################################################## + +def exp_price_trend( + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code: str # [필수] 조건 시장 분류 코드 (ex. F) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 일중예상체결추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0548] 선물옵션 예상체결추이 화면의 기능을 API로 개발한 사항입니다. + + Args: + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 101V06) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. F) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = exp_price_trend(fid_input_iscd="101W09", fid_cond_mrkt_div_code="F") + >>> print(df1) + >>> print(df2) + """ + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101V06')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F')") + + tr_id = "FHPIF05110100" # 선물옵션 일중예상체결추이 + + + api_url = "/uapi/domestic-futureoption/v1/quotations/exp-price-trend" + + + + params = { + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code # 조건 시장 분류 코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1은 object 타입이므로 단일 행 DataFrame + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2는 array 타입이므로 여러 행 DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세호가[v1_국내선물-007] +############################################################################################## + +def inquire_asking_price( + fid_cond_mrkt_div_code: str, # [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, JF: 주식선물) + fid_input_iscd: str, # [필수] FID 입력 종목코드 (ex. 101W09) + env_dv: str # [필수] 실전모의구분 (ex. real:실전, demo:모의) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 시세호가 API입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, JF: 주식선물) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101W09) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_asking_price("F", "101W09", "real") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F', 'JF')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHMIF10010000" + elif env_dv == "demo": + tr_id = "FHMIF10010000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + + api_url = "/uapi/domestic-futureoption/v1/quotations/inquire-asking-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (object) -> DataFrame + output2_data = pd.DataFrame([res.getBody().output2]) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고현황[v1_국내선물-004] +############################################################################################## + +def inquire_balance( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + mgna_dvsn: str, # [필수] 증거금 구분 (ex. 01:게시,02:유지) + excc_stat_cd: str, # [필수] 정산상태코드 (ex. 1:정산,2:본정산) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 잔고현황 API입니다. 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + mgna_dvsn (str): [필수] 증거금 구분 (ex. 01:게시,02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산,2:본정산) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀 깊이 (자동 관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 선물옵션 잔고현황 데이터 + + Example: + >>> df1, df2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", excc_stat_cd="1") + >>> print(df1) + >>> print(df2) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01' or '02')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1' or '2')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "CTFO6118R" + elif env_dv == "demo": + tr_id = "VTFO6118R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-balance" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance( + env_dv, cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고정산손익내역[v1_국내선물-013] +############################################################################################## + +def inquire_balance_settlement_pl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 (ex. 03) + inqr_dt: str, # 조회일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 잔고정산손익내역 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + inqr_dt (str): [필수] 조회일자 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_balance_settlement_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dt="20230906") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_dt == "": + raise ValueError("inqr_dt is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6117R" + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-balance-settlement-pl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_DT": inqr_dt, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_settlement_pl( + cano, acnt_prdt_cd, inqr_dt, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 잔고평가손익내역[v1_국내선물-015] +############################################################################################## + +def inquire_balance_valuation_pl( + cano: str, # [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn: str, # [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd: str, # [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + FK200: str = "", # 연속조회검색조건200 (ex. 연속조회검색조건200) + NK200: str = "", # 연속조회키200 (ex. 연속조회키200) + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 시장별 투자자매매동향(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0404] 시장별 일별동향 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn (str): [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + FK200 (str): 연속조회검색조건200 (ex. 연속조회검색조건200) + NK200 (str): 연속조회키200 (ex. 연속조회키200) + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_balance_valuation_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn="01", excc_stat_cd="1") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01:개시, 02:유지')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1:정산, 2:본정산')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6159R" # 선물옵션 잔고평가손익내역 + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-balance-valuation-pl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_valuation_pl( + cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, + max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문체결내역조회[v1_국내선물-003] +############################################################################################## + +def inquire_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + strt_ord_dt: str, # [필수] 시작주문일자 (ex. 주문내역 조회 시작 일자, YYYYMMDD) + end_ord_dt: str, # [필수] 종료주문일자 (ex. 주문내역 조회 마지막 일자, YYYYMMDD) + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (ex. 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn: str, # [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn: str, # [필수] 정렬순서 (ex. AS:정순, DS:역순) + pdno: str = "", # 상품번호 + strt_odno: str = "", # 시작주문번호 + mket_id_cd: str = "", # 시장ID코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 주문체결내역조회 API입니다. 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + strt_ord_dt (str): [필수] 시작주문일자 (ex. 주문내역 조회 시작 일자, YYYYMMDD) + end_ord_dt (str): [필수] 종료주문일자 (ex. 주문내역 조회 마지막 일자, YYYYMMDD) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn (str): [필수] 정렬순서 (ex. AS:정순, DS:역순) + pdno (str, optional): 상품번호. Defaults to "". + strt_odno (str, optional): 시작주문번호. Defaults to "". + mket_id_cd (str, optional): 시장ID코드. Defaults to "". + FK200 (str, optional): 연속조회검색조건200. Defaults to "". + NK200 (str, optional): 연속조회키200. Defaults to "". + tr_cont (str, optional): 연속거래여부. Defaults to "". + dataframe1 (Optional[pd.DataFrame], optional): 누적 데이터프레임1. Defaults to None. + dataframe2 (Optional[pd.DataFrame], optional): 누적 데이터프레임2. Defaults to None. + depth (int, optional): 내부 재귀깊이 (자동관리). Defaults to 0. + max_depth (int, optional): 최대 재귀 횟수 제한. Defaults to 10. + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주문체결내역 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_ccnl(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20220730", end_ord_dt="20220830", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00", sort_sqn="DS") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if not env_dv: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if not cano: + raise ValueError("cano is required") + + if not acnt_prdt_cd: + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if not strt_ord_dt: + raise ValueError("strt_ord_dt is required (e.g. '20220730')") + + if not end_ord_dt: + raise ValueError("end_ord_dt is required (e.g. '20220830')") + + if not sll_buy_dvsn_cd: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00')") + + if not ccld_nccs_dvsn: + raise ValueError("ccld_nccs_dvsn is required (e.g. '00')") + + if not sort_sqn: + raise ValueError("sort_sqn is required (e.g. 'AS' or 'DS')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTO5201R" + elif env_dv == "demo": + tr_id = "VTTO5201R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + # 파라미터 설정 + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-ccnl" + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_ORD_DT": strt_ord_dt, + "END_ORD_DT": end_ord_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SORT_SQN": sort_sqn, + "PDNO": pdno, + "STRT_ODNO": strt_odno, + "MKET_ID_CD": mket_id_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 (단일 객체) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # 연속조회 정보 업데이트 + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ccnl( + env_dv, cano, acnt_prdt_cd, strt_ord_dt, end_ord_dt, + sll_buy_dvsn_cd, ccld_nccs_dvsn, sort_sqn, pdno, strt_odno, + mket_id_cd, FK200, NK200, "N", dataframe1, dataframe2, + depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 기준일체결내역[v1_국내선물-016] +############################################################################################## + +def inquire_ccnl_bstime( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + ord_dt: str, # [필수] 주문일자 (ex. 20250101) + fuop_tr_strt_tmd: str, # [필수] 선물옵션거래시작시각 (ex. HHMMSS) + fuop_tr_end_tmd: str, # [필수] 선물옵션거래종료시각 (ex. HHMMSS) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 기준일체결내역 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + ord_dt (str): [필수] 주문일자 (ex. 20250101) + fuop_tr_strt_tmd (str): [필수] 선물옵션거래시작시각 (ex. HHMMSS) + fuop_tr_end_tmd (str): [필수] 선물옵션거래종료시각 (ex. HHMMSS) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션 기준일체결내역 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_ccnl_bstime(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ord_dt="20230920", fuop_tr_strt_tmd="000000", fuop_tr_end_tmd="240000") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if ord_dt == "": + raise ValueError("ord_dt is required (e.g. '20250101')") + + if fuop_tr_strt_tmd == "": + raise ValueError("fuop_tr_strt_tmd is required (e.g. 'HHMMSS')") + + if fuop_tr_end_tmd == "": + raise ValueError("fuop_tr_end_tmd is required (e.g. 'HHMMSS')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO5139R" + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-ccnl-bstime" + + + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ORD_DT": ord_dt, # 주문일자 + "FUOP_TR_STRT_TMD": fuop_tr_strt_tmd, # 선물옵션거래시작시각 + "FUOP_TR_END_TMD": fuop_tr_end_tmd, # 선물옵션거래종료시각 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ccnl_bstime( + cano, acnt_prdt_cd, ord_dt, fuop_tr_strt_tmd, fuop_tr_end_tmd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션기간약정수수료일별[v1_국내선물-017] +############################################################################################## + +def inquire_daily_amount_fee( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + inqr_strt_day: str, # [필수] 조회시작일 (ex. 20240401) + inqr_end_day: str, # [필수] 조회종료일 (ex. 20240625) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션기간약정수수료일별 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + inqr_strt_day (str): [필수] 조회시작일 (ex. 20240401) + inqr_end_day (str): [필수] 조회종료일 (ex. 20240625) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션기간약정수수료일별 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_daily_amount_fee(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_day="20240401", inqr_end_day="20240625") + >>> print(df1) + >>> print(df2) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_day == "": + raise ValueError("inqr_strt_day is required") + + if inqr_end_day == "": + raise ValueError("inqr_end_day is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTFO6119R" # 선물옵션기간약정수수료일별 + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-daily-amount-fee" + + + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_STRT_DAY": inqr_strt_day, # 조회시작일 + "INQR_END_DAY": inqr_end_day, # 조회종료일 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_daily_amount_fee( + cano, acnt_prdt_cd, inqr_strt_day, inqr_end_day, FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션기간별시세(일/주/월/년)[v1_국내선물-008] +############################################################################################## + +def inquire_daily_fuopchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # 종목코드 + fid_input_date_1: str, # 조회 시작일자 + fid_input_date_2: str, # 조회 종료일자 + fid_period_div_code: str, # 기간분류코드 + env_dv: str # 실전모의구분 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (지수)선물옵션 기간별시세 데이터(일/주/월/년) 조회 (최대 100건 조회) + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] 종목코드 (ex. 101W09) + fid_input_date_1 (str): [필수] 조회 시작일자 (ex. 20250301) + fid_input_date_2 (str): [필수] 조회 종료일자 (ex. 20250810) + fid_period_div_code (str): [필수] 기간분류코드 (ex. D: 일봉, W: 주봉) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (기본정보, 차트데이터) 튜플 + + Example: + >>> output1, output2 = inquire_daily_fuopchartprice( + ... fid_cond_mrkt_div_code="F", + ... fid_input_iscd="101W09", + ... fid_input_date_1="20250301", + ... fid_input_date_2="20250810", + ... fid_period_div_code="D", + ... env_dv="real" + ... ) + >>> print(output1) + >>> print(output2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F: 지수선물, O: 지수옵션')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20250301')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20250810')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D: 일봉, W: 주봉')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKIF03020100" + elif env_dv == "demo": + tr_id = "FHKIF03020100" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + + api_url = "/uapi/domestic-futureoption/v1/quotations/inquire-daily-fuopchartprice" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1: object -> DataFrame (1행) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2: array -> DataFrame (여러행) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 총자산현황[v1_국내선물-014] +############################################################################################## + +def inquire_deposit( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str # [필수] 계좌상품코드 (ex. 03) +) -> pd.DataFrame: + """ + 선물옵션 총자산현황 API 입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + + Returns: + pd.DataFrame: 선물옵션 총자산현황 데이터 + + Example: + >>> df = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + tr_id = "CTRP6550R" # 선물옵션 총자산현황 + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-deposit" + + + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd # 계좌상품코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +############################################################################################## + +def inquire_ngt_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + mgna_dvsn: str, # 증거금구분 + excc_stat_cd: str, # 정산상태코드 + acnt_pwd: str = "", # 계좌비밀번호 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 잔고현황 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + mgna_dvsn (str): [필수] 증거금구분 (ex. 01:개시, 02:유지) + excc_stat_cd (str): [필수] 정산상태코드 (ex. 1:정산, 2:본정산) + acnt_pwd (str): 계좌비밀번호 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_ngt_balance("12345678", "01", "01", "1") + >>> print(df1, df2) + """ + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if mgna_dvsn == "": + raise ValueError("mgna_dvsn is required (e.g. '01:개시, 02:유지')") + + if excc_stat_cd == "": + raise ValueError("excc_stat_cd is required (e.g. '1:정산, 2:본정산')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame() + ) + + tr_id = "CTFN6118R" + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN": mgna_dvsn, + "EXCC_STAT_CD": excc_stat_cd, + "ACNT_PWD": acnt_pwd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ngt_balance( + cano, acnt_prdt_cd, mgna_dvsn, excc_stat_cd, acnt_pwd, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return (dataframe1, dataframe2) + else: + res.printError(url=api_url) + return (pd.DataFrame(), pd.DataFrame()) + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] +############################################################################################## + +def inquire_ngt_ccnl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_ord_dt: str, # 시작주문일자 + end_ord_dt: str, # 종료주문일자 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sort_sqn: str = "", # 정렬순서 + strt_odno: str = "", # 시작주문번호 + pdno: str = "", # 상품번호 + mket_id_cd: str = "", # 시장ID코드 + fuop_dvsn_cd: str = "", # 선물옵션구분코드 + scrn_dvsn: str = "", # 화면구분 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 주문체결 내역조회 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + strt_ord_dt (str): [필수] 시작주문일자 + end_ord_dt (str): [필수] 종료주문일자 (ex. 조회하려는 마지막 일자 다음일자로 조회 (ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정)) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 공란:default, 00:전체, 01:매도, 02:매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. 00:전체, 01:체결, 02:미체결) + sort_sqn (str): 정렬순서 (ex. 공란:default(DS:정순, 그외:역순)) + strt_odno (str): 시작주문번호 (ex. 공란:default) + pdno (str): 상품번호 (ex. 공란:default) + mket_id_cd (str): 시장ID코드 (ex. 공란:default) + fuop_dvsn_cd (str): 선물옵션구분코드 (ex. 공란:전체, 01:선물, 02:옵션) + scrn_dvsn (str): 화면구분 (ex. 02(Default)) + FK200 (str): 연속조회검색조건200 (ex. 공란:최초 조회시, 이전 조회 Output CTX_AREA_FK200값:다음페이지 조회시(2번째부터)) + NK200 (str): 연속조회키200 (ex. 공란:최초 조회시, 이전 조회 Output CTX_AREA_NK200값:다음페이지 조회시(2번째부터)) + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_ngt_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_ord_dt="20231201", end_ord_dt="20231214", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if strt_ord_dt == "" or strt_ord_dt is None: + raise ValueError("strt_ord_dt is required") + + if end_ord_dt == "" or end_ord_dt is None: + raise ValueError("end_ord_dt is required (e.g. '조회하려는 마지막 일자 다음일자로 조회 (ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정)')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '공란:default, 00:전체, 01:매도, 02:매수')") + + if ccld_nccs_dvsn == "" or ccld_nccs_dvsn is None: + raise ValueError("ccld_nccs_dvsn is required (e.g. '00:전체, 01:체결, 02:미체결')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "STTN5201R" + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_ORD_DT": strt_ord_dt, + "END_ORD_DT": end_ord_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SORT_SQN": sort_sqn, + "STRT_ODNO": strt_odno, + "PDNO": pdno, + "MKET_ID_CD": mket_id_cd, + "FUOP_DVSN_CD": fuop_dvsn_cd, + "SCRN_DVSN": scrn_dvsn, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + print(res.getBody()) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_ngt_ccnl( + cano, acnt_prdt_cd, strt_ord_dt, end_ord_dt, sll_buy_dvsn_cd, ccld_nccs_dvsn, + sort_sqn, strt_odno, pdno, mket_id_cd, fuop_dvsn_cd, scrn_dvsn, + FK200, NK200, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 시세[v1_국내선물-006] +############################################################################################## + +def inquire_price( + fid_cond_mrkt_div_code: str, # [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd: str, # [필수] FID 입력 종목코드 (ex. 101W09) + env_dv: str # [필수] 실전모의구분 (ex. real:실전, demo:모의) +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 시세 API입니다. + + ※ 종목코드 마스터파일 정제코드는 한국투자증권 Github 참고: + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101W09) + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 선물옵션 시세 데이터 (output1, output2, output3) + + Example: + >>> result1, result2, result3 = inquire_price( + ... fid_cond_mrkt_div_code="F", + ... fid_input_iscd="101W09", + ... env_dv="real" + ... ) + >>> print(result1) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F', 'O')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101W09')") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHMIF10000000" + elif env_dv == "demo": + tr_id = "FHMIF10000000" + else: + raise ValueError("env_dv can only be real or demo") + + + api_url = "/uapi/domestic-futureoption/v1/quotations/inquire-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 처리 + output1 = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 처리 + output2 = pd.DataFrame(res.getBody().output2, index=[0]) + + # output3 처리 + output3 = pd.DataFrame(res.getBody().output3, index=[0]) + + return output1, output2, output3 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +############################################################################################## + +def inquire_psbl_ngt_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + unit_price: str, # 주문가격1 + ord_dvsn_cd: str # 주문구분코드 +) -> pd.DataFrame: + """ + (야간)선물옵션 주문가능 조회 API입니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + pdno (str): [필수] 상품번호 + prdt_type_cd (str): [필수] 상품유형코드 (ex. 301:선물옵션) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도, 02:매수) + unit_price (str): [필수] 주문가격1 + ord_dvsn_cd (str): [필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK)) + + Returns: + pd.DataFrame: (야간)선물옵션 주문가능 데이터 + + Example: + >>> df = inquire_psbl_ngt_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="101W09", prdt_type_cd="301", sll_buy_dvsn_cd="02", unit_price="322", ord_dvsn_cd="01") + >>> print(df) + """ + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required") + + if prdt_type_cd == "" or prdt_type_cd is None: + raise ValueError("prdt_type_cd is required (e.g. '301')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01', '02')") + + if unit_price == "" or unit_price is None: + raise ValueError("unit_price is required") + + if ord_dvsn_cd == "" or ord_dvsn_cd is None: + raise ValueError("ord_dvsn_cd is required (e.g. '01', '02', '03', '04', '10', '11', '12', '13', '14', '15')") + + tr_id = "STTN5105R" + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-psbl-ngt-order" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "UNIT_PRICE": unit_price, + "ORD_DVSN_CD": ord_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문가능[v1_국내선물-005] +############################################################################################## + +def inquire_psbl_order( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 03) + pdno: str, # [필수] 상품번호 (ex. 선물 6자리, 옵션 9자리) + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (ex. 01:매도,02:매수) + unit_price: str, # [필수] 주문가격1 + ord_dvsn_cd: str # [필수] 주문구분코드 +) -> pd.DataFrame: + """ + 선물옵션 주문가능 API입니다. 주문가능 내역과 수량을 확인하실 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + pdno (str): [필수] 상품번호 (ex. 선물 6자리, 옵션 9자리) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도,02:매수) + unit_price (str): [필수] 주문가격1 + ord_dvsn_cd (str): [필수] 주문구분코드 + + Returns: + pd.DataFrame: 선물옵션 주문가능 데이터 + + Example: + >>> df = inquire_psbl_order(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... pdno="101W09", sll_buy_dvsn_cd="02", unit_price="1", ord_dvsn_cd="01") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '101W09')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01' or '02')") + + if unit_price == "": + raise ValueError("unit_price is required") + + if ord_dvsn_cd == "": + raise ValueError("ord_dvsn_cd is required") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTO5105R" + elif env_dv == "demo": + tr_id = "VTTO5105R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + + api_url = "/uapi/domestic-futureoption/v1/trading/inquire-psbl-order" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "UNIT_PRICE": unit_price, + "ORD_DVSN_CD": ord_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 기본시세 > 선물옵션 분봉조회[v1_국내선물-012] +############################################################################################## + +def inquire_time_fuopchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 (F: 지수선물, O: 지수옵션) + fid_input_iscd: str, # FID 입력 종목코드 (101T12) + fid_hour_cls_code: str, # FID 시간 구분 코드 (30: 30초, 60: 1분) + fid_pw_data_incu_yn: str, # FID 과거 데이터 포함 여부 (Y:과거, N: 당일) + fid_fake_tick_incu_yn: str, # FID 허봉 포함 여부 (N) + fid_input_date_1: str, # FID 입력 날짜1 (20230901) + fid_input_hour_1: str # FID 입력 시간1 (100000) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 선물옵션 분봉조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 102건까지 확인 가능하며, + FID_INPUT_DATE_1(입력날짜), FID_INPUT_HOUR_1(입력시간)을 이용하여 다음 조회 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (ex. F: 지수선물, O: 지수옵션) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 101T12) + fid_hour_cls_code (str): [필수] FID 시간 구분 코드 (ex. 30: 30초, 60: 1분) + fid_pw_data_incu_yn (str): [필수] FID 과거 데이터 포함 여부 (ex. Y:과거, N: 당일) + fid_fake_tick_incu_yn (str): [필수] FID 허봉 포함 여부 (ex. N) + fid_input_date_1 (str): [필수] FID 입력 날짜1 (ex. 20230901) + fid_input_hour_1 (str): [필수] FID 입력 시간1 (ex. 100000) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 선물옵션 분봉 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_time_fuopchartprice("F", "101T12", "60", "Y", "N", "20230901", "100000") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'F: 지수선물, O: 지수옵션')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '101T12')") + + if fid_hour_cls_code == "": + raise ValueError("fid_hour_cls_code is required (e.g. '30: 30초, 60: 1분')") + + if fid_pw_data_incu_yn == "": + raise ValueError("fid_pw_data_incu_yn is required (e.g. 'Y:과거, N: 당일')") + + if fid_fake_tick_incu_yn == "": + raise ValueError("fid_fake_tick_incu_yn is required (e.g. 'N')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20230901')") + + if fid_input_hour_1 == "": + raise ValueError("fid_input_hour_1 is required (e.g. '100000')") + + tr_id = "FHKIF03020200" # 선물옵션 분봉조회 + + + api_url = "/uapi/domestic-futureoption/v1/quotations/inquire-time-fuopchartprice" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_FAKE_TICK_INCU_YN": fid_fake_tick_incu_yn, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1: object array -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2: array -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 증거금 상세 [국내선물-024] +############################################################################################## + +def ngt_margin_detail( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + mgna_dvsn_cd: str # 증거금 구분코드 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + (야간)선물옵션 증거금상세 API입니다. + 한국투자 HTS(eFriend Force) > [2537] 야간선물옵션 증거금상세 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 03) + mgna_dvsn_cd (str): [필수] 증거금 구분코드 (ex. 01:위탁, 02:유지) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: (output1, output2, output3) 데이터프레임 + + Example: + >>> df1, df2, df3 = ngt_margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, mgna_dvsn_cd="01") + >>> print(df1) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '03')") + + if mgna_dvsn_cd == "": + raise ValueError("mgna_dvsn_cd is required (e.g. '01:위탁, 02:유지')") + + tr_id = "CTFN7107R" # (야간)선물옵션 증거금 상세 + + + api_url = "/uapi/domestic-futureoption/v1/trading/ngt-margin-detail" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "MGNA_DVSN_CD": mgna_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame(res.getBody().output1) + output2_data = pd.DataFrame(res.getBody().output2) + output3_data = pd.DataFrame([res.getBody().output3]) + + return output1_data, output2_data, output3_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] +############################################################################################## + +def order( + env_dv: str, # 실전모의구분 + ord_dv: str, # 매도매수구분 + ord_prcs_dvsn_cd: str, # 주문처리구분코드 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + shtn_pdno: str, # 단축상품번호 + ord_qty: str, # 주문수량 + unit_price: str, # 주문가격1 + nmpr_type_cd: str, # 호가유형코드 + krx_nmpr_cndt_cd: str, # 한국거래소호가조건코드 + ord_dvsn_cd: str, # 주문구분코드 + ctac_tlno: str = "", # 연락전화번호 + fuop_item_dvsn_cd: str = "" # 선물옵션종목구분코드 +) -> pd.DataFrame: + """ + [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] + 선물옵션 주문 API입니다. + * 선물옵션 운영시간 외 API 호출 시 애러가 발생하오니 운영시간을 확인해주세요. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd (str): [필수] 주문처리구분코드 (ex. 02:주문전송) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 01:매도, 02:매수) + shtn_pdno (str): [필수] 단축상품번호 (ex. 종목번호, 선물 6자리 (예: 101W09), 옵션 9자리 (예: 201S03370)) + ord_qty (str): [필수] 주문수량 + unit_price (str): [필수] 주문가격1 (ex. 시장가나 최유리 지정가인 경우 0으로 입력) + nmpr_type_cd (str): [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd (str): [필수] 한국거래소호가조건코드 (ex. 0:없음, 3:IOC, 4:FOK) + ord_dvsn_cd (str): [필수] 주문구분코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리, 10:지정가(IOC), 11:지정가(FOK), 12:시장가(IOC), 13:시장가(FOK), 14:최유리(IOC), 15:최유리(FOK)) + ctac_tlno (str): 연락전화번호 (ex. 고객의 연락 가능한 전화번호) + fuop_item_dvsn_cd (str): 선물옵션종목구분코드 (ex. 공란(Default)) + + Returns: + pd.DataFrame: 선물옵션 주문 결과 데이터 + + Example: + >>> df = order(env_dv="real", ord_dv="day", ord_prcs_dvsn_cd="02", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, sll_buy_dvsn_cd="02", shtn_pdno="101W09", ord_qty="1", unit_price="0", nmpr_type_cd="02", krx_nmpr_cndt_cd="0", ord_dvsn_cd="02") + >>> print(df) + """ + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + if ord_dv == "": + raise ValueError("ord_dv is required (e.g. 'day', 'night')") + + if ord_prcs_dvsn_cd == "": + raise ValueError("ord_prcs_dvsn_cd is required (e.g. '02')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01', '02')") + + if shtn_pdno == "": + raise ValueError("shtn_pdno is required (e.g. '101W09', '201S03370')") + + if ord_qty == "": + raise ValueError("ord_qty is required") + + if unit_price == "": + raise ValueError("unit_price is required (e.g. '0')") + + if nmpr_type_cd == "": + raise ValueError("nmpr_type_cd is required (e.g. '01', '02', '03', '04')") + + if krx_nmpr_cndt_cd == "": + raise ValueError("krx_nmpr_cndt_cd is required (e.g. '0', '3', '4')") + + if ord_dvsn_cd == "": + raise ValueError("ord_dvsn_cd is required (e.g. '01', '02', '03', '04', '10', '11', '12', '13', '14', '15')") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "day": + tr_id = "TTTO1101U" + elif ord_dv == "night": + tr_id = "STTN1101U" + else: + raise ValueError("ord_dv can only be 'day' or 'night'") + elif env_dv == "demo": + if ord_dv == "day": + tr_id = "VTTO1101U" + else: + raise ValueError("ord_dv can only be 'day' for demo environment") + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + + api_url = "/uapi/domestic-futureoption/v1/trading/order" + + + + params = { + "ORD_PRCS_DVSN_CD": ord_prcs_dvsn_cd, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "SHTN_PDNO": shtn_pdno, + "ORD_QTY": ord_qty, + "UNIT_PRICE": unit_price, + "NMPR_TYPE_CD": nmpr_type_cd, + "KRX_NMPR_CNDT_CD": krx_nmpr_cndt_cd, + "ORD_DVSN_CD": ord_dvsn_cd, + "CTAC_TLNO": ctac_tlno, + "FUOP_ITEM_DVSN_CD": fuop_item_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] +############################################################################################## + +def order_rvsecncl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + day_dv: str, # [필수] 주야간구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd: str, # [필수] 주문처리구분코드 (ex. 02) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + rvse_cncl_dvsn_cd: str, # [필수] 정정취소구분코드 (ex. 01:정정, 02:취소) + orgn_odno: str, # [필수] 원주문번호 + ord_qty: str, # [필수] 주문수량 (ex. 0:전량, 그 외는 수량) + unit_price: str, # [필수] 주문가격1 (ex 0:시장가/최유리, 그 외 가격) + nmpr_type_cd: str, # [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd: str, # [필수] 한국거래소호가조건코드 (ex. 0:취소/없음, 3:IOC, 4:FOK) + rmn_qty_yn: str, # [필수] 잔여수량여부 (ex. Y:전량, N:일부) + ord_dvsn_cd: str, # [필수] 주문구분코드 + fuop_item_dvsn_cd: str = "" # 선물옵션종목구분코드 +) -> pd.DataFrame: + """ + 선물옵션 주문 건에 대하여 정정 및 취소하는 API입니다. 단, 이미 체결된 건은 정정 및 취소가 불가합니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + day_dv (str): [필수] 주야간구분 (ex. day:주간, night:야간) + ord_prcs_dvsn_cd (str): [필수] 주문처리구분코드 (ex. 02) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + rvse_cncl_dvsn_cd (str): [필수] 정정취소구분코드 (ex. 01:정정, 02:취소) + orgn_odno (str): [필수] 원주문번호 + ord_qty (str): [필수] 주문수량 (ex. 0:전량, 그 외는 수량) + unit_price (str): [필수] 주문가격1 (ex 0:시장가/최유리, 그 외 가격) + nmpr_type_cd (str): [필수] 호가유형코드 (ex. 01:지정가, 02:시장가, 03:조건부, 04:최유리) + krx_nmpr_cndt_cd (str): [필수] 한국거래소호가조건코드 (ex. 0:취소/없음, 3:IOC, 4:FOK) + rmn_qty_yn (str): [필수] 잔여수량여부 (ex. Y:전량, N:일부) + ord_dvsn_cd (str): [필수] 주문구분코드 + fuop_item_dvsn_cd (str): 선물옵션종목구분코드 + + Returns: + pd.DataFrame: 선물옵션 정정취소주문 결과 데이터 + + Example: + >>> df = order_rvsecncl( + ... env_dv="real", day_dv="day", ord_prcs_dvsn_cd="02", + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rvse_cncl_dvsn_cd="02", + ... orgn_odno="0000004018", ord_qty="0", unit_price="0", + ... nmpr_type_cd="02", krx_nmpr_cndt_cd="0", rmn_qty_yn="Y", + ... ord_dvsn_cd="01" + ... ) + >>> print(df) + """ + + # tr_id 설정 + if env_dv == "real": + if day_dv == "day": + tr_id = "TTTO1103U" + elif day_dv == "night": + tr_id = "TTTN1103U" + else: + raise ValueError("day_dv can only be 'day' or 'night'") + elif env_dv == "demo": + if day_dv == "day": + tr_id = "VTTO1103U" + else: + raise ValueError("day_dv can only be 'day' for demo environment") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + + api_url = "/uapi/domestic-futureoption/v1/trading/order-rvsecncl" + + + + params = { + "ORD_PRCS_DVSN_CD": ord_prcs_dvsn_cd, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORGN_ODNO": orgn_odno, + "ORD_QTY": ord_qty, + "UNIT_PRICE": unit_price, + "NMPR_TYPE_CD": nmpr_type_cd, + "KRX_NMPR_CNDT_CD": krx_nmpr_cndt_cd, + "RMN_QTY_YN": rmn_qty_yn, + "ORD_DVSN_CD": ord_dvsn_cd, + "FUOP_ITEM_DVSN_CD": fuop_item_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions_ws.py b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions_ws.py new file mode 100644 index 0000000..d490100 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_futureoption/domestic_futureoption_functions_ws.py @@ -0,0 +1,1710 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간체결가[실시간-022] +############################################################################################## + +def commodity_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 상품선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 상품선물의 실시간 체결가 정보를 수신할 수 있습니다. + 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = commodity_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is empty") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0CFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dscs_bltr_acml_qty", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 상품선물 실시간호가[실시간-023] +############################################################################################## + +def commodity_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 상품선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 상품선물 매도/매수 호가 정보를 실시간으로 수신할 수 있습니다. + 실전계좌만 지원되며, 모의투자는 지원하지 않습니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = commodity_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0CFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 선물옵션 실시간체결통보[실시간-012] +############################################################################################## + +def fuopt_ccnl_notice( + tr_type: str, + tr_key: str, +): + """ + 선물옵션 실시간체결통보 API입니다. + 실시간 웹소켓 연결을 통해 선물옵션 거래의 실시간 체결 통보를 수신할 수 있습니다. + 주문접수, 체결, 정정, 취소 등의 거래 상태 변화를 실시간으로 통보받을 수 있습니다. + 고객ID, 계좌번호, 주문번호, 체결수량, 체결단가 등의 상세 거래 정보를 포함합니다. + 실전계좌와 모의투자 모두 지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. dttest11) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = fuopt_ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond", + "ord_grp", + "ord_grpseq", + "order_prc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] +############################################################################################## + +def futures_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 > 주식선물 실시간예상체결 [실시간-031] + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = futures_exp_ccnl("1", "111W07") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code", + "antc_cnqn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간체결가[실시간-010] +############################################################################################## + +def index_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 지수선물의 실시간 체결가 정보를 수신할 수 있습니다. + 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dscs_bltr_acml_qty", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수선물 실시간호가[실시간-011] +############################################################################################## + +def index_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 지수선물의 실시간 호가 정보를 수신할 수 있습니다. + 매도/매수 호가 1~5단계, 호가 건수, 호가 잔량 등의 상세 정보를 제공합니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간체결가[실시간-014] +############################################################################################## + +def index_option_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수옵션 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 지수옵션의 실시간 체결가 정보를 수신할 수 있습니다. + 옵션 현재가, 시고저가, 체결량, 누적거래량, 이론가 등의 기본 정보와 함께 + 델타, 감마, 베가, 세타, 로우 등의 그리스 지표와 내재가치, 시간가치, 변동성 정보를 제공합니다. + 옵션 거래에 필수적인 전문 지표들을 포함하는 확장된 체결가 정보입니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 201S11305) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_option_realtime_conclusion("1", "101W09") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IOCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "avrg_vltl", + "dscs_lrqn_vol", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 지수옵션 실시간호가[실시간-015] +############################################################################################## + +def index_option_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 지수옵션 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 지수옵션 매도/매수 호가 정보를 실시간으로 수신할 수 있습니다. + 실전계좌만 지원되며, 모의투자는 지원하지 않습니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 코드 (ex. 201S11305) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = index_option_realtime_quote("1", "201S11305") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0IOASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간호가 [실시간-065] +############################################################################################## + +def krx_ngt_futures_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + ※ 선물옵션 호가 데이터는 0.2초 필터링 옵션이 있습니다. + 필터링 사유는 순간적으로 데이터가 폭증할 경우 서버 뿐만아니라 클라이언트 환경에도 부하를 줄 수 있어 적용된 사항인 점 양해 부탁드립니다. + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_asking_price("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_askp1", + "futs_askp2", + "futs_askp3", + "futs_askp4", + "futs_askp5", + "futs_bidp1", + "futs_bidp2", + "futs_bidp3", + "futs_bidp4", + "futs_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간종목체결 [실시간-064] +############################################################################################## + +def krx_ngt_futures_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "futs_prdy_vrss", + "prdy_vrss_sign", + "futs_prdy_ctrt", + "futs_prpr", + "futs_oprc", + "futs_hgpr", + "futs_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "futs_askp1", + "futs_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간선물 실시간체결통보 [실시간-066] +############################################################################################## + +def krx_ngt_futures_ccnl_notice( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_futures_ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0MFCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간호가 [실시간-033] +############################################################################################## + +def krx_ngt_option_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_asking_price("1", "101W09") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션 실시간체결가 [실시간-032] +############################################################################################## + +def krx_ngt_option_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (str): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_prc_limt_yn", + "dynm_llam" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간예상체결 [실시간-034] +############################################################################################## + +def krx_ngt_option_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 + KRX야간옵션실시간예상체결 [실시간-034] + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_exp_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code", + "antc_cnqn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > KRX야간옵션실시간체결통보 [실시간-067] +############################################################################################## + +def krx_ngt_option_notice( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 고객 ID + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = krx_ngt_option_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0EUCNI0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "cust_id", + "acnt_no", + "oder_no", + "ooder_no", + "seln_byov_cls", + "rctf_cls", + "oder_kind2", + "stck_shrn_iscd", + "cntg_qty", + "cntg_unpr", + "stck_cntg_hour", + "rfus_yn", + "cntg_yn", + "acpt_yn", + "brnc_no", + "oder_qty", + "acnt_name", + "cntg_isnm", + "oder_cond" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간예상체결 [실시간-046] +############################################################################################## + +def option_exp_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + [국내선물옵션] 실시간시세 + 주식옵션 실시간예상체결 [실시간-046] + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = option_exp_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOANC0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "antc_cnpr", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "antc_mkop_cls_code" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간체결가 [실시간-029] +############################################################################################## + +def stock_futures_realtime_conclusion( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식선물 실시간체결가 API입니다. + 실시간 웹소켓 연결을 통해 주식선물의 실시간 체결가 정보를 수신할 수 있습니다. + 주식 현재가, 시고저가, 체결량, 누적거래량, 이론가, 베이시스, 괴리율 등의 상세 정보를 제공합니다. + 매도/매수 호가, 체결 건수, 미결제 약정 수량 등의 선물거래 필수 정보를 포함합니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = stock_futures_realtime_conclusion("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "futs_prdy_ctrt", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "mrkt_basis", + "dprt", + "nmsc_fctn_stpl_prc", + "fmsc_fctn_stpl_prc", + "spead_prc", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "shnu_rate", + "cttr", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "askp1", + "bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate", + "dynm_mxpr", + "dynm_llam", + "dynm_prc_limt_yn" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식선물 실시간호가 [실시간-030] +############################################################################################## + +def stock_futures_realtime_quote( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식선물 실시간호가 API입니다. + 실시간 웹소켓 연결을 통해 주식선물의 실시간 호가 정보를 수신할 수 있습니다. + 매도/매수 호가 1~10단계까지의 확장된 호가 정보를 제공하는 특별한 API입니다. + 호가별 건수, 호가별 잔량 등의 상세 정보를 포함합니다. + 선물옵션 호가 데이터는 0.2초 필터링 옵션이 적용됩니다. + 실전계좌만 지원되며 모의투자는 미지원됩니다. + + Args: + tr_type (str): [필수] 구독 등록/해제 여부 (ex. "1": 구독, "2": 해제) + tr_key (str): [필수] 종목코드 (ex. 101S12) + + Returns: + message (str): 메시지 데이터 + + Example: + >>> msg, columns = stock_futures_realtime_quote("1", "101S12") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZFASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "futs_shrn_iscd", + "bsop_hour", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "askp10", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "bidp10", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "askp_csnu6", + "askp_csnu7", + "askp_csnu8", + "askp_csnu9", + "askp_csnu10", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "bidp_csnu6", + "bidp_csnu7", + "bidp_csnu8", + "bidp_csnu9", + "bidp_csnu10", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간호가 [실시간-045] +############################################################################################## + +def stock_option_asking_price( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 국내선물옵션 주식옵션 실시간호가 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 선물단축종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = stock_option_asking_price("1", "111W80") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_askp1", + "optn_askp2", + "optn_askp3", + "optn_askp4", + "optn_askp5", + "optn_bidp1", + "optn_bidp2", + "optn_bidp3", + "optn_bidp4", + "optn_bidp5", + "askp_csnu1", + "askp_csnu2", + "askp_csnu3", + "askp_csnu4", + "askp_csnu5", + "bidp_csnu1", + "bidp_csnu2", + "bidp_csnu3", + "bidp_csnu4", + "bidp_csnu5", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "total_askp_csnu", + "total_bidp_csnu", + "total_askp_rsqn", + "total_bidp_rsqn", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc", + "optn_askp6", + "optn_askp7", + "optn_askp8", + "optn_askp9", + "optn_askp10", + "optn_bidp6", + "optn_bidp7", + "optn_bidp8", + "optn_bidp9", + "optn_bidp10", + "askp_csnu6", + "askp_csnu7", + "askp_csnu8", + "askp_csnu9", + "askp_csnu10", + "bidp_csnu6", + "bidp_csnu7", + "bidp_csnu8", + "bidp_csnu9", + "bidp_csnu10", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10" + ] + + return msg, columns + +############################################################################################## +# [국내선물옵션] 실시간시세 > 주식옵션 실시간체결가 [실시간-044] +############################################################################################## + +def stock_option_ccnl( + tr_type: str, + tr_key: str, +) -> (dict, list[str]): + """ + 주식옵션 실시간체결가 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = stock_option_ccnl("1", "101W9000") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "H0ZOCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "optn_shrn_iscd", + "bsop_hour", + "optn_prpr", + "prdy_vrss_sign", + "optn_prdy_vrss", + "prdy_ctrt", + "optn_oprc", + "optn_hgpr", + "optn_lwpr", + "last_cnqn", + "acml_vol", + "acml_tr_pbmn", + "hts_thpr", + "hts_otst_stpl_qty", + "otst_stpl_qty_icdc", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_nmix_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_nmix_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_nmix_prpr", + "shnu_rate", + "prmm_val", + "invl_val", + "tmvl_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "esdg", + "otst_stpl_rgbf_qty_icdc", + "thpr_basis", + "unas_hist_vltl", + "cttr", + "dprt", + "mrkt_basis", + "optn_askp1", + "optn_bidp1", + "askp_rsqn1", + "bidp_rsqn1", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "total_askp_rsqn", + "total_bidp_rsqn", + "prdy_vol_vrss_acml_vol_rate" + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples.py b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples.py new file mode 100644 index 0000000..aac62fc --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples.py @@ -0,0 +1,1256 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_stock_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외잔량 순위[v1_국내주식-093] +############################################################################################## + +df = after_hour_balance(fid_input_price_1="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20176", + fid_rank_sort_cls_code="1", fid_div_cls_code="0", fid_input_iscd="0000", + fid_trgt_exls_cls_code="0", fid_trgt_cls_code="0", fid_vol_cnt="", fid_input_price_2="") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 대량체결건수 상위[국내주식-107] +############################################################################################## + +df = bulk_trans_num(fid_aply_rang_prc_2="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="11909", + fid_input_iscd="0000", fid_rank_sort_cls_code="0", fid_div_cls_code="0", fid_input_price_1="", + fid_aply_rang_prc_1="", fid_input_iscd_2="", fid_trgt_exls_cls_code="0", fid_trgt_cls_code="0", + fid_vol_cnt="") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 상하한가 포착 [국내주식-190] +############################################################################################## + +result = capture_uplowprice( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11300", + fid_prc_cls_code="0", + fid_div_cls_code="0", + fid_input_iscd="0000" +) +print(result) + +############################################################################################## +# [국내주식] 업종/기타 > 국내휴장일조회[국내주식-040] +############################################################################################## + +result = chk_holiday(bass_dt="20250630") +print(result) + +############################################################################################## +# [국내주식] 업종/기타 > 금리 종합(국내채권_금리)[국내주식-155] +############################################################################################## + +df1, df2 = comp_interest(fid_cond_mrkt_div_code="I", fid_cond_scr_div_code="20702", fid_div_cls_code="1", + fid_div_cls_code1="") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(일별)[국내주식-115] +############################################################################################## + +result = comp_program_trade_daily( + fid_cond_mrkt_div_code="J", + fid_mrkt_cls_code="K", + fid_input_date_1="20250101", + fid_input_date_2="20250617" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(시간) [국내주식-114] +############################################################################################## + +result = comp_program_trade_today(fid_cond_mrkt_div_code="J", fid_mrkt_cls_code="K") +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신용잔고 상위 [국내주식-109] +############################################################################################## + +df1, df2 = credit_balance(fid_cond_scr_div_code="11701", fid_input_iscd="0000", fid_option="2", + fid_cond_mrkt_div_code="J", fid_rank_sort_cls_code="0") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 당사 신용가능종목[국내주식-111] +############################################################################################## + +df = credit_by_company(fid_rank_sort_cls_code="0", fid_slct_yn="0", fid_input_iscd="0000", + fid_cond_scr_div_code="20477", fid_cond_mrkt_div_code="J") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 신용잔고 일별추이[국내주식-110] +############################################################################################## + +result1 = daily_credit_balance(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20476", + fid_input_iscd="068270", fid_input_date_1="20240508") +print(result1) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 일별 대차거래추이 [국내주식-135] +############################################################################################## + +result = daily_loan_trans( + mrkt_div_cls_code="1", + mksc_shrn_iscd="005930", + start_date="20240301", + end_date="20240328" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 공매도 일별추이[국내주식-134] +############################################################################################## + +result1, result2 = daily_short_sale( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_date_1="20240301", + fid_input_date_2="20240328" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 이격도 순위 [v1_국내주식-095] +############################################################################################## + +df = disparity(fid_input_price_2="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20178", fid_div_cls_code="0", + fid_rank_sort_cls_code="0", fid_hour_cls_code="5", fid_input_iscd="0000", fid_trgt_cls_code="0", + fid_trgt_exls_cls_code="0", fid_input_price_1="", fid_vol_cnt="") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 배당률 상위[국내주식-106] +############################################################################################## + +df = dividend_rate(cts_area="", gb1="0", upjong="0001", gb2="0", gb3="1", f_dt="20230101", t_dt="20231231", gb4="0") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목추정실적[국내주식-187] +############################################################################################## + +df1, df2, df3, df4 = estimate_perform(sht_cd="265520") +print(df1) +print(df2) +print(df3) +print(df4) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 장마감 예상체결가[국내주식-120] +############################################################################################## + +result = exp_closing_price( + fid_cond_mrkt_div_code="J", + fid_input_iscd="0001", + fid_rank_sort_cls_code="0", + fid_cond_scr_div_code="11173", + fid_blng_cls_code="0" +) +print(result) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결지수 추이[국내주식-121] +############################################################################################## + +df = exp_index_trend(fid_mkop_cls_code="1", fid_input_hour_1="", fid_input_iscd="0001", fid_cond_mrkt_div_code="U") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 예상체결가 추이[국내주식-118] +############################################################################################## + +output1, output2 = exp_price_trend( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_mkop_cls_code="0" +) +print(output1) +print(output2) + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결 전체지수[국내주식-122] +############################################################################################## + +df1, df2 = exp_total_index(fid_mrkt_cls_code="0", fid_cond_mrkt_div_code="U", fid_cond_scr_div_code="11175", + fid_input_iscd="0000", fid_mkop_cls_code="1") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 예상체결 상승_하락상위[v1_국내주식-103] +############################################################################################## + +df = exp_trans_updown(fid_rank_sort_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20182", + fid_input_iscd="0000", fid_div_cls_code="0", fid_aply_rang_prc_1="", fid_vol_cnt="", fid_pbmn="", + fid_blng_cls_code="0", fid_mkop_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 대차대조표 [v1_국내주식-078] +############################################################################################## + +df = finance_balance_sheet(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 재무비율 [v1_국내주식-080] +############################################################################################## + +df = finance_financial_ratio(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 성장성비율 [v1_국내주식-085] +############################################################################################## + +df = finance_growth_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 손익계산서 [v1_국내주식-079] +############################################################################################## + +df = finance_income_statement(fid_div_cls_code="0", fid_cond_mrkt_div_code="J", fid_input_iscd="000660") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 기타주요비율[v1_국내주식-082] +############################################################################################## + +df = finance_other_major_ratios(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 수익성비율[v1_국내주식-081] +############################################################################################## + +df = finance_profit_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 재무비율 순위[v1_국내주식-092] +############################################################################################## + +df = finance_ratio(fid_trgt_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20175", + fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", + fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="3", fid_rank_sort_cls_code="7", + fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 안정성비율[v1_국내주식-083] +############################################################################################## + +df = finance_stability_ratio(fid_input_iscd="000660", fid_div_cls_code="0", fid_cond_mrkt_div_code="J") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 등락률 순위[v1_국내주식-088] +############################################################################################## + +df = fluctuation(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20170", fid_input_iscd="0000", + fid_rank_sort_cls_code="0", fid_input_cnt_1="0", fid_prc_cls_code="0", fid_input_price_1="", + fid_input_price_2="", fid_vol_cnt="", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", + fid_div_cls_code="0", fid_rsfl_rate1="", fid_rsfl_rate2="") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내기관_외국인 매매종목가집계[국내주식-037] +############################################################################################## + +result = foreign_institution_total( + fid_cond_mrkt_div_code="V", + fid_cond_scr_div_code="16449", + fid_input_iscd="0000", + fid_div_cls_code="0", + fid_rank_sort_cls_code="0", + fid_etc_cls_code="0" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외국계 순매수추이 [국내주식-164] +############################################################################################## + +result = frgnmem_pchs_trend( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_iscd_2="99999" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 외국계 매매종목 가집계 [국내주식-161] +############################################################################################## + +result = frgnmem_trade_estimate( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="16441", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_rank_sort_cls_code_2="0" +) +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 회원사 실 시간 매매동향(틱)[국내주식-163] +############################################################################################## + +df1, df2 = frgnmem_trade_trend(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20432", fid_input_iscd="005930", + fid_input_iscd_2="99999", fid_mrkt_cls_code="A", fid_vol_cnt="1000") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 순위분석 > HTS조회상위20종목[국내주식-214] +############################################################################################## + +df = hts_top_view() +print(df) + +############################################################################################## +# [국내주식] 주문/계좌 > 투자계좌자산현황조회[v1_국내주식-048] +############################################################################################## + +result1, result2 = inquire_account_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 호가/예상체결[v1_국내주식-011] +############################################################################################## + +result1, result2 = inquire_asking_price_exp_ccn(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930") +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회[v1_국내주식-006] +############################################################################################## + +result1, result2 = inquire_balance( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + afhr_flpr_yn="N", + inqr_dvsn="01", + unpr_dvsn="01", + fund_sttl_icld_yn="N", + fncg_amt_auto_rdpt_yn="N", + prcs_dvsn="00" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익[v1_국내주식-041] +############################################################################################## + +result1, result2 = inquire_balance_rlz_pl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + afhr_flpr_yn="N", + inqr_dvsn="02", + unpr_dvsn="01", + fund_sttl_icld_yn="N", + fncg_amt_auto_rdpt_yn="N", + prcs_dvsn="01", + cost_icld_yn="N" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 체결[v1_국내주식-009] +############################################################################################## + +result = inquire_ccnl(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 신용매수가능조회[v1_국내주식-042] +############################################################################################## + +result = inquire_credit_psamount( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="005930", + ord_dvsn="00", + crdt_type="21", + cma_evlu_amt_icld_yn="N", + ovrs_icld_yn="N" +) +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식일별주문체결조회[v1_국내주식-005] +############################################################################################## + +result1, result2 = inquire_daily_ccld( + env_dv="real", + pd_dv="inner", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_dt="20220810", + inqr_end_dt="20220810", + sll_buy_dvsn_cd="00", + inqr_dvsn="00", + pdno="005930", + ccld_dvsn="00", + inqr_dvsn_3="00" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] +############################################################################################## + +df1, df2 = inquire_daily_indexchartprice(fid_cond_mrkt_div_code="U", fid_input_iscd="0001", fid_input_date_1="20250101", + fid_input_date_2="20250131", fid_period_div_code="D", env_dv="real") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년)[v1_국내주식-016] +############################################################################################## + +result1, result2 = inquire_daily_itemchartprice( + env_dv="real", + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_date_1="20220101", + fid_input_date_2="20220809", + fid_period_div_code="D", + fid_org_adj_prc="1" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가[v1_국내주식-026] +############################################################################################## + +result1, result2 = inquire_daily_overtimeprice(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930") +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 일자별[v1_국내주식-010] +############################################################################################## + +result = inquire_daily_price(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930", + fid_period_div_code="D", fid_org_adj_prc="1") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 종목별일별매수매도체결량 [v1_국내주식-056] +############################################################################################## + +result1, result2 = inquire_daily_trade_volume( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_period_div_code="D" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] ELW시세 > ELW 현재가 시세 [v1_국내주식-014] +############################################################################################## + +df = inquire_elw_price(fid_cond_mrkt_div_code="W", fid_input_iscd="123456", env_dv="real") +print(df) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 구분별전체시세[v1_국내주식-066] +############################################################################################## + +df1, df2 = inquire_index_category_price(fid_cond_mrkt_div_code="U", fid_input_iscd="0001", + fid_cond_scr_div_code="20214", fid_mrkt_cls_code="K", fid_blng_cls_code="0") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 일자별지수 [v1_국내주식-065] +############################################################################################## + +df1, df2 = inquire_index_daily_price(fid_period_div_code="D", fid_cond_mrkt_div_code="U", fid_input_iscd="0001", + fid_input_date_1="20250101") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 현재지수 [v1_국내주식-063] +############################################################################################## + +df = inquire_index_price(fid_cond_mrkt_div_code="U", fid_input_iscd="0001") +print(df) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(초)[국내주식-064] +############################################################################################## + +df = inquire_index_tickprice(fid_input_iscd="0001", fid_cond_mrkt_div_code="U") +print(df) + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(분)[국내주식-119] +############################################################################################## + +df = inquire_index_timeprice(fid_input_hour_1="60", fid_input_iscd="0001", fid_cond_mrkt_div_code="U") +print(df) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 투자자[v1_국내주식-012] +############################################################################################## + +result = inquire_investor(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(일별) [국내주식-075] +############################################################################################## + +result = inquire_investor_daily_by_market( + fid_cond_mrkt_div_code="U", + fid_input_iscd="0001", + fid_input_date_1="20250701", + fid_input_iscd_1="KSP", + fid_input_date_2="20250701", + fid_input_iscd_2="0001", +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(시세)[v1_국내주식-074] +############################################################################################## + +result = inquire_investor_time_by_market(fid_input_iscd="999", fid_input_iscd_2="S001") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 회원사[v1_국내주식-013] +############################################################################################## + +result = inquire_member(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 주식현재가 회원사 종목매매동향 [국내주식-197] +############################################################################################## + +result = inquire_member_daily( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_iscd_2="00003", + fid_input_date_1="20240501", + fid_input_date_2="20240624" +) +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외호가[국내주식-077] +############################################################################################## + +result = inquire_overtime_asking_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외현재가[국내주식-076] +############################################################################################## + +result = inquire_overtime_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별손익일별합산조회[v1_국내주식-052] +############################################################################################## + +result1, result2 = inquire_period_profit( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + inqr_strt_dt="20230101", + inqr_end_dt="20240301", + sort_dvsn="00", + inqr_dvsn="00", + cblc_dvsn="00" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별매매손익현황조회[v1_국내주식-060] +############################################################################################## + +result1, result2 = inquire_period_trade_profit( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + sort_dvsn="02", + inqr_strt_dt="20230216", + inqr_end_dt="20240301", + cblc_dvsn="00" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세[v1_국내주식-008] +############################################################################################## + +result = inquire_price(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세2[v1_국내주식-054] +############################################################################################## + +result = inquire_price_2(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 매수가능조회[v1_국내주식-007] +############################################################################################## + +result = inquire_psbl_order(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", + ord_unpr="55000", + ord_dvsn="01", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식정정취소가능주문조회[v1_국내주식-004] +############################################################################################## + +result = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dvsn_1="1", inqr_dvsn_2="0") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 매도가능수량조회 [국내주식-165] +############################################################################################## + +df = inquire_psbl_sell(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="000660") +print(df) + +############################################################################################## +# [국내주식] 기본시세 > 주식일별분봉조회 [국내주식-213] +############################################################################################## + +result1, result2 = inquire_time_dailychartprice( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_hour_1="130000", + fid_input_date_1="20241023" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 업종 분봉조회[v1_국내주식-045] +############################################################################################## + +df1, df2 = inquire_time_indexchartprice(fid_cond_mrkt_div_code="U", fid_etc_cls_code="0", fid_input_iscd="0001", + fid_input_hour_1="60", fid_pw_data_incu_yn="Y") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 기본시세 > 주식당일분봉조회[v1_국내주식-022] +############################################################################################## + +output1, output2 = inquire_time_itemchartprice(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", fid_input_hour_1="093000", + fid_pw_data_incu_yn="Y") +print(output1) +print(output2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결[v1_국내주식-023] +############################################################################################## + +result1, result2 = inquire_time_itemconclusion( + env_dv="real", + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_input_hour_1="115959" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외시간별체결[v1_국내주식-025] +############################################################################################## + +result1, result2 = inquire_time_overtimeconclusion(env_dv="real", fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", fid_hour_cls_code="1") +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > 변동성완화장치(VI) 현황[v1_국내주식-055] +############################################################################################## + +df = inquire_vi_status(fid_div_cls_code="0", fid_cond_scr_div_code="20139", fid_mrkt_cls_code="0", fid_input_iscd="", + fid_rank_sort_cls_code="0", fid_input_date_1="20250101", fid_trgt_cls_code="", + fid_trgt_exls_cls_code="") +print(df) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식통합증거금 현황 [국내주식-191] +############################################################################################## + +result = intgr_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, cma_evlu_amt_icld_yn="N", wcrc_frcr_dvsn_cd="01", + fwex_ctrt_frcr_dvsn_cd="01") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹조회 [국내주식-204] +############################################################################################## + +result = intstock_grouplist(type="1", fid_etc_cls_code="00", user_id=trenv.my_htsid) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목(멀티종목) 시세조회 [국내주식-205] +############################################################################################## + +result = intstock_multprice( + fid_cond_mrkt_div_code_1="J", + fid_input_iscd_1="419530", + fid_cond_mrkt_div_code_2="J", + fid_input_iscd_2="092070" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹별 종목조회 [국내주식-203] +############################################################################################## + +result1, result2 = intstock_stocklist_by_group( + type="1", + user_id=trenv.my_htsid, + inter_grp_code="001", + fid_etc_cls_code="4" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 증권사별 투자의견[국내주식-189] +############################################################################################## + +df = invest_opbysec(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="16634", fid_input_iscd="005930", + fid_div_cls_code="0", fid_input_date_1="20250101", fid_input_date_2="20250131") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목투자의견[국내주식-188] +############################################################################################## + +df = invest_opinion(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="16633", fid_input_iscd="005930", + fid_input_date_1="20231113", fid_input_date_2="20240513") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 투자자매매동향(당일) [국내주식-116] +############################################################################################## + +result = investor_program_trade_today(mrkt_div_cls_code="1") +print(result) + +######################################################################################## +# [국내주식] 시세분석 > 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] +######################################################################################## + +df1, df2 = investor_trade_by_stock_daily(fid_cond_mrkt_div_code="J", fid_input_iscd="005930", + fid_input_date_1="20250812", fid_org_adj_prc="", fid_etc_cls_code="") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외인기관 추정가집계[v1_국내주식-046] +############################################################################################## + +result = investor_trend_estimate(mksc_shrn_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(무상증자일정)[국내주식-144] +############################################################################################## + +df = ksdinfo_bonus_issue(cts="", f_dt="20250101", t_dt="20250131", sht_cd="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(자본감소일정) [국내주식-149] +############################################################################################## + +df = ksdinfo_cap_dcrs(cts="", f_dt="20250101", t_dt="20250131", sht_cd="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(배당일정)[국내주식-145] +############################################################################################## + +df = ksdinfo_dividend(cts="", gb1="0", f_dt="20250101", t_dt="20250131", sht_cd="", high_gb="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(실권주일정)[국내주식-152] +############################################################################################## + +df = ksdinfo_forfeit(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(상장정보일정)[국내주식-150] +############################################################################################## + +df = ksdinfo_list_info(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(의무예치일정) [국내주식-153] +############################################################################################## + +df = ksdinfo_mand_deposit(t_dt="20250131", sht_cd="", f_dt="20250101", cts="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(합병_분할일정)[국내주식-147] +############################################################################################## + +df = ksdinfo_merger_split(cts="", f_dt="20230101", t_dt="20231231", sht_cd="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(유상증자일정)[국내주식-143] +############################################################################################## + +df = ksdinfo_paidin_capin(cts="", gb1="1", f_dt="20250101", t_dt="20250101", sht_cd="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(공모주청약일정)[국내주식-151] +############################################################################################## + +df = ksdinfo_pub_offer(sht_cd="", cts="", f_dt="20250101", t_dt="20250131") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주식매수청구일정)[국내주식-146] +############################################################################################## + +df = ksdinfo_purreq(sht_cd="", t_dt="20250131", f_dt="20250101", cts="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(액면교체일정)[국내주식-148] +############################################################################################## + +df = ksdinfo_rev_split(sht_cd="", cts="", f_dt="20250101", t_dt="20250131", market_gb="0") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주주총회일정)[국내주식-154] +############################################################################################## + +df = ksdinfo_sharehld_meet(cts="", f_dt="20230101", t_dt="20231231", sht_cd="") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 당사 대주가능 종목 [국내주식-195] +############################################################################################## + +df1, df2 = lendable_by_company(excg_dvsn_cd="00", pdno="", thco_stln_psbl_yn="Y", inqr_dvsn_1="0", ctx_area_fk200="", + ctx_area_nk100="") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시가총액 상위 [v1_국내주식-091] +############################################################################################## + +df = market_cap(fid_input_price_2="1000000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20174", + fid_div_cls_code="0", fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", + fid_input_price_1="50000", fid_vol_cnt="1000") +print(df) + +############################################################################################## +# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160] +############################################################################################## + +result = market_time() +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시장가치 순위[v1_국내주식-096] +############################################################################################## + +df = market_value(fid_trgt_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20179", + fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", + fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="0", fid_rank_sort_cls_code="23", + fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내 증시자금 종합 [국내주식-193] +############################################################################################## + +result = mktfunds(fid_input_date_1="") +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신고_신저근접종목 상위[v1_국내주식-105] +############################################################################################## + +df = near_new_highlow(fid_aply_rang_vol="100", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20187", + fid_div_cls_code="0", fid_input_cnt_1="0", fid_input_cnt_2="10", fid_prc_cls_code="0", + fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", + fid_aply_rang_prc_1="10000", fid_aply_rang_prc_2="50000") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 종합 시황/공시(제목) [국내주식-141] +############################################################################################## + +df = news_title(fid_news_ofer_entp_code="", fid_cond_mrkt_cls_code="", fid_input_iscd="", fid_titl_cntt="", + fid_input_date_1="", fid_input_hour_1="", fid_rank_sort_cls_code="", fid_input_srno="") +print(df) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(현금)[v1_국내주식-001] +############################################################################################## + +result = order_cash(env_dv="real", ord_dv="sell", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", + ord_dvsn="00", ord_qty="1", ord_unpr="2000", excg_id_dvsn_cd="SOR") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(신용)[v1_국내주식-002] +############################################################################################## + +result = order_credit( + ord_dv="buy", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="005930", + crdt_type="21", + loan_dt="20220810", + ord_dvsn="00", + ord_qty="1", + ord_unpr="55000" +) +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문[v1_국내주식-017] +############################################################################################## + +result = order_resv(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_qty="1", ord_unpr="55000", + sll_buy_dvsn_cd="02", ord_dvsn_cd="00", ord_objt_cblc_dvsn_cd="10") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] +############################################################################################## + +result = order_resv_ccnl( + rsvn_ord_ord_dt="20220729", + rsvn_ord_end_dt="20220810", + tmnl_mdia_kind_cd="00", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + prcs_dvsn_cd="0", + cncl_yn="Y" +) +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문정정취소[v1_국내주식-018,019] +############################################################################################## + +result = order_resv_rvsecncl( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rsvn_ord_seq="88793", + rsvn_ord_orgno="001", + rsvn_ord_ord_dt="20250113", + ord_type="cancel", + pdno="005930", + ord_qty="2", + ord_unpr="55000", + sll_buy_dvsn_cd="02", + ord_dvsn_cd="00", + ord_objt_cblc_dvsn_cd="10" +) +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(정정취소)[v1_국내주식-003] +############################################################################################## + +result = order_rvsecncl( + env_dv="real", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + krx_fwdg_ord_orgno="06010", + orgn_odno="0000002101", + ord_dvsn="00", + rvse_cncl_dvsn_cd="02", + ord_qty="1", + ord_unpr="55000", + qty_all_ord_yn="Y", + excg_id_dvsn_cd="KRX" +) +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 시간외예상체결등락률 [국내주식-140] +############################################################################################## + +result = overtime_exp_trans_fluct( + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11186", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_div_cls_code="0" +) +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시간외등락율순위[국내주식-138] +############################################################################################## + +df1, df2 = overtime_fluctuation(fid_cond_mrkt_div_code="J", fid_mrkt_cls_code="", fid_cond_scr_div_code="20234", + fid_input_iscd="0000", fid_div_cls_code="1", fid_input_price_1="", fid_input_price_2="", + fid_vol_cnt="", fid_trgt_cls_code="", fid_trgt_exls_cls_code="") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 국내주식 > 국내주식 시간외거래량순위[국내주식-139] +############################################################################################## + +df1, df2 = overtime_volume(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20235", fid_input_iscd="0000", + fid_rank_sort_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_vol_cnt="", + fid_trgt_cls_code="", fid_trgt_exls_cls_code="") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 매물대/거래비중 [국내주식-196] +############################################################################################## + +result1, result2 = pbar_tratio( + fid_cond_mrkt_div_code="J", + fid_input_iscd="005930", + fid_cond_scr_div_code="20113" +) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 잔고조회[v1_국내주식-036] +############################################################################################## + +result1, result2 = pension_inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00", + inqr_dvsn="00") +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] +############################################################################################## + +result = pension_inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="%%", + sll_buy_dvsn_cd="00", + ccld_nccs_dvsn="%%", inqr_dvsn_3="00") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 예수금조회[v1_국내주식-035] +############################################################################################## + +result = pension_inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00") +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] +############################################################################################## + +result1, result2 = pension_inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + user_dvsn_cd="00" + ) +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] +############################################################################################## + +result = pension_inquire_psbl_order( + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + pdno="069500", + acca_dvsn_cd="00", + cma_evlu_amt_icld_yn="Y", + ord_unpr="30800", + ord_dvsn="00" +) +print(result) + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별계좌권리현황조회 [국내주식-211] +############################################################################################## + +result = period_rights(inqr_dvsn="03", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", + inqr_end_dt="20250103") +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 우선주_괴리율 상위[v1_국내주식-094] +############################################################################################## + +df = prefer_disparate_ratio(fid_vol_cnt="1000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20177", + fid_div_cls_code="0", fid_input_iscd="0000", fid_trgt_cls_code="0", + fid_trgt_exls_cls_code="0", fid_input_price_1="10000", fid_input_price_2="50000") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 수익자산지표 순위[v1_국내주식-090] +############################################################################################## + +df = profit_asset_index(fid_cond_mrkt_div_code="J", fid_trgt_cls_code="0", fid_cond_scr_div_code="20173", + fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", + fid_vol_cnt="", fid_input_option_1="2023", fid_input_option_2="0", fid_rank_sort_cls_code="0", + fid_blng_cls_code="0", fid_trgt_exls_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(체결)[v1_국내주식-044] +############################################################################################## + +result = program_trade_by_stock(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(일별) [국내주식-113] +############################################################################################## + +result = program_trade_by_stock_daily(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색조회 [국내주식-039] +############################################################################################## + +result = psearch_result(user_id=trenv.my_htsid, seq="0") +print(result) + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] +############################################################################################## + +result = psearch_title(user_id=trenv.my_htsid) +print(result) + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 호가잔량 순위[국내주식-089] +############################################################################################## + +df = quote_balance(fid_vol_cnt="1000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20172", fid_input_iscd="0001", + fid_rank_sort_cls_code="0", fid_div_cls_code="0", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", + fid_input_price_1="50000", fid_input_price_2="100000") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 상품기본조회[v1_국내주식-029] +############################################################################################## + +df = search_info(pdno="000660", prdt_type_cd="300") +print(df) + +############################################################################################## +# [국내주식] 종목정보 > 주식기본조회[v1_국내주식-067] +############################################################################################## + +df = search_stock_info(prdt_type_cd="300", pdno="005930") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 공매도 상위종목[국내주식-133] +############################################################################################## + +df = short_sale(fid_aply_rang_vol="", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20482", fid_input_iscd="0000", + fid_period_div_code="D", fid_input_cnt_1="0", fid_trgt_exls_cls_code="", fid_trgt_cls_code="", + fid_aply_rang_prc_1="0", fid_aply_rang_prc_2="1000000") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 관심종목등록 상위[v1_국내주식-102] +############################################################################################## + +df = top_interest_stock(fid_input_iscd_2="000000", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20180", + fid_input_iscd="0000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_input_price_1="0", + fid_input_price_2="0", fid_vol_cnt="0", fid_div_cls_code="0", fid_input_cnt_1="1") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 당사매매종목 상위[v1_국내주식-104] +############################################################################################## + +df = traded_by_company(fid_trgt_exls_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20186", + fid_div_cls_code="0", fid_rank_sort_cls_code="1", fid_input_date_1="20230101", + fid_input_date_2="20231231", fid_input_iscd="0000", fid_trgt_cls_code="0", + fid_aply_rang_vol="100", fid_aply_rang_prc_2="100000", fid_aply_rang_prc_1="50000") +print(df) + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 체결금액별 매매비중 [국내주식-192] +############################################################################################## + +result = tradprt_byamt(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="11119", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 체결강도 상위[v1_국내주식-101] +############################################################################################## + +df = volume_power(fid_trgt_exls_cls_code="0", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20168", + fid_input_iscd="0000", fid_div_cls_code="0", fid_input_price_1="0", fid_input_price_2="1000000", + fid_vol_cnt="0", fid_trgt_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] 순위분석 > 거래량순위[v1_국내주식-047] +############################################################################################## + +df = volume_rank(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20171", fid_input_iscd="0000", fid_div_cls_code="0", + fid_blng_cls_code="0", fid_trgt_cls_code="111111111", fid_trgt_exls_cls_code="0000000000", + fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_input_date_1="") +print(df) diff --git a/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples_ws.py b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples_ws.py new file mode 100644 index 0000000..ef18d69 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_examples_ws.py @@ -0,0 +1,181 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from domestic_stock_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (KRX) [실시간-004] +############################################################################################## + +kws.subscribe(request=asking_price_krx, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (NXT) +############################################################################################## + +kws.subscribe(request=asking_price_nxt, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (통합) +############################################################################################## + +kws.subscribe(request=asking_price_total, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가(KRX) [실시간-003] +############################################################################################## + +kws.subscribe(request=ccnl_krx, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 주식체결통보 [실시간-005] +############################################################################################## + +kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (NXT) +############################################################################################## + +kws.subscribe(request=ccnl_nxt, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (통합) +############################################################################################## + +kws.subscribe(request=ccnl_total, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (KRX) [실시간-041] +############################################################################################## + +kws.subscribe(request=exp_ccnl_krx, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (NXT) +############################################################################################## + +kws.subscribe( + request=exp_ccnl_nxt, + data=["005930", "000660", "005380"] +) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결(통합) +############################################################################################## + +kws.subscribe(request=exp_ccnl_total, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간체결 [실시간-026] +############################################################################################## + +kws.subscribe(request=index_ccnl, data=["0001", "0128"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간예상체결 [실시간-027] +############################################################################################## + +kws.subscribe(request=index_exp_ccnl, data=["0001"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간프로그램매매 [실시간-028] +############################################################################################## + +kws.subscribe(request=index_program_trade, data=["0001", "0128"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보 (KRX) [실시간-049] +############################################################################################## + +kws.subscribe(request=market_status_krx, data=["417450", "308100"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(NXT) +############################################################################################## + +kws.subscribe(request=market_status_nxt, data=["006220"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(통합) +############################################################################################## + +kws.subscribe(request=market_status_total, data=["158430"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (KRX) [실시간-047] +############################################################################################## + +kws.subscribe(request=member_krx, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (NXT) +############################################################################################## + +kws.subscribe(request=member_nxt, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (통합) +############################################################################################## + +kws.subscribe(request=member_total, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간호가 (KRX) [실시간-025] +############################################################################################## + +kws.subscribe(request=overtime_asking_price_krx, data=["023460"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간체결가 (KRX) [실시간-042] +############################################################################################## + +kws.subscribe(request=overtime_ccnl_krx, data=["023460", "199480", "462860", "440790", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간예상체결 (KRX) [실시간-024] +############################################################################################## + +kws.subscribe(request=overtime_exp_ccnl_krx, data=["023460"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (KRX) [실시간-048] +############################################################################################## + +kws.subscribe(request=program_trade_krx, data=["005930", "000660"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (NXT) +############################################################################################## + +kws.subscribe(request=program_trade_nxt, data=["032640", "010950"]) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (통합) +############################################################################################## + +kws.subscribe(request=program_trade_total, data=["005930", "000660"]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions.py b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions.py new file mode 100644 index 0000000..e585487 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions.py @@ -0,0 +1,13463 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외잔량 순위[v1_국내주식-093] +############################################################################################## + +def after_hour_balance( + fid_input_price_1: str, # 입력 가격1 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_vol_cnt: str, # 거래량 수 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외잔량 순위[v1_국내주식-093] + 국내주식 시간외잔량 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key( 20176 ) + fid_rank_sort_cls_code (str): 1: 장전 시간외, 2: 장후 시간외, 3:매도잔량, 4:매수잔량 + fid_div_cls_code (str): 0 : 전체 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_trgt_cls_code (str): 0 : 전체 + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 시간외잔량 순위 데이터 + + Example: + >>> df = after_hour_balance( + ... fid_input_price_1="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20176", + ... fid_rank_sort_cls_code="1", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_exls_cls_code="0", + ... fid_trgt_cls_code="0", + ... fid_vol_cnt="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/after-hour-balance" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20176')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20176')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHPST01760000" + + # API 요청 파라미터 설정 + params = { + "fid_input_price_1": fid_input_price_1, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return after_hour_balance( + fid_input_price_1, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_vol_cnt, + fid_input_price_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 대량체결건수 상위[국내주식-107] +############################################################################################## + +def bulk_trans_num( + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_input_iscd_2: str, # 입력 종목코드2 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 대량체결건수 상위[국내주식-107] + 국내주식 대량체결건수 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_prc_2 (str): ~ 가격 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(11909) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_rank_sort_cls_code (str): 0:매수상위, 1:매도상위 + fid_div_cls_code (str): 0:전체 + fid_input_price_1 (str): 건별금액 ~ + fid_aply_rang_prc_1 (str): 가격 ~ + fid_input_iscd_2 (str): 공백:전체종목, 개별종목 조회시 종목코드 (000660) + fid_trgt_exls_cls_code (str): 0:전체 + fid_trgt_cls_code (str): 0:전체 + fid_vol_cnt (str): 거래량 ~ + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 대량체결건수 상위 데이터 + + Example: + >>> df = bulk_trans_num( + fid_aply_rang_prc_2="100000", + fid_cond_mrkt_div_code="J", + fid_cond_scr_div_code="11909", + fid_input_iscd="0000", + fid_rank_sort_cls_code="0", + fid_div_cls_code="0", + fid_input_price_1="50000", + fid_aply_rang_prc_1="200000", + fid_input_iscd_2="", + fid_trgt_exls_cls_code="0", + fid_trgt_cls_code="0", + fid_vol_cnt="1000" + ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/bulk-trans-num" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11909')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11909')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST190900C0" + + params = { + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_input_iscd_2": fid_input_iscd_2, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_vol_cnt": fid_vol_cnt, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 다음 페이지 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return bulk_trans_num( + fid_aply_rang_prc_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_input_price_1, + fid_aply_rang_prc_1, + fid_input_iscd_2, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_vol_cnt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 상하한가 포착 [국내주식-190] +############################################################################################## + +def capture_uplowprice( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11300) + fid_prc_cls_code: str, # [필수] 상하한가 구분코드 (ex. 0:상한가, 1:하한가) + fid_div_cls_code: str, + # [필수] 분류구분코드 (ex. 0:상하한가종목, 6:8%상하한가 근접, 5:10%상하한가 근접, 1:15%상하한가 근접, 2:20%상하한가 근접, 3:25%상하한가 근접) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_trgt_cls_code: str = "", # 대상구분코드 + fid_trgt_exls_cls_code: str = "", # 대상제외구분코드 + fid_input_price_1: str = "", # 입력가격1 + fid_input_price_2: str = "", # 입력가격2 + fid_vol_cnt: str = "" # 거래량수 +) -> pd.DataFrame: + """ + 국내주식 상하한가 포착 API입니다. + 한국투자 HTS(eFriend Plus) > [0917] 실시간 상하한가 포착 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11300) + fid_prc_cls_code (str): [필수] 상하한가 구분코드 (ex. 0:상한가, 1:하한가) + fid_div_cls_code (str): [필수] 분류구분코드 (ex. 0:상하한가종목, 6:8%상하한가 근접, 5:10%상하한가 근접, 1:15%상하한가 근접, 2:20%상하한가 근접, 3:25%상하한가 근접) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_trgt_cls_code (str): 대상구분코드 + fid_trgt_exls_cls_code (str): 대상제외구분코드 + fid_input_price_1 (str): 입력가격1 + fid_input_price_2 (str): 입력가격2 + fid_vol_cnt (str): 거래량수 + + Returns: + pd.DataFrame: 상하한가 포착 데이터 + + Example: + >>> df = capture_uplowprice("J", "11300", "0", "0", "0000") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/capture-uplowprice" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11300')") + + if fid_prc_cls_code == "": + raise ValueError("fid_prc_cls_code is required (e.g. '0', '1')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0', '6', '5', '1', '2', '3')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000', '0001', '1001')") + + tr_id = "FHKST130000C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_PRC_CLS_CODE": fid_prc_cls_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내휴장일조회[국내주식-040] +############################################################################################## + +def chk_holiday( + bass_dt: str, # 기준일자 (YYYYMMDD) + NK100: str = "", # 연속조회키 + FK100: str = "", # 연속조회검색조건 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + (★중요) 국내휴장일조회(TCA0903R) 서비스는 당사 원장서비스와 연관되어 있어 + 단시간 내 다수 호출시 서비스에 영향을 줄 수 있어 가급적 1일 1회 호출 부탁드립니다. + + 국내휴장일조회 API입니다. + 영업일, 거래일, 개장일, 결제일 여부를 조회할 수 있습니다. + 주문을 넣을 수 있는지 확인하고자 하실 경우 개장일여부(opnd_yn)을 사용하시면 됩니다. + + Args: + bass_dt (str): [필수] 기준일자 (ex. YYYYMMDD) + NK100 (str): 연속조회키 + FK100 (str): 연속조회검색조건 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 국내휴장일조회 데이터 + + Example: + >>> df = chk_holiday(bass_dt="20250630") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/chk-holiday" + + if bass_dt == "": + raise ValueError("bass_dt is required (e.g. 'YYYYMMDD')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTCA0903R" # 국내휴장일조회 + + params = { + "BASS_DT": bass_dt, + "CTX_AREA_FK": FK100, + "CTX_AREA_NK": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk + NK100 = res.getBody().ctx_area_nk + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return chk_holiday( + bass_dt, NK100, FK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 금리 종합(국내채권_금리)[국내주식-155] +############################################################################################## + +def comp_interest( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_div_cls_code: str, # 분류구분코드 + fid_div_cls_code1: str, # 분류구분코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 금리 종합(국내채권_금리)[국내주식-155] + 금리 종합(국내채권_금리) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_div_cls_code (str): 분류구분코드 (필수) + fid_div_cls_code1 (str): 분류구분코드 (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 금리 종합(국내채권_금리) 데이터 + + Example: + >>> df1, df2 = comp_interest('01', '20702', '1', '') + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/comp-interest" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. '01')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. '01')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20702')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20702')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPST07020000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_DIV_CLS_CODE1": fid_div_cls_code1, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return comp_interest( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_div_cls_code1, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(일별)[국내주식-115] +############################################################################################## + +def comp_program_trade_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식,NX:NXT,UN:통합) + fid_mrkt_cls_code: str, # [필수] 시장구분코드 (ex. K:코스피,Q:코스닥) + fid_input_date_1: str = "", # 검색시작일 + fid_input_date_2: str = "" # 검색종료일 +) -> pd.DataFrame: + """ + 프로그램매매 종합현황(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0460] 프로그램매매 종합현황 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식,NX:NXT,UN:통합) + fid_mrkt_cls_code (str): [필수] 시장구분코드 (ex. K:코스피,Q:코스닥) + fid_input_date_1 (str): 검색시작일 + fid_input_date_2 (str): 검색종료일 + + Returns: + pd.DataFrame: 프로그램매매 종합현황(일별) 데이터 + + Example: + >>> df = comp_program_trade_daily("J", "K", "20250101", "20250617") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/comp-program-trade-daily" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식,NX:NXT,UN:통합')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'K:코스피,Q:코스닥')") + + tr_id = "FHPPG04600001" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 종합현황(시간) [국내주식-114] +############################################################################################## + +def comp_program_trade_today( + fid_cond_mrkt_div_code: str, # [필수] 시장 구분 코드 (J:KRX,NX:NXT,UN:통합) + fid_mrkt_cls_code: str, # [필수] 시장구분코드 (K:코스피, Q:코스닥) + fid_sctn_cls_code: str = "", # 구간 구분 코드 + fid_input_iscd: str = "", # 입력종목코드 + fid_cond_mrkt_div_code1: str = "", # 시장분류코드 + fid_input_hour_1: str = "" # 입력시간 +) -> pd.DataFrame: + """ + 프로그램매매 종합현황(시간) API입니다. + 한국투자 HTS(eFriend Plus) > [0460] 프로그램매매 종합현황 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 장시간(09:00~15:30) 동안의 최근 30분간의 데이터 확인이 가능하며, 다음조회가 불가합니다. + ※ 장시간(09:00~15:30) 이후에는 bsop_hour 에 153000 ~ 170000 까지의 시간데이터가 출력되지만 데이터는 모두 동일한 장마감 데이터인 점 유의 부탁드립니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 구분 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_mrkt_cls_code (str): [필수] 시장구분코드 (ex. K:코스피, Q:코스닥) + fid_sctn_cls_code (str): 구간 구분 코드 + fid_input_iscd (str): 입력종목코드 + fid_cond_mrkt_div_code1 (str): 시장분류코드 + fid_input_hour_1 (str): 입력시간 + + Returns: + pd.DataFrame: 프로그램매매 종합현황 데이터 + + Example: + >>> df = comp_program_trade_today("J", "K") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/comp-program-trade-today" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX,NX:NXT,UN:통합')") + + if fid_mrkt_cls_code == "": + raise ValueError("fid_mrkt_cls_code is required (e.g. 'K:코스피, Q:코스닥')") + + tr_id = "FHPPG04600101" # 프로그램매매 종합현황(시간) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 구분 코드 + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, # 시장구분코드 + "FID_SCTN_CLS_CODE": fid_sctn_cls_code, # 구간 구분 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력종목코드 + "FID_COND_MRKT_DIV_CODE1": fid_cond_mrkt_div_code1, # 시장분류코드 + "FID_INPUT_HOUR_1": fid_input_hour_1 # 입력시간 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # array 타입이므로 DataFrame으로 반환 + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신용잔고 상위 [국내주식-109] +############################################################################################## + +def credit_balance( + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_option: str, # 증가율기간 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 신용잔고 상위[국내주식-109] + 국내주식 신용잔고 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): Unique key(11701) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, + fid_option (str): 2~999 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_rank_sort_cls_code (str): '(융자)0:잔고비율 상위, 1: 잔고수량 상위, 2: 잔고금액 상위, 3: 잔고비율 증가상위, 4: 잔고비율 감소상위 (대주)5:잔고비율 상위, 6: 잔고수량 상위, 7: 잔고금액 상위, 8: 잔고비율 증가상위, 9: 잔고비율 감소상위 ' + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 신용잔고 상위 데이터 + + Example: + >>> df1, df2 = credit_balance('11701', '0000', '2', 'J', '0') + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/ranking/credit-balance" + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11701')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11701')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_option: + logger.error("fid_option is required. (e.g. '2')") + raise ValueError("fid_option is required. (e.g. '2')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if fid_rank_sort_cls_code not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKST17010000" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_OPTION": fid_option, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return credit_balance( + fid_cond_scr_div_code, + fid_input_iscd, + fid_option, + fid_cond_mrkt_div_code, + fid_rank_sort_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 당사 신용가능종목[국내주식-111] +############################################################################################## + +def credit_by_company( + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_slct_yn: str, # 선택 여부 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 당사 신용가능종목[국내주식-111] + 국내주식 당사 신용가능종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_rank_sort_cls_code (str): 0:코드순, 1:이름순 + fid_slct_yn (str): 0:신용주문가능, 1: 신용주문불가 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_cond_scr_div_code (str): Unique key(20477) + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 당사 신용가능종목 데이터 + + Example: + >>> df = credit_by_company( + ... fid_rank_sort_cls_code="1", + ... fid_slct_yn="0", + ... fid_input_iscd="0000", + ... fid_cond_scr_div_code="20477", + ... fid_cond_mrkt_div_code="J" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/credit-by-company" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + + if not fid_slct_yn: + logger.error("fid_slct_yn is required. (e.g. '0')") + raise ValueError("fid_slct_yn is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20477')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20477')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 ID 설정 + + tr_id = "FHPST04770000" + + # 요청 파라미터 설정 + params = { + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_slct_yn": fid_slct_yn, + "fid_input_iscd": fid_input_iscd, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return credit_by_company( + fid_rank_sort_cls_code, + fid_slct_yn, + fid_input_iscd, + fid_cond_scr_div_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 신용잔고 일별추이[국내주식-110] +############################################################################################## + +def daily_credit_balance( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 + fid_cond_scr_div_code: str, # [필수] 화면 분류 코드 + fid_input_iscd: str, # [필수] 종목코드 + fid_input_date_1: str, # [필수] 결제일자 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 국내주식 신용잔고 일별추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0476] 국내주식 신용잔고 일별추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 한 번의 호출에 최대 30건 확인 가능하며, fid_input_date_1 을 입력하여 다음 조회가 가능합니다. + + ※ 상환수량은 "매도상환수량+현금상환수량"의 합계 수치입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J: 주식) + fid_cond_scr_div_code (str): [필수] 화면 분류 코드 (ex. 20476) + fid_input_iscd (str): [필수] 종목코드 (ex. 005930) + fid_input_date_1 (str): [필수] 결제일자 (ex. 20240313) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 국내주식 신용잔고 일별추이 데이터 + + Example: + >>> df = daily_credit_balance("J", "20476", "005930", "20240313") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/daily-credit-balance" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20476')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20240313')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "FHPST04760000" # 국내주식 신용잔고 일별추이 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 분류 코드 + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, # 화면 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 종목코드 + "FID_INPUT_DATE_1": fid_input_date_1 # 결제일자 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return daily_credit_balance( + fid_cond_mrkt_div_code, fid_cond_scr_div_code, fid_input_iscd, fid_input_date_1, "N", dataframe, + depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별 일별 대차거래추이 [국내주식-135] +############################################################################################## + +def daily_loan_trans( + mrkt_div_cls_code: str, # [필수] 조회구분 (ex. 1:코스피,2:코스닥,3:종목) + mksc_shrn_iscd: str, # [필수] 종목코드 (ex. 123456) + start_date: str = "", # 시작일자 + end_date: str = "", # 종료일자 + cts: str = "" # 이전조회KEY +) -> pd.DataFrame: + """ + 종목별 일별 대차거래추이 API입니다. + 한 번의 조회에 최대 100건까지 조회 가능하며, start_date, end_date 를 수정하여 다음 조회가 가능합니다. + + Args: + mrkt_div_cls_code (str): [필수] 조회구분 (ex. 1:코스피,2:코스닥,3:종목) + mksc_shrn_iscd (str): [필수] 종목코드 (ex. 123456) + start_date (str): 시작일자 + end_date (str): 종료일자 + cts (str): 이전조회KEY + + Returns: + pd.DataFrame: 종목별 일별 대차거래추이 데이터 + + Example: + >>> df = daily_loan_trans(mrkt_div_cls_code="1", mksc_shrn_iscd="005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/daily-loan-trans" + + # 필수 파라미터 검증 + if mrkt_div_cls_code == "": + raise ValueError("mrkt_div_cls_code is required (e.g. '1', '2', '3')") + + if mksc_shrn_iscd == "": + raise ValueError("mksc_shrn_iscd is required (e.g. '123456')") + + tr_id = "HHPST074500C0" + + params = { + "MRKT_DIV_CLS_CODE": mrkt_div_cls_code, + "MKSC_SHRN_ISCD": mksc_shrn_iscd, + "START_DATE": start_date, + "END_DATE": end_date, + "CTS": cts + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + result_data = pd.DataFrame(res.getBody().output1) + return result_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 공매도 일별추이[국내주식-134] +############################################################################################## + +def daily_short_sale( + fid_cond_mrkt_div_code: str, # [필수] 시장분류코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 종목코드 (ex. 123456) + fid_input_date_1: str = "", # 시작일자 + fid_input_date_2: str = "" # 종료일자 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 공매도 일별추이를 조회합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + fid_input_date_1 (str): 시작일자 + fid_input_date_2 (str): 종료일자 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 쌍 + + Example: + >>> df1, df2 = daily_short_sale("J", "005930", "20240301", "20240328") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/daily-short-sale" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST04830000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object 타입 -> DataFrame) + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 처리 (array 타입 -> DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 이격도 순위 [v1_국내주식-095] +############################################################################################## + +def disparity( + fid_input_price_2: str, # 입력 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_hour_cls_code: str, # 시간 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 이격도 순위[v1_국내주식-095] + 국내주식 이격도 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_cond_mrkt_div_code (str): 시장구분코드 (ex. J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20178 ) + fid_div_cls_code (str): 0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보톧주, 7:우선주 + fid_rank_sort_cls_code (str): 0: 이격도상위순, 1:이격도하위순 + fid_hour_cls_code (str): 5:이격도5, 10:이격도10, 20:이격도20, 60:이격도60, 120:이격도120 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 이격도 순위 데이터 + + Example: + >>> df = disparity( + ... fid_input_price_2="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20178", + ... fid_div_cls_code="0", + ... fid_rank_sort_cls_code="0", + ... fid_hour_cls_code="5", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_vol_cnt="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/disparity" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20178')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20178')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '5')") + raise ValueError("fid_hour_cls_code is required. (e.g. '5')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01780000" + + params = { + "fid_input_price_2": fid_input_price_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_hour_cls_code": fid_hour_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_vol_cnt": fid_vol_cnt, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return disparity( + fid_input_price_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_rank_sort_cls_code, + fid_hour_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_vol_cnt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 배당률 상위[국내주식-106] +############################################################################################## + +def dividend_rate( + cts_area: str, # CTS_AREA + gb1: str, # KOSPI + upjong: str, # 업종구분 + gb2: str, # 종목선택 + gb3: str, # 배당구분 + f_dt: str, # 기준일From + t_dt: str, # 기준일To + gb4: str, # 결산/중간배당 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 배당률 상위[국내주식-106] + 국내주식 배당률 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts_area (str): 공백 + gb1 (str): 0:전체, 1:코스피, 2: 코스피200, 3: 코스닥, + upjong (str): '코스피(0001:종합, 0002:대형주.…0027:제조업 ), 코스닥(1001:종합, …. 1041:IT부품 코스피200 (2001:KOSPI200, 2007:KOSPI100, 2008:KOSPI50)' + gb2 (str): 0:전체, 6:보통주, 7:우선주 + gb3 (str): 1:주식배당, 2: 현금배당 + f_dt (str): 기준일 시작 + t_dt (str): 기준일 종료 + gb4 (str): 0:전체, 1:결산배당, 2:중간배당 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 배당률 상위 데이터 + + Example: + >>> df = dividend_rate( + ... cts_area=" ", + ... gb1="1", + ... upjong="0001", + ... gb2="0", + ... gb3="1", + ... f_dt="20230101", + ... t_dt="20231231", + ... gb4="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/dividend-rate" + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '1')") + raise ValueError("gb1 is required. (e.g. '1')") + + if not upjong: + logger.error("upjong is required. (e.g. '0001')") + raise ValueError("upjong is required. (e.g. '0001')") + + if not gb2: + logger.error("gb2 is required. (e.g. '0')") + raise ValueError("gb2 is required. (e.g. '0')") + + if not gb3: + logger.error("gb3 is required. (e.g. '1')") + raise ValueError("gb3 is required. (e.g. '1')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + if not gb4: + logger.error("gb4 is required. (e.g. '0')") + raise ValueError("gb4 is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB13470100" + + params = { + "CTS_AREA": cts_area, + "GB1": gb1, + "UPJONG": upjong, + "GB2": gb2, + "GB3": gb3, + "F_DT": f_dt, + "T_DT": t_dt, + "GB4": gb4, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return dividend_rate( + cts_area, + gb1, + upjong, + gb2, + gb3, + f_dt, + t_dt, + gb4, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목추정실적[국내주식-187] +############################################################################################## + +def estimate_perform( + sht_cd: str, # 종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + dataframe4: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output4) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 종목추정실적[국내주식-187] + 국내주식 종목추정실적 API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 종목코드 (예: 265520) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + dataframe4 (Optional[pd.DataFrame]): 누적 데이터프레임 (output4) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]: 국내주식 종목추정실적 데이터 + + Example: + >>> df1, df2, df3, df4 = estimate_perform("265520") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/estimate-perform" + # 필수 파라미터 검증 + if not sht_cd: + logger.error("sht_cd is required. (e.g. '265520')") + raise ValueError("sht_cd is required. (e.g. '265520')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return ( + dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame(), + dataframe3 if dataframe3 is not None else pd.DataFrame(), + dataframe4 if dataframe4 is not None else pd.DataFrame() + ) + + tr_id = "HHKST668300C0" + + params = { + "SHT_CD": sht_cd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + current_data3 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe3 = pd.concat([dataframe3, current_data3], + ignore_index=True) if dataframe3 is not None else current_data3 + else: + dataframe3 = pd.DataFrame() if dataframe3 is None else dataframe3 + + # output4 처리 + if hasattr(res.getBody(), 'output4'): + output_data = res.getBody().output4 + if output_data: + current_data4 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe4 = pd.concat([dataframe4, current_data4], + ignore_index=True) if dataframe4 is not None else current_data4 + else: + dataframe4 = pd.DataFrame() if dataframe4 is None else dataframe4 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return estimate_perform( + sht_cd, dataframe1, dataframe2, dataframe3, dataframe4, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3, dataframe4 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 장마감 예상체결가[국내주식-120] +############################################################################################## + +def exp_closing_price( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + fid_rank_sort_cls_code: str, # [필수] 순위정렬구분코드 (ex. 0:전체, 1:상한가마감예상, 2:하한가마감예상, 3:직전대비상승률상위, 4:직전대비하락률상위) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11173) + fid_blng_cls_code: str # [필수] 소속구분코드 (ex. 0:전체, 1:종가범위연장) +) -> pd.DataFrame: + """ + 국내주식 장마감 예상체결가 API입니다. + 한국투자 HTS(eFriend Plus) > [0183] 장마감 예상체결가 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:전체, 1:상한가마감예상, 2:하한가마감예상, 3:직전대비상승률상위, 4:직전대비하락률상위) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11173) + fid_blng_cls_code (str): [필수] 소속구분코드 (ex. 0:전체, 1:종가범위연장) + + Returns: + pd.DataFrame: 국내주식 장마감 예상체결가 데이터 + + Example: + >>> df = exp_closing_price("J", "0001", "0", "11173", "0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/exp-closing-price" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000', '0001', '1001', '2001', '4001')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0', '1', '2', '3', '4')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11173')") + + if fid_blng_cls_code == "": + raise ValueError("fid_blng_cls_code is required (e.g. '0', '1')") + + tr_id = "FHKST117300C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결지수 추이[국내주식-121] +############################################################################################## + +def exp_index_trend( + fid_mkop_cls_code: str, # 장운영 구분 코드 + fid_input_hour_1: str, # 입력 시간1 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식 예상체결지수 추이[국내주식-121] + 국내주식 예상체결지수 추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_mkop_cls_code (str): 1: 장시작전, 2: 장마감 + fid_input_hour_1 (str): 10(10초), 30(30초), 60(1분), 600(10분) + fid_input_iscd (str): 0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 예상체결지수 추이 데이터 + + Example: + >>> df = exp_index_trend('1', '10', '0000', 'U') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/exp-index-trend" + # 필수 파라미터 검증 + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '1')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '1')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01840000" + + params = { + "FID_MKOP_CLS_CODE": fid_mkop_cls_code, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return exp_index_trend( + fid_mkop_cls_code, + fid_input_hour_1, + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 예상체결가 추이[국내주식-118] +############################################################################################## + +def exp_price_trend( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # 입력 종목코드 (ex. 123456) + fid_mkop_cls_code: str # (ex. 0:전체, 4:체결량 0 제외) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 예상체결가 추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0184] 예상체결지수 추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 최대 30건 확인 가능하며, 다음 조회가 불가합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_mkop_cls_code (str): [필수] (ex. 0:전체, 4:체결량 0 제외) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터 + + Example: + >>> output1, output2 = exp_price_trend("J", "005930", "0") + >>> print(output1) + >>> print(output2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/exp-price-trend" + + if not fid_cond_mrkt_div_code: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if not fid_input_iscd: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if not fid_mkop_cls_code: + raise ValueError("fid_mkop_cls_code is required (e.g. '0')") + + tr_id = "FHPST01810000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_MKOP_CLS_CODE": fid_mkop_cls_code, + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame([res.getBody().output1]) + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내주식 예상체결 전체지수[국내주식-122] +############################################################################################## + +def exp_total_index( + fid_mrkt_cls_code: str, # 시장 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_mkop_cls_code: str, # 장운영 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식 예상체결 전체지수[국내주식-122] + 국내주식 예상체결 전체지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_mrkt_cls_code (str): 0:전체 K:거래소 Q:코스닥 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_cond_scr_div_code (str): Unique key(11175) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_mkop_cls_code (str): 1:장시작전, 2:장마감 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 예상체결 전체지수 데이터 + + Example: + >>> df1, df2 = exp_total_index( + ... fid_mrkt_cls_code="K", + ... fid_cond_mrkt_div_code="U", + ... fid_cond_scr_div_code="11175", + ... fid_input_iscd="1001", + ... fid_mkop_cls_code="1" + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/exp-total-index" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'K')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'K')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11175')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11175')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '1001')") + raise ValueError("fid_input_iscd is required. (e.g. '1001')") + + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '1')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKUP11750000" + + params = { + "fid_mrkt_cls_code": fid_mrkt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_mkop_cls_code": fid_mkop_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return exp_total_index( + fid_mrkt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_mkop_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 예상체결 상승_하락상위[v1_국내주식-103] +############################################################################################## + +def exp_trans_updown( + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_vol_cnt: str, # 거래량 수 + fid_pbmn: str, # 거래대금 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_mkop_cls_code: str, # 장운영 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 예상체결 상승_하락상위[v1_국내주식-103] + 국내주식 예상체결 상승_하락상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_rank_sort_cls_code (str): 0:상승률1:상승폭2:보합3:하락율4:하락폭5:체결량6:거래대금 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20182) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_div_cls_code (str): 0:전체 1:보통주 2:우선주 + fid_aply_rang_prc_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_pbmn (str): 입력값 없을때 전체 (거래대금 ~) 천원단위 + fid_blng_cls_code (str): 0: 전체 + fid_mkop_cls_code (str): 0:장전예상1:장마감예상 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 예상체결 상승_하락상위 데이터 + + Example: + >>> df = exp_trans_updown( + ... fid_rank_sort_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20182", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_aply_rang_prc_1="", + ... fid_vol_cnt="", + ... fid_pbmn="", + ... fid_blng_cls_code="0", + ... fid_mkop_cls_code="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/exp-trans-updown" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20182')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20182')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + if not fid_mkop_cls_code: + logger.error("fid_mkop_cls_code is required. (e.g. '0')") + raise ValueError("fid_mkop_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01820000" + + params = { + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_vol_cnt": fid_vol_cnt, + "fid_pbmn": fid_pbmn, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_mkop_cls_code": fid_mkop_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return exp_trans_updown( + fid_rank_sort_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_aply_rang_prc_1, + fid_vol_cnt, + fid_pbmn, + fid_blng_cls_code, + fid_mkop_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 대차대조표 [v1_국내주식-078] +############################################################################################## + +def finance_balance_sheet( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 대차대조표[v1_국내주식-078] + 국내주식 대차대조표 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0: 년, 1: 분기 + fid_cond_mrkt_div_code (str): J + fid_input_iscd (str): 000660 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 대차대조표 데이터 + + Example: + >>> df = finance_balance_sheet("0", "J", "000660") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/balance-sheet" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430100" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_balance_sheet( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 재무비율 [v1_국내주식-080] +############################################################################################## + +def finance_financial_ratio( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 재무비율[v1_국내주식-080] + 국내주식 재무비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0: 년, 1: 분기 + fid_cond_mrkt_div_code (str): J + fid_input_iscd (str): 000660 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 재무비율 데이터 + + Example: + >>> df = finance_financial_ratio("0", "J", "000660") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/financial-ratio" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430300" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_financial_ratio( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 성장성비율 [v1_국내주식-085] +############################################################################################## + +def finance_growth_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 성장성비율[v1_국내주식-085] + 국내주식 성장성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 입력 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 성장성비율 데이터 + + Example: + >>> df = finance_growth_ratio('005930', '1', 'J') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/growth-ratio" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API URL 및 거래 ID 설정 + tr_id = "FHKST66430800" + + # 요청 파라미터 설정 + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_growth_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 손익계산서 [v1_국내주식-079] +############################################################################################## + +def finance_income_statement( + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + 국내주식 손익계산서 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + fid_input_iscd (str): 입력 종목코드 (예: '000660') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 손익계산서 데이터 + + Example: + >>> df = finance_income_statement('1', 'J', '005930') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/income-statement" + # 필수 파라미터 검증 + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430200" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_input_iscd": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_income_statement( + fid_div_cls_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 기타주요비율[v1_국내주식-082] +############################################################################################## + +def finance_other_major_ratios( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 기타주요비율[v1_국내주식-082] + 국내주식 기타주요비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (예: '0' - 년, '1' - 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 기타주요비율 데이터 + + Example: + >>> df = finance_other_major_ratios('005930', '1', 'J') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/other-major-ratios" + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430500" + + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_other_major_ratios( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 수익성비율[v1_국내주식-081] +############################################################################################## + +def finance_profit_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 수익성비율[v1_국내주식-081] + 국내주식 수익성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 입력 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (0: 년, 1: 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 수익성비율 데이터 + + Example: + >>> df = finance_profit_ratio('005930', '1', 'J') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/profit-ratio" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430400" + + params = { + "fid_input_iscd": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_profit_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 재무비율 순위[v1_국내주식-092] +############################################################################################## + +def finance_ratio( + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 재무비율 순위[v1_국내주식-092] + 국내주식 재무비율 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_cls_code (str): 대상 구분 코드 (0 : 전체) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (Unique key, 20175) + fid_input_iscd (str): 입력 종목코드 (0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200) + fid_div_cls_code (str): 분류 구분 코드 (0 : 전체) + fid_input_price_1 (str): 입력 가격1 (입력값 없을때 전체, 가격 ~) + fid_input_price_2 (str): 입력 가격2 (입력값 없을때 전체, ~ 가격) + fid_vol_cnt (str): 거래량 수 (입력값 없을때 전체, 거래량 ~) + fid_input_option_1 (str): 입력 옵션1 (회계년도 입력, ex 2023) + fid_input_option_2 (str): 입력 옵션2 (0: 1/4분기, 1: 반기, 2: 3/4분기, 3: 결산) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (7: 수익성 분석, 11: 안정성 분석, 15: 성장성 분석, 20: 활동성 분석) + fid_blng_cls_code (str): 소속 구분 코드 (0) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (0 : 전체) + tr_cont (str): 연속 거래 여부 (공백 : 초기 조회, N : 다음 데이터 조회) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 재무비율 순위 데이터 + + Example: + >>> df = finance_ratio( + ... fid_trgt_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20175", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="3", + ... fid_rank_sort_cls_code="7", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/finance-ratio" + # 필수 파라미터 검증 + if fid_trgt_cls_code == "": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20175": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["7", "11", "15", "20"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code != "0": + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01750000" + + params = { + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return finance_ratio( + fid_trgt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 안정성비율[v1_국내주식-083] +############################################################################################## + +def finance_stability_ratio( + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 안정성비율[v1_국내주식-083] + 국내주식 안정성비율 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 종목코드 (예: '000660') + fid_div_cls_code (str): 분류 구분 코드 (예: '0' - 년, '1' - 분기) + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (예: 'J') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 안정성비율 데이터 + + Example: + >>> df = finance_stability_ratio('005930', '1', 'J') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/finance/stability-ratio" + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0' or '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '0' or '1')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHKST66430600" + + params = { + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return finance_stability_ratio( + fid_input_iscd, + fid_div_cls_code, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 등락률 순위[v1_국내주식-088] +############################################################################################## + +def fluctuation( + fid_cond_mrkt_div_code: str, # 필수, 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 필수, 조건 화면 분류 코드 + fid_input_iscd: str, # 필수, 입력 종목코드 + fid_rank_sort_cls_code: str, # 필수, 순위 정렬 구분 코드 + fid_input_cnt_1: str, # 필수, 입력 수1 + fid_prc_cls_code: str, # 필수, 가격 구분 코드 + fid_input_price_1: str, # 필수, 입력 가격1 + fid_input_price_2: str, # 필수, 입력 가격2 + fid_vol_cnt: str, # 필수, 거래량 수 + fid_trgt_cls_code: str, # 필수, 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 필수, 대상 제외 구분 코드 + fid_div_cls_code: str, # 필수, 분류 구분 코드 + fid_rsfl_rate1: str, # 필수, 등락 비율1 + fid_rsfl_rate2: str, # 필수, 등락 비율2 + tr_cont: str = "", # 선택, 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 선택, 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 등락률 순위[v1_국내주식-088] + 국내주식 등락률 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (20170: 등락률) + fid_input_iscd (str): 입력 종목코드 (0000: 전체) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (0000: 등락률순) + fid_input_cnt_1 (str): 입력 수1 (조회할 종목 수) + fid_prc_cls_code (str): 가격 구분 코드 (0: 전체) + fid_input_price_1 (str): 입력 가격1 (하한가) + fid_input_price_2 (str): 입력 가격2 (상한가) + fid_vol_cnt (str): 거래량 수 (최소 거래량) + fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 증거금30% 40% 50% 60% 100% 신용보증금30% 40% 50% 60%) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + fid_div_cls_code (str): 분류 구분 코드 (0: 전체) + fid_rsfl_rate1 (str): 등락 비율1 (하락률 하한) + fid_rsfl_rate2 (str): 등락 비율2 (상승률 상한) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: API 응답 데이터 + + Example: + >>> df = fluctuation(fid_rsfl_rate2="10", fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20170", fid_input_iscd="0000", fid_rank_sort_cls_code="0000", fid_input_cnt_1="10", fid_prc_cls_code="0", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_trgt_cls_code="0", fid_trgt_exls_cls_code="0", fid_div_cls_code="0", fid_rsfl_rate1="0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/fluctuation" + if fid_cond_mrkt_div_code not in ["J", "W", "Q"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + + if fid_cond_scr_div_code != "20170": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + + tr_id = "FHPST01700000" # 국내주식 등락률 순위 + + params = { + "fid_rsfl_rate2": fid_rsfl_rate2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + "fid_prc_cls_code": fid_prc_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rsfl_rate1": fid_rsfl_rate1 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": # 다음 페이지 존재 + print("Call Next") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return fluctuation( + fid_rsfl_rate2, fid_cond_mrkt_div_code, fid_cond_scr_div_code, + fid_input_iscd, fid_rank_sort_cls_code, fid_input_cnt_1, + fid_prc_cls_code, fid_input_price_1, fid_input_price_2, + fid_vol_cnt, fid_trgt_cls_code, fid_trgt_exls_cls_code, + fid_div_cls_code, fid_rsfl_rate1, "N", dataframe + ) + else: + print("The End") + return dataframe + else: + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내기관_외국인 매매종목가집계[국내주식-037] +############################################################################################## + +def foreign_institution_total( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류구분코드 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_etc_cls_code: str # 기타구분정렬 +) -> pd.DataFrame: + """ + 국내기관_외국인 매매종목가집계 API입니다. + + HTS(efriend Plus) [0440] 외국인/기관 매매종목 가집계 화면을 API로 구현한 사항으로 화면을 함께 보시면 기능 이해가 쉽습니다. + + 증권사 직원이 장중에 집계/입력한 자료를 단순 누계한 수치로서, + 입력시간은 외국인 09:30, 11:20, 13:20, 14:30 / 기관종합 10:00, 11:20, 13:20, 14:30 이며, + 입력한 시간은 ±10분정도 차이가 발생할 수 있으며, 장운영 사정에 다라 변동될 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. V) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 16449) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0000:전체,0001:코스피,1001:코스닥,...,FAQ 종목정보 다운로드(국내) - 업종코드 참조 ) + fid_div_cls_code (str): [필수] 분류구분코드 (ex. 0:수량정열, 1:금액정열) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:순매수상위,1:순매도상위) + fid_etc_cls_code (str): [필수] 기타구분정렬 (ex. 0:전체,1:외국인,2:기관계,3:기타) + + Returns: + pd.DataFrame: 국내기관_외국인 매매종목가집계 데이터 + + Example: + >>> df = foreign_institution_total("V", "16449", "0000", "0", "0", "0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/foreign-institution-total" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'V')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '16449')") + + if fid_input_iscd == "": + raise ValueError( + "fid_input_iscd is required (e.g. '0000:전체,0001:코스피,1001:코스닥,...,FAQ 종목정보 다운로드(국내) - 업종코드 참조 ')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0:수량정열, 1:금액정열')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0:순매수상위,1:순매도상위')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '0:전체,1:외국인,2:기관계,3:기타')") + + tr_id = "FHPTJ04400000" # 국내기관_외국인 매매종목가집계 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, # 조건화면분류코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_DIV_CLS_CODE": fid_div_cls_code, # 분류구분코드 + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, # 순위정렬구분코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code # 기타구분정렬 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외국계 순매수추이 [국내주식-164] +############################################################################################## + +def frgnmem_pchs_trend( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # 입력 종목코드 (ex. 123456) + fid_input_iscd_2: str # 입력 종목코드 (ex. 99999) +) -> pd.DataFrame: + """ + 종목별 외국계 순매수추이 API입니다. + 한국투자 HTS(eFriend Plus) > [0433] 종목별 외국계 순매수추이 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_iscd_2 (str): [필수] 입력 종목코드 (ex. 99999) + + Returns: + pd.DataFrame: 종목별 외국계 순매수추이 데이터 + + Example: + >>> df = frgnmem_pchs_trend("J", "005930", "99999") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/frgnmem-pchs-trend" + + if not fid_cond_mrkt_div_code: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if not fid_input_iscd: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if not fid_input_iscd_2: + raise ValueError("fid_input_iscd_2 is required (e.g. '99999')") + + tr_id = "FHKST644400C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output_data = pd.DataFrame(res.getBody().output) + + logging.info("Data fetch complete.") + return output_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 외국계 매매종목 가집계 [국내주식-161] +############################################################################################## + +def frgnmem_trade_estimate( + fid_cond_mrkt_div_code: str, + fid_cond_scr_div_code: str, + fid_input_iscd: str, + fid_rank_sort_cls_code: str, + fid_rank_sort_cls_code_2: str +) -> pd.DataFrame: + """ + 외국계 매매종목 가집계 API입니다. + 한국투자 HTS(eFriend Plus) > [0430] 외국계 매매종목 가집계 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 16441) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 0000:전체, 1001:코스피, 2001:코스닥) + fid_rank_sort_cls_code (str): [필수] 순위정렬구분코드 (ex. 0:금액순, 1:수량순) + fid_rank_sort_cls_code_2 (str): [필수] 순위정렬구분코드2 (ex. 0:매수순, 1:매도순) + + Returns: + pd.DataFrame: 외국계 매매종목 가집계 데이터 + + Example: + >>> df = frgnmem_trade_estimate("J", "16441", "0000", "0", "0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/frgnmem-trade-estimate" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '16441')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0')") + + if fid_rank_sort_cls_code_2 == "": + raise ValueError("fid_rank_sort_cls_code_2 is required (e.g. '0')") + + tr_id = "FHKST644100C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_RANK_SORT_CLS_CODE_2": fid_rank_sort_cls_code_2 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 회원사 실 시간 매매동향(틱)[국내주식-163] +############################################################################################## + +def frgnmem_trade_trend( + fid_cond_scr_div_code: str, # 화면분류코드 + fid_cond_mrkt_div_code: str, # 조건시장구분코드 + fid_input_iscd: str, # 종목코드 + fid_input_iscd_2: str, # 회원사코드 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_vol_cnt: str, # 거래량 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 시세분석 + 회원사 실 시간 매매동향(틱)[국내주식-163] + 회원사 실 시간 매매동향(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 20432(primary key) + fid_cond_mrkt_div_code (str): J 고정입력 + fid_input_iscd (str): ex. 005930(삼성전자) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력 + fid_input_iscd_2 (str): ex. 99999(전체) ※ 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조) + fid_mrkt_cls_code (str): A(전체),K(코스피), Q(코스닥), K2(코스피200), W(ELW) ※ FID_INPUT_ISCD(종목코드) 혹은 FID_MRKT_CLS_CODE(시장구분코드) 둘 중 하나만 입력 + fid_vol_cnt (str): 거래량 ~ + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 회원사 실 시간 매매동향(틱) 데이터 + + Example: + >>> df1, df2 = frgnmem_trade_trend( + ... fid_cond_scr_div_code="20432", + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_iscd_2="99999", + ... fid_mrkt_cls_code="A", + ... fid_vol_cnt="1000" + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/frgnmem-trade-trend" + # [필수 파라미터 검증] + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20432')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20432')") + if not fid_cond_mrkt_div_code or fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '99999')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '99999')") + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPST04320000" + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_VOL_CNT": fid_vol_cnt, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return frgnmem_trade_trend( + fid_cond_scr_div_code, + fid_input_iscd, + fid_input_iscd_2, + fid_mrkt_cls_code, + fid_vol_cnt, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > HTS조회상위20종목[국내주식-214] +############################################################################################## + +def hts_top_view( + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + HTS조회상위20종목[국내주식-214] + HTS조회상위20종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + tr_cont (str): 연속 거래 여부 ("공백": 초기 조회, "N": 다음 데이터 조회) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: HTS조회상위20종목 데이터 + + Example: + >>> df = hts_top_view(tr_cont="", dataframe=None, depth=0, max_depth=10) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/hts-top-view" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHMCM000100C0" + + # Request Query Parameter가 없으므로 빈 딕셔너리로 유지 + params = {} + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 다음 페이지 호출 여부 결정 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return hts_top_view( + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 투자계좌자산현황조회[v1_국내주식-048] +############################################################################################## + +def inquire_account_balance( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 19 or 21) + inqr_dvsn_1: str = "", # 조회구분1 + bspr_bf_dt_aply_yn: str = "" # 기준가이전일자적용여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 투자계좌자산현황조회 API입니다. + + output1은 한국투자 HTS(eFriend Plus) > [0891] 계좌 자산비중(결제기준) 화면 아래 테이블의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 19 or 21) + inqr_dvsn_1 (str): 조회구분1 + bspr_bf_dt_aply_yn (str): 기준가이전일자적용여부 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_account_balance("12345678", "21") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-account-balance" + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '19' or '21')") + + tr_id = "CTRP6548R" # 투자계좌자산현황조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_DVSN_1": inqr_dvsn_1, # 조회구분1 + "BSPR_BF_DT_APLY_YN": bspr_bf_dt_aply_yn # 기준가이전일자적용여부 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 - array 타입 + df1 = pd.DataFrame(res.getBody().output1) + + # output2 - object 타입 (단일 객체를 DataFrame으로 변환) + df2 = pd.DataFrame([res.getBody().output2]) + + logging.info("Data fetch complete.") + return df1, df2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 호가/예상체결[v1_국내주식-011] +############################################################################################## + +def inquire_asking_price_exp_ccn( + env_dv: str, # 실전모의구분 (real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # 입력 종목코드 (123456) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 호가 예상체결 API입니다. 매수 매도 호가를 확인하실 수 있습니다. 실시간 데이터를 원하신다면 웹소켓 API를 활용하세요. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (호가정보, 예상체결정보) 데이터 + + Example: + >>> result1, result2 = inquire_asking_price_exp_ccn(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(result1) # 호가정보 + >>> print(result2) # 예상체결정보 + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHKST01010200" + elif env_dv == "demo": + tr_id = "FHKST01010200" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd # 입력 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> 호가정보 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) -> 예상체결정보 + output2_data = pd.DataFrame([res.getBody().output2]) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회[v1_국내주식-006] +############################################################################################## + +def inquire_balance( + env_dv: str, # 실전모의구분 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + afhr_flpr_yn: str, # 시간외단일가·거래소여부 + inqr_dvsn: str, # 조회구분 + unpr_dvsn: str, # 단가구분 + fund_sttl_icld_yn: str, # 펀드결제분포함여부 + fncg_amt_auto_rdpt_yn: str, # 융자금액자동상환여부 + prcs_dvsn: str, # 처리구분 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식 잔고조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 50건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + * 당일 전량매도한 잔고도 보유수량 0으로 보여질 수 있으나, 해당 보유수량 0인 잔고는 최종 D-2일 이후에는 잔고에서 사라집니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + afhr_flpr_yn (str): [필수] 시간외단일가·거래소여부 (ex. N:기본값, Y:시간외단일가, X:NXT) + inqr_dvsn (str): [필수] 조회구분 (ex. 01 – 대출일별 | 02 – 종목별) + unpr_dvsn (str): [필수] 단가구분 (ex. 01) + fund_sttl_icld_yn (str): [필수] 펀드결제분포함여부 (ex. N, Y) + fncg_amt_auto_rdpt_yn (str): [필수] 융자금액자동상환여부 (ex. N) + prcs_dvsn (str): [필수] 처리구분 (ex. 00: 전일매매포함, 01:전일매매미포함) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주식잔고조회 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_balance(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, afhr_flpr_yn="N", inqr_dvsn="01", unpr_dvsn="01", fund_sttl_icld_yn="N", fncg_amt_auto_rdpt_yn="N", prcs_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-balance" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if afhr_flpr_yn == "": + raise ValueError("afhr_flpr_yn is required (e.g. 'N:기본값, Y:시간외단일가, X:NXT')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '01 – 대출일별 | 02 – 종목별')") + + if unpr_dvsn == "": + raise ValueError("unpr_dvsn is required (e.g. '01')") + + if fund_sttl_icld_yn == "": + raise ValueError("fund_sttl_icld_yn is required (e.g. 'N, Y')") + + if fncg_amt_auto_rdpt_yn == "": + raise ValueError("fncg_amt_auto_rdpt_yn is required (e.g. 'N')") + + if prcs_dvsn == "": + raise ValueError("prcs_dvsn is required (e.g. '00: 전일매매포함, 01:전일매매미포함')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC8434R" + elif env_dv == "demo": + tr_id = "VTTC8434R" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "AFHR_FLPR_YN": afhr_flpr_yn, + "OFL_YN": "", + "INQR_DVSN": inqr_dvsn, + "UNPR_DVSN": unpr_dvsn, + "FUND_STTL_ICLD_YN": fund_sttl_icld_yn, + "FNCG_AMT_AUTO_RDPT_YN": fncg_amt_auto_rdpt_yn, + "PRCS_DVSN": prcs_dvsn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance( + env_dv, cano, acnt_prdt_cd, afhr_flpr_yn, inqr_dvsn, unpr_dvsn, + fund_sttl_icld_yn, fncg_amt_auto_rdpt_yn, prcs_dvsn, FK100, NK100, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익[v1_국내주식-041] +############################################################################################## + +def inquire_balance_rlz_pl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + afhr_flpr_yn: str, # 시간외단일가여부 + inqr_dvsn: str, # 조회구분 + unpr_dvsn: str, # 단가구분 + fund_sttl_icld_yn: str, # 펀드결제포함여부 + fncg_amt_auto_rdpt_yn: str, # 융자금액자동상환여부 + prcs_dvsn: str, # PRCS_DVSN + ofl_yn: str = "", # 오프라인여부 + cost_icld_yn: str = "", # 비용포함여부 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식잔고조회_실현손익 API입니다. + 한국투자 HTS(eFriend Plus) [0800] 국내 체결기준잔고 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + (참고: 포럼 - 공지사항 - 신규 API 추가 안내(주식잔고조회_실현손익 외 1건)) + + Args: + cano (str): [필수] 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + afhr_flpr_yn (str): [필수] 시간외단일가여부 (N:기본값, Y:시간외단일가) + inqr_dvsn (str): [필수] 조회구분 (00:전체) + unpr_dvsn (str): [필수] 단가구분 (01:기본값) + fund_sttl_icld_yn (str): [필수] 펀드결제포함여부 (N:포함하지 않음, Y:포함) + fncg_amt_auto_rdpt_yn (str): [필수] 융자금액자동상환여부 (N:기본값) + prcs_dvsn (str): [필수] PRCS_DVSN (00:전일매매포함, 01:전일매매미포함) + ofl_yn (str): 오프라인여부 + cost_icld_yn (str): 비용포함여부 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 주식잔고조회_실현손익 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_balance_rlz_pl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, afhr_flpr_yn="N", inqr_dvsn="02", unpr_dvsn="01", fund_sttl_icld_yn="N", fncg_amt_auto_rdpt_yn="N", prcs_dvsn="01") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl" + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if afhr_flpr_yn == "": + raise ValueError("afhr_flpr_yn is required (e.g. 'N:기본값, Y:시간외단일가')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00:전체')") + + if unpr_dvsn == "": + raise ValueError("unpr_dvsn is required (e.g. '01:기본값')") + + if fund_sttl_icld_yn == "": + raise ValueError("fund_sttl_icld_yn is required (e.g. 'N:포함하지 않음, Y:포함')") + + if fncg_amt_auto_rdpt_yn == "": + raise ValueError("fncg_amt_auto_rdpt_yn is required (e.g. 'N:기본값')") + + if prcs_dvsn == "": + raise ValueError("prcs_dvsn is required (e.g. '00:전일매매포함, 01:전일매매미포함')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8494R" # 주식잔고조회_실현손익 + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "AFHR_FLPR_YN": afhr_flpr_yn, + "OFL_YN": ofl_yn, + "INQR_DVSN": inqr_dvsn, + "UNPR_DVSN": unpr_dvsn, + "FUND_STTL_ICLD_YN": fund_sttl_icld_yn, + "FNCG_AMT_AUTO_RDPT_YN": fncg_amt_auto_rdpt_yn, + "PRCS_DVSN": prcs_dvsn, + "COST_ICLD_YN": cost_icld_yn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_balance_rlz_pl( + cano, acnt_prdt_cd, afhr_flpr_yn, inqr_dvsn, unpr_dvsn, + fund_sttl_icld_yn, fncg_amt_auto_rdpt_yn, prcs_dvsn, + ofl_yn, cost_icld_yn, FK100, NK100, "N", + dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 체결[v1_국내주식-009] +############################################################################################## + +def inquire_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내현재가 체결 API 입니다. 종목의 체결 정보를 확인할 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 체결 데이터 + + Example: + >>> df = inquire_ccnl("real", "J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-ccnl" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전', 'demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX', 'NX:NXT', 'UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010300" + elif env_dv == "demo": + tr_id = "FHKST01010300" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 신용매수가능조회[v1_국내주식-042] +############################################################################################## + +def inquire_credit_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 종목코드 + ord_dvsn: str, # 주문구분 + crdt_type: str, # 신용유형 + cma_evlu_amt_icld_yn: str, # CMA평가금액포함여부 + ovrs_icld_yn: str, # 해외포함여부 + ord_unpr: str = "" # 주문단가 +) -> pd.DataFrame: + """ + 신용매수가능조회 API입니다. + 신용매수주문 시 주문가능수량과 금액을 확인하실 수 있습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + pdno (str): [필수] 종목코드 + ord_dvsn (str): [필수] 주문구분 (ex. 00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 03 : 최유리지정가, 04 : 최우선지정가, 05 : 장전 시간외, 06 : 장후 시간외, 07 : 시간외 단일가 등) + crdt_type (str): [필수] 신용유형 (ex. 21 : 자기융자신규, 23 : 유통융자신규, 26 : 유통대주상환, 28 : 자기대주상환, 25 : 자기융자상환, 27 : 유통융자상환, 22 : 유통대주신규, 24 : 자기대주신규) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 + ovrs_icld_yn (str): [필수] 해외포함여부 + ord_unpr (str): 주문단가 (ex. 1주당 가격. 장전/장후 시간외, 시장가의 경우 "0" 입력 권고) + + Returns: + pd.DataFrame: 신용매수가능조회 데이터 + + Example: + >>> df = inquire_credit_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_dvsn="00", crdt_type="21", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-credit-psamount" + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError( + "ord_dvsn is required (e.g. '00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 03 : 최유리지정가, 04 : 최우선지정가, 05 : 장전 시간외, 06 : 장후 시간외, 07 : 시간외 단일가 등')") + + if crdt_type == "" or crdt_type is None: + raise ValueError( + "crdt_type is required (e.g. '21 : 자기융자신규, 23 : 유통융자신규, 26 : 유통대주상환, 28 : 자기대주상환, 25 : 자기융자상환, 27 : 유통융자상환, 22 : 유통대주신규, 24 : 자기대주신규')") + + if cma_evlu_amt_icld_yn == "" or cma_evlu_amt_icld_yn is None: + raise ValueError("cma_evlu_amt_icld_yn is required") + + if ovrs_icld_yn == "" or ovrs_icld_yn is None: + raise ValueError("ovrs_icld_yn is required") + + tr_id = "TTTC8909R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_DVSN": ord_dvsn, + "CRDT_TYPE": crdt_type, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "OVRS_ICLD_YN": ovrs_icld_yn, + "ORD_UNPR": ord_unpr + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식일별주문체결조회[v1_국내주식-005] +############################################################################################## + +def inquire_daily_ccld( + env_dv: str, # [필수] 실전모의구분 (real:실전, demo:모의) + pd_dv: str, # [필수] 3개월이전이내구분 (before:이전, inner:이내) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + inqr_strt_dt: str, # [필수] 조회시작일자 + inqr_end_dt: str, # [필수] 조회종료일자 + sll_buy_dvsn_cd: str, # [필수] 매도매수구분코드 (00 : 전체 / 01 : 매도 / 02 : 매수) + ccld_dvsn: str, # [필수] 체결구분 (00 전체 / 01 체결 / 02 미체결) + inqr_dvsn: str, # [필수] 조회구분 (00 역순 / 01 정순) + inqr_dvsn_3: str, # [필수] 조회구분3 (00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환) + pdno: str = "", # 상품번호 + ord_gno_brno: str = "", # 주문채번지점번호 + odno: str = "", # 주문번호 (주문시 한국투자증권 시스템에서 채번된 주문번호) + inqr_dvsn_1: str = "", # 조회구분1 (없음: 전체 / 1: ELW / 2: 프리보드) + FK100: str = "", # 연속조회검색조건100 (공란: 최초 조회 / 이전 조회 Output 사용) + NK100: str = "", # 연속조회키100 (공란: 최초 조회 / 이전 조회 Output 사용) + tr_cont: str = "", # 연속거래여부 + excg_id_dvsn_cd: Optional[str] = "KRX", # 거래소ID구분코드 (KRX / NXT / SOR / ALL) + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식일별주문체결조회 API입니다. + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + 모의계좌의 경우, 한 번의 호출에 최대 15건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + * 다만, 3개월 이전 체결내역 조회(CTSC9115R) 의 경우, + 장중에는 많은 거래량으로 인해 순간적으로 DB가 밀렸거나 응답을 늦게 받거나 하는 등의 이슈가 있을 수 있어 + ① 가급적 장 종료 이후(15:30 이후) 조회하시고 + ② 조회기간(INQR_STRT_DT와 INQR_END_DT 사이의 간격)을 보다 짧게 해서 조회하는 것을 + 권유드립니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + pd_dv (str): [필수] 3개월이전이내구분 (ex. before:이전, inner:이내) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00 : 전체 / 01 : 매도 / 02 : 매수) + pdno (str): 상품번호 + ccld_dvsn (str): [필수] 체결구분 (ex. 00 전체 / 01 체결 / 02 미체결) + inqr_dvsn (str): [필수] 조회구분 (ex. 00 역순 / 01 정순) + inqr_dvsn_3 (str): [필수] 조회구분3 (ex. 00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환) + ord_gno_brno (str): 주문채번지점번호 + odno (str): 주문번호 (ex. 주문시 한국투자증권 시스템에서 채번된 주문번호) + inqr_dvsn_1 (str): 조회구분1 (ex. 없음: 전체 / 1: ELW / 2: 프리보드) + FK100 (str): 연속조회검색조건100 (ex. 공란: 최초 조회 / 이전 조회 Output 사용) + NK100 (str): 연속조회키100 (ex. 공란: 최초 조회 / 이전 조회 Output 사용) + tr_cont (str): 연속거래여부 + excg_id_dvsn_cd (Optional[str]): 거래소ID구분코드 (ex. KRX / NXT / SOR / ALL) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... env_dv="real", pd_dv="inner", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... inqr_strt_dt="20220810", inqr_end_dt="20220810", + ... sll_buy_dvsn_cd="00", pdno="005930", ccld_dvsn="00", + ... inqr_dvsn="00", inqr_dvsn_3="00" + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-daily-ccld" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전', 'demo:모의')") + + if pd_dv == "": + raise ValueError("pd_dv is required (e.g. 'before:이전', 'inner:이내')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00 : 전체 / 01 : 매도 / 02 : 매수')") + + if ccld_dvsn == "": + raise ValueError("ccld_dvsn is required (e.g. '00 전체 / 01 체결 / 02 미체결')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00 역순 / 01 정순')") + + if inqr_dvsn_3 == "": + raise ValueError( + "inqr_dvsn_3 is required (e.g. '00 전체 / 01 현금 / 02 신용 / 03 담보 / 04 대주 / 05 대여 / 06 자기융자신규/상환 / 07 유통융자신규/상환')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + # tr_id 설정 + if env_dv == "real": + if pd_dv == "before": + tr_id = "CTSC9215R" + elif pd_dv == "inner": + tr_id = "TTTC0081R" + else: + raise ValueError("pd_dv can only be 'before' or 'inner'") + elif env_dv == "demo": + if pd_dv == "before": + tr_id = "VTSC9215R" + elif pd_dv == "inner": + tr_id = "VTTC0081R" + else: + raise ValueError("pd_dv can only be 'before' or 'inner'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "PDNO": pdno, + "CCLD_DVSN": ccld_dvsn, + "INQR_DVSN": inqr_dvsn, + "INQR_DVSN_3": inqr_dvsn_3, + "ORD_GNO_BRNO": ord_gno_brno, + "ODNO": odno, + "INQR_DVSN_1": inqr_dvsn_1, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + if excg_id_dvsn_cd is not None: + params["EXCG_ID_DVSN_CD"] = excg_id_dvsn_cd + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 (array) 처리 + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 (object) 처리 + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_daily_ccld( + env_dv, pd_dv, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + sll_buy_dvsn_cd, pdno, ccld_dvsn, inqr_dvsn, inqr_dvsn_3, + ord_gno_brno, odno, inqr_dvsn_1, FK100, NK100, "N", + excg_id_dvsn_cd, dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] +############################################################################################## + +def inquire_daily_indexchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 업종 상세코드 + fid_input_date_1: str, # 조회 시작일자 + fid_input_date_2: str, # 조회 종료일자 + fid_period_div_code: str, # 기간분류코드 + env_dv: str = "real", # [추가] 실전모의구분 (real:실전, demo:모의) + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내주식업종기간별시세(일_주_월_년)[v1_국내주식-021] + 국내주식업종기간별시세(일_주_월_년) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 업종 : U + fid_input_iscd (str): 0001 : 종합 0002 : 대형주 ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_input_date_1 (str): 조회 시작일자 (ex. 20220501) + fid_input_date_2 (str): 조회 종료일자 (ex. 20220530) + fid_period_div_code (str): D:일봉 W:주봉, M:월봉, Y:년봉 + env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real') + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식업종기간별시세(일_주_월_년) 데이터 + + Example: + >>> df1, df2 = inquire_daily_indexchartprice( + ... fid_cond_mrkt_div_code="U", + ... fid_input_iscd="0001", + ... fid_input_date_1="20220501", + ... fid_input_date_2="20220530", + ... fid_period_div_code="D", + ... env_dv="real" # 실전투자 + ... ) + >>> df1, df2 = inquire_daily_indexchartprice( + ... fid_cond_mrkt_div_code="U", + ... fid_input_iscd="0001", + ... fid_input_date_1="20220501", + ... fid_input_date_2="20220530", + ... fid_period_div_code="D", + ... env_dv="demo" # 모의투자 + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20220501')") + raise ValueError("fid_input_date_1 is required. (e.g. '20220501')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20220530')") + raise ValueError("fid_input_date_2 is required. (e.g. '20220530')") + + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + # env_dv 파라미터 검증 (모의투자 지원 로직) + if env_dv not in ["real", "demo"]: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # API 호출 URL 설정 + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKUP03500100" # 실전투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_indexchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + fid_period_div_code, + env_dv, # env_dv 파라미터 추가 + dataframe1, + dataframe2, + "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년)[v1_국내주식-016] +############################################################################################## + +def inquire_daily_itemchartprice( + env_dv: str, # 실전모의구분 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_input_date_1: str, # 입력 날짜 1 + fid_input_date_2: str, # 입력 날짜 2 + fid_period_div_code: str, # 기간분류코드 + fid_org_adj_prc: str # 수정주가 원주가 가격 여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식기간별시세(일/주/월/년) API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_input_date_1 (str): [필수] 입력 날짜 1 (ex. 조회 시작일자) + fid_input_date_2 (str): [필수] 입력 날짜 2 (ex. 조회 종료일자 (최대 100개)) + fid_period_div_code (str): [필수] 기간분류코드 (ex. D:일봉 W:주봉, M:월봉, Y:년봉) + fid_org_adj_prc (str): [필수] 수정주가 원주가 가격 여부 (ex. 0:수정주가 1:원주가) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_daily_itemchartprice("real", "J", "005930", "20220101", "20220809", "D", "1") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자)')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '조회 시작일자')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '조회 종료일자 (최대 100개)')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D:일봉 W:주봉, M:월봉, Y:년봉')") + + if fid_org_adj_prc == "": + raise ValueError("fid_org_adj_prc is required (e.g. '0:수정주가 1:원주가')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHKST03010100" + elif env_dv == "demo": + tr_id = "FHKST03010100" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_ORG_ADJ_PRC": fid_org_adj_prc + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object 타입이므로 DataFrame) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (array 타입이므로 DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return (output1_data, output2_data) + else: + res.printError(url=api_url) + return (pd.DataFrame(), pd.DataFrame()) + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가[v1_국내주식-026] +############################################################################################## + +def inquire_daily_overtimeprice( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str # [필수] 입력 종목코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 시간외일자별주가 API입니다. (최근일 30건만 조회 가능) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> result1, result2 = inquire_daily_overtimeprice("real", "J", "005930") + >>> print(result1) + >>> print(result2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHPST02320000" + elif env_dv == "demo": + tr_id = "FHPST02320000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 일자별[v1_국내주식-010] +############################################################################################## + +def inquire_daily_price( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_period_div_code: str, # [필수] 기간 분류 코드 (ex. D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월) + fid_org_adj_prc: str + # [필수] 수정주가 원주가 가격 (ex. 0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격) +) -> pd.DataFrame: + """ + 주식현재가 일자별 API입니다. 일/주/월별 주가를 확인할 수 있으며 최근 30일(주,별)로 제한되어 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자)) + fid_period_div_code (str): [필수] 기간 분류 코드 (ex. D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월) + fid_org_adj_prc (str): [필수] 수정주가 원주가 가격 (ex. 0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격) + + Returns: + pd.DataFrame: 주식현재가 일자별 데이터 + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Example: + >>> df = inquire_daily_price("real", "J", "005930", "D", "1") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-daily-price" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자)')") + + if fid_period_div_code == "" or fid_period_div_code is None: + raise ValueError("fid_period_div_code is required (e.g. 'D:(일)최근 30거래일, W:(주)최근 30주, M:(월)최근 30개월')") + + if fid_org_adj_prc == "" or fid_org_adj_prc is None: + raise ValueError( + "fid_org_adj_prc is required (e.g. '0:수정주가미반영, 1:수정주가반영, *수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격')") + + # tr_id 설정 (실전/모의 모두 동일) + if env_dv == "real": + tr_id = "FHKST01010400" + elif env_dv == "demo": + tr_id = "FHKST01010400" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_ORG_ADJ_PRC": fid_org_adj_prc + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output은 array 자료형이므로 DataFrame으로 변환 + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별일별매수매도체결량 [v1_국내주식-056] +############################################################################################## + +def inquire_daily_trade_volume( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_period_div_code: str, # FID 기간 분류 코드 + fid_input_date_1: str = "", # FID 입력 날짜1 + fid_input_date_2: str = "" # FID 입력 날짜2 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 종목별일별매수매도체결량 API입니다. 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + 국내주식 종목의 일별 매수체결량, 매도체결량 데이터를 확인할 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] FID 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] FID 입력 종목코드 (ex. 123456) + fid_period_div_code (str): [필수] FID 기간 분류 코드 (ex. D) + fid_input_date_1 (str): FID 입력 날짜1 + fid_input_date_2 (str): FID 입력 날짜2 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = inquire_daily_trade_volume("J", "005930", "D") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-daily-trade-volume" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + if fid_period_div_code == "": + raise ValueError("fid_period_div_code is required (e.g. 'D')") + + tr_id = "FHKST03010800" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) - 단일 레코드 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) - 배열 데이터 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] ELW시세 > ELW 현재가 시세 [v1_국내주식-014] +############################################################################################## + +def inquire_elw_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + env_dv: str = "real", # 실전모의구분 (real:실전, demo:모의) + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 현재가 시세[v1_국내주식-014] + ELW 현재가 시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (예: 'W') + fid_input_iscd (str): FID 입력 종목코드 (예: '000660') + env_dv (str): [추가] 실전모의구분 (real:실전, demo:모의, 기본값: 'real') + tr_cont (str): 연속 거래 여부 (기본값: '') + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 현재가 시세 데이터 + + Example: + >>> df = inquire_elw_price('W', '000660', env_dv='real') # 실전투자 + >>> df = inquire_elw_price('W', '000660', env_dv='demo') # 모의투자 + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-elw-price" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '000660')") + raise ValueError("fid_input_iscd is required. (e.g. '000660')") + + # env_dv 파라미터 검증 (모의투자 지원 로직) + if env_dv not in ["real", "demo"]: + logger.error("env_dv must be 'real' or 'demo'") + raise ValueError("env_dv must be 'real' or 'demo'") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 설정 + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKEW15010000" # 실전투자용 TR ID + + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_elw_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + env_dv, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 구분별전체시세[v1_국내주식-066] +############################################################################################## + +def inquire_index_category_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_cond_scr_div_code: str, # FID 조건 화면 분류 코드 + fid_mrkt_cls_code: str, # FID 시장 구분 코드 + fid_blng_cls_code: str, # FID 소속 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 구분별전체시세[v1_국내주식-066] + 국내업종 구분별전체시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_cond_scr_div_code (str): Unique key( 20214 ) + fid_mrkt_cls_code (str): 시장구분코드(K:거래소, Q:코스닥, K2:코스피200) + fid_blng_cls_code (str): 시장구분코드에 따라 아래와 같이 입력 시장구분코드(K:거래소) 0:전업종, 1:기타구분, 2:자본금구분 3:상업별구분 시장구분코드(Q:코스닥) 0:전업종, 1:기타구분, 2:벤처구분 3:일반구분 시장구분코드(K2:코스닥) 0:전업종 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내업종 구분별전체시세 데이터 + + Example: + >>> df1, df2 = inquire_index_category_price( + ... fid_cond_mrkt_div_code='U', + ... fid_input_iscd='0001', + ... fid_cond_scr_div_code='20214', + ... fid_mrkt_cls_code='K', + ... fid_blng_cls_code='0' + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-index-category-price" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20214')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20214')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'K')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'K')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPUP02140000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_category_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_blng_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 일자별지수 [v1_국내주식-065] +############################################################################################## + +def inquire_index_daily_price( + fid_period_div_code: str, # FID 기간 분류 코드 + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_date_1: str, # FID 입력 날짜1 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 일자별지수[v1_국내주식-065] + 국내업종 일자별지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_period_div_code (str): 일/주/월 구분코드 ( D:일별 , W:주별, M:월별 ) + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + fid_input_date_1 (str): 입력 날짜(ex. 20240223) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내업종 일자별지수 데이터 + + Example: + >>> df1, df2 = inquire_index_daily_price('D', 'U', '0001', '20240223') + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-index-daily-price" + # 필수 파라미터 검증 + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240223')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240223')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPUP02120000" + + params = { + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = pd.DataFrame() if dataframe1 is None else dataframe1 + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = pd.DataFrame() if dataframe2 is None else dataframe2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_daily_price( + fid_period_div_code, + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 현재지수 [v1_국내주식-063] +############################################################################################## + +def inquire_index_price( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 현재지수[v1_국내주식-063] + 국내업종 현재지수 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 업종(U) + fid_input_iscd (str): 코스피(0001), 코스닥(1001), 코스피200(2001) ... 포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 현재지수 데이터 + + Example: + >>> df = inquire_index_price("U", "0001") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-index-price" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + tr_id = "FHPUP02100000" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_price( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(초)[국내주식-064] +############################################################################################## + +def inquire_index_tickprice( + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(초)[국내주식-064] + 국내업종 시간별지수(초) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd (str): 0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 시간별지수(초) 데이터 + + Example: + >>> df = inquire_index_tickprice('0001', 'U') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-index-tickprice" + # 필수 파라미터 검증 + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPUP02110100" + + params = { + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_tickprice( + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내업종 시간별지수(분)[국내주식-119] +############################################################################################## + +def inquire_index_timeprice( + fid_input_hour_1: str, # ?입력 시간1 + fid_input_iscd: str, # 입력 종목코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 국내업종 시간별지수(분)[국내주식-119] + 국내업종 시간별지수(분) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_hour_1 (str): 초단위, 60(1분), 300(5분), 600(10분) + fid_input_iscd (str): 0001:거래소, 1001:코스닥, 2001:코스피200, 3003:KSQ150 + fid_cond_mrkt_div_code (str): 시장구분코드 (업종 U) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내업종 시간별지수(분) 데이터 + + Example: + >>> df = inquire_index_timeprice("60", "0001", "U") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-index-timeprice" + # 필수 파라미터 검증 + if not fid_input_hour_1: + logger.error("fid_input_hour_1 is required. (e.g. '60')") + raise ValueError("fid_input_hour_1 is required. (e.g. '60')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPUP02110200" + + params = { + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_index_timeprice( + fid_input_hour_1, + fid_input_iscd, + fid_cond_mrkt_div_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 투자자[v1_국내주식-012] +############################################################################################## + +def inquire_investor( + env_dv: str, # [필수] 실전모의구분 + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 + fid_input_iscd: str # [필수] 입력 종목코드 +) -> pd.DataFrame: + """ + 주식현재가 투자자 API입니다. 개인, 외국인, 기관 등 투자 정보를 확인할 수 있습니다. + + [유의사항] + - 외국인은 외국인(외국인투자등록 고유번호가 있는 경우)+기타 외국인을 지칭합니다. + - 당일 데이터는 장 종료 후 제공됩니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 투자자 데이터 + + Example: + >>> df = inquire_investor(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-investor" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010900" + elif env_dv == "demo": + tr_id = "FHKST01010900" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(일별) [국내주식-075] +############################################################################################## + +def inquire_investor_daily_by_market( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. U:업종) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 0001) + fid_input_date_1: str, # [필수] 입력 날짜1 (ex. 20250701) + fid_input_iscd_1: str, # [필수] 입력 종목코드 (ex. KSP:코스피, KSQ:코스닥) + fid_input_date_2: str, # [필수] 입력 날짜1과 동일날짜 입력 + fid_input_iscd_2: str, # [필수] 입력 종목코드 (ex. 업종분류코드) + +) -> pd.DataFrame: + """ + 시장별 투자자매매동향(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0404] 시장별 일별동향 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. U:업종) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0001) + fid_input_date_1 (str): [필수] 입력 날짜1 (ex. 20250701) + fid_input_iscd_1 (str): [필수] 입력 종목코드 (ex. KSP:코스피, KSQ:코스닥) + fid_input_date_2 (str): [필수] 입력 날짜1과 동일날짜 입력 + fid_input_iscd_2 (str): [필수] 입력 종목코드 (ex. 업종분류코드) + + Returns: + pd.DataFrame: 시장별 투자자매매동향(일별) 데이터 + + Example: + >>> df = inquire_investor_daily_by_market("U", "0001", "20250701", "KSP", "20250701", "0001") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-investor-daily-by-market" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'U')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0001')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20250701')") + + if fid_input_iscd_1 == "": + raise ValueError("fid_input_iscd_1 is required (e.g. 'KSP')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20250701')") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required (e.g. 업종분류코드')") + + tr_id = "FHPTJ04040000" # 시장별 투자자매매동향(일별) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + "FID_INPUT_DATE_1": fid_input_date_1, # 입력 날짜1 + "FID_INPUT_ISCD_1": fid_input_iscd_1, # 입력 종목코드 + "FID_INPUT_DATE_2": fid_input_date_2, # 입력 날짜2 + "FID_INPUT_ISCD_2": fid_input_iscd_2, # 입력 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 시장별 투자자매매동향(시세)[v1_국내주식-074] +############################################################################################## + +def inquire_investor_time_by_market( + fid_input_iscd: str, # [필수] 시장구분 + fid_input_iscd_2: str # [필수] 업종구분 +) -> pd.DataFrame: + """ + 시장별 투자자매매동향(시세성) API입니다. + 한국투자 HTS(eFriend Plus) > [0403] 시장별 시간동향 의 상단 표 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_input_iscd (str): [필수] 시장구분 + fid_input_iscd_2 (str): [필수] 업종구분 + + Returns: + pd.DataFrame: 시장별 투자자매매동향 데이터 + + Example: + >>> df = inquire_investor_time_by_market(fid_input_iscd="999", fid_input_iscd_2="S001") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-investor-time-by-market" + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required") + + tr_id = "FHPTJ04030000" + + params = { + "FID_INPUT_ISCD": fid_input_iscd, # 시장구분 + "FID_INPUT_ISCD_2": fid_input_iscd_2 # 업종구분 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 회원사[v1_국내주식-013] +############################################################################################## + +def inquire_member( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 주식 현재가 회원사 API입니다. 회원사의 투자 정보를 확인할 수 있습니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 주식현재가 회원사 데이터 + + Example: + >>> df = inquire_member(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-member" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010600" + elif env_dv == "demo": + tr_id = "FHKST01010600" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 주식현재가 회원사 종목매매동향 [국내주식-197] +############################################################################################## + +def inquire_member_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. 주식J) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456) + fid_input_iscd_2: str, # [필수] 회원사코드 (ex. 회원사코드 FAQ 종목정보 다운로드(국내) > 회원사 참조) + fid_input_date_1: str, # [필수] 입력날짜1 + fid_input_date_2: str, # [필수] 입력날짜2 + fid_sctn_cls_code: str = "" # 데이터 순위 (초기값: "") +) -> pd.DataFrame: + """ + 주식현재가 회원사 종목매매동향 API입니다. + 한국투자 HTS(eFriend Plus) > [0454] 증권사 종목매매동향 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:KRX, NX:NXT) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_input_iscd_2 (str): [필수] 회원사코드 (ex. 회원사코드 FAQ 종목정보 다운로드(국내) > 회원사 참조) + fid_input_date_1 (str): [필수] 입력날짜1 + fid_input_date_2 (str): [필수] 입력날짜2 + fid_sctn_cls_code (str): 데이터 순위 (초기값: "") + + Returns: + pd.DataFrame: 주식현재가 회원사 종목매매동향 데이터 + + Example: + >>> df = inquire_member_daily( + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_iscd_2="00003", + ... fid_input_date_1="20240501", + ... fid_input_date_2="20240624" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-member-daily" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_iscd_2 == "": + raise ValueError("fid_input_iscd_2 is required (e.g. '00003')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required") + + tr_id = "FHPST04540000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_SCTN_CLS_CODE": fid_sctn_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외호가[국내주식-077] +############################################################################################## + +def inquire_overtime_asking_price( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 (ex. J:주식) + fid_input_iscd: str, # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 시간외호가 API입니다. + 한국투자 HTS(eFriend Plus) > [0230] 시간외 현재가 화면의 '호가' 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J:주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 국내주식 시간외호가 데이터 + + Example: + >>> df = inquire_overtime_asking_price("J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-overtime-asking-price" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST02300400" # 국내주식 시간외호가 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 시간외현재가[국내주식-076] +############################################################################################## + +def inquire_overtime_price( + fid_cond_mrkt_div_code: str, # [필수] 시장 분류 코드 (ex. J: 주식) + fid_input_iscd: str # [필수] 종목코드 (ex. 005930) +) -> pd.DataFrame: + """ + 국내주식 시간외현재가 API입니다. + 한국투자 HTS(eFriend Plus) > [0230] 시간외 현재가 화면의 좌측 상단기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J: 주식) + fid_input_iscd (str): [필수] 종목코드 (ex. 005930) + + Returns: + pd.DataFrame: 시간외현재가 데이터 + + Example: + >>> df = inquire_overtime_price("J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-overtime-price" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '005930')") + + tr_id = "FHPST02300000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별손익일별합산조회[v1_국내주식-052] +############################################################################################## + +def inquire_period_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + sort_dvsn: str, # 정렬구분 (ex. 00: 최근 순, 01: 과거 순, 02: 최근 순) + inqr_dvsn: str, # 조회구분 (ex. 00) + cblc_dvsn: str, # 잔고구분 (ex. 00: 전체) + pdno: str = "", # 상품번호 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 기간별손익일별합산조회 API입니다. + 한국투자 HTS(eFriend Plus) > [0856] 기간별 매매손익 화면 에서 "일별" 클릭 시의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + sort_dvsn (str): [필수] 정렬구분 (00: 최근 순, 01: 과거 순, 02: 최근 순) + inqr_dvsn (str): [필수] 조회구분 (00) + cblc_dvsn (str): [필수] 잔고구분 (00: 전체) + pdno (str): 상품번호 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 기간별손익일별합산조회 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_period_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20230101", inqr_end_dt="20240301", sort_dvsn="00", inqr_dvsn="00", cblc_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-period-profit" + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if sort_dvsn == "": + raise ValueError("sort_dvsn is required (e.g. '00', '01', '02')") + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '00')") + + if cblc_dvsn == "": + raise ValueError("cblc_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8708R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "SORT_DVSN": sort_dvsn, + "INQR_DVSN": inqr_dvsn, + "CBLC_DVSN": cblc_dvsn, + "PDNO": pdno, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_period_profit( + cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, sort_dvsn, inqr_dvsn, cblc_dvsn, + pdno, NK100, FK100, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별매매손익현황조회[v1_국내주식-060] +############################################################################################## + +def inquire_period_trade_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + sort_dvsn: str, # 정렬구분 (00: 최근, 01:과거, 02:최근) + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + cblc_dvsn: str, # 잔고구분 (00: 전체) + pdno: str = "", # 상품번호 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 기간별매매손익현황조회 API입니다. + 한국투자 HTS(eFriend Plus) > [0856] 기간별 매매손익 화면 에서 "종목별" 클릭 시의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + sort_dvsn (str): [필수] 정렬구분 (ex. 00: 최근, 01:과거, 02:최근) + inqr_strt_dt (str): [필수] 조회시작일자 + inqr_end_dt (str): [필수] 조회종료일자 + cblc_dvsn (str): [필수] 잔고구분 (ex. 00: 전체) + pdno (str): 상품번호 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 기간별매매손익현황 데이터 (output1, output2) + + Example: + >>> df1, df2 = inquire_period_trade_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, sort_dvsn="02", inqr_strt_dt="20230216", inqr_end_dt="20240301", cblc_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-period-trade-profit" + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if sort_dvsn == "": + raise ValueError("sort_dvsn is required (e.g. '00', '01', '02')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required") + + if cblc_dvsn == "": + raise ValueError("cblc_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC8715R" # 기간별매매손익현황조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "SORT_DVSN": sort_dvsn, # 정렬구분 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": cblc_dvsn, # 잔고구분 + "PDNO": pdno, # 상품번호 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data1 = pd.DataFrame(res.getBody().output1) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_period_trade_profit( + cano, acnt_prdt_cd, sort_dvsn, inqr_strt_dt, inqr_end_dt, cblc_dvsn, + pdno, NK100, FK100, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세[v1_국내주식-008] +############################################################################################## + +def inquire_price( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수) +) -> pd.DataFrame: + """ + 주식 현재가 시세 API입니다. 실시간 시세를 원하신다면 웹소켓 API를 활용하세요. + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수) + + Returns: + pd.DataFrame: 주식 현재가 시세 데이터 + + Example: + >>> df = inquire_price("real", "J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-price" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '종목코드 (ex 005930 삼성전자), ETN은 종목코드 6자리 앞에 Q 입력 필수')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHKST01010100" + elif env_dv == "demo": + tr_id = "FHKST01010100" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세2[v1_국내주식-054] +############################################################################################## + +def inquire_price_2( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 +) -> pd.DataFrame: + """ + 주식현재가 시세2 API입니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + pd.DataFrame: 주식현재가 시세2 데이터 + + Example: + >>> df = inquire_price_2("J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-price-2" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + tr_id = "FHPST01010000" # 주식현재가 시세2 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 매수가능조회[v1_국내주식-007] +############################################################################################## + +def inquire_psbl_order( + env_dv: str, # 실전모의구분 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + ord_unpr: str, # 주문단가 + ord_dvsn: str, # 주문구분 + cma_evlu_amt_icld_yn: str, # CMA평가금액포함여부 + ovrs_icld_yn: str # 해외포함여부 +) -> pd.DataFrame: + """ + 매수가능 조회 API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 1건까지 확인 가능합니다. + + 1) 매수가능금액 확인 + . 미수 사용 X: nrcvb_buy_amt(미수없는매수금액) 확인 + . 미수 사용 O: max_buy_amt(최대매수금액) 확인 + + 2) 매수가능수량 확인 + . 특정 종목 전량매수 시 가능수량을 확인하실 경우 ORD_DVSN:00(지정가)는 종목증거금율이 반영되지 않습니다. + 따라서 "반드시" ORD_DVSN:01(시장가)로 지정하여 종목증거금율이 반영된 가능수량을 확인하시기 바랍니다. + + (다만, 조건부지정가 등 특정 주문구분(ex.IOC)으로 주문 시 가능수량을 확인할 경우 주문 시와 동일한 주문구분(ex.IOC) 입력하여 가능수량 확인) + + . 미수 사용 X: ORD_DVSN:01(시장가) or 특정 주문구분(ex.IOC)로 지정하여 nrcvb_buy_qty(미수없는매수수량) 확인 + . 미수 사용 O: ORD_DVSN:01(시장가) or 특정 주문구분(ex.IOC)로 지정하여 max_buy_qty(최대매수수량) 확인 + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + pdno (str): [필수] 상품번호 (ex. 종목번호(6자리)) + ord_unpr (str): [필수] 주문단가 (ex. 1주당 가격) + ord_dvsn (str): [필수] 주문구분 (ex. 01 : 시장가) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y) + ovrs_icld_yn (str): [필수] 해외포함여부 (ex. N) + + Returns: + pd.DataFrame: 매수가능조회 데이터 + + Example: + >>> df = inquire_psbl_order(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_unpr="55000", ord_dvsn="01", cma_evlu_amt_icld_yn="N", ovrs_icld_yn="N") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-psbl-order" + + # 필수 파라미터 검증 + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '종목번호(6자리)')") + + if ord_unpr == "": + raise ValueError("ord_unpr is required (e.g. '1주당 가격')") + + if ord_dvsn == "": + raise ValueError("ord_dvsn is required (e.g. '01 : 시장가')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y')") + + if ovrs_icld_yn == "": + raise ValueError("ovrs_icld_yn is required (e.g. 'N')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC8908R" + elif env_dv == "demo": + tr_id = "VTTC8908R" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_UNPR": ord_unpr, + "ORD_DVSN": ord_dvsn, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "OVRS_ICLD_YN": ovrs_icld_yn + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output, index=[0]) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식정정취소가능주문조회[v1_국내주식-004] +############################################################################################## + +def inquire_psbl_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_dvsn_1: str, # 조회구분1 + inqr_dvsn_2: str, # 조회구분2 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 주식정정취소가능주문조회 API입니다. 한 번의 호출에 최대 50건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + ※ 주식주문(정정취소) 호출 전에 반드시 주식정정취소가능주문조회 호출을 통해 정정취소가능수량(output > psbl_qty)을 확인하신 후 정정취소주문 내시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 계좌번호 체계(8-2)의 뒤 2자리) + inqr_dvsn_1 (str): [필수] 조회구분1 (ex. 0: 주문, 1: 종목) + inqr_dvsn_2 (str): [필수] 조회구분2 (ex. 0: 전체, 1: 매도, 2: 매수) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 주식정정취소가능주문조회 데이터 + + Example: + >>> df = inquire_psbl_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_dvsn_1="1", inqr_dvsn_2="0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl" + + if cano == "": + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if inqr_dvsn_1 == "": + raise ValueError("inqr_dvsn_1 is required (e.g. '0: 주문, 1: 종목')") + + if inqr_dvsn_2 == "": + raise ValueError("inqr_dvsn_2 is required (e.g. '0: 전체, 1: 매도, 2: 매수')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTC0084R" # 주식정정취소가능주문조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "INQR_DVSN_1": inqr_dvsn_1, # 조회구분1 + "INQR_DVSN_2": inqr_dvsn_2, # 조회구분2 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_psbl_rvsecncl( + cano, acnt_prdt_cd, inqr_dvsn_1, inqr_dvsn_2, FK100, NK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 매도가능수량조회 [국내주식-165] +############################################################################################## + +def inquire_psbl_sell( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 종목번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 주문/계좌 + 매도가능수량조회[국내주식-165] + 매도가능수량조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + pdno (str): 보유종목 코드 ex)000660 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 매도가능수량조회 데이터 + + Example: + >>> df = inquire_psbl_sell("12345678", "01", "000660") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/inquire-psbl-sell" + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC8408R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psbl_sell( + cano, + acnt_prdt_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식일별분봉조회 [국내주식-213] +############################################################################################## + +def inquire_time_dailychartprice( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 + fid_input_iscd: str, # 종목코드 + fid_input_hour_1: str, # 입력 시간1 + fid_input_date_1: str, # 입력 날짜1 + fid_pw_data_incu_yn: str = "N", # 과거 데이터 포함 여부 + fid_fake_tick_incu_yn: str = "" # 허봉 포함 여부 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식일별분봉조회 API입니다. + + 실전계좌의 경우, 한 번의 호출에 최대 120건까지 확인 가능하며, + FID_INPUT_DATE_1, FID_INPUT_HOUR_1 이용하여 과거일자 분봉조회 가능합니다. + + ※ 과거 분봉 조회 시, 당사 서버에서 보관하고 있는 만큼의 데이터만 확인이 가능합니다. (최대 1년 분봉 보관) + + Args: + fid_cond_mrkt_div_code (str): [필수] 시장 분류 코드 (ex. J:주식,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + fid_input_hour_1 (str): [필수] 입력 시간1 (ex. 130000) + fid_input_date_1 (str): [필수] 입력 날짜1 (ex. 20241023) + fid_pw_data_incu_yn (str): 과거 데이터 포함 여부 (기본값: "N") + fid_fake_tick_incu_yn (str): 허봉 포함 여부 (기본값: "") + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_dailychartprice("J", "005930", "130000", "20241023") + >>> print(output1) + >>> print(output2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-time-dailychartprice" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J', 'NX', 'UN')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_hour_1 == "": + raise ValueError("fid_input_hour_1 is required (e.g. '130000')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20241023')") + + tr_id = "FHKST03010230" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_FAKE_TICK_INCU_YN": fid_fake_tick_incu_yn + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1 = pd.DataFrame([res.getBody().output1]) + + # output2 (array) -> DataFrame + output2 = pd.DataFrame(res.getBody().output2) + + return output1, output2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 업종 분봉조회[v1_국내주식-045] +############################################################################################## + +def inquire_time_indexchartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_etc_cls_code: str, # FID 기타 구분 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_hour_1: str, # FID 입력 시간1 + fid_pw_data_incu_yn: str, # FID 과거 데이터 포함 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 업종/기타 + 업종 분봉조회[v1_국내주식-045] + 업종 분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): FID 조건 시장 분류 코드 (예: 'U') + fid_etc_cls_code (str): FID 기타 구분 코드 (예: '0' 기본, '1' 장마감, 시간외 제외) + fid_input_iscd (str): FID 입력 종목코드 (예: '0001' 종합, '0002' 대형주) + fid_input_hour_1 (str): FID 입력 시간1 (예: '30', '60', '600', '3600') + fid_pw_data_incu_yn (str): FID 과거 데이터 포함 여부 (예: 'Y' 과거, 'N' 당일) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 업종 분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_indexchartprice( + ... fid_cond_mrkt_div_code='U', + ... fid_etc_cls_code='0', + ... fid_input_iscd='0001', + ... fid_input_hour_1='30', + ... fid_pw_data_incu_yn='Y' + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-time-indexchartprice" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'U')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'U')") + + if not fid_etc_cls_code: + logger.error("fid_etc_cls_code is required. (e.g. '0')") + raise ValueError("fid_etc_cls_code is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0001')") + raise ValueError("fid_input_iscd is required. (e.g. '0001')") + + if not fid_input_hour_1: + logger.error("fid_input_hour_1 is required. (e.g. '30')") + raise ValueError("fid_input_hour_1 is required. (e.g. '30')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'Y')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'Y')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKUP03500200" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_indexchartprice( + fid_cond_mrkt_div_code, + fid_etc_cls_code, + fid_input_iscd, + fid_input_hour_1, + fid_pw_data_incu_yn, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식당일분봉조회[v1_국내주식-022] +############################################################################################## + +def inquire_time_itemchartprice( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_input_hour_1: str, # [필수] 입력 시간1 (ex. 입력시간) + fid_pw_data_incu_yn: str, # [필수] 과거 데이터 포함 여부 + fid_etc_cls_code: str = "" # [필수] 기타 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식당일분봉조회 API입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 30건까지 확인 가능합니다. + + ※ 당일 분봉 데이터만 제공됩니다. (전일자 분봉 미제공) + + ※ input > FID_INPUT_HOUR_1 에 미래일시 입력 시에 현재가로 조회됩니다. + ex) 오전 10시에 113000 입력 시에 오전 10시~11시30분 사이의 데이터가 오전 10시 값으로 조회됨 + + ※ output2의 첫번째 배열의 체결량(cntg_vol)은 첫체결이 발생되기 전까지는 이전 분봉의 체결량이 해당 위치에 표시됩니다. + 해당 분봉의 첫 체결이 발생되면 해당 이전분 체결량이 두번째 배열로 이동되면서 새로운 체결량으로 업데이트됩니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_hour_1 (str): [필수] 입력 시간1 (ex. 입력시간) + fid_pw_data_incu_yn (str): [필수] 과거 데이터 포함 여부 + fid_etc_cls_code (str): [필수] 기타 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_itemchartprice(env_dv="real", fid_cond_mrkt_div_code="J", fid_input_iscd="005930", fid_input_hour_1="093000", fid_pw_data_incu_yn="Y") + >>> print(output1) + >>> print(output2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_hour_1 == "" or fid_input_hour_1 is None: + raise ValueError("fid_input_hour_1 is required (e.g. '입력시간')") + + if fid_pw_data_incu_yn == "" or fid_pw_data_incu_yn is None: + raise ValueError("fid_pw_data_incu_yn is required") + + # tr_id 설정 (실전/모의 동일) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKST03010200" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + "FID_ETC_CLS_CODE": fid_etc_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame (1행) + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame (여러행) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결[v1_국내주식-023] +############################################################################################## + +def inquire_time_itemconclusion( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 + fid_input_hour_1: str # [필수] 입력 시간1 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 당일시간대별체결 API입니다. + + Args: + env_dv (str): [필수] 실전모의구분 (real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 + fid_input_hour_1 (str): [필수] 입력 시간1 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = inquire_time_itemconclusion("real", "U", "0001", "115959") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '입력 종목코드')") + + if fid_input_hour_1 == "" or fid_input_hour_1 is None: + raise ValueError("fid_input_hour_1 is required (e.g. '입력 시간1')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "FHPST01060000" + elif env_dv == "demo": + tr_id = "FHPST01060000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 처리 (object -> DataFrame) + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (object -> DataFrame) + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외시간별체결[v1_국내주식-025] +############################################################################################## + +def inquire_time_overtimeconclusion( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. J:주식/ETF/ETN) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456(ETN의 경우 Q로 시작 Q500001)) + fid_hour_cls_code: str # [필수] 적립금구분코드 (ex. 1: 시간외) +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식현재가 시간외시간별체결 API입니다. + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식/ETF/ETN) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456(ETN의 경우 Q로 시작 Q500001)) + fid_hour_cls_code (str): [필수] 적립금구분코드 (ex. 1: 시간외) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = inquire_time_overtimeconclusion("real", "J", "005930", "1") + >>> print(output1) + >>> print(output2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-time-overtimeconclusion" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식/ETF/ETN')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456(ETN의 경우 Q로 시작 Q500001)')") + + if fid_hour_cls_code == "" or fid_hour_cls_code is None: + raise ValueError("fid_hour_cls_code is required (e.g. '1: 시간외')") + + # TR_ID 설정 + if env_dv == "real": + tr_id = "FHPST02310000" + elif env_dv == "demo": + tr_id = "FHPST02310000" + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + + # output2 (array) -> DataFrame + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 변동성완화장치(VI) 현황[v1_국내주식-055] +############################################################################################## + +def inquire_vi_status( + fid_div_cls_code: str, # FID 분류 구분 코드 + fid_cond_scr_div_code: str, # FID 조건 화면 분류 코드 + fid_mrkt_cls_code: str, # FID 시장 구분 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_rank_sort_cls_code: str, # FID 순위 정렬 구분 코드 + fid_input_date_1: str, # FID 입력 날짜1 + fid_trgt_cls_code: str, # FID 대상 구분 코드 + fid_trgt_exls_cls_code: str, # FID 대상 제외 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 변동성완화장치(VI) 현황[v1_국내주식-055] + 변동성완화장치(VI) 현황 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_div_cls_code (str): 0:전체 1:상승 2:하락 + fid_cond_scr_div_code (str): 20139 + fid_mrkt_cls_code (str): 0:전체 K:거래소 Q:코스닥 + fid_input_iscd (str): 종목코드 + fid_rank_sort_cls_code (str): 0:전체 1:정적 2:동적 3:정적&동적 + fid_input_date_1 (str): 영업일 + fid_trgt_cls_code (str): 대상 구분 코드 + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 변동성완화장치(VI) 현황 데이터 + + Example: + >>> df = inquire_vi_status( + ... fid_div_cls_code="0", + ... fid_cond_scr_div_code="20139", + ... fid_mrkt_cls_code="0", + ... fid_input_iscd="005930", + ... fid_rank_sort_cls_code="0", + ... fid_input_date_1="20240126", + ... fid_trgt_cls_code="", + ... fid_trgt_exls_cls_code="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/inquire-vi-status" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 (첨부된 사진 기준, 비어있으면 빼고 체크) + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20139')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20139')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. '0')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20200420')") + raise ValueError("fid_input_date_1 is required. (e.g. '20200420')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01390000" + + params = { + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_vi_status( + fid_div_cls_code, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_input_date_1, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식통합증거금 현황 [국내주식-191] +############################################################################################## + +def intgr_margin( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + cma_evlu_amt_icld_yn: str, # [필수] CMA평가금액포함여부 (ex. Y: 포함, N: 미포함) + wcrc_frcr_dvsn_cd: str, # [필수] 원화외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + fwex_ctrt_frcr_dvsn_cd: str # [필수] 선도환계약외화구분코드 (ex. 01: 외화기준, 02: 원화기준) +) -> pd.DataFrame: + """ + 주식통합증거금 현황 API입니다. + 한국투자 HTS(eFriend Plus) > [0867] 통합증거금조회 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 해당 화면은 일반계좌와 통합증거금 신청계좌에 대해서 국내 및 해외 주문가능금액을 간단하게 조회하는 화면입니다. + ※ 해외 국가별 상세한 증거금현황을 원하시면 [해외주식] 주문/계좌 > 해외증거금 통화별조회 API를 이용하여 주시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y: 포함, N: 미포함) + wcrc_frcr_dvsn_cd (str): [필수] 원화외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + fwex_ctrt_frcr_dvsn_cd (str): [필수] 선도환계약외화구분코드 (ex. 01: 외화기준, 02: 원화기준) + + Returns: + pd.DataFrame: 주식통합증거금 현황 데이터 + + Example: + >>> df = intgr_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, cma_evlu_amt_icld_yn="N", wcrc_frcr_dvsn_cd="01", fwex_ctrt_frcr_dvsn_cd="01") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/intgr-margin" + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y' or 'N')") + + if wcrc_frcr_dvsn_cd == "": + raise ValueError("wcrc_frcr_dvsn_cd is required (e.g. '01' or '02')") + + if fwex_ctrt_frcr_dvsn_cd == "": + raise ValueError("fwex_ctrt_frcr_dvsn_cd is required (e.g. '01' or '02')") + + tr_id = "TTTC0869R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "FWEX_CTRT_FRCR_DVSN_CD": fwex_ctrt_frcr_dvsn_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹조회 [국내주식-204] +############################################################################################## + +def intstock_grouplist( + type: str, # [필수] 관심종목구분코드 (ex. 1) + fid_etc_cls_code: str, # [필수] FID 기타 구분 코드 (ex. 00) + user_id: str # [필수] 사용자 ID +) -> pd.DataFrame: + """ + 관심종목 그룹조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + type (str): [필수] 관심종목구분코드 (ex. 1) + fid_etc_cls_code (str): [필수] FID 기타 구분 코드 (ex. 00) + user_id (str): [필수] 사용자 ID + + Returns: + pd.DataFrame: 관심종목 그룹 정보를 담은 DataFrame + + Example: + >>> df = intstock_grouplist(type="1", fid_etc_cls_code="00", user_id=trenv.my_htsid) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/intstock-grouplist" + + if type == "": + raise ValueError("type is required (e.g. '1')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '00')") + + if user_id == "": + raise ValueError("user_id is required") + + tr_id = "HHKCM113004C7" # 관심종목 그룹조회 + + params = { + "TYPE": type, # 관심종목구분코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code, # FID 기타 구분 코드 + "USER_ID": user_id # 사용자 ID + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 관심종목(멀티종목) 시세조회 [국내주식-205] +############################################################################################## + +def intstock_multprice( + fid_cond_mrkt_div_code_1: str, # [필수] 조건 시장 분류 코드1 (ex. J) + fid_input_iscd_1: str, # [필수] 입력 종목코드1 (ex. 123456) + fid_cond_mrkt_div_code_2: Optional[str] = None, # 조건 시장 분류 코드2 + fid_input_iscd_2: Optional[str] = None, # 입력 종목코드2 + fid_cond_mrkt_div_code_3: Optional[str] = None, # 조건 시장 분류 코드3 + fid_input_iscd_3: Optional[str] = None, # 입력 종목코드3 + fid_cond_mrkt_div_code_4: Optional[str] = None, # 조건 시장 분류 코드4 + fid_input_iscd_4: Optional[str] = None, # 입력 종목코드4 + fid_cond_mrkt_div_code_5: Optional[str] = None, # 조건 시장 분류 코드5 + fid_input_iscd_5: Optional[str] = None, # 입력 종목코드5 + fid_cond_mrkt_div_code_6: Optional[str] = None, # 조건 시장 분류 코드6 + fid_input_iscd_6: Optional[str] = None, # 입력 종목코드6 + fid_cond_mrkt_div_code_7: Optional[str] = None, # 조건 시장 분류 코드7 + fid_input_iscd_7: Optional[str] = None, # 입력 종목코드7 + fid_cond_mrkt_div_code_8: Optional[str] = None, # 조건 시장 분류 코드8 + fid_input_iscd_8: Optional[str] = None, # 입력 종목코드8 + fid_cond_mrkt_div_code_9: Optional[str] = None, # 조건 시장 분류 코드9 + fid_input_iscd_9: Optional[str] = None, # 입력 종목코드9 + fid_cond_mrkt_div_code_10: Optional[str] = None, # 조건 시장 분류 코드10 + fid_input_iscd_10: Optional[str] = None, # 입력 종목코드10 + fid_cond_mrkt_div_code_11: Optional[str] = None, # 조건 시장 분류 코드11 + fid_input_iscd_11: Optional[str] = None, # 입력 종목코드11 + fid_cond_mrkt_div_code_12: Optional[str] = None, # 조건 시장 분류 코드12 + fid_input_iscd_12: Optional[str] = None, # 입력 종목코드12 + fid_cond_mrkt_div_code_13: Optional[str] = None, # 조건 시장 분류 코드13 + fid_input_iscd_13: Optional[str] = None, # 입력 종목코드13 + fid_cond_mrkt_div_code_14: Optional[str] = None, # 조건 시장 분류 코드14 + fid_input_iscd_14: Optional[str] = None, # 입력 종목코드14 + fid_cond_mrkt_div_code_15: Optional[str] = None, # 조건 시장 분류 코드15 + fid_input_iscd_15: Optional[str] = None, # 입력 종목코드15 + fid_cond_mrkt_div_code_16: Optional[str] = None, # 조건 시장 분류 코드16 + fid_input_iscd_16: Optional[str] = None, # 입력 종목코드16 + fid_cond_mrkt_div_code_17: Optional[str] = None, # 조건 시장 분류 코드17 + fid_input_iscd_17: Optional[str] = None, # 입력 종목코드17 + fid_cond_mrkt_div_code_18: Optional[str] = None, # 조건 시장 분류 코드18 + fid_input_iscd_18: Optional[str] = None, # 입력 종목코드18 + fid_cond_mrkt_div_code_19: Optional[str] = None, # 조건 시장 분류 코드19 + fid_input_iscd_19: Optional[str] = None, # 입력 종목코드19 + fid_cond_mrkt_div_code_20: Optional[str] = None, # 조건 시장 분류 코드20 + fid_input_iscd_20: Optional[str] = None, # 입력 종목코드20 + fid_cond_mrkt_div_code_21: Optional[str] = None, # 조건 시장 분류 코드21 + fid_input_iscd_21: Optional[str] = None, # 입력 종목코드21 + fid_cond_mrkt_div_code_22: Optional[str] = None, # 조건 시장 분류 코드22 + fid_input_iscd_22: Optional[str] = None, # 입력 종목코드22 + fid_cond_mrkt_div_code_23: Optional[str] = None, # 조건 시장 분류 코드23 + fid_input_iscd_23: Optional[str] = None, # 입력 종목코드23 + fid_cond_mrkt_div_code_24: Optional[str] = None, # 조건 시장 분류 코드24 + fid_input_iscd_24: Optional[str] = None, # 입력 종목코드24 + fid_cond_mrkt_div_code_25: Optional[str] = None, # 조건 시장 분류 코드25 + fid_input_iscd_25: Optional[str] = None, # 입력 종목코드25 + fid_cond_mrkt_div_code_26: Optional[str] = None, # 조건 시장 분류 코드26 + fid_input_iscd_26: Optional[str] = None, # 입력 종목코드26 + fid_cond_mrkt_div_code_27: Optional[str] = None, # 조건 시장 분류 코드27 + fid_input_iscd_27: Optional[str] = None, # 입력 종목코드27 + fid_cond_mrkt_div_code_28: Optional[str] = None, # 조건 시장 분류 코드28 + fid_input_iscd_28: Optional[str] = None, # 입력 종목코드28 + fid_cond_mrkt_div_code_29: Optional[str] = None, # 조건 시장 분류 코드29 + fid_input_iscd_29: Optional[str] = None, # 입력 종목코드29 + fid_cond_mrkt_div_code_30: Optional[str] = None, # 조건 시장 분류 코드30 + fid_input_iscd_30: Optional[str] = None # 입력 종목코드30 +) -> pd.DataFrame: + """ + 관심종목(멀티종목) 시세조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + 그룹별종목조회 결과를 아래와 같이 입력하셔서 총 30종목까지 복수종목 조회 가능합니다.(아래 Example 참고) + . fid_mrkt_cls_code(시장구분) → FID_COND_MRKT_DIV_CODE_1 + . jong_code(종목코드) 1 → FID_INPUT_ISCD_1 + ... + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + fid_cond_mrkt_div_code_1 (str): [필수] 조건 시장 분류 코드1 (ex. J:KRX, NX:NXT) + fid_input_iscd_1 (str): [필수] 입력 종목코드1 (ex. 123456) + fid_cond_mrkt_div_code_2 (Optional[str]): 조건 시장 분류 코드2 + fid_input_iscd_2 (Optional[str]): 입력 종목코드2 + fid_cond_mrkt_div_code_3 (Optional[str]): 조건 시장 분류 코드3 + fid_input_iscd_3 (Optional[str]): 입력 종목코드3 + fid_cond_mrkt_div_code_4 (Optional[str]): 조건 시장 분류 코드4 + fid_input_iscd_4 (Optional[str]): 입력 종목코드4 + fid_cond_mrkt_div_code_5 (Optional[str]): 조건 시장 분류 코드5 + fid_input_iscd_5 (Optional[str]): 입력 종목코드5 + fid_cond_mrkt_div_code_6 (Optional[str]): 조건 시장 분류 코드6 + fid_input_iscd_6 (Optional[str]): 입력 종목코드6 + fid_cond_mrkt_div_code_7 (Optional[str]): 조건 시장 분류 코드7 + fid_input_iscd_7 (Optional[str]): 입력 종목코드7 + fid_cond_mrkt_div_code_8 (Optional[str]): 조건 시장 분류 코드8 + fid_input_iscd_8 (Optional[str]): 입력 종목코드8 + fid_cond_mrkt_div_code_9 (Optional[str]): 조건 시장 분류 코드9 + fid_input_iscd_9 (Optional[str]): 입력 종목코드9 + fid_cond_mrkt_div_code_10 (Optional[str]): 조건 시장 분류 코드10 + fid_input_iscd_10 (Optional[str]): 입력 종목코드10 + fid_cond_mrkt_div_code_11 (Optional[str]): 조건 시장 분류 코드11 + fid_input_iscd_11 (Optional[str]): 입력 종목코드11 + fid_cond_mrkt_div_code_12 (Optional[str]): 조건 시장 분류 코드12 + fid_input_iscd_12 (Optional[str]): 입력 종목코드12 + fid_cond_mrkt_div_code_13 (Optional[str]): 조건 시장 분류 코드13 + fid_input_iscd_13 (Optional[str]): 입력 종목코드13 + fid_cond_mrkt_div_code_14 (Optional[str]): 조건 시장 분류 코드14 + fid_input_iscd_14 (Optional[str]): 입력 종목코드14 + fid_cond_mrkt_div_code_15 (Optional[str]): 조건 시장 분류 코드15 + fid_input_iscd_15 (Optional[str]): 입력 종목코드15 + fid_cond_mrkt_div_code_16 (Optional[str]): 조건 시장 분류 코드16 + fid_input_iscd_16 (Optional[str]): 입력 종목코드16 + fid_cond_mrkt_div_code_17 (Optional[str]): 조건 시장 분류 코드17 + fid_input_iscd_17 (Optional[str]): 입력 종목코드17 + fid_cond_mrkt_div_code_18 (Optional[str]): 조건 시장 분류 코드18 + fid_input_iscd_18 (Optional[str]): 입력 종목코드18 + fid_cond_mrkt_div_code_19 (Optional[str]): 조건 시장 분류 코드19 + fid_input_iscd_19 (Optional[str]): 입력 종목코드19 + fid_cond_mrkt_div_code_20 (Optional[str]): 조건 시장 분류 코드20 + fid_input_iscd_20 (Optional[str]): 입력 종목코드20 + fid_cond_mrkt_div_code_21 (Optional[str]): 조건 시장 분류 코드21 + fid_input_iscd_21 (Optional[str]): 입력 종목코드21 + fid_cond_mrkt_div_code_22 (Optional[str]): 조건 시장 분류 코드22 + fid_input_iscd_22 (Optional[str]): 입력 종목코드22 + fid_cond_mrkt_div_code_23 (Optional[str]): 조건 시장 분류 코드23 + fid_input_iscd_23 (Optional[str]): 입력 종목코드23 + fid_cond_mrkt_div_code_24 (Optional[str]): 조건 시장 분류 코드24 + fid_input_iscd_24 (Optional[str]): 입력 종목코드24 + fid_cond_mrkt_div_code_25 (Optional[str]): 조건 시장 분류 코드25 + fid_input_iscd_25 (Optional[str]): 입력 종목코드25 + fid_cond_mrkt_div_code_26 (Optional[str]): 조건 시장 분류 코드26 + fid_input_iscd_26 (Optional[str]): 입력 종목코드26 + fid_cond_mrkt_div_code_27 (Optional[str]): 조건 시장 분류 코드27 + fid_input_iscd_27 (Optional[str]): 입력 종목코드27 + fid_cond_mrkt_div_code_28 (Optional[str]): 조건 시장 분류 코드28 + fid_input_iscd_28 (Optional[str]): 입력 종목코드28 + fid_cond_mrkt_div_code_29 (Optional[str]): 조건 시장 분류 코드29 + fid_input_iscd_29 (Optional[str]): 입력 종목코드29 + fid_cond_mrkt_div_code_30 (Optional[str]): 조건 시장 분류 코드30 + fid_input_iscd_30 (Optional[str]): 입력 종목코드30 + + Returns: + pd.DataFrame: 관심종목(멀티종목) 시세 데이터 + + Example: + >>> df = intstock_multprice(fid_cond_mrkt_div_code_1="J", fid_input_iscd_1="419530") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/intstock-multprice" + + if fid_cond_mrkt_div_code_1 == "": + raise ValueError("fid_cond_mrkt_div_code_1 is required (e.g. 'J')") + + if fid_input_iscd_1 == "": + raise ValueError("fid_input_iscd_1 is required (e.g. '123456')") + + tr_id = "FHKST11300006" # 관심종목(멀티종목) 시세조회 + + params = { + "FID_COND_MRKT_DIV_CODE_1": fid_cond_mrkt_div_code_1, + "FID_INPUT_ISCD_1": fid_input_iscd_1 + } + + # 옵션 파라미터 처리 + if fid_cond_mrkt_div_code_2 is not None: + params["FID_COND_MRKT_DIV_CODE_2"] = fid_cond_mrkt_div_code_2 + if fid_input_iscd_2 is not None: + params["FID_INPUT_ISCD_2"] = fid_input_iscd_2 + if fid_cond_mrkt_div_code_3 is not None: + params["FID_COND_MRKT_DIV_CODE_3"] = fid_cond_mrkt_div_code_3 + if fid_input_iscd_3 is not None: + params["FID_INPUT_ISCD_3"] = fid_input_iscd_3 + if fid_cond_mrkt_div_code_4 is not None: + params["FID_COND_MRKT_DIV_CODE_4"] = fid_cond_mrkt_div_code_4 + if fid_input_iscd_4 is not None: + params["FID_INPUT_ISCD_4"] = fid_input_iscd_4 + if fid_cond_mrkt_div_code_5 is not None: + params["FID_COND_MRKT_DIV_CODE_5"] = fid_cond_mrkt_div_code_5 + if fid_input_iscd_5 is not None: + params["FID_INPUT_ISCD_5"] = fid_input_iscd_5 + if fid_cond_mrkt_div_code_6 is not None: + params["FID_COND_MRKT_DIV_CODE_6"] = fid_cond_mrkt_div_code_6 + if fid_input_iscd_6 is not None: + params["FID_INPUT_ISCD_6"] = fid_input_iscd_6 + if fid_cond_mrkt_div_code_7 is not None: + params["FID_COND_MRKT_DIV_CODE_7"] = fid_cond_mrkt_div_code_7 + if fid_input_iscd_7 is not None: + params["FID_INPUT_ISCD_7"] = fid_input_iscd_7 + if fid_cond_mrkt_div_code_8 is not None: + params["FID_COND_MRKT_DIV_CODE_8"] = fid_cond_mrkt_div_code_8 + if fid_input_iscd_8 is not None: + params["FID_INPUT_ISCD_8"] = fid_input_iscd_8 + if fid_cond_mrkt_div_code_9 is not None: + params["FID_COND_MRKT_DIV_CODE_9"] = fid_cond_mrkt_div_code_9 + if fid_input_iscd_9 is not None: + params["FID_INPUT_ISCD_9"] = fid_input_iscd_9 + if fid_cond_mrkt_div_code_10 is not None: + params["FID_COND_MRKT_DIV_CODE_10"] = fid_cond_mrkt_div_code_10 + if fid_input_iscd_10 is not None: + params["FID_INPUT_ISCD_10"] = fid_input_iscd_10 + if fid_cond_mrkt_div_code_11 is not None: + params["FID_COND_MRKT_DIV_CODE_11"] = fid_cond_mrkt_div_code_11 + if fid_input_iscd_11 is not None: + params["FID_INPUT_ISCD_11"] = fid_input_iscd_11 + if fid_cond_mrkt_div_code_12 is not None: + params["FID_COND_MRKT_DIV_CODE_12"] = fid_cond_mrkt_div_code_12 + if fid_input_iscd_12 is not None: + params["FID_INPUT_ISCD_12"] = fid_input_iscd_12 + if fid_cond_mrkt_div_code_13 is not None: + params["FID_COND_MRKT_DIV_CODE_13"] = fid_cond_mrkt_div_code_13 + if fid_input_iscd_13 is not None: + params["FID_INPUT_ISCD_13"] = fid_input_iscd_13 + if fid_cond_mrkt_div_code_14 is not None: + params["FID_COND_MRKT_DIV_CODE_14"] = fid_cond_mrkt_div_code_14 + if fid_input_iscd_14 is not None: + params["FID_INPUT_ISCD_14"] = fid_input_iscd_14 + if fid_cond_mrkt_div_code_15 is not None: + params["FID_COND_MRKT_DIV_CODE_15"] = fid_cond_mrkt_div_code_15 + if fid_input_iscd_15 is not None: + params["FID_INPUT_ISCD_15"] = fid_input_iscd_15 + if fid_cond_mrkt_div_code_16 is not None: + params["FID_COND_MRKT_DIV_CODE_16"] = fid_cond_mrkt_div_code_16 + if fid_input_iscd_16 is not None: + params["FID_INPUT_ISCD_16"] = fid_input_iscd_16 + if fid_cond_mrkt_div_code_17 is not None: + params["FID_COND_MRKT_DIV_CODE_17"] = fid_cond_mrkt_div_code_17 + if fid_input_iscd_17 is not None: + params["FID_INPUT_ISCD_17"] = fid_input_iscd_17 + if fid_cond_mrkt_div_code_18 is not None: + params["FID_COND_MRKT_DIV_CODE_18"] = fid_cond_mrkt_div_code_18 + if fid_input_iscd_18 is not None: + params["FID_INPUT_ISCD_18"] = fid_input_iscd_18 + if fid_cond_mrkt_div_code_19 is not None: + params["FID_COND_MRKT_DIV_CODE_19"] = fid_cond_mrkt_div_code_19 + if fid_input_iscd_19 is not None: + params["FID_INPUT_ISCD_19"] = fid_input_iscd_19 + if fid_cond_mrkt_div_code_20 is not None: + params["FID_COND_MRKT_DIV_CODE_20"] = fid_cond_mrkt_div_code_20 + if fid_input_iscd_20 is not None: + params["FID_INPUT_ISCD_20"] = fid_input_iscd_20 + if fid_cond_mrkt_div_code_21 is not None: + params["FID_COND_MRKT_DIV_CODE_21"] = fid_cond_mrkt_div_code_21 + if fid_input_iscd_21 is not None: + params["FID_INPUT_ISCD_21"] = fid_input_iscd_21 + if fid_cond_mrkt_div_code_22 is not None: + params["FID_COND_MRKT_DIV_CODE_22"] = fid_cond_mrkt_div_code_22 + if fid_input_iscd_22 is not None: + params["FID_INPUT_ISCD_22"] = fid_input_iscd_22 + if fid_cond_mrkt_div_code_23 is not None: + params["FID_COND_MRKT_DIV_CODE_23"] = fid_cond_mrkt_div_code_23 + if fid_input_iscd_23 is not None: + params["FID_INPUT_ISCD_23"] = fid_input_iscd_23 + if fid_cond_mrkt_div_code_24 is not None: + params["FID_COND_MRKT_DIV_CODE_24"] = fid_cond_mrkt_div_code_24 + if fid_input_iscd_24 is not None: + params["FID_INPUT_ISCD_24"] = fid_input_iscd_24 + if fid_cond_mrkt_div_code_25 is not None: + params["FID_COND_MRKT_DIV_CODE_25"] = fid_cond_mrkt_div_code_25 + if fid_input_iscd_25 is not None: + params["FID_INPUT_ISCD_25"] = fid_input_iscd_25 + if fid_cond_mrkt_div_code_26 is not None: + params["FID_COND_MRKT_DIV_CODE_26"] = fid_cond_mrkt_div_code_26 + if fid_input_iscd_26 is not None: + params["FID_INPUT_ISCD_26"] = fid_input_iscd_26 + if fid_cond_mrkt_div_code_27 is not None: + params["FID_COND_MRKT_DIV_CODE_27"] = fid_cond_mrkt_div_code_27 + if fid_input_iscd_27 is not None: + params["FID_INPUT_ISCD_27"] = fid_input_iscd_27 + if fid_cond_mrkt_div_code_28 is not None: + params["FID_COND_MRKT_DIV_CODE_28"] = fid_cond_mrkt_div_code_28 + if fid_input_iscd_28 is not None: + params["FID_INPUT_ISCD_28"] = fid_input_iscd_28 + if fid_cond_mrkt_div_code_29 is not None: + params["FID_COND_MRKT_DIV_CODE_29"] = fid_cond_mrkt_div_code_29 + if fid_input_iscd_29 is not None: + params["FID_INPUT_ISCD_29"] = fid_input_iscd_29 + if fid_cond_mrkt_div_code_30 is not None: + params["FID_COND_MRKT_DIV_CODE_30"] = fid_cond_mrkt_div_code_30 + if fid_input_iscd_30 is not None: + params["FID_INPUT_ISCD_30"] = fid_input_iscd_30 + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 관심종목 그룹별 종목조회 [국내주식-203] +############################################################################################## + +def intstock_stocklist_by_group( + type: str, # 관심종목구분코드 (ex. 1) + user_id: str, # 사용자 ID + inter_grp_code: str, # 관심 그룹 코드 (ex. 001) + fid_etc_cls_code: str, # 기타 구분 코드 (ex. 4) + data_rank: str = "", # 데이터 순위 + inter_grp_name: str = "", # 관심 그룹 명 + hts_kor_isnm: str = "", # HTS 한글 종목명 + cntg_cls_code: str = "" # 체결 구분 코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 관심종목 그룹별 종목조회 API입니다. + ① 관심종목 그룹조회 → ② 관심종목 그룹별 종목조회 → ③ 관심종목(멀티종목) 시세조회 순서대로 호출하셔서 관심종목 시세 조회 가능합니다. + + ※ 한 번의 호출에 최대 30종목의 시세 확인 가능합니다. + + 한국투자증권 Github 에서 관심종목 복수시세조회 파이썬 샘플코드를 참고하실 수 있습니다. + https://github.com/koreainvestment/open-trading-api/blob/main/rest/interest_stocks_price.py + + Args: + type (str): [필수] 관심종목구분코드 (ex. 1) + user_id (str): [필수] 사용자 ID + inter_grp_code (str): [필수] 관심 그룹 코드 (ex. 001) + fid_etc_cls_code (str): [필수] 기타 구분 코드 (ex. 4) + data_rank (str): 데이터 순위 + inter_grp_name (str): 관심 그룹 명 + hts_kor_isnm (str): HTS 한글 종목명 + cntg_cls_code (str): 체결 구분 코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Example: + >>> df1, df2 = intstock_stocklist_by_group( + ... type="1", user_id=trenv.my_htsid, inter_grp_code="001", fid_etc_cls_code="4" + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/intstock-stocklist-by-group" + + if type == "": + raise ValueError("type is required (e.g. '1')") + + if user_id == "": + raise ValueError("user_id is required") + + if inter_grp_code == "": + raise ValueError("inter_grp_code is required (e.g. '001')") + + if fid_etc_cls_code == "": + raise ValueError("fid_etc_cls_code is required (e.g. '4')") + + tr_id = "HHKCM113004C6" # 관심종목 그룹별 종목조회 + + params = { + "TYPE": type, # 관심종목구분코드 + "USER_ID": user_id, # 사용자 ID + "INTER_GRP_CODE": inter_grp_code, # 관심 그룹 코드 + "FID_ETC_CLS_CODE": fid_etc_cls_code, # 기타 구분 코드 + "DATA_RANK": data_rank, # 데이터 순위 + "INTER_GRP_NAME": inter_grp_name, # 관심 그룹 명 + "HTS_KOR_ISNM": hts_kor_isnm, # HTS 한글 종목명 + "CNTG_CLS_CODE": cntg_cls_code # 체결 구분 코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 데이터프레임 생성 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 데이터프레임 생성 + output2_data = pd.DataFrame(res.getBody().output2) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 증권사별 투자의견[국내주식-189] +############################################################################################## + +def invest_opbysec( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_div_cls_code: str, # 분류구분코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 증권사별 투자의견[국내주식-189] + 국내주식 증권사별 투자의견 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J(시장 구분 코드) + fid_cond_scr_div_code (str): 16634(Primary key) + fid_input_iscd (str): 회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조) + fid_div_cls_code (str): 전체(0) 매수(1) 중립(2) 매도(3) + fid_input_date_1 (str): 이후 ~ + fid_input_date_2 (str): ~ 이전 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 증권사별 투자의견 데이터 + + Example: + >>> df = invest_opbysec( + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="16634", + ... fid_input_iscd="005930", + ... fid_div_cls_code="0", + ... fid_input_date_1="20230101", + ... fid_input_date_2="20231231" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/invest-opbysec" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '16634')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '16634')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20230101')") + raise ValueError("fid_input_date_1 is required. (e.g. '20230101')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20231231')") + raise ValueError("fid_input_date_2 is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHKST663400C0" + + # API 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return invest_opbysec( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_date_1, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 국내주식 종목투자의견[국내주식-188] +############################################################################################## + +def invest_opinion( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 국내주식 종목투자의견[국내주식-188] + 국내주식 종목투자의견 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J(시장 구분 코드) + fid_cond_scr_div_code (str): 16633(Primary key) + fid_input_iscd (str): 종목코드(ex) 005930(삼성전자)) + fid_input_date_1 (str): 이후 ~(ex) 0020231113) + fid_input_date_2 (str): ~ 이전(ex) 0020240513) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 종목투자의견 데이터 + + Example: + >>> df = invest_opinion( + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="16633", + ... fid_input_iscd="005930", + ... fid_input_date_1="20231113", + ... fid_input_date_2="20240513" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/invest-opinion" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '16633')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '16633')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20231113')") + raise ValueError("fid_input_date_1 is required. (e.g. '20231113')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20240513')") + raise ValueError("fid_input_date_2 is required. (e.g. '20240513')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "FHKST663300C0" + + # 요청 파라미터 설정 + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return invest_opinion( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 프로그램매매 투자자매매동향(당일) [국내주식-116] +############################################################################################## + +def investor_program_trade_today( + mrkt_div_cls_code: str # [필수] 시장 구분 코드 (ex. 1:코스피, 4:코스닥) +) -> pd.DataFrame: + """ + 프로그램매매 투자자매매동향(당일) API입니다. + 한국투자 HTS(eFriend Plus) > [0466] 프로그램매매 투자자별 동향 화면 의 "당일동향" 표의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + mrkt_div_cls_code (str): [필수] 시장 구분 코드 (ex. 1:코스피, 4:코스닥) + + Returns: + pd.DataFrame: 프로그램매매 투자자매매동향 데이터 + + Example: + >>> df = investor_program_trade_today(mrkt_div_cls_code="1") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/investor-program-trade-today" + + if mrkt_div_cls_code == "": + raise ValueError("mrkt_div_cls_code is required (e.g. '1' or '4')") + + tr_id = "HHPPG046600C1" + + params = { + "MRKT_DIV_CLS_CODE": mrkt_div_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +######################################################################################## +# [국내주식] 시세분석 > 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] +######################################################################################## + +def investor_trade_by_stock_daily( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_input_date_1: str, # 입력 날짜1 + fid_org_adj_prc: str, # 수정주가 원주가 가격 + fid_etc_cls_code: str, # 기타 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 시세분석 + 종목별 투자자매매동향(일별)[종목별 투자자매매동향(일별)] + 종목별 투자자매매동향(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): J:KRX, NX:NXT, UN:통합 + fid_input_iscd (str): 종목번호 (6자리) + fid_input_date_1 (str): 입력 날짜(20250812) + fid_org_adj_prc (str): 공란 입력 + fid_etc_cls_code (str): 공란 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 종목별 투자자매매동향(일별) 데이터 + + Example: + >>> df1, df2 = investor_trade_by_stock_daily( + ... fid_cond_mrkt_div_code="J", + ... fid_input_iscd="005930", + ... fid_input_date_1="20250812", + ... fid_org_adj_prc="", + ... fid_etc_cls_code="" + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/investor-trade-by-stock-daily" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20250812')") + raise ValueError("fid_input_date_1 is required. (e.g. '20250812')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPTJ04160001" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_ORG_ADJ_PRC": fid_org_adj_prc, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return investor_trade_by_stock_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_org_adj_prc, + fid_etc_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별 외인기관 추정가집계[v1_국내주식-046] +############################################################################################## + +def investor_trend_estimate( + mksc_shrn_iscd: str # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 종목별 외국인, 기관 추정가집계 API입니다. + + 한국투자 MTS > 국내 현재가 > 투자자 > 투자자동향 탭 > 왼쪽구분을 '추정(주)'로 선택 시 확인 가능한 데이터를 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 증권사 직원이 장중에 집계/입력한 자료를 단순 누계한 수치로서, + 입력시간은 외국인 09:30, 11:20, 13:20, 14:30 / 기관종합 10:00, 11:20, 13:20, 14:30 이며, 사정에 따라 변동될 수 있습니다. + + Args: + mksc_shrn_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 종목별 외인기관 추정가집계 데이터 + + Example: + >>> df = investor_trend_estimate(mksc_shrn_iscd="005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/investor-trend-estimate" + + if mksc_shrn_iscd == "": + raise ValueError("mksc_shrn_iscd is required (ex. '123456')") + + tr_id = "HHPTJ04160200" + + params = { + "MKSC_SHRN_ISCD": mksc_shrn_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(무상증자일정)[국내주식-144] +############################################################################################## + +def ksdinfo_bonus_issue( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(무상증자일정)[국내주식-144] + 예탁원정보(무상증자일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(무상증자일정) 데이터 + + Example: + >>> df = ksdinfo_bonus_issue(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/bonus-issue" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669101C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_bonus_issue( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(자본감소일정) [국내주식-149] +############################################################################################## + +def ksdinfo_cap_dcrs( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(자본감소일정)[국내주식-149] + 예탁원정보(자본감소일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(자본감소일정) 데이터 + + Example: + >>> df = ksdinfo_cap_dcrs(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/cap-dcrs" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669106C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_cap_dcrs( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(배당일정)[국내주식-145] +############################################################################################## + +def ksdinfo_dividend( + cts: str, # CTS + gb1: str, # 조회구분 + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + high_gb: str, # 고배당여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(배당일정)[국내주식-145] + 예탁원정보(배당일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + gb1 (str): 0:배당전체, 1:결산배당, 2:중간배당 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + high_gb (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(배당일정) 데이터 + + Example: + >>> df = ksdinfo_dividend(" ", "0", "20230101", "20231231", " ", " ") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/dividend" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '0')") + raise ValueError("gb1 is required. (e.g. '0')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669102C0" + + params = { + "CTS": cts, + "GB1": gb1, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + "HIGH_GB": high_gb, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_dividend( + cts, + gb1, + f_dt, + t_dt, + sht_cd, + high_gb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(실권주일정)[국내주식-152] +############################################################################################## + +def ksdinfo_forfeit( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(실권주일정)[국내주식-152] + 예탁원정보(실권주일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(실권주일정) 데이터 + + Example: + >>> df = ksdinfo_forfeit("001440", "20240315", "20240314", " ") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/forfeit" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20240315')") + raise ValueError("t_dt is required. (e.g. '20240315')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20240314')") + raise ValueError("f_dt is required. (e.g. '20240314')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669109C0" + + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_forfeit( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(상장정보일정)[국내주식-150] +############################################################################################## + +def ksdinfo_list_info( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(상장정보일정)[국내주식-150] + 예탁원정보(상장정보일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(상장정보일정) 데이터 + + Example: + >>> df = ksdinfo_list_info("000660", "20231010", "20231001", "") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/list-info" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20231010')") + raise ValueError("t_dt is required. (e.g. '20231010')") + if not f_dt: + logger.error("f_dt is required. (e.g. '20231001')") + raise ValueError("f_dt is required. (e.g. '20231001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 ID 설정 + + tr_id = "HHKDB669107C0" + + # 요청 파라미터 설정 + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_list_info( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(의무예치일정) [국내주식-153] +############################################################################################## + +def ksdinfo_mand_deposit( + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(의무예치일정)[국내주식-153] + 예탁원정보(의무예치일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + t_dt (str): 조회 종료 일자 (예: '20230301') + sht_cd (str): 종목코드 (공백: 전체, 특정종목 조회시 : 종목코드) + f_dt (str): 조회 시작 일자 (예: '20230101') + cts (str): CTS (공백) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(의무예치일정) 데이터 + + Example: + >>> df = ksdinfo_mand_deposit('20230301', '005930', '20230101', '') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/mand-deposit" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20230301')") + raise ValueError("t_dt is required. (e.g. '20230301')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "HHKDB669110C0" + + # 요청 파라미터 설정 + params = { + "T_DT": t_dt, + "SHT_CD": sht_cd, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 시 데이터 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 다음 페이지 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_mand_deposit( + t_dt, + sht_cd, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(합병_분할일정)[국내주식-147] +############################################################################################## + +def ksdinfo_merger_split( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(합병_분할일정)[국내주식-147] + 예탁원정보(합병_분할일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(합병_분할일정) 데이터 + + Example: + >>> df = ksdinfo_merger_split(" ", "20230101", "20231231", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/merger-split" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669104C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_merger_split( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(유상증자일정)[국내주식-143] +############################################################################################## + +def ksdinfo_paidin_capin( + cts: str, # CTS + gb1: str, # 조회구분 + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(유상증자일정)[국내주식-143] + 예탁원정보(유상증자일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + gb1 (str): 1(청약일별), 2(기준일별) + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백(전체), 특정종목 조회시(종목코드) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(유상증자일정) 데이터 + + Example: + >>> df = ksdinfo_paidin_capin(" ", "1", "20230101", "20231231", " ") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/paidin-capin" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not gb1: + logger.error("gb1 is required. (e.g. '1')") + raise ValueError("gb1 is required. (e.g. '1')") + + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669100C0" + + params = { + "CTS": cts, + "GB1": gb1, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_paidin_capin( + cts, + gb1, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(공모주청약일정)[국내주식-151] +############################################################################################## + +def ksdinfo_pub_offer( + sht_cd: str, # 종목코드 + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(공모주청약일정)[국내주식-151] + 예탁원정보(공모주청약일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(공모주청약일정) 데이터 + + Example: + >>> df = ksdinfo_pub_offer("000000", "", "20230101", "20231231") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/pub-offer" + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669108C0" + + params = { + "SHT_CD": sht_cd, + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_pub_offer( + sht_cd, + cts, + f_dt, + t_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주식매수청구일정)[국내주식-146] +############################################################################################## + +def ksdinfo_purreq( + sht_cd: str, # 종목코드 + t_dt: str, # 조회일자To + f_dt: str, # 조회일자From + cts: str, # CTS + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(주식매수청구일정)[국내주식-146] + 예탁원정보(주식매수청구일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + t_dt (str): ~ 일자 + f_dt (str): 일자 ~ + cts (str): 공백 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(주식매수청구일정) 데이터 + + Example: + >>> df = ksdinfo_purreq("005930", "20231010", "20231001", "") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/purreq" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not t_dt: + logger.error("t_dt is required. (e.g. '20231010')") + raise ValueError("t_dt is required. (e.g. '20231010')") + if not f_dt: + logger.error("f_dt is required. (e.g. '20231001')") + raise ValueError("f_dt is required. (e.g. '20231001')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669103C0" + + params = { + "SHT_CD": sht_cd, + "T_DT": t_dt, + "F_DT": f_dt, + "CTS": cts, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_purreq( + sht_cd, + t_dt, + f_dt, + cts, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(액면교체일정)[국내주식-148] +############################################################################################## + +def ksdinfo_rev_split( + sht_cd: str, # 종목코드 + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + market_gb: str, # 시장구분 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(액면교체일정)[국내주식-148] + 예탁원정보(액면교체일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + market_gb (str): 0:전체, 1:코스피, 2:코스닥 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(액면교체일정) 데이터 + + Example: + >>> df = ksdinfo_rev_split("001390", "", "20230101", "20231231", "0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/rev-split" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + if market_gb not in ["0", "1", "2"]: + logger.error("market_gb must be one of ['0', '1', '2'].") + raise ValueError("market_gb must be one of ['0', '1', '2'].") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669105C0" + + params = { + "SHT_CD": sht_cd, + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "MARKET_GB": market_gb, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_rev_split( + sht_cd, + cts, + f_dt, + t_dt, + market_gb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 예탁원정보(주주총회일정)[국내주식-154] +############################################################################################## + +def ksdinfo_sharehld_meet( + cts: str, # CTS + f_dt: str, # 조회일자From + t_dt: str, # 조회일자To + sht_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 예탁원정보(주주총회일정)[국내주식-154] + 예탁원정보(주주총회일정) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cts (str): 공백 + f_dt (str): 일자 ~ + t_dt (str): ~ 일자 + sht_cd (str): 공백: 전체, 특정종목 조회시 : 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 예탁원정보(주주총회일정) 데이터 + + Example: + >>> df = ksdinfo_sharehld_meet(" ", "20230101", "20231231", " ") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ksdinfo/sharehld-meet" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not f_dt: + logger.error("f_dt is required. (e.g. '20230101')") + raise ValueError("f_dt is required. (e.g. '20230101')") + + if not t_dt: + logger.error("t_dt is required. (e.g. '20231231')") + raise ValueError("t_dt is required. (e.g. '20231231')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHKDB669111C0" + + params = { + "CTS": cts, + "F_DT": f_dt, + "T_DT": t_dt, + "SHT_CD": sht_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return ksdinfo_sharehld_meet( + cts, + f_dt, + t_dt, + sht_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 당사 대주가능 종목 [국내주식-195] +############################################################################################## + +def lendable_by_company( + excg_dvsn_cd: str, # 거래소구분코드 + pdno: str, # 상품번호 + thco_stln_psbl_yn: str, # 당사대주가능여부 + inqr_dvsn_1: str, # 조회구분1 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk100: str, # 연속조회키100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 종목정보 + 당사 대주가능 종목[국내주식-195] + 당사 대주가능 종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excg_dvsn_cd (str): 00(전체), 02(거래소), 03(코스닥) + pdno (str): 공백 : 전체조회, 종목코드 입력 시 해당종목만 조회 + thco_stln_psbl_yn (str): Y + inqr_dvsn_1 (str): 0 : 전체조회, 1: 종목코드순 정렬 + ctx_area_fk200 (str): 미입력 (다음조회 불가) + ctx_area_nk100 (str): 미입력 (다음조회 불가) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 당사 대주가능 종목 데이터 + + Example: + >>> df1, df2 = lendable_by_company('00', '', 'Y', '0', '', '') + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/lendable-by-company" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excg_dvsn_cd: + logger.error("excg_dvsn_cd is required. (e.g. '00')") + raise ValueError("excg_dvsn_cd is required. (e.g. '00')") + + if not thco_stln_psbl_yn: + logger.error("thco_stln_psbl_yn is required. (e.g. 'Y')") + raise ValueError("thco_stln_psbl_yn is required. (e.g. 'Y')") + + if not inqr_dvsn_1: + logger.error("inqr_dvsn_1 is required. (e.g. '0')") + raise ValueError("inqr_dvsn_1 is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTSC2702R" + + params = { + "EXCG_DVSN_CD": excg_dvsn_cd, + "PDNO": pdno, + "THCO_STLN_PSBL_YN": thco_stln_psbl_yn, + "INQR_DVSN_1": inqr_dvsn_1, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK100": ctx_area_nk100, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return lendable_by_company( + excg_dvsn_cd, + pdno, + thco_stln_psbl_yn, + inqr_dvsn_1, + ctx_area_fk200, + ctx_area_nk100, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시가총액 상위 [v1_국내주식-091] +############################################################################################## + +def market_cap( + fid_input_price_2: str, # 입력 가격2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_vol_cnt: str, # 거래량 수 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시가총액 상위[v1_국내주식-091] + 국내주식 시가총액 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20174 ) + fid_div_cls_code (str): 0: 전체, 1:보통주, 2:우선주 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 시가총액 상위 데이터 + + Example: + >>> df = market_cap( + ... fid_input_price_2="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20174", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_vol_cnt="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/market-cap" + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20174": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01740000" + + params = { + "fid_input_price_2": fid_input_price_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_vol_cnt": fid_vol_cnt, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + current_data = pd.DataFrame(res.getBody().output) if hasattr(res.getBody(), 'output') else pd.DataFrame() + + # 기존 데이터프레임과 병합 + dataframe = pd.concat([dataframe, current_data], ignore_index=True) if dataframe is not None else current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return market_cap( + fid_input_price_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_vol_cnt, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 출력 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160] +############################################################################################## + +def market_time() -> pd.DataFrame: + """ + 국내선물 영업일조회 API입니다. + API호출 시 body 혹은 params로 입력하는 사항이 없습니다. + + Returns: + pd.DataFrame: 국내선물 영업일조회 데이터 + + Example: + >>> df = market_time() + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/market-time" + + tr_id = "HHMCM000002C0" # 국내선물 영업일조회 + + params = {} + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + result = pd.DataFrame([res.getBody().output1]) + return result + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시장가치 순위[v1_국내주식-096] +############################################################################################## + +def market_value( + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시장가치 순위[v1_국내주식-096] + 국내주식 시장가치 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_cls_code (str): 0 : 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20179 ) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_div_cls_code (str): 0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_input_option_1 (str): 회계연도 입력 (ex 2023) + fid_input_option_2 (str): 0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산 + fid_rank_sort_cls_code (str): '가치분석(23:PER, 24:PBR, 25:PCR, 26:PSR, 27: EPS, 28:EVA, 29: EBITDA, 30: EV/EBITDA, 31:EBITDA/금융비율' + fid_blng_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 시장가치 순위 데이터 + + Example: + >>> df = market_value( + ... fid_trgt_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20179", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="3", + ... fid_rank_sort_cls_code="23", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/market-value" + # 필수 파라미터 검증 + if fid_trgt_cls_code not in ["0"]: + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_mrkt_div_code not in ["J"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20179": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["23", "24", "25", "26", "27", "28", "29", "30", "31"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code not in ["0"]: + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code not in ["0"]: + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01790000" + + params = { + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return market_value( + fid_trgt_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내 증시자금 종합 [국내주식-193] +############################################################################################## + +def mktfunds( + fid_input_date_1: str = "" +) -> pd.DataFrame: + """ + 국내 증시자금 종합 API입니다. + 한국투자 HTS(eFriend Plus) > [0470] 증시자금 종합 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. (단위: 억원) + + ※ 해당자료는 금융투자협회의 자료를 제공하고 있으며, 오류와 지연이 발생할 수 있습니다. + ※ 위 정보에 의한 투자판단의 최종책임은 정보이용자에게 있으며, 당사와 한국금융투자협회는 어떠한 법적인 책임도 지지 않사오니 투자에 참고로만 이용하시기 바랍니다. + + Args: + fid_input_date_1 (str): [입력날짜] + + Returns: + pd.DataFrame: 국내 증시자금 종합 데이터 + + Example: + >>> df = mktfunds() + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/mktfunds" + + tr_id = "FHKST649100C0" + + params = { + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 신고_신저근접종목 상위[v1_국내주식-105] +############################################################################################## + +def near_new_highlow( + fid_aply_rang_vol: str, # 적용 범위 거래량 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_cnt_1: str, # 입력 수1 + fid_input_cnt_2: str, # 입력 수2 + fid_prc_cls_code: str, # 가격 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 신고_신저근접종목 상위[v1_국내주식-105] + 국내주식 신고_신저근접종목 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_vol (str): 0: 전체, 100: 100주 이상 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20187) + fid_div_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고 + fid_input_cnt_1 (str): 괴리율 최소 + fid_input_cnt_2 (str): 괴리율 최대 + fid_prc_cls_code (str): 0:신고근접, 1:신저근접 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_trgt_cls_code (str): 0: 전체 + fid_trgt_exls_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_aply_rang_prc_1 (str): 가격 ~ + fid_aply_rang_prc_2 (str): ~ 가격 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 신고_신저근접종목 상위 데이터 + + Example: + >>> df = near_new_highlow( + ... fid_aply_rang_vol="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20187", + ... fid_div_cls_code="0", + ... fid_input_cnt_1="0", + ... fid_input_cnt_2="100", + ... fid_prc_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_aply_rang_prc_1="0", + ... fid_aply_rang_prc_2="1000000" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/near-new-highlow" + # 필수 파라미터 검증 + if fid_aply_rang_vol not in ["0", "100"]: + raise ValueError("적용 범위 거래량 확인요망!!!") + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20187": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_div_cls_code not in ["0", "1", "2", "3"]: + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_prc_cls_code not in ["0", "1"]: + raise ValueError("가격 구분 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001", "4001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01870000" + + params = { + "fid_aply_rang_vol": fid_aply_rang_vol, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + "fid_input_cnt_2": fid_input_cnt_2, + "fid_prc_cls_code": fid_prc_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 기존 데이터프레임과 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return near_new_highlow( + fid_aply_rang_vol, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_cnt_1, + fid_input_cnt_2, + fid_prc_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 발생 시 처리 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 종합 시황/공시(제목) [국내주식-141] +############################################################################################## + +def news_title( + fid_news_ofer_entp_code: str, # 뉴스 제공 업체 코드 + fid_cond_mrkt_cls_code: str, # 조건 시장 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_titl_cntt: str, # 제목 내용 + fid_input_date_1: str, # 입력 날짜 + fid_input_hour_1: str, # 입력 시간 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_srno: str, # 입력 일련번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 업종/기타 + 종합 시황_공시(제목)[국내주식-141] + 종합 시황_공시(제목) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_news_ofer_entp_code (str): 뉴스 제공 업체 코드 + fid_cond_mrkt_cls_code (str): 조건 시장 구분 코드 + fid_input_iscd (str): 입력 종목코드 + fid_titl_cntt (str): 제목 내용 + fid_input_date_1 (str): 입력 날짜 + fid_input_hour_1 (str): 입력 시간 + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 + fid_input_srno (str): 입력 일련번호 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 종합 시황_공시(제목) 데이터 + + Example: + >>> df = news_title( + ... fid_news_ofer_entp_code='2', + ... fid_cond_mrkt_cls_code='00', + ... fid_input_iscd='005930', + ... fid_titl_cntt='', + ... fid_input_date_1='20231010', + ... fid_input_hour_1='090000', + ... fid_rank_sort_cls_code='01', + ... fid_input_srno='1' + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/news-title" + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API URL 및 거래 ID 설정 + tr_id = "FHKST01011800" + + # 요청 파라미터 설정 + params = { + "FID_NEWS_OFER_ENTP_CODE": fid_news_ofer_entp_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TITL_CNTT": fid_titl_cntt, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_SRNO": fid_input_srno, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return news_title( + fid_news_ofer_entp_code, + fid_cond_mrkt_cls_code, + fid_input_iscd, + fid_titl_cntt, + fid_input_date_1, + fid_input_hour_1, + fid_rank_sort_cls_code, + fid_input_srno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(현금)[v1_국내주식-001] +############################################################################################## + +def order_cash( + env_dv: str, # 실전모의구분 (real:실전, demo:모의) + ord_dv: str, # 매도매수구분 (buy:매수, sell:매도) + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 (종목코드) + ord_dvsn: str, # 주문구분 + ord_qty: str, # 주문수량 + ord_unpr: str, # 주문단가 + excg_id_dvsn_cd: str, # 거래소ID구분코드 + sll_type: str = "", # 매도유형 (매도주문 시) + cndt_pric: str = "" # 조건가격 +) -> pd.DataFrame: + """ + 국내주식주문(현금) API 입니다. + + ※ TTC0802U(현금매수) 사용하셔서 미수매수 가능합니다. 단, 거래하시는 계좌가 증거금40%계좌로 신청이 되어있어야 가능합니다. + ※ 신용매수는 별도의 API가 준비되어 있습니다. + + ※ ORD_QTY(주문수량), ORD_UNPR(주문단가) 등을 String으로 전달해야 함에 유의 부탁드립니다. + + ※ ORD_UNPR(주문단가)가 없는 주문은 상한가로 주문금액을 선정하고 이후 체결이되면 체결금액로 정산됩니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + env_dv (str): [필수] 실전모의구분 (real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (buy:매수, sell:매도) + cano (str): [필수] 종합계좌번호 (종합계좌번호) + acnt_prdt_cd (str): [필수] 계좌상품코드 (상품유형코드) + pdno (str): [필수] 상품번호 (종목코드(6자리) , ETN의 경우 7자리 입력) + ord_dvsn (str): [필수] 주문구분 + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + excg_id_dvsn_cd (str): [필수] 거래소ID구분코드 (KRX) + sll_type (str): 매도유형 (매도주문 시) (01:일반매도,02:임의매매,05:대차매도) + cndt_pric (str): 조건가격 (스탑지정가호가 주문 시 사용) + + Returns: + pd.DataFrame: 주식주문 결과 데이터 + + Example: + >>> df = order_cash(env_dv="demo", ord_dv="buy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_dvsn="00", ord_qty="1", ord_unpr="70000", excg_id_dvsn_cd="KRX") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-cash" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real:실전, demo:모의')") + + if ord_dv == "" or ord_dv is None: + raise ValueError("ord_dv is required (e.g. 'buy:매수, sell:매도')") + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '종합계좌번호')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '상품유형코드')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '종목코드(6자리) , ETN의 경우 7자리 입력')") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required (e.g. '')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required (e.g. '')") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required (e.g. '')") + + if excg_id_dvsn_cd == "" or excg_id_dvsn_cd is None: + raise ValueError("excg_id_dvsn_cd is required (e.g. 'KRX')") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "sell": + tr_id = "TTTC0011U" + elif ord_dv == "buy": + tr_id = "TTTC0012U" + else: + raise ValueError("ord_dv can only be sell or buy") + elif env_dv == "demo": + if ord_dv == "sell": + tr_id = "VTTC0011U" + elif ord_dv == "buy": + tr_id = "VTTC0012U" + else: + raise ValueError("ord_dv can only be sell or buy") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "PDNO": pdno, # 상품번호 + "ORD_DVSN": ord_dvsn, # 주문구분 + "ORD_QTY": ord_qty, # 주문수량 + "ORD_UNPR": ord_unpr, # 주문단가 + "EXCG_ID_DVSN_CD": excg_id_dvsn_cd, # 거래소ID구분코드 + "SLL_TYPE": sll_type, # 매도유형 + "CNDT_PRIC": cndt_pric # 조건가격 + } + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(신용)[v1_국내주식-002] +############################################################################################## + +def order_credit( + ord_dv: str, # 매수매도구분 (buy:매수, sell:매도) + cano: str, # 종합계좌번호 (12345678) + acnt_prdt_cd: str, # 계좌상품코드 (01) + pdno: str, # 상품번호 (123456) + crdt_type: str, # 신용유형 + loan_dt: str, # 대출일자 + ord_dvsn: str, # 주문구분 + ord_qty: str, # 주문수량 + ord_unpr: str, # 주문단가 + excg_id_dvsn_cd: str = "", # 거래소ID구분코드 (KRX:한국거래소, NXT:넥스트레이드, SOR:SOR) + sll_type: str = "", # 매도유형 + rsvn_ord_yn: str = "", # 예약주문여부 (Y: 예약주문, N: 신용주문) + emgc_ord_yn: str = "", # 비상주문여부 + pgtr_dvsn: str = "", # 프로그램매매구분 + mgco_aptm_odno: str = "", # 운용사지정주문번호 + lqty_tr_ngtn_dtl_no: str = "", # 대량거래협상상세번호 + lqty_tr_agmt_no: str = "", # 대량거래협정번호 + lqty_tr_ngtn_id: str = "", # 대량거래협상자Id + lp_ord_yn: str = "", # LP주문여부 + mdia_odno: str = "", # 매체주문번호 + ord_svr_dvsn_cd: str = "", # 주문서버구분코드 + pgm_nmpr_stmt_dvsn_cd: str = "", # 프로그램호가신고구분코드 + cvrg_slct_rson_cd: str = "", # 반대매매선정사유코드 + cvrg_seq: str = "", # 반대매매순번 + cndt_pric: str = "" # 조건가격 +) -> pd.DataFrame: + """ + 국내주식주문(신용) API입니다. + ※ 모의투자는 사용 불가합니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + ord_dv (str): [필수] 매수매도구분 (ex. buy:매수, sell:매도) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + pdno (str): [필수] 상품번호 (ex. 123456) + crdt_type (str): [필수] 신용유형 (ex. [매도] 22:유통대주신규, 24:자기대주신규, 25:자기융자상환, 27:유통융자상환 / [매수] 21:자기융자신규, 23:유통융자신규 , 26:유통대주상환, 28:자기대주상환) + loan_dt (str): [필수] 대출일자 (ex. [신용매수] 오늘날짜(yyyyMMdd), [신용매도] 매도할 종목의 대출일자(yyyyMMdd)) + ord_dvsn (str): [필수] 주문구분 + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + excg_id_dvsn_cd (str): 거래소ID구분코드 (ex. KRX:한국거래소, NXT:넥스트레이드, SOR:SOR) + sll_type (str): 매도유형 + rsvn_ord_yn (str): 예약주문여부 (ex. Y: 예약주문, N: 신용주문) + emgc_ord_yn (str): 비상주문여부 + pgtr_dvsn (str): 프로그램매매구분 + mgco_aptm_odno (str): 운용사지정주문번호 + lqty_tr_ngtn_dtl_no (str): 대량거래협상상세번호 + lqty_tr_agmt_no (str): 대량거래협정번호 + lqty_tr_ngtn_id (str): 대량거래협상자Id + lp_ord_yn (str): LP주문여부 + mdia_odno (str): 매체주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + pgm_nmpr_stmt_dvsn_cd (str): 프로그램호가신고구분코드 + cvrg_slct_rson_cd (str): 반대매매선정사유코드 + cvrg_seq (str): 반대매매순번 + cndt_pric (str): 조건가격 + + Returns: + pd.DataFrame: 주식주문(신용) 결과 데이터 + + Example: + >>> df = order_credit(ord_dv="buy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", crdt_type="21", loan_dt="20220810", ord_dvsn="00", ord_qty="1", ord_unpr="55000") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-credit" + + # 필수 파라미터 검증 + if ord_dv == "" or ord_dv is None: + raise ValueError("ord_dv is required (e.g. 'buy:매수, sell:매도')") + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '123456')") + + if crdt_type == "" or crdt_type is None: + raise ValueError( + "crdt_type is required (e.g. '[매도] 22:유통대주신규, 24:자기대주신규, 25:자기융자상환, 27:유통융자상환 / [매수] 21:자기융자신규, 23:유통융자신규 , 26:유통대주상환, 28:자기대주상환')") + + if loan_dt == "" or loan_dt is None: + raise ValueError("loan_dt is required (e.g. '[신용매수] 오늘날짜(yyyyMMdd), [신용매도] 매도할 종목의 대출일자(yyyyMMdd)')") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required") + + # tr_id 설정 + if ord_dv == "buy": + tr_id = "TTTC0052U" + elif ord_dv == "sell": + tr_id = "TTTC0051U" + else: + raise ValueError("ord_dv can only be buy or sell") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "CRDT_TYPE": crdt_type, + "LOAN_DT": loan_dt, + "ORD_DVSN": ord_dvsn, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr + } + + # 옵션 파라미터 추가 + if excg_id_dvsn_cd: + params["EXCG_ID_DVSN_CD"] = excg_id_dvsn_cd + if sll_type: + params["SLL_TYPE"] = sll_type + if rsvn_ord_yn: + params["RSVN_ORD_YN"] = rsvn_ord_yn + if emgc_ord_yn: + params["EMGC_ORD_YN"] = emgc_ord_yn + if pgtr_dvsn: + params["PGTR_DVSN"] = pgtr_dvsn + if mgco_aptm_odno: + params["MGCO_APTM_ODNO"] = mgco_aptm_odno + if lqty_tr_ngtn_dtl_no: + params["LQTY_TR_NGTN_DTL_NO"] = lqty_tr_ngtn_dtl_no + if lqty_tr_agmt_no: + params["LQTY_TR_AGMT_NO"] = lqty_tr_agmt_no + if lqty_tr_ngtn_id: + params["LQTY_TR_NGTN_ID"] = lqty_tr_ngtn_id + if lp_ord_yn: + params["LP_ORD_YN"] = lp_ord_yn + if mdia_odno: + params["MDIA_ODNO"] = mdia_odno + if ord_svr_dvsn_cd: + params["ORD_SVR_DVSN_CD"] = ord_svr_dvsn_cd + if pgm_nmpr_stmt_dvsn_cd: + params["PGM_NMPR_STMT_DVSN_CD"] = pgm_nmpr_stmt_dvsn_cd + if cvrg_slct_rson_cd: + params["CVRG_SLCT_RSON_CD"] = cvrg_slct_rson_cd + if cvrg_seq: + params["CVRG_SEQ"] = cvrg_seq + if cndt_pric: + params["CNDT_PRIC"] = cndt_pric + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문[v1_국내주식-017] +############################################################################################## + +def order_resv( + cano: str, + acnt_prdt_cd: str, + pdno: str, + ord_qty: str, + ord_unpr: str, + sll_buy_dvsn_cd: str, + ord_dvsn_cd: str, + ord_objt_cblc_dvsn_cd: str, + loan_dt: Optional[str] = "", + rsvn_ord_end_dt: Optional[str] = "", + ldng_dt: Optional[str] = "" +) -> pd.DataFrame: + """ + 국내주식 예약주문 매수/매도 API 입니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + ※ 유의사항 + 1. 예약주문 가능시간 : 15시 40분 ~ 다음 영업일 7시 30분 + (단, 서버 초기화 작업 시 예약주문 불가 : 23시 40분 ~ 00시 10분) + ※ 예약주문 처리내역은 통보되지 않으므로 주문처리일 장 시작전에 반드시 주문처리 결과를 확인하시기 바랍니다. + + 2. 예약주문 안내 + - 예약종료일 미입력 시 일반예약주문으로 최초 도래하는 영업일에 주문 전송됩니다. + - 예약종료일 입력 시 기간예약주문으로 최초 예약주문수량 중 미체결 된 수량에 대해 예약종료일까지 매 영업일 주문이 + 실행됩니다. (예약종료일은 익영업일부터 달력일 기준으로 공휴일 포함하여 최대 30일이 되는 일자까지 입력가능) + - 예약주문 접수 처리순서는 일반/기간예약주문 중 신청일자가 빠른 주문이 우선합니다. + 단, 기간예약주문 자동배치시간(약 15시35분 ~ 15시55분)사이 접수되는 주문의 경우 당일에 한해 순서와 상관없이 + 처리될 수 있습니다. + - 기간예약주문 자동배치시간(약 15시35분 ~ 15시55분)에는 예약주문 조회가 제한 될 수 있습니다. + - 기간예약주문은 계좌 당 주문건수 최대 1,000건으로 제한됩니다. + + 3. 예약주문 접수내역 중 아래의 사유 등으로 인해 주문이 거부될 수 있사오니, 주문처리일 장 시작전에 반드시 + 주문처리 결과를 확인하시기 바랍니다. + * 주문처리일 기준 : 매수가능금액 부족, 매도가능수량 부족, 주문수량/호가단위 오류, 대주 호가제한, + 신용/대주가능종목 변경, 상/하한폭 변경, 시가형성 종목(신규상장 등)의 시장가, 거래서비스 미신청 등 + + 4. 익일 예상 상/하한가는 조회시점의 현재가로 계산되며 익일의 유/무상증자, 배당, 감자, 합병, 액면변경 등에 의해 + 변동될 수 있으며 이로 인해 상/하한가를 벗어나 주문이 거부되는 경우가 발생할 수 있사오니, 주문처리일 장 시작전에 + 반드시 주문처리결과를 확인하시기 바랍니다. + + 5. 정리매매종목, ELW, 신주인수권증권, 신주인수권증서 등은 가격제한폭(상/하한가) 적용 제외됩니다. + + 6. 영업일 장 시작 후 [기간예약주문] 내역 취소는 해당시점 이후의 예약주문이 취소되는 것으로, + 일반주문으로 이미 전환된 주문에는 영향을 미치지 않습니다. 반드시 장 시작전 주문처리결과를 확인하시기 바랍니다. + + Args: + cano (str): [필수] 종합계좌번호 (계좌번호 체계(8-2)의 앞 8자리) + acnt_prdt_cd (str): [필수] 계좌상품코드 (계좌번호 체계(8-2)의 뒤 2자리) + pdno (str): [필수] 종목코드(6자리) + ord_qty (str): [필수] 주문수량 (주0문주식수) + ord_unpr (str): [필수] 주문단가 (1주당 가격, 시장가/장전 시간외는 0 입력) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (01 : 매도, 02 : 매수) + ord_dvsn_cd (str): [필수] 주문구분코드 (00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외) + ord_objt_cblc_dvsn_cd (str): [필수] 주문대상잔고구분코드 (10: 현금, 12~28: 각종 대출/상환코드) + loan_dt (Optional[str]): 대출일자 + rsvn_ord_end_dt (Optional[str]): 예약주문종료일자 (YYYYMMDD, 익영업일부터 최대 30일 이내) + ldng_dt (Optional[str]): 대여일자 + + Returns: + pd.DataFrame: 예약주문 결과 데이터 + + Example: + >>> df = order_resv(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="005930", ord_qty="1", ord_unpr="55000", sll_buy_dvsn_cd="02", ord_dvsn_cd="00", ord_objt_cblc_dvsn_cd="10") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-resv" + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '계좌번호 체계(8-2)의 앞 8자리')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '계좌번호 체계(8-2)의 뒤 2자리')") + + if pdno == "" or pdno is None: + raise ValueError("pdno is required (e.g. '종목코드(6자리)')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required (e.g. '주0문주식수')") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required (e.g. '1주당 가격, 시장가/장전 시간외는 0 입력')") + + if sll_buy_dvsn_cd == "" or sll_buy_dvsn_cd is None: + raise ValueError("sll_buy_dvsn_cd is required (e.g. '01 : 매도, 02 : 매수')") + + if ord_dvsn_cd == "" or ord_dvsn_cd is None: + raise ValueError("ord_dvsn_cd is required (e.g. '00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외')") + + if ord_objt_cblc_dvsn_cd == "" or ord_objt_cblc_dvsn_cd is None: + raise ValueError("ord_objt_cblc_dvsn_cd is required (e.g. '10: 현금, 12~28: 각종 대출/상환코드')") + + tr_id = "CTSC0008U" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "ORD_DVSN_CD": ord_dvsn_cd, + "ORD_OBJT_CBLC_DVSN_CD": ord_objt_cblc_dvsn_cd + } + + if loan_dt: + params["LOAN_DT"] = loan_dt + if rsvn_ord_end_dt: + params["RSVN_ORD_END_DT"] = rsvn_ord_end_dt + if ldng_dt: + params["LDNG_DT"] = ldng_dt + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] +############################################################################################## + +def order_resv_ccnl( + rsvn_ord_ord_dt: str, # [필수] 예약주문시작일자 + rsvn_ord_end_dt: str, # [필수] 예약주문종료일자 + tmnl_mdia_kind_cd: str, # [필수] 단말매체종류코드 (ex. 00) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + prcs_dvsn_cd: str, # [필수] 처리구분코드 (ex. 0) + cncl_yn: str, # [필수] 취소여부 (ex. Y) + rsvn_ord_seq: str = "", # 예약주문순번 + pdno: str = "", # 상품번호 (ex. 005930) + sll_buy_dvsn_cd: str = "", # 매도매수구분코드 (ex. 01) + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 국내예약주문 처리내역 조회 API 입니다. + 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + + Args: + rsvn_ord_ord_dt (str): [필수] 예약주문시작일자 + rsvn_ord_end_dt (str): [필수] 예약주문종료일자 + tmnl_mdia_kind_cd (str): [필수] 단말매체종류코드 (ex. 00) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + prcs_dvsn_cd (str): [필수] 처리구분코드 (ex. 0) + cncl_yn (str): [필수] 취소여부 (ex. Y) + rsvn_ord_seq (str): 예약주문순번 + pdno (str): 상품번호 (ex. 005930) + sll_buy_dvsn_cd (str): 매도매수구분코드 (ex. 01) + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 주식예약주문조회 데이터 + + Example: + >>> df = order_resv_ccnl( + ... rsvn_ord_ord_dt="20220729", + ... rsvn_ord_end_dt="20220810", + ... tmnl_mdia_kind_cd="00", + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... prcs_dvsn_cd="0", + ... cncl_yn="Y" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-resv-ccnl" + + # 필수 파라미터 검증 + if rsvn_ord_ord_dt == "": + raise ValueError("rsvn_ord_ord_dt is required") + + if rsvn_ord_end_dt == "": + raise ValueError("rsvn_ord_end_dt is required") + + if tmnl_mdia_kind_cd == "": + raise ValueError("tmnl_mdia_kind_cd is required (e.g. '00')") + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if prcs_dvsn_cd == "": + raise ValueError("prcs_dvsn_cd is required (e.g. '0')") + + if cncl_yn == "": + raise ValueError("cncl_yn is required (e.g. 'Y')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTSC0004R" # 주식예약주문조회 + + params = { + "RSVN_ORD_ORD_DT": rsvn_ord_ord_dt, # 예약주문시작일자 + "RSVN_ORD_END_DT": rsvn_ord_end_dt, # 예약주문종료일자 + "TMNL_MDIA_KIND_CD": tmnl_mdia_kind_cd, # 단말매체종류코드 + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "PRCS_DVSN_CD": prcs_dvsn_cd, # 처리구분코드 + "CNCL_YN": cncl_yn, # 취소여부 + "RSVN_ORD_SEQ": rsvn_ord_seq, # 예약주문순번 + "PDNO": pdno, # 상품번호 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return order_resv_ccnl( + rsvn_ord_ord_dt, rsvn_ord_end_dt, tmnl_mdia_kind_cd, cano, acnt_prdt_cd, + prcs_dvsn_cd, cncl_yn, rsvn_ord_seq, pdno, sll_buy_dvsn_cd, + FK200, NK200, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문정정취소[v1_국내주식-018,019] +############################################################################################## + +def order_resv_rvsecncl( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + rsvn_ord_seq: str, # [필수] 예약주문순번 + rsvn_ord_orgno: str, # [필수] 예약주문조직번호 + rsvn_ord_ord_dt: str, # [필수] 예약주문주문일자 + ord_type: str, # [필수] 주문구분 (ex. cancel:취소, modify:정정) + pdno: Optional[str] = "", # 종목코드 + ord_qty: Optional[str] = "", # 주문수량 + ord_unpr: Optional[str] = "", # 주문단가 + sll_buy_dvsn_cd: Optional[str] = "", # 매도매수구분코드 (ex. 01:매도, 02:매수) + ord_dvsn_cd: Optional[str] = "", # 주문구분코드 (ex. 00:지정가, 01:시장가, 02:조건부지정가, 05:장전 시간외) + ord_objt_cblc_dvsn_cd: Optional[str] = "", # 주문대상잔고구분코드 (ex. 10 : 현금, 12 : 주식담보대출, ... 28 : 자기대주상환) + loan_dt: Optional[str] = "", # 대출일자 + rsvn_ord_end_dt: Optional[str] = "", # 예약주문종료일자 + ctal_tlno: Optional[str] = "" # 연락전화번호 +) -> pd.DataFrame: + """ + 국내주식 예약주문 정정/취소 API 입니다. + * 정정주문은 취소주문에 비해 필수 입력값이 추가 됩니다. + 하단의 입력값을 참조하시기 바랍니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + rsvn_ord_seq (str): [필수] 예약주문순번 + rsvn_ord_orgno (str): [필수] 예약주문조직번호 + rsvn_ord_ord_dt (str): [필수] 예약주문주문일자 + ord_type (str): [필수] 주문구분 (ex. cancel:취소, modify:정정) + pdno (Optional[str]): 종목코드 + ord_qty (Optional[str]): 주문수량 + ord_unpr (Optional[str]): 주문단가 + sll_buy_dvsn_cd (Optional[str]): 매도매수구분코드 (ex. 01:매도, 02:매수) + ord_dvsn_cd (Optional[str]): 주문구분코드 (ex. 00:지정가, 01:시장가, 02:조건부지정가, 05:장전 시간외) + ord_objt_cblc_dvsn_cd (Optional[str]): 주문대상잔고구분코드 (ex. 10 : 현금, 12 : 주식담보대출, ... 28 : 자기대주상환) + loan_dt (Optional[str]): 대출일자 + rsvn_ord_end_dt (Optional[str]): 예약주문종료일자 + ctal_tlno (Optional[str]): 연락전화번호 + + Returns: + pd.DataFrame: 주식예약주문정정취소 결과 데이터 + + Example: + >>> df = order_resv_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rsvn_ord_seq="88793", rsvn_ord_orgno="123", rsvn_ord_ord_dt="20250113", ord_type="cancel") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-resv-rvsecncl" + + # 필수 파라미터 검증 + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if rsvn_ord_seq == "" or rsvn_ord_seq is None: + raise ValueError("rsvn_ord_seq is required") + + if rsvn_ord_orgno == "" or rsvn_ord_orgno is None: + raise ValueError("rsvn_ord_orgno is required") + + if rsvn_ord_ord_dt == "" or rsvn_ord_ord_dt is None: + raise ValueError("rsvn_ord_ord_dt is required") + + if ord_type == "" or ord_type is None: + raise ValueError("ord_type is required") + + # tr_id 설정 + if ord_type == "cancel": + tr_id = "CTSC0009U" + elif ord_type == "modify": + tr_id = "CTSC0013U" + else: + raise ValueError("ord_type can only be cancel or modify") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RSVN_ORD_SEQ": rsvn_ord_seq, + "RSVN_ORD_ORGNO": rsvn_ord_orgno, + "RSVN_ORD_ORD_DT": rsvn_ord_ord_dt + } + + # 옵션 파라미터 추가 + if pdno: + params["PDNO"] = pdno + if ord_qty: + params["ORD_QTY"] = ord_qty + if ord_unpr: + params["ORD_UNPR"] = ord_unpr + if sll_buy_dvsn_cd: + params["SLL_BUY_DVSN_CD"] = sll_buy_dvsn_cd + if ord_dvsn_cd: + params["ORD_DVSN_CD"] = ord_dvsn_cd + if ord_objt_cblc_dvsn_cd: + params["ORD_OBJT_CBLC_DVSN_CD"] = ord_objt_cblc_dvsn_cd + if loan_dt: + params["LOAN_DT"] = loan_dt + if rsvn_ord_end_dt: + params["RSVN_ORD_END_DT"] = rsvn_ord_end_dt + if ctal_tlno: + params["CTAL_TLNO"] = ctal_tlno + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(정정취소)[v1_국내주식-003] +############################################################################################## + +def order_rvsecncl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 + krx_fwdg_ord_orgno: str, # [필수] 한국거래소전송주문조직번호 + orgn_odno: str, # [필수] 원주문번호 + ord_dvsn: str, # [필수] 주문구분 + rvse_cncl_dvsn_cd: str, # [필수] 정정취소구분코드 (ex. 01:정정,02:취소) + ord_qty: str, # [필수] 주문수량 + ord_unpr: str, # [필수] 주문단가 + qty_all_ord_yn: str, # [필수] 잔량전부주문여부 (ex. Y:전량, N:일부) + excg_id_dvsn_cd: str, # [필수] 거래소ID구분코드 (ex. KRX: 한국거래소, NXT:대체거래소,SOR:SOR) + cndt_pric: Optional[str] = "" # 조건가격 +) -> pd.DataFrame: + """ + 주문 건에 대하여 정정 및 취소하는 API입니다. 단, 이미 체결된 건은 정정 및 취소가 불가합니다. + + ※ 정정은 원주문에 대한 주문단가 혹은 주문구분을 변경하는 사항으로, 정정이 가능한 수량은 원주문수량을 초과 할 수 없습니다. + + ※ 주식주문(정정취소) 호출 전에 반드시 주식정정취소가능주문조회 호출을 통해 정정취소가능수량(output > psbl_qty)을 확인하신 후 정정취소주문 내시기 바랍니다. + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 + krx_fwdg_ord_orgno (str): [필수] 한국거래소전송주문조직번호 + orgn_odno (str): [필수] 원주문번호 + ord_dvsn (str): [필수] 주문구분 + rvse_cncl_dvsn_cd (str): [필수] 정정취소구분코드 (ex. 01:정정,02:취소) + ord_qty (str): [필수] 주문수량 + ord_unpr (str): [필수] 주문단가 + qty_all_ord_yn (str): [필수] 잔량전부주문여부 (ex. Y:전량, N:일부) + excg_id_dvsn_cd (str): [필수] 거래소ID구분코드 (ex. KRX: 한국거래소, NXT:대체거래소,SOR:SOR) + cndt_pric (Optional[str]): 조건가격 + + Returns: + pd.DataFrame: 주식주문(정정취소) 결과 데이터 + + Example: + >>> df = order_rvsecncl(env_dv="real", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ...) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/order-rvsecncl" + + # 필수 파라미터 검증 + if env_dv == "" or env_dv is None: + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + if cano == "" or cano is None: + raise ValueError("cano is required") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required") + + if krx_fwdg_ord_orgno == "" or krx_fwdg_ord_orgno is None: + raise ValueError("krx_fwdg_ord_orgno is required") + + if orgn_odno == "" or orgn_odno is None: + raise ValueError("orgn_odno is required") + + if ord_dvsn == "" or ord_dvsn is None: + raise ValueError("ord_dvsn is required") + + if rvse_cncl_dvsn_cd == "" or rvse_cncl_dvsn_cd is None: + raise ValueError("rvse_cncl_dvsn_cd is required (e.g. '01', '02')") + + if ord_qty == "" or ord_qty is None: + raise ValueError("ord_qty is required") + + if ord_unpr == "" or ord_unpr is None: + raise ValueError("ord_unpr is required") + + if qty_all_ord_yn == "" or qty_all_ord_yn is None: + raise ValueError("qty_all_ord_yn is required (e.g. 'Y', 'N')") + + if excg_id_dvsn_cd == "" or excg_id_dvsn_cd is None: + raise ValueError("excg_id_dvsn_cd is required (e.g. 'KRX', 'NXT', 'SOR')") + + # tr_id 설정 + if env_dv == "real": + tr_id = "TTTC0013U" + elif env_dv == "demo": + tr_id = "VTTC0013U" + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "KRX_FWDG_ORD_ORGNO": krx_fwdg_ord_orgno, + "ORGN_ODNO": orgn_odno, + "ORD_DVSN": ord_dvsn, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "ORD_UNPR": ord_unpr, + "QTY_ALL_ORD_YN": qty_all_ord_yn, + "EXCG_ID_DVSN_CD": excg_id_dvsn_cd + } + + # 옵션 파라미터 추가 + if cndt_pric: + params["CNDT_PRIC"] = cndt_pric + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + return pd.DataFrame([res.getBody().output]) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 시간외예상체결등락률 [국내주식-140] +############################################################################################## + +def overtime_exp_trans_fluct( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:주식) + fid_cond_scr_div_code: str, # [필수] 조건 화면 분류 코드 (ex. 11186) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_rank_sort_cls_code: str, # [필수] 순위 정렬 구분 코드 (ex. 0:상승률, 1:상승폭, 2:보합, 3:하락률, 4:하락폭) + fid_div_cls_code: str, # [필수] 분류 구분 코드 (ex. 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + fid_input_price_1: str = "", # 입력 가격1 + fid_input_price_2: str = "", # 입력 가격2 + fid_input_vol_1: str = "" # 입력 거래량 +) -> pd.DataFrame: + """ + 국내주식 시간외예상체결등락률 API입니다. + 한국투자 HTS(eFriend Plus) > [0236] 시간외 예상체결등락률 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:주식) + fid_cond_scr_div_code (str): [필수] 조건 화면 분류 코드 (ex. 11186) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 0000:전체, 0001:코스피, 1001:코스닥) + fid_rank_sort_cls_code (str): [필수] 순위 정렬 구분 코드 (ex. 0:상승률, 1:상승폭, 2:보합, 3:하락률, 4:하락폭) + fid_div_cls_code (str): [필수] 분류 구분 코드 (ex. 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주) + fid_input_price_1 (str): 입력 가격1 + fid_input_price_2 (str): 입력 가격2 + fid_input_vol_1 (str): 입력 거래량 + + Returns: + pd.DataFrame: 국내주식 시간외예상체결등락률 데이터 + + Example: + >>> df = overtime_exp_trans_fluct("J", "11186", "0000", "0", "0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/overtime-exp-trans-fluct" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11186')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '0000')") + + if fid_rank_sort_cls_code == "": + raise ValueError("fid_rank_sort_cls_code is required (e.g. '0')") + + if fid_div_cls_code == "": + raise ValueError("fid_div_cls_code is required (e.g. '0')") + + tr_id = "FHKST11860000" # 국내주식 시간외예상체결등락률 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 시간외등락율순위[국내주식-138] +############################################################################################## + +def overtime_fluctuation( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_mrkt_cls_code: str, # 시장 구분 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외등락율순위[국내주식-138] + 국내주식 시간외등락율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (J: 주식) + fid_mrkt_cls_code (str): 공백 입력 + fid_cond_scr_div_code (str): Unique key(20234) + fid_input_iscd (str): 0000(전체), 0001(코스피), 1001(코스닥) + fid_div_cls_code (str): 1(상한가), 2(상승률), 3(보합),4(하한가),5(하락률) + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_trgt_cls_code (str): 공백 입력 + fid_trgt_exls_cls_code (str): 공백 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 시간외등락율순위 데이터 + + Example: + >>> df1, df2 = overtime_fluctuation( + ... fid_cond_mrkt_div_code='J', + ... fid_mrkt_cls_code='', + ... fid_cond_scr_div_code='20234', + ... fid_input_iscd='0000', + ... fid_div_cls_code='1', + ... fid_input_price_1='', + ... fid_input_price_2='', + ... fid_vol_cnt='', + ... fid_trgt_cls_code='', + ... fid_trgt_exls_cls_code='' + ... ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/ranking/overtime-fluctuation" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20234')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20234')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '1')") + raise ValueError("fid_div_cls_code is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPST02340000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return overtime_fluctuation( + fid_cond_mrkt_div_code, + fid_mrkt_cls_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 국내주식 > 국내주식 시간외거래량순위[국내주식-139] +############################################################################################## + +def overtime_volume( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 시간외거래량순위[국내주식-139] + 국내주식 시간외거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (J: 주식) + fid_cond_scr_div_code (str): Unique key(20235) + fid_input_iscd (str): 0000(전체), 0001(코스피), 1001(코스닥) + fid_rank_sort_cls_code (str): 0(매수잔량), 1(매도잔량), 2(거래량) + fid_input_price_1 (str): 가격 ~ + fid_input_price_2 (str): ~ 가격 + fid_vol_cnt (str): 거래량 ~ + fid_trgt_cls_code (str): 공백 + fid_trgt_exls_cls_code (str): 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 국내주식 시간외거래량순위 데이터 + + Example: + >>> df1, df2 = overtime_volume( + fid_cond_mrkt_div_code='J', + fid_cond_scr_div_code='20235', + fid_input_iscd='0000', + fid_rank_sort_cls_code='2', + fid_input_price_1='', + fid_input_price_2='', + fid_vol_cnt='', + fid_trgt_cls_code='', + fid_trgt_exls_cls_code='' + ) + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/ranking/overtime-volume" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20235')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20235')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '2')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '2')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHPST02350000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], + ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], + ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return overtime_volume( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 매물대/거래비중 [국내주식-196] +############################################################################################## + +def pbar_tratio( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 20113) + fid_input_hour_1: str = "", # 입력시간 (기본값: "") +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 국내주식 매물대/거래비중 API입니다. + 한국투자 HTS(eFriend Plus) > [0113] 당일가격대별 매물대 화면의 데이터 중 일부를 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 20113) + fid_input_hour_1 (str): 입력시간 (기본값: "") + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = pbar_tratio("J", "005930", "20113") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/quotations/pbar-tratio" + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '20113')") + + tr_id = "FHPST01130000" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_HOUR_1": fid_input_hour_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) - 단일 객체를 DataFrame으로 변환 + output1_data = pd.DataFrame([res.getBody().output1]) + + # output2 (array) - 배열을 DataFrame으로 변환 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 잔고조회[v1_국내주식-036] +############################################################################################## + +def pension_inquire_balance( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd: str, # [필수] 적립금구분코드 (ex. 00) + inqr_dvsn: str, # [필수] 조회구분 (ex. 00) + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속 거래 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 주식, ETF, ETN만 조회 가능하며 펀드는 조회 불가합니다. + + ​※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + inqr_dvsn (str): [필수] 조회구분 (ex. 00) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 퇴직연금 잔고 데이터 + + Example: + >>> df1, df2 = pension_inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00", inqr_dvsn="00") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/pension/inquire-balance" + + if cano == "" or cano is None: + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "" or acnt_prdt_cd is None: + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if acca_dvsn_cd == "" or acca_dvsn_cd is None: + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + if inqr_dvsn == "" or inqr_dvsn is None: + raise ValueError("inqr_dvsn is required (e.g. '00')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "TTTC2208R" # 퇴직연금 잔고조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ACCA_DVSN_CD": acca_dvsn_cd, # 적립금구분코드 + "INQR_DVSN": inqr_dvsn, # 조회구분 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame(res.getBody().output2, index=[0]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return pension_inquire_balance( + cano, acnt_prdt_cd, acca_dvsn_cd, inqr_dvsn, FK100, NK100, "N", dataframe1, dataframe2, depth + 1, + max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] +############################################################################################## + +def pension_inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + user_dvsn_cd: str, # 사용자구분코드 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + inqr_dvsn_3: str, # 조회구분3 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + [국내주식] 주문/계좌 > 퇴직연금 미체결내역[v1_국내주식-033] + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + user_dvsn_cd (str): [필수] 사용자구분코드 (ex. %%) + sll_buy_dvsn_cd (str): [필수] 매도매수구분코드 (ex. 00: 전체, 01: 매도, 02: 매수) + ccld_nccs_dvsn (str): [필수] 체결미체결구분 (ex. %%: 전체, 01: 체결, 02: 미체결) + inqr_dvsn_3 (str): [필수] 조회구분3 (ex. 00: 전체) + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 퇴직연금 미체결내역 데이터 + + Example: + >>> df = pension_inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="%%", sll_buy_dvsn_cd="00", ccld_nccs_dvsn="%%", inqr_dvsn_3="00") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/pension/inquire-daily-ccld" + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if user_dvsn_cd == "": + raise ValueError("user_dvsn_cd is required (e.g. '%%')") + + if sll_buy_dvsn_cd == "": + raise ValueError("sll_buy_dvsn_cd is required (e.g. '00: 전체, 01: 매도, 02: 매수')") + + if ccld_nccs_dvsn == "": + raise ValueError("ccld_nccs_dvsn is required (e.g. '%%: 전체, 01: 체결, 02: 미체결')") + + if inqr_dvsn_3 == "": + raise ValueError("inqr_dvsn_3 is required (e.g. '00: 전체')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTC2201R" # 퇴직연금 미체결내역 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "USER_DVSN_CD": user_dvsn_cd, # 사용자구분코드 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, # 체결미체결구분 + "INQR_DVSN_3": inqr_dvsn_3, # 조회구분3 + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return pension_inquire_daily_ccld( + cano, acnt_prdt_cd, user_dvsn_cd, sll_buy_dvsn_cd, ccld_nccs_dvsn, inqr_dvsn_3, FK100, NK100, "N", + dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 예수금조회[v1_국내주식-035] +############################################################################################## + +def pension_inquire_deposit( + cano: str, # 종합계좌번호 (12345678) + acnt_prdt_cd: str, # 계좌상품코드 (29) + acca_dvsn_cd: str # 적립금구분코드 (00) +) -> pd.DataFrame: + """ + ​※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + + Returns: + pd.DataFrame: 퇴직연금 예수금 데이터 + + Example: + >>> df = pension_inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acca_dvsn_cd="00") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/pension/inquire-deposit" + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if acca_dvsn_cd == "": + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + tr_id = "TTTC0506R" # 퇴직연금 예수금조회 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ACCA_DVSN_CD": acca_dvsn_cd # 적립금구분코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame([res.getBody().output]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] +############################################################################################## + +def pension_inquire_present_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + user_dvsn_cd: str, # 상품번호 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "" # 연속조회키100 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [국내주식] 주문/계좌 > 퇴직연금 체결기준잔고[v1_국내주식-032] + + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. '12345678') + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. '29') + user_dvsn_cd (str): [필수] 상품번호 (ex. '00') + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = pension_inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, user_dvsn_cd="00") + >>> print(df1) + >>> print(df2) + """ + api_url = "/uapi/domestic-stock/v1/trading/pension/inquire-present-balance" + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if user_dvsn_cd == "": + raise ValueError("user_dvsn_cd is required (e.g. '00')") + + tr_id = "TTTC2202R" # 퇴직연금 체결기준잔고 + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "USER_DVSN_CD": user_dvsn_cd, # 상품번호 + "CTX_AREA_FK100": FK100, # 연속조회검색조건100 + "CTX_AREA_NK100": NK100 # 연속조회키100 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (array) - 보유종목 정보 + output1_data = pd.DataFrame(res.getBody().output1) + + # output2 (array) - 계좌 요약 정보 + output2_data = pd.DataFrame(res.getBody().output2) + + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] +############################################################################################## + +def pension_inquire_psbl_order( + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 29) + pdno: str, # [필수] 상품번호 (ex. 123456) + acca_dvsn_cd: str, # [필수] 적립금구분코드 (ex. 00) + cma_evlu_amt_icld_yn: str, # [필수] CMA평가금액포함여부 (ex. Y:포함, N:미포함) + ord_unpr: str, # [필수] 주문단가 + ord_dvsn: str # [필수] 주문구분 (ex. 00: 지정가, 01: 시장가) +) -> pd.DataFrame: + """ + [국내주식] 주문/계좌 > 퇴직연금 매수가능조회[v1_국내주식-034] + + ※ 55번 계좌(DC가입자계좌)의 경우 해당 API 이용이 불가합니다. + KIS Developers API의 경우 HTS ID에 반드시 연결되어있어야만 API 신청 및 앱정보 발급이 가능한 서비스로 개발되어서 실물계좌가 아닌 55번 계좌는 API 이용이 불가능한 점 양해 부탁드립니다. + + Args: + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 29) + pdno (str): [필수] 상품번호 (ex. 123456) + acca_dvsn_cd (str): [필수] 적립금구분코드 (ex. 00) + cma_evlu_amt_icld_yn (str): [필수] CMA평가금액포함여부 (ex. Y:포함, N:미포함) + ord_unpr (str): [필수] 주문단가 + ord_dvsn (str): [필수] 주문구분 (ex. 00: 지정가, 01: 시장가) + + Returns: + pd.DataFrame: 퇴직연금 매수가능조회 데이터 + + Example: + >>> df = pension_inquire_psbl_order( + ... cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + ... pdno="069500", + ... acca_dvsn_cd="00", + ... cma_evlu_amt_icld_yn="Y", + ... ord_unpr="30800", + ... ord_dvsn="00" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/pension/inquire-psbl-order" + + # 필수 파라미터 검증 + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '29')") + + if pdno == "": + raise ValueError("pdno is required (e.g. '123456')") + + if acca_dvsn_cd == "": + raise ValueError("acca_dvsn_cd is required (e.g. '00')") + + if cma_evlu_amt_icld_yn == "": + raise ValueError("cma_evlu_amt_icld_yn is required (e.g. 'Y:포함, N:미포함')") + + if ord_unpr == "": + raise ValueError("ord_unpr is required") + + if ord_dvsn == "": + raise ValueError("ord_dvsn is required (e.g. '00: 지정가, 01: 시장가')") + + tr_id = "TTTC0503R" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ACCA_DVSN_CD": acca_dvsn_cd, + "CMA_EVLU_AMT_ICLD_YN": cma_evlu_amt_icld_yn, + "ORD_UNPR": ord_unpr, + "ORD_DVSN": ord_dvsn + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별계좌권리현황조회 [국내주식-211] +############################################################################################## + +def period_rights( + inqr_dvsn: str, # [필수] 조회구분 (ex. 03) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01 or 22) + inqr_strt_dt: str, # [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt: str, # [필수] 조회종료일자 (ex. 20250103) + cust_rncno25: str = "", # 고객실명확인번호25 + hmid: str = "", # 홈넷ID + rght_type_cd: str = "", # 권리유형코드 + pdno: str = "", # 상품번호 + prdt_type_cd: str = "", # 상품유형코드 + NK100: str = "", # 연속조회키100 + FK100: str = "", # 연속조회검색조건100 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 기간별계좌권리현황조회 API입니다. + 한국투자 HTS(eFriend Plus) > [7344] 권리유형별 현황조회 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + inqr_dvsn (str): [필수] 조회구분 (ex. 03) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01 or 22) + inqr_strt_dt (str): [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt (str): [필수] 조회종료일자 (ex. 20250103) + cust_rncno25 (str): 고객실명확인번호25 + hmid (str): 홈넷ID + rght_type_cd (str): 권리유형코드 + pdno (str): 상품번호 + prdt_type_cd (str): 상품유형코드 + NK100 (str): 연속조회키100 + FK100 (str): 연속조회검색조건100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 기간별계좌권리현황 데이터 + + Example: + >>> df = period_rights(inqr_dvsn="03", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", inqr_end_dt="20250103") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/trading/period-rights" + + if inqr_dvsn == "": + raise ValueError("inqr_dvsn is required (e.g. '03')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01' or '22')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20250103')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTRGA011R" # 기간별계좌권리현황조회 + + params = { + "INQR_DVSN": inqr_dvsn, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "CUST_RNCNO25": cust_rncno25, + "HMID": hmid, + "RGHT_TYPE_CD": rght_type_cd, + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + "CTX_AREA_NK100": NK100, + "CTX_AREA_FK100": FK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return period_rights( + inqr_dvsn, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + cust_rncno25, hmid, rght_type_cd, pdno, prdt_type_cd, + NK100, FK100, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 우선주_괴리율 상위[v1_국내주식-094] +############################################################################################## + +def prefer_disparate_ratio( + fid_vol_cnt: str, # 거래량 수 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 우선주_괴리율 상위[v1_국내주식-094] + 국내주식 우선주_괴리율 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20177 ) + fid_div_cls_code (str): 0: 전체 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 우선주_괴리율 상위 데이터 + + Example: + >>> df = prefer_disparate_ratio( + ... fid_vol_cnt="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20177", + ... fid_div_cls_code="0", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/prefer-disparate-ratio" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20177')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20177')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + raise ValueError("fid_input_iscd is required. (e.g. '0000')") + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01770000" + + params = { + "fid_vol_cnt": fid_vol_cnt, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return prefer_disparate_ratio( + fid_vol_cnt, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 수익자산지표 순위[v1_국내주식-090] +############################################################################################## + +def profit_asset_index( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_input_option_1: str, # 입력 옵션1 + fid_input_option_2: str, # 입력 옵션2 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_blng_cls_code: str, # 소속 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 수익자산지표 순위[v1_국내주식-090] + 국내주식 수익자산지표 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 (필수) (J:KRX, NX:NXT) + fid_trgt_cls_code (str): 대상 구분 코드 (필수) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 (필수) + fid_input_iscd (str): 입력 종목코드 (필수) + fid_div_cls_code (str): 분류 구분 코드 (필수) + fid_input_price_1 (str): 입력 가격1 (필수) + fid_input_price_2 (str): 입력 가격2 (필수) + fid_vol_cnt (str): 거래량 수 (필수) + fid_input_option_1 (str): 입력 옵션1 (필수) + fid_input_option_2 (str): 입력 옵션2 (필수) + fid_rank_sort_cls_code (str): 순위 정렬 구분 코드 (필수) + fid_blng_cls_code (str): 소속 구분 코드 (필수) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + + Returns: + Optional[pd.DataFrame]: 국내주식 수익자산지표 순위 데이터 + + Example: + >>> df = profit_asset_index( + ... fid_cond_mrkt_div_code="J", + ... fid_trgt_cls_code="0", + ... fid_cond_scr_div_code="20173", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_input_option_1="2023", + ... fid_input_option_2="0", + ... fid_rank_sort_cls_code="0", + ... fid_blng_cls_code="0", + ... fid_trgt_exls_cls_code="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/profit-asset-index" + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_cond_scr_div_code != "20173": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_input_option_1 != "2023": + raise ValueError("입력 옵션1 확인요망!!!") + if fid_input_option_2 not in ["0", "1", "2", "3"]: + raise ValueError("입력 옵션2 확인요망!!!") + if fid_rank_sort_cls_code not in ["0", "1", "2", "3", "4", "5", "6"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_blng_cls_code != "0": + raise ValueError("소속 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01730000" + + params = { + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_input_option_1": fid_input_option_1, + "fid_input_option_2": fid_input_option_2, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_blng_cls_code": fid_blng_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return profit_asset_index( + fid_cond_mrkt_div_code, + fid_trgt_cls_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_input_option_1, + fid_input_option_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_trgt_exls_cls_code, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 처리 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(체결)[v1_국내주식-044] +############################################################################################## + +def program_trade_by_stock( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd: str # [필수] 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 종목별 프로그램매매추이(체결) API입니다. + + 한국투자 HTS(eFriend Plus) > [0465] 종목별 프로그램 매매추이 화면(혹은 한국투자 MTS > 국내 현재가 > 기타수급 > 프로그램) 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 종목별 프로그램매매추이 데이터 + + Example: + >>> df = program_trade_by_stock(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/program-trade-by-stock" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (ex. J:KRX,NX:NXT,UN:통합)") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (ex. 123456)") + + tr_id = "FHPPG04650101" # 종목별 프로그램매매추이(체결) + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd # 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목별 프로그램매매추이(일별) [국내주식-113] +############################################################################################## + +def program_trade_by_stock_daily( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd: str, # [필수] 입력 종목코드 (ex. 123456) + fid_input_date_1: str = "" # [필수] 입력날짜 (초기값: "") +) -> pd.DataFrame: + """ + 국내주식 종목별 프로그램매매추이(일별) API입니다. + 한국투자 HTS(eFriend Plus) > [0465] 종목별 프로그램 매매추이 화면(혹은 한국투자 MTS > 국내 현재가 > 기타수급 > 프로그램) 의 "일자별" 클릭 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX,NX:NXT,UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + fid_input_date_1 (str): [필수] 입력날짜 (초기값: "") + + Returns: + pd.DataFrame: 종목별 프로그램매매추이(일별) 데이터 + + Example: + >>> df = program_trade_by_stock_daily("J", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/program-trade-by-stock-daily" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (ex. J:KRX,NX:NXT,UN:통합)") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (ex. 123456)") + + tr_id = "FHPPG04650201" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색조회 [국내주식-039] +############################################################################################## + +def psearch_result( + user_id: str, # 사용자 HTS ID + seq: str # 사용자조건 키값 +) -> pd.DataFrame: + """ + HTS(efriend Plus) [0110] 조건검색에서 등록 및 서버저장한 나의 조건 목록을 확인할 수 있는 API입니다. + 종목조건검색 목록조회 API(/uapi/domestic-stock/v1/quotations/psearch-title)의 output인 'seq'을 종목조건검색조회 API(/uapi/domestic-stock/v1/quotations/psearch-result)의 input으로 사용하시면 됩니다. + + ※ 시스템 안정성을 위해 API로 제공되는 조건검색 결과의 경우 조건당 100건으로 제한을 둔 점 양해 부탁드립니다. + + ※ [0110] 화면의 '대상변경' 설정사항은 HTS [0110] 사용자 조건검색 화면에만 적용됨에 유의 부탁드립니다. + + ※ '조회가 계속 됩니다. (다음을 누르십시오.)' 오류 발생 시 해결방법 + → HTS(efriend Plus) [0110] 조건검색 화면에서 조건을 등록하신 후, 왼쪽 하단의 "사용자조건 서버저장" 클릭하셔서 등록한 조건들을 서버로 보낸 후 다시 API 호출 시도 부탁드립니다. + + ※ {"rt_cd":"1","msg_cd":"MCA05918","msg1":"종목코드 오류입니다."} 메시지 발생 이유 + → 조건검색 결과 검색된 종목이 0개인 경우 위 응답값을 수신하게 됩니다. + + Args: + user_id (str): [필수] 사용자 HTS ID + seq (str): [필수] 사용자조건 키값 (종목조건검색 목록조회 API의 output인 'seq'을 이용) + + Returns: + pd.DataFrame: 종목조건검색조회 데이터 + + Example: + >>> df = psearch_result(user_id=trenv.my_htsid, seq="0") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/psearch-result" + + if user_id == "": + raise ValueError("user_id is required") + + if seq == "": + raise ValueError("seq is required (e.g. '종목조건검색 목록조회 API의 output인 'seq'을 이용')") + + tr_id = "HHKST03900400" # 종목조건검색조회 + + params = { + "user_id": user_id, # 사용자 HTS ID + "seq": seq # 사용자조건 키값 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] +############################################################################################## + +def psearch_title( + user_id: str # [필수] 사용자 HTS ID (ex. U:업종) +) -> pd.DataFrame: + """ + [국내주식] 시세분석 > 종목조건검색 목록조회[국내주식-038] + HTS(efriend Plus) [0110] 조건검색에서 등록 및 서버저장한 나의 조건 목록을 확인할 수 있는 API입니다. + 종목조건검색 목록조회 API(/uapi/domestic-stock/v1/quotations/psearch-title)의 output인 'seq'을 종목조건검색조회 API(/uapi/domestic-stock/v1/quotations/psearch-result)의 input으로 사용하시면 됩니다. + + ※ 시스템 안정성을 위해 API로 제공되는 조건검색 결과의 경우 조건당 100건으로 제한을 둔 점 양해 부탁드립니다. + + ※ [0110] 화면의 '대상변경' 설정사항은 HTS [0110] 사용자 조건검색 화면에만 적용됨에 유의 부탁드립니다. + + ※ '조회가 계속 됩니다. (다음을 누르십시오.)' 오류 발생 시 해결방법 + → HTS(efriend Plus) [0110] 조건검색 화면에서 조건을 등록하신 후, 왼쪽 하단의 "사용자조건 서버저장" 클릭하셔서 등록한 조건들을 서버로 보낸 후 다시 API 호출 시도 부탁드립니다. + + Args: + user_id (str): [필수] 사용자 HTS ID (ex. U:업종) + + Returns: + pd.DataFrame: 종목조건검색 목록 데이터 + + Example: + >>> df = psearch_title(user_id=trenv.my_htsid) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/psearch-title" + + if user_id == "": + raise ValueError("user_id is required (e.g. 'U:업종')") + + tr_id = "HHKST03900300" # 종목조건검색 목록조회 + + params = { + "user_id": user_id # 사용자 HTS ID + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output2) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식 호가잔량 순위[국내주식-089] +############################################################################################## + +def quote_balance( + fid_vol_cnt: str, # 거래량 수 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 호가잔량 순위[국내주식-089] + 국내주식 호가잔량 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20172 ) + fid_input_iscd (str): 0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001) + fid_rank_sort_cls_code (str): 0: 순매수잔량순, 1:순매도잔량순, 2:매수비율순, 3:매도비율순 + fid_div_cls_code (str): 0:전체 + fid_trgt_cls_code (str): 0:전체 + fid_trgt_exls_cls_code (str): 0:전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + Optional[pd.DataFrame]: 국내주식 호가잔량 순위 데이터 + + Example: + >>> df = quote_balance( + ... fid_vol_cnt="", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20172", + ... fid_input_iscd="0000", + ... fid_rank_sort_cls_code="0", + ... fid_div_cls_code="0", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/quote-balance" + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code != "J": + raise ValueError("조건 시장 분류 코드 확인요망!!!") + if fid_cond_scr_div_code != "20172": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + raise ValueError("입력 종목코드 확인요망!!!") + if fid_rank_sort_cls_code not in ["0", "1", "2", "3"]: + raise ValueError("순위 정렬 구분 코드 확인요망!!!") + if fid_div_cls_code != "0": + raise ValueError("분류 구분 코드 확인요망!!!") + if fid_trgt_cls_code != "0": + raise ValueError("대상 구분 코드 확인요망!!!") + if fid_trgt_exls_cls_code != "0": + raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01720000" + + params = { + "fid_vol_cnt": fid_vol_cnt, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + print("Call Next") + ka.smart_sleep() + return quote_balance( + fid_vol_cnt, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_rank_sort_cls_code, + fid_div_cls_code, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + "N", dataframe + ) + else: + print("The End") + return dataframe + else: + # 오류 출력 + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 상품기본조회[v1_국내주식-029] +############################################################################################## + +def search_info( + pdno: str, # 상품번호 + prdt_type_cd: str, # 상품유형코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 상품기본조회[v1_국내주식-029] + 상품기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + pdno (str): 상품번호 (예: '000660', 'KR4101SC0009', 'AAPL') + prdt_type_cd (str): 상품유형코드 (예: '300', '301', '512') + tr_cont (str): 연속 거래 여부 (기본값: 공백) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 상품기본조회 데이터 + + Example: + >>> df = search_info('AAPL', '512') + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/search-info" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '300')") + raise ValueError("prdt_type_cd is required. (e.g. '300')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + tr_id = "CTPF1604R" + + # 요청 파라미터 설정 + params = { + "PDNO": pdno, + "PRDT_TYPE_CD": prdt_type_cd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_info( + pdno, + prdt_type_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 종목정보 > 주식기본조회[v1_국내주식-067] +############################################################################################## + +def search_stock_info( + prdt_type_cd: str, # 상품유형코드 + pdno: str, # 상품번호 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 종목정보 + 주식기본조회[v1_국내주식-067] + 주식기본조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prdt_type_cd (str): 300: 주식, ETF, ETN, ELW 301 : 선물옵션 302 : 채권 306 : ELS' + pdno (str): 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 주식기본조회 데이터 + + Example: + >>> df = search_stock_info("300", "000660") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/search-stock-info" + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '300')") + raise ValueError("prdt_type_cd is required. (e.g. '300')") + + if not pdno: + logger.error("pdno is required. (e.g. '000660')") + raise ValueError("pdno is required. (e.g. '000660')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1002R" + + params = { + "PRDT_TYPE_CD": prdt_type_cd, + "PDNO": pdno, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_stock_info( + prdt_type_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 공매도 상위종목[국내주식-133] +############################################################################################## + +def short_sale( + fid_aply_rang_vol: str, # FID 적용 범위 거래량 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_period_div_code: str, # 조회구분 (일/월) + fid_input_cnt_1: str, # 조회가간(일수) + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_trgt_cls_code: str, # FID 대상 구분 코드 + fid_aply_rang_prc_1: str, # FID 적용 범위 가격1 + fid_aply_rang_prc_2: str, # FID 적용 범위 가격2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 공매도 상위종목[국내주식-133] + 국내주식 공매도 상위종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_aply_rang_vol (str): FID 적용 범위 거래량 + fid_cond_mrkt_div_code (str): 시장구분코드 (주식 J) + fid_cond_scr_div_code (str): Unique key(20482) + fid_input_iscd (str): 0000:전체, 0001:코스피, 1001:코스닥, 2001:코스피200, 4001: KRX100, 3003: 코스닥150 + fid_period_div_code (str): 조회구분 (일/월) D: 일, M:월 + fid_input_cnt_1 (str): 조회가간(일수): 조회구분(D) 0:1일, 1:2일, 2:3일, 3:4일, 4:1주일, 9:2주일, 14:3주일, 조회구분(M) 1:1개월, 2:2개월, 3:3개월 + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 + fid_trgt_cls_code (str): FID 대상 구분 코드 + fid_aply_rang_prc_1 (str): FID 적용 범위 가격1 + fid_aply_rang_prc_2 (str): FID 적용 범위 가격2 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 공매도 상위종목 데이터 + + Example: + >>> df = short_sale( + ... fid_aply_rang_vol="1000", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20482", + ... fid_input_iscd="0000", + ... fid_period_div_code="D", + ... fid_input_cnt_1="0", + ... fid_trgt_exls_cls_code="", + ... fid_trgt_cls_code="", + ... fid_aply_rang_prc_1="1000", + ... fid_aply_rang_prc_2="5000" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/short-sale" + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + return None + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20482')") + return None + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '0000')") + return None + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + return None + if not fid_input_cnt_1: + logger.error("fid_input_cnt_1 is required. (e.g. '0')") + return None + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST04820000" + + params = { + "FID_APLY_RANG_VOL": fid_aply_rang_vol, + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + "FID_INPUT_CNT_1": fid_input_cnt_1, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_APLY_RANG_PRC_1": fid_aply_rang_prc_1, + "FID_APLY_RANG_PRC_2": fid_aply_rang_prc_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return short_sale( + fid_aply_rang_vol, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_period_div_code, + fid_input_cnt_1, + fid_trgt_exls_cls_code, + fid_trgt_cls_code, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 관심종목등록 상위[v1_국내주식-102] +############################################################################################## + +def top_interest_stock( + fid_input_iscd_2: str, # 입력 종목코드2 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_cnt_1: str, # 입력 수1 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 관심종목등록 상위[v1_국내주식-102] + 국내주식 관심종목등록 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_input_iscd_2 (str): 000000 : 필수입력값 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(20180) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_trgt_cls_code (str): 0 : 전체 + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_div_cls_code (str): 0: 전체 1: 관리종목 2: 투자주의 3: 투자경고 4: 투자위험예고 5: 투자위험 6: 보통주 7: 우선주 + fid_input_cnt_1 (str): 순위검색 입력값(1: 1위부터, 10:10위부터) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 관심종목등록 상위 데이터 + + Example: + >>> df = top_interest_stock( + ... fid_input_iscd_2="000000", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20180", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_trgt_exls_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_div_cls_code="0", + ... fid_input_cnt_1="1" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/top-interest-stock" + # 필수 파라미터 검증 + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '000000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '000000')") + if fid_cond_mrkt_div_code not in ['J']: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'J')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20180')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20180')") + if fid_input_iscd not in ['0000', '0001', '1001', '2001']: + logger.error("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001')") + raise ValueError("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001')") + if fid_div_cls_code not in ['0', '1', '2', '3', '4', '5', '6', '7']: + logger.error("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + raise ValueError("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01800000" + + params = { + "fid_input_iscd_2": fid_input_iscd_2, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_cnt_1": fid_input_cnt_1, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return top_interest_stock( + fid_input_iscd_2, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_trgt_cls_code, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_div_cls_code, + fid_input_cnt_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 당사매매종목 상위[v1_국내주식-104] +############################################################################################## + +def traded_by_company( + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_rank_sort_cls_code: str, # 순위 정렬 구분 코드 + fid_input_date_1: str, # 입력 날짜1 + fid_input_date_2: str, # 입력 날짜2 + fid_input_iscd: str, # 입력 종목코드 + fid_trgt_cls_code: str, # 대상 구분 코드 + fid_aply_rang_vol: str, # 적용 범위 거래량 + fid_aply_rang_prc_2: str, # 적용 범위 가격2 + fid_aply_rang_prc_1: str, # 적용 범위 가격1 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 당사매매종목 상위[v1_국내주식-104] + 국내주식 당사매매종목 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_exls_cls_code (str): 0: 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key(20186) + fid_div_cls_code (str): 0:전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주 + fid_rank_sort_cls_code (str): 0:매도상위,1:매수상위 + fid_input_date_1 (str): 기간~ + fid_input_date_2 (str): ~기간 + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100 + fid_trgt_cls_code (str): 0: 전체 + fid_aply_rang_vol (str): 0: 전체, 100: 100주 이상 + fid_aply_rang_prc_2 (str): ~ 가격 + fid_aply_rang_prc_1 (str): 가격 ~ + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 당사매매종목 상위 데이터 + + Example: + >>> df = traded_by_company( + ... fid_trgt_exls_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20186", + ... fid_div_cls_code="0", + ... fid_rank_sort_cls_code="0", + ... fid_input_date_1="20240314", + ... fid_input_date_2="20240315", + ... fid_input_iscd="0000", + ... fid_trgt_cls_code="0", + ... fid_aply_rang_vol="0", + ... fid_aply_rang_prc_2="", + ... fid_aply_rang_prc_1="" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/traded-by-company" + # 필수 파라미터 검증 + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + return None + if fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'J')") + return None + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20186')") + return None + if fid_div_cls_code not in ["0", "1", "2", "3", "4", "5", "6", "7"]: + logger.error("fid_div_cls_code is required. (e.g. '0', '1', '2', '3', '4', '5', '6', '7')") + return None + if fid_rank_sort_cls_code not in ["0", "1"]: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0', '1')") + return None + if not fid_input_date_1: + logger.error("fid_input_date_1 is required.") + return None + if not fid_input_date_2: + logger.error("fid_input_date_2 is required.") + return None + if fid_input_iscd not in ["0000", "0001", "1001", "2001", "4001"]: + logger.error("fid_input_iscd is required. (e.g. '0000', '0001', '1001', '2001', '4001')") + return None + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + return None + if fid_aply_rang_vol not in ["0", "100"]: + logger.error("fid_aply_rang_vol is required. (e.g. '0', '100')") + return None + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01860000" + + params = { + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_div_cls_code": fid_div_cls_code, + "fid_rank_sort_cls_code": fid_rank_sort_cls_code, + "fid_input_date_1": fid_input_date_1, + "fid_input_date_2": fid_input_date_2, + "fid_input_iscd": fid_input_iscd, + "fid_trgt_cls_code": fid_trgt_cls_code, + "fid_aply_rang_vol": fid_aply_rang_vol, + "fid_aply_rang_prc_2": fid_aply_rang_prc_2, + "fid_aply_rang_prc_1": fid_aply_rang_prc_1, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return traded_by_company( + fid_trgt_exls_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_rank_sort_cls_code, + fid_input_date_1, + fid_input_date_2, + fid_input_iscd, + fid_trgt_cls_code, + fid_aply_rang_vol, + fid_aply_rang_prc_2, + fid_aply_rang_prc_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 시세분석 > 국내주식 체결금액별 매매비중 [국내주식-192] +############################################################################################## + +def tradprt_byamt( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11119) + fid_input_iscd: str # [필수] 입력 종목코드 (ex. 123456) +) -> pd.DataFrame: + """ + 국내주식 체결금액별 매매비중 API입니다. + 한국투자 HTS(eFriend Plus) > [0135] 체결금액별 매매비중 화면의 "상단 표" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11119) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: 국내주식 체결금액별 매매비중 데이터 + + Example: + >>> df = tradprt_byamt("J", "11119", "005930") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/tradprt-byamt" + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11119')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHKST111900C0" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 국내주식 체결강도 상위[v1_국내주식-101] +############################################################################################## + +def volume_power( + fid_trgt_exls_cls_code: str, # 대상 제외 구분 코드 + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 조건 화면 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_div_cls_code: str, # 분류 구분 코드 + fid_input_price_1: str, # 입력 가격1 + fid_input_price_2: str, # 입력 가격2 + fid_vol_cnt: str, # 거래량 수 + fid_trgt_cls_code: str, # 대상 구분 코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 국내주식 체결강도 상위[v1_국내주식-101] + 국내주식 체결강도 상위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_trgt_exls_cls_code (str): 0 : 전체 + fid_cond_mrkt_div_code (str): 시장구분코드 (J:KRX, NX:NXT) + fid_cond_scr_div_code (str): Unique key( 20168 ) + fid_input_iscd (str): 0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200 + fid_div_cls_code (str): 0: 전체, 1: 보통주 2: 우선주 + fid_input_price_1 (str): 입력값 없을때 전체 (가격 ~) + fid_input_price_2 (str): 입력값 없을때 전체 (~ 가격) + fid_vol_cnt (str): 입력값 없을때 전체 (거래량 ~) + fid_trgt_cls_code (str): 0 : 전체 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 국내주식 체결강도 상위 데이터 + + Example: + >>> df = volume_power( + ... fid_trgt_exls_cls_code="0", + ... fid_cond_mrkt_div_code="J", + ... fid_cond_scr_div_code="20168", + ... fid_input_iscd="0000", + ... fid_div_cls_code="0", + ... fid_input_price_1="", + ... fid_input_price_2="", + ... fid_vol_cnt="", + ... fid_trgt_cls_code="0" + ... ) + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/ranking/volume-power" + # 필수 파라미터 검증 + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + if fid_cond_mrkt_div_code != "J": + logger.error("fid_cond_mrkt_div_code must be 'J'.") + raise ValueError("fid_cond_mrkt_div_code must be 'J'.") + if fid_cond_scr_div_code != "20168": + logger.error("fid_cond_scr_div_code must be '20168'.") + raise ValueError("fid_cond_scr_div_code must be '20168'.") + if fid_input_iscd not in ["0000", "0001", "1001", "2001"]: + logger.error("fid_input_iscd must be one of ['0000', '0001', '1001', '2001'].") + raise ValueError("fid_input_iscd must be one of ['0000', '0001', '1001', '2001'].") + if fid_div_cls_code not in ["0", "1", "2"]: + logger.error("fid_div_cls_code must be one of ['0', '1', '2'].") + raise ValueError("fid_div_cls_code must be one of ['0', '1', '2'].") + if not fid_trgt_cls_code: + logger.error("fid_trgt_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "FHPST01680000" + + params = { + "fid_trgt_exls_cls_code": fid_trgt_exls_cls_code, + "fid_cond_mrkt_div_code": fid_cond_mrkt_div_code, + "fid_cond_scr_div_code": fid_cond_scr_div_code, + "fid_input_iscd": fid_input_iscd, + "fid_div_cls_code": fid_div_cls_code, + "fid_input_price_1": fid_input_price_1, + "fid_input_price_2": fid_input_price_2, + "fid_vol_cnt": fid_vol_cnt, + "fid_trgt_cls_code": fid_trgt_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volume_power( + fid_trgt_exls_cls_code, + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_vol_cnt, + fid_trgt_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 순위분석 > 거래량순위[v1_국내주식-047] +############################################################################################## + +def volume_rank( + fid_cond_mrkt_div_code: str, # 필수, 조건 시장 분류 코드 + fid_cond_scr_div_code: str, # 필수, 조건 화면 분류 코드 + fid_input_iscd: str, # 필수, 입력 종목코드 + fid_div_cls_code: str, # 필수, 분류 구분 코드 + fid_blng_cls_code: str, # 필수, 소속 구분 코드 + fid_trgt_cls_code: str, # 필수, 대상 구분 코드 + fid_trgt_exls_cls_code: str, # 필수, 대상 제외 구분 코드 + fid_input_price_1: str, # 필수, 입력 가격1 + fid_input_price_2: str, # 필수, 입력 가격2 + fid_vol_cnt: str, # 필수, 거래량 수 + fid_input_date_1: str, # 필수, 입력 날짜1 + tr_cont: str = "", # 선택, 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None # 선택, 누적 데이터프레임 +) -> Optional[pd.DataFrame]: + """ + [국내주식] 순위분석 + 순위분석[v1_국내주식-047] + 순위분석 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건 시장 분류 코드 ("J": KRX, "NX": NXT, "UN": 통합, "W": ELW) + fid_cond_scr_div_code (str): 조건 화면 분류 코드 ("20171") + fid_input_iscd (str): 입력 종목코드 ("0000": 전체, 기타: 업종코드) + fid_div_cls_code (str): 분류 구분 코드 ("0": 전체, "1": 보통주, "2": 우선주) + fid_blng_cls_code (str): 소속 구분 코드 ("0": 평균거래량, "1": 거래증가율, "2": 평균거래회전율, "3": 거래금액순, "4": 평균거래금액회전율) + fid_trgt_cls_code (str): 대상 구분 코드 (9자리, "1" or "0", 차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%) + fid_trgt_exls_cls_code (str): 대상 제외 구분 코드 (10자리, "1" or "0", 차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지 ETF ETN 신용주문불가 SPAC) + fid_input_price_1 (str): 입력 가격1 (가격 ~, 전체 가격 대상 조회 시 공란) + fid_input_price_2 (str): 입력 가격2 (~ 가격, 전체 가격 대상 조회 시 공란) + fid_vol_cnt (str): 거래량 수 (거래량 ~, 전체 거래량 대상 조회 시 공란) + fid_input_date_1 (str): 입력 날짜1 (공란) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + + Returns: + pd.DataFrame: 순위분석 데이터 + + Example: + >>> df = volume_rank(fid_cond_mrkt_div_code="J", fid_cond_scr_div_code="20171", fid_input_iscd="0000", fid_div_cls_code="0", fid_blng_cls_code="0", fid_trgt_cls_code="111111111", fid_trgt_exls_cls_code="0000000000", fid_input_price_1="0", fid_input_price_2="1000000", fid_vol_cnt="100000", fid_input_date_1="") + >>> print(df) + """ + api_url = "/uapi/domestic-stock/v1/quotations/volume-rank" + if fid_cond_mrkt_div_code not in ["J", "NX", "UN", "W"]: + raise ValueError("조건 시장 분류 코드 확인요망!!!") + + if fid_cond_scr_div_code != "20171": + raise ValueError("조건 화면 분류 코드 확인요망!!!") + + if fid_input_iscd == "": # "0000"은 전체를 의미하므로 유효한 값 + raise ValueError("입력 종목코드 확인요망!!!") + + if fid_div_cls_code not in ["0", "1", "2"]: + raise ValueError("분류 구분 코드 확인요망!!!") + + if fid_blng_cls_code not in ["0", "1", "2", "3", "4"]: + raise ValueError("소속 구분 코드 확인요망!!!") + + # To fix: description에 나와있는 자릿수와 다름(0 6개 입력해야 나옴) + # if len(fid_trgt_cls_code) != 9 or not (all(c == '0' for c in fid_trgt_cls_code) or all(c == '1' for c in fid_trgt_cls_code)): + # raise ValueError("대상 구분 코드 확인요망!!!") + + # if len(fid_trgt_exls_cls_code) != 10 or not (all(c == '0' for c in fid_trgt_exls_cls_code) or all(c == '1' for c in fid_trgt_exls_cls_code)): + # raise ValueError("대상 제외 구분 코드 확인요망!!!") + + tr_id = "FHPST01710000" # 거래량순위 + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_VOL_CNT": fid_vol_cnt, + "FID_INPUT_DATE_1": fid_input_date_1 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + current_data = pd.DataFrame(res.getBody().output) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": # 다음 페이지 존재 + print("Call Next") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_rank( + fid_cond_mrkt_div_code, fid_cond_scr_div_code, fid_input_iscd, + fid_div_cls_code, fid_blng_cls_code, fid_trgt_cls_code, + fid_trgt_exls_cls_code, fid_input_price_1, fid_input_price_2, + fid_vol_cnt, fid_input_date_1, "N", dataframe + ) + else: + print("The End") + return dataframe + else: + res.printError(api_url) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions_ws.py b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions_ws.py new file mode 100644 index 0000000..0c2ae07 --- /dev/null +++ b/한국투자증권(API)/examples_user/domestic_stock/domestic_stock_functions_ws.py @@ -0,0 +1,2129 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (KRX) [실시간-004] +############################################################################################## + +def asking_price_krx( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간 호가 데이터 구독 (KRX)[H0STASP0] + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내주식의 호가 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제 기능을 제공합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + env_dv (str): 실전모의구분 (real: 실전, demo: 모의) + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터 + columns (list[str]): 실시간 데이터의 컬럼 정보 + + Raises: + ValueError: 필수 파라미터가 누락되었거나 잘못된 경우 발생 + + Example: + >>> msg, columns = subscribe_krx_realtime_asking_price("1", "005930", env_dv="real") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신되며, 구독 해제 시까지 계속됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STASP0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STASP0" # 모의투자용 TR ID (웹소켓은 동일한 TR ID 사용) + else: + raise ValueError("env_dv는 'real' 또는 'demo'만 가능합니다.") + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "BSOP_HOUR", "HOUR_CLS_CODE", + "ASKP1", "ASKP2", "ASKP3", "ASKP4", "ASKP5", + "ASKP6", "ASKP7", "ASKP8", "ASKP9", "ASKP10", + "BIDP1", "BIDP2", "BIDP3", "BIDP4", "BIDP5", + "BIDP6", "BIDP7", "BIDP8", "BIDP9", "BIDP10", + "ASKP_RSQN1", "ASKP_RSQN2", "ASKP_RSQN3", "ASKP_RSQN4", "ASKP_RSQN5", + "ASKP_RSQN6", "ASKP_RSQN7", "ASKP_RSQN8", "ASKP_RSQN9", "ASKP_RSQN10", + "BIDP_RSQN1", "BIDP_RSQN2", "BIDP_RSQN3", "BIDP_RSQN4", "BIDP_RSQN5", + "BIDP_RSQN6", "BIDP_RSQN7", "BIDP_RSQN8", "BIDP_RSQN9", "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "OVTM_TOTAL_ASKP_RSQN", "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", "ANTC_CNQN", "ANTC_VOL", "ANTC_CNTG_VRSS", "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", "ACML_VOL", "TOTAL_ASKP_RSQN_ICDC", "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", "OVTM_TOTAL_BIDP_ICDC", "STCK_DEAL_CLS_CODE" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (NXT) +############################################################################################## + +def asking_price_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간호가 (NXT)[H0NXASP0] 구독 함수 + 국내주식 실시간호가 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_asking_price("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXASP0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터 기반 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "BSOP_HOUR", + "HOUR_CLS_CODE", + "ASKP1", + "ASKP2", + "ASKP3", + "ASKP4", + "ASKP5", + "ASKP6", + "ASKP7", + "ASKP8", + "ASKP9", + "ASKP10", + "BIDP1", + "BIDP2", + "BIDP3", + "BIDP4", + "BIDP5", + "BIDP6", + "BIDP7", + "BIDP8", + "BIDP9", + "BIDP10", + "ASKP_RSQN1", + "ASKP_RSQN2", + "ASKP_RSQN3", + "ASKP_RSQN4", + "ASKP_RSQN5", + "ASKP_RSQN6", + "ASKP_RSQN7", + "ASKP_RSQN8", + "ASKP_RSQN9", + "ASKP_RSQN10", + "BIDP_RSQN1", + "BIDP_RSQN2", + "BIDP_RSQN3", + "BIDP_RSQN4", + "BIDP_RSQN5", + "BIDP_RSQN6", + "BIDP_RSQN7", + "BIDP_RSQN8", + "BIDP_RSQN9", + "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "OVTM_TOTAL_ASKP_RSQN", + "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", + "ANTC_CNQN", + "ANTC_VOL", + "ANTC_CNTG_VRSS", + "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", + "ACML_VOL", + "TOTAL_ASKP_RSQN_ICDC", + "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", + "OVTM_TOTAL_BIDP_ICDC", + "STCK_DEAL_CLS_CODE", + "KMID_PRC", + "KMID_TOTAL_RSQN", + "KMID_CLS_CODE", + "NMID_PRC", + "NMID_TOTAL_RSQN", + "NMID_CLS_CODE", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간호가 (통합) +############################################################################################## + +def asking_price_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간호가 (통합)[H0UNASP0] + 국내주식 실시간호가 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_asking_price("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 서버로부터 실시간 데이터가 지속적으로 전송됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0UNASP0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "BSOP_HOUR", + "HOUR_CLS_CODE", + "ASKP1", + "ASKP2", + "ASKP3", + "ASKP4", + "ASKP5", + "ASKP6", + "ASKP7", + "ASKP8", + "ASKP9", + "ASKP10", + "BIDP1", + "BIDP2", + "BIDP3", + "BIDP4", + "BIDP5", + "BIDP6", + "BIDP7", + "BIDP8", + "BIDP9", + "BIDP10", + "ASKP_RSQN1", + "ASKP_RSQN2", + "ASKP_RSQN3", + "ASKP_RSQN4", + "ASKP_RSQN5", + "ASKP_RSQN6", + "ASKP_RSQN7", + "ASKP_RSQN8", + "ASKP_RSQN9", + "ASKP_RSQN10", + "BIDP_RSQN1", + "BIDP_RSQN2", + "BIDP_RSQN3", + "BIDP_RSQN4", + "BIDP_RSQN5", + "BIDP_RSQN6", + "BIDP_RSQN7", + "BIDP_RSQN8", + "BIDP_RSQN9", + "BIDP_RSQN10", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "OVTM_TOTAL_ASKP_RSQN", + "OVTM_TOTAL_BIDP_RSQN", + "ANTC_CNPR", + "ANTC_CNQN", + "ANTC_VOL", + "ANTC_CNTG_VRSS", + "ANTC_CNTG_VRSS_SIGN", + "ANTC_CNTG_PRDY_CTRT", + "ACML_VOL", + "TOTAL_ASKP_RSQN_ICDC", + "TOTAL_BIDP_RSQN_ICDC", + "OVTM_TOTAL_ASKP_ICDC", + "OVTM_TOTAL_BIDP_ICDC", + "STCK_DEAL_CLS_CODE", + "KMID_PRC", + "KMID_TOTAL_RSQN", + "KMID_CLS_CODE", + "NMID_PRC", + "NMID_TOTAL_RSQN", + "NMID_CLS_CODE", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가(KRX) [실시간-003] +############################################################################################## + +def ccnl_krx( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (KRX)[H0STCNT0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 국내 주식의 실시간 체결가 데이터를 구독합니다. + 실시간 데이터를 구독하거나 구독 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 + ValueError: env_dv가 'real' 또는 'demo'가 아닌 경우 + + Example: + >>> msg, columns = ccnl_krx("1", "005930", env_dv="real") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STCNT0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STCNT0" # 모의투자용 TR ID (웹소켓은 동일한 TR ID 사용) + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "STCK_CNTG_HOUR", "STCK_PRPR", "PRDY_VRSS_SIGN", + "PRDY_VRSS", "PRDY_CTRT", "WGHN_AVRG_STCK_PRC", "STCK_OPRC", + "STCK_HGPR", "STCK_LWPR", "ASKP1", "BIDP1", "CNTG_VOL", "ACML_VOL", + "ACML_TR_PBMN", "SELN_CNTG_CSNU", "SHNU_CNTG_CSNU", "NTBY_CNTG_CSNU", + "CTTR", "SELN_CNTG_SMTN", "SHNU_CNTG_SMTN", "CCLD_DVSN", "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", "OPRC_HOUR", "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", "HGPR_HOUR", "HGPR_VRSS_PRPR_SIGN", "HGPR_VRSS_PRPR", + "LWPR_HOUR", "LWPR_VRSS_PRPR_SIGN", "LWPR_VRSS_PRPR", "BSOP_DATE", + "NEW_MKOP_CLS_CODE", "TRHT_YN", "ASKP_RSQN1", "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", "MRKT_TRTM_CLS_CODE", "VI_STND_PRC" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 주식체결통보 [실시간-005] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, + env_dv: str = "real", # 실전모의구분 +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결통보[H0STCNI0] + 국내주식 실시간 체결통보 수신 시에 (1) 주문·정정·취소·거부 접수 통보 와 (2) 체결 통보 가 모두 수신됩니다. + (14번째 값(CNTG_YN;체결여부)가 2이면 체결통보, 1이면 주문·정정·취소·거부 접수 통보입니다.) + + ※ 모의투자는 H0STCNI9 로 변경하여 사용합니다. + + 실시간 데이터 구독을 위한 웹소켓 함수입니다. 구독을 등록하거나 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1")/해제("0") 여부 + tr_key (str): [필수] 종목코드 (예: "005930") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", "005930", env_dv="real") + >>> print(msg, columns) + + 웹소켓을 통해 실시간 데이터를 수신하며, 데이터는 암호화되어 제공됩니다. + AES256 KEY와 IV를 사용하여 복호화해야 합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "H0STCNI0" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "H0STCNI9" # 모의투자용 TR ID + else: + raise ValueError("env_dv는 'real' 또는 'demo'만 가능합니다.") + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "CUST_ID", "ACNT_NO", "ODER_NO", "ODER_QTY", "SELN_BYOV_CLS", "RCTF_CLS", + "ODER_KIND", "ODER_COND", "STCK_SHRN_ISCD", "CNTG_QTY", "CNTG_UNPR", + "STCK_CNTG_HOUR", "RFUS_YN", "CNTG_YN", "ACPT_YN", "BRNC_NO", "ACNT_NO2", + "ACNT_NAME", "ORD_COND_PRC", "ORD_EXG_GB", "POPUP_YN", "FILLER", "CRDT_CLS", + "CRDT_LOAN_DATE", "CNTG_ISNM40", "ODER_PRC" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (NXT) +############################################################################################## + +def ccnl_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (NXT)[H0NXCNT0] + 국내주식 실시간체결가 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 체결가 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 리스트 + + Example: + >>> msg, columns = ccnl_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하세요. tr_key는 유효한 종목코드를 입력해야 합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다. 유효한 종목코드를 입력하세요.") + + tr_id = "H0NXCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 페치 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", "STCK_CNTG_HOUR", "STCK_PRPR", "PRDY_VRSS_SIGN", + "PRDY_VRSS", "PRDY_CTRT", "WGHN_AVRG_STCK_PRC", "STCK_OPRC", + "STCK_HGPR", "STCK_LWPR", "ASKP1", "BIDP1", "CNTG_VOL", "ACML_VOL", + "ACML_TR_PBMN", "SELN_CNTG_CSNU", "SHNU_CNTG_CSNU", "NTBY_CNTG_CSNU", + "CTTR", "SELN_CNTG_SMTN", "SHNU_CNTG_SMTN", "CNTG_CLS_CODE", + "SHNU_RATE", "PRDY_VOL_VRSS_ACML_VOL_RATE", "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", "OPRC_VRSS_PRPR", "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", "HGPR_VRSS_PRPR", "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", "LWPR_VRSS_PRPR", "BSOP_DATE", + "NEW_MKOP_CLS_CODE", "TRHT_YN", "ASKP_RSQN1", "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", "TOTAL_BIDP_RSQN", "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", "MRKT_TRTM_CLS_CODE", "VI_STND_PRC" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간체결가 (통합) +############################################################################################## + +def ccnl_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간체결가 (통합)[H0UNCNT0] + 국내주식 실시간체결가 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 실시간 데이터를 구독할 주식의 종목코드 + + Returns: + message (dict): 실시간 체결가 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = ccnl_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UNCNT0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터를 가져옵니다. + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터에 기반한 정확한 컬럼 리스트 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (KRX) [실시간-041] +############################################################################################## + +def exp_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (KRX)[H0STANC0] + 국내주식 실시간예상체결 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = exp_ccnl_krx("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + "hour_cls_code", + "mrkt_trtm_cls_code", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결 (NXT) +############################################################################################## + +def exp_ccnl_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (NXT)[H0NXANC0] + 국내주식 실시간예상체결 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = exp_ccnl_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0NXANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간예상체결(통합) +############################################################################################## + +def exp_ccnl_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간예상체결 (통합)[H0UNANC0] + 국내주식 실시간예상체결 (통합) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 데이터의 컬럼 정보 + + Example: + >>> msg, columns = exp_ccnl_total("1", "005930") + >>> print(msg, columns) + + Note: + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 시 지속적으로 데이터가 업데이트됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다. 빈 문자열을 사용할 수 없습니다.") + + tr_id = "H0UNANC0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터를 가져옵니다. + msg = ka.data_fetch(tr_id, tr_type, params) + + # API 메타데이터에 기반한 정확한 컬럼 리스트 + columns = [ + "MKSC_SHRN_ISCD", + "STCK_CNTG_HOUR", + "STCK_PRPR", + "PRDY_VRSS_SIGN", + "PRDY_VRSS", + "PRDY_CTRT", + "WGHN_AVRG_STCK_PRC", + "STCK_OPRC", + "STCK_HGPR", + "STCK_LWPR", + "ASKP1", + "BIDP1", + "CNTG_VOL", + "ACML_VOL", + "ACML_TR_PBMN", + "SELN_CNTG_CSNU", + "SHNU_CNTG_CSNU", + "NTBY_CNTG_CSNU", + "CTTR", + "SELN_CNTG_SMTN", + "SHNU_CNTG_SMTN", + "CNTG_CLS_CODE", + "SHNU_RATE", + "PRDY_VOL_VRSS_ACML_VOL_RATE", + "OPRC_HOUR", + "OPRC_VRSS_PRPR_SIGN", + "OPRC_VRSS_PRPR", + "HGPR_HOUR", + "HGPR_VRSS_PRPR_SIGN", + "HGPR_VRSS_PRPR", + "LWPR_HOUR", + "LWPR_VRSS_PRPR_SIGN", + "LWPR_VRSS_PRPR", + "BSOP_DATE", + "NEW_MKOP_CLS_CODE", + "TRHT_YN", + "ASKP_RSQN1", + "BIDP_RSQN1", + "TOTAL_ASKP_RSQN", + "TOTAL_BIDP_RSQN", + "VOL_TNRT", + "PRDY_SMNS_HOUR_ACML_VOL", + "PRDY_SMNS_HOUR_ACML_VOL_RATE", + "HOUR_CLS_CODE", + "MRKT_TRTM_CLS_CODE", + "VI_STND_PRC", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간체결 [실시간-026] +############################################################################################## + +def index_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간체결[H0UPCNT0] 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 국내지수의 실시간 데이터를 구독합니다. + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트되며, 구독을 통해 실시간으로 데이터를 수신할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = subscribe_realtime_index("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UPCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "prpr_nmix", "prdy_vrss_sign", + "bstp_nmix_prdy_vrss", "acml_vol", "acml_tr_pbmn", "pcas_vol", + "pcas_tr_pbmn", "prdy_ctrt", "oprc_nmix", "nmix_hgpr", "nmix_lwpr", + "oprc_vrss_nmix_prpr", "oprc_vrss_nmix_sign", "hgpr_vrss_nmix_prpr", + "hgpr_vrss_nmix_sign", "lwpr_vrss_nmix_prpr", "lwpr_vrss_nmix_sign", + "prdy_clpr_vrss_oprc_rate", "prdy_clpr_vrss_hgpr_rate", + "prdy_clpr_vrss_lwpr_rate", "uplm_issu_cnt", "ascn_issu_cnt", + "stnr_issu_cnt", "down_issu_cnt", "lslm_issu_cnt", "qtqt_ascn_issu_cnt", + "qtqt_down_issu_cnt", "tick_vrss" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간예상체결 [실시간-027] +############################################################################################## + +def index_exp_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간예상체결[H0UPANC0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 국내지수의 실시간 데이터를 구독합니다. + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트되며, 구독 등록/해제 여부와 종목코드를 통해 데이터를 필터링합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 응답 메시지 + columns (list[str]): 실시간 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = index_exp_ccnl("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UPANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "prpr_nmix", "prdy_vrss_sign", + "bstp_nmix_prdy_vrss", "acml_vol", "acml_tr_pbmn", "pcas_vol", + "pcas_tr_pbmn", "prdy_ctrt", "oprc_nmix", "nmix_hgpr", "nmix_lwpr", + "oprc_vrss_nmix_prpr", "oprc_vrss_nmix_sign", "hgpr_vrss_nmix_prpr", + "hgpr_vrss_nmix_sign", "lwpr_vrss_nmix_prpr", "lwpr_vrss_nmix_sign", + "prdy_clpr_vrss_oprc_rate", "prdy_clpr_vrss_hgpr_rate", + "prdy_clpr_vrss_lwpr_rate", "uplm_issu_cnt", "ascn_issu_cnt", + "stnr_issu_cnt", "down_issu_cnt", "lslm_issu_cnt", + "qtqt_ascn_issu_cnt", "qtqt_down_issu_cnt", "tick_vrss" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내지수 실시간프로그램매매 [실시간-028] +############################################################################################## + +def index_program_trade( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내지수 실시간프로그램매매[H0UPPGM0] 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 국내지수의 실시간 프로그램 매매 데이터를 구독합니다. + 실시간 데이터를 구독하거나 구독 해제할 수 있습니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 웹소켓으로부터 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = index_program_trade("1", "005930") + >>> print(msg, columns) + + 참고자료: + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0UPPGM0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "bstp_cls_code", "bsop_hour", "arbt_seln_entm_cnqn", "arbt_seln_onsl_cnqn", + "arbt_shnu_entm_cnqn", "arbt_shnu_onsl_cnqn", "nabt_seln_entm_cnqn", + "nabt_seln_onsl_cnqn", "nabt_shnu_entm_cnqn", "nabt_shnu_onsl_cnqn", + "arbt_seln_entm_cntg_amt", "arbt_seln_onsl_cntg_amt", "arbt_shnu_entm_cntg_amt", + "arbt_shnu_onsl_cntg_amt", "nabt_seln_entm_cntg_amt", "nabt_seln_onsl_cntg_amt", + "nabt_shnu_entm_cntg_amt", "nabt_shnu_onsl_cntg_amt", "arbt_smtn_seln_vol", + "arbt_smtm_seln_vol_rate", "arbt_smtn_seln_tr_pbmn", "arbt_smtm_seln_tr_pbmn_rate", + "arbt_smtn_shnu_vol", "arbt_smtm_shnu_vol_rate", "arbt_smtn_shnu_tr_pbmn", + "arbt_smtm_shnu_tr_pbmn_rate", "arbt_smtn_ntby_qty", "arbt_smtm_ntby_qty_rate", + "arbt_smtn_ntby_tr_pbmn", "arbt_smtm_ntby_tr_pbmn_rate", "nabt_smtn_seln_vol", + "nabt_smtm_seln_vol_rate", "nabt_smtn_seln_tr_pbmn", "nabt_smtm_seln_tr_pbmn_rate", + "nabt_smtn_shnu_vol", "nabt_smtm_shnu_vol_rate", "nabt_smtn_shnu_tr_pbmn", + "nabt_smtm_shnu_tr_pbmn_rate", "nabt_smtn_ntby_qty", "nabt_smtm_ntby_qty_rate", + "nabt_smtn_ntby_tr_pbmn", "nabt_smtm_ntby_tr_pbmn_rate", "whol_entm_seln_vol", + "entm_seln_vol_rate", "whol_entm_seln_tr_pbmn", "entm_seln_tr_pbmn_rate", + "whol_entm_shnu_vol", "entm_shnu_vol_rate", "whol_entm_shnu_tr_pbmn", + "entm_shnu_tr_pbmn_rate", "whol_entm_ntby_qt", "entm_ntby_qty_rat", + "whol_entm_ntby_tr_pbmn", "entm_ntby_tr_pbmn_rate", "whol_onsl_seln_vol", + "onsl_seln_vol_rate", "whol_onsl_seln_tr_pbmn", "onsl_seln_tr_pbmn_rate", + "whol_onsl_shnu_vol", "onsl_shnu_vol_rate", "whol_onsl_shnu_tr_pbmn", + "onsl_shnu_tr_pbmn_rate", "whol_onsl_ntby_qty", "onsl_ntby_qty_rate", + "whol_onsl_ntby_tr_pbmn", "onsl_ntby_tr_pbmn_rate", "total_seln_qty", + "whol_seln_vol_rate", "total_seln_tr_pbmn", "whol_seln_tr_pbmn_rate", + "shnu_cntg_smtn", "whol_shun_vol_rate", "total_shnu_tr_pbmn", + "whol_shun_tr_pbmn_rate", "whol_ntby_qty", "whol_smtm_ntby_qty_rate", + "whol_ntby_tr_pbmn", "whol_ntby_tr_pbmn_rate", "arbt_entm_ntby_qty", + "arbt_entm_ntby_tr_pbmn", "arbt_onsl_ntby_qty", "arbt_onsl_ntby_tr_pbmn", + "nabt_entm_ntby_qty", "nabt_entm_ntby_tr_pbmn", "nabt_onsl_ntby_qty", + "nabt_onsl_ntby_tr_pbmn", "acml_vol", "acml_tr_pbmn", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보 (KRX) [실시간-049] +############################################################################################## + +def market_status_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (KRX)[H0STMKO0] 실시간 데이터 구독 함수 + 이 함수는 국내주식 장운영정보를 실시간으로 구독하거나 구독 해제합니다. + 연결된 종목의 VI 발동 시와 VI 해제 시에 데이터가 수신됩니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 서버로부터 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_krx("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STMKO0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", # 유가증권단축종목코드 + "trht_yn", # 거래정지여부 + "tr_susp_reas_cntt", # 거래정지사유내용 + "mkop_cls_code", # 장운영구분코드 + "antc_mkop_cls_code", # 예상장운영구분코드 + "mrkt_trtm_cls_code", # 임의연장구분코드 + "divi_app_cls_code", # 동시호가배분처리구분코드 + "iscd_stat_cls_code", # 종목상태구분코드 + "vi_cls_code", # VI적용구분코드 + "ovtm_vi_cls_code", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소구분코드 + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(NXT) +############################################################################################## + +def market_status_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (NXT)[H0NXMKO0] + 실시간으로 국내주식 장운영정보를 구독하거나 구독 해제하는 웹소켓 API입니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하면 서버로부터 실시간 데이터가 지속적으로 전송됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXMKO0" + + params = { + "tr_key": tr_key, + } + + # 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 종목코드 + "TRHT_YN", # 거래정지 여부 + "TR_SUSP_REAS_CNTT", # 거래 정지 사유 내용 + "MKOP_CLS_CODE", # 장운영 구분 코드 + "ANTC_MKOP_CLS_CODE", # 예상 장운영 구분 코드 + "MRKT_TRTM_CLS_CODE", # 임의연장구분코드 + "DIVI_APP_CLS_CODE", # 동시호가배분처리구분코드 + "ISCD_STAT_CLS_CODE", # 종목상태구분코드 + "VI_CLS_CODE", # VI적용구분코드 + "OVTM_VI_CLS_CODE", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소 구분코드 + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 장운영정보(통합) +############################################################################################## + +def market_status_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 장운영정보 (통합)[H0UNMKO0] 실시간 데이터 구독 함수 + 이 함수는 웹소켓을 통해 실시간으로 국내주식 장운영정보를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 구독할 종목의 고유 코드 + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 수신된 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = market_status_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독하므로, 지속적인 데이터 수신이 가능합니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UNMKO0" + + params = { + "tr_key": tr_key, + } + + # kis 모듈을 사용하여 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "TRHT_YN", # 거래정지 여부 + "TR_SUSP_REAS_CNTT", # 거래 정지 사유 내용 + "MKOP_CLS_CODE", # 장운영 구분 코드 + "ANTC_MKOP_CLS_CODE", # 예상 장운영 구분 코드 + "MRKT_TRTM_CLS_CODE", # 임의연장구분코드 + "DIVI_APP_CLS_CODE", # 동시호가배분처리구분코드 + "ISCD_STAT_CLS_CODE", # 종목상태구분코드 + "VI_CLS_CODE", # VI적용구분코드 + "OVTM_VI_CLS_CODE", # 시간외단일가VI적용구분코드 + "EXCH_CLS_CODE", # 거래소 구분코드 + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (KRX) [실시간-047] +############################################################################################## + +def member_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간 회원사 (KRX) 데이터 구독 함수 [H0STMBC0] + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내주식 회원사 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제를 지원합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드를 나타내는 문자열. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 구독 요청에 대한 응답 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = member_krx("1", "005930") + >>> print(msg, columns) + + Note: + 실시간 데이터는 웹소켓을 통해 지속적으로 수신됩니다. 구독 해제를 원할 경우, tr_type을 "0"으로 설정하여 호출하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STMBC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "seln2_mbcr_name1", + "seln2_mbcr_name2", + "seln2_mbcr_name3", + "seln2_mbcr_name4", + "seln2_mbcr_name5", + "byov_mbcr_name1", + "byov_mbcr_name2", + "byov_mbcr_name3", + "byov_mbcr_name4", + "byov_mbcr_name5", + "total_seln_qty1", + "total_seln_qty2", + "total_seln_qty3", + "total_seln_qty4", + "total_seln_qty5", + "total_shnu_qty1", + "total_shnu_qty2", + "total_shnu_qty3", + "total_shnu_qty4", + "total_shnu_qty5", + "seln_mbcr_glob_yn_1", + "seln_mbcr_glob_yn_2", + "seln_mbcr_glob_yn_3", + "seln_mbcr_glob_yn_4", + "seln_mbcr_glob_yn_5", + "shnu_mbcr_glob_yn_1", + "shnu_mbcr_glob_yn_2", + "shnu_mbcr_glob_yn_3", + "shnu_mbcr_glob_yn_4", + "shnu_mbcr_glob_yn_5", + "seln_mbcr_no1", + "seln_mbcr_no2", + "seln_mbcr_no3", + "seln_mbcr_no4", + "seln_mbcr_no5", + "shnu_mbcr_no1", + "shnu_mbcr_no2", + "shnu_mbcr_no3", + "shnu_mbcr_no4", + "shnu_mbcr_no5", + "seln_mbcr_rlim1", + "seln_mbcr_rlim2", + "seln_mbcr_rlim3", + "seln_mbcr_rlim4", + "seln_mbcr_rlim5", + "shnu_mbcr_rlim1", + "shnu_mbcr_rlim2", + "shnu_mbcr_rlim3", + "shnu_mbcr_rlim4", + "shnu_mbcr_rlim5", + "seln_qty_icdc1", + "seln_qty_icdc2", + "seln_qty_icdc3", + "seln_qty_icdc4", + "seln_qty_icdc5", + "shnu_qty_icdc1", + "shnu_qty_icdc2", + "shnu_qty_icdc3", + "shnu_qty_icdc4", + "shnu_qty_icdc5", + "glob_total_seln_qty", + "glob_total_shnu_qty", + "glob_total_seln_qty_icdc", + "glob_total_shnu_qty_icdc", + "glob_ntby_qty", + "glob_seln_rlim", + "glob_shnu_rlim", + "seln2_mbcr_eng_name1", + "seln2_mbcr_eng_name2", + "seln2_mbcr_eng_name3", + "seln2_mbcr_eng_name4", + "seln2_mbcr_eng_name5", + "byov_mbcr_eng_name1", + "byov_mbcr_eng_name2", + "byov_mbcr_eng_name3", + "byov_mbcr_eng_name4", + "byov_mbcr_eng_name5", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (NXT) +############################################################################################## + +def member_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간회원사 (NXT)[H0NXMBC0] + 국내주식 실시간회원사 (NXT) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 빈 문자열이 아니어야 함 + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = member_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. 구독을 시작하려면 tr_type을 "1"로 설정하고, + 구독을 해제하려면 "0"으로 설정하십시오. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0NXMBC0" + + params = { + "tr_key": tr_key, + } + + # 실시간 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "SELN2_MBCR_NAME1", + "SELN2_MBCR_NAME2", + "SELN2_MBCR_NAME3", + "SELN2_MBCR_NAME4", + "SELN2_MBCR_NAME5", + "BYOV_MBCR_NAME1", + "BYOV_MBCR_NAME2", + "BYOV_MBCR_NAME3", + "BYOV_MBCR_NAME4", + "BYOV_MBCR_NAME5", + "TOTAL_SELN_QTY1", + "TOTAL_SELN_QTY2", + "TOTAL_SELN_QTY3", + "TOTAL_SELN_QTY4", + "TOTAL_SELN_QTY5", + "TOTAL_SHNU_QTY1", + "TOTAL_SHNU_QTY2", + "TOTAL_SHNU_QTY3", + "TOTAL_SHNU_QTY4", + "TOTAL_SHNU_QTY5", + "SELN_MBCR_GLOB_YN_1", + "SELN_MBCR_GLOB_YN_2", + "SELN_MBCR_GLOB_YN_3", + "SELN_MBCR_GLOB_YN_4", + "SELN_MBCR_GLOB_YN_5", + "SHNU_MBCR_GLOB_YN_1", + "SHNU_MBCR_GLOB_YN_2", + "SHNU_MBCR_GLOB_YN_3", + "SHNU_MBCR_GLOB_YN_4", + "SHNU_MBCR_GLOB_YN_5", + "SELN_MBCR_NO1", + "SELN_MBCR_NO2", + "SELN_MBCR_NO3", + "SELN_MBCR_NO4", + "SELN_MBCR_NO5", + "SHNU_MBCR_NO1", + "SHNU_MBCR_NO2", + "SHNU_MBCR_NO3", + "SHNU_MBCR_NO4", + "SHNU_MBCR_NO5", + "SELN_MBCR_RLIM1", + "SELN_MBCR_RLIM2", + "SELN_MBCR_RLIM3", + "SELN_MBCR_RLIM4", + "SELN_MBCR_RLIM5", + "SHNU_MBCR_RLIM1", + "SHNU_MBCR_RLIM2", + "SHNU_MBCR_RLIM3", + "SHNU_MBCR_RLIM4", + "SHNU_MBCR_RLIM5", + "SELN_QTY_ICDC1", + "SELN_QTY_ICDC2", + "SELN_QTY_ICDC3", + "SELN_QTY_ICDC4", + "SELN_QTY_ICDC5", + "SHNU_QTY_ICDC1", + "SHNU_QTY_ICDC2", + "SHNU_QTY_ICDC3", + "SHNU_QTY_ICDC4", + "SHNU_QTY_ICDC5", + "GLOB_TOTAL_SELN_QTY", + "GLOB_TOTAL_SHNU_QTY", + "GLOB_TOTAL_SELN_QTY_ICDC", + "GLOB_TOTAL_SHNU_QTY_ICDC", + "GLOB_NTBY_QTY", + "GLOB_SELN_RLIM", + "GLOB_SHNU_RLIM", + "SELN2_MBCR_ENG_NAME1", + "SELN2_MBCR_ENG_NAME2", + "SELN2_MBCR_ENG_NAME3", + "SELN2_MBCR_ENG_NAME4", + "SELN2_MBCR_ENG_NAME5", + "BYOV_MBCR_ENG_NAME1", + "BYOV_MBCR_ENG_NAME2", + "BYOV_MBCR_ENG_NAME3", + "BYOV_MBCR_ENG_NAME4", + "BYOV_MBCR_ENG_NAME5", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간회원사 (통합) +############################################################################################## + +def member_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간회원사 (통합)[H0UNMBC0] + 국내주식 실시간회원사 (통합) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드, 빈 문자열이 아니어야 함 + + Returns: + message (dict): 실시간으로 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Example: + >>> msg, columns = member_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 실시간 데이터를 처리하기 위해 웹소켓을 사용합니다. 구독을 등록하면 실시간으로 데이터가 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0UNMBC0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", + "SELN2_MBCR_NAME1", + "SELN2_MBCR_NAME2", + "SELN2_MBCR_NAME3", + "SELN2_MBCR_NAME4", + "SELN2_MBCR_NAME5", + "BYOV_MBCR_NAME1", + "BYOV_MBCR_NAME2", + "BYOV_MBCR_NAME3", + "BYOV_MBCR_NAME4", + "BYOV_MBCR_NAME5", + "TOTAL_SELN_QTY1", + "TOTAL_SELN_QTY2", + "TOTAL_SELN_QTY3", + "TOTAL_SELN_QTY4", + "TOTAL_SELN_QTY5", + "TOTAL_SHNU_QTY1", + "TOTAL_SHNU_QTY2", + "TOTAL_SHNU_QTY3", + "TOTAL_SHNU_QTY4", + "TOTAL_SHNU_QTY5", + "SELN_MBCR_GLOB_YN_1", + "SELN_MBCR_GLOB_YN_2", + "SELN_MBCR_GLOB_YN_3", + "SELN_MBCR_GLOB_YN_4", + "SELN_MBCR_GLOB_YN_5", + "SHNU_MBCR_GLOB_YN_1", + "SHNU_MBCR_GLOB_YN_2", + "SHNU_MBCR_GLOB_YN_3", + "SHNU_MBCR_GLOB_YN_4", + "SHNU_MBCR_GLOB_YN_5", + "SELN_MBCR_NO1", + "SELN_MBCR_NO2", + "SELN_MBCR_NO3", + "SELN_MBCR_NO4", + "SELN_MBCR_NO5", + "SHNU_MBCR_NO1", + "SHNU_MBCR_NO2", + "SHNU_MBCR_NO3", + "SHNU_MBCR_NO4", + "SHNU_MBCR_NO5", + "SELN_MBCR_RLIM1", + "SELN_MBCR_RLIM2", + "SELN_MBCR_RLIM3", + "SELN_MBCR_RLIM4", + "SELN_MBCR_RLIM5", + "SHNU_MBCR_RLIM1", + "SHNU_MBCR_RLIM2", + "SHNU_MBCR_RLIM3", + "SHNU_MBCR_RLIM4", + "SHNU_MBCR_RLIM5", + "SELN_QTY_ICDC1", + "SELN_QTY_ICDC2", + "SELN_QTY_ICDC3", + "SELN_QTY_ICDC4", + "SELN_QTY_ICDC5", + "SHNU_QTY_ICDC1", + "SHNU_QTY_ICDC2", + "SHNU_QTY_ICDC3", + "SHNU_QTY_ICDC4", + "SHNU_QTY_ICDC5", + "GLOB_TOTAL_SELN_QTY", + "GLOB_TOTAL_SHNU_QTY", + "GLOB_TOTAL_SELN_QTY_ICDC", + "GLOB_TOTAL_SHNU_QTY_ICDC", + "GLOB_NTBY_QTY", + "GLOB_SELN_RLIM", + "GLOB_SHNU_RLIM", + "SELN2_MBCR_ENG_NAME1", + "SELN2_MBCR_ENG_NAME2", + "SELN2_MBCR_ENG_NAME3", + "SELN2_MBCR_ENG_NAME4", + "SELN2_MBCR_ENG_NAME5", + "BYOV_MBCR_ENG_NAME1", + "BYOV_MBCR_ENG_NAME2", + "BYOV_MBCR_ENG_NAME3", + "BYOV_MBCR_ENG_NAME4", + "BYOV_MBCR_ENG_NAME5", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간호가 (KRX) [실시간-025] +############################################################################################## + +def overtime_asking_price_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간호가 (KRX)[H0STOAA0] + 국내주식 시간외 실시간호가 API입니다. + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간호가 데이터 확인 가능합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = subscribe_overtime_asking_price_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신됩니다. 구독을 해제하지 않으면 데이터가 계속 수신됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STOAA0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "bsop_hour", + "hour_cls_code", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "total_askp_rsqn", + "total_bidp_rsqn", + "ovtm_total_askp_rsqn", + "ovtm_total_bidp_rsqn", + "antc_cnpr", + "antc_cnqn", + "antc_vol", + "antc_cntg_vrss", + "antc_cntg_vrss_sign", + "antc_cntg_prdy_ctrt", + "acml_vol", + "total_askp_rsqn_icdc", + "total_bidp_rsqn_icdc", + "ovtm_total_askp_icdc", + "ovtm_total_bidp_icdc", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간체결가 (KRX) [실시간-042] +############################################################################################## + +def overtime_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간체결가 (KRX)[H0STOUP0] + 국내주식 시간외 실시간체결가 API입니다. + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간체결가 데이터 확인 가능합니다. + + 실시간 데이터 구독을 위한 웹소켓 함수입니다. + tr_type은 구독 등록("1") 또는 해제("0") 여부를 나타내며, + tr_key는 구독할 종목의 코드를 나타냅니다. + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부 + tr_key (str): [필수] 구독할 종목의 코드 (빈 문자열 불가) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = overtime_ccnl_krx("1", "005930") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STOUP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 시간외 실시간예상체결 (KRX) [실시간-024] +############################################################################################## + +def overtime_exp_ccnl_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 시간외 실시간예상체결 (KRX)[H0STOAC0] + 국내주식 시간외 단일가(16:00~18:00) 시간대에 실시간예상체결 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 메시지 데이터. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = subscribe_overtime_exp_ccnl_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 수신되며, 구독이 성공적으로 등록되면 실시간으로 데이터를 받을 수 있습니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0STOAC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "vol_tnrt", + "prdy_smns_hour_acml_vol", + "prdy_smns_hour_acml_vol_rate", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (KRX) [실시간-048] +############################################################################################## + +def program_trade_krx( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (KRX)[H0STPGM0] 구독 함수 + + 이 함수는 한국투자증권 웹소켓 API를 통해 실시간으로 국내 주식의 프로그램 매매 데이터를 구독합니다. + 웹소켓을 통해 실시간 데이터를 수신하며, 구독 등록 및 해제를 지원합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드. 빈 문자열이 아니어야 하며, 유효한 종목코드 형식이어야 합니다. + + Returns: + message (dict): 웹소켓을 통해 수신된 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 리스트 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = program_trade_krx("1", "005930") + >>> print(msg, columns) + + 실시간 데이터는 웹소켓을 통해 지속적으로 수신되며, 구독 해제 요청을 보내기 전까지 계속됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # 거래 ID 설정 + tr_id = "H0STPGM0" + + # 요청 파라미터 설정 + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", # 유가증권단축종목코드 + "stck_cntg_hour", # 주식체결시간 + "seln_cnqn", # 매도체결량 + "seln_tr_pbmn", # 매도거래대금 + "shnu_cnqn", # 매수2체결량 + "shnu_tr_pbmn", # 매수2거래대금 + "ntby_cnqn", # 순매수체결량 + "ntby_tr_pbmn", # 순매수거래대금 + "seln_rsqn", # 매도호가잔량 + "shnu_rsqn", # 매수호가잔량 + "whol_ntby_qty", # 전체순매수호가잔량 + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (NXT) +############################################################################################## + +def program_trade_nxt( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (NXT)[H0NXPGM0] + 국내주식 실시간프로그램매매 (NXT) API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독하거나 구독 해제합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Example: + >>> msg, columns = program_trade_nxt("1", "005930") + >>> print(msg, columns) + + Note: + 실시간 데이터는 웹소켓을 통해 지속적으로 업데이트됩니다. 구독을 해제하지 않으면 데이터 스트림이 계속 유지됩니다. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + # 거래 ID 설정 + tr_id = "H0NXPGM0" + + # 요청 파라미터 설정 + params = { + "tr_key": tr_key, + } + + # 데이터 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 유가증권 단축 종목코드 + "STCK_CNTG_HOUR", # 주식 체결 시간 + "SELN_CNQN", # 매도 체결량 + "SELN_TR_PBMN", # 매도 거래 대금 + "SHNU_CNQN", # 매수2 체결량 + "SHNU_TR_PBMN", # 매수2 거래 대금 + "NTBY_CNQN", # 순매수 체결량 + "NTBY_TR_PBMN", # 순매수 거래 대금 + "SELN_RSQN", # 매도호가잔량 + "SHNU_RSQN", # 매수호가잔량 + "WHOL_NTBY_QTY", # 전체순매수호가잔량 + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 > 국내주식 실시간프로그램매매 (통합) +############################################################################################## + +def program_trade_total( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내주식 실시간프로그램매매 (통합)[H0UNPGM0] + 국내주식 실시간프로그램매매 (통합) API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 값 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 실시간 데이터 메시지 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = program_trade_total("1", "005930") + >>> print(msg, columns) + + Note: + 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. + 구독을 시작하려면 tr_type을 "1"로 설정하고, 해제하려면 "0"으로 설정하세요. + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 빈 문자열일 수 없습니다.") + + tr_id = "H0UNPGM0" + + params = { + "tr_key": tr_key, + } + + # 웹소켓을 통해 실시간 데이터 구독 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "MKSC_SHRN_ISCD", # 유가증권 단축 종목코드 + "STCK_CNTG_HOUR", # 주식 체결 시간 + "SELN_CNQN", # 매도 체결량 + "SELN_TR_PBMN", # 매도 거래 대금 + "SHNU_CNQN", # 매수2 체결량 + "SHNU_TR_PBMN", # 매수2 거래 대금 + "NTBY_CNQN", # 순매수 체결량 + "NTBY_TR_PBMN", # 순매수 거래 대금 + "SELN_RSQN", # 매도호가잔량 + "SHNU_RSQN", # 매수호가잔량 + "WHOL_NTBY_QTY", # 전체순매수호가잔량 + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/elw/elw_examples.py b/한국투자증권(API)/examples_user/elw/elw_examples.py new file mode 100644 index 0000000..9e579b3 --- /dev/null +++ b/한국투자증권(API)/examples_user/elw/elw_examples.py @@ -0,0 +1,165 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from elw_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [국내주식] ELW시세 - ELW 비교대상종목조회[국내주식-183] +############################################################################################## + +df = compare_stocks(fid_cond_scr_div_code="11517", fid_input_iscd="005930") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 종목검색[국내주식-166] +############################################################################################## + +df = cond_search(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11510", fid_rank_sort_cls_code="0", fid_input_cnt_1="100") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 만기예정/만기종목[국내주식-184] +############################################################################################## + +df = expiration_stocks(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11547", fid_input_date_1="20240402", fid_input_date_2="20240408", fid_div_cls_code="2", fid_etc_cls_code="", fid_unas_input_iscd="000000", fid_input_iscd_2="00000", fid_blng_cls_code="0", fid_input_option_1="") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 지표순위[국내주식-169] +############################################################################################## + +df = indicator(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20279", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_rank_sort_cls_code="0", fid_blng_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(체결)[국내주식-172] +############################################################################################## + +df = indicator_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(일별)[국내주식-173] +############################################################################################## + +df = indicator_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="57K281") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(분별)[국내주식-174] +############################################################################################## + +df = indicator_trend_minute(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297", fid_hour_cls_code="60", fid_pw_data_incu_yn="N") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW LP매매추이 [국내주식-182] +############################################################################################## + +df1, df2 = lp_trade_trend(fid_cond_mrkt_div_code="W", fid_input_iscd="52K577") +print(df1) +print(df2) + +############################################################################################## +# [국내주식] ELW시세 - ELW 신규상장종목[국내주식-181] +############################################################################################## + +df = newly_listed(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11548", fid_div_cls_code="02", fid_unas_input_iscd="000000", fid_input_iscd_2="00003", fid_input_date_1="20240402", fid_blng_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 당일급변종목[국내주식-171] +############################################################################################## + +df = quick_change(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20287", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_mrkt_cls_code="A", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_hour_cls_code="1", fid_input_hour_1="", fid_input_hour_2="", fid_rank_sort_cls_code="1", fid_blng_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 순위[국내주식-170] +############################################################################################## + +df = sensitivity(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20285", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_rank_sort_cls_code="0", fid_input_rmnn_dynu_1="", fid_input_date_1="", fid_blng_cls_code="0") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(체결)[국내주식-175] +############################################################################################## + +df = sensitivity_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(일별)[국내주식-176] +############################################################################################## + +df = sensitivity_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="58J438") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산 목록조회[국내주식-185] +############################################################################################## + +df = udrl_asset_list(fid_cond_scr_div_code="11541", fid_rank_sort_cls_code="0", fid_input_iscd="00000") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산별 종목시세[국내주식-186] +############################################################################################## + +df = udrl_asset_price(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="11541", fid_mrkt_cls_code="A", fid_input_iscd="00000", fid_unas_input_iscd="005930", fid_vol_cnt="1000", fid_trgt_exls_cls_code="0", fid_input_price_1="1000", fid_input_price_2="5000", fid_input_vol_1="100", fid_input_vol_2="1000", fid_input_rmnn_dynu_1="30", fid_input_rmnn_dynu_2="90", fid_option="0", fid_input_option_1="", fid_input_option_2="") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 상승률순위[국내주식-167] +############################################################################################## + +df = updown_rate(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20277", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_input_rmnn_dynu_1="0", fid_div_cls_code="0", fid_input_price_1="", fid_input_price_2="", fid_input_vol_1="", fid_input_vol_2="", fid_input_date_1="", fid_rank_sort_cls_code="0", fid_blng_cls_code="0", fid_input_date_2="") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(체결)[국내주식-177] +############################################################################################## + +df = volatility_trend_ccnl(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(일별)[국내주식-178] +############################################################################################## + +df = volatility_trend_daily(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(분별)[국내주식-179] +############################################################################################## + +df = volatility_trend_minute(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297", fid_hour_cls_code="60", fid_pw_data_incu_yn="N") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(틱)[국내주식-180] +############################################################################################## + +df = volatility_trend_tick(fid_cond_mrkt_div_code="W", fid_input_iscd="58J297") +print(df) + +############################################################################################## +# [국내주식] ELW시세 - ELW 거래량순위[국내주식-168] +############################################################################################## + +df = volume_rank(fid_cond_mrkt_div_code="W", fid_cond_scr_div_code="20278", fid_unas_input_iscd="000000", fid_input_iscd="00000", fid_input_rmnn_dynu_1="", fid_div_cls_code="0", fid_input_price_1="0", fid_input_price_2="100000", fid_input_vol_1="0", fid_input_vol_2="1000000", fid_input_date_1="20250101", fid_rank_sort_cls_code="0", fid_blng_cls_code="0", fid_input_iscd_2="0000", fid_input_date_2="") +print(df) + diff --git a/한국투자증권(API)/examples_user/elw/elw_examples_ws.py b/한국투자증권(API)/examples_user/elw/elw_examples_ws.py new file mode 100644 index 0000000..ce66b6c --- /dev/null +++ b/한국투자증권(API)/examples_user/elw/elw_examples_ws.py @@ -0,0 +1,46 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from elw_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간호가[실시간-062] +############################################################################################## + +kws.subscribe(request=elw_asking_price, data=["57LA24", "57L739", "57L650", "57L966", "52L181", "57LB38"]) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간체결가[실시간-061] +############################################################################################## + +kws.subscribe(request=elw_ccnl, data=["57LA24", "57L739", "57L650", "57L966", "52L181", "57LB38"]) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간예상체결[실시간-063] +############################################################################################## + +kws.subscribe(request=elw_exp_ccnl, data=["57LA24", "57L739", "57L650", "57L966", "52L181", "57LB38"]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/elw/elw_functions.py b/한국투자증권(API)/examples_user/elw/elw_functions.py new file mode 100644 index 0000000..01e50bb --- /dev/null +++ b/한국투자증권(API)/examples_user/elw/elw_functions.py @@ -0,0 +1,3021 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] ELW시세 - ELW 비교대상종목조회[국내주식-183] +############################################################################################## + +def compare_stocks( + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 비교대상종목조회[국내주식-183] + ELW 비교대상종목조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 조건화면분류코드 (예: '11517') + fid_input_iscd (str): 입력종목코드 (예: '005930') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 비교대상종목조회 데이터 + + Example: + >>> df = compare_stocks('11517', '005930') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11517')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11517')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '005930')") + raise ValueError("fid_input_iscd is required. (e.g. '005930')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHKEW151701C0" + + + + api_url = "/uapi/elw/v1/quotations/compare-stocks" + + + + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return compare_stocks( + fid_cond_scr_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 종목검색[국내주식-166] +############################################################################################## + +def cond_search( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 (필수) + fid_cond_scr_div_code: str, # 조건화면분류코드 (필수) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 (필수) + fid_input_cnt_1: str, # 입력수1 (필수) + fid_rank_sort_cls_code_2: Optional[str] = "", # 순위정렬구분코드2 (선택) + fid_input_cnt_2: Optional[str] = "", # 입력수2 (선택) + fid_rank_sort_cls_code_3: Optional[str] = "", # 순위정렬구분코드3 (선택) + fid_input_cnt_3: Optional[str] = "", # 입력수3 (선택) + fid_trgt_cls_code: Optional[str] = "", # 대상구분코드 (선택) + fid_input_iscd: Optional[str] = "", # 입력종목코드 (선택 - 전체 허용) + fid_unas_input_iscd: Optional[str] = "", # 기초자산입력종목코드 (선택) + fid_mrkt_cls_code: Optional[str] = "", # 시장구분코드 (선택 - 전체 허용) + fid_input_date_1: Optional[str] = "", # 입력날짜1 (선택 - 전체 허용) + fid_input_date_2: Optional[str] = "", # 입력날짜2 (선택 - 전체 허용) + fid_input_iscd_2: Optional[str] = "", # 입력종목코드2 (선택) + fid_etc_cls_code: Optional[str] = "", # 기타구분코드 (선택 - 전체 허용) + fid_input_rmnn_dynu_1: Optional[str] = "", # 입력잔존일수1 (선택 - 이상값) + fid_input_rmnn_dynu_2: Optional[str] = "", # 입력잔존일수2 (선택 - 이하값) + fid_prpr_cnt1: Optional[str] = "", # 현재가수1 (선택 - 이상값) + fid_prpr_cnt2: Optional[str] = "", # 현재가수2 (선택 - 이하값) + fid_rsfl_rate1: Optional[str] = "", # 등락비율1 (선택 - 이상값) + fid_rsfl_rate2: Optional[str] = "", # 등락비율2 (선택 - 이하값) + fid_vol1: Optional[str] = "", # 거래량1 (선택 - 이상값) + fid_vol2: Optional[str] = "", # 거래량2 (선택 - 이하값) + fid_aply_rang_prc_1: Optional[str] = "", # 적용범위가격1 (선택) + fid_aply_rang_prc_2: Optional[str] = "", # 적용범위가격2 (선택) + fid_lvrg_val1: Optional[str] = "", # 레버리지값1 (선택) + fid_lvrg_val2: Optional[str] = "", # 레버리지값2 (선택) + fid_vol3: Optional[str] = "", # 거래량3 (선택) + fid_vol4: Optional[str] = "", # 거래량4 (선택) + fid_ints_vltl1: Optional[str] = "", # 내재변동성1 (선택 - 이상값) + fid_ints_vltl2: Optional[str] = "", # 내재변동성2 (선택 - 이하값) + fid_prmm_val1: Optional[str] = "", # 프리미엄값1 (선택 - 이상값) + fid_prmm_val2: Optional[str] = "", # 프리미엄값2 (선택 - 이하값) + fid_gear1: Optional[str] = "", # 기어링1 (선택 - 이상값) + fid_gear2: Optional[str] = "", # 기어링2 (선택 - 이하값) + fid_prls_qryr_rate1: Optional[str] = "", # 손익분기비율1 (선택 - 이상값) + fid_prls_qryr_rate2: Optional[str] = "", # 손익분기비율2 (선택 - 이하값) + fid_delta1: Optional[str] = "", # 델타1 (선택 - 이상값) + fid_delta2: Optional[str] = "", # 델타2 (선택 - 이하값) + fid_acpr1: Optional[str] = "", # 행사가1 (선택) + fid_acpr2: Optional[str] = "", # 행사가2 (선택) + fid_stck_cnvr_rate1: Optional[str] = "", # 주식전환비율1 (선택 - 이상값) + fid_stck_cnvr_rate2: Optional[str] = "", # 주식전환비율2 (선택 - 이하값) + fid_div_cls_code: Optional[str] = "", # 분류구분코드 (선택) + fid_prit1: Optional[str] = "", # 패리티1 (선택 - 이상값) + fid_prit2: Optional[str] = "", # 패리티2 (선택 - 이하값) + fid_cfp1: Optional[str] = "", # 자본지지점1 (선택 - 이상값) + fid_cfp2: Optional[str] = "", # 자본지지점2 (선택 - 이하값) + fid_input_nmix_price_1: Optional[str] = "", # 지수가격1 (선택 - 이상값) + fid_input_nmix_price_2: Optional[str] = "", # 지수가격2 (선택 - 이하값) + fid_egea_val1: Optional[str] = "", # E기어링값1 (선택 - 이상값) + fid_egea_val2: Optional[str] = "", # E기어링값2 (선택 - 이하값) + fid_input_dvdn_ert: Optional[str] = "", # 배당수익율 (선택 - 이상값) + fid_input_hist_vltl: Optional[str] = "", # 역사적변동성 (선택 - 이하값) + fid_theta1: Optional[str] = "", # 세타1 (선택 - 이상값) + fid_theta2: Optional[str] = "", # 세타2 (선택 - 이하값) + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> pd.DataFrame: + """ + ELW 종목검색 API를 호출하여 조건에 맞는 ELW 종목 정보를 조회합니다. + + 한국투자 HTS(eFriend Plus) > [0291] ELW 종목검색 화면의 기능을 API로 구현한 함수입니다. + 다양한 조건을 설정하여 ELW 종목을 검색하고, 한 번의 호출에 최대 100건까지 조회 가능합니다. + 연속 조회를 통해 전체 데이터를 수집할 수 있습니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (ELW의 경우 "W" 입력) + fid_cond_scr_div_code (str): 조건화면분류코드 (화면번호 "11510" 입력) + fid_rank_sort_cls_code (str): 순위정렬구분코드 + - 0: 정렬안함, 1: 종목코드, 2: 현재가, 3: 대비율, 4: 거래량 + - 5: 행사가격, 6: 전환비율, 7: 상장일, 8: 만기일, 9: 잔존일수, 10: 레버리지 + fid_input_cnt_1 (str): 정렬1기준 (1: 상위, 2: 하위) + 나머지 파라미터들: 대부분 선택사항으로 빈 문자열("")로 설정 가능 + tr_cont (str): 연속 거래 여부 (초기 조회시 공백, 연속 조회시 "N") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (재귀 호출용) + depth (int): 현재 재귀 깊이 (재귀 호출 횟수 추적) + max_depth (int): 최대 재귀 깊이 (무한 재귀 방지, 기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 종목검색 결과 데이터프레임 + - 성공시: ELW 종목 정보가 포함된 DataFrame 반환 + - 실패시: 빈 DataFrame 반환 + - API 오류시: None 반환 + + Raises: + ValueError: 필수 파라미터가 누락되거나 잘못된 값이 입력된 경우 + + Example: + >>> # 기본 ELW 검색 (전체 종목) + >>> df = cond_search( + ... fid_cond_mrkt_div_code="W", + ... fid_cond_scr_div_code="11510", + ... fid_rank_sort_cls_code="0", + ... fid_input_cnt_1="1", + ... fid_rank_sort_cls_code_2="", + ... fid_input_cnt_2="", + ... fid_rank_sort_cls_code_3="", + ... fid_input_cnt_3="", + ... fid_trgt_cls_code="", + ... fid_input_iscd="", + ... fid_unas_input_iscd="", + ... fid_mrkt_cls_code="", + ... fid_input_date_1="", + ... fid_input_date_2="", + ... fid_input_iscd_2="", + ... fid_etc_cls_code="", + ... # 나머지 모든 파라미터는 빈 문자열 + ... **{param: "" for param in [ + ... "fid_input_rmnn_dynu_1", "fid_input_rmnn_dynu_2", + ... "fid_prpr_cnt1", "fid_prpr_cnt2", "fid_rsfl_rate1", "fid_rsfl_rate2", + ... "fid_vol1", "fid_vol2", "fid_aply_rang_prc_1", "fid_aply_rang_prc_2", + ... "fid_lvrg_val1", "fid_lvrg_val2", "fid_vol3", "fid_vol4", + ... "fid_ints_vltl1", "fid_ints_vltl2", "fid_prmm_val1", "fid_prmm_val2", + ... "fid_gear1", "fid_gear2", "fid_prls_qryr_rate1", "fid_prls_qryr_rate2", + ... "fid_delta1", "fid_delta2", "fid_acpr1", "fid_acpr2", + ... "fid_stck_cnvr_rate1", "fid_stck_cnvr_rate2", "fid_div_cls_code", + ... "fid_prit1", "fid_prit2", "fid_cfp1", "fid_cfp2", + ... "fid_input_nmix_price_1", "fid_input_nmix_price_2", + ... "fid_egea_val1", "fid_egea_val2", "fid_input_dvdn_ert", + ... "fid_input_hist_vltl", "fid_theta1", "fid_theta2" + ... ]} + ... ) + >>> print(df.head()) + """ + + # 필수 파라미터 검증 (최소한으로 축소) + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11510')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11510')") + + if fid_rank_sort_cls_code is None: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_cnt_1: + logger.error("fid_input_cnt_1 is required. (e.g. '1')") + raise ValueError("fid_input_cnt_1 is required. (e.g. '1')") + + # 최대 재귀 깊이 체크 (무한 재귀 방지) + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 정보 설정 + + # 요청 파라미터 설정 + + tr_id = "FHKEW15100000" + + api_url = "/uapi/elw/v1/quotations/cond-search" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_CNT_1": fid_input_cnt_1, + "FID_RANK_SORT_CLS_CODE_2": fid_rank_sort_cls_code_2, + "FID_INPUT_CNT_2": fid_input_cnt_2, + "FID_RANK_SORT_CLS_CODE_3": fid_rank_sort_cls_code_3, + "FID_INPUT_CNT_3": fid_input_cnt_3, + "FID_TRGT_CLS_CODE": fid_trgt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_RMNN_DYNU_2": fid_input_rmnn_dynu_2, + "FID_PRPR_CNT1": fid_prpr_cnt1, + "FID_PRPR_CNT2": fid_prpr_cnt2, + "FID_RSFL_RATE1": fid_rsfl_rate1, + "FID_RSFL_RATE2": fid_rsfl_rate2, + "FID_VOL1": fid_vol1, + "FID_VOL2": fid_vol2, + "FID_APLY_RANG_PRC_1": fid_aply_rang_prc_1, + "FID_APLY_RANG_PRC_2": fid_aply_rang_prc_2, + "FID_LVRG_VAL1": fid_lvrg_val1, + "FID_LVRG_VAL2": fid_lvrg_val2, + "FID_VOL3": fid_vol3, + "FID_VOL4": fid_vol4, + "FID_INTS_VLTL1": fid_ints_vltl1, + "FID_INTS_VLTL2": fid_ints_vltl2, + "FID_PRMM_VAL1": fid_prmm_val1, + "FID_PRMM_VAL2": fid_prmm_val2, + "FID_GEAR1": fid_gear1, + "FID_GEAR2": fid_gear2, + "FID_PRLS_QRYR_RATE1": fid_prls_qryr_rate1, + "FID_PRLS_QRYR_RATE2": fid_prls_qryr_rate2, + "FID_DELTA1": fid_delta1, + "FID_DELTA2": fid_delta2, + "FID_ACPR1": fid_acpr1, + "FID_ACPR2": fid_acpr2, + "FID_STCK_CNVR_RATE1": fid_stck_cnvr_rate1, + "FID_STCK_CNVR_RATE2": fid_stck_cnvr_rate2, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_PRIT1": fid_prit1, + "FID_PRIT2": fid_prit2, + "FID_CFP1": fid_cfp1, + "FID_CFP2": fid_cfp2, + "FID_INPUT_NMIX_PRICE_1": fid_input_nmix_price_1, + "FID_INPUT_NMIX_PRICE_2": fid_input_nmix_price_2, + "FID_EGEA_VAL1": fid_egea_val1, + "FID_EGEA_VAL2": fid_egea_val2, + "FID_INPUT_DVDN_ERT": fid_input_dvdn_ert, + "FID_INPUT_HIST_VLTL": fid_input_hist_vltl, + "FID_THETA1": fid_theta1, + "FID_THETA2": fid_theta2, + } + + # API 호출 정보 로그 + logger.info("ELW 종목검색 API 호출 시작 (depth: %d)", depth) + + # API 호출 실행 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + # 단일 객체인 경우 리스트로 변환 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + logger.info("API 호출 성공: %d건의 데이터를 수신했습니다.", len(current_data)) + else: + current_data = pd.DataFrame() + logger.warning("API 응답에서 output 데이터를 찾을 수 없습니다.") + + # 데이터프레임 누적 처리 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 조회 여부 확인 + tr_cont = res.getHeader().tr_cont + + # 연속 데이터가 있는 경우 재귀 호출 + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() # API 호출 간격 조절 + return cond_search( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_input_cnt_1, + fid_rank_sort_cls_code_2, + fid_input_cnt_2, + fid_rank_sort_cls_code_3, + fid_input_cnt_3, + fid_trgt_cls_code, + fid_input_iscd, + fid_unas_input_iscd, + fid_mrkt_cls_code, + fid_input_date_1, + fid_input_date_2, + fid_input_iscd_2, + fid_etc_cls_code, + fid_input_rmnn_dynu_1, + fid_input_rmnn_dynu_2, + fid_prpr_cnt1, + fid_prpr_cnt2, + fid_rsfl_rate1, + fid_rsfl_rate2, + fid_vol1, + fid_vol2, + fid_aply_rang_prc_1, + fid_aply_rang_prc_2, + fid_lvrg_val1, + fid_lvrg_val2, + fid_vol3, + fid_vol4, + fid_ints_vltl1, + fid_ints_vltl2, + fid_prmm_val1, + fid_prmm_val2, + fid_gear1, + fid_gear2, + fid_prls_qryr_rate1, + fid_prls_qryr_rate2, + fid_delta1, + fid_delta2, + fid_acpr1, + fid_acpr2, + fid_stck_cnvr_rate1, + fid_stck_cnvr_rate2, + fid_div_cls_code, + fid_prit1, + fid_prit2, + fid_cfp1, + fid_cfp2, + fid_input_nmix_price_1, + fid_input_nmix_price_2, + fid_egea_val1, + fid_egea_val2, + fid_input_dvdn_ert, + fid_input_hist_vltl, + fid_theta1, + fid_theta2, + "N", dataframe, depth + 1, max_depth + ) + else: + # 데이터 수집 완료 + logger.info("Data fetch complete.") + total_records = len(dataframe) if dataframe is not None else 0 + logger.info("총 %d건의 ELW 종목 데이터를 수집했습니다.", total_records) + return dataframe + else: + # API 호출 실패 처리 + error_code = res.getErrorCode() + error_message = res.getErrorMessage() + logger.error("API call failed: %s - %s", error_code, error_message) + res.printError(api_url) + return pd.DataFrame() # 빈 데이터프레임 반환 + +############################################################################################## +# [국내주식] ELW시세 - ELW 만기예정/만기종목[국내주식-184] +############################################################################################## + +def expiration_stocks( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_input_date_1: str, # 입력날짜1 + fid_input_date_2: str, # 입력날짜2 + fid_div_cls_code: str, # 분류구분코드 + fid_etc_cls_code: str, # 기타구분코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd_2: str, # 발행회사코드 + fid_blng_cls_code: str, # 결제방법 + fid_input_option_1: str, # 입력옵션1 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 만기예정_만기종목[국내주식-184] + ELW 만기예정_만기종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): W 입력 + fid_cond_scr_div_code (str): 11547 입력 + fid_input_date_1 (str): 입력날짜 ~ (ex) 20240402) + fid_input_date_2 (str): ~입력날짜 (ex) 20240408) + fid_div_cls_code (str): 0(콜),1(풋),2(전체) + fid_etc_cls_code (str): 공백 입력 + fid_unas_input_iscd (str): 000000(전체), 2001(KOSPI 200), 기초자산코드(종목코드 ex. 삼성전자-005930) + fid_input_iscd_2 (str): 00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권) + fid_blng_cls_code (str): 0(전체),1(일반),2(조기종료) + fid_input_option_1 (str): 공백 입력 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 만기예정_만기종목 데이터 + + Example: + >>> df = expiration_stocks( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11547', + ... fid_input_date_1='20240402', + ... fid_input_date_2='20240408', + ... fid_div_cls_code='0', + ... fid_etc_cls_code='', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd_2='00000', + ... fid_blng_cls_code='0', + ... fid_input_option_1='', + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11547')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11547')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240402')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240402')") + + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20240408')") + raise ValueError("fid_input_date_2 is required. (e.g. '20240408')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '00000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '00000')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHKEW154700C0" + + + + api_url = "/uapi/elw/v1/quotations/expiration-stocks" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_ETC_CLS_CODE": fid_etc_cls_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_OPTION_1": fid_input_option_1, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return expiration_stocks( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_input_date_1, + fid_input_date_2, + fid_div_cls_code, + fid_etc_cls_code, + fid_unas_input_iscd, + fid_input_iscd_2, + fid_blng_cls_code, + fid_input_option_1, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 지표순위[국내주식-169] +############################################################################################## + +def indicator( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 지표순위[국내주식-169] + ELW 지표순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_unas_input_iscd (str): 기초자산입력종목코드 (필수) + fid_input_iscd (str): 발행사 (필수) + fid_div_cls_code (str): 콜풋구분코드 (필수) + fid_input_price_1 (str): 가격(이상) (필수) + fid_input_price_2 (str): 가격(이하) (필수) + fid_input_vol_1 (str): 거래량(이상) (필수) + fid_input_vol_2 (str): 거래량(이하) (필수) + fid_rank_sort_cls_code (str): 순위정렬구분코드 (필수) + fid_blng_cls_code (str): 결재방법 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + depth (int): 현재 재귀 깊이 (옵션) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 지표순위 데이터 + + Example: + >>> df = indicator( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20279', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_div_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='1000', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20279')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20279')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02790000" + + + + api_url = "/uapi/elw/v1/ranking/indicator" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(체결)[국내주식-172] +############################################################################################## + +def indicator_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(체결)[국내주식-172] + ELW 투자지표추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(체결) 데이터 + + Example: + >>> df = indicator_trend_ccnl("W", "58J297") + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02740100" + + + + api_url = "/uapi/elw/v1/quotations/indicator-trend-ccnl" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(일별)[국내주식-173] +############################################################################################## + +def indicator_trend_daily( + fid_cond_mrkt_div_code: str, # 시장 분류 코드 (예: 'W') + fid_input_iscd: str, # 종목코드 (6자리) + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(일별)[국내주식-173] + ELW 투자지표추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장 분류 코드 (예: 'W') + fid_input_iscd (str): 종목코드 (6자리, 예: '57K281') + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(일별) 데이터 + + Example: + >>> df = indicator_trend_daily('W', '57K281') + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '57K281')") + raise ValueError("fid_input_iscd is required. (e.g. '57K281')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02740200" + + + + api_url = "/uapi/elw/v1/quotations/indicator-trend-daily" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 투자지표추이(분별)[국내주식-174] +############################################################################################## + +def indicator_trend_minute( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_hour_cls_code: str, # 시간구분코드 + fid_pw_data_incu_yn: str, # 과거데이터 포함 여부 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 투자지표추이(분별)[국내주식-174] + ELW 투자지표추이(분별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_input_iscd (str): 입력종목코드 예시: 58J297(KBJ297삼성전자콜) + fid_hour_cls_code (str): 시간구분코드 예시: '60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분), 7200(60분)' + fid_pw_data_incu_yn (str): 과거데이터 포함 여부 예시: N(과거데이터포함X), Y(과거데이터포함O) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 투자지표추이(분별) 데이터 + + Example: + >>> df = indicator_trend_minute( + ... fid_cond_mrkt_div_code='W', + ... fid_input_iscd='58J297', + ... fid_hour_cls_code='60', + ... fid_pw_data_incu_yn='N' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '60')") + raise ValueError("fid_hour_cls_code is required. (e.g. '60')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'N')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + # 요청 파라미터 설정 + + tr_id = "FHPEW02740300" + + api_url = "/uapi/elw/v1/quotations/indicator-trend-minute" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 호출 성공 여부 확인 + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return indicator_trend_minute( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 호출 실패 시 에러 로그 출력 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW LP매매추이[국내주식-182] +############################################################################################## + +def lp_trade_trend( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[Optional[pd.DataFrame], Optional[pd.DataFrame]]: + """ + [국내주식] ELW시세 + ELW LP매매추이[국내주식-182] + ELW LP매매추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분(W) + fid_input_iscd (str): 입력종목코드(ex 52K577(미래 K577KOSDAQ150콜) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: ELW LP매매추이 데이터 + + Example: + >>> df1, df2 = lp_trade_trend("W", "52K577") + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '52K577')") + raise ValueError("fid_input_iscd is required. (e.g. '52K577')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + + + tr_id = "FHPEW03760000" + + + + api_url = "/uapi/elw/v1/quotations/lp-trade-trend" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + current_data1 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) if dataframe1 is not None else current_data1 + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + else: + dataframe1 = dataframe1 if dataframe1 is not None else pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + current_data2 = pd.DataFrame(output_data if isinstance(output_data, list) else [output_data]) + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) if dataframe2 is not None else current_data2 + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + dataframe2 = dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return lp_trade_trend( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 신규상장종목[국내주식-181] +############################################################################################## + +def newly_listed( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_div_cls_code: str, # 분류구분코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd_2: str, # 입력종목코드2 + fid_input_date_1: str, # 입력날짜1 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 신규상장종목[국내주식-181] + ELW 신규상장종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_cond_scr_div_code (str): Unique key(11548) + fid_div_cls_code (str): 전체(02), 콜(00), 풋(01) + fid_unas_input_iscd (str): 'ex) 000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ' + fid_input_iscd_2 (str): '00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권)' + fid_input_date_1 (str): 날짜 (ex) 20240402) + fid_blng_cls_code (str): 0(전체), 1(일반), 2(조기종료) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 신규상장종목 데이터 + + Example: + >>> df = newly_listed( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11548', + ... fid_div_cls_code='02', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd_2='00003', + ... fid_input_date_1='20240402', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11548')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11548')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '02')") + raise ValueError("fid_div_cls_code is required. (e.g. '02')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '00003')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '00003')") + + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20240402')") + raise ValueError("fid_input_date_1 is required. (e.g. '20240402')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHKEW154800C0" + + + + api_url = "/uapi/elw/v1/quotations/newly-listed" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return newly_listed( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_div_cls_code, + fid_unas_input_iscd, + fid_input_iscd_2, + fid_input_date_1, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 당일급변종목[국내주식-171] +############################################################################################## + +def quick_change( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_hour_cls_code: str, # 시간구분코드 + fid_input_hour_1: str, # 입력 일 또는 분 + fid_input_hour_2: str, # 기준시간(분 선택 시) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 당일급변종목[국내주식-171] + ELW 당일급변종목 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_cond_scr_div_code (str): 조건화면분류코드 (필수) + fid_unas_input_iscd (str): 기초자산입력종목코드 (필수) + fid_input_iscd (str): 발행사 (필수) + fid_mrkt_cls_code (str): 시장구분코드 (필수) + fid_input_price_1 (str): 가격(이상) (필수) + fid_input_price_2 (str): 가격(이하) (필수) + fid_input_vol_1 (str): 거래량(이상) (필수) + fid_input_vol_2 (str): 거래량(이하) (필수) + fid_hour_cls_code (str): 시간구분코드 (필수) + fid_input_hour_1 (str): 입력 일 또는 분 (필수) + fid_input_hour_2 (str): 기준시간(분 선택 시) (필수) + fid_rank_sort_cls_code (str): 순위정렬구분코드 (필수) + fid_blng_cls_code (str): 결재방법 (필수) + tr_cont (str): 연속 거래 여부 (옵션) + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (옵션) + depth (int): 현재 재귀 깊이 (옵션) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 당일급변종목 데이터 + + Example: + >>> df = quick_change( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20287', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_mrkt_cls_code='A', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='10000', + ... fid_input_vol_2='50000', + ... fid_hour_cls_code='1', + ... fid_input_hour_1='10', + ... fid_input_hour_2='30', + ... fid_rank_sort_cls_code='1', + ... fid_blng_cls_code='0' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20287')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20287')") + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '1')") + raise ValueError("fid_hour_cls_code is required. (e.g. '1')") + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '1')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '1')") + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02870000" + + + + api_url = "/uapi/elw/v1/ranking/quick-change" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_INPUT_HOUR_2": fid_input_hour_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return quick_change( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_mrkt_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_hour_cls_code, + fid_input_hour_1, + fid_input_hour_2, + fid_rank_sort_cls_code, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 순위[국내주식-170] +############################################################################################## + +def sensitivity( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 입력종목코드 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_input_rmnn_dynu_1: str, # 잔존일수(이상) + fid_input_date_1: str, # 조회기준일 + fid_blng_cls_code: str, # 결재방법 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 순위[국내주식-170] + ELW 민감도 순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 + fid_cond_scr_div_code (str): 조건화면분류코드 + fid_unas_input_iscd (str): 기초자산입력종목코드 + fid_input_iscd (str): 입력종목코드 + fid_div_cls_code (str): 콜풋구분코드 + fid_input_price_1 (str): 가격(이상) + fid_input_price_2 (str): 가격(이하) + fid_input_vol_1 (str): 거래량(이상) + fid_input_vol_2 (str): 거래량(이하) + fid_rank_sort_cls_code (str): 순위정렬구분코드 + fid_input_rmnn_dynu_1 (str): 잔존일수(이상) + fid_input_date_1 (str): 조회기준일 + fid_blng_cls_code (str): 결재방법 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 순위 데이터 + + Example: + >>> df = sensitivity( + fid_cond_mrkt_div_code='W', + fid_cond_scr_div_code='20285', + fid_unas_input_iscd='000000', + fid_input_iscd='00000', + fid_div_cls_code='0', + fid_input_price_1='0', + fid_input_price_2='100000', + fid_input_vol_1='0', + fid_input_vol_2='1000000', + fid_rank_sort_cls_code='0', + fid_input_rmnn_dynu_1='0', + fid_input_date_1='20230101', + fid_blng_cls_code='0' + ) + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20285')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20285')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02850000" + + + + api_url = "/uapi/elw/v1/ranking/sensitivity" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_rank_sort_cls_code, + fid_input_rmnn_dynu_1, + fid_input_date_1, + fid_blng_cls_code, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(체결)[국내주식-175] +############################################################################################## + +def sensitivity_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 추이(체결)[국내주식-175] + ELW 민감도 추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 추이(체결) 데이터 + + Example: + >>> df = sensitivity_trend_ccnl('W', '58J297') + >>> print(df) + """ + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02830100" + + + + api_url = "/uapi/elw/v1/quotations/sensitivity-trend-ccnl" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 민감도 추이(일별)[국내주식-176] +############################################################################################## + +def sensitivity_trend_daily( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 민감도 추이(일별)[국내주식-176] + ELW 민감도 추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 민감도 추이(일별) 데이터 + + Example: + >>> df = sensitivity_trend_daily("W", "58J438") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J438')") + raise ValueError("fid_input_iscd is required. (e.g. '58J438')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + # 요청 파라미터 설정 + + tr_id = "FHPEW02830200" + + api_url = "/uapi/elw/v1/quotations/sensitivity-trend-daily" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return sensitivity_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산 목록조회[국내주식-185] +############################################################################################## + +def udrl_asset_list( + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 기초자산 목록조회[국내주식-185] + ELW 기초자산 목록조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_scr_div_code (str): 조건화면분류코드, 예: '11541' + fid_rank_sort_cls_code (str): 순위정렬구분코드, 예: '0', '1', '2', '3', '4', '5', '6' + fid_input_iscd (str): 입력종목코드, 예: '00000', '00003', '00017', '00005' + tr_cont (str): 연속 거래 여부, 기본값은 공백 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 기초자산 목록조회 데이터 + + Example: + >>> df = udrl_asset_list('11541', '0', '00000') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11541')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11541')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHKEW154100C0" + + + + api_url = "/uapi/elw/v1/quotations/udrl-asset-list" + + + + + params = { + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return udrl_asset_list( + fid_cond_scr_div_code, + fid_rank_sort_cls_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 기초자산별 종목시세[국내주식-186] +############################################################################################## + +def udrl_asset_price( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_mrkt_cls_code: str, # 시장구분코드 + fid_input_iscd: str, # 입력종목코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_vol_cnt: str, # 거래량수 + fid_trgt_exls_cls_code: str, # 대상제외구분코드 + fid_input_price_1: str, # 입력가격1 + fid_input_price_2: str, # 입력가격2 + fid_input_vol_1: str, # 입력거래량1 + fid_input_vol_2: str, # 입력거래량2 + fid_input_rmnn_dynu_1: str, # 입력잔존일수1 + fid_input_rmnn_dynu_2: str, # 입력잔존일수2 + fid_option: str, # 옵션 + fid_input_option_1: str, # 입력옵션1 + fid_input_option_2: str, # 입력옵션2 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 기초자산별 종목시세[국내주식-186] + ELW 기초자산별 종목시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분(W) + fid_cond_scr_div_code (str): Uniquekey(11541) + fid_mrkt_cls_code (str): 전체(A),콜(C),풋(P) + fid_input_iscd (str): '00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)' + fid_unas_input_iscd (str): 기초자산입력종목코드 + fid_vol_cnt (str): 전일거래량(정수량미만) + fid_trgt_exls_cls_code (str): 거래불가종목제외(0:미체크,1:체크) + fid_input_price_1 (str): 가격~원이상 + fid_input_price_2 (str): 가격~월이하 + fid_input_vol_1 (str): 거래량~계약이상 + fid_input_vol_2 (str): 거래량~계약이하 + fid_input_rmnn_dynu_1 (str): 잔존일(~일이상) + fid_input_rmnn_dynu_2 (str): 잔존일(~일이하) + fid_option (str): 옵션상태(0:없음,1:ATM,2:ITM,3:OTM) + fid_input_option_1 (str): 입력옵션1 + fid_input_option_2 (str): 입력옵션2 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 기초자산별 종목시세 데이터 + + Example: + >>> df = udrl_asset_price( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='11541', + ... fid_mrkt_cls_code='A', + ... fid_input_iscd='00000', + ... fid_unas_input_iscd='005930', + ... fid_vol_cnt='1000', + ... fid_trgt_exls_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='500', + ... fid_input_rmnn_dynu_1='10', + ... fid_input_rmnn_dynu_2='20', + ... fid_option='0', + ... fid_input_option_1='', + ... fid_input_option_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '11541')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '11541')") + + if not fid_mrkt_cls_code: + logger.error("fid_mrkt_cls_code is required. (e.g. 'A')") + raise ValueError("fid_mrkt_cls_code is required. (e.g. 'A')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '00001')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '00001')") + + if not fid_trgt_exls_cls_code: + logger.error("fid_trgt_exls_cls_code is required. (e.g. '0')") + raise ValueError("fid_trgt_exls_cls_code is required. (e.g. '0')") + + if not fid_option: + logger.error("fid_option is required. (e.g. '0')") + raise ValueError("fid_option is required. (e.g. '0')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHKEW154101C0" + + + + api_url = "/uapi/elw/v1/quotations/udrl-asset-price" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_MRKT_CLS_CODE": fid_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_VOL_CNT": fid_vol_cnt, + "FID_TRGT_EXLS_CLS_CODE": fid_trgt_exls_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_INPUT_RMNN_DYNU_2": fid_input_rmnn_dynu_2, + "FID_OPTION": fid_option, + "FID_INPUT_OPTION_1": fid_input_option_1, + "FID_INPUT_OPTION_2": fid_input_option_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return udrl_asset_price( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_mrkt_cls_code, + fid_input_iscd, + fid_unas_input_iscd, + fid_vol_cnt, + fid_trgt_exls_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_rmnn_dynu_1, + fid_input_rmnn_dynu_2, + fid_option, + fid_input_option_1, + fid_input_option_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 상승률순위[국내주식-167] +############################################################################################## + +def updown_rate( + fid_cond_mrkt_div_code: str, # 사용자권한정보 + fid_cond_scr_div_code: str, # 거래소코드 + fid_unas_input_iscd: str, # 상승율/하락율 구분 + fid_input_iscd: str, # N일자값 + fid_input_rmnn_dynu_1: str, # 거래량조건 + fid_div_cls_code: str, # NEXT KEY BUFF + fid_input_price_1: str, # 사용자권한정보 + fid_input_price_2: str, # 거래소코드 + fid_input_vol_1: str, # 상승율/하락율 구분 + fid_input_vol_2: str, # N일자값 + fid_input_date_1: str, # 거래량조건 + fid_rank_sort_cls_code: str, # NEXT KEY BUFF + fid_blng_cls_code: str, # 사용자권한정보 + fid_input_date_2: str, # 거래소코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 상승률순위[국내주식-167] + ELW 상승률순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 시장구분코드 (W) + fid_cond_scr_div_code (str): Unique key(20277) + fid_unas_input_iscd (str): '000000(전체), 2001(코스피200) , 3003(코스닥150), 005930(삼성전자) ' + fid_input_iscd (str): '00000(전체), 00003(한국투자증권) , 00017(KB증권), 00005(미래에셋주식회사)' + fid_input_rmnn_dynu_1 (str): '0(전체), 1(1개월이하), 2(1개월~2개월), 3(2개월~3개월), 4(3개월~6개월), 5(6개월~9개월),6(9개월~12개월), 7(12개월이상)' + fid_div_cls_code (str): 0(전체), 1(콜), 2(풋) + fid_input_price_1 (str): + fid_input_price_2 (str): + fid_input_vol_1 (str): + fid_input_vol_2 (str): + fid_input_date_1 (str): + fid_rank_sort_cls_code (str): '0(상승율), 1(하락율), 2(시가대비상승율) , 3(시가대비하락율), 4(변동율)' + fid_blng_cls_code (str): 0(전체) + fid_input_date_2 (str): + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 상승률순위 데이터 + + Example: + >>> df = updown_rate( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20277', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_input_rmnn_dynu_1='0', + ... fid_div_cls_code='0', + ... fid_input_price_1='', + ... fid_input_price_2='', + ... fid_input_vol_1='', + ... fid_input_vol_2='', + ... fid_input_date_1='1', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0', + ... fid_input_date_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20277')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20277')") + + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + + if not fid_input_rmnn_dynu_1: + logger.error("fid_input_rmnn_dynu_1 is required. (e.g. '0')") + raise ValueError("fid_input_rmnn_dynu_1 is required. (e.g. '0')") + + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02770000" + + + + api_url = "/uapi/elw/v1/ranking/updown-rate" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return updown_rate( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_input_rmnn_dynu_1, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_date_1, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(체결)[국내주식-177] +############################################################################################## + +def volatility_trend_ccnl( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성추이(체결)[국내주식-177] + ELW 변동성추이(체결) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (필수) + fid_input_iscd (str): 입력종목코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성추이(체결) 데이터 + + Example: + >>> df = volatility_trend_ccnl("W", "58J297") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + # 요청 파라미터 설정 + + tr_id = "FHPEW02840100" + + api_url = "/uapi/elw/v1/quotations/volatility-trend-ccnl" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_ccnl( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(일별)[국내주식-178] +############################################################################################## + +def volatility_trend_daily( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(일별)[국내주식-178] + ELW 변동성 추이(일별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 (기본값: None) + depth (int): 현재 재귀 깊이 (기본값: 0) + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(일별) 데이터 + + Example: + >>> df = volatility_trend_daily('W', '58J297') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02840200" + + + + api_url = "/uapi/elw/v1/quotations/volatility-trend-daily" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_daily( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(분별)[국내주식-179] +############################################################################################## + +def volatility_trend_minute( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_hour_cls_code: str, # 시간구분코드 + fid_pw_data_incu_yn: str, # 과거데이터 포함 여부 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(분별)[국내주식-179] + ELW 변동성 추이(분별) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + fid_hour_cls_code (str): 시간구분코드 (예: '60', '180', '300', '600', '1800', '3600') + fid_pw_data_incu_yn (str): 과거데이터 포함 여부 ('N' 또는 'Y') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(분별) 데이터 + + Example: + >>> df = volatility_trend_minute( + ... fid_cond_mrkt_div_code='W', + ... fid_input_iscd='58J297', + ... fid_hour_cls_code='60', + ... fid_pw_data_incu_yn='N' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '60')") + raise ValueError("fid_hour_cls_code is required. (e.g. '60')") + + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'N')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + # 요청 파라미터 설정 + + tr_id = "FHPEW02840300" + + api_url = "/uapi/elw/v1/quotations/volatility-trend-minute" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_minute( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 변동성추이(틱)[국내주식-180] +############################################################################################## + +def volatility_trend_tick( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 변동성 추이(틱)[국내주식-180] + ELW 변동성 추이(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_input_iscd (str): 입력종목코드 (예: '58J297') + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 변동성 추이(틱) 데이터 + + Example: + >>> df = volatility_trend_tick('W', '58J297') + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '58J297')") + raise ValueError("fid_input_iscd is required. (e.g. '58J297')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # API 호출 URL 및 거래 ID 설정 + + # 요청 파라미터 설정 + + tr_id = "FHPEW02840400" + + api_url = "/uapi/elw/v1/quotations/volatility-trend-tick" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + # API 응답 처리 + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volatility_trend_tick( + fid_cond_mrkt_div_code, + fid_input_iscd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] ELW시세 - ELW 거래량순위[국내주식-168] +############################################################################################## + +def volume_rank( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_cond_scr_div_code: str, # 조건화면분류코드 + fid_unas_input_iscd: str, # 기초자산입력종목코드 + fid_input_iscd: str, # 발행사 + fid_input_rmnn_dynu_1: str, # 입력잔존일수 + fid_div_cls_code: str, # 콜풋구분코드 + fid_input_price_1: str, # 가격(이상) + fid_input_price_2: str, # 가격(이하) + fid_input_vol_1: str, # 거래량(이상) + fid_input_vol_2: str, # 거래량(이하) + fid_input_date_1: str, # 조회기준일 + fid_rank_sort_cls_code: str, # 순위정렬구분코드 + fid_blng_cls_code: str, # 소속구분코드 + fid_input_iscd_2: str, # LP발행사 + fid_input_date_2: str, # 만기일-최종거래일조회 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [국내주식] ELW시세 + ELW 거래량순위[국내주식-168] + ELW 거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): 조건시장분류코드 (예: 'W') + fid_cond_scr_div_code (str): 조건화면분류코드 (예: '20278') + fid_unas_input_iscd (str): 기초자산입력종목코드 (예: '000000') + fid_input_iscd (str): 발행사 (예: '00000') + fid_input_rmnn_dynu_1 (str): 입력잔존일수 + fid_div_cls_code (str): 콜풋구분코드 (예: '0') + fid_input_price_1 (str): 가격(이상) + fid_input_price_2 (str): 가격(이하) + fid_input_vol_1 (str): 거래량(이상) + fid_input_vol_2 (str): 거래량(이하) + fid_input_date_1 (str): 조회기준일 + fid_rank_sort_cls_code (str): 순위정렬구분코드 (예: '0') + fid_blng_cls_code (str): 소속구분코드 (예: '0') + fid_input_iscd_2 (str): LP발행사 (예: '0000') + fid_input_date_2 (str): 만기일-최종거래일조회 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: ELW 거래량순위 데이터 + + Example: + >>> df = volume_rank( + ... fid_cond_mrkt_div_code='W', + ... fid_cond_scr_div_code='20278', + ... fid_unas_input_iscd='000000', + ... fid_input_iscd='00000', + ... fid_input_rmnn_dynu_1='', + ... fid_div_cls_code='0', + ... fid_input_price_1='1000', + ... fid_input_price_2='5000', + ... fid_input_vol_1='100', + ... fid_input_vol_2='1000', + ... fid_input_date_1='20230101', + ... fid_rank_sort_cls_code='0', + ... fid_blng_cls_code='0', + ... fid_input_iscd_2='0000', + ... fid_input_date_2='' + ... ) + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'W')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'W')") + if not fid_cond_scr_div_code: + logger.error("fid_cond_scr_div_code is required. (e.g. '20278')") + raise ValueError("fid_cond_scr_div_code is required. (e.g. '20278')") + if not fid_unas_input_iscd: + logger.error("fid_unas_input_iscd is required. (e.g. '000000')") + raise ValueError("fid_unas_input_iscd is required. (e.g. '000000')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '00000')") + raise ValueError("fid_input_iscd is required. (e.g. '00000')") + if not fid_div_cls_code: + logger.error("fid_div_cls_code is required. (e.g. '0')") + raise ValueError("fid_div_cls_code is required. (e.g. '0')") + if not fid_rank_sort_cls_code: + logger.error("fid_rank_sort_cls_code is required. (e.g. '0')") + raise ValueError("fid_rank_sort_cls_code is required. (e.g. '0')") + if not fid_blng_cls_code: + logger.error("fid_blng_cls_code is required. (e.g. '0')") + raise ValueError("fid_blng_cls_code is required. (e.g. '0')") + if not fid_input_iscd_2: + logger.error("fid_input_iscd_2 is required. (e.g. '0000')") + raise ValueError("fid_input_iscd_2 is required. (e.g. '0000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + + + tr_id = "FHPEW02780000" + + + + api_url = "/uapi/elw/v1/ranking/volume-rank" + + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_UNAS_INPUT_ISCD": fid_unas_input_iscd, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_RMNN_DYNU_1": fid_input_rmnn_dynu_1, + "FID_DIV_CLS_CODE": fid_div_cls_code, + "FID_INPUT_PRICE_1": fid_input_price_1, + "FID_INPUT_PRICE_2": fid_input_price_2, + "FID_INPUT_VOL_1": fid_input_vol_1, + "FID_INPUT_VOL_2": fid_input_vol_2, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_BLNG_CLS_CODE": fid_blng_cls_code, + "FID_INPUT_ISCD_2": fid_input_iscd_2, + "FID_INPUT_DATE_2": fid_input_date_2, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # 응답 데이터 처리 + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return volume_rank( + fid_cond_mrkt_div_code, + fid_cond_scr_div_code, + fid_unas_input_iscd, + fid_input_iscd, + fid_input_rmnn_dynu_1, + fid_div_cls_code, + fid_input_price_1, + fid_input_price_2, + fid_input_vol_1, + fid_input_vol_2, + fid_input_date_1, + fid_rank_sort_cls_code, + fid_blng_cls_code, + fid_input_iscd_2, + fid_input_date_2, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + # API 에러 처리 + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/elw/elw_functions_ws.py b/한국투자증권(API)/examples_user/elw/elw_functions_ws.py new file mode 100644 index 0000000..aa0b026 --- /dev/null +++ b/한국투자증권(API)/examples_user/elw/elw_functions_ws.py @@ -0,0 +1,307 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간호가[실시간-062] +############################################################################################## + +def elw_asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간호가[H0EWASP0] + ELW 실시간 호가 정보를 실시간으로 구독하는 웹소켓 API입니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 실시간 데이터 구독에 대한 응답 메시지. + columns (list[str]): 실시간 데이터의 컬럼 정보. + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = elw_asking_price("1", "005930") + >>> print(msg, columns) + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0EWASP0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "bsop_hour", + "hour_cls_code", + "askp1", + "askp2", + "askp3", + "askp4", + "askp5", + "askp6", + "askp7", + "askp8", + "askp9", + "askp10", + "bidp1", + "bidp2", + "bidp3", + "bidp4", + "bidp5", + "bidp6", + "bidp7", + "bidp8", + "bidp9", + "bidp10", + "askp_rsqn1", + "askp_rsqn2", + "askp_rsqn3", + "askp_rsqn4", + "askp_rsqn5", + "askp_rsqn6", + "askp_rsqn7", + "askp_rsqn8", + "askp_rsqn9", + "askp_rsqn10", + "bidp_rsqn1", + "bidp_rsqn2", + "bidp_rsqn3", + "bidp_rsqn4", + "bidp_rsqn5", + "bidp_rsqn6", + "bidp_rsqn7", + "bidp_rsqn8", + "bidp_rsqn9", + "bidp_rsqn10", + "total_askp_rsqn", + "total_bidp_rsqn", + "antc_cnpr", + "antc_cnqn", + "antc_cntg_vrss_sign", + "antc_cntg_vrss", + "antc_cntg_prdy_ctrt", + "lp_askp_rsqn1", + "lp_askp_rsqn2", + "lp_askp_rsqn3", + "lp_bidp_rsqn4", + "lp_askp_rsqn4", + "lp_bidp_rsqn5", + "lp_askp_rsqn5", + "lp_bidp_rsqn6", + "lp_askp_rsqn6", + "lp_bidp_rsqn7", + "lp_askp_rsqn7", + "lp_askp_rsqn8", + "lp_bidp_rsqn8", + "lp_askp_rsqn9", + "lp_bidp_rsqn9", + "lp_askp_rsqn10", + "lp_bidp_rsqn10", + "lp_bidp_rsqn1", + "lp_total_askp_rsqn", + "lp_bidp_rsqn2", + "lp_total_bidp_rsqn", + "lp_bidp_rsqn3", + "antc_vol", + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간체결가[실시간-061] +############################################################################################## + +def elw_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간체결가[H0EWCNT0] 구독 함수 + ELW 실시간체결가 API를 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드를 입력합니다. 빈 문자열이 아니어야 합니다. + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 실시간 데이터의 컬럼 정보 + + Example: + >>> msg, columns = elw_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key는 필수 입력값입니다.") + + tr_id = "H0EWCNT0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터 컬럼 정보 + columns = [ + "mksc_shrn_iscd", "stck_cntg_hour", "stck_prpr", "prdy_vrss_sign", + "prdy_vrss", "prdy_ctrt", "wghn_avrg_stck_prc", "stck_oprc", + "stck_hgpr", "stck_lwpr", "askp1", "bidp1", "cntg_vol", "acml_vol", + "acml_tr_pbmn", "seln_cntg_csnu", "shnu_cntg_csnu", "ntby_cntg_csnu", + "cttr", "seln_cntg_smtn", "shnu_cntg_smtn", "cntg_cls_code", + "shnu_rate", "prdy_vol_vrss_acml_vol_rate", "oprc_hour", + "oprc_vrss_prpr_sign", "oprc_vrss_prpr", "hgpr_hour", + "hgpr_vrss_prpr_sign", "hgpr_vrss_prpr", "lwpr_hour", + "lwpr_vrss_prpr_sign", "lwpr_vrss_prpr", "bsop_date", + "new_mkop_cls_code", "trht_yn", "askp_rsqn1", "bidp_rsqn1", + "total_askp_rsqn", "total_bidp_rsqn", "tmvl_val", "prit", "prmm_val", + "gear", "prls_qryr_rate", "invl_val", "prmm_rate", "cfp", "lvrg_val", + "delta", "gama", "vega", "theta", "rho", "hts_ints_vltl", "hts_thpr", + "vol_tnrt", "prdy_smns_hour_acml_vol", "prdy_smns_hour_acml_vol_rate", + "apprch_rate", "lp_hvol", "lp_hldn_rate", "lp_ntby_qty" + ] + + return msg, columns + +############################################################################################## +# [국내주식] 실시간시세 - ELW 실시간예상체결[실시간-063] +############################################################################################## + +def elw_exp_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ELW 실시간예상체결[H0EWANC0] + ELW 실시간예상체결 API입니다. 이 함수는 웹소켓을 통해 실시간 데이터를 구독합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타냅니다. + tr_key (str): [필수] 종목코드. 빈 문자열일 수 없습니다. + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 응답 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생합니다. + + Example: + >>> msg, columns = elw_exp_ccnl("1", "005930") + >>> print(msg, columns) + + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0EWANC0" + + params = { + "tr_key": tr_key, + } + + # 데이터 구독 요청 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 데이터의 컬럼 정보 + columns = [ + "mksc_shrn_iscd", + "stck_cntg_hour", + "stck_prpr", + "prdy_vrss_sign", + "prdy_vrss", + "prdy_ctrt", + "wghn_avrg_stck_prc", + "stck_oprc", + "stck_hgpr", + "stck_lwpr", + "askp1", + "bidp1", + "cntg_vol", + "acml_vol", + "acml_tr_pbmn", + "seln_cntg_csnu", + "shnu_cntg_csnu", + "ntby_cntg_csnu", + "cttr", + "seln_cntg_smtn", + "shnu_cntg_smtn", + "cntg_cls_code", + "shnu_rate", + "prdy_vol_vrss_acml_vol_rate", + "oprc_hour", + "oprc_vrss_prpr_sign", + "oprc_vrss_prpr", + "hgpr_hour", + "hgpr_vrss_prpr_sign", + "hgpr_vrss_prpr", + "lwpr_hour", + "lwpr_vrss_prpr_sign", + "lwpr_vrss_prpr", + "bsop_date", + "new_mkop_cls_code", + "trht_yn", + "askp_rsqn1", + "bidp_rsqn1", + "total_askp_rsqn", + "total_bidp_rsqn", + "tmvl_val", + "prit", + "prmm_val", + "gear", + "prls_qryr_rate", + "invl_val", + "prmm_rate", + "cfp", + "lvrg_val", + "delta", + "gama", + "vega", + "theta", + "rho", + "hts_ints_vltl", + "hts_thpr", + "vol_tnrt", + "lp_hvol", + "lp_hldn_rate", + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/etfetn/etfetn_examples.py b/한국투자증권(API)/examples_user/etfetn/etfetn_examples.py new file mode 100644 index 0000000..0d1db39 --- /dev/null +++ b/한국투자증권(API)/examples_user/etfetn/etfetn_examples.py @@ -0,0 +1,54 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from etfetn_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [국내주식] 기본시세 > ETF 구성종목시세[국내주식-073] +############################################################################################## + +result1, result2 = inquire_component_stock_price(fid_cond_mrkt_div_code="J", fid_input_iscd="069500", fid_cond_scr_div_code="11216") +print(result1) +print(result2) + +############################################################################################## +# [국내주식] 기본시세 > ETF/ETN 현재가[v1_국내주식-068] +############################################################################################## + +result = inquire_price(fid_cond_mrkt_div_code="J", fid_input_iscd="005930") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(일)[v1_국내주식-071] +############################################################################################## + +result = nav_comparison_daily_trend(fid_cond_mrkt_div_code="J", fid_input_iscd="069500", fid_input_date_1="20240101", fid_input_date_2="20240220") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(분)[v1_국내주식-070] +############################################################################################## + +result = nav_comparison_time_trend(fid_cond_mrkt_div_code="E", fid_input_iscd="069500", fid_hour_cls_code="60") +print(result) + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(종목)[v1_국내주식-069] +############################################################################################## + +result1, result2 = nav_comparison_trend(fid_cond_mrkt_div_code="J", fid_input_iscd="069500") +print(result1) +print(result2) + diff --git a/한국투자증권(API)/examples_user/etfetn/etfetn_examples_ws.py b/한국투자증권(API)/examples_user/etfetn/etfetn_examples_ws.py new file mode 100644 index 0000000..38c964d --- /dev/null +++ b/한국투자증권(API)/examples_user/etfetn/etfetn_examples_ws.py @@ -0,0 +1,34 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from etfetn_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [국내주식] 실시간시세 > 국내ETF NAV추이[실시간-051] +############################################################################################## + +kws.subscribe(request=etf_nav_trend, data=["069500"]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/etfetn/etfetn_functions.py b/한국투자증권(API)/examples_user/etfetn/etfetn_functions.py new file mode 100644 index 0000000..301d45a --- /dev/null +++ b/한국투자증권(API)/examples_user/etfetn/etfetn_functions.py @@ -0,0 +1,317 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 기본시세 > ETF 구성종목시세[국내주식-073] +############################################################################################## + +def inquire_component_stock_price( + fid_cond_mrkt_div_code: str, + fid_input_iscd: str, + fid_cond_scr_div_code: str +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + ETF 구성종목시세 API입니다. + 한국투자 HTS(eFriend Plus) > [0245] ETF/ETN 구성종목시세 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J: 주식/ETF/ETN) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11216) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터프레임, output2 데이터프레임) + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Examples: + >>> df1, df2 = inquire_component_stock_price("J", "069500", "11216") + >>> print(df1) # ETF 기본 정보 + >>> print(df2) # ETF 구성종목 상세정보 + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J: 주식/ETF/ETN')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11216')") + + # API 호출 설정 + tr_id = "FHKST121600C0" + + # 파라미터 설정 + + api_url = "/uapi/etfetn/v1/quotations/inquire-component-stock-price" + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output1 (object) -> DataFrame 변환 + output1_data = res.getBody().output1 + df1 = pd.DataFrame([output1_data]) if output1_data else pd.DataFrame() + + # output2 (array) -> DataFrame 변환 + output2_data = res.getBody().output2 + df2 = pd.DataFrame(output2_data) if output2_data else pd.DataFrame() + + return df1, df2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [국내주식] 기본시세 > ETF/ETN 현재가[v1_국내주식-068] +############################################################################################## + +def inquire_price( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 +) -> pd.DataFrame: + """ + ETF/ETN 현재가 API입니다. + 한국투자 HTS(eFriend Plus) > [0240] ETF/ETN 현재가 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J:KRX, NX:NXT, UN:통합) + fid_input_iscd (str): [필수] 입력 종목코드 (ex. 123456) + + Returns: + pd.DataFrame: ETF/ETN 현재가 데이터 + + Example: + >>> df = inquire_price("J", "123456") + >>> print(df) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:KRX, NX:NXT, UN:통합')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + tr_id = "FHPST02400000" # ETF/ETN 현재가 + + + api_url = "/uapi/etfetn/v1/quotations/inquire-price" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(일)[v1_국내주식-071] +############################################################################################## + +def nav_comparison_daily_trend( + fid_cond_mrkt_div_code: str, # 조건시장분류코드 + fid_input_iscd: str, # 입력종목코드 + fid_input_date_1: str, # 조회시작일자 + fid_input_date_2: str # 조회종료일자 +) -> pd.DataFrame: + """ + NAV 비교추이(일) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면 "일별" 비교추이 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. J:주식) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_input_date_1 (str): [필수] 조회시작일자 (ex. 20240101) + fid_input_date_2 (str): [필수] 조회종료일자 (ex. 20240220) + + Returns: + pd.DataFrame: NAV 비교추이(일) 데이터 + + Example: + >>> df = nav_comparison_daily_trend("J", "069500", "20240101", "20240220") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J:주식')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_input_date_1 == "": + raise ValueError("fid_input_date_1 is required (e.g. '20240101')") + + if fid_input_date_2 == "": + raise ValueError("fid_input_date_2 is required (e.g. '20240220')") + + tr_id = "FHPST02440200" # NAV 비교추이(일) + + + api_url = "/uapi/etfetn/v1/quotations/nav-comparison-daily-trend" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건시장분류코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력종목코드 + "FID_INPUT_DATE_1": fid_input_date_1, # 조회시작일자 + "FID_INPUT_DATE_2": fid_input_date_2 # 조회종료일자 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(분)[v1_국내주식-070] +############################################################################################## + +def nav_comparison_time_trend( + fid_cond_mrkt_div_code: str, # [필수] 조건시장분류코드 (ex. E) + fid_input_iscd: str, # [필수] 입력종목코드 (ex. 123456) + fid_hour_cls_code: str # [필수] 시간구분코드 (ex. 60:1분,180:3분,...,7200:120분) +) -> pd.DataFrame: + """ + NAV 비교추이(분) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면 "분별" 비교추이 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + 실전계좌의 경우, 한 번의 호출에 최근 30건까지 확인 가능합니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건시장분류코드 (ex. E) + fid_input_iscd (str): [필수] 입력종목코드 (ex. 123456) + fid_hour_cls_code (str): [필수] 시간구분코드 (ex. 60:1분,180:3분,...,7200:120분) + + Returns: + pd.DataFrame: NAV 비교추이(분) 데이터 + + Example: + >>> df = nav_comparison_time_trend("E", "069500", "60") + >>> print(df) + """ + + # 필수 파라미터 검증 + if fid_cond_mrkt_div_code == "" or fid_cond_mrkt_div_code is None: + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'E')") + + if fid_input_iscd == "" or fid_input_iscd is None: + raise ValueError("fid_input_iscd is required (e.g. '123456')") + + if fid_hour_cls_code == "" or fid_hour_cls_code is None: + raise ValueError("fid_hour_cls_code is required (e.g. '60:1분,180:3분,...,7200:120분')") + + tr_id = "FHPST02440100" + + + api_url = "/uapi/etfetn/v1/quotations/nav-comparison-time-trend" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # output (array) -> pd.DataFrame + current_data = pd.DataFrame(res.getBody().output) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(종목)[v1_국내주식-069] +############################################################################################## + +def nav_comparison_trend( + fid_cond_mrkt_div_code: str, # [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd: str, # [필수] 입력 종목코드 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + NAV 비교추이(종목) API입니다. + 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + fid_cond_mrkt_div_code (str): [필수] 조건 시장 분류 코드 (ex. J) + fid_input_iscd (str): [필수] 입력 종목코드 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: output1, output2 데이터프레임 + + Example: + >>> output1, output2 = nav_comparison_trend("J", "069500") + >>> print(output1) + >>> print(output2) + """ + + if fid_cond_mrkt_div_code == "": + raise ValueError("fid_cond_mrkt_div_code is required (e.g. 'J')") + + if fid_input_iscd == "": + raise ValueError("fid_input_iscd is required") + + tr_id = "FHPST02440000" # NAV 비교추이(종목) + + + api_url = "/uapi/etfetn/v1/quotations/nav-comparison-trend" + + + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, # 조건 시장 분류 코드 + "FID_INPUT_ISCD": fid_input_iscd, # 입력 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + output1_data = pd.DataFrame(res.getBody().output1, index=[0]) + output2_data = pd.DataFrame(res.getBody().output2, index=[0]) + + logging.info("Data fetch complete.") + return output1_data, output2_data + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/etfetn/etfetn_functions_ws.py b/한국투자증권(API)/examples_user/etfetn/etfetn_functions_ws.py new file mode 100644 index 0000000..524c888 --- /dev/null +++ b/한국투자증권(API)/examples_user/etfetn/etfetn_functions_ws.py @@ -0,0 +1,72 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [국내주식] 실시간시세 > 국내ETF NAV추이[실시간-051] +############################################################################################## + +def etf_nav_trend( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 국내ETF NAV추이[H0STNAV0] 실시간 데이터 구독 함수 + + 이 함수는 한국투자증권의 웹소켓 API를 통해 실시간으로 국내 ETF의 NAV 추이를 구독합니다. + 구독을 시작하거나 해제할 수 있으며, 실시간 데이터를 수신합니다. + + Args: + tr_type (str): [필수] 구독 등록("1") 또는 해제("0") 여부를 나타내는 문자열 + tr_key (str): [필수] 종목코드 (빈 문자열 불가) + + Returns: + message (dict): 수신된 메시지 데이터 + columns (list[str]): 수신된 데이터의 컬럼 정보 + + Raises: + ValueError: tr_key가 빈 문자열인 경우 발생 + + Example: + >>> msg, columns = etf_nav_trend("1", "005930") + >>> print(msg, columns) + + """ + + # 필수 파라미터 검증 + if not tr_key: + raise ValueError("tr_key is required and cannot be an empty string") + + tr_id = "H0STNAV0" + + params = { + "tr_key": tr_key, + } + + # 데이터 수신 + msg = ka.data_fetch(tr_id, tr_type, params) + + # 응답 컬럼 정보 + columns = [ + "rt_cd", # 성공 실패 여부 + "msg_cd", # 응답코드 + "output1", # 응답상세 + "msg1", # 응답메세지 + "mksc_shrn_iscd", # 유가증권단축종목코드 + "nav", # NAV + "nav_prdy_vrss_sign", # NAV전일대비부호 + "nav_prdy_vrss", # NAV전일대비 + "nav_prdy_ctrt", # NAV전일대비율 + "oprc_nav", # NAV시가 + "hprc_nav", # NAV고가 + "lprc_nav", # NAV저가 + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/kis_auth.py b/한국투자증권(API)/examples_user/kis_auth.py new file mode 100644 index 0000000..cfd1a75 --- /dev/null +++ b/한국투자증권(API)/examples_user/kis_auth.py @@ -0,0 +1,799 @@ +# -*- coding: utf-8 -*- +# ====| (REST) 접근 토큰 / (Websocket) 웹소켓 접속키 발급 에 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +# ====| API 호출 공통 함수 포함 |===================== + +import asyncio +import copy +import json +import logging +import os +import time +from base64 import b64decode +from collections import namedtuple +from collections.abc import Callable +from datetime import datetime +from io import StringIO + +import pandas as pd + +# pip install requests (패키지설치) +import requests + +# 웹 소켓 모듈을 선언한다. +import websockets + +# pip install PyYAML (패키지설치) +import yaml +from Crypto.Cipher import AES + +# pip install pycryptodome +from Crypto.Util.Padding import unpad + +clearConsole = lambda: os.system("cls" if os.name in ("nt", "dos") else "clear") + +key_bytes = 32 +config_root = os.path.join(os.path.expanduser("~"), "KIS", "config") +# config_root = "$HOME/KIS/config/" # 토큰 파일이 저장될 폴더, 제3자가 찾기 어렵도록 경로 설정하시기 바랍니다. +# token_tmp = config_root + 'KIS000000' # 토큰 로컬저장시 파일 이름 지정, 파일이름을 토큰값이 유추가능한 파일명은 삼가바랍니다. +# token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d%H%M%S") # 토큰 로컬저장시 파일명 년월일시분초 +token_tmp = os.path.join( + config_root, f"KIS{datetime.today().strftime("%Y%m%d")}" +) # 토큰 로컬저장시 파일명 년월일 + +# 접근토큰 관리하는 파일 존재여부 체크, 없으면 생성 +if os.path.exists(token_tmp) == False: + f = open(token_tmp, "w+") + +# 앱키, 앱시크리트, 토큰, 계좌번호 등 저장관리, 자신만의 경로와 파일명으로 설정하시기 바랍니다. +# pip install PyYAML (패키지설치) +with open(os.path.join(config_root, "kis_devlp.yaml"), encoding="UTF-8") as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) + +_TRENV = tuple() +_last_auth_time = datetime.now() +_autoReAuth = False +_DEBUG = False +_isPaper = False +_smartSleep = 0.1 + +# 기본 헤더값 정의 +_base_headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8", + "User-Agent": _cfg["my_agent"], +} + + +# 토큰 발급 받아 저장 (토큰값, 토큰 유효시간,1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def save_token(my_token, my_expired): + # print(type(my_expired), my_expired) + valid_date = datetime.strptime(my_expired, "%Y-%m-%d %H:%M:%S") + # print('Save token date: ', valid_date) + with open(token_tmp, "w", encoding="utf-8") as f: + f.write(f"token: {my_token}\n") + f.write(f"valid-date: {valid_date}\n") + + +# 토큰 확인 (토큰값, 토큰 유효시간_1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def read_token(): + try: + # 토큰이 저장된 파일 읽기 + with open(token_tmp, encoding="UTF-8") as f: + tkg_tmp = yaml.load(f, Loader=yaml.FullLoader) + + # 토큰 만료 일,시간 + exp_dt = datetime.strftime(tkg_tmp["valid-date"], "%Y-%m-%d %H:%M:%S") + # 현재일자,시간 + now_dt = datetime.today().strftime("%Y-%m-%d %H:%M:%S") + + # print('expire dt: ', exp_dt, ' vs now dt:', now_dt) + # 저장된 토큰 만료일자 체크 (만료일시 > 현재일시 인경우 보관 토큰 리턴) + if exp_dt > now_dt: + return tkg_tmp["token"] + else: + # print('Need new token: ', tkg_tmp['valid-date']) + return None + except Exception: + # print('read token error: ', e) + return None + + +# 토큰 유효시간 체크해서 만료된 토큰이면 재발급처리 +def _getBaseHeader(): + if _autoReAuth: + reAuth() + return copy.deepcopy(_base_headers) + + +# 가져오기 : 앱키, 앱시크리트, 종합계좌번호(계좌번호 중 숫자8자리), 계좌상품코드(계좌번호 중 숫자2자리), 토큰, 도메인 +def _setTRENV(cfg): + nt1 = namedtuple( + "KISEnv", + ["my_app", "my_sec", "my_acct", "my_prod", "my_htsid", "my_token", "my_url", "my_url_ws"], + ) + d = { + "my_app": cfg["my_app"], # 앱키 + "my_sec": cfg["my_sec"], # 앱시크리트 + "my_acct": cfg["my_acct"], # 종합계좌번호(8자리) + "my_prod": cfg["my_prod"], # 계좌상품코드(2자리) + "my_htsid": cfg["my_htsid"], # HTS ID + "my_token": cfg["my_token"], # 토큰 + "my_url": cfg[ + "my_url" + ], # 실전 도메인 (https://openapi.koreainvestment.com:9443) + "my_url_ws": cfg["my_url_ws"], + } # 모의 도메인 (https://openapivts.koreainvestment.com:29443) + + # print(cfg['my_app']) + global _TRENV + _TRENV = nt1(**d) + + +def isPaperTrading(): # 모의투자 매매 + return _isPaper + + +# 실전투자면 'prod', 모의투자면 'vps'를 셋팅 하시기 바랍니다. +def changeTREnv(token_key, svr="prod", product=_cfg["my_prod"]): + cfg = dict() + + global _isPaper + if svr == "prod": # 실전투자 + ak1 = "my_app" # 실전투자용 앱키 + ak2 = "my_sec" # 실전투자용 앱시크리트 + _isPaper = False + _smartSleep = 0.05 + elif svr == "vps": # 모의투자 + ak1 = "paper_app" # 모의투자용 앱키 + ak2 = "paper_sec" # 모의투자용 앱시크리트 + _isPaper = True + _smartSleep = 0.5 + + cfg["my_app"] = _cfg[ak1] + cfg["my_sec"] = _cfg[ak2] + + if svr == "prod" and product == "01": # 실전투자 주식투자, 위탁계좌, 투자계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "prod" and product == "03": # 실전투자 선물옵션(파생) + cfg["my_acct"] = _cfg["my_acct_future"] + elif svr == "prod" and product == "08": # 실전투자 해외선물옵션(파생) + cfg["my_acct"] = _cfg["my_acct_future"] + elif svr == "prod" and product == "22": # 실전투자 개인연금저축계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "prod" and product == "29": # 실전투자 퇴직연금계좌 + cfg["my_acct"] = _cfg["my_acct_stock"] + elif svr == "vps" and product == "01": # 모의투자 주식투자, 위탁계좌, 투자계좌 + cfg["my_acct"] = _cfg["my_paper_stock"] + elif svr == "vps" and product == "03": # 모의투자 선물옵션(파생) + cfg["my_acct"] = _cfg["my_paper_future"] + + cfg["my_prod"] = product + cfg["my_htsid"] = _cfg["my_htsid"] + cfg["my_url"] = _cfg[svr] + + try: + my_token = _TRENV.my_token + except AttributeError: + my_token = "" + cfg["my_token"] = my_token if token_key else token_key + cfg["my_url_ws"] = _cfg["ops" if svr == "prod" else "vops"] + + # print(cfg) + _setTRENV(cfg) + + +def _getResultObject(json_data): + _tc_ = namedtuple("res", json_data.keys()) + + return _tc_(**json_data) + + +# Token 발급, 유효기간 1일, 6시간 이내 발급시 기존 token값 유지, 발급시 알림톡 무조건 발송 +# 모의투자인 경우 svr='vps', 투자계좌(01)이 아닌경우 product='XX' 변경하세요 (계좌번호 뒤 2자리) +def auth(svr="prod", product=_cfg["my_prod"], url=None): + p = { + "grant_type": "client_credentials", + } + # 개인 환경파일 "kis_devlp.yaml" 파일을 참조하여 앱키, 앱시크리트 정보 가져오기 + # 개인 환경파일명과 위치는 고객님만 아는 위치로 설정 바랍니다. + if svr == "prod": # 실전투자 + ak1 = "my_app" # 앱키 (실전투자용) + ak2 = "my_sec" # 앱시크리트 (실전투자용) + elif svr == "vps": # 모의투자 + ak1 = "paper_app" # 앱키 (모의투자용) + ak2 = "paper_sec" # 앱시크리트 (모의투자용) + + # 앱키, 앱시크리트 가져오기 + p["appkey"] = _cfg[ak1] + p["appsecret"] = _cfg[ak2] + + # 기존 발급된 토큰이 있는지 확인 + saved_token = read_token() # 기존 발급 토큰 확인 + # print("saved_token: ", saved_token) + if saved_token is None: # 기존 발급 토큰 확인이 안되면 발급처리 + url = f"{_cfg[svr]}/oauth2/tokenP" + res = requests.post( + url, data=json.dumps(p), headers=_getBaseHeader() + ) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + my_token = _getResultObject(res.json()).access_token # 토큰값 가져오기 + my_expired = _getResultObject( + res.json() + ).access_token_token_expired # 토큰값 만료일시 가져오기 + save_token(my_token, my_expired) # 새로 발급 받은 토큰 저장 + else: + print("Get Authentification token fail!\nYou have to restart your app!!!") + return + else: + my_token = saved_token # 기존 발급 토큰 확인되어 기존 토큰 사용 + + # 발급토큰 정보 포함해서 헤더값 저장 관리, API 호출시 필요 + changeTREnv(my_token, svr, product) + + _base_headers["authorization"] = f"Bearer {my_token}" + _base_headers["appkey"] = _TRENV.my_app + _base_headers["appsecret"] = _TRENV.my_sec + + global _last_auth_time + _last_auth_time = datetime.now() + + if _DEBUG: + print(f"[{_last_auth_time}] => get AUTH Key completed!") + + +# end of initialize, 토큰 재발급, 토큰 발급시 유효시간 1일 +# 프로그램 실행시 _last_auth_time에 저장하여 유효시간 체크, 유효시간 만료시 토큰 발급 처리 +def reAuth(svr="prod", product=_cfg["my_prod"]): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: # 유효시간 1일 + auth(svr, product) + + +def getEnv(): + return _cfg + + +def smart_sleep(): + if _DEBUG: + print(f"[RateLimit] Sleeping {_smartSleep}s ") + + time.sleep(_smartSleep) + + +def getTREnv(): + return _TRENV + + +# 주문 API에서 사용할 hash key값을 받아 header에 설정해 주는 함수 +# 현재는 hash key 필수 사항아님, 생략가능, API 호출과정에서 변조 우려를 하는 경우 사용 +# Input: HTTP Header, HTTP post param +# Output: None +def set_order_hash_key(h, p): + url = f"{getTREnv().my_url}/uapi/hashkey" # hashkey 발급 API URL + + res = requests.post(url, data=json.dumps(p), headers=h) + rescode = res.status_code + if rescode == 200: + h["hashkey"] = _getResultObject(res.json()).HASH + else: + print("Error:", rescode) + + +# API 호출 응답에 필요한 처리 공통 함수 +class APIResp: + def __init__(self, resp): + self._rescode = resp.status_code + self._resp = resp + self._header = self._setHeader() + self._body = self._setBody() + self._err_code = self._body.msg_cd + self._err_message = self._body.msg1 + + def getResCode(self): + return self._rescode + + def _setHeader(self): + fld = dict() + for x in self._resp.headers.keys(): + if x.islower(): + fld[x] = self._resp.headers.get(x) + _th_ = namedtuple("header", fld.keys()) + + return _th_(**fld) + + def _setBody(self): + _tb_ = namedtuple("body", self._resp.json().keys()) + + return _tb_(**self._resp.json()) + + def getHeader(self): + return self._header + + def getBody(self): + return self._body + + def getResponse(self): + return self._resp + + def isOK(self): + try: + if self.getBody().rt_cd == "0": + return True + else: + return False + except: + return False + + def getErrorCode(self): + return self._err_code + + def getErrorMessage(self): + return self._err_message + + def printAll(self): + print("
") + for x in self.getHeader()._fields: + print(f"\t-{x}: {getattr(self.getHeader(), x)}") + print("") + for x in self.getBody()._fields: + print(f"\t-{x}: {getattr(self.getBody(), x)}") + + def printError(self, url): + print( + "-------------------------------\nError in response: ", + self.getResCode(), + " url=", + url, + ) + print( + "rt_cd : ", + self.getBody().rt_cd, + "/ msg_cd : ", + self.getErrorCode(), + "/ msg1 : ", + self.getErrorMessage(), + ) + print("-------------------------------") + + # end of class APIResp + + +class APIRespError(APIResp): + def __init__(self, status_code, error_text): + # 부모 생성자 호출하지 않고 직접 초기화 + self.status_code = status_code + self.error_text = error_text + self._error_code = str(status_code) + self._error_message = error_text + + def isOK(self): + return False + + def getErrorCode(self): + return self._error_code + + def getErrorMessage(self): + return self._error_message + + def getBody(self): + # 빈 객체 리턴 (속성 접근 시 AttributeError 방지) + class EmptyBody: + def __getattr__(self, name): + return None + + return EmptyBody() + + def getHeader(self): + # 빈 객체 리턴 + class EmptyHeader: + tr_cont = "" + + def __getattr__(self, name): + return "" + + return EmptyHeader() + + def printAll(self): + print(f"=== ERROR RESPONSE ===") + print(f"Status Code: {self.status_code}") + print(f"Error Message: {self.error_text}") + print(f"======================") + + def printError(self, url=""): + print(f"Error Code : {self.status_code} | {self.error_text}") + if url: + print(f"URL: {url}") + + +########### API call wrapping : API 호출 공통 + + +def _url_fetch( + api_url, ptr_id, tr_cont, params, appendHeaders=None, postFlag=False, hashFlag=True +): + url = f"{getTREnv().my_url}{api_url}" + + headers = _getBaseHeader() # 기본 header 값 정리 + + # 추가 Header 설정 + tr_id = ptr_id + if ptr_id[0] in ("T", "J", "C"): # 실전투자용 TR id 체크 + if isPaperTrading(): # 모의투자용 TR id 식별 + tr_id = "V" + ptr_id[1:] + + headers["tr_id"] = tr_id # 트랜젝션 TR id + headers["custtype"] = "P" # 일반(개인고객,법인고객) "P", 제휴사 "B" + headers["tr_cont"] = tr_cont # 트랜젝션 TR id + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if _DEBUG: + print("< Sending Info >") + print(f"URL: {url}, TR: {tr_id}") + print(f"
\n{headers}") + print(f"\n{params}") + + if postFlag: + # if (hashFlag): set_order_hash_key(headers, params) + res = requests.post(url, headers=headers, data=json.dumps(params)) + else: + res = requests.get(url, headers=headers, params=params) + + if res.status_code == 200: + ar = APIResp(res) + if _DEBUG: + ar.printAll() + return ar + else: + print("Error Code : " + str(res.status_code) + " | " + res.text) + return APIRespError(res.status_code, res.text) + + +# auth() +# print("Pass through the end of the line") + + +########### New - websocket 대응 + +_base_headers_ws = { + "content-type": "utf-8", +} + + +def _getBaseHeader_ws(): + if _autoReAuth: + reAuth_ws() + + return copy.deepcopy(_base_headers_ws) + + +def auth_ws(svr="prod", product=_cfg["my_prod"]): + p = {"grant_type": "client_credentials"} + if svr == "prod": + ak1 = "my_app" + ak2 = "my_sec" + elif svr == "vps": + ak1 = "paper_app" + ak2 = "paper_sec" + + p["appkey"] = _cfg[ak1] + p["secretkey"] = _cfg[ak2] + + url = f"{_cfg[svr]}/oauth2/Approval" + res = requests.post(url, data=json.dumps(p), headers=_getBaseHeader()) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + approval_key = _getResultObject(res.json()).approval_key + else: + print("Get Approval token fail!\nYou have to restart your app!!!") + return + + changeTREnv(None, svr, product) + + _base_headers_ws["approval_key"] = approval_key + + global _last_auth_time + _last_auth_time = datetime.now() + + if _DEBUG: + print(f"[{_last_auth_time}] => get AUTH Key completed!") + + +def reAuth_ws(svr="prod", product=_cfg["my_prod"]): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: + auth_ws(svr, product) + + +def data_fetch(tr_id, tr_type, params, appendHeaders=None) -> dict: + headers = _getBaseHeader_ws() # 기본 header 값 정리 + + headers["tr_type"] = tr_type + headers["custtype"] = "P" + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if _DEBUG: + print("< Sending Info >") + print(f"TR: {tr_id}") + print(f"
\n{headers}") + + inp = { + "tr_id": tr_id, + } + inp.update(params) + + return {"header": headers, "body": {"input": inp}} + + +# iv, ekey, encrypt 는 각 기능 메소드 파일에 저장할 수 있도록 dict에서 return 하도록 +def system_resp(data): + isPingPong = False + isUnSub = False + isOk = False + tr_msg = None + tr_key = None + encrypt, iv, ekey = None, None, None + + rdic = json.loads(data) + + tr_id = rdic["header"]["tr_id"] + if tr_id != "PINGPONG": + tr_key = rdic["header"]["tr_key"] + encrypt = rdic["header"]["encrypt"] + if rdic.get("body", None) is not None: + isOk = True if rdic["body"]["rt_cd"] == "0" else False + tr_msg = rdic["body"]["msg1"] + # 복호화를 위한 key 를 추출 + if "output" in rdic["body"]: + iv = rdic["body"]["output"]["iv"] + ekey = rdic["body"]["output"]["key"] + isUnSub = True if tr_msg[:5] == "UNSUB" else False + else: + isPingPong = True if tr_id == "PINGPONG" else False + + nt2 = namedtuple( + "SysMsg", + [ + "isOk", + "tr_id", + "tr_key", + "isUnSub", + "isPingPong", + "tr_msg", + "iv", + "ekey", + "encrypt", + ], + ) + d = { + "isOk": isOk, + "tr_id": tr_id, + "tr_key": tr_key, + "tr_msg": tr_msg, + "isUnSub": isUnSub, + "isPingPong": isPingPong, + "iv": iv, + "ekey": ekey, + "encrypt": encrypt, + } + + return nt2(**d) + + +def aes_cbc_base64_dec(key, iv, cipher_text): + if key is None or iv is None: + raise AttributeError("key and iv cannot be None") + + cipher = AES.new(key.encode("utf-8"), AES.MODE_CBC, iv.encode("utf-8")) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +##### +open_map: dict = {} + + +def add_open_map( + name: str, + request: Callable[[str, str, ...], (dict, list[str])], + data: str | list[str], + kwargs: dict = None, +): + if open_map.get(name, None) is None: + open_map[name] = { + "func": request, + "items": [], + "kwargs": kwargs, + } + + if type(data) is list: + open_map[name]["items"] += data + elif type(data) is str: + open_map[name]["items"].append(data) + + +data_map: dict = {} + + +def add_data_map( + tr_id: str, + columns: list = None, + encrypt: str = None, + key: str = None, + iv: str = None, +): + if data_map.get(tr_id, None) is None: + data_map[tr_id] = {"columns": [], "encrypt": False, "key": None, "iv": None} + + if columns is not None: + data_map[tr_id]["columns"] = columns + + if encrypt is not None: + data_map[tr_id]["encrypt"] = encrypt + + if key is not None: + data_map[tr_id]["key"] = key + + if iv is not None: + data_map[tr_id]["iv"] = iv + + +class KISWebSocket: + api_url: str = "" + on_result: Callable[ + [websockets.ClientConnection, str, pd.DataFrame, dict], None + ] = None + result_all_data: bool = False + + retry_count: int = 0 + amx_retries: int = 0 + + # init + def __init__(self, api_url: str, max_retries: int = 3): + self.api_url = api_url + self.max_retries = max_retries + + # private + async def __subscriber(self, ws: websockets.ClientConnection): + async for raw in ws: + logging.info("received message >> %s" % raw) + show_result = False + + df = pd.DataFrame() + + if raw[0] in ["0", "1"]: + d1 = raw.split("|") + if len(d1) < 4: + raise ValueError("data not found...") + + tr_id = d1[1] + + dm = data_map[tr_id] + d = d1[3] + if dm.get("encrypt", None) == "Y": + d = aes_cbc_base64_dec(dm["key"], dm["iv"], d) + + df = pd.read_csv( + StringIO(d), header=None, sep="^", names=dm["columns"], dtype=object + ) + + show_result = True + + else: + rsp = system_resp(raw) + + tr_id = rsp.tr_id + add_data_map( + tr_id=rsp.tr_id, encrypt=rsp.encrypt, key=rsp.ekey, iv=rsp.iv + ) + + if rsp.isPingPong: + print(f"### RECV [PINGPONG] [{raw}]") + await ws.pong(raw) + print(f"### SEND [PINGPONG] [{raw}]") + + if self.result_all_data: + show_result = True + + if show_result is True and self.on_result is not None: + self.on_result(ws, tr_id, df, data_map[tr_id]) + + async def __runner(self): + if len(open_map.keys()) > 40: + raise ValueError("Subscription's max is 40") + + url = f"{getTREnv().my_url_ws}{self.api_url}" + + while self.retry_count < self.max_retries: + try: + async with websockets.connect(url) as ws: + # request subscribe + for name, obj in open_map.items(): + await self.send_multiple( + ws, obj["func"], "1", obj["items"], obj["kwargs"] + ) + + # subscriber + await asyncio.gather( + self.__subscriber(ws), + ) + except Exception as e: + print("Connection exception >> ", e) + self.retry_count += 1 + await asyncio.sleep(1) + + # func + @classmethod + async def send( + cls, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + tr_type: str, + data: str, + kwargs: dict = None, + ): + k = {} if kwargs is None else kwargs + msg, columns = request(tr_type, data, **k) + + add_data_map(tr_id=msg["body"]["input"]["tr_id"], columns=columns) + + logging.info("send message >> %s" % json.dumps(msg)) + + await ws.send(json.dumps(msg)) + smart_sleep() + + async def send_multiple( + self, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + tr_type: str, + data: list | str, + kwargs: dict = None, + ): + if type(data) is str: + await self.send(ws, request, tr_type, data, kwargs) + elif type(data) is list: + for d in data: + await self.send(ws, request, tr_type, d, kwargs) + else: + raise ValueError("data must be str or list") + + @classmethod + def subscribe( + cls, + request: Callable[[str, str, ...], (dict, list[str])], + data: list | str, + kwargs: dict = None, + ): + add_open_map(request.__name__, request, data, kwargs) + + def unsubscribe( + self, + ws: websockets.ClientConnection, + request: Callable[[str, str, ...], (dict, list[str])], + data: list | str, + ): + self.send_multiple(ws, request, "2", data) + + # start + def start( + self, + on_result: Callable[ + [websockets.ClientConnection, str, pd.DataFrame, dict], None + ], + result_all_data: bool = False, + ): + self.on_result = on_result + self.result_all_data = result_all_data + try: + asyncio.run(self.__runner()) + except KeyboardInterrupt: + print("Closing by KeyboardInterrupt") diff --git a/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples.py b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples.py new file mode 100644 index 0000000..bd7cbe1 --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples.py @@ -0,0 +1,250 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from overseas_futureoption_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간) [해외선물-018] +############################################################################################## + +df1, df2 = daily_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] +############################################################################################## + +df1, df2 = inquire_asking_price(srs_cd="ESZ23") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 당일주문내역조회 [v1_해외선물-004] +############################################################################################## + +df = inquire_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ccld_nccs_dvsn="01", sll_buy_dvsn_cd="%%", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") +print(df) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별체결내역[해외선물-011] +############################################################################################## + +df1, df2 = inquire_daily_ccld(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_dt="20250101", end_dt="20250131", fuop_dvsn_cd="00", fm_pdgr_cd="", crcy_cd="%%%", fm_item_ftng_yn="N", sll_buy_dvsn_cd="%%", ctx_area_fk200="", ctx_area_nk200="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역 [해외선물-013] +############################################################################################## + +df = inquire_daily_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, strt_dt="20250601", end_dt="20250703", fm_pdgr_cd="", ccld_nccs_dvsn="01", sll_buy_dvsn_cd="%%", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") +print(df) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황 [해외선물-012] +############################################################################################## + +df = inquire_deposit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="TUS", inqr_dt="20250630") +print(df) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별 [해외선물-010] +############################################################################################## + +df1, df2 = inquire_period_ccld(inqr_term_from_dt="20250601", inqr_term_to_dt="20250630", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="%%%", whol_trsl_yn="N", fuop_dvsn="00", ctx_area_fk200="", ctx_area_nk200="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역 [해외선물-014] +############################################################################################## + +df = inquire_period_trans(inqr_term_from_dt="20250101", inqr_term_to_dt="20250131", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, acnt_tr_type_cd="1", crcy_cd="%%%", ctx_area_fk100="", ctx_area_nk100="", pwd_chk_yn="") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목현재가 [v1_해외선물-009] +############################################################################################## + +df = inquire_price(srs_cd="BONU25") +print(df) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 [v1_해외선물-006] +############################################################################################## + +df = inquire_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_futr_fx_pdno="6AU22", sll_buy_dvsn_cd="02", fm_ord_pric="", ecis_rsvn_ord_yn="") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 분봉조회[해외선물-016] +############################################################################################## + +df1, df2 = inquire_time_futurechartprice(srs_cd="BONU25", exch_cd="EUREX", start_date_time="20250101", close_date_time="20250701", qry_tp="Q", qry_cnt="120", qry_gap="1", index_key="") +print(df1) +print(df2) + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 분봉조회 [해외선물-040] +############################################################################################## + +result1, result2 = inquire_time_optchartprice(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") +print(result1) +print(result2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) [v1_해외선물-005] +############################################################################################## + +df = inquire_unpd(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, fuop_dvsn="00", ctx_area_fk100="", ctx_area_nk100="") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [해외선물-029] +############################################################################################## + +df1, df2 = investor_unpd_trend(prod_iscd="GE", bsop_date="20240513", upmu_gubun="0", cts_key="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 증거금상세 [해외선물-032] +############################################################################################## + +df = margin_detail(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, crcy_cd="USD", inqr_dt="20250701") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물옵션 장운영시간 [해외선물-030] +############################################################################################## + +df = market_time(fm_pdgr_cd="", fm_clas_cd="", fm_excg_cd="CME", opt_yn="N", ctx_area_nk200="", ctx_area_fk200="") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] +############################################################################################## + +df1, df2 = monthly_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] +############################################################################################## + +df1, df2 = opt_asking_price(srs_cd="OESM24 C5340") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(일간) [해외선물-037] +############################################################################################## + +result1, result2 = opt_daily_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") +print(result1) +print(result2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목상세 [해외선물-034] +############################################################################################## + +result = opt_detail(srs_cd="C5500") +print(result) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(월간) [해외선물-039] +############################################################################################## + +result1, result2 = opt_monthly_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") +print(result1) +print(result2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목현재가 [해외선물-035] +############################################################################################## + +result = opt_price(srs_cd="DXM24") +print(result) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(틱) [해외선물-038] +############################################################################################## + +result1, result2 = opt_tick_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") +print(result1) +print(result2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(주간) [해외선물-036] +############################################################################################## + +result1, result2 = opt_weekly_ccnl(srs_cd="DXM24", exch_cd="ICE", qry_cnt="30") +print(result1) +print(result2) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문[v1_해외선물-001] +############################################################################################## + +df = order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_futr_fx_pdno="1AALN25 C10.0", sll_buy_dvsn_cd="02", fm_lqd_ustl_ccld_dt="", fm_lqd_ustl_ccno="", pric_dvsn_cd="1", fm_limit_ord_pric="1.17", fm_stop_ord_pric="", fm_ord_qty="1", fm_lqd_lmt_ord_pric="", fm_lqd_stop_ord_pric="", ccld_cndt_cd="6", cplx_ord_dvsn_cd="0", ecis_rsvn_ord_yn="N", fm_hdge_ord_scrn_yn="N") +print(df) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문[v1_해외선물-002, 003] +############################################################################################## + +df = order_rvsecncl(cano=trenv.my_acct, ord_dv="0", acnt_prdt_cd=trenv.my_prod, orgn_ord_dt="20250630", orgn_odno="00123456", fm_limit_ord_pric="10.0", fm_stop_ord_pric="", fm_lqd_lmt_ord_pric="", fm_lqd_stop_ord_pric="", fm_hdge_ord_scrn_yn="N", fm_mkpr_cvsn_yn="") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보[해외선물-023] +############################################################################################## + +df = search_contract_detail(qry_cnt="1", srs_cd_01="BONU25", srs_cd_02="BONU25", srs_cd_03="BONU25") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 상품기본정보 [해외선물-041] +############################################################################################## + +result = search_opt_detail(qry_cnt="1", srs_cd_01="6AM24") +print(result) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목상세[v1_해외선물-008] +############################################################################################## + +df = stock_detail(srs_cd="BONU25") +print(df) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] +############################################################################################## + +df1, df2 = tick_ccnl(srs_cd="BONU25", exch_cd="EUREX", start_date_time="", close_date_time="20250630", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") +print(df1) +print(df2) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] +############################################################################################## + +df1, df2 = weekly_ccnl(srs_cd="6AM24", exch_cd="CME", start_date_time="", close_date_time="20240402", qry_tp="Q", qry_cnt="30", qry_gap="", index_key="") +print(df1) +print(df2) + diff --git a/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples_ws.py b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples_ws.py new file mode 100644 index 0000000..2c9441f --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_examples_ws.py @@ -0,0 +1,52 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from overseas_futureoption_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] +############################################################################################## + +kws.subscribe(request=asking_price, data=["SPIU25"]) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결가[실시간-017] +############################################################################################## + +kws.subscribe(request=ccnl, data=["1OZQ25"]) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결내역통보[실시간-020] +############################################################################################## + +kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid]) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간주문내역통보[실시간-019] +############################################################################################## + +kws.subscribe(request=order_notice, data=[trenv.my_htsid]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions.py b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions.py new file mode 100644 index 0000000..fa5d6b0 --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions.py @@ -0,0 +1,4060 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간) [해외선물-018] +############################################################################################## + +def daily_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(일간)[해외선물-018] + 해외선물 체결추이(일간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: 6AM24) + exch_cd (str): 거래소코드 (예: CME) + start_date_time (str): 조회시작일시 (공백) + close_date_time (str): 조회종료일시 (예: 20240402) + qry_tp (str): 조회구분 (Q: 최초조회시, P: 다음키(INDEX_KEY) 입력하여 조회시) + qry_cnt (str): 요청개수 (예: 30, 최대 40) + qry_gap (str): 묶음개수 (공백, 분만 사용) + index_key (str): 이전조회KEY (공백) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(일간) 데이터 + + Example: + >>> df1, df2 = daily_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. (e.g. 'Q')") + raise ValueError("qry_tp is required. (e.g. 'Q')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020100" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/daily-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return daily_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] +############################################################################################## + +def inquire_asking_price( + srs_cd: str, # 종목명 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 호가[해외선물-031] + 해외선물 호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 호가 데이터 + + Example: + >>> df1, df2 = inquire_asking_price(srs_cd="EXAMPLE_SRS_CD") + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'EXAMPLE_SRS_CD')") + raise ValueError("srs_cd is required. (e.g. 'EXAMPLE_SRS_CD')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC86000000" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/inquire-asking-price" + + + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + srs_cd, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 당일주문내역조회 [v1_해외선물-004] +############################################################################################## + +def inquire_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 당일주문내역조회[v1_해외선물-004] + 해외선물옵션 당일주문내역조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ccld_nccs_dvsn (str): 01:전체 / 02:체결 / 03:미체결 + sll_buy_dvsn_cd (str): %%:전체 / 01:매도 / 02:매수 + fuop_dvsn (str): 00:전체 / 01:선물 / 02:옵션 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 당일주문내역조회 데이터 + + Example: + >>> df = inquire_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ccld_nccs_dvsn="01", + ... sll_buy_dvsn_cd="01", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '01')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '01')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3116R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-ccld" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccld( + cano, + acnt_prdt_cd, + ccld_nccs_dvsn, + sll_buy_dvsn_cd, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별체결내역[해외선물-011] +############################################################################################## + +def inquire_daily_ccld( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_dt: str, # 시작일자 + end_dt: str, # 종료일자 + fuop_dvsn_cd: str, # 선물옵션구분코드 + fm_pdgr_cd: str, # FM상품군코드 + crcy_cd: str, # 통화코드 + fm_item_ftng_yn: str, # FM종목합산여부 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 체결내역[해외선물-011] + 해외선물옵션 일별 체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + strt_dt (str): 시작일자(YYYYMMDD) + end_dt (str): 종료일자(YYYYMMDD) + fuop_dvsn_cd (str): 00:전체 / 01:선물 / 02:옵션 + fm_pdgr_cd (str): 공란(Default) + crcy_cd (str): %%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남 + fm_item_ftng_yn (str): "N"(Default) + sll_buy_dvsn_cd (str): %%: 전체 / 01 : 매도 / 02 : 매수 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물옵션 일별 체결내역 데이터 + + Example: + >>> df1, df2 = inquire_daily_ccld( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... strt_dt="20221010", + ... end_dt="20221216", + ... fuop_dvsn_cd="00", + ... fm_pdgr_cd="", + ... crcy_cd="%%%", + ... fm_item_ftng_yn="N", + ... sll_buy_dvsn_cd="%%", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not strt_dt: + logger.error("strt_dt is required. (e.g. '20221010')") + raise ValueError("strt_dt is required. (e.g. '20221010')") + if not end_dt: + logger.error("end_dt is required. (e.g. '20221216')") + raise ValueError("end_dt is required. (e.g. '20221216')") + if fuop_dvsn_cd not in ['00', '01', '02']: + logger.error("fuop_dvsn_cd is required. (e.g. '00', '01', '02')") + raise ValueError("fuop_dvsn_cd is required. (e.g. '00', '01', '02')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%',KRW, USD, EUR..)") + raise ValueError("crcy_cd is required. (e.g. '%%%',KRW, USD, EUR..)") + if not fm_item_ftng_yn: + logger.error("fm_item_ftng_yn is required. (e.g. 'N')") + raise ValueError("fm_item_ftng_yn is required. (e.g. 'N')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '%%')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '%%')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "OTFM3122R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-daily-ccld" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_DT": strt_dt, + "END_DT": end_dt, + "FUOP_DVSN_CD": fuop_dvsn_cd, + "FM_PDGR_CD": fm_pdgr_cd, + "CRCY_CD": crcy_cd, + "FM_ITEM_FTNG_YN": fm_item_ftng_yn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output1 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont, ctx_area_fk200, ctx_area_nk200 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_ccld( + cano, + acnt_prdt_cd, + strt_dt, + end_dt, + fuop_dvsn_cd, + fm_pdgr_cd, + crcy_cd, + fm_item_ftng_yn, + sll_buy_dvsn_cd, + ctx_area_fk200, + ctx_area_nk200, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역 [해외선물-013] +############################################################################################## + +def inquire_daily_order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + strt_dt: str, # 시작일자 + end_dt: str, # 종료일자 + fm_pdgr_cd: str, # FM상품군코드 + ccld_nccs_dvsn: str, # 체결미체결구분 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 일별 주문내역[해외선물-013] + 해외선물옵션 일별 주문내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + strt_dt (str): 시작일자 (YYYYMMDD) + end_dt (str): 종료일자 (YYYYMMDD) + fm_pdgr_cd (str): FM상품군코드 + ccld_nccs_dvsn (str): 체결미체결구분 (01:전체 / 02:체결 / 03:미체결) + sll_buy_dvsn_cd (str): 매도매수구분코드 (%%전체 / 01:매도 / 02:매수) + fuop_dvsn (str): 선물옵션구분 (00:전체 / 01:선물 / 02:옵션) + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 일별 주문내역 데이터 + + Example: + >>> df = inquire_daily_order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... strt_dt="20220101", + ... end_dt="20221214", + ... fm_pdgr_cd="", + ... ccld_nccs_dvsn="01", + ... sll_buy_dvsn_cd="%%", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not strt_dt: + logger.error("strt_dt is required. (e.g. '20220101')") + raise ValueError("strt_dt is required. (e.g. '20220101')") + if not end_dt: + logger.error("end_dt is required. (e.g. '20221214')") + raise ValueError("end_dt is required. (e.g. '20221214')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '01')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '01')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '%%')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '%%')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3120R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-daily-order" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "STRT_DT": strt_dt, + "END_DT": end_dt, + "FM_PDGR_CD": fm_pdgr_cd, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_order( + cano, + acnt_prdt_cd, + strt_dt, + end_dt, + fm_pdgr_cd, + ccld_nccs_dvsn, + sll_buy_dvsn_cd, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황 [해외선물-012] +############################################################################################## + +def inquire_deposit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + inqr_dt: str, # 조회일자 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 예수금현황[해외선물-012] + 해외선물옵션 예수금현황 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + crcy_cd (str): TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 VND: 베트남 + inqr_dt (str): 조회일자 (YYYYMMDD 형식) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 예수금현황 데이터 + + Example: + >>> df = inquire_deposit( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="KRW", + ... inqr_dt="20221214" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'KRW')") + raise ValueError("crcy_cd is required. (e.g. 'KRW')") + if not inqr_dt: + logger.error("inqr_dt is required. (e.g. '20221214')") + raise ValueError("inqr_dt is required. (e.g. '20221214')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM1411R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-deposit" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "INQR_DT": inqr_dt, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_deposit( + cano, + acnt_prdt_cd, + crcy_cd, + inqr_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별 [해외선물-010] +############################################################################################## + +def inquire_period_ccld( + inqr_term_from_dt: str, # 조회기간FROM일자 + inqr_term_to_dt: str, # 조회기간TO일자 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + whol_trsl_yn: str, # 전체환산여부 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk200: str, # 연속조회검색조건200 + ctx_area_nk200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌손익 일별[해외선물-010] + 해외선물옵션 기간계좌손익 일별 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_term_from_dt (str): 조회기간FROM일자 + inqr_term_to_dt (str): 조회기간TO일자 + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + crcy_cd (str): '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본' + whol_trsl_yn (str): 전체환산여부 + fuop_dvsn (str): 00:전체 / 01:선물 / 02:옵션 + ctx_area_fk200 (str): 연속조회검색조건200 + ctx_area_nk200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물옵션 기간계좌손익 일별 데이터 + + Example: + >>> df1, df2 = inquire_period_ccld( + ... inqr_term_from_dt="20250601", + ... inqr_term_to_dt="20250630", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="%%%", + ... whol_trsl_yn="N", + ... fuop_dvsn="00", + ... ctx_area_fk200="", + ... ctx_area_nk200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not inqr_term_from_dt: + logger.error("inqr_term_from_dt is required. (e.g. '20250601')") + raise ValueError("inqr_term_from_dt is required. (e.g. '20250601')") + if not inqr_term_to_dt: + logger.error("inqr_term_to_dt is required. (e.g. '20250630')") + raise ValueError("inqr_term_to_dt is required. (e.g. '20250630')") + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%')") + raise ValueError("crcy_cd is required. (e.g. '%%%')") + if not whol_trsl_yn: + logger.error("whol_trsl_yn is required. (e.g. 'N')") + raise ValueError("whol_trsl_yn is required. (e.g. 'N')") + if not fuop_dvsn: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "OTFM3118R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-period-ccld" + + + + params = { + "INQR_TERM_FROM_DT": inqr_term_from_dt, + "INQR_TERM_TO_DT": inqr_term_to_dt, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "WHOL_TRSL_YN": whol_trsl_yn, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK200": ctx_area_fk200, + "CTX_AREA_NK200": ctx_area_nk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_ccld( + inqr_term_from_dt, + inqr_term_to_dt, + cano, + acnt_prdt_cd, + crcy_cd, + whol_trsl_yn, + fuop_dvsn, + ctx_area_fk200, + ctx_area_nk200, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역 [해외선물-014] +############################################################################################## + +def inquire_period_trans( + inqr_term_from_dt: str, # 조회기간FROM일자 + inqr_term_to_dt: str, # 조회기간TO일자 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + acnt_tr_type_cd: str, # 계좌거래유형코드 + crcy_cd: str, # 통화코드 + ctx_area_fk100: str, # 연속조회검색조건100 + ctx_area_nk100: str, # 연속조회키100 + pwd_chk_yn: str, # 비밀번호체크여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 기간계좌거래내역[해외선물-014] + 해외선물옵션 기간계좌거래내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + inqr_term_from_dt (str): 조회기간FROM일자 (예: '20220101') + inqr_term_to_dt (str): 조회기간TO일자 (예: '20221214') + cano (str): 계좌번호 체계(8-2)의 앞 8자리 (예: '80012345') + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 (예: '08') + acnt_tr_type_cd (str): 계좌거래유형코드 (1: 전체, 2:입출금 , 3: 결제) + crcy_cd (str): 통화코드 ('%%%': 전체, 'TUS': TOT_USD, 'TKR': TOT_KRW, 'KRW': 한국, 'USD': 미국, 'EUR': EUR, 'HKD': 홍콩, 'CNY': 중국, 'JPY': 일본, 'VND': 베트남) + ctx_area_fk100 (str): 연속조회검색조건100 + ctx_area_nk100 (str): 연속조회키100 + pwd_chk_yn (str): 비밀번호체크여부 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 기간계좌거래내역 데이터 + + Example: + >>> df = inquire_period_trans( + ... inqr_term_from_dt="20220101", + ... inqr_term_to_dt="20221214", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... acnt_tr_type_cd="%%", + ... crcy_cd="%%%", + ... ctx_area_fk100="", + ... ctx_area_nk100="", + ... pwd_chk_yn="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not inqr_term_from_dt: + logger.error("inqr_term_from_dt is required. (e.g. '20220101')") + raise ValueError("inqr_term_from_dt is required. (e.g. '20220101')") + if not inqr_term_to_dt: + logger.error("inqr_term_to_dt is required. (e.g. '20221214')") + raise ValueError("inqr_term_to_dt is required. (e.g. '20221214')") + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not acnt_tr_type_cd: + logger.error("acnt_tr_type_cd is required. (e.g. '%%')") + raise ValueError("acnt_tr_type_cd is required. (e.g. '%%')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. '%%%')") + raise ValueError("crcy_cd is required. (e.g. '%%%')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + tr_id = "OTFM3114R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-period-trans" + + + + params = { + "INQR_TERM_FROM_DT": inqr_term_from_dt, + "INQR_TERM_TO_DT": inqr_term_to_dt, + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ACNT_TR_TYPE_CD": acnt_tr_type_cd, + "CRCY_CD": crcy_cd, + "CTX_AREA_FK100": ctx_area_fk100, + "CTX_AREA_NK100": ctx_area_nk100, + "PWD_CHK_YN": pwd_chk_yn, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_trans( + inqr_term_from_dt, + inqr_term_to_dt, + cano, + acnt_prdt_cd, + acnt_tr_type_cd, + crcy_cd, + ctx_area_fk100, + ctx_area_nk100, + pwd_chk_yn, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목현재가 [v1_해외선물-009] +############################################################################################## + +def inquire_price( + srs_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물종목현재가[v1_해외선물-009] + 해외선물종목현재가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: CNHU24) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물종목현재가 데이터 + + Example: + >>> df = inquire_price(srs_cd="CNHU24") + >>> print(df) + """ + # 필수 파라미터 검증 + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'CNHU24')") + raise ValueError("srs_cd is required. (e.g. 'CNHU24')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55010000" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/inquire-price" + + + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_price( + srs_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 [v1_해외선물-006] +############################################################################################## + +def inquire_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_futr_fx_pdno: str, # 해외선물FX상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fm_ord_pric: str, # FM주문가격 + ecis_rsvn_ord_yn: str, # 행사예약주문여부 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문가능조회[v1_해외선물-006] + 해외선물옵션 주문가능조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_futr_fx_pdno (str): 해외선물FX상품번호 + sll_buy_dvsn_cd (str): 01 : 매도 / 02 : 매수 + fm_ord_pric (str): FM주문가격 + ecis_rsvn_ord_yn (str): 행사예약주문여부 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 주문가능조회 데이터 + + Example: + >>> df = inquire_psamount( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_futr_fx_pdno="6AU22", + ... sll_buy_dvsn_cd="02", + ... fm_ord_pric="", + ... ecis_rsvn_ord_yn="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ovrs_futr_fx_pdno: + logger.error("ovrs_futr_fx_pdno is required. (e.g. '6AU22')") + raise ValueError("ovrs_futr_fx_pdno is required. (e.g. '6AU22')") + if sll_buy_dvsn_cd not in ["01", "02"]: + logger.error("sll_buy_dvsn_cd is required. (e.g. '01' or '02')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '01' or '02')") + + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3304R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-psamount" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_FUTR_FX_PDNO": ovrs_futr_fx_pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FM_ORD_PRIC": fm_ord_pric, + "ECIS_RSVN_ORD_YN": ecis_rsvn_ord_yn, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psamount( + cano, + acnt_prdt_cd, + ovrs_futr_fx_pdno, + sll_buy_dvsn_cd, + fm_ord_pric, + ecis_rsvn_ord_yn, + dataframe, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 분봉조회[해외선물-016] +############################################################################################## + +def inquire_time_futurechartprice( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 분봉조회[해외선물-016] + 해외선물 분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): ex) CNHU24 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고 + exch_cd (str): CME + start_date_time (str): 공백 + close_date_time (str): ex) 20230823 + qry_tp (str): Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시 + qry_cnt (str): 120 (조회갯수) + qry_gap (str): 5 (분간격) + index_key (str): 다음조회(QRY_TP를 P로 입력) 시, 이전 호출의 "output1 > index_key" 기입하여 조회 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_futurechartprice( + ... srs_cd="BONU25", + ... exch_cd="EUREX", + ... start_date_time="20250101", + ... close_date_time="20250702", + ... qry_tp="Q", + ... qry_cnt="120", + ... qry_gap="1", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'BONU25')") + raise ValueError("srs_cd is required. (e.g. 'BONU25')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'EUREX')") + raise ValueError("exch_cd is required. (e.g. 'EUREX')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20250702')") + raise ValueError("close_date_time is required. (e.g. '20250702')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '120')") + raise ValueError("qry_cnt is required. (e.g. '120')") + if not qry_gap: + logger.error("qry_gap is required. (e.g. '1', '5', '10', '15', '30', '60')") + raise ValueError("qry_gap is required. (e.g. '1', '5', '10', '15', '30', '60')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020400" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output2["index_key"] + qry_tp = "P" + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_futurechartprice( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 분봉조회 [해외선물-040] +############################################################################################## + +def inquire_time_optchartprice( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 분봉조회 API입니다. + 한 번의 호출에 120건까지 확인 가능하며, QRY_TP, INDEX_KEY 를 이용하여 다음조회 가능합니다. + + ※ 다음조회 방법 + (처음조회) "QRY_TP":"Q", "QRY_CNT":"120", "INDEX_KEY":"" + (다음조회) "QRY_TP":"P", "QRY_CNT":"120", "INDEX_KEY":"20240902 5" ◀ 이전 호출의 "output1 > index_key" 기입 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 DataFrame, output2 DataFrame) + + Example: + >>> df1, df2 = inquire_time_optchartprice("OESU24 C5500", "CME", "20") + >>> print(df1) + >>> print(df2) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None and dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return (dataframe1 if dataframe1 is not None else pd.DataFrame(), + dataframe2 if dataframe2 is not None else pd.DataFrame()) + + tr_id = "HHDFO55020100" # 해외옵션 분봉조회 + + + api_url = "/uapi/overseas-futureoption/v1/quotations/inquire-time-optchartprice" + + + + params = { + "SRS_CD": srs_cd, # 종목코드 + "EXCH_CD": exch_cd, # 거래소코드 + "QRY_CNT": qry_cnt, # 요청개수 + "START_DATE_TIME": start_date_time, # 조회시작일시 + "CLOSE_DATE_TIME": close_date_time, # 조회종료일시 + "QRY_GAP": qry_gap, # 묶음개수 + "QRY_TP": qry_tp, # 조회구분 + "INDEX_KEY": index_key # 이전조회KEY + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_time_optchartprice( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) [v1_해외선물-005] +############################################################################################## + +def inquire_unpd( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + fuop_dvsn: str, # 선물옵션구분 + ctx_area_fk100: str, # 연속조회검색조건100 + ctx_area_nk100: str, # 연속조회키100 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 미결제내역조회(잔고)[v1_해외선물-005] + 해외선물옵션 미결제내역조회(잔고) API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + fuop_dvsn (str): 00: 전체 / 01:선물 / 02: 옵션 + ctx_area_fk100 (str): 연속조회검색조건100 + ctx_area_nk100 (str): 연속조회키100 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 미결제내역조회(잔고) 데이터 + + Example: + >>> df = inquire_unpd( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... fuop_dvsn="00", + ... ctx_area_fk100="", + ... ctx_area_nk100="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '80012345')") + raise ValueError("cano is required. (e.g. '80012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if fuop_dvsn not in ['00', '01', '02']: + logger.error("fuop_dvsn is required. (e.g. '00')") + raise ValueError("fuop_dvsn is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM1412R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/inquire-unpd" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "FUOP_DVSN": fuop_dvsn, + "CTX_AREA_FK100": ctx_area_fk100, + "CTX_AREA_NK100": ctx_area_nk100, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_unpd( + cano, + acnt_prdt_cd, + fuop_dvsn, + ctx_area_fk100, + ctx_area_nk100, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [해외선물-029] +############################################################################################## + +def investor_unpd_trend( + prod_iscd: str, # 상품 + bsop_date: str, # 일자 + upmu_gubun: str, # 구분 + cts_key: str, # CTS_KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 미결제추이[해외선물-029] + 해외선물 미결제추이 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prod_iscd (str): 금리 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG), 농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX) + bsop_date (str): 기준일(ex)20240513) + upmu_gubun (str): 0(수량), 1(증감) + cts_key (str): 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 미결제추이 데이터 + + Example: + >>> df1, df2 = investor_unpd_trend( + ... prod_iscd="ES", + ... bsop_date="20240624", + ... upmu_gubun="0", + ... cts_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not prod_iscd: + logger.error("prod_iscd is required. (e.g. 'ES')") + raise ValueError("prod_iscd is required. (e.g. 'ES')") + if not bsop_date: + logger.error("bsop_date is required. (e.g. '20240624')") + raise ValueError("bsop_date is required. (e.g. '20240624')") + if not upmu_gubun: + logger.error("upmu_gubun is required. (e.g. '0')") + raise ValueError("upmu_gubun is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDDB95030000" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/investor-unpd-trend" + + + + params = { + "PROD_ISCD": prod_iscd, + "BSOP_DATE": bsop_date, + "UPMU_GUBUN": upmu_gubun, + "CTS_KEY": cts_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return investor_unpd_trend( + prod_iscd, + bsop_date, + upmu_gubun, + cts_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 증거금상세 [해외선물-032] +############################################################################################## + +def margin_detail( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + crcy_cd: str, # 통화코드 + inqr_dt: str, # 조회일자 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 증거금상세[해외선물-032] + 해외선물옵션 증거금상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (8자리) + acnt_prdt_cd (str): 계좌상품코드 (2자리) + crcy_cd (str): 통화코드 ('TKR', 'TUS', 'USD', 'HKD', 'CNY', 'JPY', 'VND') + inqr_dt (str): 조회일자 (8자리, YYYYMMDD 형식) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 증거금상세 데이터 + + Example: + >>> df = margin_detail( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... crcy_cd="USD", + ... inqr_dt="20230701" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'USD')") + raise ValueError("crcy_cd is required. (e.g. 'USD')") + if not inqr_dt: + logger.error("inqr_dt is required. (e.g. '20230701')") + raise ValueError("inqr_dt is required. (e.g. '20230701')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM3115R" + + + api_url = "/uapi/overseas-futureoption/v1/trading/margin-detail" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "CRCY_CD": crcy_cd, + "INQR_DT": inqr_dt, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return margin_detail( + cano, + acnt_prdt_cd, + crcy_cd, + inqr_dt, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물옵션 장운영시간 [해외선물-030] +############################################################################################## + +def market_time( + fm_pdgr_cd: str, # FM상품군코드 + fm_clas_cd: str, # FM클래스코드 + fm_excg_cd: str, # FM거래소코드 + opt_yn: str, # 옵션여부 + ctx_area_nk200: str, # 연속조회키200 + ctx_area_fk200: str, # 연속조회검색조건200 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물옵션 장운영시간[해외선물-030] + 해외선물옵션 장운영시간 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fm_pdgr_cd (str): FM상품군코드 + fm_clas_cd (str): FM클래스코드 + fm_excg_cd (str): FM거래소코드 + opt_yn (str): 옵션여부 + ctx_area_nk200 (str): 연속조회키200 + ctx_area_fk200 (str): 연속조회검색조건200 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 장운영시간 데이터 + + Example: + >>> df = market_time( + ... fm_pdgr_cd="001", + ... fm_clas_cd="003", + ... fm_excg_cd="CME", + ... opt_yn="N", + ... ctx_area_nk200="", + ... ctx_area_fk200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not fm_excg_cd: + logger.error("fm_excg_cd is required. (e.g. 'CME')") + raise ValueError("fm_excg_cd is required. (e.g. 'CME')") + if not opt_yn: + logger.error("opt_yn is required. (e.g. 'N')") + raise ValueError("opt_yn is required. (e.g. 'N')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "OTFM2229R" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/market-time" + + + + params = { + "FM_PDGR_CD": fm_pdgr_cd, + "FM_CLAS_CD": fm_clas_cd, + "FM_EXCG_CD": fm_excg_cd, + "OPT_YN": opt_yn, + "CTX_AREA_NK200": ctx_area_nk200, + "CTX_AREA_FK200": ctx_area_fk200, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, ctx_area_nk200, ctx_area_fk200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return market_time( + fm_pdgr_cd, + fm_clas_cd, + fm_excg_cd, + opt_yn, + ctx_area_nk200, + ctx_area_fk200, + "N", + dataframe, + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] +############################################################################################## + +def monthly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(월간)[해외선물-020] + 해외선물 체결추이(월간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: '6AM24') + exch_cd (str): 거래소코드 (예: 'CME') + start_date_time (str): 조회시작일시 (공백 허용) + close_date_time (str): 조회종료일시 (예: '20240402') + qry_tp (str): 조회구분 ('Q': 최초조회, 'P': 다음키 입력하여 조회) + qry_cnt (str): 요청개수 (예: '30', 최대 '40') + qry_gap (str): 묶음개수 (공백 허용) + index_key (str): 이전조회KEY (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(월간) 데이터 + + Example: + >>> df1, df2 = monthly_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. ('Q' or 'P')") + raise ValueError("qry_tp is required. ('Q' or 'P')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020300" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/monthly-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return monthly_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] +############################################################################################## + +def opt_asking_price( + srs_cd: str, # 종목명 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외옵션 호가[해외선물-033] + 해외옵션 호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목명 (예: 'OTXM24 C22000') + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외옵션 호가 데이터 + + Example: + >>> df1, df2 = opt_asking_price(srs_cd="OTXM24 C22000") + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. 'OTXM24 C22000')") + raise ValueError("srs_cd is required. (e.g. 'OTXM24 C22000')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFO86000000" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-asking-price" + + + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return opt_asking_price( + srs_cd, + dataframe1, dataframe2, tr_cont, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(일간) [해외선물-037] +############################################################################################## + +def opt_daily_ccnl( + srs_cd: str, # [필수] 종목코드 (ex. OESU24 C5500) + exch_cd: str, # [필수] 거래소코드 (ex. CME) + qry_cnt: str, # [필수] 요청개수 (ex. 20) + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(일간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. ("QRY_CNT: 119 입력", START_DATE_TIME, CLOSE_DATE_TIME은 공란) + + ※ 호출 시 유의사항 + : START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력, QRY_CNT는 확인 데이터 개수의 -1 개 입력 + ex) "START_DATE_TIME":"","CLOSE_DATE_TIME":"","QRY_CNT":"119" → 최근 120건 데이터 조회 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> result1, result2 = opt_daily_ccnl("OESU24 C5500", "CME", "20") + >>> print(result1) + >>> print(result2) + """ + + # 필수 파라미터 검증 + if srs_cd == "" or srs_cd is None: + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "" or exch_cd is None: + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "" or qry_cnt is None: + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020100" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-daily-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_daily_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목상세 [해외선물-034] +############################################################################################## + +def opt_detail( + srs_cd: str # [필수] 종목명 +) -> pd.DataFrame: + """ + 해외옵션종목상세 API입니다. + + (주의) sstl_price 자리에 정산가 X 전일종가 O 가 수신되는 점 유의 부탁드립니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목명 + + Returns: + pd.DataFrame: 해외옵션종목상세 데이터 + + Raises: + ValueError: 필수 파라미터 누락 시 + + Examples: + >>> df = opt_detail("C5500") + >>> print(df) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'C5500')") + + tr_id = "HHDFO55010100" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-detail" + + + + params = { + "SRS_CD": srs_cd + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(월간) [해외선물-039] +############################################################################################## + +def opt_monthly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(월간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. (START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력) + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 (ex. "") + close_date_time (str): 조회종료일시 (ex. "") + qry_gap (str): 묶음개수 (ex. "") + qry_tp (str): 조회구분 (ex. "") + index_key (str): 이전조회KEY (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외옵션 체결추이(월간) 정보 (output1, output2) + + Example: + >>> result1, result2 = opt_monthly_ccnl("OESU24 C5500", "CME", "20") + >>> print(result1) + >>> print(result2) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020300" # 해외옵션 체결추이(월간) + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-monthly-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data1 = pd.DataFrame([res.getBody().output1]) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_monthly_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션종목현재가 [해외선물-035] +############################################################################################## + +def opt_price( + srs_cd: str # 종목코드 +) -> pd.DataFrame: + """ + 해외옵션종목현재가 API입니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 + + Returns: + pd.DataFrame: 해외옵션종목현재가 데이터 + + Example: + >>> df = opt_price(srs_cd="DXM24") + >>> print(df) + """ + + if srs_cd == "": + raise ValueError("srs_cd is required") + + tr_id = "HHDFO55010000" # 해외옵션종목현재가 + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-price" + + + + params = { + "SRS_CD": srs_cd # 종목코드 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(틱) [해외선물-038] +############################################################################################## + +def opt_tick_ccnl( + srs_cd: str, # [필수] 종목코드 + exch_cd: str, # [필수] 거래소코드 + qry_cnt: str, # [필수] 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(틱) API입니다. + 한 번의 호출에 40건까지 확인 가능하며, QRY_TP, INDEX_KEY 를 이용하여 다음조회 가능합니다. + + ※ 다음조회 방법 + (처음조회) "QRY_TP":"Q", "QRY_CNT":"40", "INDEX_KEY":"" + (다음조회) "QRY_TP":"P", "QRY_CNT":"40", "INDEX_KEY":"20240906 221" ◀ 이전 호출의 "output1 > index_key" 기입 + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Raises: + ValueError: 필수 파라미터가 누락된 경우 + + Example: + >>> df1, df2 = opt_tick_ccnl("OESU24 C5500", "CME", "20") + >>> print(df1) # output1 데이터 + >>> print(df2) # output2 데이터 + """ + + # 필수 파라미터 검증 + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020200" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-tick-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "QRY_CNT": qry_cnt, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_GAP": qry_gap, + "QRY_TP": qry_tp, + "INDEX_KEY": index_key + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_tick_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 체결추이(주간) [해외선물-036] +############################################################################################## + +def opt_weekly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + qry_cnt: str, # 요청개수 + start_date_time: str = "", # 조회시작일시 + close_date_time: str = "", # 조회종료일시 + qry_gap: str = "", # 묶음개수 + qry_tp: str = "", # 조회구분 + index_key: str = "", # 이전조회KEY + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # output1 누적 데이터프레임 + dataframe2: Optional[pd.DataFrame] = None, # output2 누적 데이터프레임 + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외옵션 체결추이(주간) API입니다. + 최근 120건까지 데이터 확인이 가능합니다. (START_DATE_TIME, CLOSE_DATE_TIME은 공란 입력) + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + srs_cd (str): [필수] 종목코드 (ex. OESU24 C5500) + exch_cd (str): [필수] 거래소코드 (ex. CME) + qry_cnt (str): [필수] 요청개수 (ex. 20) + start_date_time (str): 조회시작일시 + close_date_time (str): 조회종료일시 + qry_gap (str): 묶음개수 + qry_tp (str): 조회구분 + index_key (str): 이전조회KEY + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): output1 누적 데이터프레임 + dataframe2 (Optional[pd.DataFrame]): output2 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: output1과 output2 데이터프레임 튜플 + + Example: + >>> df1, df2 = opt_weekly_ccnl(srs_cd="OESU24 C5500", exch_cd="CME", qry_cnt="20") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if srs_cd == "": + raise ValueError("srs_cd is required (e.g. 'OESU24 C5500')") + + if exch_cd == "": + raise ValueError("exch_cd is required (e.g. 'CME')") + + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. '20')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFO55020000" # 해외옵션 체결추이(주간) + + + api_url = "/uapi/overseas-futureoption/v1/quotations/opt-weekly-ccnl" + + + + params = { + "SRS_CD": srs_cd, # 종목코드 + "EXCH_CD": exch_cd, # 거래소코드 + "QRY_CNT": qry_cnt, # 요청개수 + "START_DATE_TIME": start_date_time, # 조회시작일시 + "CLOSE_DATE_TIME": close_date_time, # 조회종료일시 + "QRY_GAP": qry_gap, # 묶음개수 + "QRY_TP": qry_tp, # 조회구분 + "INDEX_KEY": index_key # 이전조회KEY + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + # 다음 페이지 정보 확인 + tr_cont = res.getHeader().tr_cont + index_key = res.getBody().output1["index_key"] + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return opt_weekly_ccnl( + srs_cd, exch_cd, qry_cnt, start_date_time, close_date_time, + qry_gap, qry_tp, index_key, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문[v1_해외선물-001] +############################################################################################## + +def order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_futr_fx_pdno: str, # 해외선물FX상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + fm_lqd_ustl_ccld_dt: str, # FM청산미결제체결일자 + fm_lqd_ustl_ccno: str, # FM청산미결제체결번호 + pric_dvsn_cd: str, # 가격구분코드 + fm_limit_ord_pric: str, # FMLIMIT주문가격 + fm_stop_ord_pric: str, # FMSTOP주문가격 + fm_ord_qty: str, # FM주문수량 + fm_lqd_lmt_ord_pric: str, # FM청산LIMIT주문가격 + fm_lqd_stop_ord_pric: str, # FM청산STOP주문가격 + ccld_cndt_cd: str, # 체결조건코드 + cplx_ord_dvsn_cd: str, # 복합주문구분코드 + ecis_rsvn_ord_yn: str, # 행사예약주문여부 + fm_hdge_ord_scrn_yn: str, # FM_HEDGE주문화면여부 + +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 주문[v1_해외선물-001] + 해외선물옵션 주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_futr_fx_pdno (str): 해외선물FX상품번호 + sll_buy_dvsn_cd (str): 01 : 매도 02 : 매수 + fm_lqd_ustl_ccld_dt (str): 빈칸 (hedge청산만 이용) + fm_lqd_ustl_ccno (str): 빈칸 (hedge청산만 이용) + pric_dvsn_cd (str): 1.지정, 2. 시장, 3. STOP, 4 S/L + fm_limit_ord_pric (str): 지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력 + fm_stop_ord_pric (str): STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력 + fm_ord_qty (str): FM주문수량 + fm_lqd_lmt_ord_pric (str): 빈칸 (hedge청산만 이용) + fm_lqd_stop_ord_pric (str): 빈칸 (hedge청산만 이용) + ccld_cndt_cd (str): 일반적으로 6 (EOD, 지정가) GTD인 경우 5, 시장가인 경우만 2 + cplx_ord_dvsn_cd (str): 0 (hedge청산만 이용) + ecis_rsvn_ord_yn (str): N + fm_hdge_ord_scrn_yn (str): N + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 주문 데이터 + + Example: + >>> df = order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_futr_fx_pdno="6BZ22", + ... sll_buy_dvsn_cd="02", + ... fm_lqd_ustl_ccld_dt="", + ... fm_lqd_ustl_ccno="", + ... pric_dvsn_cd="1", + ... fm_limit_ord_pric="1.17", + ... fm_stop_ord_pric="", + ... fm_ord_qty="1", + ... fm_lqd_lmt_ord_pric="", + ... fm_lqd_stop_ord_pric="", + ... ccld_cndt_cd="6", + ... cplx_ord_dvsn_cd="0", + ... ecis_rsvn_ord_yn="N", + ... fm_hdge_ord_scrn_yn="N" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81012345')") + raise ValueError("cano is required. (e.g. '81012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not ovrs_futr_fx_pdno: + logger.error("ovrs_futr_fx_pdno is required. (e.g. '1AALN25 C10.0')") + raise ValueError("ovrs_futr_fx_pdno is required. (e.g. '1AALN25 C10.0')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '02')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '02')") + if not pric_dvsn_cd: + logger.error("pric_dvsn_cd is required. (e.g. '1')") + raise ValueError("pric_dvsn_cd is required. (e.g. '1')") + if not fm_ord_qty: + logger.error("fm_ord_qty is required. (e.g. '1')") + raise ValueError("fm_ord_qty is required. (e.g. '1')") + if not ccld_cndt_cd: + logger.error("ccld_cndt_cd is required. (e.g. '6')") + raise ValueError("ccld_cndt_cd is required. (e.g. '6')") + + tr_id = "OTFM3001U" + + + api_url = "/uapi/overseas-futureoption/v1/trading/order" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_FUTR_FX_PDNO": ovrs_futr_fx_pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "FM_LQD_USTL_CCLD_DT": fm_lqd_ustl_ccld_dt, + "FM_LQD_USTL_CCNO": fm_lqd_ustl_ccno, + "PRIC_DVSN_CD": pric_dvsn_cd, + "FM_LIMIT_ORD_PRIC": fm_limit_ord_pric, + "FM_STOP_ORD_PRIC": fm_stop_ord_pric, + "FM_ORD_QTY": fm_ord_qty, + "FM_LQD_LMT_ORD_PRIC": fm_lqd_lmt_ord_pric, + "FM_LQD_STOP_ORD_PRIC": fm_lqd_stop_ord_pric, + "CCLD_CNDT_CD": ccld_cndt_cd, + "CPLX_ORD_DVSN_CD": cplx_ord_dvsn_cd, + "ECIS_RSVN_ORD_YN": ecis_rsvn_ord_yn, + "FM_HDGE_ORD_SCRN_YN": fm_hdge_ord_scrn_yn, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문[v1_해외선물-002, 003] +############################################################################################## + +def order_rvsecncl( + cano: str, # 종합계좌번호 + ord_dv: str, # 주문구분 + acnt_prdt_cd: str, # 계좌상품코드 + orgn_ord_dt: str, # 원주문일자 + orgn_odno: str, # 원주문번호 + fm_limit_ord_pric: str, # FMLIMIT주문가격 + fm_stop_ord_pric: str, # FMSTOP주문가격 + fm_lqd_lmt_ord_pric: str, # FM청산LIMIT주문가격 + fm_lqd_stop_ord_pric: str, # FM청산STOP주문가격 + fm_hdge_ord_scrn_yn: str, # FM_HEDGE주문화면여부 + fm_mkpr_cvsn_yn: str, # FM시장가전환여부 + +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 주문/계좌 + 해외선물옵션 정정취소주문[v1_해외선물-002, 003] + 해외선물옵션 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + ord_dv (str): 주문구분 (0:정정, 1:취소) + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + orgn_ord_dt (str): 원 주문 시 출력되는 ORD_DT 값을 입력 (현지거래일) + orgn_odno (str): 정정/취소시 주문번호(ODNO) 8자리를 문자열처럼 "0"을 포함해서 전송 (원 주문 시 출력된 ODNO 값 활용) (ex. ORGN_ODNO : 00360686) + fm_limit_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_stop_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_lqd_lmt_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_lqd_stop_ord_pric (str): OTFM3002U(해외선물옵션주문정정)만 사용 + fm_hdge_ord_scrn_yn (str): N + fm_mkpr_cvsn_yn (str): OTFM3003U(해외선물옵션주문취소)만 사용 ※ FM_MKPR_CVSN_YN 항목에 'Y'로 설정하여 취소주문을 접수할 경우, 주문 취소확인이 들어오면 원장에서 시장가주문을 하나 또 내줌 + + Returns: + Optional[pd.DataFrame]: 해외선물옵션 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... ord_dv="0", + ... acnt_prdt_cd=trenv.my_prod, + ... orgn_ord_dt="20250630", + ... orgn_odno="00360686", + ... fm_limit_ord_pric="", + ... fm_stop_ord_pric="", + ... fm_lqd_lmt_ord_pric="", + ... fm_lqd_stop_ord_pric="", + ... fm_hdge_ord_scrn_yn="N", + ... fm_mkpr_cvsn_yn="N" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81012345')") + raise ValueError("cano is required. (e.g. '81012345')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '08')") + raise ValueError("acnt_prdt_cd is required. (e.g. '08')") + if not orgn_ord_dt: + logger.error("orgn_ord_dt is required. (e.g. '20250630')") + raise ValueError("orgn_ord_dt is required. (e.g. '20250630')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '00360686')") + raise ValueError("orgn_odno is required. (e.g. '00360686')") + + if ord_dv == "0": + tr_id = "OTFM3002U" + elif ord_dv == "1": + tr_id = "OTFM3003U" + else: + logger.error("ord_dv is required. (e.g. '0' or '1')") + raise ValueError("ord_dv is required. (e.g. '0' or '1')") + + + api_url = "/uapi/overseas-futureoption/v1/trading/order-rvsecncl" + + + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ORGN_ORD_DT": orgn_ord_dt, + "ORGN_ODNO": orgn_odno, + "FM_LIMIT_ORD_PRIC": fm_limit_ord_pric, + "FM_STOP_ORD_PRIC": fm_stop_ord_pric, + "FM_LQD_LMT_ORD_PRIC": fm_lqd_lmt_ord_pric, + "FM_LQD_STOP_ORD_PRIC": fm_lqd_stop_ord_pric, + "FM_HDGE_ORD_SCRN_YN": fm_hdge_ord_scrn_yn, + "FM_MKPR_CVSN_YN": fm_mkpr_cvsn_yn, + } + + logger.info("Calling API with parameters: %s", params) + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보[해외선물-023] +############################################################################################## + +def search_contract_detail( + qry_cnt: str, # 요청개수 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10, + **kwargs # srs_cd_01, srs_cd_02, ... srs_cd_32 등을 받음 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 상품기본정보[해외선물-023] + 해외선물 상품기본정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + qry_cnt (str): 입력한 코드 개수 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + **kwargs: srs_cd_01, srs_cd_02, ... srs_cd_32 품목종류 코드들 + + Returns: + Optional[pd.DataFrame]: 해외선물 상품기본정보 데이터 + + Example: + >>> df = search_contract_detail( + ... qry_cnt="3", + ... srs_cd_01="SRS001", + ... srs_cd_02="SRS002", + ... srs_cd_03="SRS003" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not 1 <= int(qry_cnt) <= 32: + logger.error("qry_cnt is required. (e.g. '1' ~ '32')") + raise ValueError("qry_cnt is required. (e.g. '1' ~ '32')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55200000" + + # 기본 파라미터 + + api_url = "/uapi/overseas-futureoption/v1/quotations/search-contract-detail" + + + params = { + "QRY_CNT": qry_cnt, + } + + # SRS_CD_01 ~ SRS_CD_32 파라미터 동적 생성 + for i in range(1, 33): + srs_key = f"srs_cd_{i:02d}" + api_key = f"SRS_CD_{i:02d}" + params[api_key] = kwargs.get(srs_key, "") + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return search_contract_detail( + qry_cnt, "N", dataframe, depth + 1, max_depth, **kwargs + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 상품기본정보 [해외선물-041] +############################################################################################## + +def search_opt_detail( + qry_cnt: str, # [필수] 요청개수 (SRS_CD_N 개수) + srs_cd_01: str, # [필수] 종목코드1 + srs_cd_02: Optional[str] = "", # 종목코드2 + srs_cd_03: Optional[str] = "", # 종목코드3 + srs_cd_04: Optional[str] = "", # 종목코드4 + srs_cd_05: Optional[str] = "", # 종목코드5 + srs_cd_06: Optional[str] = "", # 종목코드6 + srs_cd_07: Optional[str] = "", # 종목코드7 + srs_cd_08: Optional[str] = "", # 종목코드8 + srs_cd_09: Optional[str] = "", # 종목코드9 + srs_cd_10: Optional[str] = "", # 종목코드10 + srs_cd_11: Optional[str] = "", # 종목코드11 + srs_cd_12: Optional[str] = "", # 종목코드12 + srs_cd_13: Optional[str] = "", # 종목코드13 + srs_cd_14: Optional[str] = "", # 종목코드14 + srs_cd_15: Optional[str] = "", # 종목코드15 + srs_cd_16: Optional[str] = "", # 종목코드16 + srs_cd_17: Optional[str] = "", # 종목코드17 + srs_cd_18: Optional[str] = "", # 종목코드18 + srs_cd_19: Optional[str] = "", # 종목코드19 + srs_cd_20: Optional[str] = "", # 종목코드20 + srs_cd_21: Optional[str] = "", # 종목코드21 + srs_cd_22: Optional[str] = "", # 종목코드22 + srs_cd_23: Optional[str] = "", # 종목코드23 + srs_cd_24: Optional[str] = "", # 종목코드24 + srs_cd_25: Optional[str] = "", # 종목코드25 + srs_cd_26: Optional[str] = "", # 종목코드26 + srs_cd_27: Optional[str] = "", # 종목코드27 + srs_cd_28: Optional[str] = "", # 종목코드28 + srs_cd_29: Optional[str] = "", # 종목코드29 + srs_cd_30: Optional[str] = "" # 종목코드30 +) -> pd.DataFrame: + """ + 해외옵션 상품기본정보 API입니다. + + (중요) 해외옵션시세 출력값을 해석하실 때 focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + - focode.mst(해외지수옵션 종목마스터파일), (해외주식옵션 종목마스터파일) 다운로드 방법 + 1) focode.mst(해외지수옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외옵션정보.h)를 참고하여 해석 + 2) fostkcode.mst(해외주식옵션 종목마스터파일) + : 포럼 > FAQ > 종목정보 다운로드(해외) - 해외주식옵션 클릭하여 다운로드 후 + Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외주식옵션정보.h)를 참고하여 해석 + + - 소수점 계산 시, focode.mst(해외지수옵션 종목마스터파일), fostkcode.mst(해외주식옵션 종목마스터파일)의 sCalcDesz(계산 소수점) 값 참고 + EX) focode.mst 파일의 sCalcDesz(계산 소수점) 값 + 품목코드 OES 계산소수점 -2 → 시세 7525 수신 시 75.25 로 해석 + 품목코드 O6E 계산소수점 -4 → 시세 54.0 수신 시 0.0054 로 해석 + + Args: + qry_cnt (str): [필수] 요청개수 (ex. SRS_CD_N 개수) + srs_cd_01 (str): [필수] 종목코드1 + srs_cd_02 (Optional[str]): 종목코드2 + srs_cd_03 (Optional[str]): 종목코드3 + srs_cd_04 (Optional[str]): 종목코드4 + srs_cd_05 (Optional[str]): 종목코드5 + srs_cd_06 (Optional[str]): 종목코드6 + srs_cd_07 (Optional[str]): 종목코드7 + srs_cd_08 (Optional[str]): 종목코드8 + srs_cd_09 (Optional[str]): 종목코드9 + srs_cd_10 (Optional[str]): 종목코드10 + srs_cd_11 (Optional[str]): 종목코드11 + srs_cd_12 (Optional[str]): 종목코드12 + srs_cd_13 (Optional[str]): 종목코드13 + srs_cd_14 (Optional[str]): 종목코드14 + srs_cd_15 (Optional[str]): 종목코드15 + srs_cd_16 (Optional[str]): 종목코드16 + srs_cd_17 (Optional[str]): 종목코드17 + srs_cd_18 (Optional[str]): 종목코드18 + srs_cd_19 (Optional[str]): 종목코드19 + srs_cd_20 (Optional[str]): 종목코드20 + srs_cd_21 (Optional[str]): 종목코드21 + srs_cd_22 (Optional[str]): 종목코드22 + srs_cd_23 (Optional[str]): 종목코드23 + srs_cd_24 (Optional[str]): 종목코드24 + srs_cd_25 (Optional[str]): 종목코드25 + srs_cd_26 (Optional[str]): 종목코드26 + srs_cd_27 (Optional[str]): 종목코드27 + srs_cd_28 (Optional[str]): 종목코드28 + srs_cd_29 (Optional[str]): 종목코드29 + srs_cd_30 (Optional[str]): 종목코드30 + + Returns: + pd.DataFrame: 해외옵션 상품기본정보 데이터 + + Example: + >>> df = search_opt_detail(qry_cnt="1", srs_cd_01="6AM24") + >>> print(df) + """ + + # 필수 파라미터 검증 + if qry_cnt == "": + raise ValueError("qry_cnt is required (e.g. 'SRS_CD_N 개수')") + + if srs_cd_01 == "": + raise ValueError("srs_cd_01 is required") + + tr_id = "HHDFO55200000" # 해외옵션 상품기본정보 + + + api_url = "/uapi/overseas-futureoption/v1/quotations/search-opt-detail" + + + + params = { + "QRY_CNT": qry_cnt, + "SRS_CD_01": srs_cd_01 + } + + # 옵션 파라미터 추가 + if srs_cd_02: + params["SRS_CD_02"] = srs_cd_02 + if srs_cd_03: + params["SRS_CD_03"] = srs_cd_03 + if srs_cd_04: + params["SRS_CD_04"] = srs_cd_04 + if srs_cd_05: + params["SRS_CD_05"] = srs_cd_05 + if srs_cd_06: + params["SRS_CD_06"] = srs_cd_06 + if srs_cd_07: + params["SRS_CD_07"] = srs_cd_07 + if srs_cd_08: + params["SRS_CD_08"] = srs_cd_08 + if srs_cd_09: + params["SRS_CD_09"] = srs_cd_09 + if srs_cd_10: + params["SRS_CD_10"] = srs_cd_10 + if srs_cd_11: + params["SRS_CD_11"] = srs_cd_11 + if srs_cd_12: + params["SRS_CD_12"] = srs_cd_12 + if srs_cd_13: + params["SRS_CD_13"] = srs_cd_13 + if srs_cd_14: + params["SRS_CD_14"] = srs_cd_14 + if srs_cd_15: + params["SRS_CD_15"] = srs_cd_15 + if srs_cd_16: + params["SRS_CD_16"] = srs_cd_16 + if srs_cd_17: + params["SRS_CD_17"] = srs_cd_17 + if srs_cd_18: + params["SRS_CD_18"] = srs_cd_18 + if srs_cd_19: + params["SRS_CD_19"] = srs_cd_19 + if srs_cd_20: + params["SRS_CD_20"] = srs_cd_20 + if srs_cd_21: + params["SRS_CD_21"] = srs_cd_21 + if srs_cd_22: + params["SRS_CD_22"] = srs_cd_22 + if srs_cd_23: + params["SRS_CD_23"] = srs_cd_23 + if srs_cd_24: + params["SRS_CD_24"] = srs_cd_24 + if srs_cd_25: + params["SRS_CD_25"] = srs_cd_25 + if srs_cd_26: + params["SRS_CD_26"] = srs_cd_26 + if srs_cd_27: + params["SRS_CD_27"] = srs_cd_27 + if srs_cd_28: + params["SRS_CD_28"] = srs_cd_28 + if srs_cd_29: + params["SRS_CD_29"] = srs_cd_29 + if srs_cd_30: + params["SRS_CD_30"] = srs_cd_30 + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + # 메타데이터에 따라 output2 (array)를 pd.DataFrame으로 반환 + return pd.DataFrame(res.getBody().output2) + else: + res.printError(url=api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목상세[v1_해외선물-008] +############################################################################################## + +def stock_detail( + srs_cd: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물종목상세[v1_해외선물-008] + 해외선물종목상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): ex) CNHU24 ※ 종목코드 "포럼 > FAQ > 종목정보 다운로드(해외) - 해외지수선물" 참고 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외선물종목상세 데이터 + + Example: + >>> df = stock_detail(srs_cd="6AU22") + >>> print(df) + """ + # 필수 파라미터 검증 + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AU22')") + raise ValueError("srs_cd is required. (e.g. '6AU22')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFC55010100" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/stock-detail" + + + + params = { + "SRS_CD": srs_cd, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return stock_detail( + srs_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] +############################################################################################## + +def tick_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(틱)[해외선물-019] + 해외선물 체결추이(틱) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드 (예: '6AM24') + exch_cd (str): 거래소코드 (예: 'CME') + start_date_time (str): 조회시작일시 (공백 허용) + close_date_time (str): 조회종료일시 (예: '20240402') + qry_tp (str): 조회구분 ('Q': 최초조회, 'P': 다음키 입력하여 조회) + qry_cnt (str): 요청개수 (예: '30', 최대 '40') + qry_gap (str): 묶음개수 (공백 허용) + index_key (str): 이전조회KEY (공백 허용) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(틱) 데이터 + + Example: + >>> df1, df2 = tick_ccnl( + ... srs_cd="BONU25", + ... exch_cd="EUREX", + ... start_date_time="", + ... close_date_time="20250630", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_tp: + logger.error("qry_tp is required. ('Q' or 'P')") + raise ValueError("qry_tp is required. ('Q' or 'P')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020200" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/tick-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return tick_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, dataframe2, "N", depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] +############################################################################################## + +def weekly_ccnl( + srs_cd: str, # 종목코드 + exch_cd: str, # 거래소코드 + start_date_time: str, # 조회시작일시 + close_date_time: str, # 조회종료일시 + qry_tp: str, # 조회구분 + qry_cnt: str, # 요청개수 + qry_gap: str, # 묶음개수 + index_key: str, # 이전조회KEY + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외선물옵션] 기본시세 + 해외선물 체결추이(주간)[해외선물-017] + 해외선물 체결추이(주간) API를 호출하여 DataFrame으로 반환합니다. + + Args: + srs_cd (str): 종목코드, 예) 6AM24 + exch_cd (str): 거래소코드, 예) CME + start_date_time (str): 조회시작일시, 공백 + close_date_time (str): 조회종료일시, 예) 20240402 + qry_tp (str): 조회구분, Q : 최초조회시 , P : 다음키(INDEX_KEY) 입력하여 조회시 + qry_cnt (str): 요청개수, 예) 30 (최대 40) + qry_gap (str): 묶음개수, 공백 (분만 사용) + index_key (str): 이전조회KEY, 공백 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외선물 체결추이(주간) 데이터 + + Example: + >>> df1, df2 = weekly_ccnl( + ... srs_cd="6AM24", + ... exch_cd="CME", + ... start_date_time="", + ... close_date_time="20240402", + ... qry_tp="Q", + ... qry_cnt="30", + ... qry_gap="", + ... index_key="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not srs_cd: + logger.error("srs_cd is required. (e.g. '6AM24')") + raise ValueError("srs_cd is required. (e.g. '6AM24')") + if not exch_cd: + logger.error("exch_cd is required. (e.g. 'CME')") + raise ValueError("exch_cd is required. (e.g. 'CME')") + if not close_date_time: + logger.error("close_date_time is required. (e.g. '20240402')") + raise ValueError("close_date_time is required. (e.g. '20240402')") + if not qry_cnt: + logger.error("qry_cnt is required. (e.g. '30')") + raise ValueError("qry_cnt is required. (e.g. '30')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFC55020000" + + + api_url = "/uapi/overseas-futureoption/v1/quotations/weekly-ccnl" + + + + params = { + "SRS_CD": srs_cd, + "EXCH_CD": exch_cd, + "START_DATE_TIME": start_date_time, + "CLOSE_DATE_TIME": close_date_time, + "QRY_TP": qry_tp, + "QRY_CNT": qry_cnt, + "QRY_GAP": qry_gap, + "INDEX_KEY": index_key, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return weekly_ccnl( + srs_cd, + exch_cd, + start_date_time, + close_date_time, + qry_tp, + qry_cnt, + qry_gap, + index_key, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + diff --git a/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions_ws.py b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions_ws.py new file mode 100644 index 0000000..e2bb031 --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_futureoption/overseas_futureoption_functions_ws.py @@ -0,0 +1,324 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] +############################################################################################## + +def asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + [해외선물옵션]실시간시세 > 해외선물옵션 실시간호가[실시간-018] + + ※ CME, SGX 실시간시세 유료시세 신청 필수 (KIS포털 > FAQ > 자주 묻는 질문 > 해외선물옵션 API 유료시세 신청방법(CME, SGX 거래소)) + - CME, SGX 거래소 실시간시세는 유료시세 신청 후 이용하시는 모든 계좌에 대해서 접근토큰발급 API 호출하셔야 하며, + 접근토큰발급 이후 2시간 이내로 신청정보가 동기화되어 유료시세 수신이 가능해집니다. + - CME, SGX 거래소 종목은 유료시세 신청되어 있지 않으면 실시간시세 종목등록이 불가하며, + 등록 시도 시 "SUBSCRIBE ERROR : mci send failed" 에러가 발생합니다. + + (중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = asking_price("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF010" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "series_cd", + "recv_date", + "recv_time", + "prev_price", + "bid_qntt_1", + "bid_num_1", + "bid_price_1", + "ask_qntt_1", + "ask_num_1", + "ask_price_1", + "bid_qntt_2", + "bid_num_2", + "bid_price_2", + "ask_qntt_2", + "ask_num_2", + "ask_price_2", + "bid_qntt_3", + "bid_num_3", + "bid_price_3", + "ask_qntt_3", + "ask_num_3", + "ask_price_3", + "bid_qntt_4", + "bid_num_4", + "bid_price_4", + "ask_qntt_4", + "ask_num_4", + "ask_price_4", + "bid_qntt_5", + "bid_num_5", + "bid_price_5", + "ask_qntt_5", + "ask_num_5", + "ask_price_5", + "sttl_price" + ] + + return msg, columns + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결가[실시간-017] +############################################################################################## + +def ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + ※ CME, SGX 실시간시세 유료시세 신청 필수 (포럼 > FAQ > 해외선물옵션 API 유료시세 신청방법(CME, SGX 거래소)) + - CME, SGX 거래소 실시간시세는 유료시세 신청 후 이용하시는 모든 계좌에 대해서 접근토큰발급 API 호출하셔야 하며, + 접근토큰발급 이후 2시간 이내로 신청정보가 동기화되어 유료시세 수신이 가능해집니다. + - CME, SGX 거래소 종목은 유료시세 신청되어 있지 않으면 실시간시세 종목등록이 불가하며, + 등록 시도 시 "SUBSCRIBE ERROR : mci send failed" 에러가 발생합니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF020" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "series_cd", + "bsns_date", + "mrkt_open_date", + "mrkt_open_time", + "mrkt_close_date", + "mrkt_close_time", + "prev_price", + "recv_date", + "recv_time", + "active_flag", + "last_price", + "last_qntt", + "prev_diff_price", + "prev_diff_rate", + "open_price", + "high_price", + "low_price", + "vol", + "prev_sign", + "quotsign", + "recv_time2", + "psttl_price", + "psttl_sign", + "psttl_diff_price", + "psttl_diff_rate" + ] + + return msg, columns + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간체결내역통보[실시간-020] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외선물옵션 실시간체결내역통보 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF2C0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "acct_no", + "ord_dt", + "odno", + "orgn_ord_dt", + "orgn_odno", + "series", + "rvse_cncl_dvsn_cd", + "sll_buy_dvsn_cd", + "cplx_ord_dvsn_cd", + "prce_tp", + "fm_excg_rcit_dvsn_cd", + "ord_qty", + "fm_lmt_pric", + "fm_stop_ord_pric", + "tot_ccld_qty", + "tot_ccld_uv", + "ord_remq", + "fm_ord_grp_dt", + "ord_grp_stno", + "ord_dtl_dtime", + "oprt_dtl_dtime", + "work_empl", + "ccld_dt", + "ccno", + "api_ccno", + "ccld_qty", + "fm_ccld_pric", + "crcy_cd", + "trst_fee", + "ord_mdia_online_yn", + "fm_ccld_amt", + "fuop_item_dvsn_cd" + ] + + return msg, columns + +############################################################################################## +# [해외선물옵션]실시간시세 > 해외선물옵션 실시간주문내역통보[실시간-019] +############################################################################################## + +def order_notice( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + [참고자료] + 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. + https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] HTS ID + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = order_notice("1", trenv.my_htsid) + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFFF1C0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "acct_no", + "ord_dt", + "odno", + "orgn_ord_dt", + "orgn_odno", + "series", + "rvse_cncl_dvsn_cd", + "sll_buy_dvsn_cd", + "cplx_ord_dvsn_cd", + "prce_tp", + "fm_excg_rcit_dvsn_cd", + "ord_qty", + "fm_lmt_pric", + "fm_stop_ord_pric", + "tot_ccld_qty", + "tot_ccld_uv", + "ord_remq", + "fm_ord_grp_dt", + "ord_grp_stno", + "ord_dtl_dtime", + "oprt_dtl_dtime", + "work_empl", + "crcy_cd", + "lqd_yn", + "lqd_lmt_pric", + "lqd_stop_pric", + "trd_cond", + "term_ord_vald_dtime", + "spec_tp", + "ecis_rsvn_ord_yn", + "fuop_item_dvsn_cd", + "auto_ord_dvsn_cd" + ] + + return msg, columns + diff --git a/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples.py b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples.py new file mode 100644 index 0000000..285ba1b --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples.py @@ -0,0 +1,414 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from overseas_stock_functions import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +trenv = ka.getTREnv() + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가주문번호조회 [해외주식-071] +############################################################################################## + +result = algo_ordno(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, trad_dt="20250619") +print(result) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간주문 [v1_해외주식-026] +############################################################################################## + +df = daytime_order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, order_dv="buy", ovrs_excg_cd="NASD", pdno="AAPL", + ord_qty="10", ovrs_ord_unpr="150.50", ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0", + ord_dvsn="00") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간정정취소 [v1_해외주식-027] +############################################################################################## + +df = daytime_order_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", pdno="AAPL", + orgn_odno="1234567890", rvse_cncl_dvsn_cd="01", ord_qty="10", ovrs_ord_unpr="150.25", + ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 - 해외증거금 통화별조회 [해외주식-035] +############################################################################################## + +df = foreign_margin(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가체결내역조회 [해외주식-070] +############################################################################################## + +result, result3 = inquire_algo_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ) +print(result) +print(result3) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고 [v1_해외주식-006] +############################################################################################## + +df = inquire_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", tr_crcy_cd="USD") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문체결내역 [v1_해외주식-007] +############################################################################################## + +df = inquire_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="", ord_strt_dt="20250101", + ord_end_dt="20250131", sll_buy_dvsn="00", ccld_nccs_dvsn="00", ovrs_excg_cd="NASD", sort_sqn="DS", + ord_dt="", ord_gno_brno="", odno="", env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미체결내역 [v1_해외주식-005] +############################################################################################## + +df = inquire_nccs(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", sort_sqn="DS", FK200="", + NK200="", env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 결제기준잔고 [해외주식-064] +############################################################################################## + +df1, df2, df3 = inquire_paymt_stdr_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, bass_dt="20250630", + wcrc_frcr_dvsn_cd="01", inqr_dvsn_cd="00") +print(df1) +print(df2) +print(df3) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익 [v1_해외주식-032] +############################################################################################## + +df1, df2 = inquire_period_profit(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", natn_cd="", + crcy_cd="USD", pdno="", inqr_strt_dt="20230101", inqr_end_dt="20231231", + wcrc_frcr_dvsn_cd="01", FK200="", NK200="") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역 [해외주식-063] +############################################################################################## + +df1, df2 = inquire_period_trans(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, erlm_strt_dt="20240420", + erlm_end_dt="20240520", ovrs_excg_cd="NAS", pdno="", sll_buy_dvsn_cd="00", + loan_dvsn_cd="", FK100="", NK100="") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 [v1_해외주식-008] +############################################################################################## + +df1, df2, df3 = inquire_present_balance(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, wcrc_frcr_dvsn_cd="02", + natn_cd="000", tr_mket_cd="00", inqr_dvsn_cd="00", env_dv="real") +print(df1) +print(df2) +print(df3) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 매수가능금액조회 [v1_해외주식-014] +############################################################################################## + +df = inquire_psamount(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", ovrs_ord_unpr="1.4", + item_cd="QQQ", env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 시가총액순위[해외주식-047] +############################################################################################## + +result1, result2 = market_cap(excd="SZS", vol_rang="1") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] +############################################################################################## + +result1, result2 = new_highlow(excd="AMS", mixn="0", vol_rang="0", gubn="1", gubn2="1") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문 [v1_해외주식-001] +############################################################################################## + +df = order(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NASD", pdno="AAPL", ord_qty="10", + ovrs_ord_unpr="150.00", ord_dv="sell", ctac_tlno="", mgco_aptm_odno="", ord_svr_dvsn_cd="0", ord_dvsn="00", + env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수[v1_해외주식-002] +############################################################################################## + +result = order_resv(env_dv="real", ord_dv="usBuy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, + pdno="TSLA", ovrs_excg_cd="NASD", ft_ord_qty="1", ft_ord_unpr3="900") +print(result) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수취소[v1_해외주식-004] +############################################################################################## + +result = order_resv_ccnl( + env_dv="real", + nat_dv="us", + cano=trenv.my_acct, + acnt_prdt_cd=trenv.my_prod, + rsvn_ord_rcit_dt="20250610", + ovrs_rsvn_odno="0030008244" +) +print(result) + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문조회[v1_해외주식-013] +############################################################################################## + +df = order_resv_list(nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20220809", + inqr_end_dt="20220830", inqr_dvsn_cd="00", ovrs_excg_cd="NASD") +print(df) + +################################################################################ +# [해외주식] 주문/계좌 > 해외주식 정정취소주문[v1_해외주식-003] +################################################################################ + +df = order_rvsecncl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, ovrs_excg_cd="NYSE", pdno="BA", + orgn_odno="1234567890", rvse_cncl_dvsn_cd="01", ord_qty="100", ovrs_ord_unpr="0", mgco_aptm_odno="", + ord_svr_dvsn_cd="0", env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] +############################################################################################## + +result1, result2 = price_fluct(excd="NAS", gubn="0", mixn="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래증가율순위[해외주식-045] +############################################################################################## + +result1, result2 = trade_growth(excd="NAS", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래대금순위[해외주식-044] +############################################################################################## + +result1, result2 = trade_pbmn(excd="NAS", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] +############################################################################################## + +result1, result2 = trade_turnover(excd="SHS", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] +############################################################################################## + +result1, result2 = trade_vol(excd="HNX", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상승률/하락률[해외주식-041] +############################################################################################## + +result1, result2 = updown_rate(excd="SHS", gubn="1", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] +############################################################################################## + +result1, result2 = volume_power(excd="HKS", nday="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] +############################################################################################## + +result1, result2 = volume_surge(excd="NYS", mixn="0", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 시세분석 > 해외속보(제목) [해외주식-055] +############################################################################################## + +result = brknews_title(fid_news_ofer_entp_code="0", fid_cond_scr_div_code="11801") +print(result) + +############################################################################################## +# [해외주식] 시세분석 > 당사 해외주식담보대출 가능 종목 [해외주식-051] +############################################################################################## + +result1, result2 = colable_by_company(pdno="AMD", natn_cd="840", inqr_sqn_dvsn="01") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 기본시세 > 해외결제일자조회[해외주식-017] +############################################################################################## + +df = countries_holiday(trad_dt="20250131", NK="", FK="") +print(df) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 기간별시세[v1_해외주식-010] +############################################################################################## + +df1, df2 = dailyprice(auth="", excd="NAS", symb="TSLA", gubn="0", bymd="", modp="1", env_dv="real") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별코드조회[해외주식-049] +############################################################################################## + +result1, result2 = industry_price(excd="NAS") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별시세[해외주식-048] +############################################################################################## + +result1, result2 = industry_theme(excd="NAS", icod="010", vol_rang="0") +print(result1) +print(result2) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가 1호가[해외주식-033] +############################################################################################## + +df1, df2, df3 = inquire_asking_price(auth="", excd="NAS", symb="TSLA") +print(df1) +print(df2) +print(df3) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 체결추이[해외주식-037] +############################################################################################## + +result = quot_inquire_ccnl(excd="NAS", tday="0", symb="TSLA") +print(result) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] +############################################################################################## + +df1, df2 = inquire_daily_chartprice(fid_cond_mrkt_div_code="N", fid_input_iscd=".DJI", fid_input_date_1="20250101", + fid_input_date_2="20250131", fid_period_div_code="D", env_dv="real") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식조건검색[v1_해외주식-015] +############################################################################################## + +df1, df2 = inquire_search(auth="", excd="NYS", co_yn_pricecur="1", co_st_pricecur="100", co_en_pricecur="200", + co_yn_rate="1", co_st_rate="5", co_en_rate="10", co_yn_valx="1", co_st_valx="1000", + co_en_valx="5000", co_yn_shar="1", co_st_shar="100", co_en_shar="500", co_yn_volume="1", + co_st_volume="1000", co_en_volume="5000", co_yn_amt="1", co_st_amt="1000", co_en_amt="5000", + co_yn_eps="1", co_st_eps="1", co_en_eps="5", co_yn_per="1", co_st_per="10", co_en_per="20", + keyb="") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 기본시세 > 해외지수분봉조회[v1_해외주식-031] +############################################################################################## + +df1, df2 = inquire_time_indexchartprice(fid_cond_mrkt_div_code="N", fid_input_iscd="TSLA", fid_hour_cls_code="0", + fid_pw_data_incu_yn="Y") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식분봉조회[v1_해외주식-030] +############################################################################################## + +df1, df2 = inquire_time_itemchartprice(auth="", excd="NAS", symb="TSLA", nmin="5", pinc="1", next="", nrec="120", + fill="", keyb="") +print(df1) +print(df2) + +############################################################################################## +# [해외주식] 시세분석 > 해외뉴스종합(제목) [해외주식-053] +############################################################################################## + +result = news_title( + info_gb="", + class_cd="", + nation_cd="", + exchange_cd="", + symb="", + data_dt="", + data_tm="", + cts="" +) +print(result) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 기간별권리조회 [해외주식-052] +############################################################################################## + +result = period_rights( + rght_type_cd="%%", + inqr_dvsn_cd="02", + inqr_strt_dt="20240417", + inqr_end_dt="20240417" +) +print(result) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재체결가[v1_해외주식-009] +############################################################################################## + +df = price(auth="", excd="NAS", symb="AAPL", env_dv="real") +print(df) + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가상세[v1_해외주식-029] +############################################################################################## + +df = price_detail(auth="", excd="NAS", symb="TSLA") +print(df) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 권리종합 [해외주식-050] +############################################################################################## + +result = rights_by_ice(ncod="US", symb="NVDL") +print(result) + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상품기본정보[v1_해외주식-034] +############################################################################################## + +df = search_info(prdt_type_cd="512", pdno="AAPL") +print(df) diff --git a/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples_ws.py b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples_ws.py new file mode 100644 index 0000000..72b5b75 --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_examples_ws.py @@ -0,0 +1,52 @@ +import sys +import logging + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka +from overseas_stock_functions_ws import * + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +# 인증 +ka.auth() +ka.auth_ws() +trenv = ka.getTREnv() + +# 웹소켓 선언 +kws = ka.KISWebSocket(api_url="/tryitout") + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간호가[실시간-021] +############################################################################################## + +kws.subscribe(request=asking_price, data=["RBAQAAPL"]) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간체결통보[실시간-009] +############################################################################################## + +kws.subscribe(request=ccnl_notice, data=[trenv.my_htsid], kwargs={"env_dv": "real"}) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 지연호가(아시아)[실시간-008] +############################################################################################## + +kws.subscribe(request=delayed_asking_price_asia, data=["DHKS00003"]) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간지연체결가[실시간-007] +############################################################################################## + +kws.subscribe(request=delayed_ccnl, data=["DHKS00003"]) + + +# 시작 +def on_result(ws, tr_id, result, data_info): + print(result) + + +kws.start(on_result=on_result) diff --git a/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions.py b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions.py new file mode 100644 index 0000000..1454c66 --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions.py @@ -0,0 +1,5814 @@ +import logging +import time +import sys +from typing import Optional, Tuple + +import pandas as pd + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가주문번호조회 [해외주식-071] +############################################################################################## + +def algo_ordno( + cano: str, # [필수] 종합계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + trad_dt: str, # [필수] 거래일자 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + TWAP, VWAP 주문에 대한 주문번호를 조회하는 API + + Args: + cano (str): [필수] 종합계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + trad_dt (str): [필수] 거래일자 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 지정가주문번호 데이터 + + Example: + >>> df = algo_ordno(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, trad_dt="20250619") + >>> print(df) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if trad_dt == "": + raise ValueError("trad_dt is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "TTTS6058R" # 해외주식 지정가주문번호조회 + + api_url = "/uapi/overseas-stock/v1/trading/algo-ordno" + + params = { + "CANO": cano, # 종합계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "TRAD_DT": trad_dt, # 거래일자 + "CTX_AREA_FK200": FK200, # 연속조회검색조건200 + "CTX_AREA_NK200": NK200 # 연속조회키200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return algo_ordno( + cano, acnt_prdt_cd, trad_dt, FK200, NK200, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간주문 [v1_해외주식-026] +############################################################################################## + +def daytime_order( + order_dv: str, # 주문구분 buy(매수) / sell(매도) + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + ord_dvsn: str, # 주문구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미국주간주문[v1_해외주식-026] + 해외주식 미국주간주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + order_dv (str): 주문구분 buy(매수) / sell(매도) + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스 + pdno (str): 종목코드 + ord_qty (str): 해외거래소 별 최소 주문수량 및 주문단위 확인 필요 + ovrs_ord_unpr (str): 소수점 포함, 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 + ctac_tlno (str): " " + mgco_aptm_odno (str): " " + ord_svr_dvsn_cd (str): "0" + ord_dvsn (str): [미국 매수/매도 주문] 00 : 지정가 * 주간거래는 지정가만 가능 + + Returns: + Optional[pd.DataFrame]: 해외주식 미국주간주문 데이터 + + Example: + >>> df = daytime_order( + ... order_dv="buy", + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... ord_qty="10", + ... ovrs_ord_unpr="150.00", + ... ctac_tlno="01012345678", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... ord_dvsn="00" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '10')") + raise ValueError("ord_qty is required. (e.g. '10')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '150.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '150.00')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + if not ord_dvsn: + logger.error("ord_dvsn is required. (e.g. '00')") + raise ValueError("ord_dvsn is required. (e.g. '00')") + + if order_dv == "buy": + tr_id = "TTTS6036U" + elif order_dv == "sell": + tr_id = "TTTS6037U" + else: + logger.error("Invalid order_dv. (e.g. 'buy' or 'sell')") + raise ValueError("Invalid order_dv. (e.g. 'buy' or 'sell')") + + api_url = "/uapi/overseas-stock/v1/trading/daytime-order" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "ORD_DVSN": ord_dvsn, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간정정취소 [v1_해외주식-027] +############################################################################################## + +def daytime_order_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + orgn_odno: str, # 원주문번호 + rvse_cncl_dvsn_cd: str, # 정정취소구분코드 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미국주간정정취소[v1_해외주식-027] + 해외주식 미국주간정정취소 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD:나스닥 / NYSE:뉴욕 / AMEX:아멕스 + pdno (str): 종목코드 + orgn_odno (str): 정정 또는 취소할 원주문번호 + rvse_cncl_dvsn_cd (str): 01 : 정정, 02 : 취소 + ord_qty (str): 주문수량 + ovrs_ord_unpr (str): 소수점 포함, 1주당 가격 + ctac_tlno (str): 연락전화번호 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): 주문서버구분코드 + + Returns: + Optional[pd.DataFrame]: 해외주식 미국주간정정취소 데이터 + + Example: + >>> df = daytime_order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... orgn_odno="1234567890", + ... rvse_cncl_dvsn_cd="01", + ... ord_qty="100", + ... ovrs_ord_unpr="150.00", + ... ctac_tlno="01012345678", + ... mgco_aptm_odno="000000000001", + ... ord_svr_dvsn_cd="0" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '1234567890')") + raise ValueError("orgn_odno is required. (e.g. '1234567890')") + if rvse_cncl_dvsn_cd not in ["01", "02"]: + logger.error("rvse_cncl_dvsn_cd is required. (e.g. '01' or '02')") + raise ValueError("rvse_cncl_dvsn_cd is required. (e.g. '01' or '02')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '100')") + raise ValueError("ord_qty is required. (e.g. '100')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '150.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '150.00')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + + tr_id = "TTTS6038U" + + api_url = "/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 - 해외증거금 통화별조회 [해외주식-035] +############################################################################################## + +def foreign_margin( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 (기본값: 10) +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외증거금 통화별조회[해외주식-035] + 해외증거금 통화별조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 (필수) + acnt_prdt_cd (str): 계좌상품코드 (필수) + tr_cont (str): 연속 거래 여부 (기본값: "") + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외증거금 통화별조회 데이터 + + Example: + >>> df = foreign_margin("12345678", "01") + >>> print(df) + """ + # 필수 파라미터 검증 + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTC2101R" + + api_url = "/uapi/overseas-stock/v1/trading/foreign-margin" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + } + + # API 호출 + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return foreign_margin( + cano, + acnt_prdt_cd, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 지정가체결내역조회 [해외주식-070] +############################################################################################## + +def inquire_algo_ccnl( + cano: str, # [필수] 계좌번호 + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + ord_dt: str = "", # 주문일자 + ord_gno_brno: str = "", # 주문채번지점번호 + odno: str = "", # 주문번호 (ex. 지정가주문번호 TTTC6058R에서 조회된 주문번호 입력) + ttlz_icld_yn: str = "", # 집계포함여부 + NK200: str = "", # 연속조회키200 + FK200: str = "", # 연속조회조건200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임3 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 TWAP, VWAP 주문에 대한 체결내역 조회 API로 지정가 주문번호조회 API를 수행 후 조회해야합니다 + + Args: + cano (str): [필수] 계좌번호 + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + ord_dt (str): 주문일자 + ord_gno_brno (str): 주문채번지점번호 + odno (str): 주문번호 (ex. 지정가주문번호 TTTC6058R에서 조회된 주문번호 입력) + ttlz_icld_yn (str): 집계포함여부 + NK200 (str): 연속조회키200 + FK200 (str): 연속조회조건200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임3 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output, output3) 체결내역 데이터 + + Example: + >>> result, result3 = inquire_algo_ccnl(cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod) + >>> print(result) + >>> print(result3) + """ + + if cano == "": + raise ValueError("cano is required") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + dataframe = pd.DataFrame() + if dataframe3 is None: + dataframe3 = pd.DataFrame() + return dataframe, dataframe3 + + tr_id = "TTTS6059R" # 해외주식 지정가체결내역조회 + + api_url = "/uapi/overseas-stock/v1/trading/inquire-algo-ccnl" + + params = { + "CANO": cano, # 계좌번호 + "ACNT_PRDT_CD": acnt_prdt_cd, # 계좌상품코드 + "ORD_DT": ord_dt, # 주문일자 + "ORD_GNO_BRNO": ord_gno_brno, # 주문채번지점번호 + "ODNO": odno, # 주문번호 + "TTLZ_ICLD_YN": ttlz_icld_yn, # 집계포함여부 + "CTX_AREA_NK200": NK200, # 연속조회키200 + "CTX_AREA_FK200": FK200 # 연속조회조건200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + current_data3 = pd.DataFrame(res.getBody().output3) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + + tr_cont = res.getHeader().tr_cont + NK200 = res.getBody().ctx_area_nk200 + FK200 = res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return inquire_algo_ccnl( + cano, acnt_prdt_cd, ord_dt, ord_gno_brno, odno, ttlz_icld_yn, + NK200, FK200, "N", dataframe, dataframe3, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe, dataframe3 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고 [v1_해외주식-006] +############################################################################################## + +def inquire_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + tr_crcy_cd: str, # 거래통화코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 잔고[v1_해외주식-006] + 해외주식 잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): [모의] NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [실전] NASD : 미국전체 NAS : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 [모의/실전 공통] SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + tr_crcy_cd (str): USD : 미국달러 HKD : 홍콩달러 CNY : 중국위안화 JPY : 일본엔화 VND : 베트남동 + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 잔고 데이터 + + Example: + >>> df1, df2 = inquire_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... tr_crcy_cd="USD", + ... FK200="", + ... NK200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not tr_crcy_cd: + logger.error("tr_crcy_cd is required. (e.g. 'USD')") + raise ValueError("tr_crcy_cd is required. (e.g. 'USD')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3012R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3012R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/inquire-balance" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "TR_CRCY_CD": tr_crcy_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont, FK200, NK200 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_balance( + cano, + acnt_prdt_cd, + ovrs_excg_cd, + tr_crcy_cd, + FK200, + NK200, + env_dv, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문체결내역 [v1_해외주식-007] +############################################################################################## + +def inquire_ccnl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + pdno: str, # 상품번호 + ord_strt_dt: str, # 주문시작일자 + ord_end_dt: str, # 주문종료일자 + sll_buy_dvsn: str, # 매도매수구분 + ccld_nccs_dvsn: str, # 체결미체결구분 + sort_sqn: str, # 정렬순서 + ord_dt: str, # 주문일자 + ord_gno_brno: str, # 주문채번지점번호 + odno: str, # 주문번호 + ovrs_excg_cd: str = "", # 해외거래소코드 + NK200: str = "", # 연속조회키200 + FK200: str = "", # 연속조회검색조건200 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 주문체결내역[v1_해외주식-007] + 해외주식 주문체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + pdno (str): 전종목일 경우 "%" 입력 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능 + ord_strt_dt (str): YYYYMMDD 형식 (현지시각 기준) + ord_end_dt (str): YYYYMMDD 형식 (현지시각 기준) + sll_buy_dvsn (str): 00 : 전체 01 : 매도 02 : 매수 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + ccld_nccs_dvsn (str): 00 : 전체 01 : 체결 02 : 미체결 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + ovrs_excg_cd (str): 전종목일 경우 "%" 입력 NASD : 미국시장 전체(나스닥, 뉴욕, 아멕스) NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능 + sort_sqn (str): DS : 정순 AS : 역순 ※ 모의투자계좌의 경우 정렬순서 사용불가(Default : DS(정순)) + ord_dt (str): "" (Null 값 설정) + ord_gno_brno (str): "" (Null 값 설정) + odno (str): "" (Null 값 설정) ※ 주문번호로 검색 불가능합니다. 반드시 ""(Null 값 설정) 바랍니다. + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 주문체결내역 데이터 + + Example: + >>> df = inquire_ccnl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... pdno="%", + ... ord_strt_dt="20211027", + ... ord_end_dt="20211027", + ... sll_buy_dvsn="00", + ... ccld_nccs_dvsn="00", + ... ovrs_excg_cd="%%", + ... sort_sqn="DS", + ... ord_dt="", + ... ord_gno_brno="02111", + ... odno="", + ... NK200="", + ... FK200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ord_strt_dt: + logger.error("ord_strt_dt is required. (e.g. '20211027')") + raise ValueError("ord_strt_dt is required. (e.g. '20211027')") + if not ord_end_dt: + logger.error("ord_end_dt is required. (e.g. '20211027')") + raise ValueError("ord_end_dt is required. (e.g. '20211027')") + if not sll_buy_dvsn: + logger.error("sll_buy_dvsn is required. (e.g. '00')") + raise ValueError("sll_buy_dvsn is required. (e.g. '00')") + if not ccld_nccs_dvsn: + logger.error("ccld_nccs_dvsn is required. (e.g. '00')") + raise ValueError("ccld_nccs_dvsn is required. (e.g. '00')") + if not sort_sqn: + logger.error("sort_sqn is required. (e.g. 'DS')") + raise ValueError("sort_sqn is required. (e.g. 'DS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3035R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3035R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/inquire-ccnl" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "ORD_STRT_DT": ord_strt_dt, + "ORD_END_DT": ord_end_dt, + "SLL_BUY_DVSN": sll_buy_dvsn, + "CCLD_NCCS_DVSN": ccld_nccs_dvsn, + "OVRS_EXCG_CD": ovrs_excg_cd, + "SORT_SQN": sort_sqn, + "ORD_DT": ord_dt, + "ORD_GNO_BRNO": ord_gno_brno, + "ODNO": odno, + "CTX_AREA_NK200": NK200, + "CTX_AREA_FK200": FK200, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_ccnl( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + pdno=pdno, + ord_strt_dt=ord_strt_dt, + ord_end_dt=ord_end_dt, + sll_buy_dvsn=sll_buy_dvsn, + ccld_nccs_dvsn=ccld_nccs_dvsn, + ovrs_excg_cd=ovrs_excg_cd, + sort_sqn=sort_sqn, + ord_dt=ord_dt, + ord_gno_brno=ord_gno_brno, + odno=odno, + NK200=NK200, + FK200=FK200, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미체결내역 [v1_해외주식-005] +############################################################################################## + +def inquire_nccs( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + sort_sqn: str, # 정렬순서 + FK200: str, # 연속조회검색조건200 + NK200: str, # 연속조회키200 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 미체결내역[v1_해외주식-005] + 해외주식 미체결내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 * NASD 인 경우만 미국전체로 조회되며 나머지 거래소 코드는 해당 거래소만 조회됨 * 공백 입력 시 다음조회가 불가능하므로, 반드시 거래소코드 입력해야 함 + sort_sqn (str): DS : 정순 그외 : 역순 [header tr_id: TTTS3018R] ""(공란) + FK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터) + NK200 (str): 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 미체결내역 데이터 + + Example: + >>> df = inquire_nccs( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NYSE", + ... sort_sqn="DS", + ... FK200="", + ... NK200="" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NYSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NYSE')") + if not sort_sqn: + logger.error("sort_sqn is required. (e.g. 'DS')") + raise ValueError("sort_sqn is required. (e.g. 'DS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "TTTS3018R" + + api_url = "/uapi/overseas-stock/v1/trading/inquire-nccs" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "SORT_SQN": sort_sqn, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_nccs( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + sort_sqn=sort_sqn, + FK200=FK200, + NK200=NK200, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe is not None and not dataframe.empty: + logger.info("Returning already collected data due to API error.") + return dataframe + else: + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 결제기준잔고 [해외주식-064] +############################################################################################## + +def inquire_paymt_stdr_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + bass_dt: str, # 기준일자 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + inqr_dvsn_cd: str, # 조회구분코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 결제기준잔고[해외주식-064] + 해외주식 결제기준잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + bass_dt (str): 기준일자 + wcrc_frcr_dvsn_cd (str): 원화외화구분코드 (01: 원화기준, 02: 외화기준) + inqr_dvsn_cd (str): 조회구분코드 (00: 전체, 01: 일반, 02: 미니스탁) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 결제기준잔고 데이터 + + Example: + >>> df1, df2, df3 = inquire_paymt_stdr_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... bass_dt="20230630", + ... wcrc_frcr_dvsn_cd="01", + ... inqr_dvsn_cd="00" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not bass_dt: + logger.error("bass_dt is required. (e.g. '20230630')") + raise ValueError("bass_dt is required. (e.g. '20230630')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + if not inqr_dvsn_cd: + logger.error("inqr_dvsn_cd is required. (e.g. '00')") + raise ValueError("inqr_dvsn_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + tr_id = "CTRP6010R" + + api_url = "/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "BASS_DT": bass_dt, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "INQR_DVSN_CD": inqr_dvsn_cd, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_paymt_stdr_balance( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + bass_dt=bass_dt, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + inqr_dvsn_cd=inqr_dvsn_cd, + dataframe1=dataframe1, + dataframe2=dataframe2, + dataframe3=dataframe3, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익 [v1_해외주식-032] +############################################################################################## + +def inquire_period_profit( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + natn_cd: str, # 국가코드 + crcy_cd: str, # 통화코드 + pdno: str, # 상품번호 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + FK200: str, # 연속조회검색조건200 + NK200: str, # 연속조회키200 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 기간손익[v1_해외주식-032] + 해외주식 기간손익 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): 공란 : 전체, NASD : 미국, SEHK : 홍콩, SHAA : 중국, TKSE : 일본, HASE : 베트남 + natn_cd (str): 공란(Default) + crcy_cd (str): 공란 : 전체 USD : 미국달러, HKD : 홍콩달러, CNY : 중국위안화, JPY : 일본엔화, VND : 베트남동 + pdno (str): 공란 : 전체 + inqr_strt_dt (str): YYYYMMDD + inqr_end_dt (str): YYYYMMDD + wcrc_frcr_dvsn_cd (str): 01 : 외화, 02 : 원화 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 기간손익 데이터 + + Example: + >>> df1, df2 = inquire_period_profit( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... natn_cd="", + ... crcy_cd="USD", + ... pdno="", + ... inqr_strt_dt="20230101", + ... inqr_end_dt="20231231", + ... wcrc_frcr_dvsn_cd="01", + ... FK200="", + ... NK200="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not crcy_cd: + logger.error("crcy_cd is required. (e.g. 'USD')") + raise ValueError("crcy_cd is required. (e.g. 'USD')") + if not inqr_strt_dt: + logger.error("inqr_strt_dt is required. (e.g. '20230101')") + raise ValueError("inqr_strt_dt is required. (e.g. '20230101')") + if not inqr_end_dt: + logger.error("inqr_end_dt is required. (e.g. '20231231')") + raise ValueError("inqr_end_dt is required. (e.g. '20231231')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "TTTS3039R" + + api_url = "/uapi/overseas-stock/v1/trading/inquire-period-profit" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "NATN_CD": natn_cd, + "CRCY_CD": crcy_cd, + "PDNO": pdno, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont, NK200, FK200 = res.getHeader().tr_cont, res.getBody().ctx_area_nk200, res.getBody().ctx_area_fk200 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_profit( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + natn_cd=natn_cd, + crcy_cd=crcy_cd, + pdno=pdno, + inqr_strt_dt=inqr_strt_dt, + inqr_end_dt=inqr_end_dt, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + FK200=FK200, + NK200=NK200, + dataframe1=dataframe1, + dataframe2=dataframe2, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역 [해외주식-063] +############################################################################################## + +def inquire_period_trans( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + erlm_strt_dt: str, # 등록시작일자 + erlm_end_dt: str, # 등록종료일자 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + sll_buy_dvsn_cd: str, # 매도매수구분코드 + loan_dvsn_cd: str, # 대출구분코드 + FK100: str, # 연속조회검색조건100 + NK100: str, # 연속조회키100 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 일별거래내역[해외주식-063] + 해외주식 일별거래내역 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 종합계좌번호 + acnt_prdt_cd (str): 계좌상품코드 + erlm_strt_dt (str): 등록시작일자 (예: 20240420) + erlm_end_dt (str): 등록종료일자 (예: 20240520) + ovrs_excg_cd (str): 해외거래소코드 + pdno (str): 상품번호 + sll_buy_dvsn_cd (str): 매도매수구분코드 (00: 전체, 01: 매도, 02: 매수) + loan_dvsn_cd (str): 대출구분코드 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 일별거래내역 데이터 + + Example: + >>> df1, df2 = inquire_period_trans( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... erlm_strt_dt="20240420", + ... erlm_end_dt="20240520", + ... ovrs_excg_cd="NAS", + ... pdno="", + ... sll_buy_dvsn_cd="00", + ... loan_dvsn_cd="", + ... FK100="", + ... NK100="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '12345678')") + raise ValueError("cano is required. (e.g. '12345678')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not erlm_strt_dt: + logger.error("erlm_strt_dt is required. (e.g. '20240420')") + raise ValueError("erlm_strt_dt is required. (e.g. '20240420')") + if not erlm_end_dt: + logger.error("erlm_end_dt is required. (e.g. '20240520')") + raise ValueError("erlm_end_dt is required. (e.g. '20240520')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NAS')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NAS')") + if not sll_buy_dvsn_cd: + logger.error("sll_buy_dvsn_cd is required. (e.g. '00')") + raise ValueError("sll_buy_dvsn_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "CTOS4001R" + + api_url = "/uapi/overseas-stock/v1/trading/inquire-period-trans" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "ERLM_STRT_DT": erlm_strt_dt, + "ERLM_END_DT": erlm_end_dt, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, + "LOAN_DVSN_CD": loan_dvsn_cd, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont, NK100, FK100 = res.getHeader().tr_cont, res.getBody().ctx_area_nk100, res.getBody().ctx_area_fk100 + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_period_trans( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + erlm_strt_dt=erlm_strt_dt, + erlm_end_dt=erlm_end_dt, + ovrs_excg_cd=ovrs_excg_cd, + pdno=pdno, + sll_buy_dvsn_cd=sll_buy_dvsn_cd, + loan_dvsn_cd=loan_dvsn_cd, + FK100=FK100, + NK100=NK100, + dataframe1=dataframe1, + dataframe2=dataframe2, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 [v1_해외주식-008] +############################################################################################## + +def inquire_present_balance( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + wcrc_frcr_dvsn_cd: str, # 원화외화구분코드 + natn_cd: str, # 국가코드 + tr_mket_cd: str, # 거래시장코드 + inqr_dvsn_cd: str, # 조회구분코드 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 체결기준현재잔고[v1_해외주식-008] + 해외주식 체결기준현재잔고 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + wcrc_frcr_dvsn_cd (str): 01 : 원화 02 : 외화 + natn_cd (str): 000 전체 840 미국 344 홍콩 156 중국 392 일본 704 베트남 + tr_mket_cd (str): [Request body NATN_CD 000 설정] 00 : 전체 [Request body NATN_CD 840 설정] 00 : 전체 01 : 나스닥(NASD) 02 : 뉴욕거래소(NYSE) 03 : 미국(PINK SHEETS) 04 : 미국(OTCBB) 05 : 아멕스(AMEX) [Request body NATN_CD 156 설정] 00 : 전체 01 : 상해B 02 : 심천B 03 : 상해A 04 : 심천A [Request body NATN_CD 392 설정] 01 : 일본 [Request body NATN_CD 704 설정] 01 : 하노이거래 02 : 호치민거래소 [Request body NATN_CD 344 설정] 01 : 홍콩 02 : 홍콩CNY 03 : 홍콩USD + inqr_dvsn_cd (str): 00 : 전체 01 : 일반해외주식 02 : 미니스탁 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 체결기준현재잔고 데이터 + + Example: + >>> df1, df2, df3 = inquire_present_balance( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... wcrc_frcr_dvsn_cd="01", + ... natn_cd="000", + ... tr_mket_cd="00", + ... inqr_dvsn_cd="00" + ... ) + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not wcrc_frcr_dvsn_cd: + logger.error("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + raise ValueError("wcrc_frcr_dvsn_cd is required. (e.g. '01')") + if not natn_cd: + logger.error("natn_cd is required. (e.g. '000')") + raise ValueError("natn_cd is required. (e.g. '000')") + if not tr_mket_cd: + logger.error("tr_mket_cd is required. (e.g. '00')") + raise ValueError("tr_mket_cd is required. (e.g. '00')") + if not inqr_dvsn_cd: + logger.error("inqr_dvsn_cd is required. (e.g. '00')") + raise ValueError("inqr_dvsn_cd is required. (e.g. '00')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "CTRP6504R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTRP6504R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/inquire-present-balance" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "WCRC_FRCR_DVSN_CD": wcrc_frcr_dvsn_cd, + "NATN_CD": natn_cd, + "TR_MKET_CD": tr_mket_cd, + "INQR_DVSN_CD": inqr_dvsn_cd, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_present_balance( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + wcrc_frcr_dvsn_cd=wcrc_frcr_dvsn_cd, + natn_cd=natn_cd, + tr_mket_cd=tr_mket_cd, + inqr_dvsn_cd=inqr_dvsn_cd, + env_dv=env_dv, + dataframe1=dataframe1, + dataframe2=dataframe2, + dataframe3=dataframe3, + tr_cont="N", + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + # 이미 수집된 데이터가 있으면 그것을 반환, 없으면 빈 DataFrame 반환 + if dataframe1 is not None and not dataframe1.empty: + logger.info("Returning already collected data due to API error.") + return dataframe1, dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + else: + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 매수가능금액조회 [v1_해외주식-014] +############################################################################################## + +def inquire_psamount( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + ovrs_ord_unpr: str, # 해외주문단가 + item_cd: str, # 종목코드 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 매수가능금액조회[v1_해외주식-014] + 해외주식 매수가능금액조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 / NYSE : 뉴욕 / AMEX : 아멕스 SEHK : 홍콩 / SHAA : 중국상해 / SZAA : 중국심천 TKSE : 일본 / HASE : 하노이거래소 / VNSE : 호치민거래소 + ovrs_ord_unpr (str): 해외주문단가 (23.8) 정수부분 23자리, 소수부분 8자리 + item_cd (str): 종목코드 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 매수가능금액조회 데이터 + + Example: + >>> df = inquire_psamount( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... ovrs_ord_unpr="1.4", + ... item_cd="QQQ" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '81019777')") + raise ValueError("cano is required. (e.g. '81019777')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '1.4')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '1.4')") + if not item_cd: + logger.error("item_cd is required. (e.g. 'QQQ')") + raise ValueError("item_cd is required. (e.g. 'QQQ')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTS3007R" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTS3007R" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/inquire-psamount" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "ITEM_CD": item_cd, + } + + res = ka._url_fetch(api_url=api_url, ptr_id=tr_id, tr_cont=tr_cont, params=params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_psamount( + cano=cano, + acnt_prdt_cd=acnt_prdt_cd, + ovrs_excg_cd=ovrs_excg_cd, + ovrs_ord_unpr=ovrs_ord_unpr, + item_cd=item_cd, + env_dv=env_dv, + tr_cont="N", + dataframe=dataframe, + depth=depth + 1, + max_depth=max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 시가총액순위[해외주식-047] +############################################################################################## + +def market_cap( + excd: str, # 거래소명 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 시가총액순위 조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF (ex. "") + auth (str): 사용자권한정보 (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 output1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 output2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 시가총액순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = market_cap(excd="SZS", vol_rang="1") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError( + "excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if vol_rang == "": + raise ValueError( + "vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None or dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1, dataframe2 + + tr_id = "HHDFS76350100" # 해외주식 시가총액순위 + + api_url = "/uapi/overseas-stock/v1/ranking/market-cap" + + params = { + "EXCD": excd, # 거래소명 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth, # 사용자권한정보 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return market_cap( + excd, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] +############################################################################################## + +def new_highlow( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + gubn: str, # [필수] 신고/신저 구분 (ex. 0:신저,1:신고) + gubn2: str, # [필수] 일시돌파/돌파 구분 (ex. 0:일시돌파0, 1:돌파유지1) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 output2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 신고/신저가[해외주식-042] + 해외주식 신고/신저가 정보를 조회하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + gubn (str): [필수] 신고/신저 구분 (ex. 0:신저,1:신고) + gubn2 (str): [필수] 일시돌파/돌파 구분 (ex. 0:일시돌파0, 1:돌파유지1) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 output1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 output2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> output1, output2 = new_highlow(excd="AMS", mixn="0", vol_rang="0", gubn="1", gubn2="1") + >>> print(output1) + >>> print(output2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '1')") + + if gubn2 == "": + raise ValueError("gubn2 is required (e.g. '1')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76300000" # 해외주식 신고/신저가 + + api_url = "/uapi/overseas-stock/v1/ranking/new-highlow" + + params = { + "EXCD": excd, + "MIXN": mixn, + "VOL_RANG": vol_rang, + "GUBN": gubn, + "GUBN2": gubn2, + "KEYB": keyb, + "AUTH": auth + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return new_highlow( + excd, mixn, vol_rang, gubn, gubn2, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문 [v1_해외주식-001] +############################################################################################## + +def order( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + ord_dv: str, # 주문구분 (buy: 매수, sell: 매도) + ctac_tlno: str, # 연락전화번호 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + ord_dvsn: str, # 주문구분 + env_dv: str = "real", # 실전모의구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 주문[v1_해외주식-001] + 해외주식 주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + pdno (str): 종목코드 + ord_qty (str): 주문수량 (해외거래소 별 최소 주문수량 및 주문단위 확인 필요) + ovrs_ord_unpr (str): 1주당 가격 * 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 + ord_dv (str): 주문구분 (buy: 매수, sell: 매도) + ctac_tlno (str): + mgco_aptm_odno (str): + ord_svr_dvsn_cd (str): "0"(Default) + ord_dvsn (str): [Header tr_id TTTT1002U(미국 매수 주문)] 00 : 지정가 32 : LOO(장개시지정가) 34 : LOC(장마감지정가) * 모의투자 VTTT1002U(미국 매수 주문)로는 00:지정가만 가능 [Header tr_id TTTT1006U(미국 매도 주문)] 00 : 지정가 31 : MOO(장개시시장가) 32 : LOO(장개시지정가) 33 : MOC(장마감시장가) 34 : LOC(장마감지정가) * 모의투자 VTTT1006U(미국 매도 주문)로는 00:지정가만 가능 [Header tr_id TTTS1001U(홍콩 매도 주문)] 00 : 지정가 50 : 단주지정가 * 모의투자 VTTS1001U(홍콩 매도 주문)로는 00:지정가만 가능 [그외 tr_id] 제거 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + Optional[pd.DataFrame]: 해외주식 주문 데이터 + + Example: + >>> df = order( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NASD", + ... pdno="AAPL", + ... ord_qty="1", + ... ovrs_ord_unpr="145.00", + ... ord_dv="buy", + ... ctac_tlno="", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... ord_dvsn="00", + ... env_dv="real" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NASD')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NASD')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '1')") + raise ValueError("ord_qty is required. (e.g. '1')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '145.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '145.00')") + if not ord_dv: + logger.error("ord_dv is required. (e.g. 'buy' or 'sell')") + raise ValueError("ord_dv is required. (e.g. 'buy' or 'sell')") + if not ord_svr_dvsn_cd: + logger.error("ord_svr_dvsn_cd is required. (e.g. '0')") + raise ValueError("ord_svr_dvsn_cd is required. (e.g. '0')") + if not ord_dvsn: + logger.error("ord_dvsn is required. (e.g. '00')") + raise ValueError("ord_dvsn is required. (e.g. '00')") + + # TR ID 설정 (매수/매도 및 거래소별) + if ord_dv == "buy": + if ovrs_excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1002U" # 미국 매수 주문 [모의투자] VTTT1002U + elif ovrs_excg_cd == "SEHK": + tr_id = "TTTS1002U" # 홍콩 매수 주문 [모의투자] VTTS1002U + elif ovrs_excg_cd == "SHAA": + tr_id = "TTTS0202U" # 중국상해 매수 주문 [모의투자] VTTS0202U + elif ovrs_excg_cd == "SZAA": + tr_id = "TTTS0305U" # 중국심천 매수 주문 [모의투자] VTTS0305U + elif ovrs_excg_cd == "TKSE": + tr_id = "TTTS0308U" # 일본 매수 주문 [모의투자] VTTS0308U + elif ovrs_excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0311U" # 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0311U + else: + logger.error( + "ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + raise ValueError( + "ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + sll_type = "" + elif ord_dv == "sell": + if ovrs_excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1006U" # 미국 매도 주문 [모의투자] VTTT1006U + elif ovrs_excg_cd == "SEHK": + tr_id = "TTTS1001U" # 홍콩 매도 주문 [모의투자] VTTS1001U + elif ovrs_excg_cd == "SHAA": + tr_id = "TTTS1005U" # 중국상해 매도 주문 [모의투자] VTTS1005U + elif ovrs_excg_cd == "SZAA": + tr_id = "TTTS0304U" # 중국심천 매도 주문 [모의투자] VTTS0304U + elif ovrs_excg_cd == "TKSE": + tr_id = "TTTS0307U" # 일본 매도 주문 [모의투자] VTTS0307U + elif ovrs_excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0310U" # 베트남(하노이,호치민) 매도 주문 [모의투자] VTTS0310U + else: + logger.error( + "ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + raise ValueError( + "ovrs_excg_cd is required. (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + sll_type = "00" + else: + logger.error("ord_dv is required. (e.g. 'buy' or 'sell')") + raise ValueError("ord_dv is required. (e.g. 'buy' or 'sell')") + + # 모의투자인 경우 TR ID 앞에 V 붙이기 + if env_dv == "demo": + tr_id = "V" + tr_id[1:] + elif env_dv != "real": + logger.error("env_dv can only be 'real' or 'demo'") + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/order" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "CTAC_TLNO": ctac_tlno, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "SLL_TYPE": sll_type, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + "ORD_DVSN": ord_dvsn, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True + ) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수[v1_해외주식-002] +############################################################################################## + +def order_resv( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv: str, # [필수] 매도매수구분 (ex. usBuy:미국매수, usSell:미국매도, asia:아시아) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + pdno: str, # [필수] 상품번호 + ovrs_excg_cd: str, + # [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + ft_ord_qty: str, # [필수] FT주문수량 + ft_ord_unpr3: str, # [필수] FT주문단가3 + sll_buy_dvsn_cd: Optional[str] = "", # 매도매수구분코드 (ex. 아시아인경우만 사용, 01:매도,02:매수) + rvse_cncl_dvsn_cd: Optional[str] = "", # 정정취소구분코드 (ex. 아시아인경우만 사용, 00:매도/매수) + prdt_type_cd: Optional[str] = "", # 상품유형코드 (ex. 아시아인경우만 사용) + ord_svr_dvsn_cd: Optional[str] = "", # 주문서버구분코드 (ex. 0) + rsvn_ord_rcit_dt: Optional[str] = "", # 예약주문접수일자 (ex. 아시아인경우만 사용) + ord_dvsn: Optional[str] = "", # 주문구분 (ex. 미국 매수/매도인 경우만 사용) + ovrs_rsvn_odno: Optional[str] = "", # 해외예약주문번호 (ex. 아이사인 경우만 사용) + algo_ord_tmd_dvsn_cd: Optional[str] = "" # 알고리즘주문시간구분코드 (ex. TWAP, VWAP 주문에서만 사용, 02로 고정) +) -> pd.DataFrame: + """ + 미국거래소 운영시간 외 미국주식을 예약 매매하기 위한 API입니다. + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + * 아래 각 국가의 시장별 예약주문 접수 가능 시간을 확인하시길 바랍니다. + + 미국 예약주문 접수시간 + 1) 10:00 ~ 23:20 / 10:00 ~ 22:20 (서머타임 시) + 2) 주문제한 : 16:30 ~ 16:45 경까지 (사유 : 시스템 정산작업시간) + 3) 23:30 정규장으로 주문 전송 (서머타임 시 22:30 정규장 주문 전송) + 4) 미국 거래소 운영시간(한국시간 기준) : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) + + 홍콩 예약주문 접수시간 + 1) 09:00 ~ 10:20 접수, 10:30 주문전송 + 2) 10:40 ~ 13:50 접수, 14:00 주문전송 + + 중국 예약주문 접수시간 + 1) 09:00 ~ 10:20 접수, 10:30 주문전송 + 2) 10:40 ~ 13:50 접수, 14:00 주문전송 + + 일본 예약주문 접수시간 + 1) 09:10 ~ 12:20 까지 접수, 12:30 주문전송 + + 베트남 예약주문 접수시간 + 1) 09:00 ~ 11:00 까지 접수, 11:15 주문전송 + 2) 11:20 ~ 14:50 까지 접수, 15:00 주문전송 + + * 예약주문 유의사항 + 1) 예약주문 유효기간 : 당일 + - 미국장 마감 후, 미체결주문은 자동취소 + - 미국휴장 시, 익 영업일로 이전 + (미국예약주문화면에서 취소 가능) + 2) 증거금 및 잔고보유 : 체크 안함 + 3) 주문전송 불가사유 + - 매수증거금 부족: 수수료 포함 매수금액부족, 환전, 시세이용료 출금, 인출에 의한 증거금 부족 + - 기타 매수증거금 부족, 매도가능수량 부족, 주권변경 등 권리발생으로 인한 주문불가사유 발생 + 4) 지정가주문만 가능 + * 단 미국 예약매도주문(TTTT3016U)의 경우, MOO(장개시시장가)로 주문 접수 가능 + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + ord_dv (str): [필수] 매도매수구분 (ex. usBuy:미국매수, usSell:미국매도, asia:아시아) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + pdno (str): [필수] 상품번호 + ovrs_excg_cd (str): [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + ft_ord_qty (str): [필수] FT주문수량 + ft_ord_unpr3 (str): [필수] FT주문단가3 + sll_buy_dvsn_cd (Optional[str]): 매도매수구분코드 (ex. 아시아인경우만 사용, 01:매도,02:매수) + rvse_cncl_dvsn_cd (Optional[str]): 정정취소구분코드 (ex. 아시아인경우만 사용, 00:매도/매수) + prdt_type_cd (Optional[str]): 상품유형코드 (ex. 아시아인경우만 사용) + ord_svr_dvsn_cd (Optional[str]): 주문서버구분코드 (ex. 0) + rsvn_ord_rcit_dt (Optional[str]): 예약주문접수일자 (ex. 아시아인경우만 사용) + ord_dvsn (Optional[str]): 주문구분 (ex. 미국 매수/매도인 경우만 사용) + ovrs_rsvn_odno (Optional[str]): 해외예약주문번호 (ex. 아이사인 경우만 사용) + algo_ord_tmd_dvsn_cd (Optional[str]): 알고리즘주문시간구분코드 (ex. TWAP, VWAP 주문에서만 사용, 02로 고정) + + Returns: + pd.DataFrame: 해외주식 예약주문접수 결과 데이터 + + Example: + >>> df = order_resv(env_dv="real", ord_dv="usBuy", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, pdno="TSLA", ovrs_excg_cd="NASD", ft_ord_qty="1", ft_ord_unpr3="900") + >>> print(df) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if ord_dv == "": + raise ValueError("ord_dv is required (e.g. 'usBuy', 'usSell', 'asia')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if pdno == "": + raise ValueError("pdno is required") + + if ovrs_excg_cd == "": + raise ValueError( + "ovrs_excg_cd is required (e.g. 'NASD', 'NYSE', 'AMEX', 'SEHK', 'SHAA', 'SZAA', 'TKSE', 'HASE', 'VNSE')") + + if ft_ord_qty == "": + raise ValueError("ft_ord_qty is required") + + if ft_ord_unpr3 == "": + raise ValueError("ft_ord_unpr3 is required") + + # tr_id 설정 + if env_dv == "real": + if ord_dv == "usBuy": + tr_id = "TTTT3014U" + elif ord_dv == "usSell": + tr_id = "TTTT3016U" + elif ord_dv == "asia": + tr_id = "TTTS3013U" + else: + raise ValueError("ord_dv can only be 'usBuy', 'usSell' or 'asia'") + elif env_dv == "demo": + if ord_dv == "usBuy": + tr_id = "VTTT3014U" + elif ord_dv == "usSell": + tr_id = "VTTT3016U" + elif ord_dv == "asia": + tr_id = "VTTS3013U" + else: + raise ValueError("ord_dv can only be 'usBuy', 'usSell' or 'asia'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + api_url = "/uapi/overseas-stock/v1/trading/order-resv" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "PDNO": pdno, + "OVRS_EXCG_CD": ovrs_excg_cd, + "FT_ORD_QTY": ft_ord_qty, + "FT_ORD_UNPR3": ft_ord_unpr3 + } + + # 옵션 파라미터 추가 + if sll_buy_dvsn_cd: + params["SLL_BUY_DVSN_CD"] = sll_buy_dvsn_cd + if rvse_cncl_dvsn_cd: + params["RVSE_CNCL_DVSN_CD"] = rvse_cncl_dvsn_cd + if prdt_type_cd: + params["PRDT_TYPE_CD"] = prdt_type_cd + if ord_svr_dvsn_cd: + params["ORD_SVR_DVSN_CD"] = ord_svr_dvsn_cd + if rsvn_ord_rcit_dt: + params["RSVN_ORD_RCIT_DT"] = rsvn_ord_rcit_dt + if ord_dvsn: + params["ORD_DVSN"] = ord_dvsn + if ovrs_rsvn_odno: + params["OVRS_RSVN_ODNO"] = ovrs_rsvn_odno + if algo_ord_tmd_dvsn_cd: + params["ALGO_ORD_TMD_DVSN_CD"] = algo_ord_tmd_dvsn_cd + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output, index=[0]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문접수취소[v1_해외주식-004] +############################################################################################## + +def order_resv_ccnl( + env_dv: str, # [필수] 실전모의구분 (ex. real:실전, demo:모의) + nat_dv: str, # [필수] 국가구분 (ex. us:미국) + cano: str, # [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd: str, # [필수] 계좌상품코드 (ex. 01) + rsvn_ord_rcit_dt: str, # [필수] 해외주문접수일자 + ovrs_rsvn_odno: str # [필수] 해외예약주문번호 (ex. 해외주식_예약주문접수 API Output ODNO(주문번호) 참고) +) -> pd.DataFrame: + """ + 접수된 미국주식 예약주문을 취소하기 위한 API입니다. + (해외주식 예약주문접수 시 Return 받은 ODNO를 참고하여 API를 호출하세요.) + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + + Args: + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + nat_dv (str): [필수] 국가구분 (ex. us:미국) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + rsvn_ord_rcit_dt (str): [필수] 해외주문접수일자 + ovrs_rsvn_odno (str): [필수] 해외예약주문번호 (ex. 해외주식_예약주문접수 API Output ODNO(주문번호) 참고) + + Returns: + pd.DataFrame: 해외주식 예약주문접수취소 결과 데이터 + + Example: + >>> df = order_resv_ccnl(env_dv="real", nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, rsvn_ord_rcit_dt="20220810", ovrs_rsvn_odno="0030008244") + >>> print(df) + """ + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + if nat_dv == "": + raise ValueError("nat_dv is required (e.g. 'us')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if rsvn_ord_rcit_dt == "": + raise ValueError("rsvn_ord_rcit_dt is required") + + if ovrs_rsvn_odno == "": + raise ValueError("ovrs_rsvn_odno is required") + + # tr_id 설정 + if env_dv == "real": + if nat_dv == "us": + tr_id = "TTTT3017U" + else: + raise ValueError("nat_dv can only be 'us'") + elif env_dv == "demo": + if nat_dv == "us": + tr_id = "VTTT3017U" + else: + raise ValueError("nat_dv can only be 'us'") + else: + raise ValueError("env_dv is required (e.g. 'real' or 'demo')") + + api_url = "/uapi/overseas-stock/v1/trading/order-resv-ccnl" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "RSVN_ORD_RCIT_DT": rsvn_ord_rcit_dt, + "OVRS_RSVN_ODNO": ovrs_rsvn_odno + } + + res = ka._url_fetch(api_url, tr_id, "", params, postFlag=True) + + if res.isOK(): + # output은 object 자료형이므로 DataFrame으로 변환 + current_data = pd.DataFrame([res.getBody().output]) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 예약주문조회[v1_해외주식-013] +############################################################################################## + +def order_resv_list( + nat_dv: str, # 국가구분코드 + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + inqr_dvsn_cd: str, # 조회구분코드 + ovrs_excg_cd: str, # 해외거래소코드 + prdt_type_cd: str = "", # 상품유형코드 + FK200: str = "", # 연속조회검색조건200 + NK200: str = "", # 연속조회키200 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 예약주문 조회 API입니다. + ※ 모의투자는 사용 불가합니다. + + * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + + Args: + nat_dv (str): [필수] 국가구분코드 (ex. us:미국, asia:아시아) + cano (str): [필수] 종합계좌번호 (ex. 12345678) + acnt_prdt_cd (str): [필수] 계좌상품코드 (ex. 01) + inqr_strt_dt (str): [필수] 조회시작일자 (ex. 20250101) + inqr_end_dt (str): [필수] 조회종료일자 (ex. 20251231) + inqr_dvsn_cd (str): [필수] 조회구분코드 (ex. 00:전체, 01:일반해외주식, 02:미니스탁) + ovrs_excg_cd (str): [필수] 해외거래소코드 (ex. NASD:나스닥, NYSE:뉴욕, AMEX:아멕스, SEHK:홍콩, SHAA:상해, SZAA:심천, TKSE:일본, HASE:하노이, VNSE:호치민) + prdt_type_cd (str): 상품유형코드 + FK200 (str): 연속조회검색조건200 + NK200 (str): 연속조회키200 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 예약주문조회 데이터 + + Example: + >>> df = order_resv_list(nat_dv="us", cano=trenv.my_acct, acnt_prdt_cd=trenv.my_prod, inqr_strt_dt="20250101", inqr_end_dt="20251231", inqr_dvsn_cd="00", ovrs_excg_cd="NASD") + >>> print(df) + """ + + if nat_dv == "": + raise ValueError("nat_dv is required (e.g. 'us' or 'asia')") + + if cano == "": + raise ValueError("cano is required (e.g. '12345678')") + + if acnt_prdt_cd == "": + raise ValueError("acnt_prdt_cd is required (e.g. '01')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20251231')") + + if inqr_dvsn_cd == "": + raise ValueError("inqr_dvsn_cd is required (e.g. '00')") + + if ovrs_excg_cd == "": + raise ValueError("ovrs_excg_cd is required (e.g. 'NASD')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + # tr_id 설정 + if nat_dv == "us": + tr_id = "TTTT3039R" + elif nat_dv == "asia": + tr_id = "TTTS3014R" + else: + raise ValueError("nat_dv can only be 'us' or 'asia'") + + api_url = "/uapi/overseas-stock/v1/trading/order-resv-list" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "INQR_DVSN_CD": inqr_dvsn_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PRDT_TYPE_CD": prdt_type_cd, + "CTX_AREA_FK200": FK200, + "CTX_AREA_NK200": NK200 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + FK200 = res.getBody().ctx_area_fk200 + NK200 = res.getBody().ctx_area_nk200 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return order_resv_list( + nat_dv, cano, acnt_prdt_cd, inqr_strt_dt, inqr_end_dt, + inqr_dvsn_cd, ovrs_excg_cd, prdt_type_cd, FK200, NK200, + "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +################################################################################ +# [해외주식] 주문/계좌 > 해외주식 정정취소주문[v1_해외주식-003] +################################################################################ + +def order_rvsecncl( + cano: str, # 종합계좌번호 + acnt_prdt_cd: str, # 계좌상품코드 + ovrs_excg_cd: str, # 해외거래소코드 + pdno: str, # 상품번호 + orgn_odno: str, # 원주문번호 + rvse_cncl_dvsn_cd: str, # 정정취소구분코드 + ord_qty: str, # 주문수량 + ovrs_ord_unpr: str, # 해외주문단가 + mgco_aptm_odno: str, # 운용사지정주문번호 + ord_svr_dvsn_cd: str, # 주문서버구분코드 + env_dv: str = "real", # 실전모의구분 + +) -> Optional[pd.DataFrame]: + """ + [해외주식] 주문/계좌 + 해외주식 정정취소주문[v1_해외주식-003] + 해외주식 정정취소주문 API를 호출하여 DataFrame으로 반환합니다. + + Args: + cano (str): 계좌번호 체계(8-2)의 앞 8자리 + acnt_prdt_cd (str): 계좌번호 체계(8-2)의 뒤 2자리 + ovrs_excg_cd (str): NASD : 나스닥 NYSE : 뉴욕 AMEX : 아멕스 SEHK : 홍콩 SHAA : 중국상해 SZAA : 중국심천 TKSE : 일본 HASE : 베트남 하노이 VNSE : 베트남 호치민 + pdno (str): 상품번호 + orgn_odno (str): 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + rvse_cncl_dvsn_cd (str): 01 : 정정 02 : 취소 + ord_qty (str): 주문수량 + ovrs_ord_unpr (str): 취소주문 시, "0" 입력 + mgco_aptm_odno (str): 운용사지정주문번호 + ord_svr_dvsn_cd (str): "0"(Default) + env_dv (str): 실전모의구분 (real:실전, demo:모의) + + Returns: + Optional[pd.DataFrame]: 해외주식 정정취소주문 데이터 + + Example: + >>> df = order_rvsecncl( + ... cano=trenv.my_acct, + ... acnt_prdt_cd=trenv.my_prod, + ... ovrs_excg_cd="NYSE", + ... pdno="BA", + ... orgn_odno="30135009", + ... rvse_cncl_dvsn_cd="01", + ... ord_qty="1", + ... ovrs_ord_unpr="226.00", + ... mgco_aptm_odno="", + ... ord_svr_dvsn_cd="0", + ... env_dv="real" + ... ) + >>> print(df) + """ + # [필수 파라미터 검증] + if not cano: + logger.error("cano is required. (e.g. '810XXXXX')") + raise ValueError("cano is required. (e.g. '810XXXXX')") + if not acnt_prdt_cd: + logger.error("acnt_prdt_cd is required. (e.g. '01')") + raise ValueError("acnt_prdt_cd is required. (e.g. '01')") + if not ovrs_excg_cd: + logger.error("ovrs_excg_cd is required. (e.g. 'NYSE')") + raise ValueError("ovrs_excg_cd is required. (e.g. 'NYSE')") + if not pdno: + logger.error("pdno is required. (e.g. 'BA')") + raise ValueError("pdno is required. (e.g. 'BA')") + if not orgn_odno: + logger.error("orgn_odno is required. (e.g. '30135009')") + raise ValueError("orgn_odno is required. (e.g. '30135009')") + if not rvse_cncl_dvsn_cd: + logger.error("rvse_cncl_dvsn_cd is required. (e.g. '01')") + raise ValueError("rvse_cncl_dvsn_cd is required. (e.g. '01')") + if not ord_qty: + logger.error("ord_qty is required. (e.g. '1')") + raise ValueError("ord_qty is required. (e.g. '1')") + if not ovrs_ord_unpr: + logger.error("ovrs_ord_unpr is required. (e.g. '226.00')") + raise ValueError("ovrs_ord_unpr is required. (e.g. '226.00')") + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real": + tr_id = "TTTT1004U" # 실전투자용 TR ID + elif env_dv == "demo": + tr_id = "VTTT1004U" # 모의투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-stock/v1/trading/order-rvsecncl" + + params = { + "CANO": cano, + "ACNT_PRDT_CD": acnt_prdt_cd, + "OVRS_EXCG_CD": ovrs_excg_cd, + "PDNO": pdno, + "ORGN_ODNO": orgn_odno, + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, + "ORD_QTY": ord_qty, + "OVRS_ORD_UNPR": ovrs_ord_unpr, + "MGCO_APTM_ODNO": mgco_aptm_odno, + "ORD_SVR_DVSN_CD": ord_svr_dvsn_cd, + } + + res = ka._url_fetch(api_url=api_url, + ptr_id=tr_id, + tr_cont="", + params=params, + postFlag=True) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + dataframe = pd.DataFrame(output_data) + else: + dataframe = pd.DataFrame() + + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] +############################################################################################## + +def price_fluct( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + gubn: str, # [필수] 급등/급락구분 (ex. 0:급락, 1:급등) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 가격급등락[해외주식-038] + 해외주식 가격급등락 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + gubn (str): [필수] 급등/급락구분 (ex. 0:급락, 1:급등) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 가격급등락 데이터 (output1, output2) + + Example: + >>> df1, df2 = price_fluct(excd="NAS", gubn="0", mixn="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '0' or '1')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76260000" # 해외주식 가격급등락 + + api_url = "/uapi/overseas-stock/v1/ranking/price-fluct" + + params = { + "EXCD": excd, + "GUBN": gubn, + "MIXN": mixn, + "VOL_RANG": vol_rang, + "KEYB": keyb, + "AUTH": auth + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return price_fluct( + excd, gubn, mixn, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래증가율순위[해외주식-045] +############################################################################################## + +def trade_growth( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 > 해외주식 거래증가율순위[해외주식-045] + 해외주식 거래증가율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터프레임 튜플 + + Example: + >>> df1, df2 = trade_growth(excd="NAS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if nday == "": + raise ValueError("nday is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76330000" # 해외주식 거래증가율순위 + + api_url = "/uapi/overseas-stock/v1/ranking/trade-growth" + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_growth( + excd, nday, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래대금순위[해외주식-044] +############################################################################################## + +def trade_pbmn( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + prc1: str = "", # 현재가 필터범위 시작 + prc2: str = "", # 현재가 필터범위 끝 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 거래대금순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + prc1 (str): 현재가 필터범위 시작 + prc2 (str): 현재가 필터범위 끝 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 거래대금순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = trade_pbmn(excd="NAS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError( + "excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년')") + + if vol_rang == "": + raise ValueError( + "vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None or dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1, dataframe2 + + tr_id = "HHDFS76320010" # 해외주식 거래대금순위 + + api_url = "/uapi/overseas-stock/v1/ranking/trade-pbmn" + + params = { + "EXCD": excd, # 거래소명 + "NDAY": nday, # N일자값 + "VOL_RANG": vol_rang, # 거래량조건 + "AUTH": auth, # 사용자권한정보 + "KEYB": keyb, # NEXT KEY BUFF + "PRC1": prc1, # 현재가 필터범위 시작 + "PRC2": prc2, # 현재가 필터범위 끝 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + keyb = res.getBody().keyb if hasattr(res.getBody(), 'keyb') else "" + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_pbmn( + excd, nday, vol_rang, auth, keyb, prc1, prc2, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] +############################################################################################## + +def trade_turnover( + excd: str, # 거래소명 + nday: str, # N분전콤보값 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀 깊이 (자동 관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래회전율순위[해외주식-046] + 해외주식 거래회전율순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N분전콤보값 (ex. 0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 해외주식 거래회전율순위 데이터 + + Example: + >>> result1, result2 = trade_turnover(excd="SHS", nday="0", vol_rang="0") + >>> print(result1) + >>> print(result2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError( + "excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError( + "nday is required (e.g. '0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전')") + + if vol_rang == "": + raise ValueError( + "vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + # 재귀 깊이 제한 확인 + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76340000" # 해외주식 거래회전율순위 + + api_url = "/uapi/overseas-stock/v1/ranking/trade-turnover" + + params = { + "EXCD": excd, # 거래소명 + "NDAY": nday, # N분전콤보값 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth # 사용자권한정보 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_turnover( + excd, nday, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] +############################################################################################## + +def trade_vol( + excd: str, # 거래소명 + nday: str, # N분전콤보값 + vol_rang: str, # 거래량조건 + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + prc1: str = "", # 가격 필터 시작 + prc2: str = "", # 가격 필터 종료 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래량순위[해외주식-043] + 해외주식 거래량순위 API를 호출하여 DataFrame으로 반환합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N분전콤보값 (ex. 0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF (ex. "") + auth (str): 사용자권한정보 (ex. "") + prc1 (str): 가격 필터 시작 (ex. "") + prc2 (str): 가격 필터 종료 (ex. "") + tr_cont (str): 연속거래여부 (ex. "") + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 거래량순위 데이터 (output1, output2) + + Example: + >>> df1, df2 = trade_vol(excd="NYS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError( + "excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError( + "nday is required (e.g. '0:당일, 1:2일전, 2:3일전, 3:5일전, 4:10일전, 5:20일전, 6:30일전, 7:60일전, 8:120일전, 9:1년전')") + + if vol_rang == "": + raise ValueError( + "vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76310010" # 해외주식 거래량순위 + + api_url = "/uapi/overseas-stock/v1/ranking/trade-vol" + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "KEYB": keyb, + "AUTH": auth, + "PRC1": prc1, + "PRC2": prc2 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return trade_vol( + excd, nday, vol_rang, keyb, auth, prc1, prc2, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상승률/하락률[해외주식-041] +############################################################################################## + +def updown_rate( + excd: str, # [필수] 거래소명 + nday: str, # [필수] N일자값 + gubn: str, # [필수] 상승율/하락율 구분 + vol_rang: str, # [필수] 거래량조건 + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 상승률/하락률 순위를 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + gubn (str): [필수] 상승율/하락율 구분 (ex. 0:하락율, 1:상승율) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 상승률/하락률 순위 데이터 + + Example: + >>> df1, df2 = updown_rate(excd="NYS", nday="0", gubn="1", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + # 필수 파라미터 검증 + if excd == "": + raise ValueError( + "excd is required (e.g. 'NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄')") + + if nday == "": + raise ValueError("nday is required (e.g. '0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년')") + + if gubn == "": + raise ValueError("gubn is required (e.g. '0:하락율, 1:상승율')") + + if vol_rang == "": + raise ValueError( + "vol_rang is required (e.g. '0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None and dataframe2 is None: + return pd.DataFrame(), pd.DataFrame() + else: + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76290000" + + api_url = "/uapi/overseas-stock/v1/ranking/updown-rate" + + params = { + "EXCD": excd, + "NDAY": nday, + "GUBN": gubn, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return updown_rate( + excd, nday, gubn, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] +############################################################################################## + +def volume_power( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday: str, # [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # output1 누적 데이터프레임 + dataframe2: Optional[pd.DataFrame] = None, # output2 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 매수체결강도상위[해외주식-040] + + 해외주식 매수 체결강도 상위 종목을 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + nday (str): [필수] N일자값 (ex. 0:당일, 1:2일, 2:3일, 3:5일, 4:10일, 5:20일전, 6:30일, 7:60일, 8:120일, 9:1년) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): output1 누적 데이터프레임 + dataframe2 (Optional[pd.DataFrame]): output2 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = volume_power(excd="HKS", nday="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'HKS')") + + if nday == "": + raise ValueError("nday is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76280000" + + api_url = "/uapi/overseas-stock/v1/ranking/volume-power" + + params = { + "EXCD": excd, + "NDAY": nday, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_power( + excd, nday, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] +############################################################################################## + +def volume_surge( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn: str, # [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb: str = "", # NEXT KEY BUFF + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 시세분석 > 해외주식 거래량급증[해외주식-039] + 해외주식 거래량급증 정보를 조회합니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + mixn (str): [필수] N분전콤보값 (ex. 0:1분전, 1:2분전, 2:3분전, 3:5분전, 4:10분전, 5:15분전, 6:20분전, 7:30분전, 8:60분전, 9:120분전) + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + keyb (str): NEXT KEY BUFF + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = volume_surge(excd="NYS", mixn="0", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS')") + + if mixn == "": + raise ValueError("mixn is required (e.g. '0')") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76270000" # 해외주식 거래량급증 + + api_url = "/uapi/overseas-stock/v1/ranking/volume-surge" + + params = { + "EXCD": excd, # 거래소명 + "MIXN": mixn, # N분전콤보값 + "VOL_RANG": vol_rang, # 거래량조건 + "KEYB": keyb, # NEXT KEY BUFF + "AUTH": auth # 사용자권한정보 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return volume_surge( + excd, mixn, vol_rang, keyb, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외속보(제목) [해외주식-055] +############################################################################################## + +def brknews_title( + fid_news_ofer_entp_code: str, # [필수] 뉴스제공업체코드 (ex. 0:전체조회) + fid_cond_scr_div_code: str, # [필수] 조건화면분류코드 (ex. 11801) + fid_cond_mrkt_cls_code: str = "", # 조건시장구분코드 + fid_input_iscd: str = "", # 입력종목코드 + fid_titl_cntt: str = "", # 제목내용 + fid_input_date_1: str = "", # 입력날짜1 + fid_input_hour_1: str = "", # 입력시간1 + fid_rank_sort_cls_code: str = "", # 순위정렬구분코드 + fid_input_srno: str = "" # 입력일련번호 +) -> pd.DataFrame: + """ + 해외속보(제목) API입니다. + 한국투자 HTS(eFriend Plus) > [7704] 해외속보 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 최대 100건까지 조회 가능합니다. + + Args: + fid_news_ofer_entp_code (str): [필수] 뉴스제공업체코드 (ex. 0:전체조회) + fid_cond_scr_div_code (str): [필수] 조건화면분류코드 (ex. 11801) + fid_cond_mrkt_cls_code (str): 조건시장구분코드 + fid_input_iscd (str): 입력종목코드 + fid_titl_cntt (str): 제목내용 + fid_input_date_1 (str): 입력날짜1 + fid_input_hour_1 (str): 입력시간1 + fid_rank_sort_cls_code (str): 순위정렬구분코드 + fid_input_srno (str): 입력일련번호 + + Returns: + pd.DataFrame: 해외속보(제목) 데이터 + + Example: + >>> df = brknews_title("0", "11801") + >>> print(df) + """ + + if fid_news_ofer_entp_code == "": + raise ValueError("fid_news_ofer_entp_code is required (e.g. '0')") + + if fid_cond_scr_div_code == "": + raise ValueError("fid_cond_scr_div_code is required (e.g. '11801')") + + tr_id = "FHKST01011801" + + api_url = "/uapi/overseas-price/v1/quotations/brknews-title" + + params = { + "FID_NEWS_OFER_ENTP_CODE": fid_news_ofer_entp_code, + "FID_COND_SCR_DIV_CODE": fid_cond_scr_div_code, + "FID_COND_MRKT_CLS_CODE": fid_cond_mrkt_cls_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_TITL_CNTT": fid_titl_cntt, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_HOUR_1": fid_input_hour_1, + "FID_RANK_SORT_CLS_CODE": fid_rank_sort_cls_code, + "FID_INPUT_SRNO": fid_input_srno + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + return pd.DataFrame(res.getBody().output) + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 당사 해외주식담보대출 가능 종목 [해외주식-051] +############################################################################################## + +def colable_by_company( + pdno: str, # 상품번호 + natn_cd: str, # 국가코드 + inqr_sqn_dvsn: str, # 조회순서구분 + prdt_type_cd: str = "", # 상품유형코드 + inqr_strt_dt: str = "", # 조회시작일자 + inqr_end_dt: str = "", # 조회종료일자 + inqr_dvsn: str = "", # 조회구분 + rt_dvsn_cd: str = "", # 비율구분코드 + rt: str = "", # 비율 + loan_psbl_yn: str = "", # 대출가능여부 + FK100: str = "", # 연속조회검색조건100 + NK100: str = "", # 연속조회키100 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 당사 해외주식담보대출 가능 종목 API입니다. + 한국투자 HTS(eFriend Plus) > [0497] 당사 해외주식담보대출 가능 종목 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + 한 번의 호출에 20건까지 조회가 가능하며 다음조회가 불가하기에, PDNO에 데이터 확인하고자 하는 종목코드를 입력하여 단건조회용으로 사용하시기 바랍니다. + + Args: + pdno (str): [필수] 상품번호 (ex. AMD) + natn_cd (str): [필수] 국가코드 (ex. 840:미국,344:홍콩,156:중국) + inqr_sqn_dvsn (str): [필수] 조회순서구분 (ex. 01:이름순,02:코드순) + prdt_type_cd (str): 상품유형코드 + inqr_strt_dt (str): 조회시작일자 + inqr_end_dt (str): 조회종료일자 + inqr_dvsn (str): 조회구분 + rt_dvsn_cd (str): 비율구분코드 + rt (str): 비율 + loan_psbl_yn (str): 대출가능여부 + FK100 (str): 연속조회검색조건100 + NK100 (str): 연속조회키100 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = colable_by_company(pdno="AMD", natn_cd="840", inqr_sqn_dvsn="01") + >>> print(df1) # output1 데이터 + >>> print(df2) # output2 데이터 + """ + + # 필수 파라미터 검증 + if pdno == "": + raise ValueError("pdno is required (e.g. 'AMD')") + + if natn_cd == "": + raise ValueError("natn_cd is required (e.g. '840:미국,344:홍콩,156:중국')") + + if inqr_sqn_dvsn == "": + raise ValueError("inqr_sqn_dvsn is required (e.g. '01:이름순,02:코드순')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "CTLN4050R" + + api_url = "/uapi/overseas-price/v1/quotations/colable-by-company" + + params = { + "PDNO": pdno, + "NATN_CD": natn_cd, + "INQR_SQN_DVSN": inqr_sqn_dvsn, + "PRDT_TYPE_CD": prdt_type_cd, + "INQR_STRT_DT": inqr_strt_dt, + "INQR_END_DT": inqr_end_dt, + "INQR_DVSN": inqr_dvsn, + "RT_DVSN_CD": rt_dvsn_cd, + "RT": rt, + "LOAN_PSBL_YN": loan_psbl_yn, + "CTX_AREA_FK100": FK100, + "CTX_AREA_NK100": NK100 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (array) + current_data1 = pd.DataFrame(res.getBody().output1) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (object) + current_data2 = pd.DataFrame([res.getBody().output2]) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + FK100 = res.getBody().ctx_area_fk100 + NK100 = res.getBody().ctx_area_nk100 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return colable_by_company( + pdno, natn_cd, inqr_sqn_dvsn, prdt_type_cd, inqr_strt_dt, inqr_end_dt, + inqr_dvsn, rt_dvsn_cd, rt, loan_psbl_yn, FK100, NK100, "N", + dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + +############################################################################################## +# [해외주식] 기본시세 > 해외결제일자조회[해외주식-017] +############################################################################################## + +def countries_holiday( + trad_dt: str, # 기준일자 + NK: str = "", # 연속조회키 + FK: str = "", # 연속조회검색조건 + tr_cont: str = "", # 연속 거래 여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 현재 재귀 깊이 + max_depth: int = 10 # 최대 재귀 깊이 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외결제일자조회[해외주식-017] + 해외결제일자조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + trad_dt (str): 기준일자(YYYYMMDD) + ctx_area_nk (str): 공백으로 입력 + ctx_area_fk (str): 공백으로 입력 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외결제일자조회 데이터 + + Example: + >>> df = countries_holiday("20250131", "", "") + >>> print(df) + """ + # 필수 파라미터 검증 + if not trad_dt: + logger.error("trad_dt is required. (e.g. '20250131')") + raise ValueError("trad_dt is required. (e.g. '20250131')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTOS5011R" + + api_url = "/uapi/overseas-stock/v1/quotations/countries-holiday" + + params = { + "TRAD_DT": trad_dt, + "CTX_AREA_NK": NK, + "CTX_AREA_FK": FK, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + # 데이터프레임 병합 + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + # 연속 거래 여부 확인 + tr_cont = res.getHeader().tr_cont + NK = res.getBody().ctx_area_nk + FK = res.getBody().ctx_area_fk + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return countries_holiday( + trad_dt, + NK, + FK, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 기간별시세[v1_해외주식-010] +############################################################################################## + +def dailyprice( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + gubn: str, # 일/주/월구분 + bymd: str, # 조회기준일자 + modp: str, # 수정주가반영여부 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 기간별시세[v1_해외주식-010] + 해외주식 기간별시세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 (예: "") + excd (str): 거래소코드 (예: "NAS") + symb (str): 종목코드 (예: "TSLA") + gubn (str): 일/주/월구분 (예: "0") + bymd (str): 조회기준일자(YYYYMMDD) (예: "20230101") + modp (str): 수정주가반영여부 (예: "0") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 기간별시세 데이터 + + Example: + >>> df1, df2 = dailyprice("auth_token", "NAS", "TSLA", "0", "20230101", "0", "") + >>> print(df1) + >>> print(df2) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + if not gubn: + logger.error("gubn is required. (e.g. '0')") + raise ValueError("gubn is required. (e.g. '0')") + if not modp: + logger.error("modp is required. (e.g. '0')") + raise ValueError("modp is required. (e.g. '0')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "HHDFS76240000" # 실전/모의투자 공통 TR ID + else: + logger.error("env_dv can only be 'real' or 'demo'") + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-price/v1/quotations/dailyprice" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + "GUBN": gubn, + "BYMD": bymd, + "MODP": modp, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return dailyprice( + auth, + excd, + symb, + gubn, + bymd, + modp, + env_dv, + dataframe1, + dataframe2, + "N", + depth + 1, + max_depth + ) + + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별코드조회[해외주식-049] +############################################################################################## + +def industry_price( + excd: str, # [필수] 거래소명 + auth: str = "", # 사용자권한정보 + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 업종별코드조회 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + auth (str): 사용자권한정보 + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1, output2) 데이터 + + Example: + >>> df1, df2 = industry_price(excd="NAS") + >>> print(df1, df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NYS', 'NAS', 'AMS', 'HKS', 'SHS', 'SZS', 'HSX', 'HNX', 'TSE')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76370100" + + api_url = "/uapi/overseas-price/v1/quotations/industry-price" + + params = { + "EXCD": excd, + "AUTH": auth + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 (object 타입) + current_data1 = pd.DataFrame([res.getBody().output1]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 처리 (array 타입) + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return industry_price( + excd, auth, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 업종별시세[해외주식-048] +############################################################################################## + +def industry_theme( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + icod: str, # [필수] 업종코드 + vol_rang: str, # [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임1 + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임2 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + 해외주식 업종별시세 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + icod (str): [필수] 업종코드 + vol_rang (str): [필수] 거래량조건 (ex. 0:전체, 1:1백주이상, 2:1천주이상, 3:1만주이상, 4:10만주이상, 5:100만주이상, 6:1000만주이상) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임1 + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임2 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: (output1 데이터, output2 데이터) + + Example: + >>> df1, df2 = industry_theme(excd="NAS", icod="010", vol_rang="0") + >>> print(df1) + >>> print(df2) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if icod == "": + raise ValueError("icod is required") + + if vol_rang == "": + raise ValueError("vol_rang is required (e.g. '0')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe1 is None: + dataframe1 = pd.DataFrame() + if dataframe2 is None: + dataframe2 = pd.DataFrame() + return dataframe1, dataframe2 + + tr_id = "HHDFS76370000" + + api_url = "/uapi/overseas-price/v1/quotations/industry-theme" + + params = { + "EXCD": excd, + "ICOD": icod, + "VOL_RANG": vol_rang, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 데이터 처리 + current_data1 = pd.DataFrame(res.getBody().output1, index=[0]) + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + + # output2 데이터 처리 + current_data2 = pd.DataFrame(res.getBody().output2) + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return industry_theme( + excd, icod, vol_rang, auth, keyb, "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + res.printError(url=api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가 1호가[해외주식-033] +############################################################################################## + +def inquire_asking_price( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + dataframe3: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output3) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재가 1호가[해외주식-033] + 해외주식 현재가 1호가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소코드 (예: NYS, NAS, AMS, 등) + symb (str): 종목코드 (예: TSLA) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + dataframe3 (Optional[pd.DataFrame]): 누적 데이터프레임 (output3) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: 해외주식 현재가 1호가 데이터 + + Example: + >>> df1, df2, df3 = inquire_asking_price(auth="your_auth_token", excd="NAS", symb="TSLA") + >>> print(df1) + >>> print(df2) + >>> print(df3) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame(), dataframe3 if dataframe3 is not None else pd.DataFrame() + + tr_id = "HHDFS76200100" + + api_url = "/uapi/overseas-price/v1/quotations/inquire-asking-price" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + # output3 처리 + if hasattr(res.getBody(), 'output3'): + output_data = res.getBody().output3 + if output_data: + if isinstance(output_data, list): + current_data3 = pd.DataFrame(output_data) + else: + current_data3 = pd.DataFrame([output_data]) + + if dataframe3 is not None: + dataframe3 = pd.concat([dataframe3, current_data3], ignore_index=True) + else: + dataframe3 = current_data3 + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + else: + if dataframe3 is None: + dataframe3 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_asking_price( + auth, + excd, + symb, + "N", dataframe1, dataframe2, dataframe3, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2, dataframe3 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 체결추이[해외주식-037] +############################################################################################## + +def quot_inquire_ccnl( + excd: str, # [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + tday: str, # [필수] 당일전일구분 (ex. 0:전일, 1:당일) + symb: str, # [필수] 종목코드 (ex. 해외종목코드) + auth: str = "", # 사용자권한정보 + keyb: str = "", # NEXT KEY BUFF + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 체결추이 API입니다. + + Args: + excd (str): [필수] 거래소명 (ex. NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄) + tday (str): [필수] 당일전일구분 (ex. 0:전일, 1:당일) + symb (str): [필수] 종목코드 (ex. 해외종목코드) + auth (str): 사용자권한정보 + keyb (str): NEXT KEY BUFF + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 체결추이 데이터 + + Example: + >>> df = quot_inquire_ccnl(excd="NAS", tday="0", symb="TSLA") + >>> print(df) + """ + + if excd == "": + raise ValueError("excd is required (e.g. 'NAS')") + + if tday == "": + raise ValueError("tday is required (e.g. '0' or '1')") + + if symb == "": + raise ValueError("symb is required (e.g. 'TSLA')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "HHDFS76200300" + + api_url = "/uapi/overseas-price/v1/quotations/inquire-ccnl" + + params = { + "EXCD": excd, + "TDAY": tday, + "SYMB": symb, + "AUTH": auth, + "KEYB": keyb + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + keyb = res.getBody().keyb if hasattr(res.getBody(), 'keyb') else "" + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return quot_inquire_ccnl( + excd, tday, symb, auth, keyb, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] +############################################################################################## + +def inquire_daily_chartprice( + fid_cond_mrkt_div_code: str, # FID 조건 시장 분류 코드 + fid_input_iscd: str, # FID 입력 종목코드 + fid_input_date_1: str, # FID 입력 날짜1 + fid_input_date_2: str, # FID 입력 날짜2 + fid_period_div_code: str, # FID 기간 분류 코드 + env_dv: str = "real", # 실전모의구분 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 종목_지수_환율기간별시세(일_주_월_년)[v1_해외주식-012] + 해외주식 종목_지수_환율기간별시세(일_주_월_년) API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): N: 해외지수, X 환율, I: 국채, S:금선물 + fid_input_iscd (str): 종목코드 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드(해외) > 해외지수) ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다. + fid_input_date_1 (str): 시작일자(YYYYMMDD) + fid_input_date_2 (str): 종료일자(YYYYMMDD) + fid_period_div_code (str): D:일, W:주, M:월, Y:년 + env_dv (str): 실전모의구분 (real:실전, demo:모의) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식 종목_지수_환율기간별시세(일_주_월_년) 데이터 + + Example: + >>> df1, df2 = inquire_daily_chartprice( + ... fid_cond_mrkt_div_code="N", + ... fid_input_iscd=".DJI", + ... fid_input_date_1="20220401", + ... fid_input_date_2="20220613", + ... fid_period_div_code="D", + ... env_dv="real" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'N')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'N')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. '.DJI')") + raise ValueError("fid_input_iscd is required. (e.g. '.DJI')") + if not fid_input_date_1: + logger.error("fid_input_date_1 is required. (e.g. '20220401')") + raise ValueError("fid_input_date_1 is required. (e.g. '20220401')") + if not fid_input_date_2: + logger.error("fid_input_date_2 is required. (e.g. '20220613')") + raise ValueError("fid_input_date_2 is required. (e.g. '20220613')") + if not fid_period_div_code: + logger.error("fid_period_div_code is required. (e.g. 'D')") + raise ValueError("fid_period_div_code is required. (e.g. 'D')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "FHKST03030100" # 실전투자용 TR ID + else: + raise ValueError("env_dv can only be 'real' or 'demo'") + + api_url = "/uapi/overseas-price/v1/quotations/inquire-daily-chartprice" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_INPUT_DATE_1": fid_input_date_1, + "FID_INPUT_DATE_2": fid_input_date_2, + "FID_PERIOD_DIV_CODE": fid_period_div_code, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_daily_chartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_input_date_1, + fid_input_date_2, + fid_period_div_code, + env_dv, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식조건검색[v1_해외주식-015] +############################################################################################## + +def inquire_search( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + co_yn_pricecur: str, # 현재가선택조건 + co_st_pricecur: str, # 현재가시작범위가 + co_en_pricecur: str, # 현재가끝범위가 + co_yn_rate: str, # 등락율선택조건 + co_st_rate: str, # 등락율시작율 + co_en_rate: str, # 등락율끝율 + co_yn_valx: str, # 시가총액선택조건 + co_st_valx: str, # 시가총액시작액 + co_en_valx: str, # 시가총액끝액 + co_yn_shar: str, # 발행주식수선택조건 + co_st_shar: str, # 발행주식시작수 + co_en_shar: str, # 발행주식끝수 + co_yn_volume: str, # 거래량선택조건 + co_st_volume: str, # 거래량시작량 + co_en_volume: str, # 거래량끝량 + co_yn_amt: str, # 거래대금선택조건 + co_st_amt: str, # 거래대금시작금 + co_en_amt: str, # 거래대금끝금 + co_yn_eps: str, # EPS선택조건 + co_st_eps: str, # EPS시작 + co_en_eps: str, # EPS끝 + co_yn_per: str, # PER선택조건 + co_st_per: str, # PER시작 + co_en_per: str, # PER끝 + keyb: str, # NEXT KEY BUFF + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식조건검색[v1_해외주식-015] + 해외주식조건검색 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): "" (Null 값 설정) + excd (str): NYS : 뉴욕, NAS : 나스닥, AMS : 아멕스 HKS : 홍콩, SHS : 상해 , SZS : 심천 HSX : 호치민, HNX : 하노이 TSE : 도쿄 + co_yn_pricecur (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_pricecur (str): 단위: 각국통화(JPY, USD, HKD, CNY, VND) + co_en_pricecur (str): 단위: 각국통화(JPY, USD, HKD, CNY, VND) + co_yn_rate (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_rate (str): % + co_en_rate (str): % + co_yn_valx (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_valx (str): 단위: 천 + co_en_valx (str): 단위: 천 + co_yn_shar (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_shar (str): 단위: 천 + co_en_shar (str): 단위: 천 + co_yn_volume (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_volume (str): 단위: 주 + co_en_volume (str): 단위: 주 + co_yn_amt (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_amt (str): 단위: 천 + co_en_amt (str): 단위: 천 + co_yn_eps (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_eps (str): + co_en_eps (str): + co_yn_per (str): 해당조건 사용시(1), 미사용시 필수항목아님 + co_st_per (str): + co_en_per (str): + keyb (str): "" 공백 입력 + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식조건검색 데이터 + + Example: + >>> df1, df2 = inquire_search( + ... auth="", excd="NAS", co_yn_pricecur="1", co_st_pricecur="160", co_en_pricecur="161", + ... co_yn_rate="", co_st_rate="", co_en_rate="", co_yn_valx="", co_st_valx="", co_en_valx="", + ... co_yn_shar="", co_st_shar="", co_en_shar="", co_yn_volume="", co_st_volume="", co_en_volume="", + ... co_yn_amt="", co_st_amt="", co_en_amt="", co_yn_eps="", co_st_eps="", co_en_eps="", + ... co_yn_per="", co_st_per="", co_en_per="", keyb="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76410000" + + api_url = "/uapi/overseas-price/v1/quotations/inquire-search" + + params = { + "AUTH": auth, + "EXCD": excd, + "CO_YN_PRICECUR": co_yn_pricecur, + "CO_ST_PRICECUR": co_st_pricecur, + "CO_EN_PRICECUR": co_en_pricecur, + "CO_YN_RATE": co_yn_rate, + "CO_ST_RATE": co_st_rate, + "CO_EN_RATE": co_en_rate, + "CO_YN_VALX": co_yn_valx, + "CO_ST_VALX": co_st_valx, + "CO_EN_VALX": co_en_valx, + "CO_YN_SHAR": co_yn_shar, + "CO_ST_SHAR": co_st_shar, + "CO_EN_SHAR": co_en_shar, + "CO_YN_VOLUME": co_yn_volume, + "CO_ST_VOLUME": co_st_volume, + "CO_EN_VOLUME": co_en_volume, + "CO_YN_AMT": co_yn_amt, + "CO_ST_AMT": co_st_amt, + "CO_EN_AMT": co_en_amt, + "CO_YN_EPS": co_yn_eps, + "CO_ST_EPS": co_st_eps, + "CO_EN_EPS": co_en_eps, + "CO_YN_PER": co_yn_per, + "CO_ST_PER": co_st_per, + "CO_EN_PER": co_en_per, + "KEYB": keyb, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + # output1은 단일 객체, output2는 배열일 수 있음 + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + # 단일 객체인 경우 리스트로 감싸서 DataFrame 생성 + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_search( + auth, + excd, + co_yn_pricecur, + co_st_pricecur, + co_en_pricecur, + co_yn_rate, + co_st_rate, + co_en_rate, + co_yn_valx, + co_st_valx, + co_en_valx, + co_yn_shar, + co_st_shar, + co_en_shar, + co_yn_volume, + co_st_volume, + co_en_volume, + co_yn_amt, + co_st_amt, + co_en_amt, + co_yn_eps, + co_st_eps, + co_en_eps, + co_yn_per, + co_st_per, + co_en_per, + keyb, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외지수분봉조회[v1_해외주식-031] +############################################################################################## + +def inquire_time_indexchartprice( + fid_cond_mrkt_div_code: str, # 조건 시장 분류 코드 + fid_input_iscd: str, # 입력 종목코드 + fid_hour_cls_code: str, # 시간 구분 코드 + fid_pw_data_incu_yn: str, # 과거 데이터 포함 여부 + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외지수분봉조회[v1_해외주식-031] + 해외지수분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + fid_cond_mrkt_div_code (str): N 해외지수 X 환율 KX 원화환율 + fid_input_iscd (str): 종목번호(ex. TSLA) + fid_hour_cls_code (str): 0: 정규장, 1: 시간외 + fid_pw_data_incu_yn (str): Y/N + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외지수분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_indexchartprice( + ... fid_cond_mrkt_div_code="N", + ... fid_input_iscd="SPX", + ... fid_hour_cls_code="0", + ... fid_pw_data_incu_yn="Y" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not fid_cond_mrkt_div_code: + logger.error("fid_cond_mrkt_div_code is required. (e.g. 'N')") + raise ValueError("fid_cond_mrkt_div_code is required. (e.g. 'N')") + if not fid_input_iscd: + logger.error("fid_input_iscd is required. (e.g. 'SPX')") + raise ValueError("fid_input_iscd is required. (e.g. 'SPX')") + if not fid_hour_cls_code: + logger.error("fid_hour_cls_code is required. (e.g. '0')") + raise ValueError("fid_hour_cls_code is required. (e.g. '0')") + if not fid_pw_data_incu_yn: + logger.error("fid_pw_data_incu_yn is required. (e.g. 'Y')") + raise ValueError("fid_pw_data_incu_yn is required. (e.g. 'Y')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "FHKST03030200" + + api_url = "/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice" + + params = { + "FID_COND_MRKT_DIV_CODE": fid_cond_mrkt_div_code, + "FID_INPUT_ISCD": fid_input_iscd, + "FID_HOUR_CLS_CODE": fid_hour_cls_code, + "FID_PW_DATA_INCU_YN": fid_pw_data_incu_yn, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_indexchartprice( + fid_cond_mrkt_div_code, + fid_input_iscd, + fid_hour_cls_code, + fid_pw_data_incu_yn, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식분봉조회[v1_해외주식-030] +############################################################################################## + +def inquire_time_itemchartprice( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + nmin: str, # 분갭 + pinc: str, # 전일포함여부 + next: str, # 다음여부 + nrec: str, # 요청갯수 + fill: str, # 미체결채움구분 + keyb: str, # NEXT KEY BUFF + dataframe1: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output1) + dataframe2: Optional[pd.DataFrame] = None, # 누적 데이터프레임 (output2) + tr_cont: str = "", + depth: int = 0, + max_depth: int = 10 +) -> Tuple[pd.DataFrame, pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식분봉조회[v1_해외주식-030] + 해외주식분봉조회 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): "" 공백으로 입력 + excd (str): NYS : 뉴욕 NAS : 나스닥 AMS : 아멕스 HKS : 홍콩 SHS : 상해 SZS : 심천 HSX : 호치민 HNX : 하노이 TSE : 도쿄 ※ 주간거래는 최대 1일치 분봉만 조회 가능 BAY : 뉴욕(주간) BAQ : 나스닥(주간) BAA : 아멕스(주간) + symb (str): 종목코드(ex. TSLA) + nmin (str): 분단위(1: 1분봉, 2: 2분봉, ...) + pinc (str): 0:당일 1:전일포함 ※ 다음조회 시 반드시 "1"로 입력 + next (str): 처음조회 시, "" 공백 입력 다음조회 시, "1" 입력 + nrec (str): 레코드요청갯수 (최대 120) + fill (str): "" 공백으로 입력 + keyb (str): 처음 조회 시, "" 공백 입력 다음 조회 시, 이전 조회 결과의 마지막 분봉 데이터를 이용하여, 1분 전 혹은 n분 전의 시간을 입력 (형식: YYYYMMDDHHMMSS, ex. 20241014140100) + dataframe1 (Optional[pd.DataFrame]): 누적 데이터프레임 (output1) + dataframe2 (Optional[pd.DataFrame]): 누적 데이터프레임 (output2) + tr_cont (str): 연속 거래 여부 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Tuple[pd.DataFrame, pd.DataFrame]: 해외주식분봉조회 데이터 + + Example: + >>> df1, df2 = inquire_time_itemchartprice( + ... auth="", excd="NAS", symb="TSLA", nmin="5", pinc="1", next="1", nrec="120", fill="", keyb="" + ... ) + >>> print(df1) + >>> print(df2) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + if not nmin: + logger.error("nmin is required. (e.g. '5')") + raise ValueError("nmin is required. (e.g. '5')") + if not pinc: + logger.error("pinc is required. (e.g. '1')") + raise ValueError("pinc is required. (e.g. '1')") + if not nrec or int(nrec) > 120: + logger.error("nrec is required. (e.g. '120', 최대120개)") + raise ValueError("nrec is required. (e.g. '120', 최대120개)") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe1 if dataframe1 is not None else pd.DataFrame(), dataframe2 if dataframe2 is not None else pd.DataFrame() + + tr_id = "HHDFS76950200" + + api_url = "/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + "NMIN": nmin, + "PINC": pinc, + "NEXT": next, + "NREC": nrec, + "FILL": fill, + "KEYB": keyb, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + # Output1 처리 + if hasattr(res.getBody(), 'output1'): + output_data = res.getBody().output1 + if output_data: + if isinstance(output_data, list): + current_data1 = pd.DataFrame(output_data) + else: + current_data1 = pd.DataFrame([output_data]) + + if dataframe1 is not None: + dataframe1 = pd.concat([dataframe1, current_data1], ignore_index=True) + else: + dataframe1 = current_data1 + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + else: + if dataframe1 is None: + dataframe1 = pd.DataFrame() + + # Output2 처리 + if hasattr(res.getBody(), 'output2'): + output_data = res.getBody().output2 + if output_data: + if isinstance(output_data, list): + current_data2 = pd.DataFrame(output_data) + else: + current_data2 = pd.DataFrame([output_data]) + + if dataframe2 is not None: + dataframe2 = pd.concat([dataframe2, current_data2], ignore_index=True) + else: + dataframe2 = current_data2 + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + else: + if dataframe2 is None: + dataframe2 = pd.DataFrame() + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: + logger.info("Calling next page...") + ka.smart_sleep() + return inquire_time_itemchartprice( + auth, + excd, + symb, + nmin, + pinc, + next, + nrec, + fill, + keyb, + "N", dataframe1, dataframe2, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe1, dataframe2 + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame(), pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외뉴스종합(제목) [해외주식-053] +############################################################################################## + +def news_title( + info_gb: str = "", # [필수] 뉴스구분 + class_cd: str = "", # [필수] 중분류 + nation_cd: str = "", # [필수] 국가코드 (ex. 공백:전체, CN:중국, HK:홍콩, US:미국) + exchange_cd: str = "", # [필수] 거래소코드 + symb: str = "", # [필수] 종목코드 + data_dt: str = "", # [필수] 조회일자 + data_tm: str = "", # [필수] 조회시간 + cts: str = "", # [필수] 다음키 + tr_cont: str = "", # [필수] 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외뉴스종합(제목) API입니다. + 한국투자 HTS(eFriend Plus) > [7702] 해외뉴스종합 화면의 "우측 상단 뉴스목록" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + Args: + info_gb (str): [필수] 뉴스구분 + class_cd (str): [필수] 중분류 + nation_cd (str): [필수] 국가코드 (ex. 공백:전체, CN:중국, HK:홍콩, US:미국) + exchange_cd (str): [필수] 거래소코드 + symb (str): [필수] 종목코드 + data_dt (str): [필수] 조회일자 + data_tm (str): [필수] 조회시간 + cts (str): [필수] 다음키 + tr_cont (str): [필수] 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외뉴스종합(제목) 데이터 + + Example: + >>> df = news_title() + >>> print(df) + """ + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "HHPSTH60100C1" # 해외뉴스종합(제목) + + api_url = "/uapi/overseas-price/v1/quotations/news-title" + + params = { + "INFO_GB": info_gb, # 뉴스구분 + "CLASS_CD": class_cd, # 중분류 + "NATION_CD": nation_cd, # 국가코드 + "EXCHANGE_CD": exchange_cd, # 거래소코드 + "SYMB": symb, # 종목코드 + "DATA_DT": data_dt, # 조회일자 + "DATA_TM": data_tm, # 조회시간 + "CTS": cts # 다음키 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().outblock1) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return news_title( + info_gb, class_cd, nation_cd, exchange_cd, symb, data_dt, data_tm, cts, "N", dataframe, depth + 1, + max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 기간별권리조회 [해외주식-052] +############################################################################################## + +def period_rights( + rght_type_cd: str, # 권리유형코드 + inqr_dvsn_cd: str, # 조회구분코드 + inqr_strt_dt: str, # 조회시작일자 + inqr_end_dt: str, # 조회종료일자 + pdno: str = "", # 상품번호 + prdt_type_cd: str = "", # 상품유형코드 + NK50: str = "", # 연속조회키50 + FK50: str = "", # 연속조회검색조건50 + tr_cont: str = "", # 연속거래여부 + dataframe: Optional[pd.DataFrame] = None, # 누적 데이터프레임 + depth: int = 0, # 내부 재귀깊이 (자동관리) + max_depth: int = 10 # 최대 재귀 횟수 제한 +) -> pd.DataFrame: + """ + 해외주식 기간별권리조회 API입니다. + 한국투자 HTS(eFriend Plus) > [7520] 기간별해외증권권리조회 화면을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 확정여부가 '예정'으로 표시되는 경우는 권리정보가 변경될 수 있으니 참고자료로만 활용하시기 바랍니다. + + Args: + rght_type_cd (str): [필수] 권리유형코드 (%%:전체, 01:유상, 02:무상, 03:배당, 11:합병,14:액면분할, 15:액면병합, 17:감자, 54:WR청구,61:원리금상환, 71:WR소멸, 74:배당옵션, 75:특별배당, 76:ISINCODE변경, 77:실권주청약) + inqr_dvsn_cd (str): [필수] 조회구분코드 (02:현지기준일, 03:청약시작일, 04:청약종료일) + inqr_strt_dt (str): [필수] 조회시작일자 (20250101) + inqr_end_dt (str): [필수] 조회종료일자 (20250131) + pdno (str): 상품번호 + prdt_type_cd (str): 상품유형코드 + NK50 (str): 연속조회키50 + FK50 (str): 연속조회검색조건50 + tr_cont (str): 연속거래여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 내부 재귀깊이 (자동관리) + max_depth (int): 최대 재귀 횟수 제한 + + Returns: + pd.DataFrame: 해외주식 기간별권리조회 데이터 + + Example: + >>> df = period_rights("%%", "02", "20240417", "20240417") + >>> print(df) + """ + + # 필수 파라미터 검증 + if rght_type_cd == "": + raise ValueError( + "rght_type_cd is required (e.g. '%%:전체, 01:유상, 02:무상, 03:배당, 11:합병,14:액면분할, 15:액면병합, 17:감자, 54:WR청구,61:원리금상환, 71:WR소멸, 74:배당옵션, 75:특별배당, 76:ISINCODE변경, 77:실권주청약')") + + if inqr_dvsn_cd == "": + raise ValueError("inqr_dvsn_cd is required (e.g. '02:현지기준일, 03:청약시작일, 04:청약종료일')") + + if inqr_strt_dt == "": + raise ValueError("inqr_strt_dt is required (e.g. '20250101')") + + if inqr_end_dt == "": + raise ValueError("inqr_end_dt is required (e.g. '20250131')") + + if depth > max_depth: + logging.warning("Max recursive depth reached.") + if dataframe is None: + return pd.DataFrame() + else: + return dataframe + + tr_id = "CTRGT011R" # 해외주식 기간별권리조회 + + api_url = "/uapi/overseas-price/v1/quotations/period-rights" + + params = { + "RGHT_TYPE_CD": rght_type_cd, # 권리유형코드 + "INQR_DVSN_CD": inqr_dvsn_cd, # 조회구분코드 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "PDNO": pdno, # 상품번호 + "PRDT_TYPE_CD": prdt_type_cd, # 상품유형코드 + "CTX_AREA_NK50": NK50, # 연속조회키50 + "CTX_AREA_FK50": FK50 # 연속조회검색조건50 + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output) + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + NK50 = res.getBody().ctx_area_nk50 + FK50 = res.getBody().ctx_area_fk50 + + if tr_cont in ["M", "F"]: # 다음 페이지 존재 + logging.info("Call Next page...") + ka.smart_sleep() # 시스템 안정적 운영을 위한 지연 + return period_rights( + rght_type_cd, inqr_dvsn_cd, inqr_strt_dt, inqr_end_dt, + pdno, prdt_type_cd, NK50, FK50, "N", dataframe, depth + 1, max_depth + ) + else: + logging.info("Data fetch complete.") + return dataframe + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재체결가[v1_해외주식-009] +############################################################################################## + +def price( + auth: str, # 사용자권한정보 + excd: str, # 거래소코드 + symb: str, # 종목코드 + env_dv: str = "real", # 실전모의구분 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재체결가[v1_해외주식-009] + 해외주식 현재체결가 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소코드 (예: "NAS") + symb (str): 종목코드 (예: "AAPL") + env_dv (str): 실전모의구분 (real:실전, demo:모의) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 현재체결가 데이터 + + Example: + >>> df = price("", "NAS", "AAPL") + >>> print(df) + """ + # 로깅 설정 + logger = logging.getLogger(__name__) + + # 필수 파라미터 검증 + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + + if not symb: + logger.error("symb is required. (e.g. 'AAPL')") + raise ValueError("symb is required. (e.g. 'AAPL')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + # TR ID 설정 (모의투자 지원 로직) + if env_dv == "real" or env_dv == "demo": + tr_id = "HHDFS00000300" # 실전투자, 모의투자 공통 TR ID + else: + logger.error("Invalid env_dv value: %s. Must be 'real' or 'demo'.", env_dv) + raise ValueError("env_dv must be 'real' or 'demo'") + + api_url = "/uapi/overseas-price/v1/quotations/price" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + # API 호출 + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return price( + auth, + excd, + symb, + env_dv, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가상세[v1_해외주식-029] +############################################################################################## + +def price_detail( + auth: str, # 사용자권한정보 + excd: str, # 거래소명 + symb: str, # 종목코드 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 현재가상세[v1_해외주식-029] + 해외주식 현재가상세 API를 호출하여 DataFrame으로 반환합니다. + + Args: + auth (str): 사용자권한정보 + excd (str): 거래소명 (예: HKS, NYS, NAS, AMS, TSE, SHS, SZS, SHI, SZI, HSX, HNX, BAY, BAQ, BAA) + symb (str): 종목코드 + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 현재가상세 데이터 + + Example: + >>> df = price_detail(auth="your_auth_token", excd="NAS", symb="TSLA") + >>> print(df) + """ + # [필수 파라미터 검증] + if not excd: + logger.error("excd is required. (e.g. 'NAS')") + raise ValueError("excd is required. (e.g. 'NAS')") + if not symb: + logger.error("symb is required. (e.g. 'TSLA')") + raise ValueError("symb is required. (e.g. 'TSLA')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "HHDFS76200200" + + api_url = "/uapi/overseas-price/v1/quotations/price-detail" + + params = { + "AUTH": auth, + "EXCD": excd, + "SYMB": symb, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return price_detail( + auth, + excd, + symb, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 권리종합 [해외주식-050] +############################################################################################## + +def rights_by_ice( + ncod: str, # 국가코드 (CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남) + symb: str, # 종목코드 + st_ymd: str = "", # 일자시작일 (미입력시 3개월전) + ed_ymd: str = "" # 일자종료일 (미입력시 3개월후) +) -> pd.DataFrame: + """ + 해외주식 권리종합 API입니다. + 한국투자 HTS(eFriend Plus) > [7833] 해외주식 권리(ICE제공) 화면의 "전체" 탭 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. + + ※ 조회기간 기준일 입력시 참고 - 상환: 상환일자, 조기상환: 조기상환일자, 티커변경: 적용일, 그 외: 발표일 + + Args: + ncod (str): [필수] 국가코드 (ex. CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남) + symb (str): [필수] 종목코드 + st_ymd (str): 일자시작일 (ex. 미입력시 3개월전) + ed_ymd (str): 일자종료일 (ex. 미입력시 3개월후) + + Returns: + pd.DataFrame: 해외주식 권리종합 정보 + + Raises: + ValueError: 필수 파라미터가 누락되었을 때 + + Example: + >>> df = rights_by_ice("US", "NVDL") + >>> print(df) + """ + + # 필수 파라미터 검증 + if ncod == "": + raise ValueError("ncod is required (e.g. 'CN:중국,HK:홍콩,US:미국,JP:일본,VN:베트남')") + + if symb == "": + raise ValueError("symb is required") + + tr_id = "HHDFS78330900" + + api_url = "/uapi/overseas-price/v1/quotations/rights-by-ice" + + params = { + "NCOD": ncod, # 국가코드 + "SYMB": symb, # 종목코드 + "ST_YMD": st_ymd, # 일자시작일 + "ED_YMD": ed_ymd # 일자종료일 + } + + res = ka._url_fetch(api_url, tr_id, "", params) + + if res.isOK(): + current_data = pd.DataFrame(res.getBody().output1) + logging.info("Data fetch complete.") + return current_data + else: + res.printError(url=api_url) + return pd.DataFrame() + + +############################################################################################## +# [해외주식] 시세분석 > 해외주식 상품기본정보[v1_해외주식-034] +############################################################################################## + +def search_info( + prdt_type_cd: str, # 상품유형코드 + pdno: str, # 상품번호 + tr_cont: str = "", + dataframe: Optional[pd.DataFrame] = None, + depth: int = 0, + max_depth: int = 10 +) -> Optional[pd.DataFrame]: + """ + [해외주식] 기본시세 + 해외주식 상품기본정보[v1_해외주식-034] + 해외주식 상품기본정보 API를 호출하여 DataFrame으로 반환합니다. + + Args: + prdt_type_cd (str): 512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 515 일본 501 홍콩 / 543 홍콩CNY / 558 홍콩USD 507 베트남 하노이 / 508 베트남 호치민 551 중국 상해A / 552 중국 심천A + pdno (str): 예) AAPL (애플) + tr_cont (str): 연속 거래 여부 + dataframe (Optional[pd.DataFrame]): 누적 데이터프레임 + depth (int): 현재 재귀 깊이 + max_depth (int): 최대 재귀 깊이 (기본값: 10) + + Returns: + Optional[pd.DataFrame]: 해외주식 상품기본정보 데이터 + + Example: + >>> df = search_info(prdt_type_cd="512", pdno="AAPL") + >>> print(df) + """ + # [필수 파라미터 검증] + if not prdt_type_cd: + logger.error("prdt_type_cd is required. (e.g. '512')") + raise ValueError("prdt_type_cd is required. (e.g. '512')") + if not pdno: + logger.error("pdno is required. (e.g. 'AAPL')") + raise ValueError("pdno is required. (e.g. 'AAPL')") + + # 최대 재귀 깊이 체크 + if depth >= max_depth: + logger.warning("Maximum recursion depth (%d) reached. Stopping further requests.", max_depth) + return dataframe if dataframe is not None else pd.DataFrame() + + tr_id = "CTPF1702R" + + api_url = "/uapi/overseas-price/v1/quotations/search-info" + + params = { + "PRDT_TYPE_CD": prdt_type_cd, + "PDNO": pdno, + } + + res = ka._url_fetch(api_url, tr_id, tr_cont, params) + + if res.isOK(): + if hasattr(res.getBody(), 'output'): + output_data = res.getBody().output + if not isinstance(output_data, list): + output_data = [output_data] + current_data = pd.DataFrame(output_data) + else: + current_data = pd.DataFrame() + + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) + else: + dataframe = current_data + + tr_cont = res.getHeader().tr_cont + + if tr_cont == "M": + logger.info("Calling next page...") + ka.smart_sleep() + return search_info( + prdt_type_cd, + pdno, + "N", dataframe, depth + 1, max_depth + ) + else: + logger.info("Data fetch complete.") + return dataframe + else: + logger.error("API call failed: %s - %s", res.getErrorCode(), res.getErrorMessage()) + res.printError(api_url) + return pd.DataFrame() diff --git a/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions_ws.py b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions_ws.py new file mode 100644 index 0000000..04daf9c --- /dev/null +++ b/한국투자증권(API)/examples_user/overseas_stock/overseas_stock_functions_ws.py @@ -0,0 +1,295 @@ +import logging +import sys + +sys.path.extend(['..', '.']) +import kis_auth as ka + +# 로깅 설정 +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') +logger = logging.getLogger(__name__) + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간호가[실시간-021] +############################################################################################## + +def asking_price( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간호가를 이용하여 미국시세 실시간 1호가(매수/매도) 시세가 무료로 제공됩니다. (미국은 유료시세 제공 X) + + 아시아 국가의 경우, HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시, + "해외주식 실시간호가 HDFSASP0" 을 이용하여 아시아국가 유료시세(실시간호가)를 받아보실 수 있습니다. (24.11.29 반영) + (아시아 국가 무료시세는 "해외주식 지연호가(아시아) HDFSASP1" 를 이용하시기 바랍니다.) + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = asking_price("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSASP0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "symb", + "zdiv", + "xymd", + "xhms", + "kymd", + "khms", + "bvol", + "avol", + "bdvl", + "advl", + "pbid1", + "pask1", + "vbid1", + "vask1", + "dbid1", + "dask1" + ] + + return msg, columns + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간체결통보[실시간-009] +############################################################################################## + +def ccnl_notice( + tr_type: str, + tr_key: str, + env_dv: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간체결통보 API입니다. + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + env_dv (str): [필수] 실전모의구분 (ex. real:실전, demo:모의) + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = ccnl_notice("1", trenv.my_htsid, "real") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + if env_dv == "": + raise ValueError("env_dv is required (e.g. 'real', 'demo')") + + # tr_id 구분 + if env_dv == "real": + tr_id = "H0GSCNI0" + elif env_dv == "demo": + tr_id = "H0GSCNI9" + else: + raise ValueError("env_dv can only be real or demo") + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "CUST_ID", + "ACNT_NO", + "ODER_NO", + "OODER_NO", + "SELN_BYOV_CLS", + "RCTF_CLS", + "ODER_KIND2", + "STCK_SHRN_ISCD", + "CNTG_QTY", + "CNTG_UNPR", + "STCK_CNTG_HOUR", + "RFUS_YN", + "CNTG_YN", + "ACPT_YN", + "BRNC_NO", + "ODER_QTY", + "ACNT_NAME", + "CNTG_ISNM", + "ODER_COND", + "DEBT_GB", + "DEBT_DATE", + "START_TM", + "END_TM", + "TM_DIV_TP", + "CNTG_UNPR12" + ] + + return msg, columns + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 지연호가(아시아)[실시간-008] +############################################################################################## + +def delayed_asking_price_asia( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 지연호가(아시아)의 경우 아시아 무료시세(지연호가)가 제공됩니다. + + HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시, + "해외주식 실시간호가 HDFSASP0" 을 이용하여 아시아국가 유료시세(실시간호가)를 받아보실 수 있습니다. (24.11.29 반영) + + ※ 지연시세 지연시간 : 홍콩, 베트남, 중국, 일본 - 15분지연 + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = delayed_asking_price_asia("1", "DHKS00003") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSASP1" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "symb", + "zdiv", + "xymd", + "xhms", + "kymd", + "khms", + "bvol", + "avol", + "bdvl", + "advl", + "pbid1", + "pask1", + "vbid1", + "vask1", + "dbid1", + "dask1" + ] + + return msg, columns + +############################################################################################## +# [해외주식] 실시간시세 > 해외주식 실시간지연체결가[실시간-007] +############################################################################################## + +def delayed_ccnl( + tr_type: str, + tr_key: str, +) -> tuple[dict, list[str]]: + """ + 해외주식 실시간지연체결가의 경우 기본적으로 무료시세(지연체결가)가 제공되며, + 아시아국가의 경우 HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시 API로도 유료시세(실시간체결가)를 받아보실 수 있습니다. (24.11.29 반영) + + ※ 지연시세 지연시간 : 미국 - 실시간무료(0분지연) / 홍콩, 베트남, 중국, 일본 - 15분지연 (중국은 실시간시세 신청 시 무료실시간시세 제공) + 미국의 경우 0분지연시세로 제공되나, 장중 당일 시가는 상이할 수 있으며, 익일 정정 표시됩니다. + + 해당 API로 미국주간거래(10:00~16:00) 시세 조회도 가능합니다. + ※ 미국주간거래 실시간 조회 시, 맨 앞자리(R), tr_key 중 시장구분 값을 다음과 같이 입력 → 나스닥: BAQ, 뉴욕: BAY, 아멕스: BAA + + Args: + tr_type (str): [필수] 등록/해제 + tr_key (str): [필수] 종목코드 + + Returns: + message (dict): 메시지 데이터 + columns (list[str]): 컬럼 정보 + + Example: + >>> msg, columns = delayed_ccnl("1", "DNASAAPL") + >>> print(msg, columns) + """ + + # 필수 파라미터 검증 + if tr_type == "": + raise ValueError("tr_type is required") + + if tr_key == "": + raise ValueError("tr_key is required") + + tr_id = "HDFSCNT0" + + params = { + "tr_key": tr_key, + } + + msg = ka.data_fetch(tr_id, tr_type, params) + + columns = [ + "SYMB", + "ZDIV", + "TYMD", + "XYMD", + "XHMS", + "KYMD", + "KHMS", + "OPEN", + "HIGH", + "LOW", + "LAST", + "SIGN", + "DIFF", + "RATE", + "PBID", + "PASK", + "VBID", + "VASK", + "EVOL", + "TVOL", + "TAMT", + "BIVL", + "ASVL", + "STRN", + "MTYP" + ] + + return msg, columns + diff --git a/한국투자증권(API)/kis_devlp.yaml b/한국투자증권(API)/kis_devlp.yaml new file mode 100644 index 0000000..9d8615d --- /dev/null +++ b/한국투자증권(API)/kis_devlp.yaml @@ -0,0 +1,35 @@ +#홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 +#실전투자 +my_app: "앱키" +my_sec: "앱키 시크릿" + +#모의투자 +paper_app: "모의투자 앱키" +paper_sec: "모의투자 앱키 시크릿" + +# HTS ID +my_htsid: "사용자 HTS ID" + +#계좌번호 앞 8자리 +my_acct_stock: "증권계좌 8자리" +my_acct_future: "선물옵션계좌 8자리" +my_paper_stock: "모의투자 증권계좌 8자리" +my_paper_future: "모의투자 선물옵션계좌 8자리" + +#계좌번호 뒤 2자리 +my_prod: "01" # 종합계좌 +# my_prod: "03" # 국내선물옵션계좌 +# my_prod: "08" # 해외선물옵션 계좌 +# my_prod: "22" # 개인연금 +# my_prod: "29" # 퇴직연금 + +#domain infos +prod: "https://openapi.koreainvestment.com:9443" # 서비스 +ops: "ws://ops.koreainvestment.com:21000" # 웹소켓 +vps: "https://openapivts.koreainvestment.com:29443" # 모의투자 서비스 +vops: "ws://ops.koreainvestment.com:31000" # 모의투자 웹소켓 + +my_token: "" + +# User-Agent; Chrome > F12 개발자 모드 > Console > navigator.userAgent > 자신의 userAgent 확인가능 +my_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" diff --git a/한국투자증권(API)/legacy/README.md b/한국투자증권(API)/legacy/README.md new file mode 100644 index 0000000..580876a --- /dev/null +++ b/한국투자증권(API)/legacy/README.md @@ -0,0 +1,478 @@ +#### **[당사에서 제공하는 샘플코드에 대한 유의사항]** #### +- 샘플 코드는 한국투자증권 오픈API(KIS Develpers)를 연동하는 예시입니다. 고객님의 개발부담을 줄이고자 참고용으로 제공되고 있습니다. +- 샘플 코드는 별도의 공지 없이 지속적으로 업데이트될 수 있습니다. +- 샘플 코드를 활용하여 제작한 고객님의 프로그램으로 인한 손해에 대해서는 당사에서 책임지지 않습니다. + +![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=300§ion=header&text=한국투자증권%20KIS%20Developers&fontSize=50&animation=fadeIn&fontAlignY=38&desc=Open%20Trading%20API%20Docs&descAlignY=51&descAlign=62) + +## 1. KIS Developers 개발자 센터 소개 +[KIS Developers](https://apiportal.koreainvestment.com/)는 한국투자증권의 트레이딩 서비스를 오픈API로 제공하여 개발자들이 다양한 금융서비스를 만들 수 있도록 지원하는 개발자 센터입니다. KIS Developers에서는 개발자의 금융 서비스 개발을 지원하기 위해 API 문서 메뉴 내 API에 대한 상세한 설명과 예제를 제공합니다. 전문 개발자가 아닌 일반인들도 쉽게 금융 서비스를 만들 수 있습니다. + +* 제휴 문의는 [제휴안내 페이지](https://apiportal.koreainvestment.com/howto-register)에서 제휴 신청 부탁드립니다. +* API 사용 관련 문의는 [Q&A 페이지](https://apiportal.koreainvestment.com/community/10000000-0000-0011-0000-000000000003)에서 문의 부탁드립니다. + + +## 2. 이용 안내 +### 2.1. 사전 준비 +KIS Developers 서비스 신청을 위해서는 2가지 사전 준비물이 필요합니다. 첫 번째로는 한국투자증권 계좌가 개설되어있어야 하며, 두 번째로는 한국투자증권 ID 등록이 필요합니다. 만약 계좌가 없으시다면 한국투자증권 앱을 통해 비대면 개설을 진행하거나, 가까운 영업점을 방문해주시길 바랍니다. (모의투자계좌의 경우, 한국투자 홈페이지 혹은 MTS에서 모의투자 서비스 신청 후 발급받은 모의계좌번호로 API 신청을 하셔야 합니다.) + +- 한국투자증권 앱 : [https://securities.koreainvestment.com/main/customer/cusGuide/customerGuide.jsp](https://securities.koreainvestment.com/main/customer/cusGuide/customerGuide.jsp) +- 가까운 영업점 찾기 : [https://securities.koreainvestment.com/main/customer/guide/branch/branch.jsp](https://securities.koreainvestment.com/main/customer/guide/branch/branch.jsp) +- 모의투자계좌 발급 : [https://securities.koreainvestment.com/main/research/virtual/_static/TF07da010000.jsp](https://securities.koreainvestment.com/main/research/virtual/_static/TF07da010000.jsp) + + +### 2.2. 서비스 신청 + +KIS Developers 서비스 신청 페이지까지 2가지 경로로 접속 가능합니다. + +* KIS Developers 우상단 API신청 버튼 클릭 +* 한국투자증권 홈페이지 [서비스신청 > Open API > KIS Developers > KIS Developers 서비스 신청하기] + +서비스 신청 화면에 접속하면 홈페이지 인증서 로그인 화면이 뜨고, 인증을 완료하면 아래와 같이 KIS Developers 서비스 신청하기의 첫 화면인 휴대폰 인증 화면이 뜨게 됩니다. + +![](https://wikidocs.net/images/page/159301/kis_restapi_1.png) + +해당 화면에서 등록하신 휴대폰 인증을 통해 본인 인증을 완료합니다. + +* HTS ID에 $나 @가 포함되면 추후에 HTS ID 변경 시 Open API 서비스 사용에 제한이 있을 수 있으니, HTS ID 변경 후 서비스 가입을 권유드립니다. +* 다만 기존 가입내역이 있으며 HTS ID 변경 후 Open API 서비스 사용에 어려움을 겪으실 경우, KIS Developers 홈페이지 Q&A 게시판에 문의 남겨주시면 조치해 드리겠습니다. + +### 2.3. 유의사항 확인 +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/9413332d-105c-47aa-89de-7d419714a0fb) + +다음으로는 유의사항확인입니다. 서비스 사용에 관한 유의사항을 정독하여 충분하게 숙지하신 뒤, 동의를 진행합니다. 개인정보 수집·이용 동의서, 고객 이용약관 및 이용약관 개정 알림에 대해 미동의 시, 서비스 이용이 불가합니다. + + + +### 2.4. KIS Developers 서비스 신청하기 +![](https://wikidocs.net/images/page/159301/kis_restapi_3.png) + +유의사항 확인이 완료되면 기존 신청내역이 없으실 경우, 곧바로 서비스 신청하기 팝업 화면이 뜨게 됩니다. 해당 화면에서 보유하고 계신 계좌에 대하여 API 신청하실 수 있습니다. 한 번에 2개의 계좌까지 API 신청 가능하며, 다계좌 API 신청을 원하실 경우, 신청하기 완료 후 신청정보 페이지에서 추가신청하기 기능을 이용하시기 바랍니다. + +* 실전투자계좌의 경우 동일한 종합 계좌번호의 주식(국내, 해외), 선물/옵션 계좌로 API 이용 가능합니다. +* 모의투자계좌의 경우 한국투자 홈페이지 혹은 MTS에서 모의투자 서비스 신청 후 발급받은 모의계좌번호로 API 신청을 하셔야 합니다. + +계좌번호 선택 하단에 위치한 테이블에 있는 KIS Developers 사용자 ID는 향후 KIS Developers 포탈에서 사용되는 ID로 기존 등록된 HTS ID와 동일합니다. 두번째로 API그룹은 현재 KIS Developers에서 이용 가능한 API 기능들로, 지속적으로 추가 개발될 예정입니다. 세번째로 문자메시지 설정을 통해 서비스 만료 1개월 전 메시지를 받을 수 있으니 참고하시길 바랍니다. 마지막으로 이용기간은 신청일로부터 1년입니다. + +계좌번호를 선택 혹은 입력하시고 신청 버튼을 누르시면 처음 홈페이지 로그인하신 방식으로 인증 팝업이 뜨게 됩니다. + +![](https://wikidocs.net/images/page/159301/kis_restapi_6.png) + +정상적으로 인증을 완료하였다는 메시지가 창에 뜨고, 해당 계좌번호로 API 신청 및 APP Key, APP Secret 발급이 완료됩니다. + +![](https://wikidocs.net/images/page/159301/kis_restapi_4.png) + +이상으로 신청이 완료되었습니다. 카카오톡 알림톡 혹은 문자 메시지로 오픈API 서비스 신청완료 안내 메시지와 함께 KIS Developers 홈페이지 초기 패스워드가 발송됩니다. KIS Developers 홈페이지의 ID는 HTS ID와 같으며, 메시지로 받으신 임시비밀번호로 홈페이지에 로그인하셔서 API문서 등을 확인하실 수 있습니다. + + +### 2.5. 신청정보 + +![](https://wikidocs.net/images/page/159301/kis_restapi_7.png) + +신청이 완료되면 신청정보 화면의 신청현황 테이블에서 해당 계좌의 App Key와 App Secret을 확인하실 수 있습니다. App Key와 App Secret은 노출되어 있지 않아, 클립보드에 복사 후 원하시는 곳에 붙여넣어 사용 부탁드립니다. App Key와 App Secret 두 암호키를 통해 계좌에 접근할 수 있는 토큰을 발급받을 수 있어, 타인에게 유출을 금하며 관리에 유의해야합니다. 유출시 즉시 홈페이지에서 재발급 하시기 바랍니다. + +갱신 기능과 해지 기능에 대해 설명드리겠습니다. 갱신(기간 연장)은 만료 30일 전부터 신청 가능하며, 그 전까지는 갱신 버튼이 비활성화되어 클릭이 불가능합니다. 갱신 시, 신청일로부터 1년 기간이 연장되며, APP Key, APP Secret가 재발급됩니다. 해지는 언제든지 신청 가능하며, 해지 완료 시 발급되었던 APP Key, APP Secret는 사용이 불가능합니다. + + +### 2.6. 추가신청하기 + +![](https://wikidocs.net/images/page/159301/kis_restapi_5.png) + +신청현황 화면 하단의 추가신청하기 기능을 이용하여 더 많은 계좌의 API 신청이 가능합니다. 실전투자계좌의 경우 최대 89개, 모의투자계좌의 경우 최대 2개까지 신청 가능합니다. 추가 신청 프로세스는 맨 처음 신청했을 때와 동일하게 계좌 선택 및 비밀번호 인증, 인증서 인증을 거쳐 이뤄집니다. + +### 2.7. 초기 로그인 시 패스워드 변경 방법 +오픈API 서비스 신청 완료 후 KIS Developers 포탈로 이동하여 로그인을 진행합니다. 초기 아이디는 HTS 아이디와 동일하며, 홈페이지 신청 정보를 통해 확인하실 수 있습니다. 초기 패스워드는 안내 메시지 카카오톡 알림톡 혹은 문자 메시지로 발송됩니다. 반드시 로그인 후 패스워드를 변경하시길 바랍니다. 패스워드 변경은 아래와 같이 진행하실 수 있습니다. + +**■ 초기 로그인 시 패스워드 변경 방법** +![image](https://github.com/user-attachments/assets/954e3853-f18d-4f9a-aa86-e86cc9358b73) +![image](https://github.com/user-attachments/assets/83553b44-c5f2-4f6d-adde-44e58f2fa2f2) + + +### 2.8. 이전 ID 신청정보 삭제 방법 + +KIS Developers 서비스 가입 후 HTS ID를 변경하여 '처리계좌의 ID와 사용자정보가 상이하여 주문처리 불가능 합니다.' 오류가 발생하셨을 경우 아래와 같이 한국투자증권 홈페이지에서 이전 ID 신청정보 삭제하신 후 핸드폰 인증 후 신청현황에서 신청을 다시 하시고 발급받으신 앱키를 이용하시면 정상 이용하실 수 있습니다. + +**■ 이전 ID 신청정보 삭제 방법** +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/c331efc3-0c5c-4722-8e69-3c50924a73b4) +한국투자증권 홈페이지 > 트레이딩 > Open API > KIS Developers > KIS Developers 서비스 신청하기 접속 후 'ID 변경 전 신청정보 삭제' 클릭 +(https://securities.koreainvestment.com/main/customer/systemdown/RestAPIService.jsp) + +## 3. API 제공 목록 + +|구분 |API명 |모의투자 제공 여부| +|--|--|--| +|OAuth인증|웹소켓접속키발급|⭕| +|OAuth인증|접근토큰발급|⭕| +|OAuth인증|접근토큰폐기|⭕| +|OAuth인증|Hashkey|⭕| +|[국내주식]주문/계좌|주식주문(현금)|⭕| +|[국내주식]주문/계좌|주식주문(신용)| | +|[국내주식]주문/계좌|주식주문(정정취소)|⭕| +|[국내주식]주문/계좌|주식정정취소가능주문조회| | +|[국내주식]주문/계좌|주식일별주문체결조회|⭕| +|[국내주식]주문/계좌|주식잔고조회|⭕| +|[국내주식]주문/계좌|매수가능조회|⭕| +|[국내주식]주문/계좌|주식예약주문| | +|[국내주식]주문/계좌|주식예약주문정정취소| | +|[국내주식]주문/계좌|주식예약주문조회| | +|[국내주식]주문/계좌|퇴직연금 체결기준잔고| | +|[국내주식]주문/계좌|퇴직연금 미체결내역| | +|[국내주식]주문/계좌|퇴직연금 매수가능조회| | +|[국내주식]주문/계좌|퇴직연금 예수금조회| | +|[국내주식]주문/계좌|퇴직연금 잔고조회| | +|[국내주식]주문/계좌|주식잔고조회_실현손익| | +|[국내주식]주문/계좌|신용매수가능조회| | +|[국내주식]주문/계좌|투자계좌자산현황조회| | +|[국내주식]주문/계좌|기간별매매손익현황조회| | +|[국내주식]주문/계좌|기간별손익일별합산조회| | +|[국내주식]주문/계좌|매도가능수량조회| | +|[국내주식]주문/계좌|주식통합증거금 현황| | +|[국내주식]주문/계좌|기간별계좌권리현황조회| | +|[국내주식]기본시세|주식현재가 시세|⭕| +|[국내주식]기본시세|주식현재가 체결|⭕| +|[국내주식]기본시세|주식현재가 일자별|⭕| +|[국내주식]기본시세|주식현재가 호가/예상체결|⭕| +|[국내주식]기본시세|주식현재가 투자자|⭕| +|[국내주식]기본시세|주식현재가 회원사|⭕| +|[국내주식]기본시세|국내주식기간별시세(일/주/월/년)|⭕| +|[국내주식]기본시세|주식현재가 당일시간대별체결|⭕| +|[국내주식]기본시세|주식현재가 시간외일자별주가|⭕| +|[국내주식]기본시세|주식당일분봉조회|⭕| +|[국내주식]기본시세|주식일별분봉조회|⭕| +|[국내주식]기본시세|주식현재가 시세2| | +|[국내주식]기본시세|ETF/ETN 현재가| | +|[국내주식]기본시세|NAV 비교추이(종목)| | +|[국내주식]기본시세|NAV 비교추이(분)| | +|[국내주식]기본시세|NAV 비교추이(일)| | +|[국내주식]기본시세|국내주식 장마감 예상체결가| | +|[국내주식]기본시세|ETF 구성종목시세| | +|[국내주식]기본시세|국내주식 시간외현재가| | +|[국내주식]기본시세|국내주식 시간외호가| | +|[국내주식]ELW시세|ELW현재가 시세|⭕| +|[국내주식]ELW시세|ELW 상승률순위| | +|[국내주식]ELW시세|ELW 거래량순위| | +|[국내주식]ELW시세|ELW 지표순위| | +|[국내주식]ELW시세|ELW 민감도 순위| | +|[국내주식]ELW시세|ELW 당일급변종목| | +|[국내주식]ELW시세|ELW 신규상장종목| | +|[국내주식]ELW시세|ELW 투자지표추이(체결)| | +|[국내주식]ELW시세|ELW 투자지표추이(분별)| | +|[국내주식]ELW시세|ELW 투자지표추이(일별)| | +|[국내주식]ELW시세|ELW 변동성 추이(틱)| | +|[국내주식]ELW시세|ELW 변동성 추이(체결)| | +|[국내주식]ELW시세|ELW 변동성 추이(분별)| | +|[국내주식]ELW시세|ELW 변동성 추이(일별)| | +|[국내주식]ELW시세|ELW 민감도 추이(체결)| | +|[국내주식]ELW시세|ELW 민감도 추이(일별)| | +|[국내주식]ELW시세|ELW 기초자산별 종목시세| | +|[국내주식]ELW시세|ELW LP매매추이| | +|[국내주식]ELW시세|ELW 비교대상종목조회| | +|[국내주식]ELW시세|ELW 종목검색| | +|[국내주식]ELW시세|ELW 기초자산 목록조회| | +|[국내주식]ELW시세|ELW 만기예정/만기종목| | +|[국내주식]업종/기타|국내주식업종기간별시세(일/주/월/년)|⭕| +|[국내주식]업종/기타|국내휴장일조회| | +|[국내주식]업종/기타|업종분봉조회| | +|[국내주식]업종/기타|변동성완화장치(VI) 현황| | +|[국내주식]업종/기타|국내업종 현재지수| | +|[국내주식]업종/기타|국내업종 일자별지수| | +|[국내주식]업종/기타|국내업종 구분별전체시세| | +|[국내주식]업종/기타|국내주식 예상체결 전체지수| | +|[국내주식]업종/기타|국내업종 시간별지수(틱)| | +|[국내주식]업종/기타|국내업종 시간별지수(분)| | +|[국내주식]업종/기타|국내주식 예상체결지수 추이| | +|[국내주식]업종/기타|금리 종합(국내채권/금리)| | +|[국내주식]업종/기타|종합 시황/공시(제목)| | +|[국내주식]업종/기타|국내선물 영업일조회| | +|[국내주식]종목정보|상품기본조회| | +|[국내주식]종목정보|주식기본조회| | +|[국내주식]종목정보|국내주식 대차대조표| | +|[국내주식]종목정보|국내주식 손익계산서| | +|[국내주식]종목정보|국내주식 재무비율| | +|[국내주식]종목정보|국내주식 수익성비율| | +|[국내주식]종목정보|국내주식 기타주요비율| | +|[국내주식]종목정보|국내주식 안정성비율| | +|[국내주식]종목정보|국내주식 성장성비율| | +|[국내주식]종목정보|국내주식 당사 신용가능종목| | +|[국내주식]종목정보|예탁원정보(배당일정)| | +|[국내주식]종목정보|예탁원정보(주식매수청구일정)| | +|[국내주식]종목정보|예탁원정보(합병/분할일정)| | +|[국내주식]종목정보|예탁원정보(액면교체일정)| | +|[국내주식]종목정보|예탁원정보(자본감소일정)| | +|[국내주식]종목정보|예탁원정보(상장정보일정)| | +|[국내주식]종목정보|예탁원정보(공모주청약일정)| | +|[국내주식]종목정보|예탁원정보(실권주일정)| | +|[국내주식]종목정보|예탁원정보(의무예치일정)| | +|[국내주식]종목정보|예탁원정보(유상증자일정)| | +|[국내주식]종목정보|예탁원정보(무상증자일정)| | +|[국내주식]종목정보|예탁원정보(주주총회일정)| | +|[국내주식]종목정보|국내주식 종목추정실적| | +|[국내주식]종목정보|당사 대주가능 종목| | +|[국내주식]종목정보|국내주식 종목투자의견| | +|[국내주식]종목정보|국내주식 증권사별 투자의견| | +|[국내주식]시세분석|국내기관_외국인 매매종목가집계| | +|[국내주식]시세분석|종목조건검색 목록조회| | +|[국내주식]시세분석|종목조건검색조회| | +|[국내주식]시세분석|종목별 프로그램매매추이(체결)| | +|[국내주식]시세분석|종목별 프로그램매매추이(일별)| | +|[국내주식]시세분석|종목별 외인기관 추정가집계| | +|[국내주식]시세분석|종목별일별매수매도체결량| | +|[국내주식]시세분석|시장별 투자자매매동향(시세)| | +|[국내주식]시세분석|시장별 투자자매매동향(일별)| | +|[국내주식]시세분석|국내주식 신용잔고 일별추이| | +|[국내주식]시세분석|국내주식 예상체결가 추이| | +|[국내주식]시세분석|국내주식 공매도 일별추이| | +|[국내주식]시세분석|국내주식 시간외예상체결등락률| | +|[국내주식]시세분석|프로그램매매 투자자매매동향(당일)| | +|[국내주식]시세분석|프로그램매매 종합현황(시간)| | +|[국내주식]시세분석|프로그램매매 종합현황(일별)| | +|[국내주식]시세분석|외국계 매매종목 가집계| | +|[국내주식]시세분석|종목별 외국계 순매수추이| | +|[국내주식]시세분석|국내주식 체결금액별 매매비중| | +|[국내주식]시세분석|국내 증시자금 종합| | +|[국내주식]시세분석|관심종목 그룹별 종목조회| | +|[국내주식]시세분석|관심종목 그룹조회| | +|[국내주식]시세분석|관심종목(멀티종목) 시세조회| | +|[국내주식]시세분석|국내주식 상하한가 포착| | +|[국내주식]시세분석|회원사 실시간 매매동향(틱)| | +|[국내주식]시세분석|국내주식 매물대/거래비중| | +|[국내주식]시세분석|주식현재가 회원사 종목매매동향| | +|[국내주식]순위분석|거래량순위| | +|[국내주식]순위분석|국내주식 등락률 순위| | +|[국내주식]순위분석|국내주식 호가잔량 순위| | +|[국내주식]순위분석|국내주식 수익자산지표 순위| | +|[국내주식]순위분석|국내주식 시가총액 상위| | +|[국내주식]순위분석|국내주식 재무비율 순위| | +|[국내주식]순위분석|국내주식 시간외잔량 순위| | +|[국내주식]순위분석|국내주식 우선주/괴리율 상위| | +|[국내주식]순위분석|국내주식 이격도 순위| | +|[국내주식]순위분석|국내주식 시장가치 순위| | +|[국내주식]순위분석|국내주식 체결강도 상위| | +|[국내주식]순위분석|국내주식 관심종목등록 상위| | +|[국내주식]순위분석|국내주식 예상체결 상승/하락상위| | +|[국내주식]순위분석|국내주식 당사매매종목 상위| | +|[국내주식]순위분석|국내주식 신고/신저근접종목 상위| | +|[국내주식]순위분석|국내주식 대량체결건수 상위| | +|[국내주식]순위분석|국내주식 공매도 상위종목| | +|[국내주식]순위분석|국내주식 신용잔고 상위| | +|[국내주식]순위분석|국내주식 배당률 상위| | +|[국내주식]순위분석|국내주식 시간외등락율순위| | +|[국내주식]순위분석|국내주식 시간외거래량순위| | +|[국내주식]순위분석|HTS조회상위20종목| | +|[국내주식]실시간시세|국내주식 실시간체결가|⭕| +|[국내주식]실시간시세|국내주식 실시간호가|⭕| +|[국내주식]실시간시세|국내주식 실시간체결통보|⭕| +|[국내주식]실시간시세|국내지수 실시간체결| | +|[국내주식]실시간시세|국내지수 실시간예상체결| | +|[국내주식]실시간시세|국내지수 실시간프로그램매매| | +|[국내주식]실시간시세|국내주식 실시간회원사| | +|[국내주식]실시간시세|국내주식 실시간프로그램매매| | +|[국내주식]실시간시세|국내주식 장운영정보| | +|[국내주식]실시간시세|국내주식 실시간예상체결| | +|[국내주식]실시간시세|ELW 실시간체결가| | +|[국내주식]실시간시세|ELW 실시간호가| | +|[국내주식]실시간시세|국내주식 시간외 실시간체결가| | +|[국내주식]실시간시세|국내주식 시간외 실시간예상체결| | +|[국내주식]실시간시세|국내주식 시간외 실시간호가| | +|[국내주식]실시간시세|ELW 실시간예상체결| | +|[국내주식]실시간시세|국내ETF NAV추이| | +|[국내주식]실시간시세|국내주식 실시간체결가 (NXT)| | +|[국내주식]실시간시세|국내주식 실시간호가 (NXT)| | +|[국내주식]실시간시세|국내지수 실시간예상체결 (NXT)| | +|[국내주식]실시간시세|국내지수 실시간프로그램매매 (NXT)| | +|[국내주식]실시간시세|국내주식 실시간회원사 (NXT)| | +|[국내주식]실시간시세|국내주식 장운영정보 (NXT)| | +|[국내주식]실시간시세|국내주식 실시간체결가 (통합)|| +|[국내주식]실시간시세|국내주식 실시간호가 (통합)|| +|[국내주식]실시간시세|국내지수 실시간예상체결 (통합)| | +|[국내주식]실시간시세|국내지수 실시간프로그램매매 (통합)| | +|[국내주식]실시간시세|국내주식 실시간회원사 (통합)| | +|[국내주식]실시간시세|국내주식 장운영정보 (통합)| | +|[국내선물옵션]주문/계좌|선물옵션 주문|⭕| +|[국내선물옵션]주문/계좌|선물옵션 정정취소주문|⭕| +|[국내선물옵션]주문/계좌|선물옵션 주문체결내역조회|⭕| +|[국내선물옵션]주문/계좌|선물옵션 잔고현황|⭕| +|[국내선물옵션]주문/계좌|선물옵션 주문가능|⭕| +|[국내선물옵션]주문/계좌|(야간)선물옵션 주문체결내역조회| | +|[국내선물옵션]주문/계좌|(야간)선물옵션 잔고현황| | +|[국내선물옵션]주문/계좌|(야간)선물옵션 주문가능| | +|[국내선물옵션]주문/계좌|선물옵션 잔고정산손익내역| | +|[국내선물옵션]주문/계좌|선물옵션 총자산현황| | +|[국내선물옵션]주문/계좌|선물옵션 잔고평가손익내역| | +|[국내선물옵션]주문/계좌|선물옵션 기준일체결내역| | +|[국내선물옵션]주문/계좌|선물옵션기간약정수수료일별| | +|[국내선물옵션]주문/계좌|(야간)선물옵션 증거금 상세| | +|[국내선물옵션]기본시세|선물옵션 시세|⭕| +|[국내선물옵션]기본시세|선물옵션 시세호가|⭕| +|[국내선물옵션]기본시세|선물옵션기간별시세(일/주/월/년)|⭕| +|[국내선물옵션]기본시세|선물옵션 분봉조회| | +|[국내선물옵션]기본시세|선물옵션 일중예상체결추이| | +|[국내선물옵션]기본시세|국내선물 기초자산 시세|⭕| +|[국내선물옵션]기본시세|국내옵션전광판_옵션월물리스트| | +|[국내선물옵션]기본시세|국내옵션전광판_선물| | +|[국내선물옵션]기본시세|국내옵션전광판_콜풋| | +|[국내선물옵션]실시간시세|지수선물 실시간체결가| | +|[국내선물옵션]실시간시세|지수선물 실시간호가| | +|[국내선물옵션]실시간시세|선물옵션 실시간체결 통보| | +|[국내선물옵션]실시간시세|지수옵션 실시간체결가| | +|[국내선물옵션]실시간시세|지수옵션 실시간호가| | +|[국내선물옵션]실시간시세|상품선물 실시간체결가| | +|[국내선물옵션]실시간시세|상품선물 실시간호가| | +|[국내선물옵션]실시간시세|주식선물 실시간체결가| | +|[국내선물옵션]실시간시세|주식선물 실시간호가| | +|[국내선물옵션]실시간시세|주식옵션 실시간체결가| | +|[국내선물옵션]실시간시세|주식옵션 실시간호가| | +|[국내선물옵션]실시간시세|지수선물 실시간체결가| | +|[국내선물옵션]실시간시세|지수선물 실시간호가| | +|[국내선물옵션]실시간시세|선물옵션 실시간체결 통보|⭕| +|[국내선물옵션]실시간시세|지수옵션 실시간체결가| | +|[국내선물옵션]실시간시세|지수옵션 실시간호가| | +|[국내선물옵션]실시간시세|상품선물 실시간체결가| | +|[국내선물옵션]실시간시세|상품선물 실시간호가| | +|[국내선물옵션]실시간시세|주식선물 실시간체결가| | +|[국내선물옵션]실시간시세|주식선물 실시간호가| | +|[국내선물옵션]실시간시세|주식선물 실시간예상체결| | +|[국내선물옵션]실시간시세|주식옵션 실시간체결가| | +|[국내선물옵션]실시간시세|주식옵션 실시간호가| | +|[국내선물옵션]실시간시세|주식옵션 실시간예상체결| | +|[국내선물옵션]실시간시세|KRX야간옵션 실시간체결가| | +|[국내선물옵션]실시간시세|KRX야간옵션 실시간호가| | +|[국내선물옵션]실시간시세|KRX야간옵션 실시간예상체결| | +|[국내선물옵션]실시간시세|KRX야간옵션 실시간체결통보| | +|[국내선물옵션]실시간시세|CME야간선물 실시간체결가| | +|[국내선물옵션]실시간시세|CME야간선물 실시간호가| | +|[국내선물옵션]실시간시세|CME야간선물 실시간체결통보| | +|[해외주식]주문/계좌|해외주식 주문|⭕| +|[해외주식]주문/계좌|해외주식 정정취소주문|⭕| +|[해외주식]주문/계좌|해외주식 예약주문접수|⭕| +|[해외주식]주문/계좌|해외주식 예약주문접수취소|⭕| +|[해외주식]주문/계좌|해외주식 미체결내역|⭕| +|[해외주식]주문/계좌|해외주식 잔고|⭕| +|[해외주식]주문/계좌|해외주식 주문체결내역|⭕| +|[해외주식]주문/계좌|해외주식 체결기준현재잔고|⭕| +|[해외주식]주문/계좌|해외주식 예약주문조회| | +|[해외주식]주문/계좌|해외주식 매수가능금액조회| | +|[해외주식]주문/계좌|해외주식 미국주간주문| | +|[해외주식]주문/계좌|해외주식 미국주간정정취소| | +|[해외주식]주문/계좌|해외주식 기간손익| | +|[해외주식]주문/계좌|해외증거금 통화별조회| | +|[해외주식]주문/계좌|해외주식 일별거래내역| | +|[해외주식]주문/계좌|해외주식 결제기준잔고| | +|[해외주식]주문/계좌|해외주식 지정가체결내역조회| | +|[해외주식]주문/계좌|해외주식 지정가주문번호조회| | +|[해외주식]기본시세|해외주식 현재체결가|⭕| +|[해외주식]기본시세|해외주식 기간별시세|⭕| +|[해외주식]기본시세|해외주식 종목/지수/환율기간별시세(일/주/월/년)|⭕| +|[해외주식]기본시세|해외주식 조건검색|⭕| +|[해외주식]기본시세|해외결제일자조회| | +|[해외주식]기본시세|해외주식 현재가상세| | +|[해외주식]기본시세|해외주식분봉조회| | +|[해외주식]기본시세|해외지수분봉조회| | +|[해외주식]기본시세|해외주식 상품기본정보| | +|[해외주식]기본시세|해외주식 현재가 1호가| | +|[해외주식]기본시세|해외주식 업종별코드조회| | +|[해외주식]기본시세|해외주식 업종별시세| | +|[해외주식]시세분석|해외주식 기간별권리조회| | +|[해외주식]시세분석|해외뉴스종합(제목)| | +|[해외주식]시세분석|해외주식 권리종합| | +|[해외주식]시세분석|당사 해외주식담보대출 가능 종목| | +|[해외주식]시세분석|해외속보(제목)| | +|[해외주식]시세분석|해외주식 거래증가율순위| | +|[해외주식]시세분석|해외주식 가격급등락| | +|[해외주식]시세분석|해외주식 거래대금순위| | +|[해외주식]시세분석|해외주식 거래량급증| | +|[해외주식]시세분석|해외주식 신고/신저가| | +|[해외주식]시세분석|해외주식 매수체결강도상위| | +|[해외주식]시세분석|해외주식 거래회전율순위| | +|[해외주식]시세분석|해외주식 시가총액순위| | +|[해외주식]시세분석|해외주식 상승율/하락율| | +|[해외주식]실시간시세|해외주식 실시간호가| | +|[해외주식]실시간시세|해외주식 지연호가(아시아)| | +|[해외주식]실시간시세|해외주식 실시간지연체결가| | +|[해외주식]실시간시세|해외주식 실시간체결통보| | +|[해외선물옵션]주문/계좌|해외선물옵션 주문| | +|[해외선물옵션]주문/계좌|해외선물옵션 정정취소주문| | +|[해외선물옵션]주문/계좌|해외선물옵션 당일주문내역조회| | +|[해외선물옵션]주문/계좌|해외선물옵션 미결제내역조회(잔고)| | +|[해외선물옵션]주문/계좌|해외선물옵션 주문가능조회| | +|[해외선물옵션]주문/계좌|해외선물옵션 기간계좌손익 일별| | +|[해외선물옵션]주문/계좌|해외선물옵션 일별 체결내역| | +|[해외선물옵션]주문/계좌|해외선물옵션 예수금현황| | +|[해외선물옵션]주문/계좌|해외선물옵션 일별 주문내역| | +|[해외선물옵션]주문/계좌|해외선물옵션 기간계좌거래내역| | +|[해외선물옵션]주문/계좌|해외선물옵션 증거금상세| | +|[해외선물옵션]기본시세|해외선물종목상세|⭕| +|[해외선물옵션]기본시세|해외선물종목현재가|⭕| +|[해외선물옵션]기본시세|해외선물 분봉조회| | +|[해외선물옵션]기본시세|해외선물 체결추이(주간)| | +|[해외선물옵션]기본시세|해외선물 체결추이(일간)| | +|[해외선물옵션]기본시세|해외선물 체결추이(틱)| | +|[해외선물옵션]기본시세|해외선물 체결추이(월간)| | +|[해외선물옵션]기본시세|해외선물 호가| | +|[해외선물옵션]기본시세|해외선물 상품기본정보| | +|[해외선물옵션]기본시세|해외선물 장운영시간| | +|[해외선물옵션]기본시세|해외선물 미결제추이| | +|[해외선물옵션]기본시세|해외옵션 호가| | +|[해외선물옵션]실시간시세|해외선물옵션 실시간체결가| | +|[해외선물옵션]실시간시세|해외선물옵션 실시간호가| | +|[해외선물옵션]실시간시세|해외선물옵션 실시간주문내역통보| | +|[해외선물옵션]실시간시세|해외선물옵션 실시간체결내역통보| | +|[장내채권]주문/계좌|장내채권 매도주문| | +|[장내채권]주문/계좌|장내채권 매수주문| | +|[장내채권]주문/계좌|장내채권 정정취소주문| | +|[장내채권]주문/계좌|채권정정취소가능주문조회| | +|[장내채권]주문/계좌|장내채권 주문체결내역| | +|[장내채권]주문/계좌|장내채권 잔고조회| | +|[장내채권]주문/계좌|장내채권 매수가능조회| | +|[장내채권]기본시세|장내채권 발행정보| | +|[장내채권]기본시세|장내채권 기본조회| | +|[장내채권]기본시세|장내채권현재가(호가)| | +|[장내채권]기본시세|장내채권 평균단가조회| | +|[장내채권]기본시세|장내채권 기간별시세(일)| | +|[장내채권]기본시세|장내채권현재가(시세)| | +|[장내채권]기본시세|장내채권현재가(체결)| | +|[장내채권]기본시세|장내채권현재가(일별)| | +|[장내채권]실시간시세|일반채권 실시간체결가| | +|[장내채권]실시간시세|일반채권 실시간호가| | +|[장내채권]실시간시세|채권지수 실시간체결가| | + +## 4. API 예제 목록 + +|구분|예제명|언어|상세| +|--|--|--|--| +|Sample01|kis_api01.py|python|[국내주식] 주문/계좌조회/시세 호출| +|Sample01|kis_api02.py|python|[국내선물옵션] 주문/계좌조회/시세 호출| +|Sample01|kis_api03.py|python|[해외주식] 주문/계좌조회/시세 호출| +|Sample01|kis_api04.py|python|[해외선물옵션] 주문/계좌조회/시세 호출| +|Sample01|kis_auth.py|python|토큰 발급 관리 및 공통 샘플| +|Sample01|kis_devlp.yaml|yaml|사용자 환경 샘플| +|Sample01|kis_domfuopt.py|python|[국내선물옵션] 주문/계좌조회/시세 함수| +|Sample01|kis_domstk.py|python|[국내주식] 주문/계좌조회/시세 함수| +|Sample01|kis_domstk_ws.py|python|[국내주식] 실시간(웹소켓) 체결/호가/계좌체결발생+REST 호출 함수| +|Sample01|kis_ovrseafuopt.py|python|[해외선물옵션] 주문/계좌조회/시세 함수| +|Sample01|kis_ovrseafuopt_ws.py|python|[해외선물옵션] 실시간(웹소켓) 체결/호가/계좌주문내역발생/계좌체결발생+REST 호출 함수| +|Sample01|kis_ovrseastk.py|python|[해외주식] 주문/계좌조회/시세 함수| +|Sample01|kis_ovrseastk_ws.py|python|[해외주식] 실시간(웹소켓) 체결/호가/계좌체결발생+REST 호출 함수| +|rest|current_price_sample.py|python|국내주식 현재가 조회 샘플| +|rest|get_interest_stocks_price.py|python|관심 종목 복수 시세 조회 샘플| +|rest|get_ovsfut_chart_price.py|python|해외선물 분봉 다음 조회 샘플| +|rest|get_ovsstk_chart_price.py|python|해외주식 분봉 다음 조회 샘플| +|rest|kis_api.py|python|국내주식 주문 샘플| +|rest|kis_auth.py|python|OAuth 접근 토큰 발급 및 갱신 관련 인증 관리| +|websocket|ops_ws_sample.py|python|국내주식 웹소켓 연결| +|websocket|ws_commodity_future.py|python|상품선물옵션 실시간시세 일회성 구독| +|websocket|ws_domestic+overseas_stock.py|python|국내/해외주식 실시간시세 일회성 구독| +|websocket|ws_domestic_future.py|python|국내주식 실시간시세 일회성 구독| +|websocket|ws_domestic_overseas_all.py|python|국내/해외·주식/선물옵션, 장내채권 실시간시세 일회성 구독| +|websocket|ws_domestic_stock.py|python|국내주식 실시간시세 일회성 구독| +|websocket|ws_overseas_future.py|python|해외선물옵션 실시간시세 일회성 구독| +|websocket|ws_overseas_stock.py|python|해외주식 실시간시세 일회성 구독| + +## 5. Wikidocs(참고 교안) +|구분|도서명|지원언어|링크| +|--|--|--|--| +|rest|파이썬으로 배우는 오픈API 트레이딩 초급 예제|python|https://wikidocs.net/book/7559| +|websocket|파이썬으로 배우는 한국투자증권 Websocket 사용 예제|python|https://wikidocs.net/book/7847| + + +![Footer](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200§ion=footer) diff --git a/한국투자증권(API)/legacy/Sample01/README.md b/한국투자증권(API)/legacy/Sample01/README.md new file mode 100644 index 0000000..8e60541 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/README.md @@ -0,0 +1,12 @@ +#### **[당사에서 제공하는 샘플코드에 대한 유의사항]** #### +- 샘플 코드는 한국투자증권 오픈API(KIS Develpers)를 연동하는 예시입니다. 고객님의 개발부담을 줄이고자 참고용으로 제공되고 있습니다. +- 샘플 코드는 별도의 공지 없이 지속적으로 업데이트될 수 있습니다. +- 샘플 코드를 활용하여 제작한 고객님의 프로그램으로 인한 손해에 대해서는 당사에서 책임지지 않습니다. + +![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=300§ion=header&text=한국투자증권%20KIS%20Developers&fontSize=50&animation=fadeIn&fontAlignY=38&desc=Open%20Trading%20API%20Docs&descAlignY=51&descAlign=62) + +[작성중] +## 1. 샘플코드 이용 안내 (API 호출 이제부터 한줄이면 됩니다.) + +한국투자증권 오픈API 활용하는 매매프로그램 개발을 좀더 쉽게 가능하도록 API호출에 필요한 Header, Body 정의를 Import 만으로 한줄로만 호출이 가능합니다. + diff --git a/한국투자증권(API)/legacy/Sample01/kis_api01.py b/한국투자증권(API)/legacy/Sample01/kis_api01.py new file mode 100644 index 0000000..6d6d88a --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_api01.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Feb 15 07:56:54 2022 +""" +#kis_api module 을 찾을 수 없다는 에러가 나는 경우 sys.path에 kis_api.py 가 있는 폴더를 추가해준다. +import kis_auth as ka +import kis_domstk as kb + +import pandas as pd + +import sys + +# 토큰 발급 +ka.auth() + + +#====| 국내주식(kis_domstk) import 파일을 하신후 프로그램에서 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +#====| 국내주식(kis_domstk) import 파일을 하신후 프로그램에서 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== + +#====| 국내선물옵션, 해외주식, 해외선물옵션, 채권 등 지속적으로 추가하도록 하겠습니다. 2024.05.16 KIS Developers Team |====================== + +#====| [국내주식] 주문/계좌 |============================================================================================================================ + +# [국내주식] 주문/계좌 > 주식현금주문 (매수매도구분 buy,sell + 종목번호 6자리 + 주문수량 + 주문단가) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_domstk.py get_order_cash 수정요망! +rt_data = kb.get_order_cash(ord_dv="buy",itm_no="071050", qty=10, unpr=65000) +print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + +# [국내주식] 주문/계좌 > 주식주문(정정취소) (한국거래소전송주문조직번호 5자리+원주문번호 10자리('0'을 채우지 않아도됨)+정정취소구분코드+정정및취소주문수량+잔량전부주문여부) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_domstk.py get_order_rvsecncl 수정요망! +rt_data = kb.get_order_rvsecncl(ord_orgno="06010", orgn_odno="0000224003", ord_dvsn="00", rvse_cncl_dvsn_cd="01", ord_qty=0, ord_unpr=64900, qty_all_ord_yn="Y") +print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + +# [국내주식] 주문/계좌 > 주식정정취소가능주문내역조회 +rt_data = kb.get_inquire_psbl_rvsecncl_lst() +print(rt_data) + +# [국내주식] 주문/계좌 > 주식일별주문체결(현황)조회 +# dv="01" 01:3개월 이내 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월~04월조회) +# dv="02" 02:3개월 이전 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월이전) +rt_data = kb.get_inquire_daily_ccld_obj(dv="01") +print(rt_data) + +# [국내주식] 주문/계좌 > 주식일별주문체결(내역)조회 +# dv="01" 01:3개월 이내 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월~04월조회) +# dv="02" 02:3개월 이전 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월이전) +rt_data = kb.get_inquire_daily_ccld_lst(dv="01") +print(rt_data) + +# [국내주식] 주문/계좌 > 주식잔고조회 (잔고현황) +rt_data = kb.get_inquire_balance_obj() +print(rt_data) + +# [국내주식] 주문/계좌 > 주식잔고조회 (보유종목리스트) +rt_data = kb.get_inquire_balance_lst() +print(rt_data) + + +# [국내주식] 주문/계좌 > 매수가능조회 (종목번호 5자리 + 종목단가) +rt_data = kb.get_inquire_psbl_order(pdno="", ord_unpr=0) +ord_psbl_cash_value = rt_data.loc[0, 'ord_psbl_cash'] # ord_psbl_cash 주문가능현금 +ord_psbl_cash_value = rt_data.loc[0, 'nrcvb_buy_amt'] # nrcvb_buy_amt 미수없는매수가능금액 +print(rt_data) + +# [국내주식] 주문/계좌 > 주식예약주문 (매수매도구분 buy,sell + 종목번호 6자리 + 주문수량 + 주문단가 + 주문구분코드 ) +# 주문구분코드 : 00 : 지정가 01 : 시장가 02 : 조건부지정가 05 : 장전 시간외 +rt_data = kb.get_order_resv(ord_dv="buy", itm_no="052400", qty=100, unpr=12650, ord_dvsn_cd="01") +print(rt_data.RSVN_ORD_SEQ) # 예약주문순번 + +# [국내주식] 주문/계좌 > 주식예약주문(취소) (예약주문순번) +rt_data = kb.get_order_resv_cncl(rsvn_ord_seq="93601") +print(rt_data) + +# [국내주식] 주문/계좌 > 주식예약주문(정정) (종목번호 6자리 + 주문수량 + 주문단가 + 매도매수구분코드 + 주문구분코드 + 주문대상잔고구분코드 + 예약주문순번) +# 매도매수구분코드 01 : 매도 02 : 매수 +# 주문구분코드 00 : 지정가 01 : 시장가 02 : 조건부지정가 05 : 장전 시간외 +# 주문대상잔고구분코드 10 : 현금 12 : 주식담보대출 14 : 대여상환 21 : 자기융자신규 ......... +rt_data = kb.get_order_resv_rvse(pdno="052400", ord_qty=1, ord_unpr=12700, sll_buy_dvsn_cd="02", ord_dvsn="00", ord_objt_cblc_dvsn_cd="", rsvn_ord_seq=93605) +print(rt_data) + +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] (조회시작일자 + 조회종료일자) +rt_data = kb.get_order_resv_ccnl(inqr_strt_dt="20240429", inqr_end_dt="20240430") +print(rt_data) + +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익[v1_국내주식-041] +rt_data = kb.get_inquire_balance_rlz_pl_obj() +print(rt_data) +rt_data = kb.get_inquire_balance_rlz_pl_lst() +print(rt_data) + +# [국내주식] 주문/계좌 > 신용매수가능조회 +rt_data = kb.get_inquire_credit_psamount() +print(rt_data) + +# [국내주식] 주문/계좌 > 기간별매매손익현황조회 +rt_data = kb.get_inquire_period_trade_profit_obj() +print(rt_data) +rt_data = kb.get_inquire_period_trade_profit_lst() +print(rt_data) + +# [국내주식] 주문/계좌 > 기간별손익일별합산조회 +rt_data = kb.get_inquire_period_profit_obj() +print(rt_data) +rt_data = kb.get_inquire_period_profit_lst() +print(rt_data) + + + + +# [국내주식] 기본시세 > 주식현재가 시세 (종목번호 6자리) +rt_data = kb.get_inquire_price(itm_no="071050") +print(rt_data.stck_prpr+ " " + rt_data.prdy_vrss) # 현재가, 전일대비 + +# [국내주식] 기본시세 > 주식현재가 체결 (종목번호 6자리) +rt_data = kb.get_inquire_ccnl(itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 일자별 (종목번호 6자리 + 기간분류코드) +# 기간분류코드 D : (일)최근 30거래일 W : (주)최근 30주 M : (월)최근 30개월 +# 수정주가기준이며 수정주가미반영 기준을 원하시면 인자값 adj_prc_code="2" 추가 +rt_data = kb.get_inquire_daily_price(itm_no="071050", period_code="M") + +# [국내주식] 기본시세 > 주식현재가 호가 (종목번호 6자리) +rt_data = kb.get_inquire_asking_price_exp_ccn(itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 예상체결 (출력구분="2" + 종목번호 6자리) +rt_data = kb.get_inquire_asking_price_exp_ccn(output_dv="2", itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 투자자 (종목번호 6자리) +rt_data = kb.get_inquire_investor(itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 회원사 (종목번호 6자리) +rt_data = kb.get_inquire_member(itm_no="071050") + +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) (현재) (종목번호 6자리) +rt_data = kb.get_inquire_daily_itemchartprice(itm_no="071050") + +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) (기간별 데이터 Default는 일별이며 조회기간은 100일전(영업일수 아님)부터 금일까지) +rt_data = kb.get_inquire_daily_itemchartprice(output_dv="2", itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결 (현재가 : 주식현재가, 전일대비, 전일대비율, 누적거래량,전일거래량, 대표시장한글명)) +rt_data = kb.get_inquire_time_itemconclusion(itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결 (시간대별체결내역) +rt_data = kb.get_inquire_time_itemconclusion(output_dv='2', itm_no="071050") # 기준시각 미지정시 현재시각 이전 체결 내역이 30건 조회됨 +rt_data = kb.get_inquire_time_itemconclusion(output_dv='2', itm_no="071050", inqr_hour='100000') # 지정 기준시각 이전 체결 내역이 30건 조회됨 + +# [국내주식] 기본시세 > 주식현재가 시간외현재주가 (시간외 현재가 : 주식현재가, 전일대비, 전일대비율, 누적거래량, 거래량, 거래대금, 단일가상한가 .... 등) +rt_data = kb.get_inquire_daily_overtimeprice(itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가 (최근 30일) (출력구분 + 종목번호 6자리) +rt_data = kb.get_inquire_daily_overtimeprice(output_dv='2', itm_no="071050") + +# [국내주식] 기본시세 > 주식당일분봉조회 (종목번호 6자리) (출력구분 + 종목번호 6자리) +rt_data = kb.get_inquire_time_itemchartprice(itm_no="071050") # +rt_data = kb.get_inquire_time_itemchartprice(output_dv="2", itm_no="071050") + +# [국내주식] 기본시세 > 주식현재가 시세2 +rt_data = kb.get_inquire_daily_price_2(itm_no="071050") + +# [국내주식] 기본시세 > ETF/ETN 현재가 +rt_data = kb.get_quotations_inquire_price(itm_no="071050") + +# [국내주식] 기본시세 > NAV 비교추이(종목) +rt_data = kb.get_quotations_nav_comparison_trend(itm_no="071050") # ETF 종목 정보 +rt_data = kb.get_quotations_nav_comparison_trend(output_dv="2", itm_no="071050") # ETF NAV 정보 + +# [국내주식] 업종/기타 > 국내휴장일조회 +rt_data = kb.get_quotations_ch_holiday(dt="20240302") + +print(rt_data) diff --git a/한국투자증권(API)/legacy/Sample01/kis_api02.py b/한국투자증권(API)/legacy/Sample01/kis_api02.py new file mode 100644 index 0000000..b72ac3e --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_api02.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Feb 15 07:56:54 2022 +""" +#kis_api module 을 찾을 수 없다는 에러가 나는 경우 sys.path에 kis_api.py 가 있는 폴더를 추가해준다. +import kis_auth as ka +import kis_domfuopt as kb + +import pandas as pd + +import sys + +# 토큰 발급 +ka.auth() + +#====| 국내선물옵션(야간포함)(kis_domfuopt) import 파일을 하신후 프로그램에서 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |======================= +#====| 국내선물옵션(야간포함)(kis_domfuopt) import 파일을 하신후 프로그램에서 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |======================= +#====| 국내선물옵션(야간포함)(kis_domfuopt) import 파일을 하신후 프로그램에서 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |======================= + +#====| 국내선물옵션, 해외주식, 해외선물옵션, 채권 등 지속적으로 추가하도록 하겠습니다. 2024.05.16 KIS Developers Team |====================== + + +#====| [국내선물옵션] 주문/계좌 |============================================================================================================================ + +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] (주간:01/야간(Eurex):02구분 + 매수매도구분 buy,sell + 종목번호 + 주문수량 + 주문단가) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_domstk.py get_order_cash 수정요망! +rt_data = kb.get_domfuopt_order(dv_cd="01", sll_buy_dvsn_cd="02", dvsn_cd="02", itm_no="101V06", qty=100, unpr=0) +print(rt_data) + +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] (주간:01/야간(Eurex):02구분 + 정정취소구분코드(정정:01. 취소:02) + 원주문번호 + 주문구분 + 주문수량 + 주문단가 + 잔량전부여부) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_domfuopt.py get_domfuopt_order_rvsecncl 수정요망! +rt_data = kb.get_domfuopt_order_rvsecncl(orgn_odno="0000362027", ord_dvsn="01", rvse_cncl_dvsn_cd="01", ord_qty=1, ord_unpr=366.45, rmn_qty_yn="") +print(rt_data) + +# [[국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 현황조회 [국내선물-009] (조회시작일 + 조회종료일) +rt_data = kb.get_domfuopt_inquire_ngt_ccnl_obj(inqr_strt_dt="20230701", inqr_end_dt="20230731") +print(rt_data) + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] (조회시작일 + 조회종료일) +rt_data = kb.get_domfuopt_inquire_ngt_ccnl_lst(inqr_strt_dt="20230701", inqr_end_dt="20230731") +print(rt_data) + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +rt_data = kb.get_domfuopt_inquire_ngt_balance_obj() +print(rt_data) + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 +rt_data = kb.get_domfuopt_inquire_ngt_balance_lst() +print(rt_data) + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +rt_data = kb.get_domfuopt_inquire_psbl_ngt_order(pdno="101V06", sll_buy_dvsn_cd="02", ord_unpr=0) +print(rt_data) diff --git a/한국투자증권(API)/legacy/Sample01/kis_api03.py b/한국투자증권(API)/legacy/Sample01/kis_api03.py new file mode 100644 index 0000000..d26b3d8 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_api03.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Feb 15 07:56:54 2022 +""" +#kis_api module 을 찾을 수 없다는 에러가 나는 경우 sys.path에 kis_api.py 가 있는 폴더를 추가해준다. +import kis_auth as ka +import kis_ovrseastk as kb + +import pandas as pd + +import sys + +# 토큰 발급 +ka.auth() + + +#====| [해외주식] 주문/계좌 |============================================================================================================================ + +# [해외주식] 주문/계좌 > 주문 (매수매도구분 buy,sell + 종목코드6자리 + 주문수량 + 주문단가) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_ovrseastk.py get_overseas_order 수정요망! +#rt_data = kb.get_overseas_order(ord_dv="buy", excg_cd="NASD", itm_no="TSLA", qty=1, unpr=170) +#rt_data = kb.get_overseas_order(ord_dv="buy", excg_cd="NASD", itm_no="AAPL", qty=1, unpr=216.75) +rt_data = kb.get_overseas_order(ord_dv="buy", excg_cd="NASD", itm_no="NVDA", qty=1, unpr=123.3) +print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + +# [해외주식] 주문/계좌 > 정정취소주문 (해외거래소코드excg_cd + 종목코드itm_no + 주문번호orgn_odno + 정정취소구분rvse_cncl_dvsn_cd + 수량qty + 주문단가unpr) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_ovrseastk.py get_overseas_order 수정요망! +rt_data = kb.get_overseas_order_rvsecncl(excg_cd="NASD", itm_no="TSLA", orgn_odno="0030089601", rvse_cncl_dvsn_cd="02", qty=1, unpr=0) +print(rt_data) # 주문접수조직번호+주문접수번호+주문시각 + +# [해외주식] 주문/계좌 > 해외주식 미체결내역 (해외거래소코드) +# 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 +rt_data = kb.get_overseas_inquire_nccs(excg_cd="NASD") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 미체결전량취소주문 (해외거래소코드excg_cd + 종목코드itm_no) +# 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 +rt_data = kb.get_overseas_order_allcncl(excg_cd="NASD", itm_no="") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 잔고 현황 +# 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 +# 거래통화코드 - USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 +rt_data = kb.get_overseas_inquire_balance(excg_cd="NASD", crcy_cd="") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 잔고 내역 +# 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 +# 거래통화코드 - USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 +rt_data = kb.get_overseas_inquire_balance(excg_cd="NASD", crcy_cd="") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 주문체결내역 +# 해외거래소코드 NASD:미국시장 전체(나스닥,뉴욕,아멕스),NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 +rt_data = kb.get_overseas_inquire_ccnl(st_dt="", ed_dt="") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 +# dv : 01 보유종목, 02 외화잔고, 03 체결기준현재잔고 +# dvsn : 01 원화, 02 외화 +# natn 국가코드 : 000 전체,840 미국,344 홍콩,156 중국,392 일본,704 베트남 +# mkt 거래시장코드 [Request body NATN_CD 000 설정] +# 00 : 전체 , (NATN_CD 840 인경우) 00:전체,01:나스닥(NASD),02:뉴욕거래소(NYSE),03:미국(PINK SHEETS),04:미국(OTCBB),05:아멕스(AMEX) (다른시장 API문서 참조) +rt_data = kb.get_overseas_inquire_present_balance(dv="02", dvsn="01", natn="000", mkt="00", inqr_dvsn="00") +print(rt_data) + +# [해외주식] 주문/계좌 > 미국주간주문 (매수매도구분 buy,sell + 종목번호 + 주문수량 + 주문단가) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_ovrseastk.py get_overseas_order 수정요망! +#rt_data = kb.get_overseas_daytime_order(ord_dv="buy", excg_cd="NASD", itm_no="TSLA", qty=1, unpr=251) +#rt_data = kb.get_overseas_daytime_order(ord_dv="buy", excg_cd="NASD", itm_no="AAPL", qty=1, unpr=216.75) +rt_data = kb.get_overseas_daytime_order(ord_dv="buy", excg_cd="NASD", itm_no="NVDA", qty=1, unpr=123.3) +print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + +# [해외주식] 주문/계좌 > 미국주간정정취소 (해외거래소코드excg_cd + 종목코드itm_no + 주문번호orgn_odno + 정정취소구분rvse_cncl_dvsn_cd + 수량qty + 주문단가unpr) +# 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 kis_ovrseastk.py get_overseas_order 수정요망! +rt_data = kb.get_overseas_daytime_order_rvsecncl(excg_cd="NASD", itm_no="TSLA", orgn_odno="0030089601", rvse_cncl_dvsn_cd="02", qty=1, unpr=0) +print(rt_data) # 주문접수조직번호+주문접수번호+주문시각 + +# [해외주식] 주문/계좌 > 해외주식 기간손익[v1_해외주식-032] (해외거래소코드 + 통화코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) +# 해외거래소코드 NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 +rt_data = kb.get_overseas_inquire_period_profit(excg_cd="", crcy="", itm_no="", st_dt="20240601", ed_dt="20240709") +print(rt_data) +# [해외주식] 주문/계좌 > 해외주식 기간손익(매매일자종목별 기간손익) (해외거래소코드 + 통화코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) +rt_data = kb.get_overseas_inquire_period_profit_output1(excg_cd="NASD", crcy="", itm_no="", st_dt="20240501", ed_dt="20240709") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외증거금 통화별조회 +rt_data = kb.get_overseas_inquire_foreign_margin() +print(rt_data) + +# [해외주식] 주문/계좌 > 해외증거금 일별거래내역 (해외거래소코드 + 매도매수구분코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) +rt_data = kb.get_overseas_inquire_period_trans(excg_cd="", dvsn="", itm_no="", st_dt="20240601", ed_dt="20240709") +# [해외주식] 주문/계좌 > 해외증거금 일별거래내역[합계] +rt_data = kb.get_overseas_inquire_period_trans_output2(excg_cd="", dvsn="", itm_no="", st_dt="20240601", ed_dt="20240709") +print(rt_data) + +# [해외주식] 주문/계좌 > 해외주식 결제기준현재잔고 +# dv : 01 보유종목, 02 외화잔고, 03 결제기준현재잔고 +# dt : 기준일자(YYYYMMDD) +# dvsn : 01 원화, 02 외화 +# inqr_dvsn : 00(전체), 01(일반), 02(미니스탁) +rt_data = kb.get_overseas_inquire_paymt_stdr_balance(dv="03", dt="", dvsn="01", inqr_dvsn="00") +print(rt_data) + +#====| [해외주식] 기본시세 |============================================================================================================================ + +# [해외주식] 기본시세 > 해외주식 현재체결가 (해외거래소코드, 종목번호) +rt_data = kb.get_overseas_price_quot_search_info(excd="NAS", itm_no="AAPL") +print(rt_data) # 해외주식 현재체결가 + +# [해외주식] 기본시세 > 해외주식 기간별시세 +# ※ 기준일(bymd) 지정일자 이후 100일치 조회, 미입력시 당일자 기본 셋팅 +rt_data = kb.get_overseas_price_quot_dailyprice(excd="NAS", itm_no="AAPL", gubn="0", bymd="") +print(rt_data) # 해외주식 기간별시세 + +# [해외주식] 기본시세 > 해외주식 종목/지수/환율기간별시세(일/주/월/년) +# ※ 기준일(bymd) 지정일자 이후 100일치 조회, 미입력시 당일자 기본 셋팅 +rt_data = kb.get_overseas_price_quot_inquire_daily_price(div="N", itm_no="AAPL", inqr_strt_dt="", inqr_end_dt="", period="D") +rt_data = kb.get_overseas_price_quot_inquire_daily_chartprice(div="N", itm_no="AAPL", inqr_strt_dt="20240605", inqr_end_dt="20240610", period="D") +print(rt_data) # 해외주식 종목/지수/환율기간별시세(일/주/월/년) + +# [해외주식] 기본시세 > 해외주식조건검색 div 01 : 검색결과종목수, 02:검색결과종목리스트 +rt_data = kb.get_overseas_price_quot_inquire_search(div="02", excd="NAS", pr_st="160", pr_en="170") +print(rt_data) # 해외주식조건검색 + +# [해외주식] 기본시세 > 해외결재일자조회 (기준일자) +rt_data = kb.get_overseas_price_quot_countries_holiday(dt="") +print(rt_data) # 해외결재일자조회 + +# [해외주식] 기본시세 > 해외주식 현재가상세 (해외거래소시장코드, 종목코드) +rt_data = kb.get_overseas_price_quot_price_detail(excd="NAS", itm_no="AAPL") +print(rt_data) # 해외주식 현재가상세 + +# [해외주식] 기본시세 > 해외주식 해외주식분봉조회 (조회구분 div-02:분봉데이터,01:시장별장운영시간, 해외거래소시장코드, 종목코드, 분갭, 전일포함여부) +rt_data = kb.get_overseas_price_quot_inquire_time_itemchartprice(div="02", excd="NAS", itm_no="AAPL", nmin="", pinc="0") +print(rt_data) # 해외주식 해외주식분봉조회 + +# [해외주식] 기본시세 > 해외주식 해외지수분봉조회 (조회구분 div-02:분봉데이터,01:지수정보, 조건시장분류코드, 입력종목코드, 시간구분코드, 과거데이터포함여부) +rt_data = kb.get_overseas_price_quot_inquire_time_indexchartprice(div="02", code="N", iscd="SPX", tm_dv="0", inc="Y") +print(rt_data) # 해외주식 해외지수분봉조회 + +# [해외주식] 기본시세 > 해외주식 상품기본정보 (종목번호, 종목유형) +# 종목유형 : 512 미국 나스닥/513 미국 뉴욕/529 미국 아멕스/515 일본/501 홍콩/543 홍콩CNY/558 홍콩USD/507 베트남 하노이/508 베트남 호치민/551 중국 상해A/552 중국 심천A +rt_data = kb.get_overseas_price_search_info(itm_no="AAPL", prdt_type_cd="512") +print("종목코드("+rt_data.std_pdno+") 종목명(" +rt_data.prdt_eng_name+") 거래시장(" +rt_data.ovrs_excg_cd+":" +rt_data.tr_mket_name+")") # 해외주식 상품기본정보 +print(rt_data) # 해외주식 상품기본정보 + +# [해외주식] 기본시세 > 해외주식 현재가 10호가 (조회구분 01:기본시세 02:10호가 , 해외거래소코드, 종목번호) +rt_data = kb.get_overseas_price_inquire_asking_price(div="02", excd="NAS", itm_no="AAPL") +print(rt_data) # 해외주식 상품기본정보 + diff --git a/한국투자증권(API)/legacy/Sample01/kis_api04.py b/한국투자증권(API)/legacy/Sample01/kis_api04.py new file mode 100644 index 0000000..4d42fff --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_api04.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Feb 15 07:56:54 2022 +""" +#kis_api module 을 찾을 수 없다는 에러가 나는 경우 sys.path에 kis_api.py 가 있는 폴더를 추가해준다. +import kis_auth as ka +import kis_ovrseafuopt as kb + +import pandas as pd + +import sys + +# 토큰 발급 +ka.auth() + +#====| [해외선물옵션] 주문/계좌 |============================================================================================================================ + +# [해외선물옵션] 주문/계좌 > 해외선물옵션주문 (종목번호<6자리 5자리> + 매수매도구분ord_dv + 가격구분dvsn + 주문수량qty + 주문가격limt_pric + 주문가격stop_pric) +# 매수매도구분ord_dv 01 : 매도, 02 : 매수 # 가격구분dvsn : 1.지정, 2. 시장, 3. STOP, 4 S/L +# 주문가격limt_pric : 지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력 +# 주문가격stop_pric : STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력 +rt_data = kb.get_overseasfuopt_order(itm_no="OESU24 C6000", ord_dv="02", dvsn="1", qty=1, limt_pric=13.75, stop_pric=0) +print(rt_data.ORD_DT + "+" + rt_data.ODNO) # 주문일자+주문접수번호 + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문 (정정취소구분dvsn + 원주문일자ord_dt + 원주문번호orgn_odno + 주문가격limt_pric + 주문가격stop_pric + 청산주문가격lqd_limt_pric + 청산주문가격lqd_stop_pric) +rt_data = kb.get_overseasfuopt_order_rvsecncl(dvsn="01", ord_dt="", orgn_odno="", limt_pric=0, stop_pric=0, lqd_limt_pric=0, lqd_stop_pric=0) +print(rt_data.ORD_DT + "+" + rt_data.ODNO) # 주문일자+주문접수번호 + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문 (정정취소구분dvsn + 원주문일자ord_dt + 원주문번호orgn_odno + 주문가격limt_pric + 주문가격stop_pric + 청산주문가격lqd_limt_pric + 청산주문가격lqd_stop_pric) +rt_data = kb.get_overseasfuopt_order_rvsecncl(dvsn="01", ord_dt="", orgn_odno="", limt_pric=0, stop_pric=0, lqd_limt_pric=0, lqd_stop_pric=0) +print(rt_data.ORD_DT + "+" + rt_data.ODNO) # 주문일자+주문접수번호 + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문 (체결미체결구분ccld_dv + 매도매수구분코드ord_dv + 선물옵션구분fuop_dvsn) +# 체결미체결구분 01:전체,02:체결,03:미체결 # 매도매수구분코드 %%:전체,01:매도,02:매수 # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 +rt_data = kb.get_overseasfuopt_inquire_ccld(ccld_dv="01", ord_dv="%%", fuop_dvsn="00") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) (선물옵션구분fuop_dvsn) +# 선물옵션구분 00:전체 / 01:선물 / 02:옵션 +rt_data = kb.get_overseasfuopt_inquire_unpd(fuop_dvsn="00") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 해외선물옵션 주문가능조회 (선물옵션구분fuop_dvsn) +# 선물옵션구분 00:전체 / 01:선물 / 02:옵션 +rt_data = kb.get_overseasfuopt_inquire_psamount(itm_no="OESU24 C6000", dvsn="02", pric=0, ordyn="") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별 (조회구분inqr_dvsn + 조회시작일자fr_dt + 조회종료일자to_dt + 통화코드crcy + 선물옵션구분fuop_dvsn") +# 조회구분코드 : 01 통화별, 02 종목별 +rt_data = kb.get_overseasfuopt_inquire_period_ccld(inqr_dvsn="01", fr_dt="", to_dt="", crcy="%%%", fuop_dvsn="00") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 체결내역 (조회시작일자fr_dt + 조회종료일자to_dt + 선물옵션구분fuop_dvsn + 통화코드crcy + 매도매수구분코드dvsn) +rt_data = kb.get_overseasfuopt_inquire_daily_ccld(fr_dt="", to_dt="", fuop_dvsn="00", crcy="%%%", dvsn="%%") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황 (통화코드crcy + 조회일자inqr_dt) +rt_data = kb.get_overseasfuopt_inquire_deposit(crcy="%%%", inqr_dt="") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역 (조회시작일자fr_dt + 조회종료일자to_dt + 체결미체결구분ccld_dvsn + 매수매도구분dvsn + 선물옵션구분fuop_dvsn) +# ccld_dvsn 01:전체 / 02:체결 / 03:미체결 dvsn %% : 전체 / 01 : 매도 / 02 : 매수 fuop_dvsn 00:전체 / 01:선물 / 02:옵션 +rt_data = kb.get_overseasfuopt_inquire_daily_order(fr_dt="20240401", to_dt="", ccld_dvsn="01", dvsn="%%", fuop_dvsn="00") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역 (조회시작일자fr_dt, 조회종료일자to_dt) +rt_data = kb.get_overseasfuopt_inquire_period_trans(fr_dt="20240101", to_dt="20240717") +print(rt_data) + +# [해외선물옵션] 주문/계좌 > 해외선물옵션 증거금상세 (통화구분crcy + 조회일자inqr_dt) +rt_data = kb.get_overseasfuopt_inquire_margin_detail(crcy="TUS", inqr_dt="20240717") +print(rt_data) + + +#====| [해외선물옵션] 기본시세 |============================================================================================================================ + +# [해외선물옵션] 기본시세 > 해외선물종목상세 (종목코드) +rt_data = kb.get_overseas_fuopt_stock_detail(itm_no="6EU24") +print(rt_data) # 해외선물종목상세 + +# [해외선물옵션] 기본시세 > 해외선물종목현재가 (종목코드) +rt_data = kb.get_overseas_fuopt_inquire_price(itm_no="6EU24") +print(rt_data) # 해외선물종목현재가 + +# [해외선물옵션] 기본시세 > 분봉조회 (종목코드 + 거래소시장코드 + 조회시작일 + 조회종료일 + 조회건수(120건) + 갭(5분)) +# 조회일자 1주일 이내 (조회시작일~조회종료일) +rt_data = kb.get_overseas_fuopt_inquire_time_futurechartprice(itm_no="6EU24", exch="CME", st_dt="20240709", ed_dt="20240710", cnt="120", gap="5", idx="") +print(rt_data) # 해외선물분봉조회 + +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] (종목코드 + 거래소시장코드 + 조회시작일 + 조회종료일) +# 조회일자 1주일 이내 (조회시작일~조회종료일) +rt_data = kb.get_overseas_fuopt_weekly_ccnl(itm_no="6EU24", exch="CME", st_dt="20240709", ed_dt="20240710") +print(rt_data) # 체결추이(주간) + +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간)[해외선물-018] (종목코드 + 거래소시장코드 + 조회시작일 + 조회종료일) +# 조회일자 1주일 이내 (조회시작일~조회종료일) +rt_data = kb.get_overseas_fuopt_daily_ccnl(itm_no="6EU24", exch="CME", st_dt="20240707", ed_dt="20240710") +print(rt_data) # 체결추이(일간) + +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] (종목코드 + 거래소시장코드) +# 조회일자는 당일만 조회하도록 샘플코드 구성 +rt_data = kb.get_overseas_fuopt_tick_ccnl(itm_no="6EU24", exch="CME") +print(rt_data) # 체결추이(틱) + +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] (종목코드 + 거래소시장코드 + 조회시작일 + 조회종료일) +# 조회일자 1주일 이내 (조회시작일~조회종료일) +rt_data = kb.get_overseas_fuopt_monthly_ccnl(itm_no="6EU24", exch="CME", st_dt="20240707", ed_dt="20240710") +print(rt_data) # 체결추이(일간) + +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] (종목코드) +rt_data = kb.get_overseas_fuopt_inquire_asking_price(itm_no="6EU24") +print(rt_data) # 해외선물 호가 + +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보 [해외선물-023] (종목코드) +rt_data = kb.get_overseas_fuopt_search_contract_detail(itm_no01="6EU24") +print(rt_data) # 해외선물 상품기본정보 + +# [해외선물옵션] 기본시세 > 해외선물 장운영시간 [해외선물-030] (클래스코드 + 거래소코드 + 옵션여부) +rt_data = kb.get_overseas_fuopt_market_time(clas="", excg="CME", opt="%") +print(rt_data) # 해외선물 장운영시간 + +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [해외선물-029] (상품 + 거래소코드 + 옵션여부) +# 상품(PROD_ISCD) : 상품 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG),농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), +# 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX) +# 100건씩 조회되면 다음 페이지 조회는 응답메시지 (bsop_date 일자 순으로) 마지막 응답 데이터 일자 +1일 일자 값셋팅(bsop_date)하여 조회 +rt_data = kb.get_overseas_fuopt_investor_unpd_trend(iscd="CL", dt="20240612", kbn="0", ctskey="1") +print(rt_data) # 해외선물 장운영시간 + +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] (조회구분 + 옵션종목코드) +# dv(조회구분) : 01 현재가, 02 호가 +rt_data = kb.get_overseas_fuopt_opt_asking_price(dv="02", itm_no="OESU24 C6000") +print(rt_data) # 해외옵션 호가 diff --git a/한국투자증권(API)/legacy/Sample01/kis_auth.py b/한국투자증권(API)/legacy/Sample01/kis_auth.py new file mode 100644 index 0000000..a62c719 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_auth.py @@ -0,0 +1,355 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" +#====| 토큰 발급에 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +#====| 토큰 발급에 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +#====| 토큰 발급에 필요한 API 호출 샘플 아래 참고하시기 바랍니다. |===================== +#====| API 호출 공통 함수 포함 |===================== + + +import time, copy +import yaml +import requests +import json + +# 웹 소켓 모듈을 선언한다. +import asyncio + +import os + +import pandas as pd + +from collections import namedtuple +from datetime import datetime + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + +config_root = 'd:\\KIS\\config\\' # 토큰 파일이 저장될 폴더, 제3자가 찾지 어렵도록 경로 설정하시기 바랍니다. +#token_tmp = config_root + 'KIS000000' # 토큰 로컬저장시 파일 이름 지정, 파일이름을 토큰값이 유추가능한 파일명은 삼가바랍니다. +#token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d%H%M%S") # 토큰 로컬저장시 파일명 년월일시분초 +token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d") # 토큰 로컬저장시 파일명 년월일 + +# 접근토큰 관리하는 파일 존재여부 체크, 없으면 생성 +if os.path.exists(token_tmp) == False: + f = open(token_tmp, "w+") + +# 앱키, 앱시크리트, 토큰, 계좌번호 등 저장관리, 자신만의 경로와 파일명으로 설정하시기 바랍니다. +# pip install PyYAML (패키지설치) +with open(config_root + 'kis_devlp.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) + +_TRENV = tuple() +_last_auth_time = datetime.now() +_autoReAuth = False +_DEBUG = False +_isPaper = False + +# 기본 헤더값 정의 +_base_headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8", + 'User-Agent': _cfg['my_agent'] +} + + +# 토큰 발급 받아 저장 (토큰값, 토큰 유효시간,1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def save_token(my_token, my_expired): + valid_date = datetime.strptime(my_expired, '%Y-%m-%d %H:%M:%S') + # print('Save token date: ', valid_date) + with open(token_tmp, 'w', encoding='utf-8') as f: + f.write(f'token: {my_token}\n') + f.write(f'valid-date: {valid_date}\n') + + +# 토큰 확인 (토큰값, 토큰 유효시간_1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def read_token(): + try: + # 토큰이 저장된 파일 읽기 + with open(token_tmp, encoding='UTF-8') as f: + tkg_tmp = yaml.load(f, Loader=yaml.FullLoader) + + # 토큰 만료 일,시간 + exp_dt = datetime.strftime(tkg_tmp['valid-date'], '%Y-%m-%d %H:%M:%S') + # 현재일자,시간 + now_dt = datetime.today().strftime("%Y-%m-%d %H:%M:%S") + + # print('expire dt: ', exp_dt, ' vs now dt:', now_dt) + # 저장된 토큰 만료일자 체크 (만료일시 > 현재일시 인경우 보관 토큰 리턴) + if exp_dt > now_dt: + return tkg_tmp['token'] + else: + # print('Need new token: ', tkg_tmp['valid-date']) + return None + except Exception as e: + # print('read token error: ', e) + return None + +# 토큰 유효시간 체크해서 만료된 토큰이면 재발급처리 +def _getBaseHeader(): + if _autoReAuth: reAuth() + return copy.deepcopy(_base_headers) + + +# 가져오기 : 앱키, 앱시크리트, 종합계좌번호(계좌번호 중 숫자8자리), 계좌상품코드(계좌번호 중 숫자2자리), 토큰, 도메인 +def _setTRENV(cfg): + nt1 = namedtuple('KISEnv', ['my_app', 'my_sec', 'my_acct', 'my_prod', 'my_token', 'my_url']) + d = { + 'my_app': cfg['my_app'], # 앱키 + 'my_sec': cfg['my_sec'], # 앱시크리트 + 'my_acct': cfg['my_acct'], # 종합계좌번호(8자리) + 'my_prod': cfg['my_prod'], # 계좌상품코드(2자리) + 'my_token': cfg['my_token'], # 토큰 + 'my_url': cfg['my_url'] # 실전 도메인 (https://openapi.koreainvestment.com:9443) + } # 모의 도메인 (https://openapivts.koreainvestment.com:29443) + + # print(cfg['my_app']) + global _TRENV + _TRENV = nt1(**d) + + +def isPaperTrading(): # 모의투자 매매 + return _isPaper + + +# 실전투자면 'prod', 모의투자면 'vps'를 셋팅 하시기 바랍니다. +def changeTREnv(token_key, svr='prod', product=_cfg['my_prod']): + cfg = dict() + + global _isPaper + if svr == 'prod': # 실전투자 + ak1 = 'my_app' # 실전투자용 앱키 + ak2 = 'my_sec' # 실전투자용 앱시크리트 + _isPaper = False + elif svr == 'vps': # 모의투자 + ak1 = 'paper_app' # 모의투자용 앱키 + ak2 = 'paper_sec' # 모의투자용 앱시크리트 + _isPaper = True + + cfg['my_app'] = _cfg[ak1] + cfg['my_sec'] = _cfg[ak2] + + if svr == 'prod' and product == '01': # 실전투자 주식투자, 위탁계좌, 투자계좌 + cfg['my_acct'] = _cfg['my_acct_stock'] + elif svr == 'prod' and product == '30': # 실전투자 증권저축계좌 + cfg['my_acct'] = _cfg['my_acct_stock'] + elif svr == 'prod' and product == '03': # 실전투자 선물옵션(파생) + cfg['my_acct'] = _cfg['my_acct_future'] + elif svr == 'prod' and product == '08': # 실전투자 해외선물옵션(파생) + cfg['my_acct'] = _cfg['my_acct_future'] + elif svr == 'vps' and product == '01': # 모의투자 주식투자, 위탁계좌, 투자계좌 + cfg['my_acct'] = _cfg['my_paper_stock'] + elif svr == 'vps' and product == '03': # 모의투자 선물옵션(파생) + cfg['my_acct'] = _cfg['my_paper_future'] + + cfg['my_prod'] = product + cfg['my_token'] = token_key + cfg['my_url'] = _cfg[svr] + + # print(cfg) + _setTRENV(cfg) + + +def _getResultObject(json_data): + _tc_ = namedtuple('res', json_data.keys()) + + return _tc_(**json_data) + + +# Token 발급, 유효기간 1일, 6시간 이내 발급시 기존 token값 유지, 발급시 알림톡 무조건 발송 +# 모의투자인 경우 svr='vps', 투자계좌(01)이 아닌경우 product='XX' 변경하세요 (계좌번호 뒤 2자리) +def auth(svr='prod', product=_cfg['my_prod'], url=None): + p = { + "grant_type": "client_credentials", + } + # 개인 환경파일 "kis_devlp.yaml" 파일을 참조하여 앱키, 앱시크리트 정보 가져오기 + # 개인 환경파일명과 위치는 고객님만 아는 위치로 설정 바랍니다. + if svr == 'prod': # 실전투자 + ak1 = 'my_app' # 앱키 (실전투자용) + ak2 = 'my_sec' # 앱시크리트 (실전투자용) + elif svr == 'vps': # 모의투자 + ak1 = 'paper_app' # 앱키 (모의투자용) + ak2 = 'paper_sec' # 앱시크리트 (모의투자용) + + # 앱키, 앱시크리트 가져오기 + p["appkey"] = _cfg[ak1] + p["appsecret"] = _cfg[ak2] + + # 기존 발급된 토큰이 있는지 확인 + saved_token = read_token() # 기존 발급 토큰 확인 + # print("saved_token: ", saved_token) + if saved_token is None: # 기존 발급 토큰 확인이 안되면 발급처리 + url = f'{_cfg[svr]}/oauth2/tokenP' + res = requests.post(url, data=json.dumps(p), headers=_getBaseHeader()) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + my_token = _getResultObject(res.json()).access_token # 토큰값 가져오기 + my_expired= _getResultObject(res.json()).access_token_token_expired # 토큰값 만료일시 가져오기 + save_token(my_token, my_expired) # 새로 발급 받은 토큰 저장 + else: + print('Get Authentification token fail!\nYou have to restart your app!!!') + return + else: + my_token = saved_token # 기존 발급 토큰 확인되어 기존 토큰 사용 + + # 발급토큰 정보 포함해서 헤더값 저장 관리, API 호출시 필요 + changeTREnv(f"Bearer {my_token}", svr, product) + + _base_headers["authorization"] = _TRENV.my_token + _base_headers["appkey"] = _TRENV.my_app + _base_headers["appsecret"] = _TRENV.my_sec + + global _last_auth_time + _last_auth_time = datetime.now() + + if (_DEBUG): + print(f'[{_last_auth_time}] => get AUTH Key completed!') + + +# end of initialize, 토큰 재발급, 토큰 발급시 유효시간 1일 +# 프로그램 실행시 _last_auth_time에 저장하여 유효시간 체크, 유효시간 만료시 토큰 발급 처리 +def reAuth(svr='prod', product=_cfg['my_prod']): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: # 유효시간 1일 + auth(svr, product) + + +def getEnv(): + return _cfg + + +def getTREnv(): + return _TRENV + +# 주문 API에서 사용할 hash key값을 받아 header에 설정해 주는 함수 +# 현재는 hash key 필수 사항아님, 생략가능, API 호출과정에서 변조 우려를 하는 경우 사용 +# Input: HTTP Header, HTTP post param +# Output: None +def set_order_hash_key(h, p): + url = f"{getTREnv().my_url}/uapi/hashkey" # hashkey 발급 API URL + + res = requests.post(url, data=json.dumps(p), headers=h) + rescode = res.status_code + if rescode == 200: + h['hashkey'] = _getResultObject(res.json()).HASH + else: + print("Error:", rescode) + + +# API 호출 응답에 필요한 처리 공통 함수 +class APIResp: + def __init__(self, resp): + self._rescode = resp.status_code + self._resp = resp + self._header = self._setHeader() + self._body = self._setBody() + self._err_code = self._body.msg_cd + self._err_message = self._body.msg1 + + def getResCode(self): + return self._rescode + + def _setHeader(self): + fld = dict() + for x in self._resp.headers.keys(): + if x.islower(): + fld[x] = self._resp.headers.get(x) + _th_ = namedtuple('header', fld.keys()) + + return _th_(**fld) + + def _setBody(self): + _tb_ = namedtuple('body', self._resp.json().keys()) + + return _tb_(**self._resp.json()) + + def getHeader(self): + return self._header + + def getBody(self): + return self._body + + def getResponse(self): + return self._resp + + def isOK(self): + try: + if (self.getBody().rt_cd == '0'): + return True + else: + return False + except: + return False + + def getErrorCode(self): + return self._err_code + + def getErrorMessage(self): + return self._err_message + + def printAll(self): + print("
") + for x in self.getHeader()._fields: + print(f'\t-{x}: {getattr(self.getHeader(), x)}') + print("") + for x in self.getBody()._fields: + print(f'\t-{x}: {getattr(self.getBody(), x)}') + + def printError(self, url): + print('-------------------------------\nError in response: ', self.getResCode(), ' url=', url) + print('rt_cd : ', self.getBody().rt_cd, '/ msg_cd : ',self.getErrorCode(), '/ msg1 : ',self.getErrorMessage()) + print('-------------------------------') + + # end of class APIResp + +########### API call wrapping : API 호출 공통 + +def _url_fetch(api_url, ptr_id, tr_cont, params, appendHeaders=None, postFlag=False, hashFlag=True): + url = f"{getTREnv().my_url}{api_url}" + + headers = _getBaseHeader() # 기본 header 값 정리 + + # 추가 Header 설정 + tr_id = ptr_id + if ptr_id[0] in ('T', 'J', 'C'): # 실전투자용 TR id 체크 + if isPaperTrading(): # 모의투자용 TR id 식별 + tr_id = 'V' + ptr_id[1:] + + headers["tr_id"] = tr_id # 트랜젝션 TR id + headers["custtype"] = "P" # 일반(개인고객,법인고객) "P", 제휴사 "B" + headers["tr_cont"] = tr_cont # 트랜젝션 TR id + + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if (_DEBUG): + print("< Sending Info >") + print(f"URL: {url}, TR: {tr_id}") + print(f"
\n{headers}") + print(f"\n{params}") + + if (postFlag): + #if (hashFlag): set_order_hash_key(headers, params) + res = requests.post(url, headers=headers, data=json.dumps(params)) + else: + res = requests.get(url, headers=headers, params=params) + + if res.status_code == 200: + ar = APIResp(res) + if (_DEBUG): ar.printAll() + return ar + else: + print("Error Code : " + str(res.status_code) + " | " + res.text) + return None diff --git a/한국투자증권(API)/legacy/Sample01/kis_devlp.yaml b/한국투자증권(API)/legacy/Sample01/kis_devlp.yaml new file mode 100644 index 0000000..0dc5dd6 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_devlp.yaml @@ -0,0 +1,67 @@ +#====| 사용자 환경 샘플 아래 참고하시기 바랍니다. |====================== +#====| 본 샘플은 토큰 발급 후 파일 저장 방식이므로 보안강화를 위해 메모리 방식 등 사용자 원하시는 방식으로 구현하시기 바랍니다. |===== + +#====| kis_auth.py에서 환경파일 위치를 사용자가 정하시기 바랍니다. . 2024.05.16 KIS Developers Team |====================== +#====| kis_auth.py에서 환경파일 위치를 사용자가 정하시기 바랍니다. . 2024.05.16 KIS Developers Team |====================== +#====| kis_auth.py에서 환경파일 위치를 사용자가 정하시기 바랍니다. . 2024.05.16 KIS Developers Team |====================== +# +############################### kis_auth.py ################################################## +# clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') +# +# key_bytes = 32 +# +# config_root = 'd:\\KIS\\config\\' # 토큰 파일이 저장될 폴더, 제3자가 찾지 어렵도록 경로 설정하시기 바랍니다. <<<==== 파일 위치 지정 +# #token_tmp = config_root + 'KIS000000' # 토큰 로컬저장시 파일 이름 지정, 파일이름을 토큰값이 유추가능한 파일명은 삼가바랍니다. <<<==== 토큰 저장 파일 방식 +# #token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d%H%M%S") # 토큰 로컬저장시 파일명 년월일시분초 +# token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d") # 토큰 로컬저장시 파일명 년월일 +# +# # 접근토큰 관리하는 파일 존재여부 체크, 없으면 생성 +# if os.path.exists(token_tmp) == False: +# f = open(token_tmp, "w+") +# +# # 앱키, 앱시크리트, 토큰, 계좌번호 등 저장관리, 자신만의 경로와 파일명으로 설정하시기 바랍니다. +# # pip install PyYAML (패키지설치) +# with open(config_root + 'kis_devlp.yaml', encoding='UTF-8') as f: +# _cfg = yaml.load(f, Loader=yaml.FullLoader) +# +# _TRENV = tuple() +# _last_auth_time = datetime.now() +# _autoReAuth = False +# _DEBUG = False +# _isPaper = False +# +# 기본 헤더값 정의 +# _base_headers = { +# "Content-Type": "application/json", +# "Accept": "text/plain", +# "charset": "UTF-8", +# 'User-Agent': _cfg['my_agent'] +# } +###################################################################################################### + +#홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 +#모의투자 +#my_app: "앱키" +#my_sec: "앱시크리트" +#실전투자 +my_app: "앱키" +my_sec: "앱시크리트" + + +#계좌번호 앞 8자리 +my_acct: "계좌번호 8자리" +my_acct_stock: "증권계좌 8자리" +my_acct_future: "선물옵션계좌 8자리" +#계좌번호 뒤 2자리 +my_prod: "01" +#my_prod: "03" + +#실전투자 +prod: "https://openapi.koreainvestment.com:9443" +#모의투자 +vps: "https://openapivts.koreainvestment.com:29443" + +#디스코드 웹훅 URL +DISCORD_WEBHOOK_URL: "" + +my_agent : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" diff --git a/한국투자증권(API)/legacy/Sample01/kis_domfuopt.py b/한국투자증권(API)/legacy/Sample01/kis_domfuopt.py new file mode 100644 index 0000000..faf03f9 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_domfuopt.py @@ -0,0 +1,366 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" +import kis_auth as kis + +import time, copy +import requests +import json + +import pandas as pd + +from collections import namedtuple +from datetime import datetime +from pandas import DataFrame + +#====| [국내선물옵션] 주문/계좌 |=========================================================================================================================== + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 주문[v1_국내선물-001] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_domfuopt_order(dv_cd="02", sll_buy_dvsn_cd="", dvsn_cd="01", itm_no="", qty=0, unpr=0, tr_cont="", FK100="", NK100="", dataframe=None): # [국내선물옵션] 주문/계좌 > 선물옵션 주문 + url = '/uapi/domestic-futureoption/v1/trading/order' + + if dv_cd == "01": + tr_id = "TTTO1101U" # 선물 옵션 매수 매도 주문 주간 [모의투자] VTTO1101U : 선물 옵션 매수 매도 주문 주간 + elif dv_cd == "02": + tr_id = "JTCE1001U" # 선물 옵션 매수 매도 주문 야간 [모의투자] VTCE1001U : 선물 옵션 매수 매도 주문 야간 + else: + print("선물옵션매수매도주문주간/선물옵션매수매도주문야간 구분 확인요망!!!") + return None + + if sll_buy_dvsn_cd == "": + print("매도매수구분코드 확인요망!!!") + return None + + if itm_no == "": + print("주문종목번호 확인요망!!!") + return None + + if qty == 0: + print("주문수량 확인요망!!!") + return None + + #if unpr == 0: + # print("주문단가 확인요망!!!") + # return None + + params = { + "ORD_PRCS_DVSN_CD": "02", # 주문처리구분코드 02 : 주문전송 + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매수매도구분코드 + "SHTN_PDNO": itm_no, # 종목코드(단축상품번호 6자리) 선물 6자리 (예: 101S03) 옵션 9자리 (예: 201S03370) + "ORD_QTY": str(int(qty)), # 주문수량 + "UNIT_PRICE": str(int(unpr)), # 주문가격 + "NMPR_TYPE_CD": "", # 호가유형코드 ※ ORD_DVSN_CD(주문구분코드)를 입력한 경우 ""(공란)으로 입력해도 됨 + "KRX_NMPR_CNDT_CD": "", # 한국거래소호가조건코드 ※ ORD_DVSN_CD(주문구분코드)를 입력한 경우 ""(공란)으로 입력해도 됨 + "CTAC_TLNO": "", # 연락전화번호 + "FUOP_ITEM_DVSN_CD": "", # 선물옵션종목구분코드 + "ORD_DVSN_CD": dvsn_cd # 주문구분코드 01 : 지정가 02 : 시장가 03 : 조건부 04 : 최유리 10 : 지정가(IOC) ..... + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + dataframe = None + + return dataframe + + +############################################################################################## +# [국내선물옵션] 주문/계좌 > 선물옵션 정정취소주문[v1_국내선물-002] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_domfuopt_order_rvsecncl(dv_cd="01", rvse_cncl_dvsn_cd="", orgn_odno="", ord_dvsn="01", ord_qty=0, + ord_unpr=0, rmn_qty_yn="", tr_cont="", dataframe=None): # [국내선물옵션] 선물옵션 정정취소주문[v1_국내선물-002] + url = '/uapi/domestic-futureoption/v1/trading/order-rvsecncl' + + if dv_cd == "01": + tr_id = "TTTO1103U" # 선물 옵션 정정 취소 주문 주간 [모의투자] VTTO1103U : 선물 옵션 정정 취소 주문 주간 + elif dv_cd == "02": + tr_id = "JTCE1002U" # 선물 옵션 정정 취소 주문 야간 [모의투자] VTCE1002U : 선물 옵션 정정 취소 주문 야간 + else: + print("선물옵션정정취소주문주간/선물옵션정정취소주문야간 구분 확인요망!!!") + return None + + if not rvse_cncl_dvsn_cd in ["01","02"]: + print("정정취소구분코드 확인요망!!!") # 정정:01. 취소:02 + return None + + if orgn_odno == "": + print("원주문번호 확인요망!!!") + return None + + if ord_dvsn == "": + print("주문구분 확인요망!!!") + return None + + if rmn_qty_yn == "Y" and ord_qty > 0: + print("잔량전부 취소/정정주문인 경우 주문수량 0 처리!!!") + ord_qty = 0 + + if rmn_qty_yn == "N" and ord_qty == 0: + print("취소/정정 수량 확인요망!!!") + return None + + if rvse_cncl_dvsn_cd == "01" and ord_unpr == 0: + print("주문단가 확인요망!!!") + return None + + params = { + "ORD_PRCS_DVSN_CD": "02", # 주문처리구분코드 02 : 주문전송 + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, # 정정취소구분코드 01 : 정정 02 : 취소 + "ORGN_ODNO": orgn_odno, # 원주문번호 정정 혹은 취소할 주문의 번호 + "ORD_QTY": str(int(ord_qty)), # 주문수량 전량일 경우 0으로 입력, 일부수량 정정 및 취소 불가, 주문수량 반드시 입력 (공백 불가) 일부 미체결 시 잔량 전체에 대해서 취소 가능 + "UNIT_PRICE": str(int(ord_unpr)), # 주문가격 시장가나 최유리의 경우 0으로 입력 (취소 시에도 0 입력) + "NMPR_TYPE_CD": "", # 호가유형코드 ※ ORD_DVSN_CD(주문구분코드)를 입력한 경우 ""(공란)으로 입력해도 됨 + "KRX_NMPR_CNDT_CD": "", # 한국거래소호가조건코드 ※ ORD_DVSN_CD(주문구분코드)를 입력한 경우 ""(공란)으로 입력해도 됨 + "RMN_QTY_YN": rmn_qty_yn, # 잔여수량여부 Y : 전량 N : 일부 + "FUOP_ITEM_DVSN_CD": "", # 선물옵션종목구분코드 (주간) 공란 (야간) 01:선물 02:콜옵션 03:풋옵션 04:스프레드 + "ORD_DVSN_CD": ord_dvsn # 주문구분코드 (취소) 01, (정정) 01 : 지정가 02 : 시장가 03 : 조건부 04 : 최유리 10 : 지정가(IOC) ..... + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] +############################################################################################## + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# (JTCE5005R) +# Output: DataFrame (Option) output2 API 문서 참조 등 +def get_domfuopt_inquire_ngt_ccnl_obj(inqr_strt_dt=None, inqr_end_dt=None, sll_buy_dvsn_cd="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl' + tr_id = "JTCE5005R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "STRT_ORD_DT": inqr_strt_dt, # 시작주문일자 + "END_ORD_DT": inqr_end_dt, # 종료주문일자 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 00:전체 01:매도, 02:매수 + "CCLD_NCCS_DVSN": "01", # 체결미체결구분 + "SORT_SQN": "", # 정렬순서 DS : 정순, 그외 : 역순 + "STRT_ODNO": "", # 시작주문번호 00:전체, 01:체결, 02:미체결 + "PDNO": "", # 상품번호 (종목번호) + "MKET_ID_CD": "", # 시장ID코드 + "FUOP_DVSN_CD": "", # 선물옵션구분코드 공란 : 전체, 01 : 선물, 02 : 옵션 + "SCRN_DVSN": "02", # 화면구분 02 default + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) + if res.isOK(): + # API 응답의 output 속성이 스칼라 값인지 확인 + output_data = res.getBody().output2 + if not isinstance(output_data, list): + # 스칼라 값이면 리스트로 감싸서 반환 + output_data = [output_data] + + # DataFrame 생성 시 index 매개변수를 추가하여 스칼라 값일 경우 처리 + current_data = pd.DataFrame(output_data, index=[0]) + + return current_data + + else: + res.printError() + return pd.DataFrame() + + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문체결 내역조회 [국내선물-009] List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# (JTCE5005R) +# Output: DataFrame (Option) output1 API 문서 참조 등 +def get_domfuopt_inquire_ngt_ccnl_lst(inqr_strt_dt=None, inqr_end_dt=None, sll_buy_dvsn_cd="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl' + tr_id = "JTCE5005R" + + if inqr_strt_dt == "": + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt == "": + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "STRT_ORD_DT": inqr_strt_dt, # 시작주문일자 + "END_ORD_DT": inqr_end_dt, # 종료주문일자 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 00:전체 01:매도, 02:매수 + "CCLD_NCCS_DVSN": "00", # 체결미체결구분 + "SORT_SQN": "DS", # 정렬순서 DS : 정순, 그외 : 역순 + "STRT_ODNO": "", # 시작주문번호 00:전체, 01:체결, 02:미체결 + "PDNO": "", # 상품번호 (종목번호) + "MKET_ID_CD": "", # 시장ID코드 + "FUOP_DVSN_CD": "", # 선물옵션구분코드 공란 : 전체, 01 : 선물, 02 : 옵션 + "SCRN_DVSN": "02", # 화면구분 02 default + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(dv, tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + tr_cont = "N" # 다음조회 + return get_domfuopt_inquire_ngt_ccnl_lst(inqr_strt_dt, inqr_end_dt, sll_buy_dvsn_cd, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 [국내선물-010] +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - +def get_domfuopt_inquire_ngt_balance_obj(tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance' + tr_id = "JTCE6001R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "MGNA_DVSN": "01", # 증거금구분 01 : 개시, 02 : 유지 + "EXCC_STAT_CD": "1", # 정산상태코드 1 : 정산 (정산가격으로 잔고 조회) 2 : 본정산 (매입가격으로 잔고 조회) + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) + if res.isOK(): + # API 응답의 output 속성이 스칼라 값인지 확인 + output_data = res.getBody().output2 + if not isinstance(output_data, list): + # 스칼라 값이면 리스트로 감싸서 반환 + output_data = [output_data] + + # DataFrame 생성 시 index 매개변수를 추가하여 스칼라 값일 경우 처리 + current_data = pd.DataFrame(output_data, index=[0]) + + return current_data + + else: + res.printError() + return pd.DataFrame() + + +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 잔고현황 종목별 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 종목번호, 상품명(종목명), 매매구분명(매수매도구분), 전일매수수량 ... 등 +def get_domfuopt_inquire_ngt_balance_lst(tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식잔고조회(현재종목별 잔고) + url = '/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance' + tr_id = "JTCE6001R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "MGNA_DVSN": "01", # 증거금구분 01 : 개시, 02 : 유지 + "EXCC_STAT_CD": "1", # 정산상태코드 1 : 정산 (정산가격으로 잔고 조회) 2 : 본정산 (매입가격으로 잔고 조회) + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + print(res.getBody()) + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_domfuopt_inquire_ngt_balance_lst("N", FK100, NK100, dataframe) + + +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] +############################################################################################## +# [국내선물옵션] 주문/계좌 > (야간)선물옵션 주문가능 조회 [국내선물-011] List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - +def get_domfuopt_inquire_psbl_ngt_order(pdno="", sll_buy_dvsn_cd="", ord_unpr=0, ord_dvsn="01", tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 매수가능조회 + url = '/uapi/domestic-futureoption/v1/trading/inquire-psbl-ngt-order' + tr_id = "JTCE1004R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": pdno, # 상품번호 + "PRDT_TYPE_CD": "301", # 상품유형코드 301 : 선물옵션 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 01 : 매도 , 02 : 매수 + "UNIT_PRICE": ord_unpr, # 주문가격 + "ORD_DVSN_CD": ord_dvsn # 주문구분코드 01 : 지정가 02 : 시장가 03 : 조건부 04 : 최유리 10 : 지정가(IOC) ..... + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + print(res.getBody()) + if res.isOK(): + # API 응답의 output 속성이 스칼라 값인지 확인 + output_data = res.getBody().output + if not isinstance(output_data, list): + # 스칼라 값이면 리스트로 감싸서 반환 + output_data = [output_data] + + # DataFrame 생성 시 index 매개변수를 추가하여 스칼라 값일 경우 처리 + current_data = pd.DataFrame(output_data, index=[0]) + + return current_data + + else: + res.printError() + return pd.DataFrame() diff --git a/한국투자증권(API)/legacy/Sample01/kis_domstk.py b/한국투자증권(API)/legacy/Sample01/kis_domstk.py new file mode 100644 index 0000000..0090f06 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_domstk.py @@ -0,0 +1,1357 @@ + +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" +import kis_auth as kis + +import time, copy +import requests +import json + +import pandas as pd + +from collections import namedtuple +from datetime import datetime +from pandas import DataFrame + +#====| [국내주식] 주문/계좌 |=========================================================================================================================== + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(현금)[v1_국내주식-001] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_order_cash(ord_dv="", itm_no="", qty=0, unpr=0, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식주문(현금) + url = '/uapi/domestic-stock/v1/trading/order-cash' + + if ord_dv == "buy": + tr_id = "TTTC0802U" # 주식 현금 매수 주문 [모의투자] VTTC0802U : 주식 현금 매수 주문 + elif ord_dv == "sell": + tr_id = "TTTC0801U" # 주식 현금 매도 주문 [모의투자] VTTC0801U : 주식 현금 매도 주문 + else: + print("매수현금/매도현금 구분 확인요망!!!") + return None + + if itm_no == "": + print("주문종목번호 확인요망!!!") + return None + + if qty == 0: + print("주문수량 확인요망!!!") + return None + + if unpr == 0: + print("주문단가 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": itm_no, # 종목코드(6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "ORD_DVSN": "00", # 주문구분 00:지정가, 01:시장가, 02:조건부지정가 나머지주문구분 API 문서 참조 + "ORD_QTY": str(int(qty)), # 주문주식수 + "ORD_UNPR": str(int(unpr)) # 주문단가 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식주문(정정취소)[v1_국내주식-003] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_order_rvsecncl(ord_orgno="", orgn_odno="", ord_dvsn="", rvse_cncl_dvsn_cd="", ord_qty=0, ord_unpr=0, qty_all_ord_yn="", tr_cont="", dataframe=None): # 국내주식주문 > 주식주문(정정취소) + url = '/uapi/domestic-stock/v1/trading/order-rvsecncl' + tr_id = "TTTC0803U" # 주식 정정 취소 주문 [모의투자] VTTC0803U : 주식 정정 취소 주문 + + if ord_orgno == "": + print("주문조직번호 확인요망!!!") + return None + + if orgn_odno == "": + print("원주문번호 확인요망!!!") + return None + + if ord_dvsn == "": + print("주문구분 확인요망!!!") + return None + + if not rvse_cncl_dvsn_cd in ["01","02"]: + print("정정취소구분코드 확인요망!!!") # 정정:01. 취소:02 + return None + + if qty_all_ord_yn == "Y" and ord_qty > 0: + print("잔량전부 취소/정정주문인 경우 주문수량 0 처리!!!") + ord_qty = 0 + + if qty_all_ord_yn == "N" and ord_qty == 0: + print("취소/정정 수량 확인요망!!!") + return None + + if rvse_cncl_dvsn_cd == "01" and ord_unpr == 0: + print("주문단가 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "KRX_FWDG_ORD_ORGNO": ord_orgno, # 주문조직번호 API output의 odno(주문번호) 값 입력주문시 한국투자증권 시스템에서 채번된 주문조직번호 + "ORGN_ODNO": orgn_odno, # 주식일별주문체결조회 API output의 odno(주문번호) 값 입력주문시 한국투자증권 시스템에서 채번된 주문번호 + "ORD_DVSN": ord_dvsn, # 주문구분 00:지정가, 01:시장가, 02:조건부지정가 나머지주문구분 API 문서 참조 + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, # 정정 : 01, 취소 : 02 + "ORD_QTY": str(int(ord_qty)), # 주문주식수 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + "ORD_UNPR": str(int(ord_unpr)), # 주문단가 [정정] 정정주문 1주당 가격 [취소] "0" 설정 + "QTY_ALL_ORD_YN": qty_all_ord_yn # 잔량전부주문여부 [정정/취소] Y : 잔량전부, N : 잔량일부 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식정정취소가능주문조회[v1_국내주식-004] +############################################################################################## + +# 국내주식주문 > 주식정정취소가능주문조회 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_inquire_psbl_rvsecncl_lst(tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식정정취소가능주문조회 + url = '/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl' + tr_id = "TTTC8036R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_DVSN_1": "1", # 조회구분1(정렬순서) 0:조회순서, 1:주문순, 2:종목순 + "INQR_DVSN_2": "0", # 조회구분2 0:전체, 1:매도, 2:매수 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output2' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_psbl_rvsecncl_lst("N", FK100, NK100, dataframe) + + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식일별주문체결조회 +############################################################################################## + +# 국내주식주문 > 주식일별주문체결조회 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# dv 기간구분 - 01:3개월 이내(TTTC8001R), 02:3개월 이전(CTSC9115R) +# Output: DataFrame (Option) output2 API 문서 참조 등 +def get_inquire_daily_ccld_obj(dv="01", inqr_strt_dt=None, inqr_end_dt=None, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식일별주문체결조회 + url = '/uapi/domestic-stock/v1/trading/inquire-daily-ccld' + + if dv == "01": + tr_id = "TTTC8001R" # 01:3개월 이내 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월~04월조회) + else: + tr_id = "CTSC9115R" # 02:3개월 이전 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월이전) + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "SLL_BUY_DVSN_CD": "00", # 매도매수구분코드 00:전체 01:매도, 02:매수 + "INQR_DVSN": "01", # 조회구분(정렬순서) 00:역순, 01:정순 + "PDNO": "", # 종목번호(6자리) + "CCLD_DVSN": "00", # 체결구분 00:전체, 01:체결, 02:미체결 + "ORD_GNO_BRNO": "", # 사용안함 + "ODNO": "", # 주문번호 + "INQR_DVSN_3": "00", # 조회구분3 00:전체, 01:현금, 02:융자, 03:대출, 04:대주 + "INQR_DVSN_1": "0", # 조회구분1 공란 : 전체, 1 : ELW, 2 : 프리보드 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2, index=[0]) + + dataframe = current_data + + return dataframe + + +# 주식일별주문체결조회 종목별 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# dv 기간구분 - 01:3개월 이내(TTTC8001R), 02:3개월 이전(CTSC9115R) +# Output: DataFrame (Option) output1 API 문서 참조 등 +def get_inquire_daily_ccld_lst(dv="01", inqr_strt_dt="", inqr_end_dt="", tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식일별주문체결조회 + url = '/uapi/domestic-stock/v1/trading/inquire-daily-ccld' + + if dv == "01": + tr_id = "TTTC8001R" # 01:3개월 이내 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월~04월조회) + else: + tr_id = "CTSC9115R" # 02:3개월 이전 국내주식체결내역 (월단위 ex: 2024.04.25 이면 2024.01월이전) + + if inqr_strt_dt == "": + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt == "": + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "SLL_BUY_DVSN_CD": "00", # 매도매수구분코드 00:전체 01:매도, 02:매수 + "INQR_DVSN": "01", # 조회구분(정렬순서) 00:역순, 01:정순 + "PDNO": "", # 종목번호(6자리) + "CCLD_DVSN": "00", #체결구분 00:전체, 01:체결, 02:미체결 + "ORD_GNO_BRNO": "", # 사용안함 + "ODNO": "", #주문번호 + "INQR_DVSN_3": "00", # 조회구분3 00:전체, 01:현금, 02:융자, 03:대출, 04:대주 + "INQR_DVSN_1": "", # 조회구분1 공란 : 전체, 1 : ELW, 2 : 프리보드 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(dv, tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_daily_ccld_lst(dv, inqr_strt_dt, inqr_end_dt, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회(현재잔고) +############################################################################################## + + +# 주식계좌잔고 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 예수금총금액, 익일정산금액, 가수도정산금액, 전일매수금액, 금일매수금액, 총평가금액... 등 +def get_inquire_balance_obj(tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식잔고조회(현재잔고) + url = '/uapi/domestic-stock/v1/trading/inquire-balance' + tr_id = "TTTC8434R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "AFHR_FLPR_YN": "N", # 시간외단일가여부 Y:시간외단일가 + "OFL_YN": "", #오프라인여부 사용안함 + "INQR_DVSN": "00", # 00 : 전체 + "UNPR_DVSN": "01", # 단가구분 01:기본값 + "FUND_STTL_ICLD_YN": "N", # 펀드결제분포함여부 N:포함하지않음 + "FNCG_AMT_AUTO_RDPT_YN": "N", + "PRCS_DVSN": "00", # 00 : 전일매매포함, 01 : 전일매매미포함 + #"COST_ICLD_YN": "N", + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +# 주식계좌잔고 종목별 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 종목번호, 상품명(종목명), 매매구분명(매수매도구분), 전일매수수량 ... 등 +def get_inquire_balance_lst(tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식잔고조회(현재종목별 잔고) + url = '/uapi/domestic-stock/v1/trading/inquire-balance' + tr_id = "TTTC8434R" + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "AFHR_FLPR_YN": "N", # 시간외단일가여부 Y:시간외단일가 + "OFL_YN": "", #오프라인여부 사용안함 + "INQR_DVSN": "00", # 00 : 전체 + "UNPR_DVSN": "01", # 단가구분 01:기본값 + "FUND_STTL_ICLD_YN": "N", # 펀드결제분포함여부 N:포함하지않음 + "FNCG_AMT_AUTO_RDPT_YN": "N", + "PRCS_DVSN": "00", # 00 : 전일매매포함, 01 : 전일매매미포함 + #"COST_ICLD_YN": "N", + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_balance_lst("N", FK100, NK100, dataframe) + +############################################################################################## +# [국내주식] 주문/계좌 > 매수가능조회 +############################################################################################## +# 국내주식주문 > 매수가능조회[v1_국내주식-007] List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - +def get_inquire_psbl_order(pdno="", ord_unpr=0, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 매수가능조회 + url = '/uapi/domestic-stock/v1/trading/inquire-psbl-order' + tr_id = "TTTC8908R" + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": pdno, # 상품번호 + "ORD_UNPR": ord_unpr, # 주문단가 1주당 가격 ※ 시장가(ORD_DVSN:01)로 조회 시, 공란으로 입력 + "ORD_DVSN": "00", # 주문구분 공란 시, 매수수량 없이 매수금액만 조회됨 00 : 지정가,01 : 시장가,02 : 조건부지정가,03 : 최유리지정가 + "CMA_EVLU_AMT_ICLD_YN": "N", # CMA평가금액포함여부 Y : 포함, N : 포함하지 않음 + "OVRS_ICLD_YN": "Y" # 해외포함여부 Y : 포함, N : 포함하지 않음 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # print(res.getBody()) + if res.isOK(): + # API 응답의 output 속성이 스칼라 값인지 확인 + output_data = res.getBody().output + if not isinstance(output_data, list): + # 스칼라 값이면 리스트로 감싸서 반환 + output_data = [output_data] + + # DataFrame 생성 시 index 매개변수를 추가하여 스칼라 값일 경우 처리 + # tdf = pd.DataFrame(output_data, index=[0]) + #cf1 = ['ord_psbl_cash', 'ruse_psbl_amt', 'fund_rpch_chgs', 'psbl_qty_calc_unpr', 'nrcvb_buy_amt', 'nrcvb_buy_qty', 'max_buy_amt', 'max_buy_qty', 'cma_evlu_amt', 'ovrs_re_use_amt_wcrc', 'ord_psbl_frcr_amt_wcrc'] + #cf2 = ['주문가능현금', '주문가능대용', '재사용가능금액', '펀드환매대금', '가능수량계산단가', '미수없는매수금액', '미수없는매수수량', '최대매수금액', '최대매수수량', 'CMA평가금액', '해외재사용금액원화', '주문가능외화금액원화'] + #tdf = tdf[cf1] + #ren_dict = dict(zip(cf1, cf2)) + # return tdf.rename(columns=ren_dict) + + # DataFrame 생성 시 index 매개변수를 추가하여 스칼라 값일 경우 처리 + current_data = pd.DataFrame(output_data, index=[0]) + + return current_data + + else: + res.printError() + return pd.DataFrame() + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문[v1_국내주식-017] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_order_resv(ord_dv="", itm_no="", qty=0, unpr=0, ord_dvsn_cd="", tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식주문(현금) + url = '/uapi/domestic-stock/v1/trading/order-resv' + tr_id = "CTSC0008U" # 국내예약매수입력, 주문예약매도입력 + + if ord_dv == "buy": + sll_buy_dvsn_cd = "02" # 주식 예약 매수 주문 + elif ord_dv == "sell": + sll_buy_dvsn_cd = "01" # 주식 예약 매도 주문 + else: + print("매도매수구분코드 확인요망!!!") + return None + + if itm_no == "": + print("주문종목번호 확인요망!!!") + return None + + if qty == 0: + print("주문수량 확인요망!!!") + return None + + if unpr == 0: + print("주문단가 확인요망!!!") + return None + + if ord_dvsn_cd == "": + print("주문구분코드 확인요망!!!") + return None + + if unpr == 0: + print("주문단가 확인요망!!!") + return None + + ord_objt_cbcl_dvsn_cd = "10" # [매도매수구분코드 01:매도/02:매수시 사용] 10 : 현금 이 아닌경우는 API문서 참조 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": itm_no, # 종목코드(6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "ORD_QTY": str(int(qty)), # 주문주식수 + "ORD_UNPR": str(int(unpr)), # 주문단가 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 01 : 매도, 02 : 매수 + "ORD_DVSN_CD": "00", # 주문구분 00:지정가, 01:시장가, 02:조건부지정가, 05 : 장전 시간외 + "ORD_OBJT_CBLC_DVSN_CD": ord_objt_cbcl_dvsn_cd, # [매도매수구분코드 01:매도/02:매수시 사용] 10 : 현금 + # [매도매수구분코드 01:매도시 사용] 12:주식담보대출, 14:대여상환, 21:자기융자신규, 22:유통대주신규, 23:유통융자신규, + # 24:자기대주신규, 25:자기융자상환, 26:유통대주상환, 27:유통융자상환, 28:자기대주상환 + "RSVN_ORD_END_DT": "" # 예약주문종료일자 * (YYYYMMDD) 현재 일자보다 이후로 설정해야 함 + # * RSVN_ORD_END_DT(예약주문종료일자)를 안 넣으면 다음날 주문처리되고 예약주문은 종료됨 + # * RSVN_ORD_END_DT(예약주문종료일자)는 익영업일부터 달력일 기준으로 공휴일 포함하여 최대 30일이 되는 일자까지 입력 가능 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = res.getBody().output # getBody() kis_auth.py 존재 + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문취소[v1_국내주식-018,019] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_order_resv_cncl(rsvn_ord_seq="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 주식예약주문취소 + url = '/uapi/domestic-stock/v1/trading/order-resv-rvsecncl' + tr_id = "CTSC0009U" # 국내주식예약 취소주문 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "RSVN_ORD_SEQ": str(int(rsvn_ord_seq)) # 예약주문순번 [정정/취소] + } + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = res.getBody().output # getBody() kis_auth.py 존재 + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문정정[v1_국내주식-018,019] +# get_order_resv_rvse(rsvn_ord_seq="", pdno="", ord_qty=0, ord_unpr=0, ord_dvsn="", sll_buy_dvsn_cd=""): # 국내주식주문 > 주식예약주문정정취소 +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_order_resv_rvse(pdno="", ord_qty=0, ord_unpr=0, sll_buy_dvsn_cd="", ord_dvsn="", ord_objt_cblc_dvsn_cd="", + rsvn_ord_seq="", rsvn_ord_orgno="", rsvn_ord_ord_dt="", tr_cont="", FK100="", NK100="", dataframe=None ): # 국내주식주문 > 주식예약주문정정취소 + url = '/uapi/domestic-stock/v1/trading/order-resv-rvsecncl' + tr_id = "CTSC0013U" # 국내주식예약정정주문 * 모의투자 사용 불가 + + if ord_qty == 0: + print("주문주식수 확인요망!!!") # + return None + + if ord_unpr == 0: + print("주문단가 확인요망!!!") # 정정] 1주당 가격 * 장전 시간외, 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 권고 + return None + + if sll_buy_dvsn_cd == "": + print("매수매도구분코드 확인요망!!!") # [정정] 01 : 매도 02 : 매수 + return None + + if ord_dvsn == "": + print("주문구분코드 확인요망!!!") # [정정] 00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외 + return None + + ord_objt_cblc_dvsn_cd = "10" # 주문대상잔고구분코드 기본값 10 : 현금으로 셋팅 + #if ord_objt_cblc_dvsn_cd == "": + # print("주문대상잔고구분코드!!!") # 10 : 현금, 12 : 주식담보대출, 14 : 대여상환, 21 : 자기융자신규 + # return None + + if rsvn_ord_seq == "": + print("예약주문번호 확인요망(rsvn_ord_seq)!!!") + return None + + print(rsvn_ord_seq) + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": pdno, # 종목코드(6자리) + "ORD_QTY": str(int(ord_qty)), # 주문주식수 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + "ORD_UNPR": str(int(ord_unpr)), # 주문단가 [정정] 1주당 가격 * 장전 시간외, 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 권고 + "SLL_BUY_DVSN_CD": sll_buy_dvsn_cd, # 매도매수구분코드 [정정] 01 : 매도, 02 : 매수 + "ORD_DVSN_CD": ord_dvsn, # 주문구분 [정정]00 : 지정가, 01 : 시장가, 02 : 조건부지정가, 05 : 장전 시간외 + "ORD_OBJT_CBLC_DVSN_CD": ord_objt_cblc_dvsn_cd, # 주문대상잔고구분코드 [정정]10 : 현금, 12 : 주식담보대출, 14 : 대여상환, 21 : 자기융자신규 나머지는 API문서 참조 + "LOAN_DT": "", # 대출일자 [정정] 입력필수아님 + "RSVN_ORD_END_DT": "", # 예약주문종료일자 [정정] 입력필수아님 + "CTAL_TLNO": "", # 연락전화번호 [정정] 입력필수아님 + "RSVN_ORD_SEQ": str(int(rsvn_ord_seq)), # 예약주문순번 [정정/취소] 입력필수 + "RSVN_ORD_ORGNO": "", # 예약주문조직번호 [정정/취소] 입력불필요 + "RSVN_ORD_ORD_DT": "" # 예약주문주문일자 [정정/취소] 입력불필요 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = res.getBody().output # getBody() kis_auth.py 존재 + print(res.getBody().msg_cd + "," + res.getBody().msg1) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] +############################################################################################## +# [국내주식] 주문/계좌 > 주식예약주문조회[v1_국내주식-020] List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - +def get_order_resv_ccnl(inqr_strt_dt=None, inqr_end_dt=None, ord_seq=0, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 매수가능조회 + url = '/uapi/domestic-stock/v1/trading/order-resv-ccnl' + tr_id = "CTSC0004R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "RSVN_ORD_ORD_DT": inqr_strt_dt, # 예약주문시작일자 + "RSVN_ORD_END_DT": inqr_end_dt, # 예약주문종료일자 + "RSVN_ORD_SEQ": ord_seq, # 예약주문순번 + "TMNL_MDIA_KIND_CD": "00", # 단말매체종류코드 + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PRCS_DVSN_CD": "0", # 처리구분코드 + "CNCL_YN": "", # 오프라인여부 사용안함 + "PDNO": "", # 종목코드(6자리) (공백 입력 시 전체 조회) + "SLL_BUY_DVSN_CD": "", # 매도매수구분코드 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_order_resv_ccnl(inqr_strt_dt, inqr_end_dt, ord_seq, "N", FK100, NK100, dataframe) + +############################################################################################## +# [국내주식] 주문/계좌 > 주식잔고조회_실현손익 +############################################################################################## +# 주식잔고조회_실현손익 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 종목번호(상품번호), 종목명(상품명), 매매구분명, 전일매수수량, 전일매도수량, 금일매수수량... 등 +def get_inquire_balance_rlz_pl_obj(tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 주식잔고조회_실현손익 (잔고조회 Output2) + url = '/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl' + tr_id = "TTTC8494R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "AFHR_FLPR_YN": "N", # 시간외단일가여부 Y:시간외단일가 + "OFL_YN": "", # 오프라인여부 사용안함 + "INQR_DVSN": "00", # 00 : 전체 + "UNPR_DVSN": "01", # 단가구분 01:기본값 + "FUND_STTL_ICLD_YN": "N", # 펀드결제분포함여부 N:포함하지않음 + "FNCG_AMT_AUTO_RDPT_YN": "N", + "PRCS_DVSN": "00", # 00 : 전일매매포함, 01 : 전일매매미포함 + "COST_ICLD_YN": "N", + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'Output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +# 주식잔고조회_실현손익 list DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 예수금총금액, 익일정산금액, 가수도정산금액, CMA평가금액, 전일매수금액, 금일매수금액 ... 등 +def get_inquire_balance_rlz_pl_lst(tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 주식잔고조회_실현손익 (보유주식내역 Output2) + url = '/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl' + tr_id = "TTTC8494R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "AFHR_FLPR_YN": "N", # 시간외단일가여부 Y:시간외단일가 + "OFL_YN": "", # 오프라인여부 사용안함 + "INQR_DVSN": "00", # 00 : 전체 + "UNPR_DVSN": "01", # 단가구분 01:기본값 + "FUND_STTL_ICLD_YN": "N", # 펀드결제분포함여부 N:포함하지않음 + "FNCG_AMT_AUTO_RDPT_YN": "N", + "PRCS_DVSN": "00", # 00 : 전일매매포함, 01 : 전일매매미포함 + "COST_ICLD_YN": "N", + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_balance_rlz_pl_lst("N", FK100, NK100, dataframe) + + +############################################################################################## +# [국내주식] 주문/계좌 > 신용매수가능조회 +############################################################################################## +# 신용매수가능조회 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output1 - 주문가능현금, 주문가능대용, 재사용가능금액, 펀드환매대금, 가능수량계산단가, 미수없는매수금액... 등 +def get_inquire_credit_psamount(pdno="", ord_unpr ="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 신용매수가능조회 + url = '/uapi/domestic-stock/v1/trading/inquire-credit-psamount' + tr_id = "TTTC8909R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": pdno, # 종목번호(상품번호) + "ORD_UNPR": "", # 주문단가 1주당 가격 * 장전 시간외, 장후 시간외, 시장가의 경우 1주당 가격을 공란으로 비우지 않음 "0"으로 입력 권고 + "ORD_DVSN": "00", # 주문구분 00: 지정가 + "CRDT_TYPE": "21", # 신용유형 "":기본값 + "CMA_EVLU_AMT_ICLD_YN": "N", # CMA평가금액포함여부 + "OVRS_ICLD_YN": "N" # 펀드결제분포함여부 N:포함하지않음 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'Output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별매매손익현황조회 +############################################################################################## +# 기간별매매손익현황조회 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 매도수량합계, 매도거래금액합계, 매도수수료합계, 매도제세금합계, 매도정산금액합계, 매수수량합계... 등 +def get_inquire_period_trade_profit_obj(inqr_strt_dt=None, inqr_end_dt=None, tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 기간별매매손익현황내역 (output2) + url = '/uapi/domestic-stock/v1/trading/inquire-period-trade-profit' + tr_id = "TTTC8715R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "SORT_DVSN": "00", # 정렬구분 + "PDNO": "", # 상품번호 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": "00", # 잔고구분 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody().output2) # 오류 원인 확인 필요시 사용 + # Assuming 'Output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2, index=[0]) # getBody() kis_auth.py 존재 + dataframe = current_data + return dataframe + +# 기간별매매손익현황조회 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output1 - 매매일자, 상품번호, 상품명, 매매구분명, 대출일자, 보유수량... 등 +def get_inquire_period_trade_profit_lst(inqr_strt_dt=None, inqr_end_dt=None, tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 기간별매매손익현황조회 (output1) + url = '/uapi/domestic-stock/v1/trading/inquire-period-trade-profit' + tr_id = "TTTC8715R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "SORT_DVSN": "00", # 정렬구분 + "PDNO": "", # 상품번호 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": "00", # 잔고구분 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_period_trade_profit_lst(inqr_strt_dt, inqr_end_dt, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [국내주식] 주문/계좌 > 기간별손익일별합산조회 +############################################################################################## +# 기간별매매손익현황조회 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output2 - 매도수량합계, 매도거래금액합계, 매도수수료합계, 매도제세금합계, 매도정산금액합계, 매수수량합계... 등 +def get_inquire_period_profit_obj(inqr_strt_dt=None, inqr_end_dt=None, tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 기간별손익일별합산조회 (output2) + url = '/uapi/domestic-stock/v1/trading/inquire-period-profit' + tr_id = "TTTC8708R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_DVSN": "00", # 조회구분 + "SORT_DVSN": "00", # 정렬구분 + "PDNO": "", # 상품번호 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": "00", # 잔고구분 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody().output2) # 오류 원인 확인 필요시 사용 + # Assuming 'Output2' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2, index=[0]) # getBody() kis_auth.py 존재 + dataframe = current_data + return dataframe + +# 기간별손익일별합산조회 object DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output1 - 매매일자, 상품번호, 상품명, 매매구분명, 대출일자, 보유수량... 등 +def get_inquire_period_profit_lst(inqr_strt_dt=None, inqr_end_dt=None, tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 주문/계좌 > 기간별손익일별합산조회 (output1) + url = '/uapi/domestic-stock/v1/trading/inquire-period-profit' + tr_id = "TTTC8708R" + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_DVSN": "00", # 조회구분 + "SORT_DVSN": "00", # 정렬구분 + "PDNO": "", # 상품번호 + "INQR_STRT_DT": inqr_strt_dt, # 조회시작일자 + "INQR_END_DT": inqr_end_dt, # 조회종료일자 + "CBLC_DVSN": "00", # 잔고구분 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출, kis_auth.py에 존재 + + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_inquire_period_profit_lst(inqr_strt_dt, inqr_end_dt, "N", FK100, NK100, dataframe) + +#====| [국내주식] 기본시세 |============================================================================================================================ + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세 +############################################################################################## +# 주식현재가 시세 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_price(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 시세 + url = '/uapi/domestic-stock/v1/quotations/inquire-price' + tr_id = "FHKST01010100" # 주식현재가 시세 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 체결 (최근체결 건 30건만 조회) +############################################################################################## +# 주식현재가 체결 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_ccnl(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 체결 + url = '/uapi/domestic-stock/v1/quotations/inquire-ccnl' + tr_id = "FHKST01010300" # 주식현재가 체결 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 일자별 (최근 30일만 조회) +# 주식현재가 일자별 API입니다. 일/주/월별 주가를 확인할 수 있으며 최근 30일(주,별)로 제한되어 있습니다. +############################################################################################## +# 주식현재가 일자별 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_daily_price(div_code="J", itm_no="", period_code="D", adj_prc_code="1", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 일자별 + url = '/uapi/domestic-stock/v1/quotations/inquire-daily-price' + tr_id = "FHKST01010400" # 주식현재가 일자별 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "FID_PERIOD_DIV_CODE": period_code, # 기간분류코드 D : (일)최근 30거래일, W : (주)최근 30주, M : (월)최근 30개월 + "FID_ORG_ADJ_PRC": adj_prc_code # 0 : 수정주가반영, 1 : 수정주가미반영 * 수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 호가/예상체결 +# 주식현재가 호가 예상체결 API입니다. 매수 매도 호가를 확인하실 수 있습니다. 실시간 데이터를 원하신다면 웹소켓 API를 활용하세요. +############################################################################################## +# 주식현재가 일자별 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_asking_price_exp_ccn(output_dv='1', div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 호가/예상체결 + url = '/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn' + tr_id = "FHKST01010200" # 주식현재가 호가 예상체결 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output1' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 호가조회 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2, index=[0]) # 예상체결가조회 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 투자자 (최근 30일 조회) +# 주식현재가 투자자 API입니다. 개인, 외국인, 기관 등 투자 정보를 확인할 수 있습니다. +# +# [유의사항] +# - 외국인은 외국인(외국인투자등록 고유번호가 있는 경우)+기타 외국인을 지칭합니다. +# - 당일 데이터는 장 종료 후 제공됩니다. +############################################################################################## +# 주식현재가 투자자 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_investor(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 투자자 + url = '/uapi/domestic-stock/v1/quotations/inquire-investor' + tr_id = "FHKST01010900" # 주식현재가 투자자 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) # 호가조회 * getBody() kis_auth.py 존재 + + # @참고 전일대비 부호(prdy_vrss_sign) 1 : 상한, 2 : 상승, 3 : 보합, 4 : 하한, 5 : 하락 + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 회원사 +# 주식 현재가 회원사 API입니다. 회원사의 투자 정보를 확인할 수 있습니다.. +############################################################################################## +# 주식현재가 회원사 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_member(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 회원사 + url = '/uapi/domestic-stock/v1/quotations/inquire-member' + tr_id = "FHKST01010600" # 주식현재가 회원사 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # 호가조회 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) +# 국내주식기간별시세(일/주/월/년) API입니다. +# 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. +############################################################################################## +# 국내주식기간별시세(일/주/월/년) Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_daily_itemchartprice(div_code="J", itm_no="", tr_cont="", inqr_strt_dt=None, inqr_end_dt=None, period_code="D", adj_prc="1", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) + url = '/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice' + tr_id = "FHKST03010100" # 주식현재가 회원사 + + if inqr_strt_dt is None: + inqr_strt_dt = (datetime.now()-timedelta(days=14)).strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + print(inqr_strt_dt) + print(inqr_end_dt) + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "FID_INPUT_DATE_1": inqr_strt_dt, # 입력 날짜 (시작) 조회 시작일자 (ex. 20220501) + "FID_INPUT_DATE_2": inqr_end_dt, # 입력 날짜 (종료) 조회 종료일자 (ex. 20220530) + "FID_PERIOD_DIV_CODE": period_code, # 기간분류코드 D:일봉, W:주봉, M:월봉, Y:년봉 + "FID_ORG_ADJ_PRC": adj_prc # 수정주가 0:수정주가 1:원주가 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 호가조회 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) +# 국내주식기간별시세(일/주/월/년) API입니다. +# 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능합니다. +############################################################################################## +# 국내주식기간별시세(일/주/월/년) Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_daily_itemchartprice(output_dv="1", div_code="J", itm_no="", inqr_strt_dt=None, inqr_end_dt=None, period_code="D", adj_prc="1", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 국내주식기간별시세(일/주/월/년) + url = '/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice' + tr_id = "FHKST03010100" # 국내주식기간별시세 + + if inqr_strt_dt is None: + inqr_strt_dt = (datetime.now()-timedelta(days=100)).strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "FID_INPUT_DATE_1": inqr_strt_dt, # 입력 날짜 (시작) 조회 시작일자 (ex. 20220501) + "FID_INPUT_DATE_2": inqr_end_dt, # 입력 날짜 (종료) 조회 종료일자 (ex. 20220530) + "FID_PERIOD_DIV_CODE": period_code, # 기간분류코드 D:일봉, W:주봉, M:월봉, Y:년봉 + "FID_ORG_ADJ_PRC": adj_prc # 수정주가 0:수정주가 1:원주가 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 호가조회 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2) # 호가조회 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 당일시간대별체결 +# 기준시각(HHMMSS) 이전 체결 내역 30건 조회됨 (시간 미지정시 현재시각 기준) +############################################################################################## +# 주식현재가 당일시간대별체결 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_time_itemconclusion(output_dv="1", div_code="J", itm_no="", inqr_hour=None, tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 당일시간대별체결 + url = '/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion' + tr_id = "FHPST01060000" # 주식현재가 당일시간대별체결 + + if inqr_hour is None: + now = datetime.now() + + # 시, 분, 초 추출 + hour = now.hour + minute = now.minute + second = now.second + + # HHMMSS 형식으로 조합 + inqr_hour = f"{hour:02d}{minute:02d}{second:02d}" # 현재 시간 가져오기 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "FID_INPUT_HOUR_1": inqr_hour # 기준시간 (6자리; HH:MM:SS) ex) 155000 입력시 15시 50분 00초 기준 이전 체결 내역이 조회됨 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 호가조회 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2) # 호가조회 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시간외일자별주가 +# 기준시각(HHMMSS) 이전 체결 내역 30건 조회됨 (시간 미지정시 현재시각 기준) +############################################################################################## +# 주식현재가 시간외일자별주가 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_daily_overtimeprice(output_dv="1", div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 시간외일자별주가 + url = '/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice' + tr_id = "FHPST02320000" # 주식현재가 시간외일자별주가 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 시간외 현재가 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2) # 일자별 시간외주가 최근 30일 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > 주식당일분봉조회 +# 실전계좌/모의계좌의 경우, 한 번의 호출에 최대 30건까지 확인 가능합니다. +############################################################################################## +# 주식당일분봉조회 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_time_itemchartprice(output_dv="1", div_code="J", itm_no="", inqr_hour=None, incu_yn="N", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식당일분봉조회 + url = '/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice' + tr_id = "FHKST03010200" # 주식당일분봉조회 + + if inqr_hour is None: + now = datetime.now() + + # 시, 분, 초 추출 + hour = now.hour + minute = now.minute + second = now.second + + # HHMMSS 형식으로 조합 + inqr_hour = f"{hour:02d}{minute:02d}{second:02d}" # 현재 시간 가져오기 + + params = { + "FID_ETC_CLS_CODE": "", # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "FID_INPUT_HOUR_1": inqr_hour, # 조회대상(FID_COND_MRKT_DIV_CODE)에 따라 입력하는 값 상이 + # 종목(J)일 경우, 조회 시작일자(HHMMSS) + # ex) "123000" 입력 시 12시 30분 이전부터 1분 간격으로 조회 + # 업종(U)일 경우, 조회간격(초) (60 or 120 만 입력 가능) + # ex) "60" 입력 시 현재시간부터 1분간격으로 조회 + # "120" 입력 시 현재시간부터 2분간격으로 조회 + # ※ FID_INPUT_HOUR_1 에 미래일시 입력 시에 현재가로 조회됩니다. + # ex) 오전 10시에 113000 입력 시에 오전 10시~11시30분 사이의 데이터가 오전 10시 값으로 조회됨 + "FID_PW_DATA_INCU_YN": incu_yn # 과거 데이터 포함 여부(Y/N) * 업종(U) 조회시에만 동작하는 구분값 N : 당일데이터만 조회, Y : 이후데이터도 조회 + # (조회시점이 083000(오전8:30)일 경우 전일자 업종 시세 데이터도 같이 조회됨) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 현재가 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2) # 시간별 분봉 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > 주식현재가 시세2 +############################################################################################## +# 주식현재가 시세2 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_inquire_daily_price_2(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > 주식현재가 시세2 + url = '/uapi/domestic-stock/v1/quotations/inquire-price-2' + tr_id = "FHPST01010000" # 주식현재가 시세2 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # 시세2 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > ETF/ETN 현재가 +# 한국투자 HTS(eFriend Plus) > [0240] ETF/ETN 현재가 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다 +############################################################################################## +# ETF/ETN 현재가 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_quotations_inquire_price(div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > ETF/ETN 현재가 + url = '/uapi/etfetn/v1/quotations/inquire-price' + tr_id = "FHPST02400000" # ETF/ETN 현재가 + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # 시세2 * getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [국내주식] 기본시세 > NAV 비교추이(종목) +# 한국투자 HTS(eFriend Plus) > [0244] ETF/ETN 비교추이(NAV/IIV) 좌측 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +# NAV 비교추이(종목) Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_quotations_nav_comparison_trend(output_dv="1", div_code="J", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): # [국내주식] 기본시세 > NAV 비교추이(종목) + url = '/uapi/etfetn/v1/quotations/nav-comparison-trend' + tr_id = "FHPST02440000" # NAV 비교추이(종목) + + params = { + "FID_COND_MRKT_DIV_CODE": div_code, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "FID_INPUT_ISCD": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if output_dv == "1": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 현재가 * getBody() kis_auth.py 존재 + else: + current_data = pd.DataFrame(res.getBody().output2, index=[0]) # 시간별 분봉 + + dataframe = current_data + + return dataframe + + + +############################################################################################## +# [국내주식] 업종/기타 > 국내휴장일조회 +# 국내휴장일조회 API입니다. +# 영업일, 거래일, 개장일, 결제일 여부를 조회할 수 있습니다. +# 주문을 넣을 수 있는지 확인하고자 하실 경우 개장일여부(opnd_yn)을 사용하시면 됩니다. +############################################################################################## +def get_quotations_ch_holiday(dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/domestic-stock/v1/quotations/chk-holiday' + tr_id = "CTCA0903R" # 국내휴장일조회 + + params = { + "BASS_DT": dt, # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "CTX_AREA_FK": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # print(res.getBody()) # 오류 원인 확인 필요시 사용 + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) + + dataframe = current_data + + # 첫 번째 값만 선택하여 반환 + first_value = current_data.iloc[0] if not current_data.empty else None + + return first_value diff --git a/한국투자증권(API)/legacy/Sample01/kis_domstk_ws.py b/한국투자증권(API)/legacy/Sample01/kis_domstk_ws.py new file mode 100644 index 0000000..34b9c5a --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_domstk_ws.py @@ -0,0 +1,487 @@ +# 국내주식 실시간 websocket sample +import websocket + +import kis_auth as ka +import kis_domstk as kb + +import os +import json +import requests + +import pandas as pd +import numpy as np + +import time +import datetime + +from io import StringIO +from threading import Thread + +from collections import namedtuple, deque + +try: + import websockets + +except ImportError: + print("websocket-client 설치중입니다.") + os.system('python3 -m pip3 install websocket-client') + +from enum import StrEnum + + +class KIS_WSReq(StrEnum): + BID_ASK = 'H0STASP0' # 실시간 국내주식 호가 + CONTRACT = 'H0STCNT0' # 실시간 국내주식 체결 + NOTICE = 'H0STCNI0' # 실시간 계좌체결발생통보 + + +import talib as ta + + +class BasicPlan: + + def __init__(self, stock_code, window=20): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self._prev_ma = None + + def push(self, value): + self._queue.append(value) + ma = sum(self._queue) / len(self._queue) + diff = ma - self._prev_ma if self._prev_ma is not None else None + self._prev_ma = ma + + print(f"{self._stock_code}****** value: {value}, MA: {ma}, diff: {diff}...") + +class RSI_ST: # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + def __init__(self, stock_code, window=21): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self.rsi_period = window + + def eval(self): + # dftt = getStreamdDF(self._stock_code) + # print(self) + dftt = contract_sub_df.get(self._stock_code).copy() + dftt = dftt.set_index(['TICK_HOUR']) + dftt['STCK_PRPR'] = pd.to_numeric(dftt['STCK_PRPR'], errors='coerce').convert_dtypes() + np_closes = np.array(dftt['STCK_PRPR'], dtype=np.float64) + rsi = ta.RSI(np_closes, self.rsi_period) + + last_rsi = rsi[-1] + + if last_rsi < 30: + print(f"({self._stock_code})[BUY] ***RSI: {last_rsi}") # 통상적으로 RSI가 30 이하면 과매도 상태인 것으로 판단하고 시장이 과도하게 하락했음을 나타냄 + elif last_rsi < 70 and last_rsi >= 30: + print(f"({self._stock_code})[N/A] ***RSI: {last_rsi}") + elif last_rsi >= 70: + print(f"({self._stock_code})[SELL] ***RSI: {last_rsi}") # 통상적으로 RSI가 70 이상이면 과매수 상태로 간주하고 시장이 과열되었을 가능성이 있음을 나타냄 + else: + print(self._stock_code) + + +_today__ = datetime.date.today().strftime("%Y%m%d") + +ka.auth() + +__DEBUG__ = False # True + +# 실시간 국내주식 계좌체결통보 복호화를 위한 부분-start +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + + +# AES256 DECODE: Copied from KIS Developers Github sample code +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 실시간 국내주식 계좌체결통보 복호화를 위한 부분 - end + + +contract_sub_df = dict() # 실시간 국내주식 체결 결과를 종목별로 저장하기 위한 container +tr_plans = dict() # 실시간 국내주식 체결 값에 따라 무언가를 수행할 Class 를 저장하기 위한 container + +reserved_cols = ['TICK_HOUR', 'STCK_PRPR', 'ACML_VOL'] # 실시간 국내주식 체결 중 사용할 column 만 추출하기 위한 column 정의 + +# 실시간 국내주식체결 column header +contract_cols = ['MKSC_SHRN_ISCD', + 'TICK_HOUR', # pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 + 'STCK_PRPR', # 현재가 + 'PRDY_VRSS_SIGN', # 전일 대비 부호 + 'PRDY_VRSS', # 전일 대비 + 'PRDY_CTRT', # 전일 대비율 + 'WGHN_AVRG_STCK_PRC', # 가중 평균 주식 가격 + 'STCK_OPRC', # 시가 + 'STCK_HGPR', # 고가 + 'STCK_LWPR', # 저가 + 'ASKP1', # 매도호가1 + 'BIDP1', # 매수호가1 + 'CNTG_VOL', # 체결 거래량 + 'ACML_VOL', # 누적 거래량 + 'ACML_TR_PBMN', # 누적 거래 대금 + 'SELN_CNTG_CSNU', # 매도 체결 건수 + 'SHNU_CNTG_CSNU', # 매수 체결 건수 + 'NTBY_CNTG_CSNU', # 순매수 체결 건수 + 'CTTR', # 체결강도 + 'SELN_CNTG_SMTN', # 총 매도 수량 + 'SHNU_CNTG_SMTN', # 총 매수 수량 + 'CCLD_DVSN', # 체결구분 (1:매수(+), 3:장전, 5:매도(-)) + 'SHNU_RATE', # 매수비율 + 'PRDY_VOL_VRSS_ACML_VOL_RATE', # 전일 거래량 대비 등락율 + 'OPRC_HOUR', # 시가 시간 + 'OPRC_VRSS_PRPR_SIGN', # 시가대비구분 + 'OPRC_VRSS_PRPR', # 시가대비 + 'HGPR_HOUR', + 'HGPR_VRSS_PRPR_SIGN', + 'HGPR_VRSS_PRPR', + 'LWPR_HOUR', + 'LWPR_VRSS_PRPR_SIGN', + 'LWPR_VRSS_PRPR', + 'BSOP_DATE', # 영업 일자 + 'NEW_MKOP_CLS_CODE', # 신 장운영 구분 코드 + 'TRHT_YN', + 'ASKP_RSQN1', + 'BIDP_RSQN1', + 'TOTAL_ASKP_RSQN', + 'TOTAL_BIDP_RSQN', + 'VOL_TNRT', # 거래량 회전율 + 'PRDY_SMNS_HOUR_ACML_VOL', # 전일 동시간 누적 거래량 + 'PRDY_SMNS_HOUR_ACML_VOL_RATE', # 전일 동시간 누적 거래량 비율 + 'HOUR_CLS_CODE', # 시간 구분 코드(0 : 장중 ) + 'MRKT_TRTM_CLS_CODE', + 'VI_STND_PRC'] + +# 실시간 국내주식호가 column eader +bid_ask_cols = ['MKSC_SHRN_ISCD', + 'TICK_HOUR', # pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 + 'HOUR_CLS_CODE', # 시간 구분 코드(0 : 장중 ) + 'ASKP1', # 매도호가1 + 'ASKP2', + 'ASKP3', + 'ASKP4', + 'ASKP5', + 'ASKP6', + 'ASKP7', + 'ASKP8', + 'ASKP9', + 'ASKP10', + 'BIDP1', # 매수호가1 + 'BIDP2', + 'BIDP3', + 'BIDP4', + 'BIDP5', + 'BIDP6', + 'BIDP7', + 'BIDP8', + 'BIDP9', + 'BIDP10', + 'ASKP_RSQN1', # 매도호가 잔량1 + 'ASKP_RSQN2', + 'ASKP_RSQN3', + 'ASKP_RSQN4', + 'ASKP_RSQN5', + 'ASKP_RSQN6', + 'ASKP_RSQN7', + 'ASKP_RSQN8', + 'ASKP_RSQN9', + 'ASKP_RSQN10', + 'BIDP_RSQN1', # 매수호가 잔량1 + 'BIDP_RSQN2', + 'BIDP_RSQN3', + 'BIDP_RSQN4', + 'BIDP_RSQN5', + 'BIDP_RSQN6', + 'BIDP_RSQN7', + 'BIDP_RSQN8', + 'BIDP_RSQN9', + 'BIDP_RSQN10', + 'TOTAL_ASKP_RSQN', # 총 매도호가 잔량 + 'TOTAL_BIDP_RSQN', # 총 매수호가 잔량 + 'OVTM_TOTAL_ASKP_RSQN', + 'OVTM_TOTAL_BIDP_RSQN', + 'ANTC_CNPR', + 'ANTC_CNQN', + 'ANTC_VOL', + 'ANTC_CNTG_VRSS', + 'ANTC_CNTG_VRSS_SIGN', + 'ANTC_CNTG_PRDY_CTRT', + 'ACML_VOL', # 누적 거래량 + 'TOTAL_ASKP_RSQN_ICDC', + 'TOTAL_BIDP_RSQN_ICDC', + 'OVTM_TOTAL_ASKP_ICDC', + 'OVTM_TOTAL_BIDP_ICDC', + 'STCK_DEAL_CLS_CODE'] + +# 실시간 계좌체결발생통보 column header +notice_cols = ['CUST_ID', # HTS ID + 'ACNT_NO', + 'ODER_NO', # 주문번호 + 'OODER_NO', # 원주문번호 + 'SELN_BYOV_CLS', # 매도매수구분 + 'RCTF_CLS', # 정정구분 + 'ODER_KIND', # 주문종류(00 : 지정가,01 : 시장가,02 : 조건부지정가) + 'ODER_COND', # 주문조건 + 'STCK_SHRN_ISCD', # 주식 단축 종목코드 + 'CNTG_QTY', # 체결 수량(체결통보(CNTG_YN=2): 체결 수량, 주문·정정·취소·거부 접수 통보(CNTG_YN=1): 주문수량의미) + 'CNTG_UNPR', # 체결단가 + 'STCK_CNTG_HOUR', # 주식 체결 시간 + 'RFUS_YN', # 거부여부(0 : 승인, 1 : 거부) + 'CNTG_YN', # 체결여부(1 : 주문,정정,취소,거부,, 2 : 체결 (★ 체결만 볼 경우 2번만 )) + 'ACPT_YN', # 접수여부(1 : 주문접수, 2 : 확인 ) + 'BRNC_NO', # 지점 + 'ODER_QTY', # 주문수량 + 'ACNT_NAME', # 계좌명 + 'ORD_COND_PRC', # 호가조건가격 (스톱지정가 시 표시) + 'ORD_EXG_GB', # 주문거래소 구분 (1:KRX, 2:NXT, 3:SOR-KRX, 4:SOR-NXT) + 'POPUP_YN', # 실시간체결창 표시여부 (Y/N) + 'FILLER', # 필러 + 'CRDT_CLS', # 신용구분 + 'CRDT_LOAN_DATE', # 신용대출일자 + 'CNTG_ISNM40', # 체결종목명40 + 'ODER_PRC' # 주문가격 + ] + + +# 웹소켓 접속키 발급 +def get_approval(): + url = ka.getTREnv().my_url + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": ka.getTREnv().my_app, + "secretkey": ka.getTREnv().my_sec} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +_connect_key = get_approval() # websocker 연결Key +_iv = None # for 복호화 +_ekey = None # for 복호화 +executed_df = pd.DataFrame(data=None, columns=contract_cols) # 체결통보 저장용 DF + + +# added_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(체결통보) +def _build_message(app_key, tr_id, added_data, tr_type='1'): + _h = { + "approval_key": app_key, + "custtype": 'P', + "tr_type": tr_type, + "content-type": "utf-8" + } + _inp = { + "tr_id": tr_id, + "tr_key": added_data + } + _b = { + "input": _inp + } + _data = { + "header": _h, + "body": _b + } + + d1 = json.dumps(_data) + + return d1 + + +# sub_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(실시간 계좌체결발생통보) +def subscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록 + ws.send(_build_message(app_key, sub_type, sub_data), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +def unsubscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록해제 + ws.send(_build_message(app_key, sub_type, sub_data, '2'), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +# streaming data 를 이용해 주어진 bar 크기(예: 1분, 5분 등)의 OHLC(x분봉) 데이터프레임을 반환한다. +# 이때 streamign data 는 websocket client 가 시작한 다음부터 지금까지의 해당 종목의 가격 정보를 의미한다. +# ** 동시호가 시간은 OHLC data 가 모두 NA 가 된다. +def getStreamdDF(stock_code, bar_sz='1Min'): + df3 = contract_sub_df.get(stock_code).copy() + df3 = df3.set_index(['TICK_HOUR']) + df3['STCK_PRPR'] = pd.to_numeric(df3['STCK_PRPR'], errors='coerce').convert_dtypes() + df3 = df3['STCK_PRPR'].resample(bar_sz).ohlc() + + return df3 + +# 수신데이터 파싱 +def _dparse(data): + global executed_df + d1 = data.split("|") + dp_ = None + + hcols = [] + + if len(d1) >= 4: + tr_id = d1[1] + if tr_id == KIS_WSReq.CONTRACT: # 실시간체결 + hcols = contract_cols + elif tr_id == KIS_WSReq.BID_ASK: # 실시간호가 + hcols = bid_ask_cols + elif tr_id == KIS_WSReq.NOTICE: # 계좌체결통보 + hcols = notice_cols + else: + pass + + if tr_id in (KIS_WSReq.CONTRACT, KIS_WSReq.BID_ASK): # 실시간체결, 실시간호가 + dp_ = pd.read_csv(StringIO(d1[3]), header=None, sep='^', names=hcols, dtype=object) # 수신데이터 parsing + + print(dp_) # 실시간체결, 실시간호가 수신 데이터 파싱 결과 확인 + + dp_['TICK_HOUR'] = _today__ + dp_['TICK_HOUR'] # 수신시간 + dp_['TICK_HOUR'] = pd.to_datetime(dp_['TICK_HOUR'], format='%Y%m%d%H%M%S', errors='coerce') + else: # 실시간 계좌체결발생통보는 암호화되어서 수신되므로 복호화 과정이 필요 + dp_ = pd.read_csv(StringIO(aes_cbc_base64_dec(_ekey, _iv, d1[3])), header=None, sep='^', names=hcols, # 수신데이터 parsing 및 복호화 + dtype=object) + + print(dp_) # 실시간 계좌체결발생통보 수신 파싱 결과 확인 + + if __DEBUG__: print(f'***EXECUTED NOTICE [{dp_.to_string(header=False, index=False)}]') + + if tr_id == KIS_WSReq.CONTRACT: # 실시간 체결 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + stock_code = dp_[dp_.columns[0]].values.tolist()[0] + df2_ = dp_[reserved_cols] + # dft_ = pd.concat([contract_sub_df.get(stock_code), df2_], axis=0, ignore_index=True) + # 선택된 열이 비어 있거나 모든 값이 NA인지 확인 + selected_df = contract_sub_df.get(stock_code) + if selected_df is not None and not selected_df.dropna().empty: + dft_ = pd.concat([selected_df, df2_], axis=0, ignore_index=True) + else: + dft_ = df2_ + contract_sub_df[stock_code] = dft_ + + ######### 이 부분에서 로직을 적용한 후 매수/매도를 수행하면 될 듯!! + + val1 = dp_['STCK_PRPR'].tolist()[0] + tr_plans[stock_code].push(int(val1)) # 이동평균값 활용 + # tr_plans[stock_code].eval() # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 활용 + + # [국내주식] 주문/계좌 > 매수가능조회 (종목번호 5자리 + 종목단가) REST API + rt_data = kb.get_inquire_psbl_order(pdno=stock_code, ord_unpr=val1) + ord_qty = rt_data.loc[0, 'nrcvb_buy_qty'] # nrcvb_buy_qty 미수없는매수수량 + print("[미수없는매수주문가능수량!] : " + ord_qty) + + # 국내주식 현금 주문 + # rt_data = kb.get_order_cash(ord_dv="buy",itm_no=stock_code, qty=ord_qty, unpr=val1) + # print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + print("매수/매도 조건 주문 : " + val1) + + ######################################################### + + elif tr_id == KIS_WSReq.NOTICE: # 체결통보의 경우, 일단 executed_df 에만 저장해 둠 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + executed_df = pd.concat([executed_df, dp_], axis=0, ignore_index=True) + + else: + pass + else: + print("Data length error...{data}") + + +def _get_sys_resp(data): + global _iv + global _ekey + + isPingPong = False + isUnSub = False + isOk = False + tr_msg = None + tr_key = None + + rdic = json.loads(data) + + tr_id = rdic['header']['tr_id'] + if tr_id != "PINGPONG": tr_key = rdic['header']['tr_key'] + if rdic.get("body", None) is not None: + isOk = True if rdic["body"]["rt_cd"] == "0" else False + tr_msg = rdic["body"]["msg1"] + # 복호화를 위한 key 를 추출 + if 'output' in rdic["body"]: + _iv = rdic["body"]["output"]["iv"] + _ekey = rdic["body"]["output"]["key"] + isUnSub = True if tr_msg[:5] == "UNSUB" else False + else: + isPingPong = True if tr_id == "PINGPONG" else False + + nt2 = namedtuple('SysMsg', ['isOk', 'tr_id', 'tr_key', 'isUnSub', 'isPingPong']) + d = { + 'isOk': isOk, + 'tr_id': tr_id, + 'tr_key': tr_key, + 'isUnSub': isUnSub, + 'isPingPong': isPingPong + } + + return nt2(**d) + + +def on_data(ws, data, resp_type, data_continu): + # print(f"On data => {resp_type}, {data_continu}, {data}") #return only 1, True + pass + + +def on_message(ws, data): + if data[0] in ('0', '1'): # 실시간체결 or 실시간호가 + _dparse(data) + else: # system message or PINGPONG + rsp = _get_sys_resp(data) + if rsp.isPingPong: + ws.send(data, websocket.ABNF.OPCODE_PING) + else: + if (not rsp.isUnSub and rsp.tr_id == KIS_WSReq.CONTRACT): + contract_sub_df[rsp.tr_key] = pd.DataFrame(columns=reserved_cols) + + ######################################################################## + #### 이 부분에서 전략을 수행할 class 를 등록한다. + #### 실제 주문 실행은 _dparse 함수에서 처리 + tr_plans[rsp.tr_key] = BasicPlan(rsp.tr_key) # 이동 평균선 계산 (웹소켓 프로그램 실행시 수집된 데이터만 반영) + # tr_plans[rsp.tr_key] = RSI_ST(rsp.tr_key) # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + ######################################################################## + elif (rsp.isUnSub): + del (contract_sub_df[rsp.tr_key]) + else: + print(rsp) + + +def on_error(ws, error): + print('error=', error) + + +def on_close(ws, status_code, close_msg): + print('on_close close_status_code=', status_code, " close_msg=", close_msg) + + +def on_open(ws): + # stocks 에는 40개까지만 가능 + stocks = ('009540', '012630', '052300', '089860', '218410', '330590', '357550', '419080', '348370') + for scode in stocks: + subscribe(ws, KIS_WSReq.BID_ASK, _connect_key, scode) # 실시간 호가 + subscribe(ws, KIS_WSReq.CONTRACT, _connect_key, scode) # 실시간 체결 + + # unsubscribe(ws, KIS_WSReq.CONTRACT, _connect_key, "005930") #실시간 체결 해제 + # subscribe(ws, KIS_WSReq.BID_ASK, _connect_key, "005930") #실시간 호가 + # 실시간 계좌체결발생통보를 등록한다. 계좌체결발생통보 결과는 executed_df 에 저장된다. + subscribe(ws, KIS_WSReq.NOTICE, _connect_key, "HTS ID 입력") # HTS ID 입력 + + +ws = websocket.WebSocketApp("ws://ops.koreainvestment.com:21000/tryitout", + on_open=on_open, on_message=on_message, on_error=on_error, on_data=on_data) + +ws.run_forever() # 실시간 웹소켓 연결 작동 diff --git a/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt.py b/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt.py new file mode 100644 index 0000000..ea18ff7 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt.py @@ -0,0 +1,1173 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" +import kis_auth as kis + +import time, copy +import requests +import json + +import pandas as pd + +from collections import namedtuple +from datetime import datetime +from pandas import DataFrame + + +#====| [해외선물옵션] 주문/계좌 |============================================================================================================================ + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문 [v1_해외선물-001] +# 해외선물옵션 주문 API 입니다. +# +# ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. +# (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) +# +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_order(itm_no="", ord_dv="", dvsn="", qty=0, limt_pric=0, stop_pric=0, ccld_cd="6", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/order' + tr_id = "OTFM3001U" # 선물옵션주문신규 + + if itm_no == "": + print("해외선물FX상품번호 확인요망!!!") + return None + + if qty == 0: + print("주문수량 확인요망!!!") + return None + + if dvsn == "1" and limt_pric == 0: + print("지정가주문인 경우 LIMIT주문가격 확인요망!!!") + return None + + if dvsn == "3" and stop_pric == 0: + print("STOP주문인 경우 STOP주문가격 확인요망!!!") + return None + + if ord_dv not in ("01","02"): + print("매수01/매도02 구분 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_FUTR_FX_PDNO": itm_no, # 해외선물FX상품번호 + "SLL_BUY_DVSN_CD": ord_dv, # 매도매수구분코드 01 : 매도, 02 : 매수 + "FM_LQD_USTL_CCLD_DT": "", # FM청산미결제체결일자 + "FM_LQD_USTL_CCNO": "", # FM청산미결제체결번호 + "PRIC_DVSN_CD": dvsn, # 가격구분코드 1.지정, 2.시장, 3.STOP, 4.S/L + "FM_LIMIT_ORD_PRIC": limt_pric, # FMLIMIT주문가격 지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력 + "FM_STOP_ORD_PRIC": stop_pric, # FMSTOP주문가격 STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력 + "FM_ORD_QTY": qty, # FM주문수량 + "FM_LQD_LMT_ORD_PRIC": "", # FM청산LIMIT주문가격 + "FM_LQD_STOP_ORD_PRIC": "", # FM청산STOP주문가격 + "CCLD_CNDT_CD": ccld_cd, # 체결조건코드 일반적으로 6 (EOD, 지정가), GTD인 경우 5, 시장가인 경우만 2 + "CPLX_ORD_DVSN_CD": "0", # 복합주문구분코드 + "ECIS_RSVN_ORD_YN": "N", # 행사예약주문여부 + "FM_HDGE_ORD_SCRN_YN": "N" # FM_HEDGE주문화면여부 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 정정취소주문 [v1_해외선물-002, 003] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_order_rvsecncl(dvsn="", ord_dt="", orgn_odno="", limt_pric=0, stop_pric=0, lqd_limt_pric=0, lqd_stop_pric=0, tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/order-rvsecncl' + + if dvsn == "01": # 정정 + tr_id = "OTFM3002U" # 해외선물옵션주문정정 + elif dvsn == "02": # 취소 + tr_id = "OTFM3003U" # 해외선물옵션주문취소 + else: + print("정정취소구분 dvsn 확인요망!!!") + return None + + if ord_dt == "": + print("원주문일자 확인요망!!!") + return None + + if orgn_odno == "": + print("원주문번호 확인요망!!!") + return None + + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "ORGN_ORD_DT": ord_dt, # 원주문일자 + "ORGN_ODNO": orgn_odno, # 원주문번호 정정/취소시 주문번호(ODNO) 8자리를 문자열처럼 "0"을 포함해서 전송 (ex. ORGN_ODNO : 00360686) + "FM_LIMIT_ORD_PRIC": limt_pric, # LIMIT주문가격 (주문정정)시만 사용 + "FM_STOP_ORD_PRIC": stop_pric, # STOP주문가격 (주문정정)시만 사용 + "FM_LQD_LMT_ORD_PRIC": lqd_limt_pric, # 청산LIMIT주문가격 (주문정정)시만 사용 + "FM_LQD_STOP_ORD_PRIC": lqd_stop_pric, # 청산STOP주문가격 (주문정정)시만 사용 + "FM_HDGE_ORD_SCRN_YN": "N", # HEDGE주문화면여부 "N" + "FM_MKPR_CVSN_YN": "N" # 시장가전환여부 (주문취소)시만 사용 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 당일주문내역조회 [v1_해외선물-004] +############################################################################################## +# 해외선물옵션 당일주문내역조회 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_ccld(ccld_dv="01", ord_dv="%%", fuop_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-ccld' + tr_id = "OTFM3116R" + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "CCLD_NCCS_DVSN": ccld_dv, # 체결미체결구분 01:전체,02:체결,03:미체결 + "SLL_BUY_DVSN_CD": ord_dv, # 매도매수구분코드 %%:전체,01:매도,02:매수 + "FUOP_DVSN": fuop_dvsn, # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_ccld(ccld_dv, ord_dv, fuop_dvsn, "N", FK100, NK100, dataframe) + + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 미결제내역조회(잔고) [v1_해외선물-005] +############################################################################################## +# 해외선물옵션 미결제내역조회(잔고) List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_unpd(fuop_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-unpd' + tr_id = "OTFM1412R" + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "FUOP_DVSN": fuop_dvsn, # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_unpd(fuop_dvsn, "N", FK100, NK100, dataframe) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 [v1_해외선물-006] +############################################################################################## +# 해외선물옵션 주문가능조회 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_psamount(itm_no="", dvsn="", pric=0, ordyn="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-psamount' + tr_id = "OTFM3304R" + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_FUTR_FX_PDNO": itm_no, # 해외선물FX상품번호 + "SLL_BUY_DVSN_CD": dvsn, # 매도매수구분코드 01 : 매도 / 02 : 매수 + "FM_ORD_PRIC": pric, # 주문가격 + "ECIS_RSVN_ORD_YN": ordyn # 행사예약주문여부 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌손익 일별[해외선물-010] +############################################################################################## +# 해외선물옵션 기간계좌손익 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_period_ccld(inqr_dvsn="", fr_dt="", to_dt="", crcy="%%%", fuop_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-period-ccld' + tr_id = "OTFM3118R" + + t_cnt = 0 + + if fr_dt =="": + fr_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if to_dt =="": + to_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_TERM_FROM_DT": fr_dt, # 조회기간FROM일자 + "INQR_TERM_TO_DT": to_dt, # 조회기간TO일자 + "CRCY_CD": crcy, # 통화코드 '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본' + "WHOL_TRSL_YN": "N", # 전체환산여부 + "FUOP_DVSN": fuop_dvsn, # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + if inqr_dvsn == "01": + current_data = pd.DataFrame(res.getBody().output1) + else: + current_data = pd.DataFrame(res.getBody().output2) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_period_ccld(fr_dt, to_dt, crcy, fuop_dvsn, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 체결내역[해외선물-011] +############################################################################################## +# 해외선물옵션 일별 체결내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_daily_ccld(fr_dt="", to_dt="", fuop_dvsn="00", crcy="%%%", dvsn="%%", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-daily-ccld' + tr_id = "OTFM3122R" + + t_cnt = 0 + + if fr_dt =="": + fr_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if to_dt =="": + to_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "STRT_DT": fr_dt, # 시작일자 + "END_DT": to_dt, # 종료일자 + "FUOP_DVSN_CD": fuop_dvsn, # 선물옵션구분코드 00:전체 / 01:선물 / 02:옵션 + "FM_PDGR_CD": "", # 상품군코드 공란(Default) + "CRCY_CD": crcy, # 통화코드 '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 / VND: 베트남 + "FM_ITEM_FTNG_YN": "N", # 종목합산여부 "N"(Default) + "SLL_BUY_DVSN_CD": dvsn, # 매도매수구분코드 %%: 전체 / 01 : 매도 / 02 : 매수 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_daily_ccld(fr_dt, to_dt, fuop_dvsn, crcy, dvsn, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황[해외선물-012] +############################################################################################## +# 해외선물옵션 예수금현황 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_deposit(crcy="TUS", inqr_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-deposit' + tr_id = "OTFM1411R" + + t_cnt = 0 + + if inqr_dt =="": + inqr_dt = datetime.today().strftime("%Y%m%d") # 조회일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "CRCY_CD": crcy, # 통화코드 '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 / VND: 베트남 + "INQR_DT": inqr_dt # 조회일자 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 일별 주문내역[해외선물-013] +############################################################################################## +# 해외선물옵션 일별 주문내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_daily_order(fr_dt="", to_dt="", ccld_dvsn="01", dvsn="%%", fuop_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-daily-order' + tr_id = "OTFM3120R" + + t_cnt = 0 + + if fr_dt =="": + fr_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if to_dt =="": + to_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "STRT_DT": fr_dt, # 시작일자 + "END_DT": to_dt, # 종료일자 + "FM_PDGR_CD": "", # 상품군코드 + "CCLD_NCCS_DVSN": ccld_dvsn, # 체결미체결구분 01:전체 / 02:체결 / 03:미체결 + "SLL_BUY_DVSN_CD": dvsn, # 매도매수구분코드 %%전체 / 01 : 매도 / 02 : 매수 + "FUOP_DVSN": fuop_dvsn, # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_daily_order(fr_dt, to_dt, ccld_dvsn, dvsn, fuop_dvsn, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 기간계좌거래내역[해외선물-014] +############################################################################################## +# 해외선물옵션 기간계좌거래내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_period_trans(fr_dt="", to_dt="", trtype="1", crcy="%%%", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/inquire-period-trans' + tr_id = "OTFM3114R" + + t_cnt = 0 + + if fr_dt =="": + fr_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if to_dt =="": + to_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "INQR_TERM_FROM_DT": fr_dt, # 시작일자 + "INQR_TERM_TO_DT": to_dt, # 종료일자 + "ACNT_TR_TYPE_CD": trtype, # 계좌거래유형코드 1: 전체, 2:입출금 , 3: 결제 + "CRCY_CD": crcy, # 통화코드 %%% : 전체 TUS: TOT_USD / TKR: TOT_KRW / KRW: 한국 / USD: 미국 / EUR: EUR / HKD: 홍콩 / CNY: 중국 / JPY: 일본 / VND: 베트남 + "PWD_CHK_YN": "N", # 사용안함 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK200 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK200 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseasfuopt_inquire_period_trans(fr_dt, to_dt, trtype, crcy, "N", FK100, NK100, dataframe) + +############################################################################################## +# [해외선물옵션] 주문/계좌 > 해외선물옵션 예수금현황[해외선물-012] +############################################################################################## +# 해외선물옵션 예수금현황 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseasfuopt_inquire_margin_detail(crcy="TUS", inqr_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/trading/margin-detail' + tr_id = "OTFM3115R" + + t_cnt = 0 + + if inqr_dt =="": + inqr_dt = datetime.today().strftime("%Y%m%d") # 조회일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "CRCY_CD": crcy, # 통화코드 '%%% : 전체 TUS: TOT_USD / TKR: TOT_KRW KRW: 한국 / USD: 미국 EUR: EUR / HKD: 홍콩 CNY: 중국 / JPY: 일본 / VND: 베트남 + "INQR_DT": inqr_dt # 조회일자 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +#====| [해외선물옵션] 기본시세 |============================================================================================================================ + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목상세 [v1_해외선물-008] +# (중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. +# +# - ffcode.mst(해외선물종목마스터 파일) 다운로드 방법 2가지 +# 1) 한국투자증권 Github의 파이썬 샘플코드를 사용하여 mst 파일 다운로드 및 excel 파일로 정제 +# https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/overseas_future_code.py +# +# 2) 혹은 포럼 - FAQ - 종목정보 다운로드 - 해외선물옵션 클릭하셔서 ffcode.mst(해외선물종목마스터 파일)을 다운로드 후 +# Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외선물옵션정보.h)를 참고하여 해석 +# +# - 소수점 계산 시, ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고 +# EX) ffcode.mst 파일의 sCalcDesz(계산 소수점) 값 +# 품목코드 6A 계산소수점 -4 → 시세 6882.5 수신 시 0.68825 로 해석 +# 품목코드 GC 계산소수점 -1 → 시세 19225 수신 시 1922.5 로 해석 +# +# [참고자료] +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +def get_overseas_fuopt_stock_detail(itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/stock-detail' + tr_id = "HHDFC55010100" # 해외선물종목상세 + + params = { + "SRS_CD": itm_no # 종목코드 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물종목현재가 [v1_해외선물-009] +# (중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. +# +# - ffcode.mst(해외선물종목마스터 파일) 다운로드 방법 2가지 +# 1) 한국투자증권 Github의 파이썬 샘플코드를 사용하여 mst 파일 다운로드 및 excel 파일로 정제 +# https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/overseas_future_code.py +# +# 2) 혹은 포럼 - FAQ - 종목정보 다운로드 - 해외선물옵션 클릭하셔서 ffcode.mst(해외선물종목마스터 파일)을 다운로드 후 +# Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외선물옵션정보.h)를 참고하여 해석 +# +# - 소수점 계산 시, ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고 +# EX) ffcode.mst 파일의 sCalcDesz(계산 소수점) 값 +# 품목코드 6A 계산소수점 -4 → 시세 6882.5 수신 시 0.68825 로 해석 +# 품목코드 GC 계산소수점 -1 → 시세 19225 수신 시 1922.5 로 해석 +# +# [참고자료] +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +def get_overseas_fuopt_inquire_price(itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/inquire-price' + tr_id = "HHDFC55010000" # 해외선물종목현재가 + + params = { + "SRS_CD": itm_no # 종목코드 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 분봉조회[해외선물-016] +# 해외선물분봉조회 API입니다. 반드시 아래 호출방법을 확인하시고 호출 사용하시기 바랍니다. +# +# ※ 해외선물분봉조회 조회 방법 +# params +# . START_DATE_TIME: 공란 입력 ("") +# . CLOSE_DATE_TIME: 조회일자 입력 ("20231214") +# . QRY_CNT: 120 입력 시, 가장 최근 분봉 120건 조회, +# 240 입력 시, 240 이전 분봉 ~ 120 이전 분봉 조회 +# 360 입력 시, 360 이전 분봉 ~ 240 이전 분봉 조회 +# . QRY_TP: 처음조회시, 공백 입력 +# 다음조회시, P 입력 +# . INDEX_KEY: 처음조회시, 공백 입력 +# 다음조회시, 이전 조회 응답의 output2 > index_key 값 입력 +# +# * 따라서 분봉데이터를 기간별로 수집하고자 하실 경우 QRY_TP, INDEX_KEY 값을 이용하시면서 다음조회하시면 됩니다. +############################################################################################## +def get_overseas_fuopt_inquire_time_futurechartprice(itm_no="", exch="", st_dt="", ed_dt="", dvsn="", cnt="", gap="", idx="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice' + tr_id = "HHDFC55020400" # 해외선물 분봉조회 + + params = { + "SRS_CD": itm_no, # 종목코드 + "EXCH_CD": exch, # 거래소코드 + "START_DATE_TIME": st_dt, # 조회시작일시 + "CLOSE_DATE_TIME": ed_dt, # 조회종료일시 + "QRY_TP": dvsn, # 조회구분 + "QRY_CNT": cnt, # 요청개수 + "QRY_GAP": gap, # 묶음개수 + "INDEX_KEY": idx # 이전조회KEY + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, idx = res.getHeader().tr_cont, res.getBody().output2['index_key'] # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if idx == "": + idx = "99991231" # 다음페이지 값이 없으면 종료 처리를 위해 임의 날자 값 셋팅 + + date1 = datetime.strptime(idx[:8], '%Y%m%d') # 응답 index_key 다음날자 값 날자형 변환 + date2 = datetime.strptime(st_dt, '%Y%m%d') # 조회시작일자 날자형 변환 + date3 = datetime.strptime(ed_dt, '%Y%m%d') # 조회종료일자 날자형 변환 + #print(date1, date2, date3) + + if date1 >= date2 and date1 <= date3: # 조회시작일자 ~ 조회종료일자 까지 다음페이지 조회 + print('Call Next ( ' + idx[:8] + ' )') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_fuopt_inquire_time_futurechartprice(itm_no, exch, st_dt, ed_dt, "P", cnt, gap, idx, tr_cont, dataframe) + else: # 조회시작일자 ~ 조회종료일자 이외 날자인경우 종료 처리 + #print("The End") + print('The End ( ' + idx[:8] + ' )') + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(주간)[해외선물-017] +# 해외선물옵션 체결추이(주간) API입니다. +# 한국투자 HTS(eFriend Force) > [5502] 해외선물옵션 체결추이 화면에서 "주간" 선택 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_weekly_ccnl(itm_no="", exch="", st_dt="", ed_dt="", dvsn="Q", cnt="40", gap="", idx="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/weekly-ccnl' + tr_id = "HHDFC55020000" # 체결추이(주간) + + params = { + "SRS_CD": itm_no, # 종목코드 + "EXCH_CD": exch, # 거래소코드 + "START_DATE_TIME": st_dt, # 조회시작일시 + "CLOSE_DATE_TIME": ed_dt, # 조회종료일시 + "QRY_TP": dvsn, # 조회구분 + "QRY_CNT": cnt, # 요청개수 + "QRY_GAP": gap, # 묶음개수 + "INDEX_KEY": idx # 이전조회KEY + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, idx = res.getHeader().tr_cont, res.getBody().output1['index_key'] # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if idx == "": + idx = "99991231" # 다음페이지 값이 없으면 종료 처리를 위해 임의 날자 값 셋팅 + + date1 = datetime.strptime(str(idx), '%Y%m%d') # 응답 index_key 다음날자 값 날자형 변환 + date2 = datetime.strptime(str(st_dt),'%Y%m%d') # 조회시작일자 날자형 변환 + date3 = datetime.strptime(str(ed_dt),'%Y%m%d') # 조회종료일자 날자형 변환 + #print(date1, date2, date3) + + if date1 >= date2 and date1 <= date3: # 조회시작일자 ~ 조회종료일자 까지 다음페이지 조회 + print('Call Next ( ' + idx[:8] + ' )') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_fuopt_weekly_ccnl(itm_no, exch, st_dt, ed_dt, "P", cnt, gap, idx, tr_cont, dataframe) + else: # 조회시작일자 ~ 조회종료일자 이외 날자인경우 종료 처리 + #print("The End") + print('The End ( ' + idx[:8] + ' )') + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(일간)[해외선물-018] +# 해외선물옵션 체결추이(일간) API입니다. +# 한국투자 HTS(eFriend Force) > [5502] 해외선물옵션 체결추이 화면에서 "일간" 선택 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_daily_ccnl(itm_no="", exch="", st_dt="", ed_dt="", dvsn="Q", cnt="40", gap="", idx="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/daily-ccnl' + tr_id = "HHDFC55020100" # 체결추이(일간) + + params = { + "SRS_CD": itm_no, # 종목코드 + "EXCH_CD": exch, # 거래소코드 + "START_DATE_TIME": st_dt, # 조회시작일시 + "CLOSE_DATE_TIME": ed_dt, # 조회종료일시 + "QRY_TP": dvsn, # 조회구분 + "QRY_CNT": cnt, # 요청개수 + "QRY_GAP": gap, # 묶음개수 + "INDEX_KEY": idx # 이전조회KEY + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data.loc[current_data.data_date.between(st_dt, ed_dt)] # 조회일자 범위만큼 추출하여 dataframe에 셋팅 + + tr_cont, idx = res.getHeader().tr_cont, res.getBody().output1['index_key'] # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if idx == "": + idx = "99991231" # 다음페이지 값이 없으면 종료 처리를 위해 임의 날자 값 셋팅 + + date1 = datetime.strptime(str(idx), '%Y%m%d') # 응답 index_key 다음날자 값 날자형 변환 + date2 = datetime.strptime(str(st_dt),'%Y%m%d') # 조회시작일자 날자형 변환 + date3 = datetime.strptime(str(ed_dt),'%Y%m%d') # 조회종료일자 날자형 변환 + #print(date1, date2, date3) + + if date1 >= date2 and date1 <= date3: # 조회시작일자 ~ 조회종료일자 까지 다음페이지 조회 + print('Call Next ( ' + idx[:8] + ' )') + time.sleep(0.05) + return get_overseas_fuopt_daily_ccnl(itm_no, exch, st_dt, ed_dt, "P", cnt, gap, idx, tr_cont, dataframe) + else: # 조회시작일자 ~ 조회종료일자 이외 날자인경우 종료 처리 + #print("The End") + print('The End ( ' + idx[:8] + ' )') + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(틱)[해외선물-019] +# 해외선물옵션 체결추이(틱) API입니다. +# 한국투자 HTS(eFriend Force) > [5502] 해외선물옵션 체결추이 화면에서 "Tick" 선택 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_tick_ccnl(itm_no="", exch="", st_dt="", ed_dt="", dvsn="Q", cnt="40", gap="", idx="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/tick-ccnl' + tr_id = "HHDFC55020200" # 체결추이(틱) + + if st_dt =="": + st_dt = datetime.today().strftime("%Y%m%d") # 주문내역조회 시작일자 값이 없으면 현재일자 + + if ed_dt =="": + ed_dt = datetime.today().strftime("%Y%m%d") # 주문내역조회 종료일자 값이 없으면 현재일자 + + params = { + "SRS_CD": itm_no, # 종목코드 + "EXCH_CD": exch, # 거래소코드 + "START_DATE_TIME": st_dt, # 조회시작일시 + "CLOSE_DATE_TIME": ed_dt, # 조회종료일시 + "QRY_TP": dvsn, # 조회구분 + "QRY_CNT": cnt, # 요청개수 + "QRY_GAP": gap, # 묶음개수 + "INDEX_KEY": idx # 이전조회KEY + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data.loc[current_data.data_date.between(ed_dt, ed_dt)] # 조회일자 범위만큼 추출하여 dataframe에 셋팅 + #dataframe = current_data # 조회일자 범위만큼 추출하여 dataframe에 셋팅 + + tr_cont, idx = res.getHeader().tr_cont, res.getBody().output1['index_key'] # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if idx == "": + idx = "99991231" # 다음페이지 값이 없으면 종료 처리를 위해 임의 날자 값 셋팅 + + date1 = datetime.strptime(str(idx[:8]), '%Y%m%d') # 응답 index_key 다음날자 값 날자형 변환 + date2 = datetime.strptime(str(st_dt),'%Y%m%d') # 조회시작일자 날자형 변환 + date3 = datetime.strptime(str(ed_dt),'%Y%m%d') # 조회종료일자 날자형 변환 + #print(date1, date2, date3) + + if date1 == date3: # 조회시작일자 ~ 조회종료일자 까지 다음페이지 조회 + print('Call Next ( ' + idx + ' )') + time.sleep(0.05) + return get_overseas_fuopt_tick_ccnl(itm_no, exch, st_dt, ed_dt, "P", cnt, gap, idx, tr_cont, dataframe) + else: # 조회시작일자 ~ 조회종료일자 이외 날자인경우 종료 처리 + #print("The End") + print('The End ( ' + idx + ' )') + return dataframe + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 체결추이(월간)[해외선물-020] +# 해외선물옵션 체결추이(월간) API입니다. +# 한국투자 HTS(eFriend Force) > [5502] 해외선물옵션 체결추이 화면에서 "월간" 선택 시 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_monthly_ccnl(itm_no="", exch="", st_dt="", ed_dt="", dvsn="Q", cnt="40", gap="", idx="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/monthly-ccnl' + tr_id = "HHDFC55020300" # 체결추이(월간) + + params = { + "SRS_CD": itm_no, # 종목코드 + "EXCH_CD": exch, # 거래소코드 + "START_DATE_TIME": st_dt, # 조회시작일시 + "CLOSE_DATE_TIME": ed_dt, # 조회종료일시 + "QRY_TP": dvsn, # 조회구분 + "QRY_CNT": cnt, # 요청개수 + "QRY_GAP": gap, # 묶음개수 + "INDEX_KEY": idx # 이전조회KEY + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data #.loc[current_data.data_date.between(st_dt, ed_dt)] # 조회일자 범위만큼 추출하여 dataframe에 셋팅 + + tr_cont, idx = res.getHeader().tr_cont, res.getBody().output1['index_key'] # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if idx == "": + idx = "99991231" # 다음페이지 값이 없으면 종료 처리를 위해 임의 날자 값 셋팅 + + date1 = datetime.strptime(str(idx), '%Y%m%d') # 응답 index_key 다음날자 값 날자형 변환 + date2 = datetime.strptime(str(st_dt),'%Y%m%d') # 조회시작일자 날자형 변환 + date3 = datetime.strptime(str(ed_dt),'%Y%m%d') # 조회종료일자 날자형 변환 + #print(date1, date2, date3) + + if date1 >= date2 and date1 <= date3: # 조회시작일자 ~ 조회종료일자 까지 다음페이지 조회 + print('Call Next ( ' + idx[:8] + ' )') + time.sleep(0.05) + return get_overseas_fuopt_monthly_ccnl(itm_no, exch, st_dt, ed_dt, "P", cnt, gap, idx, tr_cont, dataframe) + else: # 조회시작일자 ~ 조회종료일자 이외 날자인경우 종료 처리 + #print("The End") + print('The End ( ' + idx[:8] + ' )') + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 호가 [해외선물-031] +# (중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다. +# +# - ffcode.mst(해외선물종목마스터 파일) 다운로드 방법 2가지 +# 1) 한국투자증권 Github의 파이썬 샘플코드를 사용하여 mst 파일 다운로드 및 excel 파일로 정제 +# https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/overseas_future_code.py +# +# 2) 혹은 포럼 - FAQ - 종목정보 다운로드 - 해외선물옵션 클릭하셔서 ffcode.mst(해외선물종목마스터 파일)을 다운로드 후 +# Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외선물옵션정보.h)를 참고하여 해석 +# +# - 소수점 계산 시, ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고 +# EX) ffcode.mst 파일의 sCalcDesz(계산 소수점) 값 +# 품목코드 6A 계산소수점 -4 → 시세 6882.5 수신 시 0.68825 로 해석 +# 품목코드 GC 계산소수점 -1 → 시세 19225 수신 시 1922.5 로 해석 +# +# [참고자료] +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +def get_overseas_fuopt_inquire_asking_price(itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/inquire-asking-price' + tr_id = "HHDFC86000000" # 해외선물호가 + + params = { + "SRS_CD": itm_no # 종목코드 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 상품기본정보 [해외선물-023] +# 해외선물옵션 상품기본정보 API입니다. +# QRY_CNT에 SRS_CD 요청 개수 입력, SRS_CD_01 ~SRS_CD_32 까지 최대 32건의 상품코드 추가 입력하여 해외선물옵션 상품기본정보 확인이 가능합니다. (아래 Example 참고) +############################################################################################## +def get_overseas_fuopt_search_contract_detail(cnt="1", itm_no01="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/search-contract-detail' + tr_id = "HHDFC55200000" # 해외선물 상품기본정보 + + params = { + "QRY_CNT": cnt, # 요청개수 + "SRS_CD_01": itm_no01 # 종목코드 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 장운영시간 [해외선물-030] +# 해외선물 장운영시간 API입니다. +# 한국투자 HTS(eFriend Force) > [6773] 해외선물 장운영시간 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_market_time(clas="", excg="CME", opt="%", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/market-time' + tr_id = "OTFM2229R" # 해외선물 장운영시간 + + t_cnt = 0 + + params = { + "FM_PDGR_CD": "", # 상품군코드 "" + "FM_CLAS_CD": clas, # 클래스코드 공백(전체), 001(통화), 002(금리), 003(지수), 004(농산물),005(축산물),006(금속),007(에너지) + "FM_EXCG_CD": excg, # 거래소코드 CME(CME), EUREX(EUREX), HKEx(HKEx), ICE(ICE), SGX(SGX), OSE(OSE), ASX(ASX), + # CBOE(CBOE), MDEX(MDEX), NYSE(NYSE),BMF(BMF),FTX(FTX), HNX(HNX), ETC(기타)' + "OPT_YN": opt, # 옵션여부 %(전체), N(선물), Y(옵션) + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + print(current_data) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data.loc[current_data.fm_pdgr_cd != ""] # 상품군코드(fm_pdgr_cd) 값이 없는 경우 제외 + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_fuopt_market_time(clas, excg, opt, "N", FK100, NK100, dataframe) + + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외선물 미결제추이 [해외선물-029] +# 해외선물 미결제추이 API입니다. +# 한국투자 HTS(eFriend Force) > [5503] 해외선물 미결제약정추이 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# +# ※ 해외선물 투자자별 미결제약정 추이 자료설명 +# 1. 해외선물 투자자별 미결제약정 자료는 미국상품선물위원회(CFTC)에서 매주 1회 발표하고 있습니다. +# 2. 기준일은 매주 화요일이며, 발표는 매주 금요일 15:30 (미국동부표준시)에 하며, 당사는 매주 토요일 아침에 자료를 업데이트하고 있습니다. +# 3. 활용방법 : CFTC에서 발표하는 미결제약점 동향자료는 각 선물시장의 투기자금 동향을 파약하는데 용이하며, 특히, 상품시장에서 유용하게 활용할 수 있습니다. +# 4. 주요항목 설명 +# . 투기거래자 : 실물보유 또는 보유중인 실물에 대한 헤지목적이 아닌 가격변동에 따른 이익을 목적으로 거래하는 고객으로 주로 투자은행, 자산운용사, 헤지펀드, 개인투자자등임 +# . 헤지거래자 : 실물보유 또는 보유중인 실물에 대한 헤지목적으로 거래하는 고객으로 주로 일반기업, 생산업체, 원자재공급업체등임. +# . 보고누락분 : 시장전체 미결제약정과 투기거래자와 헤지거래자 보고분 합계와의 차이로 투자주제가 확인안된 거래임. +# . 투자자 : 최종거래고객 기준이 아닌 거래소 회원 단위 기준임. +# 5. CFTC 홈페이지: http://www.cftc.gov/index.htm +############################################################################################## +def get_overseas_fuopt_investor_unpd_trend(iscd="CL", dt="", kbn="", ctskey="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/investor-unpd-trend' + tr_id = "HHDDB95030000" # 해외선물 상품기본정보 + + params = { + "PROD_ISCD": iscd, # 상품 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG), + # 농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), + # 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), + # 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX) + "BSOP_DATE": dt, # 일자 기준일(ex)20240513) + "UPMU_GUBUN": kbn, # 구분 0(수량), 1(증감) + "CTS_KEY": ctskey # "" 사용안함 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + dataframe = current_data + + return dataframe + + + +############################################################################################## +# [해외선물옵션] 기본시세 > 해외옵션 호가 [해외선물-033] +# 해외옵션 호가 API입니다. +# 한국투자 HTS(eFriend Force) > [5501] 해외선물옵션 현재가 화면 의 "왼쪽 상단 현재가" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +def get_overseas_fuopt_opt_asking_price(dv="01", itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-futureoption/v1/quotations/opt-asking-price' + tr_id = "HHDFO86000000" # 해외옵션 호가 + + params = { + "SRS_CD": itm_no # 종목코드 예)OESM24 C5340 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if dv == "01": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + else : + current_data = pd.DataFrame(res.getBody().output2) + + dataframe = current_data + + return dataframe diff --git a/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt_ws.py b/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt_ws.py new file mode 100644 index 0000000..c98c11b --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_ovrseafuopt_ws.py @@ -0,0 +1,508 @@ +# 국내주식 실시간 websocket sample +import websocket + +import kis_auth as ka +import kis_ovrseafuopt as kb + +import os +import json +import requests + +import pandas as pd +import numpy as np + +import time +import datetime + +from io import StringIO +from threading import Thread + +from collections import namedtuple, deque + +try: + import websockets + +except ImportError: + print("websocket-client 설치중입니다.") + os.system('python3 -m pip3 install websocket-client') + +from enum import StrEnum + + +class KIS_WSReq(StrEnum): + CONTRACT = 'HDFFF020' # 해외선물옵션 실시간체결가 + BID_ASK = 'HDFFF010' # 해외선물옵션 실시간호가 + ORDERNOTICE = 'HDFFF1C0' # 실시간 해외선물옵션 주문내역발생통보 + CCLDNOTICE = 'HDFFF2C0' # 실시간 해외선물옵션 체결내역발생통보 + +import talib as ta + + +class BasicPlan: + + def __init__(self, stock_code, window=20): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self._prev_ma = None + + def push(self, value): + self._queue.append(value) + ma = sum(self._queue) / len(self._queue) + diff = ma - self._prev_ma if self._prev_ma is not None else None + self._prev_ma = ma + + print(f"{self._stock_code}****** value: {value}, MA: {ma}, diff: {diff}...") + +class RSI_ST: # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + def __init__(self, stock_code, window=21): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self.rsi_period = window + + def eval(self): + # dftt = getStreamdDF(self._stock_code) + # print(self) + dftt = contract_sub_df.get(self._stock_code).copy() + dftt = dftt.set_index(['TICK_HOUR']) + dftt['LAST_PRICE'] = pd.to_numeric(dftt['LAST_PRICE'], errors='coerce').convert_dtypes() + np_closes = np.array(dftt['LAST_PRICE'], dtype=np.float64) + rsi = ta.RSI(np_closes, self.rsi_period) + + last_rsi = rsi[-1] + + if last_rsi < 30: + print(f"({self._stock_code})[BUY] ***RSI: {last_rsi}") # 통상적으로 RSI가 30 이하면 과매도 상태인 것으로 판단하고 시장이 과도하게 하락했음을 나타냄 + elif last_rsi < 70 and last_rsi >= 30: + print(f"({self._stock_code})[N/A] ***RSI: {last_rsi}") + elif last_rsi >= 70: + print(f"({self._stock_code})[SELL] ***RSI: {last_rsi}") # 통상적으로 RSI가 70 이상이면 과매수 상태로 간주하고 시장이 과열되었을 가능성이 있음을 나타냄 + else: + print(self._stock_code) + + +_today__ = datetime.date.today().strftime("%Y%m%d") + +ka.auth() + +__DEBUG__ = False # True + +# 실시간 해외주식 계좌체결통보 복호화를 위한 부분 - start +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + + +# AES256 DECODE: Copied from KIS Developers Github sample code +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 실시간 해외주식 계좌체결통보 복호화를 위한 부분 - end + + +contract_sub_df = dict() # 실시간 해외주식 체결 결과를 종목별로 저장하기 위한 container +tr_plans = dict() # 실시간 해외주식 체결 값에 따라 무언가를 수행할 Class 를 저장하기 위한 container +excg_dict = { + 'NYS' : 'NYSE', #미국뉴욕 + 'NAS' : 'NASD', #미국나스닥 + 'AMS' : 'AMEX', #미국아멕스 + 'TSE' : 'TKSE', #일본도쿄 + 'HKS' : 'SEHK', #홍콩 + 'SHS' : 'SHAA', #중국상해 + 'SZS' : 'SZAA', #중국심천 + 'HSX' : 'VNSE', #베트남호치민, + 'HNX' : 'HASE', #베트남하노이 + 'BAY' : 'NYSE', #미국뉴욕(주간) + 'BAQ' : 'NASD', #미국나스닥(주간), + 'BAA' : 'AMEX' #미국아멕스(주간) +} + + +#reserved_cols = ['TICK_HOUR', 'STCK_PRPR', 'ACML_VOL'] # 실시간 해외주식 체결 중 사용할 수신시간, 현재가, 누적거래량 만 추출하기 위한 column 정의 +reserved_cols = ['TICK_HOUR', 'LAST_PRICE', 'VOL'] # 실시간 해외선물옵션 체결 중 사용할 column 만 추출하기 위한 column 정의 + +# 해외선물옵션 실시간체결가 column header +contract_cols = ['SERIES_CD', # 종목코드 * 각 항목사이에는 구분자로 ^ 사용, 모든 데이터타입은 STRING으로 변환되어 PUSH 처리됨' + 'BSNS_DATE', # 영업일자 + 'MRKT_OPEN_DATE', # 장개시일자 + 'MRKT_OPEN_TIME', # 장개시시각 + 'MRKT_CLOSE_DATE', # 장종료일자 + 'MRKT_CLOSE_TIME', # 장종료시각 + 'PREV_PRICE', # 전일종가 ※ 전일종가, 체결가격, 전일대비가, 시가, 고가, 저가 ※ FFCODE.MST(해외선물종목마스터 파일)의 SCALCDESZ(계산 소수점) 값 참고 + 'RECV_DATE', # 수신일자 + 'TICK_HOUR', # 수신시각 ※ 수신시각(RECV_TIME) = 실제 체결시각 ★ pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 'KHMS' 한국시간 + 'ACTIVE_FLAG', # 본장_전산장구분 + 'LAST_PRICE', # 체결가격 + 'LAST_QNTT', # 체결수량 + 'PREV_DIFF_PRICE', # 전일대비가 + 'PREV_DIFF_RATE', # 등락률 + 'OPEN_PRICE', # 시가 + 'HIGH_PRICE', # 고가 + 'LOW_PRICE', # 저가 + 'VOL', # 누적거래량 + 'PREV_SIGN', # 전일대비부호 + 'QUOTSIGN', # 체결구분 ※ 2:매수체결 5:매도체결 + 'RECV_TIME2', # 수신시각2 만분의일초 + 'PSTTL_PRICE', # 전일정산가 + 'PSTTL_SIGN', # 전일정산가대비 + 'PSTTL_DIFF_PRICE', # 전일정산가대비가격 + 'PSTTL_DIFF_RATE'] # 전일정산가대비율 + +# 실시간 해외선물옵션호가 column eader +bid_ask_cols = ['SERIES_CD', # 종목코드 '각 항목사이에는 구분자로 ^ 사용,모든 데이터타입은 STRING으로 변환되어 PUSH 처리됨' + 'RECV_DATE', # 수신일자 + 'TICK_HOUR', # 수신시각 ※ 수신시각(RECV_TIME) = 실제 체결시각 ★ pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 'KHMS' 한국시간 + 'PREV_PRICE', # 전일종가 ※ 전일종가, 매수1호가~매도5호가 ※ FFCODE.MST(해외선물종목마스터 파일)의 SCALCDESZ(계산 소수점) 값 참고 + 'BID_QNTT_1', # 매수1수량 + 'BID_NUM_1', # 매수1번호 + 'BID_PRICE_1', # 매수1호가 + 'ASK_QNTT_1', # 매도1수량 + 'ASK_NUM_1', # 매도1번호 + 'ASK_PRICE_1', # 매도1호가 + 'BID_QNTT_2', # 매수2수량 + 'BID_NUM_2', # 매수2번호 + 'BID_PRICE_2', # 매수2호가 + 'ASK_QNTT_2', # 매도2수량 + 'ASK_NUM_2', # 매도2번호 + 'ASK_PRICE_2', # 매도2호가 + 'BID_QNTT_3', # 매수3수량 + 'BID_NUM_3', # 매수3번호 + 'BID_PRICE_3', # 매수3호가 + 'ASK_QNTT_3', # 매도3수량 + 'ASK_NUM_3', # 매도3번호 + 'ASK_PRICE_3', # 매도3호가 + 'BID_QNTT_4', # 매수4수량 + 'BID_NUM_4', # 매수4번호 + 'BID_PRICE_4', # 매수4호가 + 'ASK_QNTT_4', # 매도4수량 + 'ASK_NUM_4', # 매도4번호 + 'ASK_PRICE_4', # 매도4호가 + 'BID_QNTT_5', # 매수5수량 + 'BID_NUM_5', # 매수5번호 + 'BID_PRICE_5', # 매수5호가 + 'ASK_QNTT_5', # 매도5수량 + 'ASK_NUM_5', # 매도5번호 + 'ASK_PRICE_5', # 매도5호가 + 'STTL_PRICE'] # 전일정산가 + +# 실시간 계좌주문내역발생통보 column header +ordernotice_cols = ['USER_ID', # 유저ID 각 항목사이에는 구분자로 ^ 사용, 모든 데이터타입은 STRING으로 변환되어 PUSH 처리됨' + 'ACCT_NO', # 계좌번호 + 'ORD_DT', # 주문일자 + 'ODNO', # 주문번호 + 'ORGN_ORD_DT', # 원주문일자 + 'ORGN_ODNO', # 원주문번호 + 'SERIES', # 종목명 + 'RVSE_CNCL_DVSN_CD',# 정정취소구분코드 해당없음 : 00 , 정정 : 01 , 취소 : 02 + 'SLL_BUY_DVSN_CD', # 매도매수구분코드 01 : 매도, 02 : 매수 + 'CPLX_ORD_DVSN_CD', # 복합주문구분코드 0 (HEDGE청산만 이용) + 'PRCE_TP', # 가격구분코드', # 1:LIMIT, 2:MARKET, 3:STOP(STOP가격시 시장가) + 'FM_EXCG_RCIT_DVSN_CD', # FM거래소접수구분코드 01:접수전, 02:응답, 03:거부 + 'ORD_QTY', # 주문수량 + 'FM_LMT_PRIC', # FMLIMIT가격 + 'FM_STOP_ORD_PRIC', # FMSTOP주문가격 + 'TOT_CCLD_QTY', # 총체결수량 + 'TOT_CCLD_UV', # 총체결단가 + 'ORD_REMQ', # 잔량 + 'FM_ORD_GRP_DT', # FM주문그룹일자 주문일자(ORD_DT)와 동일 + 'ORD_GRP_STNO', # 주문그룹번호 + 'ORD_DTL_DTIME', # 주문상세일시 + 'OPRT_DTL_DTIME', # 조작상세일시 + 'WORK_EMPL', # 주문자 + 'CRCY_CD', # 통화코드 + 'LQD_YN', # 청산여부(Y/N) + 'LQD_LMT_PRIC', # 청산LIMIT가격 + 'LQD_STOP_PRIC', # 청산STOP가격 + 'TRD_COND', # 체결조건코드 + 'TERM_ORD_VALD_DTIME', # 기간주문유효상세일시 + 'SPEC_TP', # 계좌청산유형구분코드 + 'ECIS_RSVN_ORD_YN', # 행사예약주문여부 + 'FUOP_ITEM_DVSN_CD',# 선물옵션종목구분코드 + 'AUTO_ORD_DVSN_CD'] # 자동주문 전략구분 + +# 실시간 계좌체결내역발생통보 column header +ccldnotice_cols = ['USER_ID', # 유저ID '각 항목사이에는 구분자로 ^ 사용, 모든 데이터타입은 STRING으로 변환되어 PUSH 처리됨' + 'ACCT_NO', # 계좌번호 + 'ORD_DT', # 주문일자 + 'ODNO', # 주문번호 + 'ORGN_ORD_DT', # 원주문일자 + 'ORGN_ODNO', # 원주문번호 + 'SERIES', # 종목명 + 'RVSE_CNCL_DVSN_CD',# 정정취소구분코드', # 해당없음 : 00 , 정정 : 01 , 취소 : 02 + 'SLL_BUY_DVSN_CD', # 매도매수구분코드', # 01 : 매도, 02 : 매수 + 'CPLX_ORD_DVSN_CD', # 복합주문구분코드', # 0 (HEDGE청산만 이용) + 'PRCE_TP', # 가격구분코드 + 'FM_EXCG_RCIT_DVSN_CD', # FM거래소접수구분코드 + 'ORD_QTY', # 주문수량 + 'FM_LMT_PRIC', # FMLIMIT가격 + 'FM_STOP_ORD_PRIC', # FMSTOP주문가격 + 'TOT_CCLD_QTY', # 총체결수량', # 동일한 주문건에 대한 누적된 체결수량 (하나의 주문건에 여러건의 체결내역 발생) + 'TOT_CCLD_UV', # 총체결단가 + 'ORD_REMQ', # 잔량 + 'FM_ORD_GRP_DT', # FM주문그룹일자 + 'ORD_GRP_STNO', # 주문그룹번호 + 'ORD_DTL_DTIME', # 주문상세일시 + 'OPRT_DTL_DTIME', # 조작상세일시 + 'WORK_EMPL', # 주문자 + 'CCLD_DT', # 체결일자 + 'CCNO', # 체결번호 + 'API_CCNO', # API 체결번호 + 'CCLD_QTY', # 체결수량', # 매 체결 단위 체결수량임 (여러건 체결내역 누적 체결수량인 총체결수량과 다름) + 'FM_CCLD_PRIC', # FM체결가격 + 'CRCY_CD', # 통화코드 + 'TRST_FEE', # 위탁수수료 + 'ORD_MDIA_ONLINE_YN', # 주문매체온라인여부 + 'FM_CCLD_AMT', # FM체결금액 + 'FUOP_ITEM_DVSN_CD']# 선물옵션종목구분코드 + + +# 웹소켓 접속키 발급 +def get_approval(): + url = ka.getTREnv().my_url + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": ka.getTREnv().my_app, + "secretkey": ka.getTREnv().my_sec} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +_connect_key = get_approval() # websocker 연결Key +_iv = None # for 복호화 +_ekey = None # for 복호화 +executed_df = pd.DataFrame(data=None, columns=contract_cols) # 체결통보 저장용 DF + + +# added_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(체결통보) +def _build_message(app_key, tr_id, added_data, tr_type='1'): + _h = { + "approval_key": app_key, + "custtype": 'P', + "tr_type": tr_type, + "content-type": "utf-8" + } + _inp = { + "tr_id": tr_id, + "tr_key": added_data + } + _b = { + "input": _inp + } + _data = { + "header": _h, + "body": _b + } + + d1 = json.dumps(_data) + + return d1 + + +# sub_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(실시간 계좌체결발생통보) +def subscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록 + ws.send(_build_message(app_key, sub_type, sub_data), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +def unsubscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록해제 + ws.send(_build_message(app_key, sub_type, sub_data, '2'), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +# streaming data 를 이용해 주어진 bar 크기(예: 1분, 5분 등)의 OHLC(x분봉) 데이터프레임을 반환한다. +# 이때 streamign data 는 websocket client 가 시작한 다음부터 지금까지의 해당 종목의 가격 정보를 의미한다. +# ** 동시호가 시간은 OHLC data 가 모두 NA 가 된다. +def getStreamdDF(stock_code, bar_sz='1Min'): + df3 = contract_sub_df.get(stock_code).copy() + df3 = df3.set_index(['TICK_HOUR']) + df3['LAST_PRICE'] = pd.to_numeric(df3['LAST_PRICE'], errors='coerce').convert_dtypes() + df3 = df3['LAST_PRICE'].resample(bar_sz).ohlc() + + return df3 + +# 수신데이터 파싱 +def _dparse(data): + global executed_df + d1 = data.split("|") + dp_ = None + + hcols = [] + + if len(d1) >= 4: + tr_id = d1[1] + if tr_id == KIS_WSReq.CONTRACT: # 실시간체결 + hcols = contract_cols + elif tr_id == KIS_WSReq.BID_ASK: # 해외선물옵션 실시간호가 + hcols = bid_ask_cols + elif tr_id == KIS_WSReq.ORDERNOTICE: # 주문내역발생통보 + hcols = ordernotice_cols + elif tr_id == KIS_WSReq.CCLDNOTICE: # 체결내역발생통보 + hcols = ccldnotice_cols + else: + pass + + if tr_id in (KIS_WSReq.CONTRACT, KIS_WSReq.BID_ASK): # 실시간체결, 실시간호가 + dp_ = pd.read_csv(StringIO(d1[3]), header=None, sep='^', names=hcols, dtype=object) # 수신데이터 parsing + + print(dp_) # 실시간체결, 실시간호가 수신 데이터 파싱 결과 확인 + + dp_['TICK_HOUR'] = _today__ + dp_['TICK_HOUR'] # 수신시간 + dp_['TICK_HOUR'] = pd.to_datetime(dp_['TICK_HOUR'], format='%Y%m%d%H%M%S', errors='coerce') + else: # 실시간 계좌체결발생통보는 암호화되어서 수신되므로 복호화 과정이 필요 + dp_ = pd.read_csv(StringIO(aes_cbc_base64_dec(_ekey, _iv, d1[3])), header=None, sep='^', names=hcols, # 수신데이터 parsing 및 복호화 + dtype=object) + + print(dp_) # 실시간 계좌체결발생통보 수신 파싱 결과 확인 + + if __DEBUG__: print(f'***EXECUTED CCLDNOTICE [{dp_.to_string(header=False, index=False)}]') + + if tr_id == KIS_WSReq.CONTRACT: # 실시간 체결 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + stock_code = dp_[dp_.columns[0]].values.tolist()[0] + df2_ = dp_[reserved_cols] + # dft_ = pd.concat([contract_sub_df.get(stock_code), df2_], axis=0, ignore_index=True) + # 선택된 열이 비어 있거나 모든 값이 NA인지 확인 + selected_df = contract_sub_df.get(stock_code) + if selected_df is not None and not selected_df.dropna().empty: + dft_ = pd.concat([selected_df, df2_], axis=0, ignore_index=True) + else: + dft_ = df2_ + contract_sub_df[stock_code] = dft_ + ######### 이 부분에서 로직을 적용한 후 매수/매도를 수행하면 될 듯!! + + val1 = dp_['LAST_PRICE'].tolist()[0] + tr_plans[stock_code].push(float(val1)) # 이동평균값 활용 + # tr_plans[stock_code].eval() # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 활용 + stock_df = dp_['SERIES_CD'].tolist()[0] # 종목코드 + # [해외선물옵션] 주문/계좌 > 해외선물옵션 주문가능조회 (선물옵션구분fuop_dvsn) + # 선물옵션구분 00:전체 / 01:선물 / 02:옵션 + rt_data = kb.get_overseasfuopt_inquire_psamount(itm_no=stock_df, dvsn="00", pric=0, ordyn="") + ord_qty = rt_data.loc[0, 'fm_new_ord_psbl_qty'] # 신규주문가능수량 총주문가능수량(fm_tot_ord_psbl_qty), 시장가총주문가능수량(fm_mkpr_tot_ord_psbl_qty) + print("[주문가능수량!] : " + ord_qty) + + ########################################################### + # [해외선물옵션] 주문/계좌 > 해외선물옵션주문 (종목번호<6자리 5자리> + 매수매도구분ord_dv + 가격구분dvsn + 주문수량qty + 주문가격limt_pric + 주문가격stop_pric) + # 매수매도구분ord_dv 01 : 매도, 02 : 매수 # 가격구분dvsn : 1.지정, 2. 시장, 3. STOP, 4 S/L + # 주문가격limt_pric : 지정가인 경우 가격 입력 * 시장가, STOP주문인 경우, 빈칸("") 입력 + # 주문가격stop_pric : STOP 주문 가격 입력 * 시장가, 지정가인 경우, 빈칸("") 입력 + # rt_data = kb.get_overseasfuopt_order(itm_no=stock_df, ord_dv="02", dvsn="1", qty=ord_qty, limt_pric=val1, stop_pric=0) + # print(rt_data.ORD_DT + "+" + rt_data.ODNO) # 주문일자+주문접수번호 + + print("매수/매도 조건 주문 : " + val1) + ########################################################### + + elif tr_id == KIS_WSReq.CCLDNOTICE: # 체결통보의 경우, 일단 executed_df 에만 저장해 둠 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + executed_df = pd.concat([executed_df, dp_], axis=0, ignore_index=True) + + else: + pass + else: + print("Data length error...{data}") + + +def _get_sys_resp(data): + global _iv + global _ekey + + isPingPong = False + isUnSub = False + isOk = False + tr_msg = None + tr_key = None + + rdic = json.loads(data) + + tr_id = rdic['header']['tr_id'] + if tr_id != "PINGPONG": tr_key = rdic['header']['tr_key'] + if rdic.get("body", None) is not None: + isOk = True if rdic["body"]["rt_cd"] == "0" else False + tr_msg = rdic["body"]["msg1"] + # 복호화를 위한 key 를 추출 + if 'output' in rdic["body"]: + _iv = rdic["body"]["output"]["iv"] + _ekey = rdic["body"]["output"]["key"] + isUnSub = True if tr_msg[:5] == "UNSUB" else False + else: + isPingPong = True if tr_id == "PINGPONG" else False + + nt2 = namedtuple('SysMsg', ['isOk', 'tr_id', 'tr_key', 'isUnSub', 'isPingPong']) + d = { + 'isOk': isOk, + 'tr_id': tr_id, + 'tr_key': tr_key, + 'isUnSub': isUnSub, + 'isPingPong': isPingPong + } + + return nt2(**d) + + +def on_data(ws, data, resp_type, data_continu): + # print(f"On data => {resp_type}, {data_continu}, {data}") #return only 1, True + pass + + +def on_message(ws, data): + if data[0] in ('0', '1'): # 실시간체결 or 실시간호가 + _dparse(data) + else: # system message or PINGPONG + rsp = _get_sys_resp(data) + if rsp.isPingPong: + ws.send(data, websocket.ABNF.OPCODE_PING) + else: + if (not rsp.isUnSub and rsp.tr_id == KIS_WSReq.CONTRACT): + contract_sub_df[rsp.tr_key] = pd.DataFrame(columns=reserved_cols) + + ######################################################################## + #### 이 부분에서 전략을 수행할 class 를 등록한다. + #### 실제 주문 실행은 _dparse 함수에서 처리 + tr_plans[rsp.tr_key] = BasicPlan(rsp.tr_key) # 이동 평균선 계산 (웹소켓 프로그램 실행시 수집된 데이터만 반영) + # tr_plans[rsp.tr_key] = RSI_ST(rsp.tr_key) # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + ######################################################################## + + elif (rsp.isUnSub): + del (contract_sub_df[rsp.tr_key]) + else: + print(rsp) + + +def on_error(ws, error): + print('error=', error) + +def on_close(ws, status_code, close_msg): + print('on_close close_status_code=', status_code, " close_msg=", close_msg) + + +def on_open(ws): + # stocks 에는 40개까지만 가능 + stocks = ('6EV24', '6EU24', 'ESU24', 'OESU24 C5450', 'ONQU24 C18900', 'OESU24 C6000') # 해외선물옵션 + for scode in stocks: + subscribe(ws, KIS_WSReq.BID_ASK, _connect_key, scode) # 실시간 호가(미국) + subscribe(ws, KIS_WSReq.CONTRACT, _connect_key, scode) # 실시간 체결 + + # unsubscribe(ws, KIS_WSReq.CONTRACT, _connect_key, "RBAQAAPL") #실시간 체결 연결해제 + # subscribe(ws, KIS_WSReq.CONTRACT, _connect_key, "RBAQAAPL") #실시간 체결 연결등록 + # unsubscribe(ws, KIS_WSReq.BID_USA, _connect_key, "RBAQAAPL") #실시간 호가(미국) 연결해제 + # subscribe(ws, KIS_WSReq.BID_USA, _connect_key, "RBAQAAPL") #실시간 호가(미국) 연결등록 + # 실시간 계좌체결발생통보를 등록한다. 계좌체결발생통보 결과는 executed_df 에 저장된다. + #subscribe(ws, KIS_WSReq.ORDERNOTICE, _connect_key, "HTS ID 입력") # "HTS ID 입력 하세요" 계좌주문내역발생통보 + subscribe(ws, KIS_WSReq.CCLDNOTICE, _connect_key, "HTS ID 입력") # "HTS ID 입력 하세요" 계좌체결내역발생통보 + + +ws = websocket.WebSocketApp("ws://ops.koreainvestment.com:21000/tryitout", + on_open=on_open, on_message=on_message, on_error=on_error, on_data=on_data) + +ws.run_forever() # 실시간 웹소켓 연결 작동 diff --git a/한국투자증권(API)/legacy/Sample01/kis_ovrseastk.py b/한국투자증권(API)/legacy/Sample01/kis_ovrseastk.py new file mode 100644 index 0000000..14726cf --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_ovrseastk.py @@ -0,0 +1,1581 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" +import kis_auth as kis + +import time, copy +import requests +import json + +import pandas as pd + +from collections import namedtuple +from datetime import datetime +from pandas import DataFrame + + +#====| [해외주식] 주문/계좌 |============================================================================================================================ + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문[v1_해외주식-001] +# +# * 모의투자의 경우, 모든 해외 종목 매매가 지원되지 않습니다. 일부 종목만 매매 가능한 점 유의 부탁드립니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# * 해외 거래소 운영시간 외 API 호출 시 애러가 발생하오니 운영시간을 확인해주세요. +# * 해외 거래소 운영시간(한국시간 기준) +# 1) 미국 : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) +# 2) 일본 : (오전) 09:00 ~ 11:30, (오후) 12:30 ~ 15:00 +# 3) 상해 : 10:30 ~ 16:00 +# 4) 홍콩 : (오전) 10:30 ~ 13:00, (오후) 14:00 ~ 17:00 +# +# ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. +# (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) +# +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_order(ord_dv="", excg_cd="", itm_no="", qty=0, unpr=0, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식주문(현금) + url = '/uapi/overseas-stock/v1/trading/order' + + if ord_dv == "buy": + if excg_cd in ("NASD","NYSE","AMEX"): + tr_id = "TTTT1002U" # 미국 매수 주문 [모의투자] VTTT1002U + elif excg_cd == "SHEK": + tr_id = "TTTS1002U" # 홍콩 매수 주문 [모의투자] VTTS1002U + elif excg_cd == "SHAA": + tr_id = "TTTS0202U" # 중국상해 매수 주문 [모의투자] VTTS0202U + elif excg_cd == "SZAA": + tr_id = "TTTS0305U" # 중국심천 매수 주문 [모의투자] VTTS0305U + elif excg_cd == "TKSE": + tr_id = "TTTS0308U" # 일본 매수 주문 [모의투자] VTTS0308U + elif excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0311U" # 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0311U + else: + print("해외거래소코드 확인요망!!!") + return None + elif ord_dv == "sell": + if excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1006U" # 미국 매도 주문 [모의투자] VTTT1006U + elif excg_cd == "SHEK": + tr_id = "TTTS1001U" # 홍콩 매도 주문 [모의투자] VTTS1001U + elif excg_cd == "SHAA": + tr_id = "TTTS1005U" # 중국상해 매도 주문 [모의투자] VTTS1005U + elif excg_cd == "SZAA": + tr_id = "TTTS0304U" # 중국심천 매도 주문 [모의투자] VTTS0304U + elif excg_cd == "TKSE": + tr_id = "TTTS0307U" # 일본 매도 주문 [모의투자] VTTS0307U + elif excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0310U" # 베트남(하노이,호치민) 매도 주문 [모의투자] VTTS0311U + else: + print("해외거래소코드 확인요망!!!") + return None + else: + print("매수/매도 구분 확인요망!") + return None + + if itm_no == "": + print("주문종목번호(상품번호) 확인요망!!!") + return None + + if qty == 0: + print("주문수량 확인요망!!!") + return None + + if unpr == 0: + print("해외주문단가 확인요망!!!") + return None + + if ord_dv == "buy": + sll_type = "" + elif ord_dv == "sell": + sll_type = "00" + else: + print("매수/매도 구분 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 + # NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "PDNO": itm_no, # 종목코드 + "ORD_DVSN": "00", # 주문구분 00:지정가, 01:시장가, 02:조건부지정가 나머지주문구분 API 문서 참조 + "ORD_QTY": str(int(qty)), # 주문주식수 + "OVRS_ORD_UNPR": str(int(unpr)), # 해외주문단가 + "SLL_TYPE": sll_type, # 판매유형 + "ORD_SVR_DVSN_CD": "0" # 주문서버구분코드l + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 정정취소주문[v1_해외주식-003] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_order_rvsecncl(excg_cd="", itm_no="", orgn_odno="", rvse_cncl_dvsn_cd="", qty=0, unpr=0, tr_cont="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/order-rvsecncl' + + if excg_cd in ("NASD", "NYSE", "AMEX"): + tr_id = "TTTT1004U" # 미국 매수 주문 [모의투자] VTTT1004U + elif excg_cd == "SHEK": + tr_id = "TTTS1003U" # 홍콩 매수 주문 [모의투자] VTTS1003U + elif excg_cd == "SHAA": + tr_id = "TTTS0302U" # 중국상해 매수 주문 [모의투자] VTTS0302U + elif excg_cd == "SZAA": + tr_id = "TTTS0306U" # 중국심천 매수 주문 [모의투자] VTTS0306U + elif excg_cd == "TKSE": + tr_id = "TTTS0309U" # 일본 매수 주문 [모의투자] VTTS0309U + elif excg_cd in ("HASE", "VNSE"): + tr_id = "TTTS0312U" # 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0312U + else: + print("해외거래소코드 확인요망!!!") + return None + + if orgn_odno == "": + print("원주문번호 확인요망!!!") + return None + + if not rvse_cncl_dvsn_cd in ["01","02"]: + print("정정취소구분코드 확인요망!!!") # 정정:01. 취소:02 + return None + + if rvse_cncl_dvsn_cd == "01" and unpr == 0: + print("주문단가 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "PDNO": itm_no, # 종목번호(상품번호) + "ORGN_ODNO": orgn_odno, # 원주문번호 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, # 정정 : 01, 취소 : 02 + "ORD_QTY": str(int(qty)), # 주문수량 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + "OVRS_ORD_UNPR": str(int(unpr)), # 주문단가 [정정] 정정주문 1주당 가격 [취소] "0" 설정 + "MGCO_APTM_ODNO": "", # 운용사지정주문번호 + "ORD_SVR_DVSN_CD": "0" # 주문서버구분코드 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 전부취소주문[v1_해외주식-003] (검증진행중) +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_order_allcncl(excg_cd="", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-nccs' + tr_id = "TTTS3018R" # 모의투자 VTTS3018R + + t_cnt = 0 + + if excg_cd == "": # 해외거래소코드 필수 + print("해외거래소코드 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "SORT_SQN": "DS", # DS : 정순, 그외 : 역순 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("미체결내역 없음") + else: + print("미체결내역 있음") + + for index, row in current_data.iterrows(): + print(row['odno']) + r_odno = row['odno'] + res_cncl = get_overseas_order_rvsecncl(excg_cd="NASD", itm_no="", orgn_odno=r_odno, rvse_cncl_dvsn_cd="02") + print(res_cncl) + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_order_allcncl(excg_cd, itm_no, "N", FK100, NK100, dataframe) + + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미체결내역[v1_해외주식-005] +# 접수된 해외주식 주문 중 체결되지 않은 미체결 내역을 조회하는 API입니다. +# 실전계좌의 경우, 한 번의 호출에 최대 40건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# ※ 해외 거래소 운영시간(한국시간 기준) +# 1) 미국 : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) +# 2) 일본 : (오전) 09:00 ~ 11:30, (오후) 12:30 ~ 15:00 +# 3) 상해 : 10:30 ~ 16:00 +# 4) 홍콩 : (오전) 10:30 ~ 13:00, (오후) 14:00 ~ 17:00 +############################################################################################## +# 해외주식 미체결내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_nccs(excg_cd="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-nccs' + tr_id = "TTTS3018R" # 모의투자 VTTS3018R + + t_cnt = 0 + + if excg_cd == "": # 해외거래소코드 필수 + print("해외거래소코드 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "SORT_SQN": "DS", # DS : 정순, 그외 : 역순 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("미체결내역 없음") + else: + print("미체결내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_inquire_nccs(excg_cd, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고_현황 [v1_해외주식-006] +# 해외주식 잔고를 조회하는 API 입니다. +# 한국투자 HTS(eFriend Plus) > [7600] 해외주식 종합주문 화면의 좌측 하단 '실시간잔고' 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# 다만 미국주간거래 가능종목에 대해서는 frcr_evlu_pfls_amt(외화평가손익금액), evlu_pfls_rt(평가손익율), ovrs_stck_evlu_amt(해외주식평가금액), now_pric2(현재가격2) 값이 HTS와는 상이하게 표출될 수 있습니다. +# (주간시간 시간대에 HTS는 주간시세로 노출, API로는 야간시세로 노출) +# +# 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# * 미니스탁 잔고는 해당 API로 확인이 불가합니다. +############################################################################################## +# 해외주식 잔고 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_balance(excg_cd="", crcy_cd="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-balance' + tr_id = "TTTS3012R" # 모의투자 VTTS3012R + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "TR_CRCY_CD": crcy_cd, # 거래통화코드 USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output2, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 잔고 내역[v1_해외주식-006] +# 해외주식 잔고를 조회하는 API 입니다. +# 한국투자 HTS(eFriend Plus) > [7600] 해외주식 종합주문 화면의 좌측 하단 '실시간잔고' 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# 다만 미국주간거래 가능종목에 대해서는 frcr_evlu_pfls_amt(외화평가손익금액), evlu_pfls_rt(평가손익율), ovrs_stck_evlu_amt(해외주식평가금액), now_pric2(현재가격2) 값이 HTS와는 상이하게 표출될 수 있습니다. +# (주간시간 시간대에 HTS는 주간시세로 노출, API로는 야간시세로 노출) +# +# 실전계좌의 경우, 한 번의 호출에 최대 100건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# * 미니스탁 잔고는 해당 API로 확인이 불가합니다. +############################################################################################## +# 해외주식 잔고 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_balance_lst(excg_cd="", crcy_cd="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-balance' + tr_id = "TTTS3012R" # 모의투자 VTTS3012R + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "TR_CRCY_CD": crcy_cd, # 거래통화코드 USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_inquire_balance_lst(excg_cd, crcy_cd, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 주문체결내역[v1_해외주식-007] +# 일정 기간의 해외주식 주문 체결 내역을 확인하는 API입니다. +# 실전계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. +# 모의계좌의 경우, 한 번의 호출에 최대 15건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# ※ 해외 거래소 운영시간(한국시간 기준) +# 1) 미국 : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) +# 2) 일본 : (오전) 09:00 ~ 11:30, (오후) 12:30 ~ 15:00 +# 3) 상해 : 10:30 ~ 16:00 +# 4) 홍콩 : (오전) 10:30 ~ 13:00, (오후) 14:00 ~ 17:00 +############################################################################################## +# 해외주식 주문체결내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_ccnl(st_dt="", ed_dt="", ord_dv="00", ccld_dv="00", excg_cd="%", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-ccnl' + tr_id = "TTTS3035R" # 모의투자 VTTS3035R + + t_cnt = 0 + + if st_dt =="": + st_dt = datetime.today().strftime("%Y%m%d") # 주문내역조회 시작일자 값이 없으면 현재일자 + + if ed_dt =="": + ed_dt = datetime.today().strftime("%Y%m%d") # 주문내역조회 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "PDNO": "%", # 전종목일 경우 "%" 입력 ※ 모의투자계좌의 경우 ""(전체 조회)만 가능 + "ORD_STRT_DT": st_dt, # YYYYMMDD 형식 (현지시각 기준) + "ORD_END_DT": ed_dt, # YYYYMMDD 형식 (현지시각 기준) + "SLL_BUY_DVSN": ord_dv, # 매도매수구분 00:전체,01:매도,02:매수 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + "CCLD_NCCS_DVSN": ccld_dv, # 체결미체결구분 00:전체,01:체결,02:미체결 ※ 모의투자계좌의 경우 "00"(전체 조회)만 가능 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드, 전종목일 경우 "%" 입력, NASD:미국시장 전체(나스닥,뉴욕,아멕스),NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "SORT_SQN": "DS", # DS:정순,AS:역순, ※ 모의투자계좌의 경우 정렬순서 사용불가(Default : DS(정순)) + "ORD_DT": "", # "" (Null 값 설정) + "ORD_GNO_BRNO": "", # "" (Null 값 설정) + "ODNO": "", # "" (Null 값 설정) + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + #print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_inquire_ccnl(st_dt, ed_dt, ord_dv, ccld_dv, excg_cd, "N", FK100, NK100, dataframe) + + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고[v1_해외주식-008] +# 해외주식 잔고를 체결 기준으로 확인하는 API 입니다. +# +# HTS(eFriend Plus) [0839] 해외 체결기준잔고 화면을 API로 구현한 사항으로 화면을 함께 보시면 기능 이해가 쉽습니다. +# +# (※모의계좌의 경우 output3(외화평가총액 등 확인 가능)만 정상 출력됩니다. +# 잔고 확인을 원하실 경우에는 해외주식 잔고[v1_해외주식-006] API 사용을 부탁드립니다.) +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# 해외주식 체결기준현재잔고 유의사항 +# 1. 해외증권 체결기준 잔고현황을 조회하는 화면입니다. +# 2. 온라인국가는 수수료(국내/해외)가 반영된 최종 정산금액으로 잔고가 변동되며, 결제작업 지연등으로 인해 조회시간은 차이가 발생할 수 있습니다. +# - 아시아 온라인국가 : 매매일 익일 08:40 ~ 08:45분 경 +# - 미국 온라인국가 : 당일 장 종료후 08:40 ~ 08:45분 경 +# ※ 단, 애프터연장 참여 신청계좌는 10:30 ~ 10:35분 경(Summer Time : 09:30 ~ 09:35분 경)에 최종 정산금액으로 변동됩니다. +# 3. 미국 현재가 항목은 주간시세 및 애프터시세는 반영하지 않으며, 정규장 마감 후에는 종가로 조회됩니다. +# 4. 온라인국가를 제외한 국가의 현재가는 실시간 시세가 아니므로 주문화면의 잔고 평가금액 등과 차이가 발생할 수 있습니다. +# 5. 해외주식 담보대출 매도상환 체결내역은 해당 잔고화면에 반영되지 않습니다. +# 결제가 완료된 이후 외화잔고에 포함되어 반영되오니 참고하여 주시기 바랍니다. +# 6. 외화평가금액은 당일 최초고시환율이 적용된 금액으로 실제 환전금액과는 차이가 있습니다. +# 7. 미국은 메인 시스템이 아닌 별도 시스템을 통해 거래되므로, 18시 10~15분 이후 발생하는 미국 매매내역은 해당 화면에 실시간으로 반영되지 않으니 하단 내용을 참고하여 안내하여 주시기 바랍니다. +# [외화잔고 및 해외 유가증권 현황 조회] +# - 일반/통합증거금 계좌 : 미국장 종료 + 30분 후 부터 조회 가능 +# 단, 통합증거금 계좌에 한해 주문금액은 외화잔고 항목에 실시간 반영되며, 해외 유가증권 현황은 반영되지 +# 않아 해외 유가증권 평가금액이 과다 또는 과소 평가될 수 있습니다. +# - 애프터연장 신청계좌 : 실시간 반영 +# 단, 시스템정산작업시간(23:40~00:10) 및 거래량이 많은 경우 메인시스템에 반영되는 시간으로 인해 차이가 +# 발생할 수 있습니다. +# ※ 배치작업시간에 따라 시간은 변동될 수 있습니다. +############################################################################################## +# 해외주식 체결기준현재잔고 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_present_balance(dv="03", dvsn="01", natn="000", mkt="00", inqr_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-present-balance' + tr_id = "CTRP6504R" # 모의투자 VTRP6504R + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "WCRC_FRCR_DVSN_CD": dvsn, # 원화외화구분코드 01 : 원화, 02 : 외화 + "NATN_CD": natn, # 국가코드 000 전체, 840 미국, 344 홍콩, 156 중국, 392 일본, 704 베트남 + "TR_MKET_CD": mkt, # 거래시장코드 00:전체 (API문서 참조) + "INQR_DVSN_CD": inqr_dvsn # 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + } + + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + if dv == "01": + current_data = pd.DataFrame(res.getBody().output1) + elif dv == "02": + current_data = pd.DataFrame(res.getBody().output2) + else: + current_data = pd.DataFrame(res.getBody().output3, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 매수가능금액조회[v1_해외주식-014] +# 해외주식 매수가능금액조회 API입니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +############################################################################################## +# 해외주식 매수가능금액조회 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_psamount(dv="03", dvsn="01", natn="000", mkt="00", inqr_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-psamount' + tr_id = "TTTS3007R" # 모의투자 VTTS3007R + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": dvsn, # 원화외화구분코드 01 : 원화, 02 : 외화 + "OVRS_ORD_UNPR": natn, # 국가코드 000 전체, 840 미국, 344 홍콩, 156 중국, 392 일본, 704 베트남 + "ITEM_CD": inqr_dvsn # 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간주문[v1_해외주식-026] +# 해외주식 미국주간주문 API입니다. +# +# * 미국주식 주간거래 시 아래 참고 부탁드립니다. +# . 포럼 > FAQ > 미국주식 주간거래 시 어떤 API를 사용해야 하나요? +# +# * 미국주간거래의 경우, 모든 미국 종목 매매가 지원되지 않습니다. 일부 종목만 매매 가능한 점 유의 부탁드립니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# * 미국주간거래시간 외 API 호출 시 에러가 발생하오니 운영시간을 확인해주세요. +# . 주간거래(장전거래)(한국시간 기준) : 10:00 ~ 18:00 (Summer Time 동일) +# +# * 한국투자증권 해외주식 시장별 매매안내(매매수수료, 거래시간 안내, 결제일 정보, 환전안내) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca050000.jsp +# +# ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. +# (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) +# +# ※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다. +# https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_daytime_order(ord_dv="", excg_cd="", itm_no="", qty=0, unpr=0, tr_cont="", FK100="", NK100="", dataframe=None): # 국내주식주문 > 주식주문(현금) + url = '/uapi/overseas-stock/v1/trading/daytime-order' + + if ord_dv == "buy": + tr_id = "TTTS6036U" # 미국주간매수 + elif ord_dv == "sell": + tr_id = "TTTS6037U" # 미국주간매도 + else: + print("매수매도구분(ord_dv) 확인요망!!!") + return None + + if excg_cd == "": + print("해외거래소코드(excg_cd) 확인요망!!!") + return None + + if itm_no == "": + print("주문종목번호(itm_no 상품번호) 확인요망!!!") + return None + + if qty == 0: + print("주문수량(qty) 확인요망!!!") + return None + + if unpr == 0: + print("해외주문단가(unpr) 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스 + "PDNO": itm_no, # 종목코드 + "ORD_DVSN": "00", # 주문구분 00:지정가 * 주간거래는 지정가만 가능 + "ORD_QTY": str(int(qty)), # 주문주식수 + "OVRS_ORD_UNPR": str(int(unpr)), # 해외주문단가 + "CTAC_TLNO": "", # 연락전화번호 + "MGCO_APTM_ODNO": "", # 운용사지정주문번호 + "ORD_SVR_DVSN_CD": "0" # 주문서버구분코드 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 미국주간정정취소[v1_해외주식-027] +############################################################################################## +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_daytime_order_rvsecncl(excg_cd="", itm_no="", orgn_odno="", rvse_cncl_dvsn_cd="", qty=0, unpr=0, tr_cont="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl' + + tr_id = "TTTS6038U" # 미국주간정정취소 + + if excg_cd == "": + print("해외거래소코드(excg_cd) 확인요망!!!") + return None + + if itm_no == "": + print("주문종목번호(itm_no 상품번호) 확인요망!!!") + return None + + if orgn_odno == "": + print("원주문번호(orgn_odno) 확인요망!!!") + return None + + if not rvse_cncl_dvsn_cd in ["01","02"]: + print("정정취소구분코드(rvse_cncl_dvsn_cd) 확인요망!!!") # 정정:01. 취소:02 + return None + + if rvse_cncl_dvsn_cd == "01" and unpr == 0: + print("주문단가(unpr) 확인요망!!!") + return None + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + "PDNO": itm_no, # 종목번호(상품번호) + "ORGN_ODNO": orgn_odno, # 원주문번호 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + "RVSE_CNCL_DVSN_CD": rvse_cncl_dvsn_cd, # 정정 : 01, 취소 : 02 + "ORD_QTY": str(int(qty)), # 주문수량 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + "OVRS_ORD_UNPR": str(int(unpr)), # 해외주문단가 [정정] 소수점 포함, 1주당 가격 [취소] "0" 설정 + "CTAC_TLNO": "", # 연락전화번호 + "MGCO_APTM_ODNO": "", # 운용사지정주문번호 + "ORD_SVR_DVSN_CD": "0" # 주문서버구분코드 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params, postFlag=True) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익[v1_해외주식-032] +# 해외주식 기간손익 API입니다. +# 한국투자 HTS(eFriend Plus) > [7717] 해외 기간손익 화면의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# +# * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) +# https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp +# +# [해외 기간손익 유의 사항] +# ■ 단순 매체결내역을 기초로 만든 화면으로 매도체결시점의 체결기준 매입단가와 비교하여 손익이 계산됩니다. +# 결제일의 환율과 금액을 기준으로 산출하는 해외주식 양도소득세 계산방식과는 상이하오니, 참고용으로만 활용하여 주시기 바랍니다. +# ■ 기간손익은 매매일 익일부터 조회가능합니다. +# ■ 매입금액/매도금액 원화 환산 시 매도일의 환율이 적용되어있습니다. +# ■ 손익금액의 비용은 "매도비용" 만 포함되어있습니다. 단, 동일 종목의 매수/매도가 동시에 있는 경우에는 해당일 발생한 매수비용도 함께 계산됩니다. +# ■ 담보상환내역은 기간손익화면에 표시되지 많으니 참고하여 주시기 바랍니다. +############################################################################################## +# 해외주식 기간손익 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_period_profit(excg_cd="", crcy="", itm_no="", st_dt="", ed_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-period-profit' + tr_id = "TTTS3039R" + + t_cnt = 0 + + if st_dt =="": + st_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if ed_dt =="": + ed_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + "NATN_CD": "", # 국가코드 공란(Default) + "CRCY_CD": crcy, # 통화코드 공란:전체,USD:미국달러,HKD:홍콩달러,CNY:중국위안화,JPY:일본엔화,VND:베트남동 + "PDNO": itm_no, # 상품번호 공란:전체 + "INQR_STRT_DT": st_dt, # 조회시작일자 YYYYMMDD + "INQR_END_DT": ed_dt, # 조회종료일자 YYYYMMDD + "WCRC_FRCR_DVSN_CD": "02", # 원화외화구분코드 01 : 외화, 02 : 원화 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output2, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 기간손익[v1_해외주식-032] +############################################################################################## +# 해외주식 기간손익 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_period_profit_output1(excg_cd="", crcy="", itm_no="", st_dt="", ed_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-period-profit' + tr_id = "TTTS3039R" + + t_cnt = 0 + + if st_dt =="": + st_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if ed_dt =="": + ed_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + "NATN_CD": "", # 국가코드 공란(Default) + "CRCY_CD": crcy, # 통화코드 공란:전체,USD:미국달러,HKD:홍콩달러,CNY:중국위안화,JPY:일본엔화,VND:베트남동 + "PDNO": itm_no, # 상품번호 공란:전체 + "INQR_STRT_DT": st_dt, # 조회시작일자 YYYYMMDD + "INQR_END_DT": ed_dt, # 조회종료일자 YYYYMMDD + "WCRC_FRCR_DVSN_CD": "02", # 원화외화구분코드 01 : 외화, 02 : 원화 + "CTX_AREA_FK200": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK200": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk200, res.getBody().ctx_area_nk200 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_inquire_period_profit_output1(excg_cd, crcy, itm_no, st_dt, ed_dt, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외증거금 통화별조회 [해외주식-035] +# 해외증거금 통화별조회 API입니다. +# 한국투자 HTS(eFriend Plus) > [7718] 해외주식 증거금상세 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +############################################################################################## +# 해외주식 기간손익 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_foreign_margin(tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/foreign-margin' + tr_id = "TTTC2101R" + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod # 계좌상품코드 2자리 + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output) + dataframe = current_data.loc[current_data.crcy_cd != ""] # 통화코드(crcy_cd) 값이 없는 경우 제외 + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역 [해외주식-063] +# 해외주식 일별거래내역 API입니다. +# 한국투자 HTS(eFriend Plus) > [0828] 해외증권 일별거래내역 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# +# ※ 체결가격, 매매금액, 정산금액, 수수료 원화금액은 국내 결제일까지는 예상환율로 적용되고, 국내 결제일 익일부터 확정환율로 적용됨으로 금액이 변경될 수 있습니다. +# ※ 해외증권 투자 및 업무문의 안내: 한국투자증권 해외투자지원부 02)3276-5300 +############################################################################################## +# 해외주식 일별거래내역 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_period_trans(excg_cd="", dvsn="", itm_no="", st_dt="", ed_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-period-trans' + tr_id = "CTOS4001R" + + t_cnt = 0 + + if st_dt =="": + st_dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + if ed_dt =="": + ed_dt = datetime.today().strftime("%Y%m%d") # 기간손익 종료일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "ERLM_STRT_DT": st_dt, # 조회시작일자 YYYYMMDD + "ERLM_END_DT": ed_dt, # 조회종료일자 YYYYMMDD + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + "PDNO": itm_no, # 상품번호 공란:전체 + "SLL_BUY_DVSN_CD": dvsn, # 매도매수구분코드 00(전체), 01(매도), 02(매수) + "LOAN_DVSN_CD": "", # 대출구분코드 01 : 외화, 02 : 원화 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + # current_data = res.getBody().output # getBody() kis_auth.py 존재 + current_data = pd.DataFrame(res.getBody().output1) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk100, res.getBody().ctx_area_nk100 # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + current_data = pd.DataFrame(dataframe) + cnt = current_data.count() + + # Initialize t_cnt if not already initialized + try: + t_cnt += cnt + except NameError: + t_cnt = cnt + + if t_cnt.empty: + print("잔고내역 없음") + else: + print("잔고내역 있음") + + dataframe = current_data + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_inquire_period_trans(excg_cd, dvsn, itm_no, st_dt, ed_dt, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 일별거래내역합계 [해외주식-063] +############################################################################################## +# 해외주식 일별거래내역합계 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_period_trans_output2(excg_cd="", dvsn="", itm_no="", st_dt="", ed_dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-period-trans' + tr_id = "CTOS4001R" + + t_cnt = 0 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "ERLM_STRT_DT": st_dt, # 조회시작일자 YYYYMMDD + "ERLM_END_DT": ed_dt, # 조회종료일자 YYYYMMDD + "OVRS_EXCG_CD": excg_cd, # 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + "PDNO": itm_no, # 상품번호 공란:전체 + "SLL_BUY_DVSN_CD": dvsn, # 매도매수구분코드 00(전체), 01(매도), 02(매수) + "LOAN_DVSN_CD": "", # 대출구분코드 01 : 외화, 02 : 원화 + "CTX_AREA_FK100": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK100": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + } + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + current_data = pd.DataFrame(res.getBody().output2, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + +############################################################################################## +# [해외주식] 주문/계좌 > 해외주식 결제기준잔고 [해외주식-064] +# 해외주식 결제기준잔고 API입니다. +# 한국투자 HTS(eFriend Plus) > [0829] 해외 결제기준잔고 화면 의 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# +# ※ 적용환율은 당일 매매기준이며, 현재가의 경우 지연된 시세로 평가되므로 실제매도금액과 상이할 수 있습니다. +# ※ 주문가능수량 : 보유수량 - 미결제 매도수량 +# ※ 매입금액 계산 시 결제일의 최초고시환율을 적용하므로, 금일 최초고시환율을 적용하는 체결기준 잔고와는 상이합니다. +# ※ 해외증권 투자 및 업무문의 안내: 한국투자증권 해외투자지원부 02)3276-5300 +############################################################################################## +# 해외주식 결제기준잔고 List를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output API 문서 참조 등 +def get_overseas_inquire_paymt_stdr_balance(dv="03", dt="", dvsn="01", inqr_dvsn="00", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance' + tr_id = "CTRP6010R" + + t_cnt = 0 + + if dt =="": + dt = datetime.today().strftime("%Y%m%d") # 기간손익 시작일자 값이 없으면 현재일자 + + params = { + "CANO": kis.getTREnv().my_acct, # 종합계좌번호 8자리 + "ACNT_PRDT_CD": kis.getTREnv().my_prod, # 계좌상품코드 2자리 + "BASS_DT": dt, # 기준일자(YYYYMMDD) + "WCRC_FRCR_DVSN_CD": dvsn, # 원화외화구분코드 01 : 원화, 02 : 외화 + "INQR_DVSN_CD": inqr_dvsn # 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + } + + + res = kis._url_fetch(url, tr_id, tr_cont, params) + + if str(res.getBody().rt_cd) == "0": + if dv == "01": + current_data = pd.DataFrame(res.getBody().output1) + elif dv == "02": + current_data = pd.DataFrame(res.getBody().output2) + else: + current_data = pd.DataFrame(res.getBody().output3, index=[0]) + dataframe = current_data + else: + print(res.getBody().msg_cd + "," + res.getBody().msg1) + #print(res.getErrorCode() + "," + res.getErrorMessage()) + dataframe = None + + return dataframe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#====| [해외주식] 기본시세 |============================================================================================================================ + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재체결가 +############################################################################################## +def get_overseas_price_quot_price(excd="", itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/price' + tr_id = "HHDFS00000300" # 해외주식 현재체결가 + + params = { + "AUTH": "", # 사용자권한정보 : 사용안함 + "EXCD": excd, # 거래소코드 HKS : 홍콩,NYS : 뉴욕,NAS : 나스닥,AMS : 아멕스,TSE : 도쿄,SHS : 상해,SZS : 심천,SHI : 상해지수 + # SZI : 심천지수,HSX : 호치민,HNX : 하노이,BAY : 뉴욕(주간),BAQ : 나스닥(주간),BAA : 아멕스(주간) + "SYMB": itm_no # 종목번호 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) + + dataframe = current_data + + return dataframe + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 기간별시세 +############################################################################################## +def get_overseas_price_quot_dailyprice(excd="", itm_no="", gubn="", bymd="", modp="0", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/dailyprice' + tr_id = "HHDFS76240000" # 해외주식 기간별시세 + + if bymd is None: + bymd = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "AUTH": "", # (사용안함) 사용자권한정보 + "EXCD": excd, # 거래소코드 HKS : 홍콩,NYS : 뉴욕,NAS : 나스닥,AMS : 아멕스,TSE : 도쿄,SHS : 상해,SZS : 심천,SHI : 상해지수 + # SZI : 심천지수,HSX : 호치민,HNX : 하노이,BAY : 뉴욕(주간),BAQ : 나스닥(주간),BAA : 아멕스(주간) + "SYMB": itm_no, # 종목번호 + "GUBN": gubn, # 일/주/월구분 0:일. 1:주, 2:월 + "BYMD": bymd, # 조회기준일자(YYYYMMDD) ※ 공란 설정 시, 기준일 오늘 날짜로 설정 + "MODP": modp, # 수정주가반영여부 0 : 미반영, 1 : 반영 + "KEYB": "" # (사용안함) NEXT KEY BUFF 응답시 다음값이 있으면 값이 셋팅되어 있으므로 다음 조회시 응답값 그대로 셋팅 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + dataframe = current_data + + return dataframe + +########################################################################### +# [해외주식] 기본시세 > 해외주식 종목/지수/환율기간별시세(일/주/월/년) → 기본정보 +########################################################################### +# 해외주식 종목/지수/환율기간별시세(일/주/월/년) API입니다. +# 해외지수 당일 시세의 경우 지연시세 or 종가시세가 제공됩니다. +# ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. +# 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다. +########################################################################### +def get_overseas_price_quot_inquire_daily_price(div="N", itm_no="", inqr_strt_dt="", inqr_end_dt="", period="D", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-daily-chartprice' + tr_id = "FHKST03030100" # 해외주식 종목/지수/환율기간별시세(일/주/월/년) + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "FID_COND_MRKT_DIV_CODE": div, # 시장 분류 코드 N: 해외지수, X 환율, I: 국채, S:금선물 + "FID_INPUT_ISCD": itm_no, # 종목번호 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드 > 해외주식) + # ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다. + "FID_INPUT_DATE_1": inqr_strt_dt, # 시작일자(YYYYMMDD) + "FID_INPUT_DATE_2": inqr_end_dt, # 종료일자(YYYYMMDD) + "FID_PERIOD_DIV_CODE": period # 기간분류코드 D:일, W:주, M:월, Y:년 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 종목/지수/환율기간별시세(일/주/월/년) → 일자별정보 (최대 30일까지 조회) +############################################################################################## +def get_overseas_price_quot_inquire_daily_chartprice(div="N", itm_no="", inqr_strt_dt="", inqr_end_dt="", period="D", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-daily-chartprice' + tr_id = "FHKST03030100" # 해외주식 종목/지수/환율기간별시세(일/주/월/년) + + if inqr_strt_dt is None: + inqr_strt_dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + if inqr_end_dt is None: + inqr_end_dt = datetime.today().strftime("%Y%m%d") # 종료일자 값이 없으면 현재일자 + + params = { + "FID_COND_MRKT_DIV_CODE": div, # 시장 분류 코드 N: 해외지수, X 환율, I: 국채, S:금선물 + "FID_INPUT_ISCD": itm_no, # 종목번호 ※ 해외주식 마스터 코드 참조 (포럼 > FAQ > 종목정보 다운로드 > 해외주식) + # ※ 해당 API로 미국주식 조회 시, 다우30, 나스닥100, S&P500 종목만 조회 가능합니다. 더 많은 미국주식 종목 시세를 이용할 시에는, 해외주식기간별시세 API 사용 부탁드립니다. + "FID_INPUT_DATE_1": inqr_strt_dt, # 시작일자(YYYYMMDD) + "FID_INPUT_DATE_2": inqr_end_dt, # 종료일자(YYYYMMDD) + "FID_PERIOD_DIV_CODE": period # 기간분류코드 D:일, W:주, M:월, Y:년 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output2) + + dataframe = current_data + + return dataframe + +########################################################################### +# [해외주식] 기본시세 > 해외주식조건검색 → 기본정보 +########################################################################### +# 해외주식 조건검색 API입니다. +# # 현재 조건검색 결과값은 최대 100개까지 조회 가능합니다. 다음 조회(100개 이후의 값) 기능에 대해서는 개선검토 중에 있습니다. +# # ※ 그날 거래량이나 시세 형성이 안된 종목은 해외주식 기간별시세(HHDFS76240000)에서는 조회되지만 +# 해외주식 조건검색(HHDFS76410000)에서 조회되지 않습니다. (EX. NAS AATC) +# +# [미국주식시세 이용시 유의사항] +# ■ 무료 실시간 시세(0분 지연) 제공 +# ※ 무료(매수/매도 각 1호가) : 나스닥 마켓센터에서 거래되는 호가 및 호가 잔량 정보 +# ※ 유료(매수/매도 각 1호가) : 미국 전체 거래소들의 통합 주문체결 및 최우선 호가 +# ■ 무료 실시간 시세 서비스는 유료 실시간 시세 서비스 대비 평균 50% 수준에 해당하는 정보이므로 +# 현재가/호가/순간체결량/차트 등에서 일시적·부분적 차이가 있을 수 있습니다. +# ■ 무료∙유료 모두 미국에 상장된 종목(뉴욕, 나스닥, 아멕스 등)의 시세를 제공하며, 동일한 시스템을 사용하여 주문∙체결됩니다. +# 단, 무료∙유료의 기반 데이터 차이로 호가 및 체결 데이터는 차이가 발생할 수 있고, 이로 인해 발생하는 손실에 대해서 당사가 책임지지 않습니다. +# ■ 무료 실시간 시세 서비스의 시가, 저가, 고가, 종가는 유료 실시간 시세 서비스와 다를 수 있으며, +# 종목별 과거 데이터(거래량, 시가, 종가, 고가, 차트 데이터 등)는 장 종료 후(오후 12시경) 유료 실시간 시세 서비스 데이터와 동일하게 업데이트됩니다. +# ■ 유료 실시간 시세 서비스는 신청 시 1~12개월까지 기간 선택 후 해당 요금을 일괄 납부하며, +# 해지 시 해지한 달의 말일까지 시세 제공 후 남은 기간 해당 금액이 환급되니 유의하시기 바랍니다. +# (출처: 한국투자증권 외화증권 거래설명서 - https://www.truefriend.com/main/customer/guide/Guide.jsp?&cmd=TF04ag010002¤tPage=1&num=64) +########################################################################### +def get_overseas_price_quot_inquire_search(div="02", excd="", pr_st="", pr_en="", rate_st="", rate_en="", vol_st="", vol_en="", + per_st="", per_en="", eps_st="", eps_en="", amt_st="", amt_en="", shar_st="", + shar_en="", valx_st="", valx_en="", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-search' + tr_id = "HHDFS76410000" # [해외주식] 기본시세 > 해외주식조건검색 + + pr_yn = "" + rate_yn = "" + vol_yn = "" + per_yn = "" + eps_yn = "" + amt_yn = "" + shar_yn = "" + valx_yn = "" + if pr_st != "" and pr_en != "": + pr_yn = "1" + if rate_st != "" and rate_en != "": + rate_yn = "1" + if vol_st != "" and vol_en != "": + vol_yn = "1" + if per_st != "" and per_en != "": + per_yn = "1" + if eps_st != "" and eps_en != "": + eps_yn = "1" + if amt_st != "" and amt_en != "": + amt_yn = "1" + if shar_st != "" and shar_en != "": + shar_yn = "1" + if valx_st != "" and valx_en != "": + valx_yn = "1" + + params = { + "AUTH": "", # (사용안함)사용자권한정보(Null 값 설정) + "EXCD": excd, # 거래소코드 NYS:뉴욕, NAS:나스닥, AMS:아멕스, HKS:홍콩, SHS:상해, SZS:심천, HSX:호치민, HNX:하노이, TSE:도쿄 + "CO_YN_PRICECUR": pr_yn, # 현재가선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_PRICECUR": pr_st, # 현재가시작범위가 + "CO_EN_PRICECUR": pr_en, # 현재가끝범위가 + "CO_YN_RATE": rate_yn, # 등락율선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_RATE": rate_st, # 등락율시작율 + "CO_EN_RATE": rate_en, # 등락율끝율 + "CO_YN_VOLUME": vol_yn, # 거래량선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_VOLUME": vol_st, # 거래량시작량 + "CO_EN_VOLUME": vol_en, # 거래량끝량 + "CO_YN_PER": per_yn, # PER선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_PER": per_st, # PER시작 + "CO_EN_PER": per_en, # PER끝 + "CO_YN_EPS": eps_yn, # EPS선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_EPS": eps_st, # EPS시작 + "CO_EN_EPS": eps_en, # EPS끝 + "CO_YN_AMT": amt_yn, # 거래대금선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_AMT": amt_st, # 거래대금시작금 + "CO_EN_AMT": amt_en, # 거래대금끝금 + "CO_YN_SHAR": shar_yn, # 발행주식수선택조건 해당조건 사용시(1), 미사용시 필수항목아님 + "CO_ST_SHAR": shar_st, # 발행주식시작수 + "CO_EN_SHAR": shar_en, # 발행주식끝수 + "CO_YN_VALX": valx_yn, # 시가총액선택조건 + "CO_ST_VALX": valx_st, # 시가총액시작액 + "CO_EN_VALX": valx_en, # 시가총액끝액 + "KEYB": "" # (사용안함)NEXT KEY BUFF + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if div == "01": + current_data = pd.DataFrame(res.getBody().output2) + else: + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + dataframe = current_data + + return dataframe + + +########################################################################### +# [해외주식] 기본시세 > 해외결제일자조회[해외주식] +########################################################################### +# 해외결제일자조회 API입니다. +########################################################################### +def get_overseas_price_quot_countries_holiday(dt="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-stock/v1/quotations/countries-holiday' + tr_id = "CTOS5011R" # [해외주식] 기본시세 > 해외결제일자조회 + + if dt == "": + dt = datetime.today().strftime("%Y%m%d") # 시작일자 값이 없으면 현재일자 + + params = { + "TRAD_DT": dt, # 기준일자(YYYYMMDD) + "CTX_AREA_FK": FK100, # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK 값 : 다음페이지 조회시(2번째부터) + "CTX_AREA_NK": NK100 # 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK 값 : 다음페이지 조회시(2번째부터) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) # API 호출 + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output) + + # Append to the existing DataFrame if it exists + if dataframe is not None: + dataframe = pd.concat([dataframe, current_data], ignore_index=True) # + else: + dataframe = current_data + + tr_cont, FK100, NK100 = res.getHeader().tr_cont, res.getBody().ctx_area_fk, res.getBody().ctx_area_nk # 페이징 처리 getHeader(), getBody() kis_auth.py 존재 + # print(tr_cont, FK100, NK100) + + if tr_cont == "D" or tr_cont == "E": # 마지막 페이지 + print("The End") + return dataframe + elif tr_cont == "F" or tr_cont == "M": # 다음 페이지 존재하는 경우 자기 호출 처리 + print('Call Next') + time.sleep(0.1) # 시스템 안정적 운영을 위하여 반드시 지연 time 필요 + return get_overseas_price_quot_countries_holiday(dt, "N", FK100, NK100, dataframe) + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가상세 +# 개요 +# 해외주식 현재가상세 API입니다. +# 해당 API를 활용하여 해외주식 종목의 매매단위(vnit), 호가단위(e_hogau), PER, PBR, EPS, BPS 등의 데이터를 확인하실 수 있습니다. +# 해외주식 시세는 무료시세(지연시세)만이 제공되며, API로는 유료시세(실시간시세)를 받아보실 수 없습니다. +# ※ 지연시세 지연시간 : 미국 - 실시간무료(0분지연) / 홍콩, 베트남, 중국 - 15분지연 / 일본 - 15분지연 +# 미국의 경우 0분지연시세로 제공되나, 장중 당일 시가는 상이할 수 있으며, 익일 정정 표시됩니다. +# ※ 추후 HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시 실시간 시세 수신할 수 있도록 변경 예정 +# [미국주식시세 이용시 유의사항] +# ■ 무료 실시간 시세(0분 지연) 제공 +# ※ 무료(매수/매도 각 1호가) : 나스닥 마켓센터에서 거래되는 호가 및 호가 잔량 정보 +# ※ 유료(매수/매도 각 1호가) : 미국 전체 거래소들의 통합 주문체결 및 최우선 호가 +# ■ 무료 실시간 시세 서비스는 유료 실시간 시세 서비스 대비 평균 50% 수준에 해당하는 정보이므로 +# 현재가/호가/순간체결량/차트 등에서 일시적·부분적 차이가 있을 수 있습니다. +# ■ 무료∙유료 모두 미국에 상장된 종목(뉴욕, 나스닥, 아멕스 등)의 시세를 제공하며, 동일한 시스템을 사용하여 주문∙체결됩니다. +# 단, 무료∙유료의 기반 데이터 차이로 호가 및 체결 데이터는 차이가 발생할 수 있고, 이로 인해 발생하는 손실에 대해서 당사가 책임지지 않습니다. +# ■ 무료 실시간 시세 서비스의 시가, 저가, 고가, 종가는 유료 실시간 시세 서비스와 다를 수 있으며, +# 종목별 과거 데이터(거래량, 시가, 종가, 고가, 차트 데이터 등)는 장 종료 후(오후 12시경) 유료 실시간 시세 서비스 데이터와 동일하게 업데이트됩니다. +# ■ 유료 실시간 시세 서비스는 신청 시 1~12개월까지 기간 선택 후 해당 요금을 일괄 납부하며, +# 해지 시 해지한 달의 말일까지 시세 제공 후 남은 기간 해당 금액이 환급되니 유의하시기 바랍니다. +# (출처: 한국투자증권 외화증권 거래설명서 - https://www.truefriend.com/main/customer/guide/Guide.jsp?&cmd=TF04ag010002¤tPage=1&num=64) +############################################################################################## +# 해외주식 현재가상세 시세 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_overseas_price_quot_price_detail(excd="", itm_no="", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/price-detail' + tr_id = "HHDFS76200200" # 해외주식 현재가상세 + + params = { + "AUTH": "", # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "EXCD": excd, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "SYMB": itm_no # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + +############################################################################################## +# [해외주식] 기본시세 > 해외주식분봉조회 +# 해외주식분봉조회 API입니다. +# 실전계좌의 경우, 최근 120건까지 확인 가능합니다. +# +# ※ 해외주식 분봉은 정규장만 제공됩니다. +# +# [미국주식시세 이용시 유의사항] +# ■ 무료 실시간 시세(0분 지연) 제공 +# ※ 무료(매수/매도 각 1호가) : 나스닥 마켓센터에서 거래되는 호가 및 호가 잔량 정보 +# ※ 유료(매수/매도 각 1호가) : 미국 전체 거래소들의 통합 주문체결 및 최우선 호가 +# ■ 무료 실시간 시세 서비스는 유료 실시간 시세 서비스 대비 평균 50% 수준에 해당하는 정보이므로 +# 현재가/호가/순간체결량/차트 등에서 일시적·부분적 차이가 있을 수 있습니다. +# ■ 무료∙유료 모두 미국에 상장된 종목(뉴욕, 나스닥, 아멕스 등)의 시세를 제공하며, 동일한 시스템을 사용하여 주문∙체결됩니다. +# 단, 무료∙유료의 기반 데이터 차이로 호가 및 체결 데이터는 차이가 발생할 수 있고, 이로 인해 발생하는 손실에 대해서 당사가 책임지지 않습니다. +# ■ 무료 실시간 시세 서비스의 시가, 저가, 고가, 종가는 유료 실시간 시세 서비스와 다를 수 있으며, +# 종목별 과거 데이터(거래량, 시가, 종가, 고가, 차트 데이터 등)는 장 종료 후(오후 12시경) 유료 실시간 시세 서비스 데이터와 동일하게 업데이트됩니다. +# ■ 유료 실시간 시세 서비스는 신청 시 1~12개월까지 기간 선택 후 해당 요금을 일괄 납부하며, +# 해지 시 해지한 달의 말일까지 시세 제공 후 남은 기간 해당 금액이 환급되니 유의하시기 바랍니다. +# (출처: 한국투자증권 외화증권 거래설명서 - https://www.truefriend.com/main/customer/guide/Guide.jsp?&cmd=TF04ag010002¤tPage=1&num=64) +############################################################################################## +# 해외주식 해외주식분봉조회 시세 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_overseas_price_quot_inquire_time_itemchartprice(div="02", excd="", itm_no="", nmin="", pinc="0", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice' + tr_id = "HHDFS76950200" # 해외주식 해외주식분봉조회 + + params = { + "AUTH": "", # 시장 분류 코드 J : 주식/ETF/ETN, W: ELW + "EXCD": excd, # 거래소코드 HKS : 홍콩,NYS : 뉴욕,NAS : 나스닥,AMS : 아멕스,TSE : 도쿄,SHS : 상해,SZS : 심천,SHI : 상해지수 + # SZI : 심천지수,HSX : 호치민,HNX : 하노이,BAY : 뉴욕(주간),BAQ : 나스닥(주간),BAA : 아멕스(주간) + "SYMB": itm_no, # 종목코드(ex. TSLA) + "NMIN": nmin, # 분갭 분단위(1: 1분봉, 2: 2분봉, ...) + "PINC": pinc, # 전일포함여부(0:당일 1:전일포함) + "NEXT": "", # (사용안함)다음여부 + "NREC": "120", # 요청갯수 레코드요청갯수 (최대 120) + "FILL": "", # (사용안함)미체결채움구분 + "KEYB": "" # (사용안함)NEXT KEY BUFF + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if div == "02": + current_data = pd.DataFrame(res.getBody().output2) + else: + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외주식] 기본시세 > 해외지수분봉조회 +# 해외지수분봉조회 API입니다. +# 실전계좌의 경우, 최근 102건까지 확인 가능합니다. +############################################################################################## +# 해외주식 해외지수분봉조회 시세 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_overseas_price_quot_inquire_time_indexchartprice(div="01", code="N", iscd="", tm_dv="0", inc="N", tr_cont="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice' + tr_id = "FHKST03030200" # 해외주식 해외지수분봉조회 + + params = { + "FID_COND_MRKT_DIV_CODE": code, # 시장 분류 코드 N 해외지수, X 환율, KX 원화환율 + "FID_INPUT_ISCD": iscd, # 종목코드 + "FID_HOUR_CLS_CODE": tm_dv, # 시간 구분 코드 0: 정규장, 1: 시간외 + "FID_PW_DATA_INCU_YN": inc # 과거 데이터 포함 여부 (Y/N) + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if div == "02": + current_data = pd.DataFrame(res.getBody().output2) + else: + current_data = pd.DataFrame(res.getBody().output1, index=[0]) + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 상품기본정보 +############################################################################################## +# 해외주식 상품기본정보 시세 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_overseas_price_search_info(itm_no="", prdt_type_cd="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/search-info' + tr_id = "CTPF1702R" # 해외주식 상품기본정보 + + params = { + "PDNO": itm_no, # 종목번호 (6자리) ETN의 경우, Q로 시작 (EX. Q500001) + "PRDT_TYPE_CD": prdt_type_cd # 종목유형 512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스 / 515 일본 / 501 홍콩 / 543 홍콩CNY / 558 홍콩USD + # 507 베트남 하노이 / 508 베트남 호치민 / 551 중국 상해A / 552 중국 심천A + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + current_data = pd.DataFrame(res.getBody().output, index=[0]) # getBody() kis_auth.py 존재 + + dataframe = current_data + + return dataframe + + +############################################################################################## +# [해외주식] 기본시세 > 해외주식 현재가 1호가 +# 해외주식 현재가 호가 API입니다. +# 한국투자 HTS(eFriend Plus) > [7620] 해외주식 현재가 화면에서 "왼쪽 호가 창" 기능을 API로 개발한 사항으로, 해당 화면을 참고하시면 기능을 이해하기 쉽습니다. +# +# ※ 지연시세 지연시간 : 미국 - 실시간무료(0분지연, 나스닥 마켓센터에서 거래되는 호가 및 호가 잔량 정보) +# 홍콩, 베트남, 중국 - 15분지연 / 일본 - 15분지연 +# 미국의 경우 0분지연시세로 제공되나, 장중 당일 시가는 상이할 수 있으며, 익일 정정 표시됩니다. +# ※ 추후 HTS(efriend Plus) [7781] 시세신청(실시간) 화면에서 유료 서비스 신청 시 유료시세 수신할 수 있도록 변경 예정 +# +# [미국주식시세 이용시 유의사항] +# ■ 무료 실시간 시세(0분 지연) 제공 +# ※ 무료(매수/매도 각 1호가) : 나스닥 마켓센터에서 거래되는 호가 및 호가 잔량 정보 +# ※ 유료(매수/매도 각 1호가) : 미국 전체 거래소들의 통합 주문체결 및 최우선 호가 +# ■ 무료 실시간 시세 서비스는 유료 실시간 시세 서비스 대비 평균 50% 수준에 해당하는 정보이므로 +# 현재가/호가/순간체결량/차트 등에서 일시적·부분적 차이가 있을 수 있습니다. +# ■ 무료∙유료 모두 미국에 상장된 종목(뉴욕, 나스닥, 아멕스 등)의 시세를 제공하며, 동일한 시스템을 사용하여 주문∙체결됩니다. +# 단, 무료∙유료의 기반 데이터 차이로 호가 및 체결 데이터는 차이가 발생할 수 있고, 이로 인해 발생하는 손실에 대해서 당사가 책임지지 않습니다. +# ■ 무료 실시간 시세 서비스의 시가, 저가, 고가, 종가는 유료 실시간 시세 서비스와 다를 수 있으며, +# 종목별 과거 데이터(거래량, 시가, 종가, 고가, 차트 데이터 등)는 장 종료 후(오후 12시경) 유료 실시간 시세 서비스 데이터와 동일하게 업데이트됩니다. +# ■ 유료 실시간 시세 서비스는 신청 시 1~12개월까지 기간 선택 후 해당 요금을 일괄 납부하며, +# 해지 시 해지한 달의 말일까지 시세 제공 후 남은 기간 해당 금액이 환급되니 유의하시기 바랍니다. +# (출처: 한국투자증권 외화증권 거래설명서 - https://www.truefriend.com/main/customer/guide/Guide.jsp?&cmd=TF04ag010002¤tPage=1&num=64) +############################################################################################## +# 해외주식 해외주식 현재가 1호가 Object를 DataFrame 으로 반환 +# Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 +# Output: DataFrame (Option) output +def get_overseas_price_inquire_asking_price(div="", excd="", itm_no="", tr_cont="", FK100="", NK100="", dataframe=None): + url = '/uapi/overseas-price/v1/quotations/inquire-asking-price' + tr_id = "HHDFS76200100" # 해외주식 현재가 1호가 + + params = { + "AUTH": "", # (사용안함) 공백 + "EXCD": excd, # 거래소코드 + "SYMB": itm_no # 종목코드 + } + res = kis._url_fetch(url, tr_id, tr_cont, params) + + # Assuming 'output' is a dictionary that you want to convert to a DataFrame + if div == "01": + current_data = pd.DataFrame(res.getBody().output1, index=[0]) # 01:기본시세 + elif div == "02": + current_data = pd.DataFrame(res.getBody().output2, index=[0]) # 02:1호가 + else: + current_data = pd.DataFrame(res.getBody().output3, index=[0]) # getBody() kis_auth.py 존재 + + + dataframe = current_data + + return dataframe + + + diff --git a/한국투자증권(API)/legacy/Sample01/kis_ovrseastk_ws.py b/한국투자증권(API)/legacy/Sample01/kis_ovrseastk_ws.py new file mode 100644 index 0000000..114136b --- /dev/null +++ b/한국투자증권(API)/legacy/Sample01/kis_ovrseastk_ws.py @@ -0,0 +1,468 @@ +# 해외주식 실시간 websocket sample +import websocket + +import kis_auth as ka +import kis_ovrseastk as kb + +import os +import json +import requests + +import pandas as pd +import numpy as np + +import time +import datetime + +from io import StringIO +from threading import Thread + +from collections import namedtuple, deque + +try: + import websockets + +except ImportError: + print("websocket-client 설치중입니다.") + os.system('python3 -m pip3 install websocket-client') + +from enum import StrEnum + + +class KIS_WSReq(StrEnum): + BID_USA = 'HDFSASP0' # 해외주식 실시간지연호가(미국) + BID_ASA = 'HDFSASP1' # 해외주식 실시간지연호가(아시아) + CONTRACT = 'HDFSCNT0' # 해외주식 실시간지연 체결가 + NOTICE = 'H0GSCNI0' # 실시간 해외주식 체결통보 + +import talib as ta + + +class BasicPlan: + + def __init__(self, stock_code, window=20): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self._prev_ma = None + + def push(self, value): + self._queue.append(value) + ma = sum(self._queue) / len(self._queue) + diff = ma - self._prev_ma if self._prev_ma is not None else None + self._prev_ma = ma + + print(f"{self._stock_code}****** value: {value}, MA: {ma}, diff: {diff}...") + +class RSI_ST: # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + def __init__(self, stock_code, window=21): + self._stock_code = stock_code + self._queue = deque(maxlen=window) + self.rsi_period = window + + def eval(self): + # dftt = getStreamdDF(self._stock_code) + # print(self) + dftt = contract_sub_df.get(self._stock_code).copy() + dftt = dftt.set_index(['TICK_HOUR']) + dftt['LAST'] = pd.to_numeric(dftt['LAST'], errors='coerce').convert_dtypes() + np_closes = np.array(dftt['LAST'], dtype=np.float64) + rsi = ta.RSI(np_closes, self.rsi_period) + + last_rsi = rsi[-1] + + if last_rsi < 30: + print(f"({self._stock_code})[BUY] ***RSI: {last_rsi}") # 통상적으로 RSI가 30 이하면 과매도 상태인 것으로 판단하고 시장이 과도하게 하락했음을 나타냄 + elif last_rsi < 70 and last_rsi >= 30: + print(f"({self._stock_code})[N/A] ***RSI: {last_rsi}") + elif last_rsi >= 70: + print(f"({self._stock_code})[SELL] ***RSI: {last_rsi}") # 통상적으로 RSI가 70 이상이면 과매수 상태로 간주하고 시장이 과열되었을 가능성이 있음을 나타냄 + else: + print(self._stock_code) + + +_today__ = datetime.date.today().strftime("%Y%m%d") + +ka.auth() + +__DEBUG__ = False # True + +# 실시간 해외주식 계좌체결통보 복호화를 위한 부분 - start +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + + +# AES256 DECODE: Copied from KIS Developers Github sample code +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 실시간 해외주식 계좌체결통보 복호화를 위한 부분 - end + + +contract_sub_df = dict() # 실시간 해외주식 체결 결과를 종목별로 저장하기 위한 container +tr_plans = dict() # 실시간 해외주식 체결 값에 따라 무언가를 수행할 Class 를 저장하기 위한 container +excg_dict = { + 'NYS' : 'NYSE', #미국뉴욕 + 'NAS' : 'NASD', #미국나스닥 + 'AMS' : 'AMEX', #미국아멕스 + 'TSE' : 'TKSE', #일본도쿄 + 'HKS' : 'SEHK', #홍콩 + 'SHS' : 'SHAA', #중국상해 + 'SZS' : 'SZAA', #중국심천 + 'HSX' : 'VNSE', #베트남호치민, + 'HNX' : 'HASE', #베트남하노이 + 'BAY' : 'NYSE', #미국뉴욕(주간) + 'BAQ' : 'NASD', #미국나스닥(주간), + 'BAA' : 'AMEX' #미국아멕스(주간) +} + + +#reserved_cols = ['TICK_HOUR', 'STCK_PRPR', 'ACML_VOL'] # 실시간 해외주식 체결 중 사용할 수신시간, 현재가, 누적거래량 만 추출하기 위한 column 정의 +reserved_cols = ['TICK_HOUR', 'LAST'] # 실시간 해외주식 체결 중 사용할 column 만 추출하기 위한 column 정의 + +# 해외주식 실시간지연체결가 column header +contract_cols = ['RSYM', # 실시간종목코드 + 'SYMB', # 종목코드 + 'ZDIV', # 수수점자리수 + 'TYMD', # 현지영업일자 + 'XYMD', # 현지일자 + 'XHMS', # 현지시간 + 'KYMD', # 한국일자 + 'TICK_HOUR', # pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 'KHMS' 한국시간 + 'OPEN', # 시가 + 'HIGH', # 고가 + 'LOW', # 저가 + 'LAST', # 현재가 + 'SIGN', # 대비구분 + 'DIFF', # 전일대비 + 'RATE', # 등락율 + 'PBID', # 매수호가 + 'PASK', # 매도호가 + 'VBID', # 매수잔량 + 'VASK', # 매도잔량 + 'EVOL', # 체결량 + 'TVOL', # 거래량 + 'TAMT', # 거래대금 + 'BIVL', # 매도체결량 + 'ASVL', # 매수체결량 + 'STRN', # 체결강도 + 'MTYP'] # 시장구분 1:장중,2:장전,3:장후 + +# 실시간 해외주식호가(미국) column eader +bid_usa_cols = ['RSYM', #실시간종목코드 + 'SYMB', # 종목코드 + 'ZDIV', # 소숫점자리수 + 'XYMD', # 현지일자 + 'XHMS', # 현지시간 + 'KYMD', # 한국일자 + 'TICK_HOUR', # pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 'KHMS' 한국시간 + 'BVOL', # 매수총잔량 + 'AVOL', # 매도총잔량 + 'BDVL', # 매수총잔량대비 + 'ADVL', # 매도총잔량대비 + 'PBID1', # 매수호가1 + 'PASK1', # 매도호가1 + 'VBID1', # 매수잔량1 + 'VASK1', # 매도잔량1 + 'DBID1', # 매수잔량대비1 + 'DASK1' ] # 매도잔량대비1 + +# 실시간 해외주식호가(아시아) column eader +bid_asa_cols = ['RSYM', #실시간종목코드 + 'SYMB', #종목코드 + 'ZDIV', #소수점자리수 + 'XYMD', #현지일자 + 'XHMS', #현지시간 + 'KYMD', #한국일자 + 'TICK_HOUR', # pandas time conversion 편의를 위해 이 필드만 이름을 통일한다 'KHMS' 한국시간 + 'BVOL', #매수총잔량 + 'AVOL', #매도총잔량 + 'BDVL', #매수총잔량대비 + 'ADVL', #매도총잔량대비 + 'PBID1', #매수호가1 + 'PASK1', #매도호가1 + 'VBID1', #매수잔량1 + 'VASK1', #매도잔량1 + 'DBID1', #매수잔량대비1 + 'DASK1'] #매도잔량대비1 + + +# 실시간 계좌체결발생통보 column header +notice_cols = ['CUST_ID', # HTS ID + 'ACNT_NO', + 'ODER_NO', # 주문번호 + 'OODER_NO', # 원주문번호 + 'SELN_BYOV_CLS', # 매도매수구분 + 'RCTF_CLS', # 정정구분 + 'ODER_KIND2', # 주문종류2(1:시장가 2:지정자 6:단주시장가 7:단주지정가 A:MOO B:LOO C:MOC D:LOC) + 'STCK_SHRN_ISCD', # 주식 단축 종목코드 + 'CNTG_QTY', # 체결 수량 - 주문통보의 경우 해당 위치에 주문수량이 출력, - 체결통보인 경우 해당 위치에 체결수량이 출력 + 'CNTG_UNPR', # 체결단가 ※ 주문통보 시에는 주문단가가, 체결통보 시에는 체결단가가 수신 됩니다. ※ 체결단가의 경우, 국가에 따라 소수점 생략 위치가 상이합니다. + # 미국 4 일본 1 중국 3 홍콩 3 베트남 0 EX) 미국 AAPL(현재가 : 148.0100)의 경우 001480100으로 체결단가가 오는데, 4번째 자리에 소수점을 찍어 148.01로 해석하시면 됩니다. + 'STCK_CNTG_HOUR', # 주식 체결 시간 + 'RFUS_YN', # 거부여부(0 : 승인, 1 : 거부) + 'CNTG_YN', # 체결여부(1 : 주문,정정,취소,거부,, 2 : 체결 (★ 체결만 볼 경우 2번만 )) + 'ACPT_YN', # 접수여부(1:주문접수 2:확인 3:취소(FOK/IOC)) + 'BRNC_NO', # 지점 + 'ODER_QTY', # 주문수량 - 주문통보인 경우 해당 위치 미출력 (주문통보의 주문수량은 CNTG_QTY 위치에 출력) - 체결통보인 경우 해당 위치에 주문수량이 출력 + 'ACNT_NAME', # 계좌명 + 'CNTG_ISNM', # 체결종목명 + 'ODER_COND', # 해외종목구분 + 'DEBT_GB', # 담보유형코드 10:현금 15:해외주식담보대출 + 'DEBT_DATE'] # 담보대출일자 대출일(YYYYMMDD) + + +# 웹소켓 접속키 발급 +def get_approval(): + url = ka.getTREnv().my_url + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": ka.getTREnv().my_app, + "secretkey": ka.getTREnv().my_sec} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +_connect_key = get_approval() # websocker 연결Key +_iv = None # for 복호화 +_ekey = None # for 복호화 +executed_df = pd.DataFrame(data=None, columns=contract_cols) # 체결통보 저장용 DF + + +# added_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(체결통보) +def _build_message(app_key, tr_id, added_data, tr_type='1'): + _h = { + "approval_key": app_key, + "custtype": 'P', + "tr_type": tr_type, + "content-type": "utf-8" + } + _inp = { + "tr_id": tr_id, + "tr_key": added_data + } + _b = { + "input": _inp + } + _data = { + "header": _h, + "body": _b + } + + d1 = json.dumps(_data) + + return d1 + + +# sub_data 는 종목코드(실시간체결, 실시간호가) 또는 HTS_ID(실시간 계좌체결발생통보) +def subscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록 + ws.send(_build_message(app_key, sub_type, sub_data), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +def unsubscribe(ws, sub_type, app_key, sub_data): # 세션 종목코드(실시간체결, 실시간호가) 등록해제 + ws.send(_build_message(app_key, sub_type, sub_data, '2'), websocket.ABNF.OPCODE_TEXT) + + time.sleep(.1) + + +# streaming data 를 이용해 주어진 bar 크기(예: 1분, 5분 등)의 OHLC(x분봉) 데이터프레임을 반환한다. +# 이때 streamign data 는 websocket client 가 시작한 다음부터 지금까지의 해당 종목의 가격 정보를 의미한다. +# ** 동시호가 시간은 OHLC data 가 모두 NA 가 된다. +def getStreamdDF(stock_code, bar_sz='1Min'): + df3 = contract_sub_df.get(stock_code).copy() + df3 = df3.set_index(['TICK_HOUR']) + df3['LAST'] = pd.to_numeric(df3['LAST'], errors='coerce').convert_dtypes() + df3 = df3['LAST'].resample(bar_sz).ohlc() + + return df3 + +# 수신데이터 파싱 +def _dparse(data): + global executed_df + d1 = data.split("|") + dp_ = None + + hcols = [] + + if len(d1) >= 4: + tr_id = d1[1] + if tr_id == KIS_WSReq.CONTRACT: # 실시간체결 + hcols = contract_cols + elif tr_id == KIS_WSReq.BID_USA: # 해외주식 실시간지연호가(미국) + hcols = bid_usa_cols + elif tr_id == KIS_WSReq.BID_ASA: # 해외주식 실시간지연호가(아시아) + hcols = bid_asa_cols + elif tr_id == KIS_WSReq.NOTICE: # 계좌체결통보 + hcols = notice_cols + else: + pass + + if tr_id in (KIS_WSReq.CONTRACT, KIS_WSReq.BID_USA, KIS_WSReq.BID_ASA): # 실시간체결, 실시간지연호가(미국), 실시간지연호가(아시아) + dp_ = pd.read_csv(StringIO(d1[3]), header=None, sep='^', names=hcols, dtype=object) # 수신데이터 parsing + + print(dp_) # 실시간체결, 실시간호가 수신 데이터 파싱 결과 확인 + + dp_['TICK_HOUR'] = _today__ + dp_['TICK_HOUR'] # 수신시간 + dp_['TICK_HOUR'] = pd.to_datetime(dp_['TICK_HOUR'], format='%Y%m%d%H%M%S', errors='coerce') + else: # 실시간 계좌체결발생통보는 암호화되어서 수신되므로 복호화 과정이 필요 + dp_ = pd.read_csv(StringIO(aes_cbc_base64_dec(_ekey, _iv, d1[3])), header=None, sep='^', names=hcols, # 수신데이터 parsing 및 복호화 + dtype=object) + + print(dp_) # 실시간 계좌체결발생통보 수신 파싱 결과 확인 + + if __DEBUG__: print(f'***EXECUTED NOTICE [{dp_.to_string(header=False, index=False)}]') + + if tr_id == KIS_WSReq.CONTRACT: # 실시간 체결 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + stock_code = dp_[dp_.columns[0]].values.tolist()[0] + df2_ = dp_[reserved_cols] + # dft_ = pd.concat([contract_sub_df.get(stock_code), df2_], axis=0, ignore_index=True) + # 선택된 열이 비어 있거나 모든 값이 NA인지 확인 + selected_df = contract_sub_df.get(stock_code) + if selected_df is not None and not selected_df.dropna().empty: + dft_ = pd.concat([selected_df, df2_], axis=0, ignore_index=True) + else: + dft_ = df2_ + contract_sub_df[stock_code] = dft_ + + ######### 이 부분에서 로직을 적용한 후 매수/매도를 수행하면 될 듯!! + + val1 = dp_['LAST'].tolist()[0] + tr_plans[stock_code].push(float(val1)) # 이동평균값 활용 + # tr_plans[stock_code].eval() # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 활용 + + excg_df = excg_dict[stock_code[1:4]] # 해외거래소코드(3자리) 주문API 사용가능 해외거래소코드(4자리) 변환 + stock_df = dp_['SYMB'].tolist()[0] # 종목코드 + # [국내주식] 주문/계좌 > 매수가능조회 (종목번호 5자리 + 종목단가) REST API + #rt_data = kb.get_inquire_psbl_order(pdno=stock_code, ord_unpr=val1, itm_no="TSLA") + rt_data = kb.get_overseas_inquire_psamount(excg=excg_df, itm_no=stock_df) + ord_qty = rt_data.loc[0, 'ord_psbl_qty'] # ord_psbl_qty 주문가능수량 또는 외화인 경우 max_ord_psbl_qty 최대주문가능수량 + print("[주문가능수량!] : " + ord_qty) + + ########################################################### + # 해외주식(미국) 현금 주문 + # rt_data = kb.get_overseas_order(ord_dv="buy", excg_cd=excg_df, itm_no=stock_df, qty=1, unpr=123.3) + # print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + # 해외주식(미국) 현금 주문(주간) + # rt_data = kb.get_overseas_daytime_order(ord_dv="buy", excg_cd=excg_df, itm_no=stock_df, qty=1, unpr=123.3) + # print(rt_data.KRX_FWDG_ORD_ORGNO + "+" + rt_data.ODNO + "+" + rt_data.ORD_TMD) # 주문접수조직번호+주문접수번호+주문시각 + print("매수/매도 조건 주문 : " + val1) + ########################################################### + + elif tr_id == KIS_WSReq.NOTICE: # 체결통보의 경우, 일단 executed_df 에만 저장해 둠 + if __DEBUG__: print(dp_.to_string(header=False, index=False)) + executed_df = pd.concat([executed_df, dp_], axis=0, ignore_index=True) + + else: + pass + else: + print("Data length error...{data}") + + +def _get_sys_resp(data): + global _iv + global _ekey + + isPingPong = False + isUnSub = False + isOk = False + tr_msg = None + tr_key = None + + rdic = json.loads(data) + + tr_id = rdic['header']['tr_id'] + if tr_id != "PINGPONG": tr_key = rdic['header']['tr_key'] + if rdic.get("body", None) is not None: + isOk = True if rdic["body"]["rt_cd"] == "0" else False + tr_msg = rdic["body"]["msg1"] + # 복호화를 위한 key 를 추출 + if 'output' in rdic["body"]: + _iv = rdic["body"]["output"]["iv"] + _ekey = rdic["body"]["output"]["key"] + isUnSub = True if tr_msg[:5] == "UNSUB" else False + else: + isPingPong = True if tr_id == "PINGPONG" else False + + nt2 = namedtuple('SysMsg', ['isOk', 'tr_id', 'tr_key', 'isUnSub', 'isPingPong']) + d = { + 'isOk': isOk, + 'tr_id': tr_id, + 'tr_key': tr_key, + 'isUnSub': isUnSub, + 'isPingPong': isPingPong + } + + return nt2(**d) + + +def on_data(ws, data, resp_type, data_continu): + # print(f"On data => {resp_type}, {data_continu}, {data}") #return only 1, True + pass + + +def on_message(ws, data): + if data[0] in ('0', '1'): # 실시간체결 or 실시간호가 + _dparse(data) + else: # system message or PINGPONG + rsp = _get_sys_resp(data) + if rsp.isPingPong: + ws.send(data, websocket.ABNF.OPCODE_PING) + else: + if (not rsp.isUnSub and rsp.tr_id == KIS_WSReq.CONTRACT): + contract_sub_df[rsp.tr_key] = pd.DataFrame(columns=reserved_cols) + + ######################################################################## + #### 이 부분에서 전략을 수행할 class 를 등록한다. + #### 실제 주문 실행은 _dparse 함수에서 처리 + tr_plans[rsp.tr_key] = BasicPlan(rsp.tr_key) # 이동 평균선 계산 (웹소켓 프로그램 실행시 수집된 데이터만 반영) + # tr_plans[rsp.tr_key] = RSI_ST(rsp.tr_key) # RSI(Relative Strength Index, 상대강도지수)라는 주가 지표 계산 + ######################################################################## + + elif (rsp.isUnSub): + del (contract_sub_df[rsp.tr_key]) + else: + print(rsp) + + +def on_error(ws, error): + print('error=', error) + +def on_close(ws, status_code, close_msg): + print('on_close close_status_code=', status_code, " close_msg=", close_msg) + + +def on_open(ws): + # stocks 에는 40개까지만 가능 + stocks = ('RBAQAAPL', 'RBAQTSLA', 'RBAQAMZN', 'RBAQNVDA', 'RBAQINTC', 'RBAQMSFT') # 미국주식 주간거래 + #stocks = ('DNASAAPL', 'DNASTSLA', 'DNASAMZN', 'DNASNVDA', 'DNASINTC', 'DNASMSFT') # 미국주식 야간거래(정규시장) + for scode in stocks: + subscribe(ws, KIS_WSReq.BID_USA, _connect_key, scode) # 실시간 호가(미국) + #subscribe(ws, KIS_WSReq.BID_USA, _connect_key, scode) # 실시간 호가(아시아) + subscribe(ws, KIS_WSReq.CONTRACT, _connect_key, scode) # 실시간 체결 + + # unsubscribe(ws, KIS_WSReq.CONTRACT, _connect_key, "RBAQAAPL") #실시간 체결 연결해제 + # subscribe(ws, KIS_WSReq.CONTRACT, _connect_key, "RBAQAAPL") #실시간 체결 연결등록 + # unsubscribe(ws, KIS_WSReq.BID_USA, _connect_key, "RBAQAAPL") #실시간 호가(미국) 연결해제 + # subscribe(ws, KIS_WSReq.BID_USA, _connect_key, "RBAQAAPL") #실시간 호가(미국) 연결등록 + # 실시간 계좌체결발생통보를 등록한다. 계좌체결발생통보 결과는 executed_df 에 저장된다. + subscribe(ws, KIS_WSReq.NOTICE, _connect_key, "HTS ID 입력") # HTS ID 입력 계좌체결발생통보 + + +ws = websocket.WebSocketApp("ws://ops.koreainvestment.com:21000/tryitout", + on_open=on_open, on_message=on_message, on_error=on_error, on_data=on_data) + +ws.run_forever() # 실시간 웹소켓 연결 작동 diff --git a/한국투자증권(API)/legacy/Sample02/CSharp/Common.cs b/한국투자증권(API)/legacy/Sample02/CSharp/Common.cs new file mode 100644 index 0000000..04b9723 --- /dev/null +++ b/한국투자증권(API)/legacy/Sample02/CSharp/Common.cs @@ -0,0 +1,499 @@ +using System.Data; +using System.Text; +using YamlDotNet.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Linq; +using System.Threading.Tasks; + + + + +namespace KIS_Common { + class Common + { + private static string configRoot = @"d:\KIS\config\"; + private static string tokenTmp = configRoot + "KIS" + DateTime.Now.ToString("yyyyMMdd"); + private static Dictionary _cfg; + public static (string my_app, string my_sec , string my_acct, string my_prod, string my_token, string my_url) _TRENV; + private static DateTime _lastAuthTime; + private static bool _DEBUG = false; + public static bool _isPaper = false; + private static Dictionary _baseHeaders; + private static string _mode = "prod"; + public static int _rescode; + public static HttpResponseMessage _resp; + public static Dictionary _header; + public static Dictionary _body; + public static string _errCode; + public static string _errMessage; + + public static async Task doAuth(String mode) + { + if (!File.Exists(tokenTmp)){ + File.Create(tokenTmp).Close(); + } + using (var reader = new StreamReader(configRoot + "kis_devlp.yaml", Encoding.UTF8)){ + var deserializer = new Deserializer(); + _cfg = deserializer.Deserialize>(reader); + } + _baseHeaders = new Dictionary{ + { "Content-Type", "application/json" }, + { "Accept", "text/plain" }, + { "charset", "UTF-8" }, + { "User-Agent", _cfg["my_agent"] } + }; + + if(mode.Equals("V")) { + _DEBUG = true; + _mode = "vps"; + await Auth(_mode, _cfg["my_prod"]); + } + else if(mode.Equals("D")) { + _DEBUG = true; + _mode = "dev"; + await Auth(_mode, _cfg["my_prod"]); + } + else { + _DEBUG = false; + _mode = "prod"; + await Auth(_mode, _cfg["my_prod"]); + } + } + + private static void SaveToken(string myToken, string myExpired, string mode) + { + + Console.WriteLine("===== Exp " + myExpired); + + using (var writer = new StreamWriter(tokenTmp, false, Encoding.UTF8)) + { + writer.WriteLine($"token; {myToken}"); + writer.WriteLine($"valid-date; {myExpired}"); + writer.Write($"mode; {mode}"); + } + } + + private static string? ReadToken() + { + try + { + var lines = File.ReadAllLines(tokenTmp, Encoding.UTF8); + var tokenData = lines.Select(line => line.Split(';')).ToDictionary(parts => parts[0].Trim(), parts => parts[1].Trim()); + + string expDt = DateTime.Parse(tokenData["valid-date"]).ToString("yyyy-MM-dd HH:mm:ss"); + string nowDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + string getMode = tokenData["mode"]; + Console.WriteLine("Mode : " + getMode); + + if (string.Compare(expDt, nowDt) > 0 && _mode.Equals(getMode)){ + return tokenData["token"]; + } + else{ + return null; + } + } + catch + { + return null; + } + } + + private static Dictionary GetBaseHeader() + { + DateTime n2 = DateTime.Now; + if ((n2 - _lastAuthTime).TotalSeconds >= 86400){ + ReAuth(_mode, _cfg["my_prod"]); + } + return new Dictionary(_baseHeaders); + } + + private static (string my_app, string my_sec , string my_acct, string my_prod, string my_token, string my_url) GetTRENV() + { + return _TRENV; + } + + public static void SetTRENV(Dictionary cfg) + { + _TRENV = (cfg["my_app"],cfg["my_sec"],cfg["my_acct"],cfg["my_prod"],cfg["my_token"],cfg["my_url"]); + } + + private static void ChangeTREnv(string tokenKey, string svr, string product) + { + var cfg = new Dictionary(); + if (svr == "prod") + { + cfg["my_app"] = _cfg["my_app"]; + cfg["my_sec"] = _cfg["my_sec"]; + cfg["my_acct"] = _cfg["my_acct"]; + _isPaper = false; + } + else if (svr == "vps") + { + cfg["my_app"] = _cfg["paper_app"]; + cfg["my_sec"] = _cfg["paper_sec"]; + cfg["my_acct"] = _cfg["paper_acct"]; + _isPaper = true; + } + else { + cfg["my_app"] = _cfg["dev_app"]; + cfg["my_sec"] = _cfg["dev_sec"]; + cfg["my_acct"] = _cfg["dev_acct"]; + _isPaper = false; + } + + cfg["my_prod"] = product; + cfg["my_token"] = tokenKey; + cfg["my_url"] = _cfg[svr]; + + SetTRENV(cfg); + } + + private static async TaskAuth(string svr, string product) + { + var p = new Dictionary{ + { "grant_type", "client_credentials" } + }; + + string ak1 = svr == "prod" ? "my_app" : (svr == "vps" ? "paper_app" : "dev_app"); + string ak2 = svr == "prod" ? "my_sec" : (svr == "vps" ? "paper_sec" : "dev_sec"); + + p["appkey"] = _cfg[ak1]; + p["appsecret"] = _cfg[ak2]; + + string savedToken = ReadToken(); + if (savedToken == null){ + var url = $"{_cfg[svr]}/oauth2/tokenP"; + var client = new HttpClient(); + var request = new HttpRequestMessage(HttpMethod.Post, url); + request.Content = new StringContent(JsonConvert.SerializeObject(p), Encoding.UTF8, "application/json"); + var response = client.SendAsync(request).Result; + if (response.IsSuccessStatusCode){ + var jsonData = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); + string myToken = jsonData["access_token"]; + string myExpired = jsonData["access_token_token_expired"]; + SaveToken(myToken, myExpired, svr); + savedToken = ReadToken(); + ChangeTREnv($"Bearer {savedToken}", svr, product); + } + else{ + Console.WriteLine("Get Authentication token fail!\nYou have to restart your app!!!"); + return null; + } + } + else{ + ChangeTREnv($"Bearer {savedToken}", svr, product); + } + + _baseHeaders["authorization"] = _TRENV.Item5; + _baseHeaders["appkey"] = _TRENV.Item1; + _baseHeaders["appsecret"] = _TRENV.Item2; + + _lastAuthTime = DateTime.Now; + + if (_DEBUG) + { + Console.WriteLine($"[{_lastAuthTime}] => get AUTH Key completed!"); + } + + return null; + } + + private static async void ReAuth(string svr, string product) + { + await Auth(svr, product); + } + + private static Dictionary GetEnv() + { + return _cfg; + } + + public static (string my_app, string my_sec , string my_acct, string my_prod, string my_token, string my_url) GetTREnv() + { + return _TRENV; + } + + private static async Task SetOrderHashKey(Dictionary h, Dictionary p) + { + string url = $"{GetTREnv().my_url}/uapi/hashkey"; + + using (var client = new HttpClient()) + { + var content = new StringContent(JsonConvert.SerializeObject(p), Encoding.UTF8, "application/json"); + var response = await client.PostAsync(url, content); + if (response.IsSuccessStatusCode) + { + var jsonData = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); + h["hashkey"] = jsonData["HASH"]; + } + else + { + Console.WriteLine("Error: " + response.StatusCode); + } + } + } + + private static bool IsPaperTrading() + { + return _isPaper; + } + + // 응답값 사용을 위한 변수 세팅 메서드 + public static void SetAPIRespVal(HttpResponseMessage resp) + { + _rescode = (int)resp.StatusCode; + _resp = resp; + _header = _SetHeader(); + _body = _SetBody(); + _errCode = (string)_body["msg_cd"]; + _errMessage = (string)_body["msg1"]; + } + + // 응답코드 리턴값 + public int GetResCode() + { + return _rescode; + } + + // 응답메시지 리턴값 + public HttpResponseMessage GetResponse() + { + return _resp; + } + + // 트랜잭션 에러코드 리턴값 + public string GetErrorCode() + { + return _errCode; + } + + // 트랜잭션 에러메시지 리턴값 + public string GetErrorMessage() + { + return _errMessage; + } + + // 헤더 지정 + private static Dictionary _SetHeader() + { + return _resp.Headers.ToDictionary(x => x.Key.ToLower(), x => string.Join(", ", x.Value)); + } + + // 헤더 수신 + public Dictionary GetHeader() + { + return _header; + } + + // 바디 지정 + private static Dictionary _SetBody() + { + return JsonConvert.DeserializeObject>(_resp.Content.ReadAsStringAsync().Result); + + } + + // 바디 수신 + public Dictionary GetBody() + { + return _body; + } + + // 트랜잭션 정상여부 확인 부울 값 + public bool IsOK() + { + return (string) _body["rt_cd"] == "0"; + } + + // 디버그 출력용 + public static void PrintAll() + { + Common ka = new Common(); + Console.WriteLine("
"); + foreach (var x in ka.GetHeader().Keys) + { + Console.WriteLine($"\t-{x}: {ka.GetHeader()[x]}"); + } + Console.WriteLine(""); + foreach (var x in ka.GetBody().Keys) + { + Console.WriteLine($"\t-{x}: {ka.GetBody()[x]}"); + } + } + + // 에러 메시지 출력용 + public void PrintError(string url) + { + Console.WriteLine("-------------------------------\nError in response: " + GetResCode() + " url=" + url); + Console.WriteLine("rt_cd : " + GetBody()["rt_cd"] + " / msg_cd : " + GetErrorCode() + " / msg1 : " + GetErrorMessage()); + Console.WriteLine("-------------------------------"); + } + + // 특정 JToken 결과값을 DataTable로 변환하는 메서드 + public static DataTable ConvertToDataTable(JToken? data){ + + DataTable dataTable = new DataTable(); + JArray jArray = new JArray(); + if (data is null) { + Console.WriteLine("조회 값 없음"); + return null; + } + else { + Console.WriteLine("Return Type : " + data.Type.ToString()); + } + if (data.Type.ToString().Equals("Array")) { + jArray = (JArray) data; + } + else { + jArray.Add(data); + } + + if (jArray.Count > 0) + { + // Add columns to DataTable + foreach (var firstRow in jArray.Children()) + { + foreach (var property in firstRow.Properties()) + { + if (!dataTable.Columns.Contains(property.Name)) + { + dataTable.Columns.Add(property.Name); + } + } + break; + } + + // Add rows to DataTable + foreach (var row in jArray.Children()) + { + DataRow dataRow = dataTable.NewRow(); + foreach (var property in row.Properties()) + { + dataRow[property.Name] = property.Value.ToString(); + } + dataTable.Rows.Add(dataRow); + } + } + + return dataTable; + } + + // JObject 결과값을 DataTable로 변환하는 메서드 + public static DataTable ConvertToDataTable(JObject data) + { + + var dataTable = new DataTable(); + Console.WriteLine("Return Type : " + data.Type.ToString()); + + foreach (var property in data.Properties()) + { + dataTable.Columns.Add(property.Name); + } + + var row = dataTable.NewRow(); + foreach (var property in data.Properties()) + { + row[property.Name] = property.Value; + } + + dataTable.Rows.Add(row); + + return dataTable; + } + + + // DataTable 출력용 + public static void PrintDataTable(DataTable dataTable) + { + string line = ""; + foreach (DataColumn item in dataTable.Columns) + { + line += item.ColumnName +" "; + } + line += "\n"; + foreach (DataRow row in dataTable.Rows) + { + for (int i = 0; i < dataTable.Columns.Count; i++) + { + line += row[i].ToString() + " "; + } + line += "\n"; + } + Console.WriteLine("=============================================================================="); + Console.WriteLine(line) ; + } + + // API 호출 및 응답값 회신 + public static Task UrlFetch(Dictionary paramsDict, string apiUrl = "", string ptrId = "", string trCont = "", Dictionary? appendHeaders = null, bool postFlag = true , bool hashFlag = false) + { + // 요청 URL + string url = $"{GetTREnv().my_url}{apiUrl}"; + + // HTTPClient 사용, RestSharp 사용 시 별도 코드 변환 필요 + var client = new HttpClient(); + HttpResponseMessage resp = new HttpResponseMessage(); + + // 최대 타임아웃 설정 → 기본 100ms, 네트워크 상황에 따라 TimeSpan으로 타임아웃 시간 설정 + client.Timeout = TimeSpan.FromMinutes(10); + + // 요청 헤더 설정 + var headers = GetBaseHeader(); + string trId = ptrId; + if (IsPaperTrading()){ //모의투자인 경우, 트랜잭션 ID 앞에 'V'가 붙음 + if (ptrId[0] == 'T' || ptrId[0] == 'J' || ptrId[0] == 'C'){ + trId = "V" + ptrId.Substring(1); + } + } + headers["tr_id"] = trId; + headers["custtype"] = "P"; + headers["tr_cont"] = trCont; + if (appendHeaders != null && appendHeaders.Count > 0) + { + foreach (var x in appendHeaders.Keys) + { + headers[x] = appendHeaders[x]; + } + } + // 클라이언트 요청 헤더 값에 최종 설정 + foreach (var x in headers) { + client.DefaultRequestHeaders.TryAddWithoutValidation(x.Key , x.Value); + } + + // 디버그 기능 사용 시, 출력용 + + if (_DEBUG) + { + Console.WriteLine("< Sending Info >"); + Console.WriteLine($"URL: {url}, TR: {trId}"); + Console.WriteLine($"
\n{string.Join(", ", headers.Select(h => $"{h.Key}: {h.Value}"))}"); + Console.WriteLine($"\n{string.Join(", ", paramsDict.Select(p => $"{p.Key}: {p.Value}"))}"); + } + + + // POST 방식, GET 방식에 따른 분기 + if (postFlag){ + resp = client.PostAsync(url, new StringContent(JsonConvert.SerializeObject(paramsDict), Encoding.UTF8, "application/json")).ConfigureAwait(false).GetAwaiter().GetResult(); + } + else{ + resp = client.GetAsync(url + "?" + string.Join("&", paramsDict.Select(p => $"{p.Key}={p.Value}"))).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + // 응답코드가 성공으로 나온 경우 결과 값을 최종 설정함. 오류인 경우에는 오류코드와 메시지 출력 + if (resp.IsSuccessStatusCode){ + SetAPIRespVal(resp); + if (_DEBUG) { PrintAll(); } + } + else{ + Console.WriteLine("Error Code : " + (int)resp.StatusCode + " | " + resp.Content); + } + + return Task.FromResult(resp); + + } + } + + + + +} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/Sample02/CSharp/KIS_OverseaStk.cs b/한국투자증권(API)/legacy/Sample02/CSharp/KIS_OverseaStk.cs new file mode 100644 index 0000000..6e07e6b --- /dev/null +++ b/한국투자증권(API)/legacy/Sample02/CSharp/KIS_OverseaStk.cs @@ -0,0 +1,1585 @@ +using System.Data; +using Newtonsoft.Json.Linq; +using KIS_Common; +using Newtonsoft.Json; + +namespace KIS_Oversea +{ + class KIS_OverseaStk + { + /* + #====| [해외주식] 주문/계좌 |============================================================================================================================ + + ############################################################################################## + # [해외주식] 주문/계좌 > 해외주식 주문[v1_해외주식-001] + # + # * 모의투자의 경우, 모든 해외 종목 매매가 지원되지 않습니다. 일부 종목만 매매 가능한 점 유의 부탁드립니다. + # + # * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + # https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + # + # * 해외 거래소 운영시간 외 API 호출 시 애러가 발생하오니 운영시간을 확인해주세요. + # * 해외 거래소 운영시간(한국시간 기준) + # 1) 미국 : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) + # 2) 일본 : (오전) 09:00 ~ 11:30, (오후) 12:30 ~ 15:00 + # 3) 상해 : 10:30 ~ 16:00 + # 4) 홍콩 : (오전) 10:30 ~ 13:00, (오후) 14:00 ~ 17:00 + # + # ※ POST API의 경우 BODY값의 key값들을 대문자로 작성하셔야 합니다. + # (EX. "CANO" : "12345678", "ACNT_PRDT_CD": "01",...) + # + # ※ 종목코드 마스터파일 정제코드는 한국투자증권 Github 파이썬 참고 부탁드립니다. + # https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info + ############################################################################################## + # Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 + # Output: dataTable (Option) output API 문서 참조 등 + */ + // ord_dv="", excg_cd="", itm_no="", qty=0, unpr=0, trCont="", FK100="", NK100="", dataTable=None + public static DataTable GetOverseasOrder(string ord_dv="", string excg_cd="", string itm_no="", string ord_dvsn = "00", double qty=0, double unpr=0, string trCont="", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/order"; + string trID; + + if (ord_dv == "buy") + { + switch (excg_cd) + { + case "NASD": + case "NYSE": + case "AMEX": + trID = "TTTT1002U"; // 미국 매수 주문 [모의투자] VTTT1002U + break; + case "SHEK": + trID = "TTTS1002U"; // 홍콩 매수 주문 [모의투자] VTTS1002U + break; + case "SHAA": + trID = "TTTS0202U"; // 중국상해 매수 주문 [모의투자] VTTS0202U + break; + case "SZAA": + trID = "TTTS0305U"; // 중국심천 매수 주문 [모의투자] VTTS0305U + break; + case "TKSE": + trID = "TTTS0308U"; // 일본 매수 주문 [모의투자] VTTS0308U + break; + case "HASE": + case "VNSE": + trID = "TTTS0311U"; // 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0311U + break; + default: + Console.WriteLine("해외거래소코드 확인요망!!!"); + return null; + } + } + else if (ord_dv == "sell") + { + switch (excg_cd) + { + case "NASD": + case "NYSE": + case "AMEX": + trID = "TTTT1006U"; // 미국 매도 주문 [모의투자] VTTT1006U + break; + case "SHEK": + trID = "TTTS1001U"; // 홍콩 매도 주문 [모의투자] VTTS1001U + break; + case "SHAA": + trID = "TTTS1005U"; // 중국상해 매도 주문 [모의투자] VTTS1005U + break; + case "SZAA": + trID = "TTTS0304U"; // 중국심천 매도 주문 [모의투자] VTTS0304U + break; + case "TKSE": + trID = "TTTS0307U"; // 일본 매도 주문 [모의투자] VTTS0307U + break; + case "HASE": + case "VNSE": + trID = "TTTS0310U"; // 베트남(하노이,호치민) 매도 주문 [모의투자] VTTS0311U + break; + default: + Console.WriteLine("해외거래소코드 확인요망!!!"); + return null; + } + } + else + { + Console.WriteLine("매수/매도 구분 확인요망!"); + return null; + } + + if (string.IsNullOrEmpty(itm_no)) + { + Console.WriteLine("주문종목번호(상품번호) 확인요망!!!"); + return null; + } + + if (qty == 0) + { + Console.WriteLine("주문수량 확인요망!!!"); + return null; + } + + if (unpr == 0) + { + Console.WriteLine("해외주문단가 확인요망!!!"); + return null; + } + + string sll_type = ord_dv == "buy" ? "" : "00"; + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 + { "PDNO", itm_no }, // 종목코드 + { "ORD_DVSN", ord_dvsn }, // 주문구분 00:지정가, 01:시장가, 02:조건부지정가 나머지주문구분 API 문서 참조 + { "ORD_QTY", qty.ToString() }, // 주문주식수 + { "OVRS_ORD_UNPR", unpr.ToString() }, // 해외주문단가 + { "CTAC_TLNO", "" }, + { "MGCO_APTM_ODNO", "" }, + { "SLL_TYPE", sll_type }, // 판매유형 + { "ORD_SVR_DVSN_CD", "0" } // 주문서버구분코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont); + + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + + } + + public static DataTable GetOverseasOrderRvseCncl(string excg_cd = "", string itm_no = "", string? orgn_odno = "", string rvse_cncl_dvsn_cd = "", double qty = 0, double unpr = 0, string trCont = "") + { + + string url = "/uapi/overseas-stock/v1/trading/order-rvsecncl"; + string trID; + DataTable dataTable = new DataTable(); + + switch (excg_cd) + { + case "NASD": + case "NYSE": + case "AMEX": + trID = "TTTT1004U"; // 미국 매수 주문 [모의투자] VTTT1004U + break; + case "SHEK": + trID = "TTTS1003U"; // 홍콩 매수 주문 [모의투자] VTTS1003U + break; + case "SHAA": + trID = "TTTS0302U"; // 중국상해 매수 주문 [모의투자] VTTS0302U + break; + case "SZAA": + trID = "TTTS0306U"; // 중국심천 매수 주문 [모의투자] VTTS0306U + break; + case "TKSE": + trID = "TTTS0309U"; // 일본 매수 주문 [모의투자] VTTS0309U + break; + case "HASE": + case "VNSE": + trID = "TTTS0312U"; // 베트남(하노이,호치민) 매수 주문 [모의투자] VTTS0312U + break; + default: + Console.WriteLine("해외거래소코드 확인요망!!!"); + return null; + } + + if (string.IsNullOrEmpty(orgn_odno)) + { + Console.WriteLine("원주문번호 확인요망!!!"); + return null; + } + + if (!new[] { "01", "02" }.Contains(rvse_cncl_dvsn_cd)) + { + Console.WriteLine("정정취소구분코드 확인요망!!!"); // 정정:01. 취소:02 + return null; + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + { "PDNO", itm_no }, // 종목번호(상품번호) + { "ORGN_ODNO", orgn_odno }, // 원주문번호 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + { "RVSE_CNCL_DVSN_CD", rvse_cncl_dvsn_cd }, // 정정 : 01, 취소 : 02 + { "ORD_QTY", qty.ToString() }, // 주문수량 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + { "OVRS_ORD_UNPR", unpr.ToString() }, // 주문단가 [정정] 정정주문 1주당 가격 [취소] "0" 설정 + { "MGCO_APTM_ODNO", "" }, // 운용사지정주문번호 + { "ORD_SVR_DVSN_CD", "0" } // 주문서버구분코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + + } + + public static DataTable GetOverseasOrderAllCncl(string excg_cd = "", string itm_no = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-nccs"; + string trID = "TTTS3018R"; // 모의투자 VTTS3018R + DataTable currentData = new DataTable(); + + if (string.IsNullOrEmpty(excg_cd)) // 해외거래소코드 필수 + { + Console.WriteLine("해외거래소코드 확인요망!!!"); + return null; + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 + { "SORT_SQN", "DS" }, // DS : 정순, 그외 : 역순 + { "CTX_AREA_FK200", FK100 }, // 페이징 처리 + { "CTX_AREA_NK200", NK100 } // 페이징 처리 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + currentData = Common.ConvertToDataTable(jobj); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + NK100 = (string)jobj["ctx_area_nk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + int cnt = currentData.Rows.Count; + + if (cnt == 0) + { + Console.WriteLine("미체결내역 없음"); + } + else + { + Console.WriteLine("미체결내역 있음"); + } + + foreach (DataRow row in currentData.Rows) + { + Console.WriteLine(row["odno"]); + string r_odno = row["odno"].ToString(); + var res_cncl = GetOverseasOrderRvseCncl("NASD", "", r_odno, "02"); + Console.WriteLine(res_cncl); + } + + return dataTable; + + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasOrderAllCncl(excg_cd, itm_no, "N", FK100, NK100, dataTable); + } + + + return dataTable; + } + + public static DataTable GetOverseasInquireNccs(string excg_cd = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-nccs"; + string trID = "TTTS3018R"; // 모의투자 VTTS3018R + DataTable currentData = new DataTable(); + + if (string.IsNullOrEmpty(excg_cd)) // 해외거래소코드 필수 + { + Console.WriteLine("해외거래소코드 확인요망!!!"); + return null; + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 + { "SORT_SQN", "DS" }, // DS : 정순, 그외 : 역순 + { "CTX_AREA_FK200", FK100 }, // 페이징 처리 + { "CTX_AREA_NK200", NK100 } // 페이징 처리 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + currentData = Common.ConvertToDataTable(jobj); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + NK100 = (string)jobj["ctx_area_nk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + int cnt = currentData.Rows.Count; + if (cnt == 0) + { + Console.WriteLine("미체결내역 없음"); + } + else + { + Console.WriteLine("미체결내역 있음"); + } + + return dataTable; + + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasInquireNccs(excg_cd, "N", FK100, NK100, dataTable); + } + + return dataTable; + + } + + public static DataTable GetOverseasInquireBalance(string excg_cd = "", string crcy_cd = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-balance"; + string trID = "TTTS3012R"; // 모의투자 VTTS3012R + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 + { "TR_CRCY_CD", crcy_cd }, // 거래통화코드 + { "CTX_AREA_FK200", FK100 }, // 페이징 처리 + { "CTX_AREA_NK200", NK100 } // 페이징 처리 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + DataTable current_data = Common.ConvertToDataTable(jobj); + dataTable = current_data; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasInquireBalanceLst(string excg_cd = "", string crcy_cd = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-balance"; + string trID = "TTTS3012R"; // 모의투자 VTTS3012R + DataTable currentData = new DataTable(); + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 + { "TR_CRCY_CD", crcy_cd }, // 거래통화코드 + { "CTX_AREA_FK200", FK100 }, // 페이징 처리 + { "CTX_AREA_NK200", NK100 } // 페이징 처리 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + // Append to the existing DataTable if it exists + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + currentData = Common.ConvertToDataTable(jobj); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + NK100 = (string)jobj["ctx_area_nk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + int cnt = currentData.Rows.Count; + + if (cnt == 0) + { + Console.WriteLine("잔고내역 없음"); + } + else + { + Console.WriteLine("잔고내역 있음"); + } + + return dataTable; + + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasInquireBalanceLst(excg_cd, crcy_cd, "N", FK100, NK100, dataTable); + } + + return dataTable; + } + + /* + ############################################################################################## + # [해외주식] 주문/계좌 > 해외주식 주문체결내역[v1_해외주식-007] + # 일정 기간의 해외주식 주문 체결 내역을 확인하는 API입니다. + # 실전계좌의 경우, 한 번의 호출에 최대 20건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + # 모의계좌의 경우, 한 번의 호출에 최대 15건까지 확인 가능하며, 이후의 값은 연속조회를 통해 확인하실 수 있습니다. + # + # * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + # https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + # + # ※ 해외 거래소 운영시간(한국시간 기준) + # 1) 미국 : 23:30 ~ 06:00 (썸머타임 적용 시 22:30 ~ 05:00) + # 2) 일본 : (오전) 09:00 ~ 11:30, (오후) 12:30 ~ 15:00 + # 3) 상해 : 10:30 ~ 16:00 + # 4) 홍콩 : (오전) 10:30 ~ 13:00, (오후) 14:00 ~ 17:00 + ############################################################################################## + # 해외주식 주문체결내역 List를 DataTable로 반환 + # Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 + # Output: DataTable (Option) output API 문서 참조 등 + */ + public static DataTable GetOverseasInquireCcnl( + string pdno = "", string stDt = "", string edDt = "", string ordDv = "00", string ccldDv = "00", string excgCd = "%", string sort_sqn = "DS", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-ccnl"; + string trID = "TTTS3035R"; // 모의투자 VTTS3035R + + if (string.IsNullOrEmpty(stDt)) + stDt = DateTime.Today.ToString("yyyyMMdd"); + + if (string.IsNullOrEmpty(edDt)) + edDt = DateTime.Today.ToString("yyyyMMdd"); + + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, + { "PDNO", pdno }, + { "ORD_STRT_DT", stDt }, + { "ORD_END_DT", edDt }, + { "SLL_BUY_DVSN", ordDv }, + { "CCLD_NCCS_DVSN", ccldDv }, + { "OVRS_EXCG_CD", excgCd}, + { "SORT_SQN", sort_sqn }, + { "ORD_DT", "" }, + { "ORD_GNO_BRNO", "" }, + { "ODNO" , "" }, + { "CTX_AREA_FK200", FK100 }, + { "CTX_AREA_NK200", NK100 } + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj["output"]); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + NK100 = (string)jobj["ctx_area_nk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + return dataTable; + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasInquireCcnl(pdno, stDt, edDt, ordDv, ccldDv, excgCd, sort_sqn, "N", FK100, NK100, dataTable); + } + + return dataTable; + + } + + /* + ############################################################################################## + # [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고[v1_해외주식-008] + # 해외주식 잔고를 체결 기준으로 확인하는 API 입니다. + # + # HTS(eFriend Plus) [0839] 해외 체결기준잔고 화면을 API로 구현한 사항으로 화면을 함께 보시면 기능 이해가 쉽습니다. + # + # (※모의계좌의 경우 output3(외화평가총액 등 확인 가능)만 정상 출력됩니다. + # 잔고 확인을 원하실 경우에는 해외주식 잔고[v1_해외주식-006] API 사용을 부탁드립니다.) + # + # * 해외주식 서비스 신청 후 이용 가능합니다. (아래 링크 3번 해외증권 거래신청 참고) + # https://securities.koreainvestment.com/main/bond/research/_static/TF03ca010001.jsp + # + # 해외주식 체결기준현재잔고 유의사항 + # 1. 해외증권 체결기준 잔고현황을 조회하는 화면입니다. + # 2. 온라인국가는 수수료(국내/해외)가 반영된 최종 정산금액으로 잔고가 변동되며, 결제작업 지연등으로 인해 조회시간은 차이가 발생할 수 있습니다. + # - 아시아 온라인국가 : 매매일 익일 08:40 ~ 08:45분 경 + # - 미국 온라인국가 : 당일 장 종료후 08:40 ~ 08:45분 경 + # ※ 단, 애프터연장 참여 신청계좌는 10:30 ~ 10:35분 경(Summer Time : 09:30 ~ 09:35분 경)에 최종 정산금액으로 변동됩니다. + # 3. 미국 현재가 항목은 주간시세 및 애프터시세는 반영하지 않으며, 정규장 마감 후에는 종가로 조회됩니다. + # 4. 온라인국가를 제외한 국가의 현재가는 실시간 시세가 아니므로 주문화면의 잔고 평가금액 등과 차이가 발생할 수 있습니다. + # 5. 해외주식 담보대출 매도상환 체결내역은 해당 잔고화면에 반영되지 않습니다. + # 결제가 완료된 이후 외화잔고에 포함되어 반영되오니 참고하여 주시기 바랍니다. + # 6. 외화평가금액은 당일 최초고시환율이 적용된 금액으로 실제 환전금액과는 차이가 있습니다. + # 7. 미국은 메인 시스템이 아닌 별도 시스템을 통해 거래되므로, 18시 10~15분 이후 발생하는 미국 매매내역은 해당 화면에 실시간으로 반영되지 않으니 하단 내용을 참고하여 안내하여 주시기 바랍니다. + # [외화잔고 및 해외 유가증권 현황 조회] + # - 일반/통합증거금 계좌 : 미국장 종료 + 30분 후 부터 조회 가능 + # 단, 통합증거금 계좌에 한해 주문금액은 외화잔고 항목에 실시간 반영되며, 해외 유가증권 현황은 반영되지 + # 않아 해외 유가증권 평가금액이 과다 또는 과소 평가될 수 있습니다. + # - 애프터연장 신청계좌 : 실시간 반영 + # 단, 시스템정산작업시간(23:40~00:10) 및 거래량이 많은 경우 메인시스템에 반영되는 시간으로 인해 차이가 + # 발생할 수 있습니다. + # ※ 배치작업시간에 따라 시간은 변동될 수 있습니다. + ############################################################################################## + # 해외주식 체결기준현재잔고 List를 dataTable 으로 반환 + # Input: None (Option) 상세 Input값 변경이 필요한 경우 API문서 참조 + # Output: dataTable (Option) output API 문서 참조 등 + */ + public static DataTable GetOverseasInquirePresentBalance(string dv = "03", string dvsn = "01", string natn = "000", string mkt = "00", string inqr_dvsn = "00", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-present-balance"; + string trID = "CTRP6504R"; // 모의투자 VTRP6504R + DataTable currentData = new DataTable(); + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "WCRC_FRCR_DVSN_CD", dvsn }, // 원화외화구분코드 01 : 원화, 02 : 외화 + { "NATN_CD", natn }, // 국가코드 000 전체, 840 미국, 344 홍콩, 156 중국, 392 일본, 704 베트남 + { "TR_MKET_CD", mkt }, // 거래시장코드 00:전체 (API문서 참조) + { "INQR_DVSN_CD", inqr_dvsn } // 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + if (dv == "01") { + currentData = Common.ConvertToDataTable(jobj["output1"]); + } + else if (dv == "02") { + currentData = Common.ConvertToDataTable(jobj["output2"]); + } + else { + currentData = Common.ConvertToDataTable(jobj["output3"]); + } + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasInquirePsamount(string dv = "03", string dvsn = "01", string natn = "000", string mkt = "00", string inqr_dvsn = "00", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-psamount"; + string trID = "TTTS3007R"; // 모의투자 VTTS3007R + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", dvsn }, // 원화외화구분코드 01 : 원화, 02 : 외화 + { "OVRS_ORD_UNPR", natn }, // 국가코드 000 전체, 840 미국, 344 홍콩, 156 중국, 392 일본, 704 베트남 + { "ITEM_CD", inqr_dvsn } // 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasDaytimeOrder(string ord_dv = "", string excg_cd = "", string itm_no = "", int qty = 0, double unpr = 0, string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/daytime-order"; + string trID; + + if (ord_dv == "buy") + { + trID = "TTTS6036U"; // 미국주간매수 + } + else if (ord_dv == "sell") + { + trID = "TTTS6037U"; // 미국주간매도 + } + else + { + Console.WriteLine("매수매도구분(ord_dv) 확인요망!!!"); + return null; + } + + if (string.IsNullOrEmpty(excg_cd)) + { + Console.WriteLine("해외거래소코드(excg_cd) 확인요망!!!"); + return null; + } + + if (string.IsNullOrEmpty(itm_no)) + { + Console.WriteLine("주문종목번호(itm_no 상품번호) 확인요망!!!"); + return null; + } + + if (qty == 0) + { + Console.WriteLine("주문수량(qty) 확인요망!!!"); + return null; + } + + if (unpr == 0) + { + Console.WriteLine("해외주문단가(unpr) 확인요망!!!"); + return null; + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스 + { "PDNO", itm_no }, // 종목코드 + { "ORD_DVSN", "00" }, // 주문구분 00:지정가 * 주간거래는 지정가만 가능 + { "ORD_QTY", qty.ToString() }, // 주문주식수 + { "OVRS_ORD_UNPR", unpr.ToString() }, // 해외주문단가 + { "CTAC_TLNO", "" }, // 연락전화번호 + { "MGCO_APTM_ODNO", "" }, // 운용사지정주문번호 + { "ORD_SVR_DVSN_CD", "0" } // 주문서버구분코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasDaytimeOrderRvseCncl(string excg_cd = "", string itm_no = "", string orgn_odno = "", string rvse_cncl_dvsn_cd = "", int qty = 0, double unpr = 0, string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl"; + string trID = "TTTS6038U"; // 미국주간정정취소 + + if (string.IsNullOrEmpty(excg_cd)) + { + Console.WriteLine("해외거래소코드(excg_cd) 확인요망!!!"); + return null; + } + + if (string.IsNullOrEmpty(itm_no)) + { + Console.WriteLine("주문종목번호(itm_no 상품번호) 확인요망!!!"); + return null; + } + + if (string.IsNullOrEmpty(orgn_odno)) + { + Console.WriteLine("원주문번호(orgn_odno) 확인요망!!!"); + return null; + } + + if (!new[] { "01", "02" }.Contains(rvse_cncl_dvsn_cd)) + { + Console.WriteLine("정정취소구분코드(rvse_cncl_dvsn_cd) 확인요망!!!"); // 정정:01. 취소:02 + return null; + } + + if (rvse_cncl_dvsn_cd == "01" && unpr == 0) + { + Console.WriteLine("주문단가(unpr) 확인요망!!!"); + return null; + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + { "PDNO", itm_no }, // 종목번호(상품번호) + { "ORGN_ODNO", orgn_odno }, // 원주문번호 정정 또는 취소할 원주문번호 (해외주식_주문 API ouput ODNO or 해외주식 미체결내역 API output ODNO 참고) + { "RVSE_CNCL_DVSN_CD", rvse_cncl_dvsn_cd }, // 정정 : 01, 취소 : 02 + { "ORD_QTY", qty.ToString() }, // 주문수량 [잔량전부 취소/정정주문] "0" 설정 ( QTY_ALL_ORD_YN=Y 설정 ) [잔량일부 취소/정정주문] 취소/정정 수량 + { "OVRS_ORD_UNPR", unpr.ToString() }, // 해외주문단가 [정정] 소수점 포함, 1주당 가격 [취소] "0" 설정 + { "CTAC_TLNO", "" }, // 연락전화번호 + { "MGCO_APTM_ODNO", "" }, // 운용사지정주문번호 + { "ORD_SVR_DVSN_CD", "0" } // 주문서버구분코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + + } + + public static DataTable GetOverseasInquirePeriodProfit(string excg_cd = "", string crcy = "", string itm_no = "", string st_dt = "", string ed_dt = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-period-profit"; + string trID = "TTTS3039R"; + + if (string.IsNullOrEmpty(st_dt)) + { + st_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 시작일자 값이 없으면 현재일자 + } + + if (string.IsNullOrEmpty(ed_dt)) + { + ed_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 종료일자 값이 없으면 현재일자 + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + { "NATN_CD", "" }, // 국가코드 공란(Default) + { "CRCY_CD", crcy }, // 통화코드 공란:전체,USD:미국달러,HKD:홍콩달러,CNY:중국위안화,JPY:일본엔화,VND:베트남동 + { "PDNO", itm_no }, // 상품번호 공란:전체 + { "INQR_STRT_DT", st_dt }, // 조회시작일자 YYYYMMDD + { "INQR_END_DT", ed_dt }, // 조회종료일자 YYYYMMDD + { "WCRC_FRCR_DVSN_CD", "02" }, // 원화외화구분코드 01 : 외화, 02 : 원화 + { "CTX_AREA_FK200", FK100 }, // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + { "CTX_AREA_NK200", NK100 } // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj["output2"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + + } + + public static DataTable GetOverseasInquirePeriodProfitOutput1(string excg_cd = "", string crcy = "", string itm_no = "", string st_dt = "", string ed_dt = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-period-profit"; + string trID = "TTTS3039R"; + DataTable currentData = new DataTable(); + + + if (string.IsNullOrEmpty(st_dt)) + { + st_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 시작일자 값이 없으면 현재일자 + } + + if (string.IsNullOrEmpty(ed_dt)) + { + ed_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 종료일자 값이 없으면 현재일자 + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + { "NATN_CD", "" }, // 국가코드 공란(Default) + { "CRCY_CD", crcy }, // 통화코드 공란:전체,USD:미국달러,HKD:홍콩달러,CNY:중국위안화,JPY:일본엔화,VND:베트남동 + { "PDNO", itm_no }, // 상품번호 공란:전체 + { "INQR_STRT_DT", st_dt }, // 조회시작일자 YYYYMMDD + { "INQR_END_DT", ed_dt }, // 조회종료일자 YYYYMMDD + { "WCRC_FRCR_DVSN_CD", "02" }, // 원화외화구분코드 01 : 외화, 02 : 원화 + { "CTX_AREA_FK200", FK100 }, // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + { "CTX_AREA_NK200", NK100 } // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + currentData = Common.ConvertToDataTable(jobj["output1"]); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + NK100 = (string)jobj["ctx_area_nk200"] is null ? "" : (string)jobj["ctx_area_fk200"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + return dataTable; + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasInquirePeriodProfitOutput1(excg_cd, crcy, itm_no, st_dt, ed_dt, "N", FK100, NK100, dataTable); + } + + return dataTable; + + } + + // GET 타입 + public static DataTable GetOverseasInquireForeignMargin(string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/foreign-margin"; + string trID = "TTTC2101R"; + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod } // 계좌상품코드 2자리 + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj["output"]); + dataTable = currentData.AsEnumerable().Where(row => !string.IsNullOrEmpty(row.Field("crcy_cd"))).CopyToDataTable(); // 통화코드(crcy_cd) 값이 없는 경우 제외 + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + // GET + public static DataTable GetOverseasInquirePeriodTrans(string excg_cd = "", string dvsn = "00", string itm_no = "", string st_dt = "", string ed_dt = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-period-trans"; + string trID = "CTOS4001R"; + DataTable currentData = new DataTable(); + + if (string.IsNullOrEmpty(st_dt)) + { + st_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 시작일자 값이 없으면 현재일자 + } + + if (string.IsNullOrEmpty(ed_dt)) + { + ed_dt = DateTime.Today.ToString("yyyyMMdd"); // 기간손익 종료일자 값이 없으면 현재일자 + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "ERLM_STRT_DT", st_dt }, // 조회시작일자 YYYYMMDD + { "ERLM_END_DT", ed_dt }, // 조회종료일자 YYYYMMDD + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + { "PDNO", itm_no }, // 상품번호 공란:전체 + { "SLL_BUY_DVSN_CD", dvsn }, // 매도매수구분코드 00(전체), 01(매도), 02(매수) + { "LOAN_DVSN_CD", "" }, // 대출구분코드 01 : 외화, 02 : 원화 + { "CTX_AREA_FK100", FK100 }, // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + { "CTX_AREA_NK100", NK100 } // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0")) + { + currentData = Common.ConvertToDataTable(jobj["output1"]); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + else { + dataTable = currentData; + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["ctx_area_fk100"] is null ? "" : (string)jobj["ctx_area_fk100"].ToString(); + NK100 = (string)jobj["ctx_area_nk100"] is null ? "" : (string)jobj["ctx_area_fk100"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + + int cnt = currentData.Rows.Count; + + if (cnt == 0) + { + Console.WriteLine("잔고내역 없음"); + } + else + { + Console.WriteLine("잔고내역 있음"); + } + + return dataTable; + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); + return GetOverseasInquirePeriodTrans(excg_cd, dvsn, itm_no, st_dt, ed_dt, "N", FK100, NK100, dataTable); + } + + return dataTable; + } + + + public static DataTable GetOverseasInquirePeriodTransOutput2(string excg_cd = "", string dvsn = "00", string itm_no = "", string st_dt = "", string ed_dt = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-period-trans"; + string trID = "CTOS4001R"; + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "ERLM_STRT_DT", st_dt }, // 조회시작일자 YYYYMMDD + { "ERLM_END_DT", ed_dt }, // 조회종료일자 YYYYMMDD + { "OVRS_EXCG_CD", excg_cd }, // 해외거래소코드, 공란:전체,NASD:미국,SEHK:홍콩,SHAA:중국,TKSE:일본,HASE:베트남 + { "PDNO", itm_no }, // 상품번호 공란:전체 + { "SLL_BUY_DVSN_CD", dvsn }, // 매도매수구분코드 00(전체), 01(매도), 02(매수) + { "LOAN_DVSN_CD", "" }, // 대출구분코드 01 : 외화, 02 : 원화 + { "CTX_AREA_FK100", FK100 }, // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터) + { "CTX_AREA_NK100", NK100 } // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터) + }; + + var res = Common.UrlFetch(paramsDict, url, trID, trCont, null, false); + + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + var currentData = Common.ConvertToDataTable(jobj["output2"]); + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasInquirePaymtStdrBalance(string dv = "03", string dt = "", string dvsn = "01", string inqrDvsn = "00", string trCont = "", string fk100 = "", string nk100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance"; + string trId = "CTRP6010R"; + DataTable currentData = new DataTable(); + + if (string.IsNullOrEmpty(dt)) + { + dt = DateTime.Today.ToString("yyyyMMdd"); // 기본날짜 = 당일 + } + + var paramsDict = new Dictionary + { + { "CANO", Common.GetTREnv().my_acct }, // 종합계좌번호 8자리 + { "ACNT_PRDT_CD", Common.GetTREnv().my_prod }, // 계좌상품코드 2자리 + { "BASS_DT", dt }, // 기준일자(YYYYMMDD) + { "WCRC_FRCR_DVSN_CD", dvsn }, // 원화외화구분코드 01 : 원화, 02 : 외화 + { "INQR_DVSN_CD", inqrDvsn } // 00 : 전체,01 : 일반해외주식,02 : 미니스탁 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + + if (dv == "01") + { + currentData = Common.ConvertToDataTable(jobj["Output1"]); + } + else if (dv == "02") + { + currentData = Common.ConvertToDataTable(jobj["Output2"]); + } + else + { + currentData = Common.ConvertToDataTable(jobj["Output3"]); + } + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotPrice(string excd = "", string itmNo = "", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/price"; + string trId = "HHDFS00000300"; // 해외주식 현재체결가 + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // 사용자권한정보 : 사용안함 + { "EXCD", excd }, // 거래소코드 + { "SYMB", itmNo } // 종목번호 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotDailyPrice(string excd = "", string itmNo = "", string gubn = "", string bymd = "", string modp = "0", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/dailyprice"; + string trId = "HHDFS76240000"; // 해외주식 기간별시세 + + if (string.IsNullOrEmpty(bymd)) + { + bymd = DateTime.Today.ToString("yyyyMMdd"); // Current date if no date is provided + } + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // (사용안함) 사용자권한정보 + { "EXCD", excd }, // 거래소코드 + { "SYMB", itmNo }, // 종목번호 + { "GUBN", gubn }, // 일/주/월구분 + { "BYMD", bymd }, // 조회기준일자(YYYYMMDD) + { "MODP", modp }, // 수정주가반영여부 + { "KEYB", "" } // (사용안함) NEXT KEY BUFF + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output2"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotInquireDailyPrice(string div = "N", string itmNo = "", string stDt = "", string edDt = "", string period = "D", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-daily-chartprice"; + string trId = "FHKST03030100"; // 해외주식 종목/지수/환율기간별시세(일/주/월/년) + + if (string.IsNullOrEmpty(stDt)) + { + stDt = DateTime.Today.ToString("yyyyMMdd");// Current date if no start date is provided + } + if (string.IsNullOrEmpty(edDt)) + { + edDt = DateTime.Today.ToString("yyyyMMdd"); // Current date if no end date is provided + } + + var paramsDict = new Dictionary + { + { "FID_COND_MRKT_DIV_CODE", div }, // 시장 분류 코드 + { "FID_INPUT_ISCD", itmNo }, // 종목번호 + { "FID_INPUT_DATE_1", stDt }, // 시작일자(YYYYMMDD) + { "FID_INPUT_DATE_2", edDt }, // 종료일자(YYYYMMDD) + { "FID_PERIOD_DIV_CODE", period } // 기간분류코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output1"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotInquireDailyChartPrice(string div = "N", string itmNo = "", string stDt = "", string edDt = "", string period = "D", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-daily-chartprice"; + string trId = "FHKST03030100"; // 해외주식 종목/지수/환율기간별시세(일/주/월/년) + + if (string.IsNullOrEmpty(stDt)) + { + stDt = DateTime.Today.ToString("yyyyMMdd"); // Current date if no start date is provided + } + if (string.IsNullOrEmpty(edDt)) + { + edDt = DateTime.Today.ToString("yyyyMMdd"); // Current date if no end date is provided + } + + var paramsDict = new Dictionary + { + { "FID_COND_MRKT_DIV_CODE", div }, // 시장 분류 코드 + { "FID_INPUT_ISCD", itmNo }, // 종목번호 + { "FID_INPUT_DATE_1", stDt }, // 시작일자(YYYYMMDD) + { "FID_INPUT_DATE_2", edDt }, // 종료일자(YYYYMMDD) + { "FID_PERIOD_DIV_CODE", period } // 기간분류코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output2"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotInquireSearch(string div = "02", string excd = "", string prSt = "", string prEn = "", string rateSt = "", string rateEn = "", string volSt = "", string volEn = "", + string perSt = "", string perEn = "", string epsSt = "", string epsEn = "", string amtSt = "", string amtEn = "", string sharSt = "", + string sharEn = "", string valxSt = "", string valxEn = "", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-search"; + string trId = "HHDFS76410000"; // [해외주식] 기본시세 > 해외주식조건검색 + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // (사용안함)사용자권한정보(Null 값 설정) + { "EXCD", excd }, // 거래소코드 + { "CO_YN_PRICECUR", (string.IsNullOrEmpty(prSt) || string.IsNullOrEmpty(prEn)) ? "" : "1" }, // 현재가선택조건 + { "CO_ST_PRICECUR", prSt }, // 현재가시작범위가 + { "CO_EN_PRICECUR", prEn }, // 현재가끝범위가 + { "CO_YN_RATE", (string.IsNullOrEmpty(rateSt) || string.IsNullOrEmpty(rateEn)) ? "" : "1" }, // 등락율선택조건 + { "CO_ST_RATE", rateSt }, // 등락율시작율 + { "CO_EN_RATE", rateEn }, // 등락율끝율 + { "CO_YN_VOLUME", (string.IsNullOrEmpty(volSt) || string.IsNullOrEmpty(volEn)) ? "" : "1" }, // 거래량선택조건 + { "CO_ST_VOLUME", volSt }, // 거래량시작량 + { "CO_EN_VOLUME", volEn }, // 거래량끝량 + { "CO_YN_PER", (string.IsNullOrEmpty(perSt) || string.IsNullOrEmpty(perEn)) ? "" : "1" }, // PER선택조건 + { "CO_ST_PER", perSt }, // PER시작 + { "CO_EN_PER", perEn }, // PER끝 + { "CO_YN_EPS", (string.IsNullOrEmpty(epsSt) || string.IsNullOrEmpty(epsEn)) ? "" : "1" }, // EPS선택조건 + { "CO_ST_EPS", epsSt }, // EPS시작 + { "CO_EN_EPS", epsEn }, // EPS끝 + { "CO_YN_AMT", (string.IsNullOrEmpty(amtSt) || string.IsNullOrEmpty(amtEn)) ? "" : "1" }, // 거래대금선택조건 + { "CO_ST_AMT", amtSt }, // 거래대금시작금 + { "CO_EN_AMT", amtEn }, // 거래대금끝금 + { "CO_YN_SHAR", (string.IsNullOrEmpty(sharSt) || string.IsNullOrEmpty(sharEn)) ? "" : "1" }, // 발행주식수선택조건 + { "CO_ST_SHAR", sharSt }, // 발행주식시작수 + { "CO_EN_SHAR", sharEn }, // 발행주식끝수 + { "CO_YN_VALX", (string.IsNullOrEmpty(valxSt) || string.IsNullOrEmpty(valxEn)) ? "" : "1" }, // 시가총액선택조건 + { "CO_ST_VALX", valxSt }, // 시가총액시작액 + { "CO_EN_VALX", valxEn }, // 시가총액끝액 + { "KEYB", "" } // (사용안함)NEXT KEY BUFF + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = (div == "01") ? Common.ConvertToDataTable(jobj["output2"]) : Common.ConvertToDataTable(jobj["output1"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotCountriesHoliday(string dt = "", string trCont = "", string FK100 = "", string NK100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-stock/v1/quotations/countries-holiday"; + string trId = "CTOS5011R"; // [해외주식] 기본시세 > 해외결제일자조회 + DataTable currentData = new DataTable(); + + if (string.IsNullOrEmpty(dt)) + { + dt = DateTime.Today.ToString("yyyyMMdd"); // Current date if no date is provided + } + + var paramsDict = new Dictionary + { + { "TRAD_DT", dt }, // 기준일자(YYYYMMDD) + { "CTX_AREA_FK", FK100 }, // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_FK 값 + { "CTX_AREA_NK", NK100 } // 공란 : 최초 조회시 이전 조회 Output CTX_AREA_NK 값 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); // API 호출 + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")) + { + currentData = Common.ConvertToDataTable(jobj["output"]); + if (dataTable != null) { + dataTable.Merge(currentData); + trCont = res.Result.Headers.FirstOrDefault(i=>i.Key=="tr_cont").Value.FirstOrDefault(); + } + else { + dataTable = currentData; + } + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + FK100 = (string)jobj["CTX_AREA_FK"] is null ? "" : (string)jobj["CTX_AREA_FK"].ToString(); + NK100 = (string)jobj["CTX_AREA_NK"] is null ? "" : (string)jobj["CTX_AREA_NK"].ToString(); + + if (trCont == "D" || trCont == "E") + { + Console.WriteLine("The End"); + return dataTable; + + } + else if (trCont == "F" || trCont == "M") + { + Console.WriteLine("Call Next"); + Task.Delay(100); // Delay for system stability + return GetOverseasPriceQuotCountriesHoliday(dt, "N", FK100, NK100, dataTable); + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotPriceDetail(string excd = "", string itmNo = "", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/price-detail"; + string trId = "HHDFS76200200"; // 해외주식 현재가상세 + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // 시장 분류 코드 + { "EXCD", excd }, // 종목번호 + { "SYMB", itmNo } // 종목번호 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceQuotInquireTimeItemChartPrice(string div = "02", string excd = "", string itmNo = "", string nmin = "", string pinc = "0", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice"; + string trId = "HHDFS76950200"; // 해외주식 해외주식분봉조회 + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // 시장 분류 코드 + { "EXCD", excd }, // 거래소코드 + { "SYMB", itmNo }, // 종목코드 + { "NMIN", nmin }, // 분갭 분단위 + { "PINC", pinc }, // 전일포함여부 + { "NEXT", "" }, // (사용안함)다음여부 + { "NREC", "120" }, // 요청갯수 레코드요청갯수 (최대 120) + { "FILL", "" }, // (사용안함)미체결채움구분 + { "KEYB", "" } // (사용안함)NEXT KEY BUFF + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = (div == "02") ? Common.ConvertToDataTable(jobj["output2"]) : Common.ConvertToDataTable(jobj["output1"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + public static DataTable GetOverseasPriceQuotInquireTimeIndexChartPrice(string div = "01", string code = "N", string iscd = "", string tmDv = "0", string inc = "N", string trCont = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice"; + string trId = "FHKST03030200"; // 해외주식 해외지수분봉조회 + + var paramsDict = new Dictionary + { + { "FID_COND_MRKT_DIV_CODE", code }, // 시장 분류 코드 + { "FID_INPUT_ISCD", iscd }, // 종목코드 + { "FID_HOUR_CLS_CODE", tmDv }, // 시간 구분 코드 + { "FID_PW_DATA_INCU_YN", inc } // 과거 데이터 포함 여부 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = (div == "02") ? Common.ConvertToDataTable(jobj["output2"]) : Common.ConvertToDataTable(jobj["output1"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceSearchInfo(string itmNo = "", string prdtTypeCd = "", string trCont = "", string fk100 = "", string nk100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/search-info"; + string trId = "CTPF1702R"; // 해외주식 상품기본정보 + + var paramsDict = new Dictionary + { + { "PDNO", itmNo }, // 종목번호 + { "PRDT_TYPE_CD", prdtTypeCd } // 종목유형 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont, null, false); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = Common.ConvertToDataTable(jobj["output"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + public static DataTable GetOverseasPriceInquireAskingPrice(string div = "", string excd = "", string itmNo = "", string trCont = "", string fk100 = "", string nk100 = "", DataTable? dataTable = null) + { + string url = "/uapi/overseas-price/v1/quotations/inquire-asking-price"; + string trId = "HHDFS76200100"; // 해외주식 현재가 10호가 + + var paramsDict = new Dictionary + { + { "AUTH", "" }, // (사용안함) 공백 + { "EXCD", excd }, // 거래소코드 + { "SYMB", itmNo } // 종목코드 + }; + + var res = Common.UrlFetch(paramsDict, url, trId, trCont); + var jsonResponse = res.Result.Content.ReadAsStringAsync(); + JObject jobj = JsonConvert.DeserializeObject(jsonResponse.Result); + + if (((String)jobj["rt_cd"]).Equals("0") && !((String)jobj["msg1"]).Contains("조회할 자료가 없습니다")){ + var currentData = (div == "01") ? Common.ConvertToDataTable(jobj["output1"]) : (div == "02") ? Common.ConvertToDataTable(jobj["output2"]) : Common.ConvertToDataTable(jobj["output3"]); + dataTable = currentData; + } + else + { + Console.WriteLine(jobj["msg_cd"] + "," + jobj["msg1"]); + dataTable = null; + } + + return dataTable; + } + + } +} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/Sample02/CSharp/Program.cs b/한국투자증권(API)/legacy/Sample02/CSharp/Program.cs new file mode 100644 index 0000000..a857dbc --- /dev/null +++ b/한국투자증권(API)/legacy/Sample02/CSharp/Program.cs @@ -0,0 +1,166 @@ +using System.Data; +using KIS_Common; +using KIS_Domestic; +using KIS_Oversea; + + +public class Program { + + public static void Main(String [] args) { + + Program p = new Program(); + p.CallForeignStock(); + + } + + public async void CallForeignStock() { + + // 파이썬에서 Dataframe 으로 처리하던 방식을 DataTable, DataRow 사용방식으로 변경 + DataTable rt_data = new DataTable(); + + // [공통] 토큰 발급 및 갱신 처리 + // 별도 경로 지정한 yaml 파일 값을 읽어와서 처리 + // 사용 인수 : P (실전투자) 또는 V (모의투자) + await Common.doAuth("D"); + + // [해외주식] 주문/계좌 =================================================================================================================================== + // [해외주식] 주문/계좌 > 주문 (매수매도구분 buy,sell + 종목코드6자리 + 주문수량 + 주문단가) + // 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 KIS_OvrseaStk.cs GetOverseasOrder 수정요망! + // rt_data = KIS_OverseaStk.get_overseas_order(ord_dv="buy", excg_cd="NASD", itm_no="TSLA", qty=1, unpr=170) + // rt_data = KIS_OverseaStk.get_overseas_order(ord_dv="buy", excg_cd="NASD", itm_no="AAPL", qty=1, unpr=216.75) + rt_data = KIS_OverseaStk.GetOverseasOrder ("buy", "AMEX", "SGOV", "00", 1, 4335); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); // # 주문접수조직번호+주문접수번호+주문시각 + + // [해외주식] 주문/계좌 > 정정취소주문 (해외거래소코드excg_cd + 종목코드itm_no + 주문번호orgn_odno + 정정취소구분rvse_cncl_dvsn_cd + 수량qty + 주문단가unpr) + // 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 KIS_OvrseaStk.cs GetOverseasOrder 수정요망! + rt_data = KIS_OverseaStk.GetOverseasOrderRvseCncl("NASD", "TSLA", "0030089601", "02", 1, 0); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); // # 주문접수조직번호+주문접수번호+주문시각 + + // [해외주식] 주문/계좌 > 해외주식 미체결내역 (해외거래소코드) + // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + rt_data = KIS_OverseaStk.GetOverseasInquireNccs("NYSE"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 미체결전량취소주문 (해외거래소코드excg_cd + 종목코드itm_no) + // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + rt_data = KIS_OverseaStk.GetOverseasOrderAllCncl("NASD", ""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 잔고 현황 + // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + // 거래통화코드 - USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 + rt_data = KIS_OverseaStk.GetOverseasInquireBalance("NASD", ""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 잔고 내역 + // 해외거래소코드 NASD:나스닥,NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + // 거래통화코드 - USD : 미국달러,HKD : 홍콩달러,CNY : 중국위안화,JPY : 일본엔화,VND : 베트남동 + rt_data = KIS_OverseaStk.GetOverseasInquireBalanceLst("NASD", ""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 주문체결내역 + // 해외거래소코드 NASD:미국시장 전체(나스닥,뉴욕,아멕스),NYSE:뉴욕,AMEX:아멕스,SEHK:홍콩,SHAA:중국상해,SZAA:중국심천,TKSE:일본,HASE:베트남하노이,VNSE:호치민 + rt_data = KIS_OverseaStk.GetOverseasInquireCcnl("", "", ""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 체결기준현재잔고 + // dv : 01 보유종목, 02 외화잔고, 03 체결기준현재잔고 + // dvsn : 01 원화, 02 외화 + // natn 국가코드 : 000 전체,840 미국,344 홍콩,156 중국,392 일본,704 베트남 + // mkt 거래시장코드 [Request body NATN_CD 000 설정] + // 00 : 전체 , (NATN_CD 840 인경우) 00:전체,01:나스닥(NASD),02:뉴욕거래소(NYSE),03:미국(PINK SHEETS),04:미국(OTCBB),05:아멕스(AMEX) (다른시장 API문서 참조) + rt_data = KIS_OverseaStk.GetOverseasInquirePresentBalance("02", "01", "000", "00", "00"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 미국주간주문 (매수매도구분 buy,sell + 종목번호 + 주문수량 + 주문단가) + // 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 KIS_OvrseaStk.cs GetOverseasOrder 수정요망 + // !! 현재 미국주간주문은 일시적으로 중단되어 있으며, 추후 재개는 한국투자증권 홈페이지를 통해 공지 예정입니다. + // rt_data = KIS_OverseaStk.GetOverseasDaytimeOrder("buy", "NASD", "TSLA", 1, 251); + // rt_data = KIS_OverseaStk.GetOverseasDaytimeOrder("buy", "NASD", "AAPL", 1, 216.75); + rt_data = KIS_OverseaStk.GetOverseasDaytimeOrder("buy", "NASD", "NVDA", 1, 123.3); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 미국주간정정취소 (해외거래소코드excg_cd + 종목코드itm_no + 주문번호orgn_odno + 정정취소구분rvse_cncl_dvsn_cd + 수량qty + 주문단가unpr) + // 지정가 기준이며 시장가 옵션(주문구분코드)을 사용하는 경우 KIS_OvrseaStk.cs GetOverseasOrder 수정요망! + // !! 현재 미국주간주문은 일시적으로 중단되어 있으며, 추후 재개는 한국투자증권 홈페이지를 통해 공지 예정입니다. + rt_data = KIS_OverseaStk.GetOverseasDaytimeOrderRvseCncl("NASD", "TSLA", "0030089601", "02", 1, 0); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); // 주문접수조직번호+주문접수번호+주문시각 + + // [해외주식] 주문/계좌 > 해외주식 기간손익[v1_해외주식-032] (해외거래소코드 + 통화코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) + // 해외거래소코드 - 미입력 : 전체, NASD:미국, SEHK:홍콩, SHAA:중국 상해, TKSE:일본, HASE:베트남 + rt_data = KIS_OverseaStk.GetOverseasInquirePeriodProfit("", "", "", "20240601", "20240709"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 기간손익(매매일자종목별 기간손익) (해외거래소코드 + 통화코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) + rt_data = KIS_OverseaStk.GetOverseasInquirePeriodProfitOutput1("NASD", "" , "", "20240501", "20240709"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외증거금 통화별조회 + rt_data = KIS_OverseaStk.GetOverseasInquireForeignMargin(); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외증거금 일별거래내역 (해외거래소코드 + 매도매수구분코드 + 종목번호 6자리 + 조회시작일 + 조회종료일) + rt_data = KIS_OverseaStk.GetOverseasInquirePeriodTrans("", "", "", "20240601", "20240709"); + // [해외주식] 주문/계좌 > 해외증거금 일별거래내역[합계] + rt_data = KIS_OverseaStk.GetOverseasInquirePeriodTransOutput2("", "", "", "20240601", "20240709"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 주문/계좌 > 해외주식 결제기준현재잔고 + // dv : 01 보유종목, 02 외화잔고, 03 결제기준현재잔고 + // dt : 기준일자(YYYYMMDD) + // dvsn : 01 원화, 02 외화 + // inqr_dvsn : 00(전체), 01(일반), 02(미니스탁) + rt_data = KIS_OverseaStk.GetOverseasInquirePaymtStdrBalance("03", "", "01", "00"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 =================================================================================================================================== + // [해외주식] 기본시세 > 해외주식 현재체결가 (해외거래소코드, 종목번호) + rt_data = KIS_OverseaStk.GetOverseasPriceQuotPrice ("NAS", "AAPL"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 기간별시세 + // ※ 기준일(bymd) 지정일자 이후 100일치 조회, 미입력시 당일자 기본 셋팅 + rt_data = KIS_OverseaStk.GetOverseasPriceQuotDailyPrice("NAS", "AAPL", "0", ""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 종목/지수/환율기간별시세(일/주/월/년) + // ※ 기준일(bymd) 지정일자 이후 100일치 조회, 미입력시 당일자 기본 셋팅 + rt_data = KIS_OverseaStk.GetOverseasPriceQuotInquireDailyPrice("N", "AAPL" , "", "", "D"); + rt_data = KIS_OverseaStk.GetOverseasPriceQuotInquireDailyChartPrice ("N", "AAPL" , "20240605", "20240610", "D"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식조건검색 div 01 : 검색결과종목수, 02:검색결과종목리스트 + rt_data = KIS_OverseaStk.GetOverseasPriceQuotInquireSearch ("02", "NAS", "160", "170"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외결제일자조회 (기준일자) + rt_data = KIS_OverseaStk.GetOverseasPriceQuotCountriesHoliday(""); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 현재가상세 (해외거래소시장코드, 종목코드) + rt_data = KIS_OverseaStk.GetOverseasPriceQuotPriceDetail("NAS", "AAPL"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 해외주식분봉조회 (조회구분 div-02:분봉데이터,01:시장별장운영시간, 해외거래소시장코드, 종목코드, 분갭, 전일포함여부) + rt_data = KIS_OverseaStk.GetOverseasPriceQuotInquireTimeItemChartPrice("02", "NAS", "AAPL" , "", "0"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 해외지수분봉조회 (조회구분 div-02:분봉데이터,01:지수정보, 조건시장분류코드, 입력종목코드, 시간구분코드, 과거데이터포함여부) + rt_data = KIS_OverseaStk.GetOverseasPriceQuotInquireTimeIndexChartPrice("02", "N", "SPX", "0", "Y"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 상품기본정보 (종목번호, 종목유형) + // 종목유형 : 512 미국 나스닥/513 미국 뉴욕/529 미국 아멕스/515 일본/501 홍콩/543 홍콩CNY/558 홍콩USD/507 베트남 하노이/508 베트남 호치민/551 중국 상해A/552 중국 심천A + rt_data = KIS_OverseaStk.GetOverseasPriceSearchInfo ("AAPL", "512"); + //print("종목코드("+rt_data.std_pdno+") 종목명(" +rt_data.prdt_eng_name+") 거래시장(" +rt_data.ovrs_excg_cd+":" +rt_data.tr_mket_name+")") + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + // [해외주식] 기본시세 > 해외주식 현재가 10호가 (조회구분 01:기본시세 02:10호가 , 해외거래소코드, 종목번호) + rt_data = KIS_OverseaStk.GetOverseasPriceInquireAskingPrice("02", "NAS", "AAPL"); + if (rt_data is not null && rt_data.Rows.Count > 0 ) Common.PrintDataTable(rt_data); + + + + } + +} diff --git a/한국투자증권(API)/legacy/Sample02/CSharp/kis_devlp_Sample.yaml b/한국투자증권(API)/legacy/Sample02/CSharp/kis_devlp_Sample.yaml new file mode 100644 index 0000000..ffa5f8e --- /dev/null +++ b/한국투자증권(API)/legacy/Sample02/CSharp/kis_devlp_Sample.yaml @@ -0,0 +1,34 @@ +#====| 사용자 환경 샘플 아래 참고하시기 바랍니다. |====================== +#====| 본 샘플은 토큰 발급 후 파일 저장 방식이므로 보안강화를 위해 메모리 방식 등 사용자 원하시는 방식으로 구현하시기 바랍니다. |===== +#====| Common.cs에서 환경파일 위치를 사용자가 정하시기 바랍니다. . 2024.05.16 KIS Developers Team |====================== + +###################################################################################################### + +#홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 +#실전투자 +my_app: "실전앱키" +my_sec: "실전앱시크릿" + +#모의투자 +paper_app: "모의앱키" +paper_sec: "모의앱시크릿" + +#계좌번호 앞 8자리 +my_acct: "실전계좌" +paper_acct: "모의계좌" + +my_acct_stock: "실전계좌(주식계좌)" +my_acct_future: "실전계좌(선물옵션계좌)" +#계좌번호 뒤 2자리 +my_prod: "01" # 01 : 국내/해외주식, 03 : 국내선물/옵션, 08 : 해외선물/옵션 +#my_prod: "03" + +#실전투자 +prod: "https://openapi.koreainvestment.com:9443" +#모의투자 +vps: "https://openapivts.koreainvestment.com:29443" + +#디스코드 웹훅 URL +DISCORD_WEBHOOK_URL: "" + +my_agent : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" \ No newline at end of file diff --git a/한국투자증권(API)/legacy/Sample02/Make/POST 인풋예제1.PNG b/한국투자증권(API)/legacy/Sample02/Make/POST 인풋예제1.PNG new file mode 100644 index 0000000000000000000000000000000000000000..8dd1b495b5811f6ecb4ced1c82bb4f04463f79a7 GIT binary patch literal 55334 zcmcG$cT`hp+dYgZqYtP!Gc*xo7-tlbDn&$!g5o%IAt0edh;$H9Kxx4SI3nPTg4Z=P6huluM0(BdIte;6@Av%H_pbG=?~hpyB{_G_x$b@KYwvyYhl$bY z9lWBvTwGi`&ir=rEEm`2Nca!E?K}96tk=^V_-E6Vv!`{qa+<`(;EOHJCk#(;apgtx zt=jXz*Z;Zno7ELAuASA$f1B#OvMz9Ob(WqvdBXgf-Nag8nfP$<$kOGeS>F=ElxA?k zSg(O`b0XcanVF$|&GB%Yk<^HyQ1ovM_?1TpDD}u{1D=S2M<|&M-=xlKNOHmP0+we6n+) zgW9FiIoL(BO21JLa?G3>W@UxWx>z!QrHHm3*I2RlV!PsMH;Eo_;Vdnu+;8Oy3sVU?_PDvliVHn(=Y zYHKD_Ay;Kwdv&cS>b*qYuFf}|&RO*J>8(TR4M#-hDvR@SXgU_7e`ebv%;h$MuI?cBAY{cNI_OXmCW<89ri)5G)z}_koYz!kg+D$@41P~t#r8Z zhM9`*|4$O%rk3%65-l=irPqS+!s(=B9;riM8(#f8p66LnCpH}>PYQ_Q(Pq00;0`kf z^xehPX*pKTgy$j*jnLY+mvbymC=#(IT-0U$kV=xD+3|aB+Psn8D6VXGK>>2qi5vM= z!J`wzJ^>NB`kv5NW5jos;SFy7$o=#tONr^x61W}A8{?Fm)o)?>ST8f-#ai>EIa^Qo?k|}vDo!KFo*_cD&y7Y46Ff7$=UZaV9*=OdQ~IDndKx1L zFaM5*ihSfoH|<8a0P3fRaS?%c@hV4#Tzvg_T}&qlyO-l>ye<|hd{!ObOFc(1oJ1pa ztj$Xg-ao}zZWS!o1X->cDI_2JyrZbsHl&-H z7`P|v*qa-cXFnH)3w%E1yPfxr#fs@~_r`S=DJ8pR+tkDCl_J&-?$V3i|H*1rPy> zQCA1^`zBeUf8+g5JJNM0UxPW%OwTEM11J=@IyOz-l5{?EnAmd}#lAeRr|INWWq!%7 zmh7Eop=GNL4jU^b`m$F{&1%X#iZ3!(ir_43fK%~Ma0`2Dkt@oQ4VUi6&LQ4BZ#z@vy^W`y+F?(DioGtvuosYK z61fmSG|{8&Ot4kSyzT;pdfk+qQNMQZxSon}nj(?Tfu}0!df$R9?xQ!roPg++`eHOs zO;(iTf}I{oUu9--f$Vfpd7g|q536qcS(U_}WD8h>HD58kbI(msfM$b|*jxABc`w0P z6yOtz^dInf#HW_FGs$!^^SO)4mp6xUANJfF>Wlns~|G44Tp)~PxJb%LN(4t&_-LJauT z!o(?854W(g`M-C%epiH4>Zz}Y5YMP|^F0ZevvRvkj`zY>47y+{ev2E8Vh&5%%coy= zLeR$-#iOJ-4>#*lV@bTzUi#-FdwB|}M&Tt?=-J;crxa~CDJh>03ssc5k6?g{spp%} zGO7`>NCnlIbEW{dzf5EZw4}#(Zug(0!8MUfnTOx5c&KBC?se76D@VI{@I_53MLtkC zYD>_)V9D9qL0KAwN)Z+b(2fA%q<3Y)yI(_I>|j0v--F78hG+tCG*7^1(j-D(X2Euc z@3fHIO0svwc61-ym5D&lRa6TdivjHE$}ToR_VsPk$ntQ$@M;+hPHtv&U zKspoS4uv6J8~(;eFOL^D6!vDU=ZT33yx_XUoU=Ode36Kjxt>x)HRBs5A_#=m$zUit z36bTtoFoA*1-lDwL7H88mRxs(!y#Bz$NCLM=yPY^?EwQ0R)LK&O-45qh-*^6KxyNU zkMo2vhCm{V%n1D{wgV?~GP53qdQO7(soU|$)syd$>trVUKu!zUT3?cDwIp*R0NGbu z!z!G}HxY>EvP2js+D*quYWOY za99-^^8j1`x~jVx24@3B$W1>i|IF*=+UOou=A<&0|99_d&!E}%HVi746Q*a!=otl{ z)#!jPQuLlD_mPKl2Y{80=8{)RJ|0xogSKanu2U3Ok6ECb(T8owHyw~$B*MsZ-n(Mz zGLgf3Ghl)#GQL}n`LuP`L>I<(`*=HEo$bP^mCnKaWz!Gl|vT7HyzO7rm@*1 z?(?>!R5hcnY$+2}Qm7Gr1?oq1#9mHM!J!Pb)>!?UmB+i=fQp5AD)} z4-N%(i~9l;uqaZ%E#o5N3kqnm?#S6jW%T4}$-_jHi2=z;vR<8==Q&YMtyDvE$c3iO zQ$wA{w}@EsRF+trXayD_^|f0brxLARNh>tH2yYl8asjr@Z6ER>I}0FNCLVUmK0;o(-Oyp+;mZ;q*%Uj5`s!|j}emq`lX{sC> zQq!2t;IOY8Q8vt=M%`Jn?cKU5OQ+#+q0uw(lDSp{U{P=dC|ZCUbb?Gf@V9TMC>ma| zE-;=RPuTskf_9Yda=9wcH`DZnBH0j_MdZQ73||qxM~_%Cd*n#!Vd@4(o$4A0w^)Vy zA!i>2;&0la>lC15C!n$PM85#K@e|U5 zK3hdP3y^_a0j1SCX=KS$4o?$GKtSZ{)BMSR=^-FWAlMuoqePQlnsNnl%>z%A8hs$3+%^@ z!+yRo*scZ#4Ls6`*+5`!SYl&#T%S2eZIp>ReL|Lu(3xyH!c)KFln|iWQi~;{XW$t^ zT>z%CiDUUM(C}fe3o*)^Ub*L@;PoN`ABZIZ+Tsi+WKsZFYBq2a`_eWX3#A3kF@`_n z-weMcy(hZym&|&)QUsa+m!bi2_(w0zM)t))i7#IOQsUwH0W0s&hSD2^R;KkJwynVd zEvsC>Q)f5jYMzSFVJtkFpEh=Rwa=)*!CyW;zCuGLCdJh_N}3t4(FTo7rAS*^Z!sY1 zp<&HP7|@Vsz8{|XyCQo^x)t;brF#fd5Mgvn89ryQvp+zWu{77U1r+M0~TmTvZ>m&%?FEmUkR z)C`yt0zc7vjMDPF$T!m&ims}8MBh;{>_^xL(4bD%vWLG*fa}^bYMS&|m>7-CObnO` zypMc2^H|-EByV!H6Hs)8Oj`X@GXe}2Pn0oF!vlDplb_+gF~M>wPyYXmnV{CpY#~*^)OJmOz=hl&ja{23V%h!&FVYfJ#WJW*Noozhvu*{XuJU#J@N0OD8=_ggX+FL7?vCC}L02$gT=Xg|*8?5hc7WgWn0Z5a< zaJ3x@O8S&PV+Ho1u*Qv!#Bxu;lVLyPHZTVALiueO1$3fGt?90oX)JH+n6U%6Nn z!VHz}6vx%n+^)F8oq*tKeJ3I!tSrBz=L+``YxJ+YO$iK&(Coyo(FX*gm9* zSwc^*zUUkdsT}U=_N{K0q~uHr2$jMN#u1rz`txIdhgJ?cQz_|Y>fROguz<`~H*xi$ zxLTj12(aP=ejWm{B&kHkW;u&RLQ5@0a9bqwRf#lL2aPu@f-laH_aV&X2(8mPq zIH8^w=L%csf;sb2cOi`B_r?{9pT#w(p~Y|TC;9XK0mOe}0ql*(23GcLNp=&;=e-wk zRc@f#1;&(DSr%0=roe@TAEMF}*b*IR5?C8SE+(1>;gP8x9R)3jNOIRTDN^Ty&)NYC zVeV9JtbnMeErt>lFs@Q+Cy!&cc1DCuOT;sW37`DSi(I`-S6dE{9P!sh7!^jz8gV-! zwbTmA2ze5rwZcL=?=7Q(@z=f#=L)lC3!@TuTza&iS@sOyX(z9><|Ej(YA~c-x?VF_ zAfJ5DPNRI6lyHwv{RnHy?0|4je3}=%??AmOb7tz(F-ENGYUTRpbKaNUi+p;!;8yIB z!&)7?T;4-VOmJPrcm)*~1=_E*Dhl_GjRGD1@;KZkg`rPs1Zgk&nS zTNi9=tceNel3KGUHjz<{k-L4Er(od|u6+BQ;+Dm_<}y2*%2KJEl^4vKFk|?%gzA17 z+(N{u=}_T_!CK8z)AAR|9S7UjW(gR1trZy*l9kw5xpApmJ&8fX*(~ zE1gk`(#HeS&n*wUKO0RmnyNIHm}BH8PZ_`UPQTWyONc1vt1_+nToB5&yeCD|_Pg4U zxvh0VwJT2D3ub(EnL{ROj696*fMvaw_WJ1qZ?Ft?@!Y79HNKIO_+Mv{<|(}mVVD7? zw#0?Q=teWpTa|gVNLUe7N>>WEJ;+h#K#pQd5EaCZdiwh|;QlvV|E;!iV<`opZ$ND2 zqV`NhuMvp5cB7CtiQUPOToFFb1pwE0>FIOJ&aq2H=Xmc~Afk(?*=K}ie@^F2Mf*dm zb2yWS%t?!S-XMz@XD8FNXFw;i8ixv@v zv;Yz3!D7~6<%NH|ip$s;IpAA&B*IwSrC?zB0 z&F>f&*)N3iD zCH~OCbH_i{o_=y_58Ybf z5g5$25Z=_3YhTc>7i;&WnmHEYVN(!6QE7UfdEkNz{A)H!;E z59yhc1}(8anaEWbY_HvuqH{s;<4)m$84045NhGUTNQW8CYJG8vb}8GqVij1*+vP9a zIAp5oF%}%pjJfhYm)AxA7$vKvqmWH?Vbt##sQ;S)gSUZTmurHRG9_GV#xh%O3yu0O zRhn&aPz&7of;oclrX1qPCrv077{JRdKpFroiBb~V;=FOubmDP~PVi))kJ?b?PjT;b~p9R9T#=0E#LV#ZDxX)rj z(#?e2czg5n?e~UGF9;8B$CoWt5RJu`F9QWHjypyA`0|e*ld8OHVFF+%MS2x2Wn8u} zRq_=M`QXw$e>$-FVcN8_Hm>X%DC5TdfJ@{J_k6{BVA2L%PnN7f-AW8z;#~ z9P(M#62+|KEhxJgM3T>EI`Zf+3gT*6@5|*Mr=2deBR0}!TJF8AEPFp(8=y_k8qw68 zIXCxbW6Dv~CwE24}k_f+XwlZ?#s zaUEctfffNu`7N+n2m|$qW>g27(XQR>0kR4-qsQ2fiY&s>pLzc@WlwwUO84j>iE~Cx zU_@6yb>zxsc0W^d8_jlS85`3?{~q@4fl$?Q)Ry@Sp+3i{%NVq+fQ0&kg~LYMLyYl% z3tEW&%4NWmN=bHOgf`&>_To!+@q#o8{$*OSHx(V;GMwaZ5OW3AY5@`nG{0{eI$K|R z2butQSYx~EvT6kc=o_Oh!i%i;-r{yNhXrH@7!S#=+;v#cKb1FRV!Aq^b3VHVnY(H7 zp|w(KPB3ov7*@g5$tvWpFkh|ROt@<)tds2YJ&UkVd9LY)PXX^~gYvAv#^oe<-l4Ux z{f<;npV@?Jph8bI`W*bcROe=P$;?n&)3+l|PqtU2HN=fB;~>Z_I6)L`RPM>|UX9Cr zymA(0LifyAez1?vn6PSGNU@l*%zlv)swa+rdTx*gGK=FC5xd;!Z0AhsJ#EkP;Bm3SCQ?EMm$LHo{;!b^0$M4?99Bl zy1Ov1gN0B5R0KhUKr%NXM8lQFcBvf;RSV=F%Gu{UFjQ0+5RDa`m&Q5ek!qD9T`w6p z@2Or;R@J>wVq=*A1M=$Q0qbpd>ncn&aEnaGcXW@=+<_3{_S<6y`2MYy;k5xm)8oyF z(wiBjdsp42S#JaL%W5dNXsn=|%CV4eRjfW=>Th;QYb_mXRT}Ozqr?`+ z)q)V16(3;5u_K^8PB|)XSfLw@xSW_-&wIl)DG8Km=+6^G)GjKB6?MdoCj34 zeXD~!FeZ4^za1sh9Reyj$fD}RkDzbKB)AG~7 zlTeiU37CNtWC4Cc)Sh>zeEpq;R@$YvLH}KI5;80igYgAy^*;a!Fo-zboy{lNGX9GV z8kU&GuxGz@rIkm(v*lf4ct=_sW-W*kjQw&|ERq{rAuZs?_!uanQXN}SXS&H`EohBk z5g51gL0z=O)b^+m)TT?SyiOJgN?}{;t z4tz<4jLDE7$t`Owo^@|}P3Hc{3>g+jU4Jle?Hy@&>qn_AZcE3!aK%B*eYdvSCCq+b zE^oSGzO6k!R1Y3I)518kS>oKbJ3{jU0<1|*LVn@>-+K+9Rd+mH2Fax|<=i%O<*dYH z`CUPtlgIY9V#|f6L)L>!=gd>g1Ik*$8KdU}TYT!DzUY+?`f_1k`&t{pNRYLRJ@BTE zHA1e7*vHq*{8JbNhdFm*B~6MqP1jD2%y1_1`eqr66OE7mZgv~uB3rCx z+aF+E3NdP21Ld(-!Sn@TRfEqTZ25obOvm-zS3EOOSxn2XK2MLcQ=T?Zeva#V9bDh! z9bOivQ@NZ~c3!nuL9Bo9WRRx(Y#)N3Yy=xP zTfJs%Hw>i>GULG!;JtdVd%G3b{;=1r-WH9_4Zg2FHP#w)_ceha9g9jyMmMfnrR)*X zN#qaIJy>Klm-5&0N6M7F41hsrvzk$OMTt>;qfDlNXz(R!%jm5kmy~2804;MZqE1*R zyuWf`Iyg6Z@|Y%labL(eo);s++#}Z7{^^S`m8`Q%BS(~V{T9|O>#fm@DQ&Gex1$~6 z(87apbNvs7Qv#p0WNGm}%N}|*uK6I)ZZ%-{*~-ZUOtRRm zd8V@nIdjTB+ewrecbYE+mpPrgzWm-{q^k4Hf|yN2u3mdA{*j+Tv; z-x;9on#H}3CTUxz^G_5{G)XHH4Jjp^xKBRQ<*YQ`C@;*mhMp8HtGNThFEY5ZUXYt6 z8%vuFUJ&LxLoyX@n;6nk96{N(Ay5Q%AL1Or3?PLT*VU|cVT3n8f`y~jf}I$K&LPSk zxi#d_t`ub<2q~Tvws&SCD3l z=#$TQ&(5brotV;G9jTmg*taEK65i8dTRS;xUc+2)73U`T{Ar&KzJDakN|Q;LS?q7_ zEQ}+LcbI!J>(0KKNqM*&jbqk)nUWe0>JC|+5lLvmT_&z#dZS_rN5{3bhqAOg)2_R- z#>($4m);K!c;8}eO%=xW;6^lu4t&!C5o~!k$j%@t}P%N9kn4MILss=rsttK$72?t|A`nXW*Et$%g^SE=YRO36u zD*lHp!%-&5jXecZDEm_wyeTnq zw&WIqBkS}7-YrV}n5rOPKw^WkwAy@+A)zptc3*mNha@~H}tG$tp1=2Qecq&&M zc5g=sE>fE;@z0mED{{w`B0}cg<7>h~kCP_X8qyj2CH5m`s>LB9_ECi!vY zRY@*4i`MnUkSHyY)4jpA|Bjvkox!_ONA2rJkALfp?krcD?JE3Shd*1f6yb#<|a%hX7AgiwjkCb_&E@J z8iPO%7ZM8MjN9syQ|D~Av2{l~^E#98*JEGReAtoTGFmdhI0p$xo){5l^*8BQrP`pZ zF9Ku80>6M6=UEphHdG@)YQ3Q$Ggo94O+)7)~zj%hC{F+8)v| zu5+Ct8h(t_x1PudgDY)DL90=Uj7WnJ$1>fF++?)rFwvhk z5(Hxrwqi{+s)X$gUL5&f1KarS(}xc z7l>C61Kj5{ibQB#mfY&TE8_?5@I&H3r>D@R?^zFLGRw3R^_X z=&#;CJEDLD5dQfP5#x}p#-h#tDN;Z<<`r{i@IhoLbT)Es_}i9Kfug|F9_MPYO-k@W zAp2r2*fJiVT4p7FgF6wmR<$nOFh^E|m+qt|dYiK~VK#+g8;HyN*>b;YAW5zNWung; zQan{q^T^0#q4bBvJ}u>sNPZ)aH!AtXdB_PuI3c#cq&s^)eV$vq(57M?e{Z*9SYqDD6lQZuK@+LSqn!wEYW~) zA>x*7p~DQMMLHDX1ZgV{b3sf-w*SWl(6!B%f98#(qfU6a0(8oni-tajTgnCe!80vC zz!5u8qK*0a{zvmLLS#wl z1C1?pJ-BIu>g}(0L1GA;@>xMrmu=wDs*${lC_NbP36XRH7qYh}C7_a3v0Q zHgWgM0{90m3j`c-!AVf{e!A(0@ooOy5yxbXGzm2Y>82~Uqbb%i+sSl&||!c7bW zQp684;|b3YFPI$*KonXoS1_b%Aved4TxUaW?h=xlQ$TW&NGQMoUDx83sR)k4E+okE zw?_r;6-*Y<{y+de6e0_qMBewFhv@7%Z3xlc(Q9VnqSeC*_E) zY)_?VB+rhRWfzNykclDR930efGP?-wo(9CEkmUEuG{nHb#8Z(F3pcrM;Lb^=1LPp- zQQNfEn?pyJXWM;_{yjCR(qmx)LXwcYzDQ9peUMxn@@OC}S0zJ6(sIF>-q+x()VaNqyYG$)m7w0QlSA0u6*8H_(l=pm`7B)HW1p>L~zt zfDTCGeguvzohl11844J0%%yHylYr_5ZP%bUKAp5@ty|#^ehv$dG2bPh(xO?Ut>;?SOJ#^1F|pQ zBWIuwU^{J)p>G@b3rGkM`*!v<2mw|KFTJo|G2=L5t8QcpPHf7z66D7BU|8Do12y4q zhW+`0{eR7U6J*V!v?*%h(oA&tYa~ApoMSre%iAUywC7o=dvMbMrc9nA*4jVQ3$;3q zr*1U6X>e=~c8-8Uxd3JYom$$YsgVhLu#ZNLh zQl7~7HB1yV$389qJ32x7!<@hT|CpdbKF{V(kc~zT5dgUvhKffVId*v`ga%_eG5NfvUG$ou2_?EYHKnvGF#QR2zbV!WijwID;$SyG?De|FppNKzY!4o+_ zx!X9d>x@Q}r}K#Nw4p&8Hmiw3Le|gB1c2e6sUrHuxtAL1PP~bg{GoG?eI*g~%C{>q z$G2+&<`cxPmr$p}Ncj&wCB{hrAO`&SGpkNN-e^-Y!nn7`qaf3wP6xvJDhooQNGyx3 zmWRj>%^F~VmMiEX)_f7${s(FLeuDq1SGG~32EvK)jEt4pb~t0gi3C6k=3Jb#`*din zvRace-Q~X#Pr0=~QD-bf;{+Q#!dm~K_rQY%a|6jVv7ZM!sOUWiY;Qw)y^O^9;F%)g ztJr^wQ#NY1VM2@2kT?oE;eY%e3ICCIKr!dr*c?Wg6jDFFP2erjO)0t-g4;+YgcA?G z3Gv`mCuk=e^%qfq!d;uxq}h?le`oR%lUy4bG~i^DmF>2TcrF|B;7|#>4O*;zr-oz;*ppc2e0E>)* zmOL7Kf4YJif(L=-4b|6`={V=jhyBN^BYS&_|A zU`%^_zw;EpNpffzbVB#9cret`nX*B0z`Sc5j|Di|Kp225h~vru?f6HjA%{tfIUSN6 zZ9)6N)+w4pnjC0ZY?A?&SU(M-gDPNAMF(sgcEoPye}H^% zFy#1vZU_Og${ERaLDMx&@6@WnCxSlVfb9NTSOx<6}3_4~4>b~GCV7(#4 zEU_&sKPJGD3v6XLa#|>|7{SwYM&)@p`*7U?j%XmLiG&b4%ppA}!l-%rA`?0p4C##}st13W zC#&#OaSrVrnwmO{*aK{DjH<3lN6b0o&`Jx41|p#D#h-$}Ph1`FE<`nh3s-q1-tQJ@ zRu&DdW?vQoO!f&lEj76??hMA*{cgyNL7rSh;xHf}ah^9)Xz?e+jcLbSy}u1-)|baAkGD*&$9cvtt?2(twzMvCjor2Hqm< z(ahD|;E+MsyHSAc2`Z~O>0nuLFCTKBM++bLPYfR>7u7dWRta{&nCnnAQuH_&545!;@DqjNBjsj*!gYLk$3@4?Sj zYq?~(LCt%5FoMIe5_SQzLlweskU?lJ?I_B`1Ao7(@N0q`kOq;05uHZ{Iaz|vaZ?h3 z;f8&-#T|)&AZuI=6rr2M@qrQN0lFLKSWpkp24oC^F!ws$l)Pada6Cg297p_@bKvQ^ zA>|<51R~cSaAHkTp2#M)&%d$>7{l&0$`mvJ!rtIcU{A;`Z0&HrZ4R7$WBY_i`%saW zm?uK31E>Lk6T**^KZ4bWB!`_w-8(qV$OT1?5&m(xVIU7lezSFgbz5jP4PP_fG3!%@ z(TLwt)DFVnz_`vO*AO%E+u1c_^;Q2kZSs%g03zrhLX`fI8MSdZ<5RM08zMOV zOU;1=tTtdpMd|NE;5ZxHU8GeI*#U1PHV@9TTfD!4?z_Q_0qXBWtk;s$UNhwU5&KAF zUR>>6cJG6yk!kZvA2!tTHk*qls4h(O=SlPrD;@rU1ADwfm-y5X7i+RI zDZQo3H$pn?d*pi^*DKN#cSPORL%uk-`EuIy=l9i|uZ{=0c$A)c)Uplvk^6HQm{a#{ zyy%XUvR_~N?=D;5C)ZU{4=JNB{i4hbUpyCm$QK#DQ=He!^w*7VvMc{w_mX{0l-ESKUc_RCdg{Zjy z<0scSpJJP=wae;<1KL(LA!~CxB$ivk?{40@^TNtz#m8Ptj|b;_z2ut`k3Q(TsM307Wf-$Q?9iEG+wF(E!MU;Y7MCh- zh*D%4CfpsWi#F~khl7oyG*~m(yX$atEcY0N7X~hZ=&l@&#myf>yIv; z3f1eTI2%vf4$Rp`rp^t^hZGlmjCX&-HE*UpXI67sd%1NGB0~@6CwmKHlmeo)mR-DS z1T7y%`##q#KvgbOveq0^`Ux zUL6P?UX)mTzV(eN53@Pwqf$+6Q9MP*wo5nEEL)Alhs@+_gMSQ~r7XAq^5GBe)EDtP4eEtf zm91TZFFf{?2w9yzlM)@WI%LMACh3e(nzfFN;k!?T?3t{(wYC2K!h8OZBAX5^s=T&4 z@xirj$CyXW^hz(YI{U(5w99HJW-;{31#1aw)}PTqPx6fFGE?1{$a>Dp6t`qeV3C^r z>$V>2gj#y<$;vtFO5ejnk1ygs6E?Rs^eqH6F9;ZGEnO(KTMORR5a(zeTJ~1Gan*Id zIktRAd`hZ+CV9c2C(>z$%I2rLU)#96Ef2iv-%Fevkotug6tq5*l5$%&Y2Uy|`%|+T zh9$-}4ArO3tX4p-FB9sxBeEpJoZ`-Fae4TWr4Ya7tjSUZxROZ~3*}R?UaxHmFWN5c zJrSzKcWL~`(AupKSb#X#D$uGfEi& z+1^xgBtGtBdGqw2r}xJ782P;QOl!@G*77(l(Sq;pHV#>)cjJ&ZeUU*Ou20 zSKe>jCAca?@w9Yl|6+KgPkAm`m*-Tl4w1+F*mn}5bIHH;B@-7Ud(>P12wol|)bFmA zQXcm+@2e$N6nyH+!wxrKt)H`jFwMfpr9HbBWoe5F`#JddJ)H*^G3ASc5yx%~I226& zD7r8;fT`GOnvzd^@T9x0bgH7XOwc0bIZ;d9N_&m2ZM*tuYW-sOY5401OM#UOfx{m7 z+IGLKJH@2d`zlwi4sZQ1`VwvzhN~}%7(AX=OFxiR@qUMw6wBw%6lWWX{2)4A6d46_$kEpDgoIVHSWuglJ5C7a~AOf7;vFm4cU*OW&fcZNc$o#$N zCgh5e9DM)jcweNfdA$I`&s|EF4up5DNMn&Kh_xuT4DmQ-c|lF zh7)C1jSIXI_HB)RJe2jZrTUs zc`L^Y%5!VNYV)G1x9^Ayj>b+5*-l!#(H0$LrsYOdXcf=rd35JzK$V;>*a5Hoye-oC zd(lqSB+Rja`ah6Qe*KY?oG!lOAlGuLqohIF=PwZj1{WP^sqb|01v7;QmmM_=JmrtF zh?gr1w5?N^q}F)q$}#mBhv%(q8wAqYRjxYBy1tz`CGTZP@H zM3?e`Ld?{um3G|4()Hy0#-&bO%fJnWr$6470!J%lBk!qnIqIo9kQaM8Dk+9xRN z7=Ykq*MjZ-sg9u=PhPqC>L1m6NCTXcAn?7e`{}%^3L|?%h!X zUPEGsl9_~^H2=^{%Fi82*Z1d>SD(fVWA)CcljcV=RDgm zO_8i$Z9U^N@>SRVN)9s^(B82FXSHIc-P?cDFhC3^Q5)?_)lT4<38t2h=5<(ceWCVm zJ@7gy`t6M2ifa%P`)0=5Z@w*=5IN=={3)?3wip}ZlG39Z+_WClby+>f6F>6dR?Osq zNw4$3nkN&jY_J%*wLGs1cU2FNDHedH-hIkixdWcyU zJU@?J!hEI=z2f=f;e5t!>E7C@POqtG?F>Z$BN>n3sC^4Tbllh#qo*l4#yzKpPL8}> zcG;s%aq5|WI=6n5Fk%)>zv9sQA*!n9O5LBy5k8oMkwd!Jfb7BC1C@4d)4>CyU3CSq zEw37WhTYNg7hj~Y_L|QbFJJXb?~adkJEzDd2YxDUn`zdrRM)|;apz#hCu1&Y7GSy< z71J-=>*Lo4lPj(oQYUniYyWr=uX9qJFZS*{zE10$i>>JI8kJMCYE;ipOPOmy36TkH z-kB$|CKJy|SbNpk_sqv>jrgq0uDWeM788&?@_6s94^g_S>pc~I1?9_Kozk6{l@9+` zllsinqiy+-48IAi8((C{#X^#_%=kPC#p+rH(t5t4@svxu{JVA4<142$7a~e=2Rl6; zEFZj(Wy_r9tK8cwzrOrye=Qxml3|DK4p_T96;f4LV1vms8Kh0tMOic3Jn18z!8H=6 zXW>4gJG4ABOiP=>x&I{BYi`|hdiCfulZH8FYx{-Dwt8aLoCjXI9c~+ z)Kua3;t}W6s54%@ALjo|K4zU;p{})3vWU(1rfFTxsdFfdla}e(`hKw`%fv;(kK#R4 zo8NcSAs~Vnst*;>KtM@|-cWqPa(VVpKvdQPVd00w)4o^JKhfl58}kDj{Yd|TZ`84| z^qk@UfK;?82Oyv2@A_XsaC}6|;>%B)YknQUploohj|X2>;k&hh5%@%K^pVi9j&nw0 z$51v4kFD!RVhhIjU-nMh1&>8K4p5tA3hexkh4}1+MINuVxvdu}&QoF2EAy#h^8K05 zZP&0{@@n7-tsjm4eo^4BxkO8ybI9K?dv-9S)%lAHtYm76k*51B zfV|w2bst;kf_6DOn&(^M$>5IRIWbnU)*h~aN~ocWSlX1)x_ntbI?@z_B=FA(aiz11 z9(u+~2^}AA#cSh^_2;x?<$2yqt2?yrzfuQp$<>hwx3p&Kew4&ES!GwNXu+S!UMGWT zkvuAV{>`7X+qYffwQW0Kv$R_`l7O9k-*7P$wNlHMn>3;8skIoOY9y*Ie5Guhm+#&#W0dTRd21l zlZ@xTrW;+@d=z<<&-`|YiqB0~)zb^&r)MM$+O>J@MU5pJ=bh``>!x?CI7Vv!qMV7{ zdDKpl-B&+ZOL}HIL~GbJ*WPAqlc=T?jG6c*vTHv9&i2cP5l2s9`IL2b}R_T zV5k{tmp{8;*N}#Xv}tT#w(>mBh^^`=rtwB?66Vti$d>(D{xTJPP`u6UMd%o20)7nx zrTW0rlg)pQyZ8vaQC)ktlBq)%NmI<277!5ZN^cqU4b=;2;4SB^Gz~FcDf_TW5|y0E z3r`kZTgnkQ<~Jc#;L-h;C$e&d$d*y53w?fTnr53WPPD{^z0A|aOR2fdD%=*ybb+I7Pdq2so{`D zDXZl}Q15h?7P8r1tIa278;*3=HYE+rs@xQ=#?mQ{A! zBk@UQc7io{#gUOurUXBc+}~IEWJokbgQ!Jy?XHcy`B%qN**?Ntvv>pnr2HEB)$ht%F@cx3VXGJifp3b z9MljHkowf8bK|*OuDuA0oN>$1#dF_IA^%`K(k=7oMFfuspA1n*RQAK7r|c`M<3Bc5 zxLU2LBu`>iT4L9)c?8RGEe%aa*GQz)*7N*&>>_OiE9AK{v0nW^vCXqaqBL)0teG-L z8=7gZlOROe2h&v<1vBnx?X|DTOlWrw^`q(ct;I=gEgO;F|2cbi#J z9`_2S&%qkz%6w$pyaKgcw>8Y=d7ldQd`mTq_AHmMWHeFcD3jDCokSj8*6Kv!leE^3 zjFE*`d?;;e!rGIOhIw)xupyokFzIS-TkbVM2?}_AY%TnwM_|9FHL{|;(8piCdBhh6 zUvOFQ>+E~XnK{n&ZHqj2mV-pT`~LqMKmI?>F8?ntMi;a!zBb0?7p*TdBiMtiU#k%! zV!XXJ6j=kh2_^V(kG_1l`RZyjD`?uia^AfL^czYraxc!?f$sG--%&sBVqeK%e!bkG zD6yk|O;SLF$!`wZvFC1eIKT6X3=JeJVMOwZ;17DYxn_(``1W#lmsJo{Dh7{L&K#pq zBIB)snAQX6vPn-b>yC~2t~)=h7PFjzk;ctghS09n9qU(Ai731>(li*38x6l}?N#n8 ztz7Z>1z*id|3bx}p;v&}8On9}ip9Yv!62d4G_N)^3q)(LU-Ne-EqlBz%3Ex3)-o#t z0qp^hQTqrETE!AV>yh0di#Y60geKV8EWc=~VnsB~8_|Ha4-dy+>?-8X_Of8OJ~@4;^2?!N@{@52 zwk~QAQM~$BKOPaD3K}_9uc(~dG4|M!?{+{L%t-kuJuq7{j5iqvD`!TT)iGm`4}Dl+ zTx9(n|9YxeUFDSNrY|G7Pa}6F*56CWeJUD?${(m)I>O4_PU-27@@-DmtXT+QEf`15 zAo63yN@-FS51Lzz=E7UE?~Y4|(ylai zEb-TNgR*nxUqqviLf{F?*!E5-8OWoudA8S!P!C!ay>(O;X}s~4E-C?HB- zaKMe5rASwd1Xd6dY3=z@(_3-xwu;)HYu2YkK_?pEO^JU*#ig)TNA^&XkV1QA^H@_^ zTE_M96d`1paG)@@-?!7&(WSkqtz~pf$cP7Ays5>gDXHqm9dIh<#gnPr18H&Ep{8&c z!qtiytnEp-^i(ud&svo?Tiu9Z24`O^ZGBPGp#Hf_FZTJ+4I|;8%WvW&r+qQZ9~}^= z|0#bW?f=mB=5a};ecy01P1B6l*i5E{DK*Vhre;nq( zYqN#m^U2{st`@q7z)Iolaj-}BIMum8Ar`ge{KAe(ej&d&5I(bnd$$H21W5Ib1{3#b zvEnvVcKeS*6$l7K@{PGhEWkz2@7-N~THug}o>3#Wqh3^a=gRSr@7;Fa_c?W;8@O&P z_xNtSd|&S7d{-7<6p2eF-FGbfT;}U7Qr-qCH2H^p>Uld?Q+=(YEO79TiaE=$tFE}P zml3_Q`DPm75AqkNkqW9Kz?E_%e2*y%Z}p=qHSpZy>d6YGRsZxO-iMuRz78ArrHZw* z{a=_ay!e!8bi%+ow#>Gl?F9RBn_&LeAL^$VXRccdv3LagZLA<|XV_&sur#Vplw)0N z#Rp`0j%^yMPcEuYJ)&}rOLF(#RD-0l6hgi{)MoL=QVl$q0Ah4Syu=OH_J?X{S{blm z;_6k$+~4#w+5JFcvr6IO(mT&3q&q7(Go34!3s@2J|J-6{fs4NTZ9ZmMy2RO`Fyi;# z;qyI53&z(Tk(8GSMCCqIIP=UjrpM%wYORaN4nHwRA6C!<831jMG=#@_Oy{~2^YdL} ztE6*K+(aq1V&M)%kPNXXtYGlUMrucTO3O=V@6@sKvuH1B2T+CkYFwzFQ+kKEU#NBQ zYQy|d4zyV(@r78Ov5XrLc9Q(gkp7705}|teoZef_?dWSsZSiXq=bLew);A2g)9Bol z@@vP7BD_Z(BGmI%rE|IEcMW_zPe21Gv5qbxB}$gRr$HiVi^RqxejCG6U-azA?#z5w zXvo^Zh6%x`6OwL|s(NX2m%=>mg&I!(cyXmc*1*ne;Sy43)aiG1sp9f%&%b43|39K* z|MW2Cy7^Ijdh!j;_QtAM*+JhM0P+e_+}{=t-CmR2THSmdS^9PqM8*LT$sm|^k>EqJ zz2&A?r7=6D#WT^(&A!|CEMjJiEJZzmRU0c|<|X@`S_yWuJ??N;YK!^4ngh=3AiO+< z7ylp+wGp3*Qk$wrkJX8qw`1F1qugIFw`eQ{^!qYFre*Q6%=cvBi9ni{oabV)#!e+O z)y>SodGwb&(6rRB0|4E~pR2C8S96|7`-TlFqcDd~G8!Y3pV&H56c;LCR2F9>R~BbsGIgth3Pbao;ll&-s;q;GBZ~eQmR;nF-_@h}qq?kPeljN2 zzFyUmx>nQj@9*_Bf7eN`Yll-sw&>|gd1Nw0sZQ!H>sQx43{)DgzaCNS;oE@V5$tp| zFX*&H=er8KkTWc|R&KyZc?Cm1joXF%+!~r~he*z`F&LS=Ww2RXbbop`J9|J}q`0;HY1|cS`0)l3b>=KH*9O-4M4Hl50-F#* zD@~Gyz+ji1Qs=)W7y2J-nO4+a=+a5&&Oa**+x!-nRLL%;mC8qEcru<3KHVXoMeTgj zDJqAwrZfAb^(r4er<65lT8fSz=$sFu#i{Dc87-Y7b#0ME=~8z2N0q!IWb@YZl}K*T zG~aF4^%t&3_8Sfc2u%(M$S?kubb7%S=COjuP~VjClb?I6MZ4vja%N@TP|XL_q4w)s zNzwb0^rs{uIS^m#ZbpE<^UjY##&40^2jkcQS!4gXnk~rdz zWRdATkJkF7mvA8_xZh!<^HOOVfiAlLad5b)biOANhPdkJVS=J_W0sPWWf?;tQo5Av zqBD&fxzoIsxc5}f-tKVVEGqq#DeCbrdp`gSS;FLJ!N)P^FkGIjW*P1K}&l%&||c)A1go-p$yW7IlGeTQqtAmEGY&i@-xI%kGey-Y0~ zVr2=1hUfhMf!N%M(>UGw^9$hhw5LHn_{X6skOJTM;ff+}0Fi>_=t5exV0E>7k|waF4j~hnFB@-=Yr(LU!zj(sk>v=#C)Vq0%@u@7lY z1=Gqu#xv@T%yS(yg}Du)xc(w6g56CZk?X4Eq2VBPtJ`p-msi6Gj?S*szr!`Jp>`&D z;Lq?vH;P)N*(bdQB;&|Cfh%lQ*urhf;xum0;imFGb~2m1sJt(kQajgyxqkg-`W)P= z{W$1$;acYNL+>7LONB^1_-7N8U+oKF<74ecT6c*V@}V?ohDWRPn?2}!*NcXL1@($+ zkAzsG^)!Q%sw6tUnym7H^V(}~jlT?tfW!RcVs{h2uw;CpNJN%66Uav9C1={d&9f(7 zfnRA^37eB0UgMtiZpFUrV|8YA$1nDPM6p3#OSsS*>}@~tCR5k`y)V%)09&)++jT$1 z&`K+aa+D3gWp|BvuR&?z!)V_73dLQww(GpDQwKZjj6$->o-zBvPZ@>O0kdKZ4*-kj zO8Xt!AP`FFMb?Wm5qiVJkxomn%oy|WWyktyx$X_-bW%Nesz>a3BY8OHQ5BXB-UuRC zd!S*cyKfyNCf`W6qb@gMC1pavpGU6WVqU`9!lB`{@GA1B7sNhmJL>%dcI;I}EsrD< z!L46YF)Uc4JqjIo!W*~dG#4xQs%^y}zF72Y+-dM$^Ebn1!=`_H zM?q2BS$)O49SHzfkx-rqIC|*p^kRw5=Y^FYuA%vvJZ@ceOGh6hGDGXdVbGMpSmPS( zw~~w6Uspp_zH43*=tiZ~lddB^ndtwbB@@1kaHmvB!dPfd^9v7%fv(Z&*w$*J?Iq@# zA;h~4UQz>QY(`X-SnX1c8G%~(=&^gAY0D9NTnAzXpMOlJLAO_CP+%Nf{XFkjjEMgL zfcDtq;NoTLTW|b;ue=zfs}z;A9^9Q4FBJCGmZ?9v^>496$k#f|U4Je0r(OpCv(@`& zlyD$q<7qVy;-Bdu&+`xc+VsVF@yKpUwayaAh2~|TTRUS0>q6Z^f47U&PixYt6hnN| zW+^_P@VitV0;B*pQGD)bOIS zmgI{80^Qu32})1C=Rfw9e+0ETYuU>=X{rpb+SerMg$n0dF@w>qCLc^^<=;flv{?n? zZq-q8HPP^WnO{-lJy~ zk+blnSIV{JFmlcdtPSi~qqal$q)CX1kxoe$Um-K*5aiyA1C;P8B7!rQpi?M((n58I z@AmATWAsEbn!Yj4wO9*j=Jp`YxVEPKh?nPQweKto^A_UU&Qd4>Ps z8=0v(L6(lEdd+I0eY4s9FcAVKN*tH*jvlg}nIQDi1buZPfO~BdsS-rCpQzmp;|pa( z{WK|hM3QednQ6%*h;#Hu7Odj@F_)!~v8U|C$L<$$O zxB;|dxnbGj7SBkrHKc9ckX6n_%PROeXF`(zZ9GvLQqC4zlML%A&^iJ4W% z9<%-^S&Wd8LB)sIQiSAOE3u-E7$d0XM1|xIA1@$f<~n;U?xE%8U0ReyD4U7PlXoWN z5p2J_{zQh)p%-R)s7W;t9??_GG*k_6>&eJ2ve3E?t*l@9sG%D0$9HP2#>=;c!q?2M z?pZ7-ihR;(x)zO=w@l(Tjb~Sj9E4raU)f_E3g*r!g)!P^TYaEJ0?%=mIH%=#Cc!{S zYlN6-;G4bEnk-t_!`*2OcjVP6|F|>4*b3=xzmyR-0NG75PO6$Y&CDm=PIqBWuu9?Q z3lQlGGoR5dEnkE^rq<_^Cg;kLwKGF;wpaxBc`N)*GX;-W3zwE)ukaS3IH{}xId zKGiA^%c6q7@>samLP7i>T93&#sSL9bc`7~P^kpNS!~vmmt7SU1+hRh|mw0QI8;)Ab zE5#iTNJ?*p((-6_roL>`%z8@^icBKSCYWdBx|pDjE@B)MbupPcQNu}9P4W737|iPW zJUhII2?D^B5L`T3hTZEx*oFzf)(aCR_txQuC6d2q*B{^=;9TUIM>GtjZ}X3w^_%2= z9-%3Zc36VN>dlEvs;XC3M9wOmgbOSq(U!S5DQ`XwyC`_vl8z1Vf{UCKwJ=b#B)HU7 zVhMwGU8Nk5Hoba^ah&I6GoSFbgq}7!-~QX&#)XF2`Q9lO=>CLNCUT_ln0cl@+Avpd z(c)+H9mVJXnELE=X8ZLFC8rq&^_~ie(4{yT z<498coko+=etA6kC3)9h3F%L6PY78$K(G__z))&Lq#~_P^1m5@gs$8}n^L>dVscd2vh>{tWh`8a{N za*!zWo)^tNT`=`j=~hvx?o%lT7&$cmEdtbQBB{BlDVhnwBeQA*hx1A*nhOxG>D8~2&mY`I)+?M%KQ{y^sia8En(gnLCjz%=t8AzrjKo92bu@4WhCf@ zUi4CmXju!Y8=JUD?{~=%k=_~kvE9ne4=oiX!|amCE)}BGqDFbznQ^_ewP19>G*2Lw zpq+6i01H7tmVO8}T$l;db1Q)E5X2|Je5fLBJ3-9Mx&bD&n=JfmZm}Xlh{korAAdT) zVTR}}rrpa!){q!2M`Nd|{Lva|ABn*{aS`9n|2XRs*E~<&FQbio5!Nwg{q%-ix<+P1 zTv8svE>cJ$1 zPD*k^BUy(n8mf=Bs{FFX_a0ytnk`U@u+|1PS7$dW#FR)h(Ki#DOOGWA9*51^^@Z%E z?NmbMXLP;aiR*HSH6vvHLztlc{K8-ttsV%jBlzU)Y!&1X0&#IYWxYHHu=^vgn?*fMMVZ>NIsrj z!yd(w@!Z+I79IFZapZeyz=D<;gU;=O-tsxlk%V@~bekqnT^3tQshwIF9Pbv?2~;|U z*=*ipcxDnzH4u_3@8A1ibm34^dNkijG_kGWy-3D|bw?>VebBV|nL8)~l`>O?=@-w7 z4xr z-yy})=S2&g-!OUXF;*oUE9RlRl?6yKQXWr6$MBrcSURTqD9`k|DrJKEg>xygn=H2! zv4}P}{ds;!xDAD-?~;U_O{>T)9Y>vI`71h-cf}b)oS4B133Eq$dY74UW|wMUA}WF| z<_}GGr}uJyP1~C{zTlM{Ya8G0fes%YTK7j!$;d48BZmiTmWNEvLO0kh`Yn*_@P_dV z1tdCEqNp=F_`w$`^$Zk0%S5(+{0%eCls zafai15wkBtwqpv92e-=W;yR+x5w$CYq$+Bo}+Zhndul`{5`68u`*{d z(_5k2?8h*xE}2Q2T+JMkz4`cB z4_mosma#AfD!V-~ZMn;hp*8T+qaP(d&b~ygn7P(*?MM3Om|^X)4a1YCe){hp-RQV> zo${G<*3gbWQ2(r+DOp+N_Y`&!n^1i^;Ae>0ZH40_olos6+UWzFAd}a*nx~83_&1{V zPx&oFM{_!TZrSK&nO<(O7y}tVvzp%wibuyNqfI{=7msAqbV)>&PyS+nY;RJo#%3I-|>{UNvjc!Lb)cBi8cRHCy~MX#>&DLdo2H zR!RvO-^oF6E<)k=0%iauThu*2a*W_sS0$;p6vWtmBpg=MaX{qM(w;gTF>V1RlVf4w z3w3r$SoRpfjazdY7R{MDX)T|D8aBy3mVc3Kpnvb#Ds(F#h4O^?A~`A$!pFb4#d^<%vyKglG?^8cc?=C zAcyhgBo%F3A7ggepC*SDlkP7z6eHXk*)gOoixw1AYZ1rwx1`l_PKLi;ecS{}NCnkB zRXD{ghSzUqIwto$0<2Nqp7@F<@-DqJ0N#e51t{)gj4ORv?1wRK^ze7>E0pgE*ig7` zH2>@m^s<9|FVkqnHzkqL*;bKx#yl&l#ns1#*H31~`EHvSVbq7NQkV3tezB7x9htT3 zrK^1vimRJTl4{Uk=*eG92sh6fHXg37D=hTN}&HENT^6H>S-g+*rAWDy}}p3>|){L^7%# zU~>;LcZRY2w}8bpRsXqH3tN*QsdWkDwO<*iUtb_ZLFfkVBJ#Y@MY&+XXLcg}Ia01G z0$s`Minn!$qZ>?ek3!SrJhOS`*%1MmD&{<;$forinK2-}b7|jSAxyZM2VO$#&h2ZO zq^42Mxujn}g}-V{-xiu=SU5l|jVRFY0dMJ?ur{-v59 zap46~aYwB!C5H)v8NFkR`3}l%A{xnnF?anp{%3tv5mWA{r1rXsA)c4g+L&CC&+%P1IL zl4~012zHyNFk=cbY|JH#mBvI;f5jy z-lrx3l@j*`gZ^`z!&8m+BH;CLGg#&Irk@(p>vk%iZ@|FU;4>RlDNqc(mqil(oj#HY z;1#sWB7Xw+s6_OKP+Z3N#QhEJLdX|A;2<$3U5LEKd2)CPs+-ZIAb0Ui1u_dX=TPPV z#mE7nRnIvakt;9FkFscj@tR5moK{nsKMqY|nSWO-bT1tF8E-enTB%Q~@fY$59*s|&i~STdrz%K8=_P2` zZeBr9b)#O;R@>zrn(|wfPr_qxkEgwTNTloj!WNP<M`(gvStg8BR=OX2IXU$NN5y% zQY6g8UNXZle!S6Q@WuK0N$>*R-6GNCg48opE6W%|V@mnj#fCY~wI(SV9$O$}%?Th| zw&^<|`{Kq4E*8q>-SjC8?!E*hMPuAo(CklG*|jp(t&ToN)-d5740o6{y*`>#;|-2( zoP~s=eA`GaVvZkAqDzMrqRjOx@ht{3dw&58WUxcOr?>B=xygAiYQ ze1#7?$;9XhC{H%vEocEs^v#+z6-fY*y~k5y&TnpxsZqnS){T2Y5}hN$YL$x6{wa=NFLZ+D37g(+bS+)LQ9kj zBdU)oZ|FDuUM@d4d^#Gw$1`n!)3QpIR7q4m^uRUhbVHle>z}c6VQ!hf@4qJBX=Hxx z`aELHJfqs><*BI#7n01Izyv|?v7Rwr3?n7SIZ36;`4liyPwGB9TH{}Pm&6*k=wnm4 z0Yo$@l`1q%!Z>n5tl9N<1Ma9OIW_^fTonBZJlQm>rMBtsWc{Mq0a3C8Pi%Z@%KDFn zfH?gLa?Rn!DTx;cD<}Fl%2(=u!+3&8Kl=tFD~AF1;5CTs=-`*RP01yk^rjMEi4Q}Tk_$Zum|aH&+*+Xv2HYf<>iQlc1g^knr@3Ra@?d^DqttBmRcwjN^W)m@ zEdvrnzr8Leu4troY){HbC%rFIme5|6C=d}z`-|NK0aMu*LKT|_q|5z>d)f!+r5y~f z(3`V}mOm#E+`^ITz&>V8W;@gzTVNcxzIf1^*KcK{ys%sTeKCk2yKq}-<0=nNp^#To z=)E;U7fyy;2hTAue1VHv|a9IKSU{5j{3%Qdr0C1D&S1NTOG zmXE8y>rE)FWN;hPKlu5)6P2gkZj5g`35-ZfRw}2o4nybGFsPi;D~EW;qd9Nu3zR?6 z?JVvk8*pKmCPN0RX2kpEK-{0PN`Z9`(*I6_WgLDYN_+l*a<O!vIntXt7BzPu8ov)fe%@4dyW-PNge zX7Sk8!4~c;-f8&mtn+g#m#2Toz7K3!D5i@Neg)2cE5_~c@;v3Ex#0sh**q(QMdyq1 ziR`~I%DN$}jPqF9DQ%5Bf?2mIe4)5x#B&onYK$9$(AzyLtj0a;kd&gz7B)AYQ<{vz zeX3pwP3IoW!Hv5SJLBy7;(Fqhqw=|4DdsgaTe*)qIx8uV2uy#jHE`hx-3T6{C@%XT zQka8JOs>eQ#qRGMnN698b;|G|RrluQHv=xA(Uk&;AsRuV3R!SAhsA(dlq@=(mEfDG zdne#hV8FALPrs02IxWzx{(J{!MvV*e&g@h7^(`G!mno&d@ifNA$4d6T(R#Z|L=+4mfgdG9t`_ z8mdsw8TahFgl$kFTY+>No(=ZaLz6hA_^6t99w9xCwZbfG#}#}w>lX;m{-HdirAz+K zIi$zxCuQ(rMIg<%&&n9{QcPPICu7#0gi1J8TQD=7=n9qINjVW;-Xy?Twx3O3S`sBQ zQ<2#nRzG06yR0B4zVqEy%Z8Z-Jge_L7LUD{n-eM?p_NvY;-Z*`{K^L?7VxQNi0Lm6 zY#OW3BFj*C&0^$G4IDQpNb0i2`3q3fBnL986TAJozi)-q3)91qA7Jb&?o!HxmNb{f zi1_KD!9LrI4IV zuoLJ8U?sa-XPLh?NF|Whl*94|pG5*#Y92IswLC^N zTC;^LWMj3uEXo%rx$7DOL~wr=mtEtFKclQ_3$Rf!X5&T|YpKl}U5-!r-87M__#|kf z;{xX}0-^9JSNxKzVpeZ(m>P`0{X`T@@Sv@ z-t7K8=tcVs#nwkUMf`7^9T>N$%F4JYRINH?Iaec=ziZ9atU~+O+Sdz1)Y;2BHM4+u zOEVAUI+guQoxSXti$-KqHl5#jYPa&z-NE!bk9k+4c_#Pn#oJbTOmY1+qxs*4+-Xc_ z|20tWC5WaGA2iV()%)4 zCZ8NVnM-_!-JKPj)LtKRF@_-2@~Th3e5?HI^Zeaz@oXq5qRH@-Je@cNhA9hLEdfUmDL{ipUc$PZ9Z~aT?FH zA&cKz{IKlh8t@tWEkl~LGyoY*hjjkK1Ll$Es5Q&3ZZ<#bJ&Ju&y#fqPmf5JozA+$M z)=n9q)Svp)zH-^@!4SVK=}>q;IJd4mcA7q?BV<<_0eNcYcx_;7Ml@Ys2E;Ug4ct!! zx}J|fAbdvxBx4pOcwz)^>)a)@A^nSZ@QNx~Im@{LlEGj_3Yxz=km1Mk0-4Au5OM=G zRCW_g$RU|Zrv`08X{2Lv3ks=NjBrDfqEZ^=ye$8PKI@&;wI~+Bkc!~7$a#wy z8*R1D8iHtHCY$@W{rw<=zek3V*kqo-6CC`ORLldzZH_XV> zKyEhqw3PX)U~ZK@u4js=t!G8^_s#AT?#8J6`P`YAHLL zmv2nVT}~z?P7Qp!@27k-^30H3GutSVMU_a@iU)N;dk-kMQ!(}9sa4~tPq6Dt8R7j} zT8myikzmT)2VDh51Z#%1KhvNC%QKm@?CL2Z@-p&>@o-=9}6A zmixfj7Q{xK_Is3+wn{=xq8^h<8wJ8(mnIe9qVz>)$8JOyl4reyn6hJp&4Z=sy?M^S zCA9M8lG7v?oS&mmw6}C&<_NKHo@w%3|; zR1dzpV0pRam2Ik{^7K08!w%B`RVocT&NKC`P-Vs|)2gR|(C9O=f1XVOzuQuIqL=ad zMvznVqCILcx^gl6`(|n~NPn~u%J+N-QWp2OVug=rqI7YgsQ->Uq5w{iumjF6W`^-OM9q@s=rCC&x%B1I$; zDHF#iW7}h=!a;R``>AF{r=&nQrpJO3{VqL7d=%gKy$Ft~6)jj~`fjWBo3U)EVs>vm z54*ZPx=n~0C7r3B+0R`0#4q^(A{kdL7u5wQXhLhdtFc6Ey-3m@rwmn|q#JZ`YU^^1 zD0W|7Z@CkgyVeE)af17%AoNPBkInYw@v77__qGEy6!Zl%JYbC`YT~7}TQKyzG|t2J z+y2B*y=6sXznbqT@{d+|Gy@sJsecM*Mw70LXP+ZOD;Xu5c8R z#O4v!=~N14$NI31!^6-tuOB>mx60FNmCqK&#GYICvxZ@% zaU_wAxu7yodAe82Rk9X!C%Wniv_`cunpc%39l>49$OkpJlVC+=3~<~QOv6>Eia2@m zW{yjN*cM-G)-4fG3Zl9ZA5(ZN)g;R@y;w_>{Mz)5f9${m!>&G+9C34iayoW!98xPh z$#I`bsts&xm$aTuqL0-)_a@2mnQMUzjvVVhBannX@6PBJnm6RRHDoCFzy<(Ro-trn zq?jcgUi9L%e|gXm?<`JQgY#<%*w*m7IsKkH(;yeR=(QjVMYUq8W0>pS_-6;bwm_)D z4`G|;<9*pEGP=Y}?vz`cvU(y1=tXBK6M*Lb5hw?8zq2iTI2OEWoiyB=VDib(c!#-9 znR74%^WF`y;vn=VlLK-w;J8DS>y2DFS|4UtM$22<&wj!_x{f_Gky>UVOf6LI>lvAa zE1j#bSrx|^2T;jMqv{NFF8+51`;l8CWK}s>r_NJCLzV6xWx;92r(%X*31j@=NTMp! z+LV6EJVF~1n1N8WuhVA`L;aSfiT+gHU%Itbm1*zK5a8qodlwz9Q#lr-Fk!gyhF>75 z8wnDS^fSF0Y7+h3G)~r^-Xe&D__GW(FH z>)8D_3&+VX@+-d0yJ9D9#oB7#wM2~vYjvL<&+Ml5?t?!Rt#p!KDiTS1)NAWb&8;B# z9yj^sN+>&cYRGLI5omFhT8nP0V(imeO3H5)w9XI9rvQj6&OwH^VR^ZEWieu|&ZUB7T5KqR z&cr{RO&Rx-&$Y*eHjc$`{t8vB=tM*sHmYK)i7C_cQ6$be`~KJYnDx6^4R9FiMT|2i zA7?lJa0}+r19=(AL=m+>sX;j@(&Qx|BlYi@_5<2Q{9?BgYTptwCh{+#uKxLq3n zi5=SodxA1L%0w15!`R|ZEv-h3bMNA58e&z?7<~03E#)7#)A^&=M}pJ}Ea)k&Jkg_d zT(N1{;_~iAKK#JLg<{zx+Ik`wjrCgu!8fLO(R;n$JMkxwUiQUKiFB+MH6LSdQzX*X zJWMVS_V*{?PBx%*C2eRvY4c&ykGQHX9b>n6QM%0eaZQws7Mc@zoTqkp2RJusHYiI` zZ)&#TvTJJ&E)ta|!#JfTLI_2O8@FI&ja)C{pEdkclZX?^NNL>P>C!(lge*p0I8h}h z$8ia`a9+`{8!v!}sd-tPU^o6ml=TYgEay^@mMU2hzn8eu#tOro+*?sSooH5%a?^=v zZc-g)i6_L`w(y%j!^9epLDR%9A|P)Ai7BHKhLT5*4wNbAyV4oj0jkS3mPj4yqm% zQ+= zss}9i{(CT)PM^8c4?QqP&v-S}Wq; zf>bq$>Hkv54>-aJY6{PUbENUkJ=2e`=gv*Nkv4zn;sgrs(SmuW8iCMUM;%C7hWDM= z2us<+a}rvix!P1UzZB4_FSiJXqETWHu8lsPP;1K4H`-eF&iQ5YZ<)WUw}v7oojA8^ zjQkPx(w+ETOL>vo7*_$ERGs#jD!fuz-kVR+RwUr3q+K4)3@nT)P81>V$S?jl3ul)u6|*4 zx0G7N)G4c@r}uN+(TJpQ);4sl$avX7{`T{e_5AyJro&D=-g@akmlJX0SC7UmAr`Goj!6`9|fN z(VFmDD?;Z_Y=5*XbTSi18ErY_a23Ih7bFBOOU&2!_3UPcl!U{fi>mdn{>p$lC@7yl zUP{w~`$!c>m{N=~fo+934slYZY+r}I19QQL?j}0&>{OpKTcalDf3t?xOQb1EsVcFE z)oH2_7mRezp!Bxbx%hW=l4z2UB}HP3iqAGaOHrwtF&IRv3hR*L8MQDm^Z(yc$CT)Ddgg4j9Zvn#~0=VF*s@C zRvHXE82N}Vq|G5qc=Le_;y_du)vRl#r#aPeg=6++_xIhCXCM$|yv`1a-B&qZ=u%R> zdH?hM3yP7Oa=EWVFDr;xSM}_}%S(fAC!jnpL+HtZTffyKYmsyNTcBwMC>uMeqVw@^ zro6K4TS5k?s7$>)F}3GpJ^zdXH`VG?lHNa$r13M-w{#|YAclwGTHyNGR#id_zo!m= zJ8v64m=9y7I@(cvUDkas8G5zd{KjC#ghHWI%XfNtIiIj!(Ghc)`6d6&N?lE~8Ucou&8AH5?duEc zj+)=~rxJ}TATP|+#oRaWmD{2*Q}yFsT-XoWXmB9F>5A$_Fpa5n1XamRB&3tjs~C|s zG-*mqN{IV-tyXRSlPKf{?e328NQ8v;u!L6TGp{a*X0!sE3p!pMy2KC5xVjnq&$9J5 zI-dNa!Be6-U0+gGy#D_r^z#AQMqJjS+6*l*t^I|C)YrE!IklR3#E3A0z9pf=+D5HE zd8~UN^U_V8n`)z~?cToZ`XBHbLG`yvA5jG>hdl>k+x+p8y&4%d(}Qj>7$;x+kNW8m zkO=Nnmqoc`B(sQMKMV?@t&$4ZcWPN{-=i}xi_n068Q6$Njf_%PfIDBXj9CjAZP%NM ztP7O^bK)(|cQu{|rl8vI)O)uJ?$6w^Ul1!Kl2+_iSD|IZK;I8n-z{k!*M~*ej||f6 z{7wN9`U-gU9IbT6`hasofxlA#6sv3qo`dFvql6|WZrHyEqW*j6nGxSC51g2pdF0Z= z?c;`@Lt8po);AEPSW8Vq9oyAQ#`4*TuMl)IYfRQ}@6l#n;S(}TI4H8T5zsu|KV2v= z!HbMfhr#tspHi#Xb2rjx$NvIHw#I8@vf1k(alYk2>(Tzh9pjq^}{&mYSHcbq) z@@GJO39w*{ACjr&<~x4lipsIx7~>F#CNVS{{?jnrX|oFuB5Vpd&T~6EpILRX{pxiQWq(eI+c1u1Sr{!>yaGDkN zXXR(C1gna^EgWpBXu?{qReztm1UuSi2dyz#26QXT22sz8ha4b}g`;Vu6J&I$SSKcV zhx$rm8mN9~glk;TX-^5!*1Xs9S3yO_x}QXs&KWP1%L9ek>9^BKBae}Qi!BI0Gey6l z{?en3Ao5zO@Ehy@M+8WH;lH=b0VLk9!lAeJ|GRL$Loz~1N@ zwZR2q0&i(Y!t8s&M`UDjNx~d$+7KqmW&yF1M=Rhx4=lAVyHHH4$``*My3?!}p8r$) zDmZ;zaJxAVl+S_iVEB9WefC&on3x;bq%=H{G3PRA1!G*iTGtpO+LoTXRI* zHm^MM_MVtbNZ^Ews5ep;qV*SuWV6*j5yqDa42=3PK&tQ- z?6pj({@dxLr~L}PMu6cO=EqH8ZaF}qP+zsHEY48#I{3B^pLx3}KMF(=y1F^%y$_>( z&VPE}`BCl1t98*Rp+(bh>V&$l1%N{FNW~M8Jo&99kAYV!EHaoCF#j|0oI=8}pbhJ^ z&%?fiZ1}8gKxzN0CPnsM)eNG?Y;D?Cn~DJ{jk}5(Tz3`IvfleZ;|lg)#gVPzGwne?R=3$Bd_z(eoRhZ^DAj1v21iNl2B)P( ze*vamQb`l;;^)qJI|5P~lrPVLUIY_F)U*aZscKiIW|B|vhZ8)WN%@lQZ1-gdb2x7z z(q96|oC{`-n44OcVXJ(yhZ>(umrp41pdZ?aklLGCDN{3dI?5yuF4o-&`No}~UQU}H zhv&PRUrLzCmg<`7zh3E7?U~HG`6m&a&85=uXbg1c^{wP?2YP#;!>DGo%qcpau(#^i zVm2L}yDwbp+EKgVIeFgO$=4uxX;Y1{9$$4#oOq6GmPGb>rhKdjZiRm$X*Ifnb`6zw zv_aeMRRxQ$x|=)JCn5f{Zhbu*s^07!%*UyYduQHOHeWQ&**;Z2bz1hO9Jo!nA5Q)9 zp4F3o{b~$O2mUASKKxY{QvG{C7b@CURnnt`e`6B01%}vSz8n?L){HbGd59gA88PZ+ z4a=5^#&(z+*d;W~_wn)!hm@k^8!pPRnZOYDuY=ZCU$ZF^IE&|WAhKqN-+a8z+Gy0C z6G{c*+};{&lL=qVv>(+)8^#YcZsYx={sO8Q#N5bK7hS8xdDWLwJ${X@jq-9_jlbG& zZdgxhn*G|?@q$IkJf^TMC)!>ud~$JW@vQFCSIg0^PZx#nXZ& z)>KxNOQ^El$-soRxKLxNotnP!jTBXgHb@EKALW%Wmqe6kU_yIR2L_^=FMfQT$#{Tv zDJRO$WA+>$1`T1BOa!!Y$1B6EV&zE(5bu@ah?oQ6!}XTxQGW*C{iojOXcRd2dGzs% zhwNhG-_+`vT&28DqAvBOHj*!9=m`7NN&)!UKe3qH5;W@t(Z(tb+$~a zpDtJ4L0hCtBNeU}C}aw>x^|xssQ--A&q)9Ygk-Z5H0c5uZKJ*9o6DcXIro)ZZU&EuUW)Mw94@*q73B!_Ts!6eW^UVaU2C8DD7}I0< zXNhYMweP+oeCt;iT?KN}|8c|4$(ukW8le$t>83tA?_rQ|5_2Uq#QjmXb+St#Zo06# z7TwDb+TppSP+unCpnp}N+y>E7!G>4a!*z@V!9LiYFgjP!en?upCTMp`<&_m|za>3f zf;#dkUrAWUVVpsTuUF=oEZ$?m@1&~?9DAhY>85#I%^`95S|JLxxoR%L|oUV?wmVt&z)t-IV}aP{g^@=6A|S{lfE?^huX=SP9M zOLIew5*}J594mnLoF;B>g#c z81#GS-)Yig`w3nm=Eb$xg-;`?MaAV%s-6qfLc>>@n;mBlO^~}b)Dqsx2{CcHw%7Ba%LA; zW3|DxF)c4LxwOb(n1J~GZaZn~R;!u}lU0t)EfCgU54o6Y?^f(j9^$r4yDS|24UAxy z3wSjlRflRAK<>6CL9Jp2ZEC0z&l7bWrJEAeJQcK#xhTU^LS|xb-dhjBY(KhsHQv8q zglwsK1HxO$h+RC(Y7`Bqm(a}Bj=q<-$SFYKf8_~i)JAXnv|xcHh?WVokalpngU_TitcwU-?!q2P?rC~a!ckNAnoN5P7awfY1K3htBXJMB;e zUpc{Nsg3Y178vWzpCKmi1sQH2wmh#o<)(QFe4Rn?Hr(DXx~EbmYaG!y${qtvoxC3N z%zB6Ap~iX~`86$1$jjj)VIyH1MF^qsMtMA1sF+8JwpbgGqcHpG&TfyJ#U46$#x|;y5f2LmkXR123 zYeZW%hU|Bx-K_{yf`DP9j5PS5BC1Y5pPWrJncaQGvfEIwN>;A8|+<&-jOFY;-M(P|(UD(`%U6^-oWTQbp#yu(X zpWS&Uy(cged#3>_HH496ZrESw&pyVp0TDXSPc^}ea(PZ(R^Ojdd9BvN~ST~{R zuGgHI??k(;S5gC*4`Xhp3yN!R3bF(@DO>}E1X3qF!>B0JY6YA6?(bh1b zx~BB^G~XmH#Qj#{r`t|j3G3{&kJnW_DmZucjHAcJgG%FPUgx^4Dc%TQ4mh~mdp|F; z6W0BRzdTbbNTUvmgH)nQ%m#y#1_X~MK-b@Gyds4*MUYjEBRX9`y+aIKv#cH(7uM`Hj^fcO726~ldL4E%*m;6_(A;TYhHXUA` zmPj@1vH%8(h)LJa`9B%U{$`E-B_$YH?MuWqwwiKV#gCp-|ae0 z%suKRa;M9GhGgE-it02z+p|sg7j!@T_{%czWGy}0Rm+Vz|(F*e?0wK;&k zXA>s9!o7L9!j3E(t@4_ghoFp&G?6BN8(oOG*zx4@f=Pvn?Y_dUns(pbj@ z-&4EK-vl<6dZiAQZ!(x#aphI)UXfAlM)fK?w{s07Gwa3Ba$-VVl?FjaZv091u+Pez z`>uc@DPD7yc6i5k6B%yFTKO-o{guhUccofVz@fF-e-VKF@HLG$DsPd{UV_8g&C{#r z@_PxD;yT=LUIYpmFLLW8vFx-YWUQ*b?#kIa(pG(fe%dNK1D<-ayuv^qi;{;lwSUR3 zsju`qb?)iMkJWcNO8c4MC{(u5cCIC`!GXX0N*UtXQuyq-{1YF8m9{I^U%6lN%$#NX zWR&~Ve96;Q>gPvYFTUua{ey^l^2#glZFDKD0vmr)1YSI)ad zF{upqQzm@*(*3z@9wD|#pJT;jnw{HI1#eE9C~xDpc9c~Fg1A4zM*Z!5Lj#xpqYU3S z?7xykLJUTI`RVGcwEt0)4+Xm|;r&{|@r-p4H5Tl+lpuIHgGg!WiQt4GC*wge>06{H z7|^5_dE|qCvpUh;Ih`Dhi<(wyWlVuM@{Rm1dphM)XS9MfEw_&ve|y@N7&x^X2c^%>#2isy9@K zlY*w){*2qlC9u68N)$&4OP&6nf=EmLFx!S?dtyK=eUKqqeh&0~Z`&o6t=R}|0&PqQ z$0VIe(5>q>QI0_%MDIOh*lWX^JG4t^e^>Y`yFQoR3fZ0KLlV`|rD$QVr-Fk7n%1S* zf3KPgpOU!wyC%u~kE49Ka_?%;ng*STnvQX<0H-To**na9k#FJ)UttY}5PkN1uq@nj z-(=xqW=YFUAjbc8oi=p1HnJ;1_;p1EkwGPS;Ji|^dE`7j2ki_J2|ibC@}CGEG(JY} z1wHG$3C(k^yj%AjU3q6gAvx=-)2apCFcZc>Z|s$(i4_TAfmG||KhmGwH>FmPV;lvf z`*ZQFpxsxbf^v;8YWt99)>X$9Hr2Ir=5io7wC0^sHiBc%FrYpat^?_os9*J(`)M89 zAMAfBJElm>{OQxBLUtv6`sSYqjWd=nX+B=3+bHTqe!|4C;~TmOLKdki;sj-qd> zzIxQcGvBrS>6fsm_nO;oB-hw@fpdX@kO{_FTCZ!e8@~!u)@yxDEB_04iqV63PI#%u z_2>a`=l?Cz{SR(;37`7v&5`gW5B#;EpcSvlORXE9yN&YQ!6izwQR>K-{Vj+999pdZ z(a1sv^joHrRUpqCwWcT}m2W=0OilBRsQ;Zu#VDkp_d3!ByO0nCNdB1?9CZSEp`)+0 zqa#7>qXGXFt>*09kr@4MzGEKU_bA^B2+`jJb%!fKt>Ot>!LBI%i&QAsjU@O7MPoQnLHH#xdCcYVSM4noPH~)zNJm zWfVmWC1XWJKp-Ge!bnvS5K($jqqGo^8d^Xd5fMTxGxRcoiqwb@Ahf7RP-#Xm!32mH zAu0q2A)$o8_q=g-J$v?<+50=^&-eYwrgu&30O=ZN`xd$BmmcFSGjGDkNDs$o*nk;pW~(_H zi2&jgy6#+fiC-Q@3{JbmK?~d_O!fAN1`@GvxknJ6{t~qokCANNq&Bs8l?Ui&xsbKO zx_;<1ZnOek0JJN#gMDA~?_SioYN1p>u|72qx}=qBn5&_T>jwkrtDanH(&-F4GaAVwFGZe(Swz#P`D{sJhNP8L0~DnOq2W?m)Oa=~gS0gKZw0FMA;O zC-2qxSa{`$C6z2)-jA*^6DMEWWzFqz`dlG%j6TLt{pnqVTxyj+r#KI@!>(^FnnAN}T0Ac3x6Fc6xz&>R4E#*N6A=EX^iZhj`<-6Vsa>jsGOFL$gD zFd!XxcnQcFfpdy_YcfKmX{`JekTy60(ZrAb;j}CH0eersopUxVpxSxX>zwBJd=&z{ zr1`&vnH?VhaZi$qzm$8rO7&QUSM5$eOpv;Pk07T_Pk0^i>uxQ41_`KsZf+&OyF{Mr zq(1Y>n;i(zf%B!1P!y#7i|PluQ8)fve8mebAjSwNU@_~lffZoszMKTZwV_R8I&-DF zkxRJytBoQ1GC^sWQcs>ab#ZE>&SWqch}WY!^!$ct%b@D)Zi(688|M7C_dCwK0#I`| zf#ku1v8!DvvAD=@Kc^QjRFJTCi+yw3sESZjNLP`f_b`alg(^2CW%Yt%e+ZP&AGHPv}%AV6Pvz&GaMl=ijT*Qjp2R;I=LL4?r*=X;z7UZ2tPQvPWb z-s)9Ct&g1Mmpf|{t4HC5XM3oxUaml_jmBulxQu&$%cAl}=9WKexk}x17s8D4@Vh~) zXI)Q8%8J%Rxddv*gDrD7VDe>r+zzlT&K|(F716?7YXWliqqC5p#`)vcc)LSscW<45 z%A4&euWO%g5-HC-FSu|zqUyExwyu>eP13HIGMN=MQ?>#3;K%O_d#Ae|mK)09pfQ0Pmz;ftW~KcDLW5 z_-1;RZxye{@@iaA-I8F$|vx4H6K>H3H2$ND8D92viUh z4P6XpdoRD_sHzWu2?F&lP;uoF$>*=+sPkL^;Ekl4`!K_wDo`yc3E0h^kq_3SLE=n( z(ThLc7bELYkCFF<2JpzLz6C*j(+NfW;GHZYzB&@rRkSf#%23Q-QU%0O?BKzmm2TyY z9i9t*)kc8dV+#lMGJSi>ii^qN1^*#W+UnzFH|`Bp`*JSZ{ZB#0I+FrB;2`|#jov0` zyaPf__PDBngrh5tVD4O_ddu0A$^@?|SQG!b?4F+^1u?&OCo>rcf*F9clocg>yC8HD zi#QN3_(Lb)I#oP9R$UInJ&2ek$Hv*1N_sq5LrkL;7L7zr#%^Dqssmgx&|<$ZQuqVc zlw-eErO#`VN@cv~{F|P1JD=mGzg+pii56KiF+gD*{N$7UfJgqvibxjn(A$8cBx4E< z`@pU(YJU@f2`aHSm~sZ)pIX0;NlJeUNOM!$oPEfz;zu=c@+n`7X>$S?q?vF$?*DBz zRTMHm!#@XqS&dQDPt4o0CJ7L$+R~Sj zE(?W$|H7s2m5#QO>KQ?!EI@m^T{#;HP7sR-KL|<{=y}iA@&WAfz>Ya`^6IMPVgJAcv+E1|bb%MoO z9MeYpI?C1IL>1T=tDr4~u4f{_J^j0^Xu-sT6JFYJx(W|YK3&QX~OA4aRhQ7&8ReOFP2qR)rPgMD9ftNcfIIklgd6jb>v zwXMl^@i|p1sL6DZ&)$WY!?l|%?FiU%dex~Xm8_$iR|%2kaRx>4X7NbU-ahB76^0lz z=hFvTEl@tQqSzkw-eHa!qW|SGsi5G{niV^N8;T;0R0Cdh&GounVX3cu0M0vFlVLt4 zI#uvGeIQqVH;?fQT@LZFPssn8`0W46cCe0OcGJMlRkh-z`xX9up%n1dC8;tH$=V9} zpG$AA{;^8Jf1h7Lw8$l>K+$X%FCEY_A3Ro}#x;``I@;mDQUx1fA(sQ`-|3;HFt0=b zTu!76K9^(}lZTWZRtlo|@8CS0$WIQUS7nnR)OP7DUP^#(lHaT-sVhHG+XF!DRQ~(4 zYd?%+-I#-(b-M9yV=UZhYvJe$?Y1Yzb^f1aiSc0dRzh!3@he3t;&$k7{eT*W4 z4E{5(jC?_%`HD|Kc*t=n3OK{thEU%I|B&ze{GqM-PUhpd>}z%ks&C|`yf9yDS^~mv zGI^LyQ%o~f`(ua=douq$LR~YyaV3)PZN;iGw30qF zK>~!Hrl9mP2#AdS+_okK43!AmIEN4e0Miq-!kje>^$?icqq}Amiu$6uuAJFfV||{! z08X>S0dB(CX!T9rp6{5L`)d-(85S%X+$qWEJtnXeKgUJnSFGc8`0x8Ue&@s^^183J ztd@Uhck)p;<$S&arn_O4G?ZBjC!I;zBM|Ao#OI(RV1b@?x3mt3j`PO?+4eDC4(4f? z762~5gGc5;$1I5i1vi;7Bj<)iyseyV%&=3?@bOA(&@K`#6ku)vW_+(Y#m6cL0BwIM zmsYwWWCM(#gmmwl=ZM=}?Lv4KV2j5BIXvXoX3no+&q?rCQtV5&V`Va=+PGD*-UO() zwBAsX8Q<45*?u`Vl6^;<1Ue`lg|fY|$LWPtvD_VmR8}15^|)bbnQ~rCqUi#4%8&<` zZqC=vD8L4NF%1~2{qRH3$2QN7>OxQuEs$xoJ95e?X0qa&Mw5d7kQ`I21SNsC42!h{ z_q%+)22ah@iB+1Hhih02k@*=1X~7~4ieg;~F(eO`Prod1mu-?S(N5`EtxmlUcYpvu@TqcPe4nF?`^C-LG# znI!*Lk)9vQ~6ZvOR$V05ulaMlLB#gQ)zQHDi>oqH%0P z?d)(?Tc%V-`E?5Ly#I{v`n7G)6q5LV15)i*LeP__2F>#D2gADFlov0o@yOD}?86K+ zMEbEp-SE<_eaA^fd6)uS*T8BFOV^h%BPa4Vzz@N>)s?8XQPJx3-TL9npi16rIEWh{ z8HIG0OXW5?9`iYMG3skQ>Dhk&z3H#pLiTH(kUSsIe;ioPW-M_`)-KUs09qDDuR$=a9;++qh}LCpkJK zQhiTIw;b85M_K?*b`wxW1{<8dm=;!7YWf>z_E+(PH|1}7609BSdr5Y!uWzp`06<2f z%4j+DZlQ(vq*$${?~T0neW2sPV6_);ztNETTPH7ab--)2c^fFJeW@W;sO@pNGzA){ z=?C*&^)b3Or)zG_z5e8_jGK6)Pn!M3>++ifGgfD6cl9aQsczKCj(CeQThr1)Ares> z==uTzaIejN8xh@Y57Tl~RV@2BwYK&tvZ8 z2bFdtIK&@y&12b!CwQ@}P;uy=Ai7>k&!GSV!?8A=X$o#+hOvs`53exmzpZcOQ`Oqk zagWt*vTgqwM|bULaQKqpwZJASObYhAcsH8A!o2@vaj~%Sngza~DI8r)rG=ZCqV&J{ z>^=G>!^}7d58q=EB)aJ5gfBn`ACy1KvjU3OV)*k3I*H)NMLAxLvfuCfA|S6Py<+9x z%T0A?nr#c9pQ!1PBEDn@AjMoy^4d^+Yzmy*;Qh;Iz9j_;HrS-BRoFxT@?Cij$S*Zg4%92EoC{&yGXG zZ5-k)*W%@Q;}hqVy7|5O1y9P}O$lnvcuMloHR#ur3J zErqdySuF(AfAlu@Ys=hCP`UZdUfa|jz)G-v zp$~sTTZIW5!PC3}#JFEn4=Eajm-g}}%0H-fonnptUnx3{H3vxtyg`GqTRUK0f7T~m5qzXnA`wl{nO3tPSpx`hU?9sggnz?iCQX6_k<@9K!53;AhBN)2+ic10dCW|Z?w zJA?uxBVZbU+Vsa0w3%6NPxJR!jdgjFv*aj8jOQ_nrB~>)OqYa!wQ4 zhm=Jbh81|8#1yEtM#6cS?YxgRsPkhU4*-yBt@fjIPJzx1=zQWplNH-i6`%kde# z4sQ8USboJ0C@ZBWQd6L8%t-}ikPmpiGtdE49vM{d9#vH#+!~|8f{{Ql0SU&WVV&IF zbF#rnls)n*D(^G~^w%0SOtqt%C-2H)lRfK$af)p*1`A<&VPAR}FpTFkptCOJY{2K_ zSa5D}+4AcRXD2U;rpP3I!Zuil%EbGpKQ`wYMboRW5(ftdYDJ%#KYLny{H4t>8L2QF#9GOd@K<}=UF8c!i^PD~0e)O?yYVb!-wt0vlU0<<<^%}@j0 zM3_}_lp%=ma(8@2`>YVTi|;4p6IDEov{Pzm@{w1CiLJRx7aHj24WDN4xw$SdBzfjD zli5&B%Mkbx>TJdW=&>QXNz|+Co<4^uTKbXX@Q%sJ$KVlNTCo#m@DAPCGv`yFxnbs6 zcN=U=X`MF~`-$!V$wbQCC6vq0TVDObK+xmK`vI`VIKa z5s@FO@->4PNIw_N+8iH$VukzaYEgpkzE59T{a-myqV9=o9ucSzR3^Ei%j#iyJa5>%bWQ{Cd*p#CxIRp%%9=b+V*p6+E*e$A?1V?;5 zw43^U+L6w#ga=-E*(!gzj}W3c9ofkgaJ9itXPF|x&A>Z(qEGAH0GZo}8Ojo>NR-Or zl^~OQWb(KKfJu3SS9vyH>jzr)AvvfnH@bCIH1^?mYPbfXqQZ;QQXAinRTER^+;Q4 zwy82X@}0RzY-?|sLQTSsE{bM0FcKxsE>1>QUD0gxtux0?>?+@QW_1+|?WvtRTUt^P zi>tRBfFolfl56X1mX&SS;Iy^1VH=60))XZLb`7IswzLe#nwBtQQWR}F%$HSn0>3r} zmeS~X;&Rlp3MJP5HRIlh>U}d0hWEh=hc}+vjMqsOhD1Y?$HrIHnw?Wp`N%Z5jp@5! z-C0JC#i*hW-mrxpWW5z+LkyBCBOxs}5))Haafg_@l{Dg#B#&3%ZN}`hfM0y4K_FNR zFe2cI7wECd-Y>}Fb4GQ%{cyf;I}F^qqgR$-WWb!BN#Z!st7yH(1NvcZ(WkE4 z^!H~^J~BgzUQVw^tB<3{%PdgkZ0ZBZ`oy+~vD>;IhR3#dmSx;{t{=dj)^v%+oIh9) zR3NONaf%MrNE8#PH|k5@jq-b9Qg!96=%l;~2@+&c7st&w>R(T7{pmu(*rs6|wR$67 zLcZ@_pV6O8Ei#DaEhLiaveI>U{m;VH=M1i3=1C!2+lcveZaW_gd1KJ48RJ~wsiIY2 zSi5uM-hqwAO}mv<=k`r9PxSdA=s7K!tYR})$?7DZ#Z%@UEaQ6GV&aXfP95e7If>*s z!4}$p1U=o6sk=su7Gc+g;ETu$Q5Cc}E3q?Jo6=u38Gmv|Lxvc)$m8n`N>?;3t)5_y zg=y!WC=JPt_VZQSuI&+0)^3XjMBnIcT5ZzY`=sS(jT|zMWY={&aW7bVuDMemEnY0r30gXwJWE@fmVl;+ z*)L~3=ochC1P-(kBhoYn(=F|%jTS!W(TV6?8`+B!434;A_lJ#MlDYw#0?m=fv8s%8 zdq!?1crCr{CgvQWajfP%%h&^kq%1J_dYb7K9_Huh7jRT2?!)Nk5Y+x*Qi|-&nt;A0 zG-meG!4lL}OellcD2^DW#A=pj+@K~8jh&}o*w6Jc+bnh`SR(=hec*k2(yk!E&wagQ%}83c;ixqg0oL}%M9IUMheDbJfGhu4GX{=`A; z6e4!vo#Td?eye8hxL#&n_lvsHu1JZSvboXZyn;ar^#(cIy5+1Aqi(so0)9)=+)ARs z4K#LboFuDWl$}IHE|a|h&k;vpny8SAzDShY_g@iFVvE^1qgNKAkMHs_(6pOpX?&^ zf7EH++BM%3IlUdrllwfbtj^>DPpgbvtAOVZc`oX@ExauoRIw~iretR_6uo2oj38^P zd@Y4Rl3ftuN&osOJYvRat^+fRpXC3Mm<4<>6g41U?1T*ckirKDk$}nwY=v)zqE3pk zk$zKvH&{AOiXhl@`xt_E)_hsTQyD~@8r_8h<{Yp`Ji#bhl)N5}H2jnMLg6^TI!-Pw zbtr3(k%qT#-<}2GjT2GU7$y9o#2Eq@3AHl-u_ZDO08*XD-t=s}pmU0z9v;fXpDP-M zqlA&n#gtfZzFu5@MTiD%hI5duUW>6>lWe#1Sq2>eltnAkUZXL|K3ePT`tNLtTe6RDkzW}I0Wb;7L( z;5;}H3iw-=PI(cd@9d~(YpQJa*0`~v`-69q^2*CP& za#vS1*fw0Srqd(s30HO>KsQlLYiVvD>m<44fTqH9zJ3k9qk+huK!HVYF%CT105jA_ z$~YG!xbFanSHuJWCL9nJCgo%5 z4ts`gy=m}@si&pm9#<<{cOVZ1(()@BU3&-iwkx&PHGf*aeaR9-MKhH5!D;Y-okIT= z*#B>{f!{iSa15br92?VH>D`qHI{nv|l$6{-g9SExo!V(5aseSkFM6&|2?e~aa*E+1 z_2R;hZP?_rWN+ligJEnl*b9CQpuLoFK^;gm`WhkywW1F@_?Qu+VECH z>q$1^_f{6*2o$}P3)TvF38&1ym1G(Jsi(igL)j8TVbnf;tVIT^=S+%E-!9Daj(+oO zSMAM-VSP>Gs47t=C+HN2=^lwx_czFVCNeYgbz4OL-ga>^W*1BxVpSi$0}A1_j`=}b zc8Ov|bTJ40p(3BSow%+A0I7cGQgWH!;z#O&MBDK1)2aIEz0S{xn5tN9+tTLx^z*MmaFk?-iJ`-#ts4Dewd^pB)QgN#{l zhwa{tQ0}I@TZT$PeH=X&LlHU*))!`&oD7Z#eN*N)NoTS zmyE@!aH9d>$&%=GzU$^zho))XnpsGoD6_db8`2JpFofYSJovjSnVMZE>H#U$6E6@; ziHm%I!WQ^%CT4|{l-9(j$-;dbE7eD|>0{k>VI0xLkFy7_3E=**2geH7r70V#Y3>x! z7$;+KuBFy%A51&7{*H56MRpcH`%Xn3vB99YJ{|5^TN@rAdMO;yU){?zV7zo%fr;)| zsDv)r>u!OjacIco>!CqQwrd(^ZfSOz8R{HgI8HG-#PH*&4n!|D*VE58;9o93-}xB~ z_;6f&gn6;cLN;Dfa1UfO$c2rGVXfMnLmFHzQzw^1jve4Kc}?IUy8;yUcf^Zvz@0GX zJi&wE9fbSC{GKAR1N;y2FYi47excfW&UR1GSb5f+!pG_(g~R6z2oL@ZoKZbjQgoj{ zG;`_STk2_R{qU_5j`)Z`z3NW=Vu0si;po!Nj=7Ge?sRl@G`I3JLc{?##j3bSlPCWe zF=enNf#R0CzBSo9wgkJgX5R(}?2MfGijiMmq!x_x%;4ZP$0i|vf}WI@9QVT5IQ-79 zhTWgkM{>PKiLUj@0|+5vX1_mznieNvU7U5Sxt6C$)>;Vm^9af27YV@`{ku#oq17~< z1}(-jslR@XUUvqT{x5l!fAFke;NEY53(ERJn;e*fqoWE}Syxq6wV(*(?(d&&{O8n4 z;6TG6MZ<`TfA-AfE6#t|kFv6|!ZwUgXS^B5O?{$i+Gt~iU*4WwT#%qcHec3(h86Hb zrWkEv{X%2to+r#uT#tNyYhaT>lfzE+S2@%*ow}yMFxZ8bUWBKf101X?2#7WLnj3?|uoWhngrA0WI4nGM^bSer z<0pC~2_vrECUA|L}O-F|gFO!wd{&-5BL=aF3{A5}!o1X^QgdDMuS!hgKvA(iL~QeitJGj_$?e z2c=bQIEdX66wq;MCp}2qM4&OjJ9{6y0bhR)XGX#ybnd3{>+I8~x3Z2QMBLPHH3%#2 z{7td~yvvB2fE79RNeOIeAB6n3vWlW-L{y~OT<~M{!116cqXmS4o)!=l}e3?Pk1&k$^ez z9Mv^&md(*v&o!tU$tT)}cow=I43M$RjYB2(7Jv4n&kOwiG?s+q_3QZM!@>c?P2tVi5$ob@oO+Dq=YM}$g^6# zM+8+6c$Dj4!0-UT)jT*?y1i^bMV<&CAJrqDc;x^wEFjt@I_&@|EOuB+1o&4@P#jNG zOX=<vKB#DKV)=(LyzP!>f>9Q((*;`5ZE z*|PK-R4pOfU^?*TFaFcBfJ+bf98y+ZzCJ+)t{ed3#vxA#6B^D*e-uUCtzNX+ck_M9k~-bd$;_GJC8ZTnZ20tH`j}3b8}kIH9Lz1|k}Gbb zcO4V3-SUbSlN<442+>{n#20`@E^j%1^gwxOY4Uibqo{p=2Lr}1C^`aCLvee}<)27o zmIHQbJN6s#6Tj)ARoSpMrU)0;x6&D&$O~G0=SKjP8ftD3W-C|4pAx zq()644(n~f(~!l?ax%@BRIL zHve(f%k4`869XL`oi9(H`oUXAXLYKM&Z^+`Yr%I;V&OZ%msLn_x8pjbe$!d-k2Mj; zJdf$<)MS70>4F~kxBj(LK}a2)ja}M5s~E8_FX`ymy*&NHG2f&x(S&FAj_@bnoX7rc zyS03E^WLafqhk(5kSR zVydR+(#pvM;h?pD3X@7n7H4J;vlDUhIH^E#yTUpa*Gg3{6f*tEH2J)MPrwG@+ojz~ zp(MvVOf}Wa>|ySxWOSptD@g7tUq>CCj$#D|T-q)zwsYI??hEseOT&WQJ1Xw6SHq?5 z`KFrf9Hwmc>utDeQPLdb2j zjZb}~;5k}7rZ`8nk789@_+=`^3tfmyRY_RdcXU;Hpdqq3!i{CD6#bKC&-a+}HkmP> zBusBtzmBXbZ36o`5*}e9pYdoA6L0$JRUUzkv?{x@g->%k{4ZEB1RUkk1SQ8$GxTDP z#W!TLdE=_&@ps!fx;i>@wO`bA1@QGFN6{4v{uss%$^%7urvQGXR{)<@jad|el{(q@ zvcrCBzjkq^PS@vk1c>Ny<$dE8g(_zhW&`0mxXjkk=ek^ZP=q0Rbh={E6Zc^+-!4oX z5cL72eYdL?y5`_(1oVHl){Q3edG!KMAl=G^nODqdD?(ck+Db`*b8bJ1JGA_cW%!NI z2NIAt3`ynJHH3XGF72+Yt|d|;&dPkF88-Hg4i15^mg|uy9zFB5;?x8&8NArVpzBjT z4m|n&8W~Q)VWq^TUWc#b)b}|U$Cj(VC+flSY#;J(pp>Rw*Gtl@kCox(1EUqCnJdn<3cQI$ z>v_kSBhz*f-BE2zVnX6DYIvb@kUU`z?N+9$TFBCA{>Ch^@PID-QU)aEbSpL+);T%d zgJ%@NZf?Rxmj&tJ71Mfp1@y!Thc!AkCK8BgvHiYEhkXl$zOMH4 z5z_5i)6E5zZGJ(8*=$6f0O1M4n=L96ElZK46t*T@HQZNAO;?2^6eL$d{?5UphHL zU%KCTV(#%H=0Z(qK$!{vNdl&Q1>FIhuXgxX$+v06B(X{*y7s|4=w zYWVRpx}li0qnd9|>y?*-OXfoLehZbo$${vfXOY%X|3GK5yMp0x#S#VS0jr9N$#Bz8 zRXzSe5m6N8FM)VW^`MT2U>-Pbk<+0NrC20o9#NX7t^yZl4zJc83;v1!@v->aO@!9e z*5sKo{P2G?pu(%IQ85_B?}7!vx`&?+;(1}3xGG@MbtBr5s`&IyFmLDzd6U4_7HD*!ig>w)L@!Zi(Yhii~iaf!#7u6bEzyBuiRkfnDjii*9xd*{O7oB@jwT>E>Xk}En$OuvN z!wmz`nw}pZL?KAaF{m}7_A3d+64*0MRH42< zqWOt{(=%Yt7q@?W+u|Iqq^*b)Eo0yO7Og0$)8z&RV4^$`Az)^}svo9V8$DO>3(kRs z+T20xR%}C@623a{?3$qNt-y&rY#t4^-0Ei4T5t=U{_Ku*U}?^3+hWIYeej|>U+i4~ zA2^WnFa03eZec?8j=|DyImCaI>8h$t7Cw>%z$ewq)JAYMXVd>W(8g9eWMB?e6`=($ z8oDaXO`A^BENRl&t&C`H3a?l@WlWpCvtu*ZuDGXg!9Z!ZZND#}er3LbX38u?3_oZ@ zMs*(%n1WswcVw``KB62`@Ri)F+?;Xhtoye@k$ZRYCXe;Pw5q0xk93H!=2j^@gb7<^ z&AS@>Q2Rbtd%VO8elLGDxV)wFip6)9>3i?7=Er|3h-&kq#kJLV-VEV7RvyGFD0Y6@ z#biWRq{WUK=kM=9>-y>rZ|iJv`!aRb=NO6Ux;*-od}eqJSiA2)|G58V=!9=)K&OxB z!y^MfE)J83DKJRLHjy8~N!{OYQkMH}8>9va$Dfq<1#Se*VzSXpZh3%JdQX+O5I;va z93t_V0FkOP+Dae z?&Ac@7TR9Fyog*^(dzoiVKm`khGclZm`rU`i7vT-VtDwIFpa#f!H~Oh6_q6YdEHpy z`*XVR84B2}hbaE+WP3^lXwNJ#2?8`rP|fvJEWf`HrRvMK55QZ&f?MOKy9FOU`~<^- z*@gBt%iQ*=bwL;ZfoD5qq8%?av^iqfoW@J)!0W1Lc0~;ugK<4C;`{5{-M4pf6T5I zCG}Kl)NnNe6MaZr!89jP6?`#UY7W#@-Kf7WZoDU#%?+ zJAWP}yKSD`1EH!{v}}Pwp6EJt-nmWj>e58y-gGKJiVuaSf&>GXE1hEX-IPkDu(0`M z;Y-WxC^l&aJ0Qskz(VoV-uD@pR&ZR-USC<9R?>yu{)o%!-upYchQhPL0^X6b(cY?| z0t!KZm*hwz&bB_n^u~-&R8Z|ME7&eMkcgs>pDVqkOqrSofPDvg_M_EdvbE}qwVRH5m&FV38hMm!@;NAIc5usb65H^xP&MgM5G0?&Hxn^ zev|it3Xys^RO;jwz7odbYORDQ#8qQv?dsgHfX%#5Gfsr7K;^ zPWW&^4dWxDu$MXvk%hiFpuf2xKL=KAuvverKFa6Vi`%qv_trJ}Em`UJDMt_a;cJw6 z#r5QdA8(Z;<#gDyO7WSp94e;&k7VWiWRA^3_?$DRC7bGF-zW+%4FV-pfVcfJ6-gX( zyY;-R<CJ?TuD~#vm<&$|ecQI= zsWZ)|w#{95xsEy{J%8wz``cCzpGM{Da+`~S-C3on+tb7)6YY5haWHx%%Cn)WcCZrE zNPkcN{KDRa5|a2%<^{`g5?mHHc-Seb;o;x6bRN$9crcCJBtmBMvW4QPUnvo9rBCl4 zeCxWk7X>MuTUDkT)Oj}HMe@k0*2x6YRUa6AzBL@C>?a~cib!MQoLbapveC{US zSC))VlOcLks_@YbUpC^rfbFsnUXa1%|ErY3Uo z;hv{^?)csjdgr#7T`c;ZBBOE|UvJa$n%!f`Q+L-qQ&iSy`a_OGb$wWw@5(wylL|LI zI_QUBNgeu$Hi~im2o|x)6Q|B|;i*@3 zimQ=~;)Rm*mnN|!=-843g56W;m%p_L8x1=wdmL$A+I?7$I*F~^pRapOHxx3Ru|I%R zNmVU#cuc3_b*~IkRh!?u+~g1dpwWSz$7`vMJ|g!{sEQP#$_m*d_fYkR?8)$h8G5tq zljVYF;#f9Mrl4#(Y}da{E}$mod9*^{(o9c)dwYoqa-%5{thKQP$?sRR=yH9PHKMm~ z-yZn{;5wLHTe<#;@|N_HIpW@>j0-KN`4JSTBh?DL9k5@-0#E7 zNVAqk;)S2oVf}+7wjXzJ+v-qK6rLm=@|$vh*_yhtD4=IV zz;-0NHa>uUJLnpY$S>fkB=AJul}`}2n*rA1XC!xy+U+7;n*Gd*M^wq+T+I3TUTt&2 zJ$Z~cKE6%<9K!L)A7cqI#p17k;?e`AI=D;6idJIy_hqb?fG2@DTk{uj{O1s5Pn%OE zqhljjc3+iKIH<>@r=Kb@XeEaQ0G^pEqh=nENVw|Lpta$UOL?zEaaZisFMGKddok7D z*fl&+^NGD8;Ci6n&9eP*vUyGNQ|Doo8mIZBEU#6^ik?$Il?WE6dn&XAnU$4wnG@QY z5RDQ~w!a3`t7rqLcZ9=hsk!DIoXvOtB9(LRJb)$qC&D^|RQ8D=)nyogv&9Z8#iwJ3^OYCYdZp1AbVM-nJ$-XvCy}UDhZVFb_0%eEf`!LJ=$N2 z@>#VnoXu5VQh66a7Zfob0wScZrw6BaFQJ;)hO-i^?(E%G!W>FsH8E*rR>&b|$IIgx z+#ZJ7FO2zhIEy^yX6W$PTH?QOh9jGl|Ag@vF?Pjx(8_ykpX3)`8W(UlnKIQxfSZs9 zh?T1q*)EeegzU!5I1627A?}KjO3eo1*vYX2c0k_H>QUeES4wON3I3y*+wF%%$y37U z#eF{s2EKV#qY#P3U)%;H@%mrVj`yqZ4F)a;GT#w}$1JTikpa(kvRM(9YkmlmOM+$t zi>NLhm$F(WeFKEA+c4kxg{ex1Ssahk`SqTJ09I*>@j7%YM)x zoyy0m202u9&Wq^GL9r7b^C=i1Ekk7tkdI$v6CxV&gEdLq`;LRO`3v)t);B3TsB2o+ zG?}JMxv#I>893m|8re&}vW7R%LIg?=SY+f`2W zxb@4DXV9&mUv?}2y(U5!-)pk@H~KYiA-A5C7mS!a_6;ID;Jc{PfCl_d>lu=gUe zqdqVj39=M(vTc77K{}UAI7jzt4a;prk@LrX2hXKeaeL(w$|-=wpZYtY8h!?{ujqZB zbf1fku1@s^r_J)`w2pwI3cg_!utork0YuHgk11NI2%(Fc_`pMD_hY}RNcee8d;E6C<$yqO4IoL@trj67vye)jr zwp=+I9vLEQE`w#rc3AYG?=N-Wr~Hq7_s(ip?1t2KxZZKCVg>!BYAv;`I^f!!^q-T{ z%)5@m_|XDY+G1Z}eZWdk8EP88WR`>>zVVV~tghZHYuCqT!Dm1I=;e|ZXtL5zO<3ap*dv31MR z0B%q-4CYce0H!^6(P5pXkh<-wp|pN?tn@XyeTg4 z(nK19W{&!CTbN5iry|6i3LD8)ddtTaVU%&=b|JMkOHurtG!!|<#uS|5*7SWFErU~f#o%~ zFbxFVm+58Y?thA|!*^uhP%N`&? z#Fbbdk@mj7-&&u_YQ!asa`vWAZ|==0_0$x9*ACBeF^w_7wUb;mD2$&!;xeXh8Pybq z);PSMmTR3Mpq$8$hM0NjP6EBcKXHEiaiz6(QxCAc^r#=7xLIhGwEsiEoc^rg%>ga6 z0t~#kaVx^@%Nh0g`^5tq1&2`Sy0@>{&tFx302x8eVMUbQZy@3tm<4tT1RAdV$g&XS zBgsIp+J_u`WRI%xOb3Z$#GW@SeqkJ-iM*X7tKqSOuB%-f92~5+Zd|1^_2)kYjinoS z;hOxiYq?W?@AfkcZXh%d;*7=xEi&-{kr}Y+5FayFrrsw$X2X^`UZH>3)xgeF#aA|X z_1Pv`8%J0z{7%%i+4SaufT{c_LP8`#GB|Gn#((Ptp;M}UXhRC?gm+d0XAAP#x6|$L zhB7QdV-@Z)C2hzVaw`nrmUZ~?!qtR-jz%L!<3vGeXh}z6u8|qkple!7F@RK2H9tIC^4>fJ}RN+5Z^^K{^= z1H7w(!9<2p%QEoQP#E)yVP8yLuHYep{!%gadxbQhqsJkr%XdmRJQNb+nODRONR2m`au%sDQY+_Z#8Ip||n}x(0oxI71fkMG(g@ zV7sA$6c#$mkhhFJ6rFT7Sdqjcjs4gkrKZm0@bh#=815aP2KjL2T8c^30m7jz@)_O9 zq{3?fttl_o9o5!q(r#V2^!17sux(8C!CbUl@VmnqvP$N70?`joSxhQOV`c$TeW1$= zcw6~(pGs`m`bqkp`^ad1r=Ph!n>VsoYFvCXP@pW$N2ZY#p11y3`bXK~lhR=VDogYy z*v{+M>&G}8Cla)yg3Ic$C|q%&)t7w)rFA#bVl{lv1}Sq#g{L7DaWG%FS>Jt@&GFK! z*v80&B>2kDaC#rrrniqddQ5~)-7P4^WCldtEeJqoK8h=!Ai9ou3kG}DZXuQnQpG74 zS&TYIQ-XR5J@Ef#wgNFjxl#)M%Z~@+@<^^QCm{bnq-v$2@JGe(UBiX92ggsq2P4M_ z^a*opsFp_ydN^FKVM0T%M62y-r8*axZ$A8M=KJANc<*rGOhij$#@#>r3!N%@@YZBf zD5dtukt0u{k)p8%77+fv0X#bC&{dZOt=%ird(c)-IC=iVD!~Oo<8C*p6|!l0Mvc6rtY{4L8EW^4WmoHVC6yx!g#kl0)vM4OE6CUmq- zAjA$PS9lgiv>O+XF?`Wdq3k{iBV)Z)1j-62hawuvq(q2F3oKTniYY(_k=E_w$%B-M zaMiSYbUH60h_^&hq6*#m{Fv1O;`|F>eumNTYH_g;$vQF^BUp)O`_$S;YrR5HRyICv zr57rjkPp(^-SJjc)6RtJGlTt>t#Leh3(PRJ-4mkc2^-to2>q;4Z@d17&xy*}Tb5`2&2ii~vDV*iy)ThaF*w5^#=JP&B_igw^((7a-!VXM)7`&5cZunMa$&6n zWgi=nD6c({D=~20vVp$Sd%D5LTMF2f6fcPD6@*y&=6pO!rT6rtiUW3CE@*`lF1M@N z6nmVPj^0zmP38nVeT}B^bEGy=86QM+Y`Y3P=A`y92Z*;TCSy$zq?nkDvIc0CjbP=` zQcoQT%c33+v1TT*$VIrNO{09zAXNx65UEK}m?Hmg?7>*R_yA_zt$N`&aM+p=`B05M zP2Thd-ps(dtoNN5|AZW{u;wFQJ#P{sWh-8FlUTDY-hv~jeLX8lhV9XCM7JXEoFqeb zC=Bn3c%K>?Va#yP55_HFdE1aEB*LQ#b0rg@@jT?O8%(bv_(?@fn#S3O%@>J?!}5d4 zQ|{WqdJTUMxC4`9-Df*ow6apa9<}Wh`!0&4bVrtLogu4Nlu8KOy;bcE$?~zD#q{PB zF8}Uo`R%3g3^?yP<`cFM6&oBYee7iYnAUyBU(B+LyRXG!)QdjKKt3{FCDvEwui4&bm*!8!i&uf}s3zw+fQqd7=C3w&%6<+RAoM zvhO)s=H>L-`MHwHW|2x*Leromy&<;sq81+K0dL7qTYsi1r zQXT@uSjW(PD*t2i>O9b)bP7O}=@;!^La&DyrZz!T7p1*E)>V5Ke&}RwyFnLDia`>_ z#mW^}90Dzb{p|bWQfDWmsJ=%wL`at@Low)zZJ&pSmua*?DlGyQfMCfmVp%$bp7B%y z8cqjNR^?*-Y?LK0DKg*D$DSmfC*VTOeZo|Oz!RUWrN`}njSVM7hA@lq(5jm39Szjr zloE9XPK|A+I+KIDh6);HOk72ak`=YEmBBm^Pe5B4;{;eR(IT}{3!1CNcX)Z*NWjrM z21i+qq(RcUTWf9`nD2uIo@!116?ODV8gc9qWv5L)0qbHaRTRi>xkt&bx%SV;{|?@No2380NfX?y>E^9 z*;Cq(n_l^lRJc?&0dgn17zSplWS{e=^37&07SKBX0HqOJx7ohmam(f1(OP_>)V&7o zVd#!gXAlmnj57u-WE=*Nc(L-Tt?nQtpt6E%XsT44EBiu2S2&(Zrre;?;Tn!xf{Aj1<6xydr==Y`vmN6f9nZ z?+V|bk6s}k%uV2Bg`U3mVbv~?Pwv4u?`tDpT|9*I<%GF5ir9}^71Kv#XD^giK!CO+ z^N*UiPM&>ObFmy7iY$TRW>~bQ(-Yf#zZP9-%kXKv->}@GsnHM}g~olVRPS6xeUGVe z)Kze24*-hquDPS=wYFYTy}*`}j-MpoHTXh*9pc(4j=|k_XW$N)l^ZDK=Jb$(0leM-5Ou8#s!qp#ir zGFPKJ1cYB=27}0Zoh~3-leYeDr2<;Q`N+TTkk>}#Fm+2I(A3Z?Urrwwe!$OpYAl*jd1}w-9Q9--)S|_1eyI z?f%@=Dfd%lOlLR<5%LZLYs;4qmsNjSBalpPH+MORqhkS(=haxIOIPTW6mA9~F6zts zl8i@jgO>{|7)xc8WVw4_E5I*8o8-}E>Idddp&X9WFnGdXsDcQS&KfOS!CLAY0lZht z`}yTE+qSD`l9S{v!Q>&AmMt zOXqWH0|>66@PMb?Hq%>L4ohcOSvFNjLO_TmK+L#jx?=DzBq7h!wzU!*7!l1i&8wo#7SLJy4rTOKK~+(-DA)SAUc; z*(!nLbq%znP1hTaAdm?%s!v+1%35B;|*66~H&k=RT~`=Hmd* zy%C=az}XRyudtZ5i#5Cq8}l1EqXepAs5!{>waG-n?Mhj~Y{0I1g*HR9jskq&=8wip zi<4N>*!q17ei+Q3kDub95ab-6^>-lY6cuhry6+wJ3(80VA1ec8*r^pKFw2AaYB6HyJB0sdHqgOQg7VU=h4eYe_H8VJA5b zWBU3w2L(Ke$S9)>0+Nl8D!a905$=i)Yl>9oJwXntN=RdD=J_ib5Vx_Rmgk+9Tn1m( zc<0(EF|CG3bnrMmQNetVO2vflS5^b(?!3zT8PLJwlvo_mo_u}&jc$;Lv3_S{MHPA(` zA^?tk>&}CO{IHQy#id@eLjz3^r>dRaK>1!lh8-)Nw?$+|eUJ?*6M1zY#Q2Dc=~J1- zhec&8CKz#T`w;mQlMU^K+)XpEc|e6x8;FL1!g}gP==6mY-3u&gEPl}BS19C3DJ-DgErAe zsEH4gxWP{}YzOY&%$#t0CbEA5+RsQS2XMN0Neo(^KnTsxI2U~e>!m6}%!dtHi5QS} zRVeol^rKSEIP*iC35e3juaw64Ot}-rcFeV=Z_!z$6IfKJpGujx9zk?`>ynpg{XTrd zm*In7C_@RA&u*u^JbG|>md#TLTgWuQMUpdJS-CQJn2+hhe94NL3t$I9b$zY(^9u6k zOV>#O?N3>MIQ*>xn{s}!Nmt$DNxsjO(U)6kQh3uBvw;Wcl#mM<(FG6Mfny+-&@|h9(2N* zeDsi=zd+D3mZ=gPq1W)cqf|T;&TJo)Ah5SjC~2ejY?C4jl8HX9ymRz&N^S0^UV4fr zTE#idDHroqN07@Y?xR-Nfzj1)7TcmoKY8W7Edv_{vWkI?g$Akj@dATD^gqOe#TO)6 zeSmV3c>D)}GUAs={Gv%+=dna@!UyY5jt~$XSaE>PTY#SI2WcczQjQuk1Twp=m!6N6 z#?oIN4le-5;?g(-S9QU(Sn(q`h!A~0ia6&aj`)_n9kb(w>usP&DKeR*MQ*smAWGaH z%CZ-lXxd{=V4ggF8i1?UYJn|^t^+A4DMEz-nio;HWdnFdA{fPP_qWQ;s@nAAUWz_$m2g9oe&b9=z_d!>oq3;0dxwov=IAW z%wkG^SWEqs&4FXo*Ho^<{n9EZ%|UG*rIBeCUHv~BrOa<;UD+0z;`xmH!#+}EZR1jY zFfUTW=W2W032skudBi~oM{;-)(Jv_|cV?K9z4O*SZpJCd%F5vj$;4hchw$ zlCX6CmpVG7TK|*!R3VUDn=;T2UWive2;lAfmi6%k$A+wwlKM*43@QpQ*ZM^}< zc8a{i*b_wbnJOA7N)6$Lat{T-5!0!IPX>v{y;CN4E3l(J7$rWRlNSt zB`VLvel}Vd=1q<4YlqQD3GJk-CO`!n1l+A&8@3%?rX61Bn{X4PaD%&=)fB?H09W#- z{^{}0o7>3h*ouBfV!mH|9%?j60_sZkMFtR(a*sM5@UUbCAoy*bJ0&t&)1)!EA2 zLKGuF+Bc~nTk!qNC`|^N96?OKFViK_n)f87)l>E7_ssL3f>6k)K9_(XYx0}JEZ1pF z6|b#boCKJqveJdUVrXdGR1`<|K;wR7H7TH(k16)5N*$152Faz6mh>A2U$&O4dr_BA zgaE+4)MBBqZtQ+}ArW@35STKepzb_lC!_}p{46`WLzbSW*b`R{%*1L_Emr?`a@+ro lTmV|s7gBbItf@k?4%&I~Q+70V417=L^hvKDNXO6L{9gmXbfo|Q literal 0 HcmV?d00001 diff --git a/한국투자증권(API)/legacy/postman/README.md b/한국투자증권(API)/legacy/postman/README.md new file mode 100644 index 0000000..8ae0245 --- /dev/null +++ b/한국투자증권(API)/legacy/postman/README.md @@ -0,0 +1,333 @@ +#### **[당사에서 제공하는 샘플코드에 대한 유의사항]** #### +- 샘플 코드는 한국투자증권 오픈API(KIS Develpers)를 연동하는 예시입니다. 고객님의 개발부담을 줄이고자 참고용으로 제공되고 있습니다. +- 샘플 코드는 별도의 공지 없이 지속적으로 업데이트될 수 있습니다. +- 샘플 코드를 활용하여 제작한 고객님의 프로그램으로 인한 손해에 대해서는 당사에서 책임지지 않습니다. + +![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=300§ion=header&text=한국투자증권%20KIS%20Developers&fontSize=50&animation=fadeIn&fontAlignY=38&desc=Open%20Trading%20API%20Postman%20Sample%20Code&descAlignY=51&descAlign=62) + +## 1. Postman이란 + +[포스트맨(Postman)](https://www.postman.com/)은 개발자들이 API를 디자인하고 빌드하고 테스트하고 반복하기 위한 API 플랫폼입니다. 2022년 4월 기준으로 포스트맨의 등록 사용자는 20,000,000명 이상, 개방 API 수는 75,000개로 보고되었으며, 세계 최대의 공개 API 허브입니다. (출처 : [위키백과-포스트맨](https://ko.wikipedia.org/wiki/포스트맨_(소프트웨어))) + + +## 2. 사전 준비 사항 +1. 한국투자증권 홈페이지([실전계좌 개설](https://securities.koreainvestment.com/main/customer/guide/_static/TF04aa090000.jsp)/[모의계좌 개설](https://securities.koreainvestment.com/main/research/virtual/_static/TF07da010000.jsp))에서 계좌 개설 → **계좌번호 준비** +2. [KIS Developers 홈페이지](https://apiportal.koreainvestment.com/)에서 API신청 - 사용할 계좌번호로 API신청 → **APP KEY & APP SECRET 준비** +3. [Postman](https://www.postman.com/downloads/) 설치 + + +## 3. Postman을 활용한 API 호출 방법 +### 3.1. Postman 실행 및 json 파일 Import +Postman 실행 후 아래 4개의 json 파일들을 다운로드 하신 후 Import 해주세요. Import하는 방법은 Postman 좌측 상단의 Import 버튼을 누르시고 File 탭에 파일을 끌어다 놓아주세요. 파일이 정상적으로 끌어와지면 아래 이미지와 같이 파일들이 식별되며, 이후 Import 버튼을 누르시면 됩니다. +* 모의계좌만을 사용하시는 경우 1,2번 파일을, 실전계좌만을 사용하시는 경우 3,4번 파일만 Import하셔도 됩니다. + +|순번 |파일명 |파일 상세 | +|--|--|--| +|1|모의계좌_POSTMAN_샘플코드_v1.5.json|postman collections json file(모의계좌용)| +|2|모의계좌_POSTMAN_환경변수.json|postman environments json file(모의계좌용)| +|3|실전계좌_POSTMAN_샘플코드_v2.4.json|postman collections json file(실전계좌용)| +|4|실전계좌_POSTMAN_환경변수.json|postman environments json file(실전계좌용)| + +![image](https://user-images.githubusercontent.com/87407853/200476672-c9d15708-5476-4703-89c9-29046ca00d37.png) + +### 3.2. 환경변수 설정 +Import가 완료되면 환경변수 설정을 해줍니다. 모의계좌를 활용하여 API테스트를 하실 경우 왼쪽 바의 Environments의 모의Env를, 실전계좌를 활용하여 API테스트를 하실 경우 실전 Env를 환경변수로 사용합니다. 따라서 사용하실 환경변수 값들을 채워주어야 합니다. 아래 설명대로 값들을 전부 채워 넣어주세요. 값을 채워 넣을 때는 Initial Value, Current Value 모두 값을 넣어주셔야 합니다. (VTS, PROD는 이미 값이 채워져 있으니 수정하지 말아주세요.) + +* API 신청한 계좌번호와 해당 계좌의 APPKEY, APPSECRET 값을 채워주시면 됩니다. +* 주식거래계좌(01)의 경우 아래 각 표의 1,3,4번을 채워주시면 되고, 선물옵션계좌(03 or 08)의 경우 아래 각 표의 2,5,6번을 채워주시면 됩니다. + +#### 3.2.1. 모의Env의 경우 아래의 값들을 각각 채워 넣어줍니다. +|순번 |환경변수명 |값(Initial Value, Current Value) |값 예시 | +|--|--|--|--| +|1|CANO|본인의 모의계좌 종합계좌번호 8자리(주식)|ex.50012345| +|2|CANO_T|본인의 모의계좌 종합계좌번호 8자리(선물옵션)|ex.60012345| +|3|VTS_APPKEY|홈페이지에서 발급 받은 계좌번호(주식) APP KEY|ex.PSabcmEJH4U9dfewefwJdfsa4P5qewrPdf4n| +|4|VTS_APPSECRET|홈페이지에서 발급 받은 계좌번호(주식) APP SECRET|ex.FoB6uLRLw5o0Ozxsdfkejklskjkr...uFg9Ya0=| +|5|VTT_APPKEY|홈페이지에서 발급 받은 계좌번호(선물옵션) APP KEY|ex.PSabcmEJH4U9dfewefwJdfsa4P5qewrPdf4n| +|6|VTT_APPSECRET|홈페이지에서 발급 받은 계좌번호(선물옵션) APP SECRET|ex.FoB6uLRLw5o0Ozxsdfkejklskjkr...uFg9Ya0=| + +#### 3.2.2. 실전Env의 경우 아래의 값들을 각각 채워 넣어줍니다. +|순번 |환경변수명 |값(Initial Value, Current Value) |값 예시 | +|--|--|--|--| +|1|CANO_REAL|본인의 실전계좌 종합계좌번호(주식)|ex.50012345| +|2|CANO_REAL_T|본인의 실전계좌 종합계좌번호(선물옵션)|ex.60012345| +|3|PROD_APPKEY|홈페이지에서 발급 받은 계좌번호(주식) APP KEY|ex.PSabcmEJH4U9dfewefwJdfsa4P5qewrPdf4n| +|4|PROD_APPSECRET|홈페이지에서 발급 받은 계좌번호(주식) APP SECRET|ex.FoB6uLRLw5o0Ozxsdfkejklskjkr...uFg9Ya0=| +|5|PROT_APPKEY|홈페이지에서 발급 받은 계좌번호(선물옵션) APP KEY|ex.PSabcmEJH4U9dfewefwJdfsa4P5qewrPdf4n| +|6|PROT_APPSECRET|홈페이지에서 발급 받은 계좌번호(선물옵션) APP SECRET|ex.FoB6uLRLw5o0Ozxsdfkejklskjkr...uFg9Ya0=| + + +### 3.3. 환경변수 선택 +환경변수 설정이 완료되면 다시 Collections 바로 돌아가셔서 사용할 환경변수를 선택을 해줍니다. 환경변수 선택은 Postman 화면 우측 상단에서 아래 화살표(∨)를 눌러 선택 가능합니다. 모의계좌를 활용하여 API테스트를 하실 경우 모의투자(모의Env)를, 실전계좌를 활용하여 API테스트를 하실 경우 실전투자(실전Env)를 환경변수로 선택합니다. + +![image](https://user-images.githubusercontent.com/87407853/200476740-beceda63-4d7e-48e2-ba4e-f69a8a850fea.png) + +### 3.4. API 호출 +호출하고 싶은 API를 각 폴더에서 찾아 header값, body값을 변경하시면서 사용하시면 됩니다. +* 각 API 이름 앞에 V는 모의계좌를, J는 실전계좌를 의미합니다. +* GET 요청의 경우, 계좌번호 환경변수가 불러와져 그대로 사용하시면 되지만, POST 요청의 경우 계좌번호(CANO)를 BODY값에 직접 입력하셔야 하는 점 유의 부탁드립니다. **(중요) 따라서 POST API 호출 테스트하실 때는 반드시 Body 값의 계좌번호(CANO)를 본인의 종합계좌번호 8자리로 수정 후 호출하셔야 합니다.** + +### 4. 코드 자동생성 기능 +포스트맨에는 소스코드를 생성하는 기능이 있습니다. 우측의 부분을 클릭하면 소스코드가 생성되며, 생성 언어 또한 선택할 수 있습니다. + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/e22da880-1ac1-490f-b483-4917cb712953) + + + + +## 5. Postman 샘플코드 목록 + +|구분 |API명 |모의투자 제공 여부 |실전투자 제공 여부 | +|--|--|--|--| +|OAuth인증|웹소켓접속키발급|⭕|⭕| +|OAuth인증|접근토큰발급|⭕|⭕| +|OAuth인증|접근토큰폐기|⭕|⭕| +|OAuth인증|Hashkey|⭕|⭕| +|[국내주식]주문/계좌|주식주문(현금)|⭕|⭕| +|[국내주식]주문/계좌|주식주문(신용)| |⭕| +|[국내주식]주문/계좌|주식주문(정정취소)|⭕|⭕| +|[국내주식]주문/계좌|주식정정취소가능주문조회| |⭕| +|[국내주식]주문/계좌|주식일별주문체결조회|⭕|⭕| +|[국내주식]주문/계좌|주식잔고조회|⭕|⭕| +|[국내주식]주문/계좌|매수가능조회|⭕|⭕| +|[국내주식]주문/계좌|주식예약주문| |⭕| +|[국내주식]주문/계좌|주식예약주문정정취소| |⭕| +|[국내주식]주문/계좌|주식예약주문조회| |⭕| +|[국내주식]주문/계좌|퇴직연금 체결기준잔고| |⭕| +|[국내주식]주문/계좌|퇴직연금 미체결내역| |⭕| +|[국내주식]주문/계좌|퇴직연금 매수가능조회| |⭕| +|[국내주식]주문/계좌|퇴직연금 예수금조회| |⭕| +|[국내주식]주문/계좌|퇴직연금 잔고조회| |⭕| +|[국내주식]주문/계좌|주식잔고조회_실현손익| |⭕| +|[국내주식]주문/계좌|신용매수가능조회| |⭕| +|[국내주식]주문/계좌|투자계좌자산현황조회| |⭕| +|[국내주식]주문/계좌|기간별매매손익현황조회| |⭕| +|[국내주식]주문/계좌|기간별손익일별합산조회| |⭕| +|[국내주식]주문/계좌|매도가능수량조회| |⭕| +|[국내주식]주문/계좌|주식통합증거금현황| |⭕| +|[국내주식]기본시세|주식현재가 시세|⭕|⭕| +|[국내주식]기본시세|주식현재가 체결|⭕|⭕| +|[국내주식]기본시세|주식현재가 일자별|⭕|⭕| +|[국내주식]기본시세|주식현재가 호가 예상체결|⭕|⭕| +|[국내주식]기본시세|주식현재가 투자자|⭕|⭕| +|[국내주식]기본시세|주식현재가 회원사|⭕|⭕| +|[국내주식]기본시세|국내주식기간별시세(일/주/월/년)|⭕|⭕| +|[국내주식]기본시세|주식현재가 당일시간대별체결|⭕|⭕| +|[국내주식]기본시세|주식현재가 시간외일자별주가|⭕|⭕| +|[국내주식]기본시세|주식당일분봉조회|⭕|⭕| +|[국내주식]기본시세|주식현재가 시세2| |⭕| +|[국내주식]기본시세|ETF/ETN 현재가| |⭕| +|[국내주식]기본시세|NAV 비교추이(종목)| |⭕| +|[국내주식]기본시세|NAV 비교추이(분)| |⭕| +|[국내주식]기본시세|NAV 비교추이(일)| |⭕| +|[국내주식]기본시세|국내주식 장마감 예상체결가| |⭕| +|[국내주식]기본시세|ETF 구성종목시세| |⭕| +|[국내주식]기본시세|국내주식 시간외현재가| |⭕| +|[국내주식]기본시세|국내주식 시간외호가| |⭕| +|[국내주식]ELW시세|ELW현재가 시세|⭕|⭕| +|[국내주식]ELW시세|ELW 상승률순위| |⭕| +|[국내주식]ELW시세|ELW 거래량순위| |⭕| +|[국내주식]ELW시세|ELW 지표순위| |⭕| +|[국내주식]ELW시세|ELW 민감도 순위| |⭕| +|[국내주식]ELW시세|ELW 당일급변종목| |⭕| +|[국내주식]ELW시세|ELW 신규상장종목| |⭕| +|[국내주식]ELW시세|ELW 투자지표추이(체결)| |⭕| +|[국내주식]ELW시세|ELW 투자지표추이(분별)| |⭕| +|[국내주식]ELW시세|ELW 투자지표추이(일별)| |⭕| +|[국내주식]ELW시세|ELW 변동성 추이(틱)| |⭕| +|[국내주식]ELW시세|ELW 변동성 추이(체결)| |⭕| +|[국내주식]ELW시세|ELW 변동성 추이(분별)| |⭕| +|[국내주식]ELW시세|ELW 변동성 추이(일별)| |⭕| +|[국내주식]ELW시세|ELW 민감도 추이(체결)| |⭕| +|[국내주식]ELW시세|ELW 민감도 추이(일별)| |⭕| +|[국내주식]ELW시세|ELW 기초자산별 종목시세| |⭕| +|[국내주식]ELW시세|ELW LP매매추이| |⭕| +|[국내주식]ELW시세|ELW 비교대상종목조회| |⭕| +|[국내주식]ELW시세|ELW 종목검색| |⭕| +|[국내주식]ELW시세|ELW 기초자산 목록조회| |⭕| +|[국내주식]ELW시세|ELW 만기예정/만기종목| |⭕| +|[국내주식]업종/기타|국내주식업종기간별시세(일/주/월/년)|⭕|⭕| +|[국내주식]업종/기타|국내휴장일조회| |⭕| +|[국내주식]업종/기타|업종분봉조회| |⭕| +|[국내주식]업종/기타|변동성완화장치(VI) 현황| |⭕| +|[국내주식]업종/기타|국내업종 현재지수| |⭕| +|[국내주식]업종/기타|국내업종 일자별지수| |⭕| +|[국내주식]업종/기타|국내업종 구분별전체시세| |⭕| +|[국내주식]업종/기타|국내주식 예상체결 전체지수| |⭕| +|[국내주식]업종/기타|국내업종 시간별지수(틱)| |⭕| +|[국내주식]업종/기타|국내업종 시간별지수(분)| |⭕| +|[국내주식]업종/기타|국내주식 예상체결지수 추이| |⭕| +|[국내주식]업종/기타|금리 종합(국내채권/금리)| |⭕| +|[국내주식]업종/기타|종합 시황/공시(제목)| |⭕| +|[국내주식]종목정보|상품기본조회| |⭕| +|[국내주식]종목정보|주식기본조회| |⭕| +|[국내주식]종목정보|국내주식 대차대조표| |⭕| +|[국내주식]종목정보|국내주식 손익계산서| |⭕| +|[국내주식]종목정보|국내주식 재무비율| |⭕| +|[국내주식]종목정보|국내주식 수익성비율| |⭕| +|[국내주식]종목정보|국내주식 기타주요비율| |⭕| +|[국내주식]종목정보|국내주식 안정성비율| |⭕| +|[국내주식]종목정보|국내주식 성장성비율| |⭕| +|[국내주식]종목정보|국내주식 당사 신용가능종목| |⭕| +|[국내주식]종목정보|예탁원정보(배당일정)| |⭕| +|[국내주식]종목정보|예탁원정보(주식매수청구일정)| |⭕| +|[국내주식]종목정보|예탁원정보(합병/분할일정)| |⭕| +|[국내주식]종목정보|예탁원정보(액면교체일정)| |⭕| +|[국내주식]종목정보|예탁원정보(자본감소일정)| |⭕| +|[국내주식]종목정보|예탁원정보(상장정보일정)| |⭕| +|[국내주식]종목정보|예탁원정보(공모주청약일정)| |⭕| +|[국내주식]종목정보|예탁원정보(실권주일정)| |⭕| +|[국내주식]종목정보|예탁원정보(의무예치일정)| |⭕| +|[국내주식]종목정보|예탁원정보(유상증자일정)| |⭕| +|[국내주식]종목정보|예탁원정보(무상증자일정)| |⭕| +|[국내주식]종목정보|예탁원정보(주주총회일정)| |⭕| +|[국내주식]종목정보|국내주식 종목추정실적| |⭕| +|[국내주식]종목정보|당사 대주가능 종목| |⭕| +|[국내주식]종목정보|국내주식 종목투자의견| |⭕| +|[국내주식]종목정보|국내주식 증권사별 투자의견| |⭕| +|[국내주식]시세분석|국내기관_외국인 매매종목가집계| |⭕| +|[국내주식]시세분석|종목조건검색 목록조회| |⭕| +|[국내주식]시세분석|종목조건검색조회| |⭕| +|[국내주식]시세분석|종목별 프로그램매매추이(체결)| |⭕| +|[국내주식]시세분석|종목별 프로그램매매추이(일별)| |⭕| +|[국내주식]시세분석|종목별 외인기관 추정가집계| |⭕| +|[국내주식]시세분석|종목별일별매수매도체결량| |⭕| +|[국내주식]시세분석|시장별 투자자매매동향(시세)| |⭕| +|[국내주식]시세분석|시장별 투자자매매동향(일별)| |⭕| +|[국내주식]시세분석|국내주식 신용잔고 일별추이| |⭕| +|[국내주식]시세분석|국내주식 예상체결가 추이| |⭕| +|[국내주식]시세분석|국내주식 공매도 일별추이| |⭕| +|[국내주식]시세분석|국내주식 시간외예상체결등락률| |⭕| +|[국내주식]시세분석|프로그램매매 투자자매매동향(당일)| |⭕| +|[국내주식]시세분석|프로그램매매 종합현황(시간)| |⭕| +|[국내주식]시세분석|프로그램매매 종합현황(일별)| |⭕| +|[국내주식]시세분석|외국계 매매종목 가집계| |⭕| +|[국내주식]시세분석|종목별 외국계 순매수추이| |⭕| +|[국내주식]시세분석|국내주식 체결금액별 매매비중| |⭕| +|[국내주식]시세분석|국내 증시자금 종합| |⭕| +|[국내주식]시세분석|관심종목 그룹별 종목조회| |⭕| +|[국내주식]시세분석|관심종목 그룹조회| |⭕| +|[국내주식]시세분석|관심종목(멀티종목) 시세조회| |⭕| +|[국내주식]시세분석|국내주식 상하한가 포착| |⭕| +|[국내주식]시세분석|회원사 실시간 매매동향(틱)| |⭕| +|[국내주식]시세분석|국내주식 매물대/거래비중| |⭕| +|[국내주식]시세분석|주식현재가 회원사 종목매매동향| |⭕| +|[국내주식]순위분석|거래량순위| |⭕| +|[국내주식]순위분석|국내주식 등락률 순위| |⭕| +|[국내주식]순위분석|국내주식 호가잔량 순위| |⭕| +|[국내주식]순위분석|국내주식 수익자산지표 순위| |⭕| +|[국내주식]순위분석|국내주식 시가총액 상위| |⭕| +|[국내주식]순위분석|국내주식 재무비율 순위| |⭕| +|[국내주식]순위분석|국내주식 시간외잔량 순위| |⭕| +|[국내주식]순위분석|국내주식 우선주/괴리율 상위| |⭕| +|[국내주식]순위분석|국내주식 이격도 순위| |⭕| +|[국내주식]순위분석|국내주식 시장가치 순위| |⭕| +|[국내주식]순위분석|국내주식 체결강도 상위| |⭕| +|[국내주식]순위분석|국내주식 관심종목등록 상위| |⭕| +|[국내주식]순위분석|국내주식 예상체결 상승/하락상위| |⭕| +|[국내주식]순위분석|국내주식 당사매매종목 상위| |⭕| +|[국내주식]순위분석|국내주식 신고/신저근접종목 상위| |⭕| +|[국내주식]순위분석|국내주식 대량체결건수 상위| |⭕| +|[국내주식]순위분석|국내주식 공매도 상위종목| |⭕| +|[국내주식]순위분석|국내주식 신용잔고 상위| |⭕| +|[국내주식]순위분석|국내주식 배당률 상위| |⭕| +|[국내주식]순위분석|국내주식 시간외등락율순위| |⭕| +|[국내주식]순위분석|국내주식 시간외거래량순위| |⭕| +|[국내선물옵션]주문/계좌|선물옵션 주문|⭕|⭕| +|[국내선물옵션]주문/계좌|선물옵션 정정취소주문|⭕|⭕| +|[국내선물옵션]주문/계좌|선물옵션 주문체결내역조회|⭕|⭕| +|[국내선물옵션]주문/계좌|선물옵션 잔고현황|⭕|⭕| +|[국내선물옵션]주문/계좌|선물옵션 주문가능|⭕|⭕| +|[국내선물옵션]주문/계좌|(야간)선물옵션 주문체결내역조회| |⭕| +|[국내선물옵션]주문/계좌|(야간)선물옵션 잔고현황| |⭕| +|[국내선물옵션]주문/계좌|(야간)선물옵션 주문가능| |⭕| +|[국내선물옵션]주문/계좌|선물옵션 잔고정산손익내역| |⭕| +|[국내선물옵션]주문/계좌|선물옵션 총자산현황| |⭕| +|[국내선물옵션]주문/계좌|선물옵션 잔고평가손익내역| |⭕| +|[국내선물옵션]주문/계좌|선물옵션 기준일체결내역| |⭕| +|[국내선물옵션]주문/계좌|선물옵션기간약정수수료일별| |⭕| +|[국내선물옵션]주문/계좌|(야간)선물옵션 증거금 상세| |⭕| +|[국내선물옵션]기본시세|선물옵션 시세|⭕|⭕| +|[국내선물옵션]기본시세|선물옵션 시세호가|⭕|⭕| +|[국내선물옵션]기본시세|선물옵션기간별시세(일/주/월/년)|⭕|⭕| +|[국내선물옵션]기본시세|선물옵션 분봉조회| |⭕| +|[국내선물옵션]기본시세|선물옵션 일중예상체결추이| |⭕| +|[국내선물옵션]기본시세|국내선물 기초자산 시세|⭕|⭕| +|[국내선물옵션]기본시세|국내옵션전광판_옵션월물리스트| |⭕| +|[국내선물옵션]기본시세|국내옵션전광판_콜풋| |⭕| +|[국내선물옵션]기본시세|국내옵션전광판_선물| |⭕| +|[해외주식]주문/계좌|해외주식 주문|⭕|⭕| +|[해외주식]주문/계좌|해외주식 정정취소주문|⭕|⭕| +|[해외주식]주문/계좌|해외주식 예약주문접수|⭕|⭕| +|[해외주식]주문/계좌|해외주식 예약주문접수취소|⭕|⭕| +|[해외주식]주문/계좌|해외주식 미체결내역|⭕|⭕| +|[해외주식]주문/계좌|해외주식 잔고|⭕|⭕| +|[해외주식]주문/계좌|해외주식 주문체결내역|⭕|⭕| +|[해외주식]주문/계좌|해외주식 체결기준현재잔고|⭕|⭕| +|[해외주식]주문/계좌|해외주식 예약주문조회| |⭕| +|[해외주식]주문/계좌|해외주식 매수가능금액조회| |⭕| +|[해외주식]주문/계좌|해외주식 미국주간주문| |⭕| +|[해외주식]주문/계좌|해외주식 미국주간정정취소| |⭕| +|[해외주식]주문/계좌|해외주식 기간손익| |⭕| +|[해외주식]주문/계좌|해외증거금 통화별조회| |⭕| +|[해외주식]주문/계좌|해외주식 일별거래내역| |⭕| +|[해외주식]주문/계좌|해외주식 결제기준잔고| |⭕| +|[해외주식]기본시세|해외주식 현재체결가|⭕|⭕| +|[해외주식]기본시세|해외주식 기간별시세|⭕|⭕| +|[해외주식]기본시세|해외주식 종목/지수/환율기간별시세(일/주/월/년)|⭕|⭕| +|[해외주식]기본시세|해외주식 조건검색|⭕|⭕| +|[해외주식]기본시세|해외결제일자조회| |⭕| +|[해외주식]기본시세|해외주식 현재가상세| |⭕| +|[해외주식]기본시세|해외주식분봉조회| |⭕| +|[해외주식]기본시세|해외지수분봉조회| |⭕| +|[해외주식]기본시세|해외주식 상품기본정보| |⭕| +|[해외주식]기본시세|해외주식 현재가 10호가| |⭕| +|[해외주식]시세분석|해외주식 기간별권리조회| |⭕| +|[해외주식]시세분석|해외뉴스종합(제목)| |⭕| +|[해외주식]시세분석|해외주식 권리종합| |⭕| +|[해외주식]시세분석|당사 해외주식담보대출 가능 종목| |⭕| +|[해외주식]시세분석|해외속보(제목)| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 주문| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 정정취소주문| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 당일주문내역조회| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 미결제내역조회(잔고)| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 주문가능조회| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 기간계좌손익 일별| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 일별 체결내역| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 예수금현황| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 일별 주문내역| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 기간계좌거래내역| |⭕| +|[해외선물옵션]주문/계좌|해외선물옵션 증거금상세| |⭕| +|[해외선물옵션]기본시세|해외선물종목상세|⭕|⭕| +|[해외선물옵션]기본시세|해외선물종목현재가|⭕|⭕| +|[해외선물옵션]기본시세|해외선물 분봉조회| |⭕| +|[해외선물옵션]기본시세|해외선물 체결추이(주간)| |⭕| +|[해외선물옵션]기본시세|해외선물 체결추이(일간)| |⭕| +|[해외선물옵션]기본시세|해외선물 체결추이(틱)| |⭕| +|[해외선물옵션]기본시세|해외선물 체결추이(월간)| |⭕| +|[해외선물옵션]기본시세|해외선물 호가| |⭕| +|[해외선물옵션]기본시세|해외선물 상품기본정보| |⭕| +|[해외선물옵션]기본시세|해외선물 장운영시간| |⭕| +|[해외선물옵션]기본시세|해외선물 미결제추이| |⭕| +|[해외선물옵션]기본시세|해외옵션 호가| |⭕| +|[장내채권]주문/계좌|장내채권 매수주문| |⭕| +|[장내채권]주문/계좌|장내채권 매도주문| |⭕| +|[장내채권]주문/계좌|장내채권 정정취소주문| |⭕| +|[장내채권]주문/계좌|채권정정취소가능주문조회| |⭕| +|[장내채권]주문/계좌|장내채권 주문체결내역| |⭕| +|[장내채권]주문/계좌|장내채권 잔고조회| |⭕| +|[장내채권]주문/계좌|장내채권 매수가능조회| |⭕| +|[장내채권]기본시세|장내채권 발행정보| |⭕| +|[장내채권]기본시세|장내채권 기본조회| |⭕| +|[장내채권]기본시세|장내채권현재가(호가)| |⭕| +|[장내채권]기본시세|장내채권 평균단가조회| |⭕| +|[장내채권]기본시세|장내채권 기간별시세(일)| |⭕| +|[장내채권]기본시세|장내채권현재가(시세)| |⭕| +|[장내채권]기본시세|장내채권현재가(체결)| |⭕| +|[장내채권]기본시세|장내채권현재가(일별)| |⭕| + + +**사용하시면서 어려운 점이 생기면 KIS Developers - Q&A 게시판에 문의 부탁드립니다 :)** +https://apiportal.koreainvestment.com/community/qna + +![Footer](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200§ion=footer) diff --git a/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_샘플코드_v1.6.json b/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_샘플코드_v1.6.json new file mode 100644 index 0000000..03833e4 --- /dev/null +++ b/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_샘플코드_v1.6.json @@ -0,0 +1,5634 @@ +{ + "info": { + "_postman_id": "2645f167-29d0-4a00-aedc-04b7e47eae13", + "name": "모의투자(모의Env)", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "22257223", + "_collection_link": "https://truefriend-openapi.postman.co/workspace/%ED%95%9C%ED%88%ACAPI_TEST~de90589e-fb42-46d5-b9c4-ced0d1b7d0df/collection/22257223-2645f167-29d0-4a00-aedc-04b7e47eae13?action=share&source=collection_link&creator=22257223" + }, + "item": [ + { + "name": "OAuth", + "item": [ + { + "name": "V_웹소켓접속키발급", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"V_APPROVAL_KEY\", jsonData.approval_key); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{VTS_APPKEY}}\",\r\n \"secretkey\": \"{{VTS_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/oauth2/Approval", + "host": [ + "{{VTS}}" + ], + "path": [ + "oauth2", + "Approval" + ] + } + }, + "response": [] + }, + { + "name": "V_토큰발급", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"VTS_TOKEN\", jsonData.access_token); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{VTS_APPKEY}}\",\r\n \"appsecret\": \"{{VTS_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/oauth2/tokenP", + "host": [ + "{{VTS}}" + ], + "path": [ + "oauth2", + "tokenP" + ] + } + }, + "response": [] + }, + { + "name": "V_토큰폐기", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"appkey\": \"{{VTS_APPKEY}}\",\r\n \"appsecret\": \"{{VTS_APPSECRET}}\",\r\n \"token\": \"{{VTS_TOKEN}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/oauth2/revokeP", + "host": [ + "{{VTS}}" + ], + "path": [ + "oauth2", + "revokeP" + ] + } + }, + "response": [] + }, + { + "name": "V_해쉬키생성", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"VTS_HASH\", jsonData.HASH); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"CANO\": \"{{CANO}}\",\r\n\t\"ACNT_PRDT_CD\": \"01\",\r\n\t\"PDNO\": \"071050\",\r\n\t\"ORD_DVSN\": \"01\",\r\n\t\"ORD_QTY\": \"1\",\r\n\t\"ORD_UNPR\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/hashkey", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "hashkey" + ] + } + }, + "response": [] + }, + { + "name": "V_토큰발급(선물옵션)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"VTT_TOKEN\", jsonData.access_token); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{VTT_APPKEY}}\",\r\n \"appsecret\": \"{{VTT_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/oauth2/tokenP", + "host": [ + "{{VTS}}" + ], + "path": [ + "oauth2", + "tokenP" + ] + } + }, + "response": [] + }, + { + "name": "V_토큰폐기(선물옵션)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"appkey\": \"{{VTT_APPKEY}}\",\r\n \"appsecret\": \"{{VTT_APPSECRET}}\",\r\n \"token\": \"{{VTT_TOKEN}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/oauth2/revokeP", + "host": [ + "{{VTS}}" + ], + "path": [ + "oauth2", + "revokeP" + ] + } + }, + "response": [] + }, + { + "name": "V_해쉬키생성(선물옵션)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"VTT_HASH\", jsonData.HASH); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"CANO\": \"{{CANO_T}}\",\r\n\t\"ACNT_PRDT_CD\": \"03\",\r\n\t\"PDNO\": \"071050\",\r\n\t\"ORD_DVSN\": \"01\",\r\n\t\"ORD_QTY\": \"1\",\r\n\t\"ORD_UNPR\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/hashkey", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "hashkey" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "국내주식", + "item": [ + { + "name": "[국내주식] 기본시세", + "item": [ + { + "name": "V_주식현재가 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST01010100", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST01010100 : 주식현재가 시세" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 체결(최근30건)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": " application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": " Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": " {{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": " {{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": " FHKST01010300", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST01010300 : 주식현재가 체결" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-ccnl?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-ccnl" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 일자별", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST01010400", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST01010400 : 주식현재가 일자별" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_period_div_code=D&fid_org_adj_prc=1", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간 분류 코드\nD : (일)최근 30거래일\nW : (주)최근 30주\nM : (월)최근 30개월" + }, + { + "key": "fid_org_adj_prc", + "value": "1", + "description": "수정주가 원주가 가격\n0 : 수정주가반영\n1 : 수정주가미반영\n* 수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 호가 예상체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST01010200", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST01010200 : 주식현재가 호가 예상체결" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-asking-price-exp-ccn" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 투자자", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST01010900", + "type": "text", + "description": "[실전/모의투자]\nFHKST01010900 : 주식현재가 투자자" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-investor?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-investor" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 회원사", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST01010600", + "type": "text", + "description": "[실전/모의투자]\nFHKST01010600 : 주식현재가 회원사" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-member?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-member" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 ELW현재가 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKEW15010000", + "type": "text", + "description": "[실전/모의투자]\nFHKEW15010000 : ELW현재가 시세" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-elw-price?fid_cond_mrkt_div_code=W&fid_input_iscd=57H714", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-elw-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "W", + "description": "시장분류코드 (W : ELW)" + }, + { + "key": "fid_input_iscd", + "value": "57H714", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_국내주식기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST03010100", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST03010100" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_input_date_1=20220101&fid_input_date_2=20220809&fid_period_div_code=D&fid_org_adj_prc=1", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-itemchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)" + }, + { + "key": "fid_input_date_1", + "value": "20220101", + "description": "시작일자 (20220501)\n(한 번의 호출에 최대 100건의 데이터 수신, 다음 데이터를 받아오려면 OUTPUT 값의 가장 과거 일자의 1일 전 날짜를 FID_INPUT_DATE_2에 넣어 재호출)" + }, + { + "key": "fid_input_date_2", + "value": "20220809", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + }, + { + "key": "fid_org_adj_prc", + "value": "1", + "description": "수정주가 원주가 가격여부 (0:수정주가 1:원주가)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_국내주식업종기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKUP03500100", + "type": "text", + "description": "[실전투자/모의투자]\nFHKUP03500100" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice?fid_cond_mrkt_div_code=U&fid_input_iscd=0001&fid_input_date_1=20220101&fid_input_date_2=20220722&fid_period_div_code=D", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-indexchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "U", + "description": "시장 분류 코드 (U : 업종)" + }, + { + "key": "fid_input_iscd", + "value": "0001", + "description": "0001 : 종합\n0002 : 대형주\n...\n포탈 (FAQ : 종목정보 다운로드 - 업종코드 참조)" + }, + { + "key": "fid_input_date_1", + "value": "20220101", + "description": "시작일자 (20220501) \n(한 번의 호출에 최대 50건의 데이터 수신, 다음 데이터를 받아오려면 OUTPUT 값의 가장 과거 일자의 1일 전 날짜를 FID_INPUT_DATE_2에 넣어 재호출)" + }, + { + "key": "fid_input_date_2", + "value": "20220722", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 당일시간대별체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHPST01060000", + "type": "text", + "description": "[실전투자/모의투자]\nFHPST01060000" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_input_hour_1=155000", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-itemconclusion" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J:주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_input_hour_1", + "value": "155000", + "description": "기준시간 (6자리; HH:MM:SS)\nex) 155000 입력시 15시 50분 00초 기준 이전 체결 내역이 조회됨" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 시간외 시간별체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHPST02310000", + "type": "text", + "description": "[실전투자/모의투자]\nFHPST02310000" + }, + { + "key": "custtype", + "value": "P", + "type": "text", + "description": "P : 개인, B : 제휴사" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-time-overtimeconclusion?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_hour_cls_code=1", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-overtimeconclusion" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J:주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_hour_cls_code", + "value": "1", + "description": "시간구분코드 (1:시간외)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식현재가 시간외 일자별주가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHPST02320000", + "type": "text", + "description": "[실전투자/모의투자]\nFHPST02320000" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-overtimeprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J:주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식당일분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST03010200", + "type": "text", + "description": "[모의투자/실전투자]\nFHKST03010100" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice?FID_ETC_CLS_CODE=&FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_INPUT_HOUR_1=092800&FID_PW_DATA_INCU_YN=Y", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-itemchartprice" + ], + "query": [ + { + "key": "FID_ETC_CLS_CODE", + "value": "", + "description": "기타 구분 코드(\"\")" + }, + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드(J : 주식)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(6자리)" + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "092800", + "description": "조회 시작일자(HHMMSS)" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거 데이터 포함 여부(Y/N)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 주문/계좌", + "item": [ + { + "name": "V_주식주문(현금)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTC0802U", + "type": "text", + "description": "[실전투자]\nTTTC0802U : 주식 현금 매수 주문\nTTTC0801U : 주식 현금 매도 주문\n[모의투자]\nVTTC0802U : 주식 현금 매수 주문\nVTTC0801U : 주식 현금 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"005930\",\r\n \"ORD_DVSN\": \"00\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"55000\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/trading/order-cash", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-cash" + ] + } + }, + "response": [] + }, + { + "name": "V_주식주문(정정취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTC0803U", + "type": "text", + "description": "[실전투자]\nTTTC0803U : 주식 정정 취소 주문\n[모의투자]\nVTTC0803U : 주식 정정 취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"KRX_FWDG_ORD_ORGNO\": \"00950\",\r\n \"ORGN_ODNO\": \"6635\",\r\n \"ORD_DVSN\": \"00\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"55000\",\r\n \"QTY_ALL_ORD_YN\": \"Y\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/trading/order-rvsecncl", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "V_주식일별주문체결조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTSC9115R", + "type": "text", + "description": "[실전투자]\nTTTC8001R : 주식 일별 주문 체결 조회(3개월이내)\nCTSC9115R : 주식 일별 주문 체결 조회(3개월이전)\n\n[모의투자]\nVTTC8001R : 주식 일별 주문 체결 조회(3개월이내)\nVTSC9115R : 주식 일별 주문 체결 조회(3개월이전)\n* 일별 조회로, 당일 주문내역은 지연될 수 있습니다." + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/trading/inquire-daily-ccld?CANO={{CANO}}&ACNT_PRDT_CD=01&INQR_STRT_DT=20220801&INQR_END_DT=20220810&SLL_BUY_DVSN_CD=00&INQR_DVSN=00&PDNO=005930&CCLD_DVSN=00&ORD_GNO_BRNO=&ODNO=&INQR_DVSN_3=00&INQR_DVSN_1=&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-daily-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_STRT_DT", + "value": "20220801", + "description": "조회시작일자(YYYYMMDD)" + }, + { + "key": "INQR_END_DT", + "value": "20220810", + "description": "조회종료일자(YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "INQR_DVSN", + "value": "00", + "description": "조회구분\n00 : 역순\n01 : 정순" + }, + { + "key": "PDNO", + "value": "005930", + "description": "종목번호(6자리)" + }, + { + "key": "CCLD_DVSN", + "value": "00", + "description": "체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "ORD_GNO_BRNO", + "value": "", + "description": "주문시 한국투자증권 시스템에서 지정된 영업점코드" + }, + { + "key": "ODNO", + "value": "", + "description": "주문시 한국투자증권 시스템에서 채번된 주문번호" + }, + { + "key": "INQR_DVSN_3", + "value": "00", + "description": "조회구분3\n00 : 전체\n01 : 현금\n02 : 융자\n03 : 대출\n04 : 대주" + }, + { + "key": "INQR_DVSN_1", + "value": "", + "description": "조회구분1\n공란 : 전체\n1 : ELW\n2 : 프리보드" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_주식잔고조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTC8434R", + "type": "text", + "description": "[실전투자]\nTTTC8434R : 주식 잔고 조회\n\n[모의투자]\nVTTC8434R : 주식 잔고 조회" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/trading/inquire-balance?CANO={{CANO}}&ACNT_PRDT_CD=01&AFHR_FLPR_YN=N&OFL_YN=&INQR_DVSN=01&UNPR_DVSN=01&FUND_STTL_ICLD_YN=N&FNCG_AMT_AUTO_RDPT_YN=N&PRCS_DVSN=00&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "AFHR_FLPR_YN", + "value": "N", + "description": "시간외단일가여부\nN : 기본값\nY : 시간외단일가" + }, + { + "key": "OFL_YN", + "value": "", + "description": "공란(Default)" + }, + { + "key": "INQR_DVSN", + "value": "01", + "description": "조회구분\n01 : 대출일별\n02 : 종목별" + }, + { + "key": "UNPR_DVSN", + "value": "01", + "description": "단가구분\n01 : 기본값" + }, + { + "key": "FUND_STTL_ICLD_YN", + "value": "N", + "description": "펀드결제분포함여부\nN : 포함하지 않음\nY : 포함" + }, + { + "key": "FNCG_AMT_AUTO_RDPT_YN", + "value": "N", + "description": "융자금액자동상환여부\nN : 기본값" + }, + { + "key": "PRCS_DVSN", + "value": "00", + "description": "처리구분\n00 : 전일매매포함\n01 : 전일매매미포함" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_매수가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTC8908R", + "type": "text", + "description": "[실전투자]\nTTTC8908R : 매수 가능 조회\n\n[모의투자]\nVTTC8908R : 매수 가능 조회" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-stock/v1/trading/inquire-psbl-order?CANO={{CANO}}&ACNT_PRDT_CD=01&PDNO=005930&ORD_UNPR=55000&ORD_DVSN=01&OVRS_ICLD_YN=N&CMA_EVLU_AMT_ICLD_YN=N", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "005930", + "description": "종목번호 (6자리)" + }, + { + "key": "ORD_UNPR", + "value": "55000", + "description": "주문단가(1주당 가격)" + }, + { + "key": "ORD_DVSN", + "value": "01", + "description": "주문구분\n00 : 지정가\n01 : 시장가\n02 : 조건부지정가\n03 : 최유리지정가\n04 : 최우선지정가\n05 : 장전 시간외\n06 : 장후 시간외\n07 : 시간외 단일가\n08 : 자기주식\n09 : 자기주식S-Option\n10 : 자기주식금전신탁\n11 : IOC지정가 (즉시체결,잔량취소)\n12 : FOK지정가 (즉시체결,전량취소)\n13 : IOC시장가 (즉시체결,잔량취소)\n14 : FOK시장가 (즉시체결,전량취소)\n15 : IOC최유리 (즉시체결,잔량취소)\n16 : FOK최유리 (즉시체결,전량취소)\n51 : 장중대량\n52 : 장중바스켓\n62 : 장개시전 시간외대량\n63 : 장개시전 시간외바스켓\n67 : 장개시전 금전신탁자사주\n69 : 장개시전 자기주식\n72 : 시간외대량\n77 : 시간외자사주신탁\n79 : 시간외대량자기주식\n80 : 바스켓" + }, + { + "key": "OVRS_ICLD_YN", + "value": "N", + "description": "CMA평가금액포함여부\nY : 포함\nN : 포함하지 않음" + }, + { + "key": "CMA_EVLU_AMT_ICLD_YN", + "value": "N", + "description": "해외포함여부\nY : 포함\nN : 포함하지 않음" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "국내선물옵션", + "item": [ + { + "name": "[국내선물옵션] 주문/계좌", + "item": [ + { + "name": "V_선물옵션 주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTT_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTO1101U", + "type": "text", + "description": "[실전투자]\nTTTO1101U : 선물 옵션 매수 매도 주문 주간\nJTCE1001U : 선물 옵션 매수 매도 주문 야간\n\n[모의투자]\nVTTO1101U : 선물 옵션 매수 매도 주문 주간\nVTCE1001U : 선물 옵션 매수 매도 주문 야간" + }, + { + "key": "hashkey", + "value": "{{VTT_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"ORD_PRCS_DVSN_CD\": \"02\",\r\n \"CANO\": \"{{CANO_T}}\",\r\n \"ACNT_PRDT_CD\": \"03\",\r\n \"SLL_BUY_DVSN_CD\": \"02\",\r\n \"SHTN_PDNO\": \"101S09\",\r\n \"ORD_QTY\": \"10\",\r\n \"UNIT_PRICE\": \"300\",\r\n \"NMPR_TYPE_CD\": \"01\",\r\n \"KRX_NMPR_CNDT_CD\": \"0\",\r\n \"ORD_DVSN_CD\": \"01\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션 정정취소주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTT_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appKey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appSecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTO1103U", + "type": "text", + "description": "[실전투자]\nTTTO1103U : 선물 옵션 정정 취소 주문 주간\nJTCE1002U : 선물 옵션 정정 취소 주문 야간\n\n[모의투자]\nVTTO1103U : 선물 옵션 정정 취소 주문 주간\nVTCE1002U : 선물 옵션 정정 취소 주문 야간" + }, + { + "key": "hashkey", + "value": "{{VTT_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"ORD_PRCS_DVSN_CD\": \"02\",\r\n \"CANO\": \"{{CANO_T}}\",\r\n \"ACNT_PRDT_CD\": \"03\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORGN_ODNO\": \"0000004018\",\r\n \"ORD_QTY\": \"10\",\r\n \"UNIT_PRICE\": \"300\",\r\n \"NMPR_TYPE_CD\": \"01\",\r\n \"KRX_NMPR_CNDT_CD\": \"0\",\r\n \"RMN_QTY_YN\": \"Y\",\r\n \"ORD_DVSN_CD\": \"01\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/trading/order-rvsecncl", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션 주문체결내역조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTO5201R", + "type": "text", + "description": "[실전투자]\nTTTO5201R : 선물 옵션 주문 체결 내역 조회\n\n[모의투자]\nVTTO5201R : 선물 옵션 주문 체결 내역 조회" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/trading/inquire-ccnl?CANO={{CANO_T}}&ACNT_PRDT_CD=03&STRT_ORD_DT=20220730&END_ORD_DT=20220830&SLL_BUY_DVSN_CD=00&CCLD_NCCS_DVSN=00&SORT_SQN=DS&STRT_ODNO=&PDNO=&MKET_ID_CD=00&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-ccnl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "STRT_ORD_DT", + "value": "20220730", + "description": "주문내역 조회 시작 일자 (YYYYMMDD)" + }, + { + "key": "END_ORD_DT", + "value": "20220830", + "description": "주문내역 조회 마지막 일자 (YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nAS : 정순\nDS : 역순" + }, + { + "key": "STRT_ODNO", + "value": "", + "description": "시작주문번호(조회 시작 번호 입력)" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호\n공란 : default\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "MKET_ID_CD", + "value": "00", + "description": "공란(Default)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션 잔고현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTFO6118R", + "type": "text", + "description": "[실전투자]\nCTFO6118R : 선물 옵션 잔고 현황\n\n[모의투자]\nVTFO6118R : 선물 옵션 잔고 현황" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/trading/inquire-balance?CANO={{CANO_T}}&ACNT_PRDT_CD=03&MGNA_DVSN=01&EXCC_STAT_CD=1&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "MGNA_DVSN", + "value": "01", + "description": "증거금 구분(01 : 개시, 02 : 유지)" + }, + { + "key": "EXCC_STAT_CD", + "value": "1", + "description": "정산상태코드(1 : 정산, 2 : 본정산)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션 주문가능", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTO5105R", + "type": "text", + "description": "[실전투자]\nTTTO5105R : 선물 옵션 주문 가능\n\n[모의투자]\nVTTO5105R : 선물 옵션 주문 가능" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/trading/inquire-psbl-order?CANO={{CANO_T}}&ACNT_PRDT_CD=03&PDNO=101S09&SLL_BUY_DVSN_CD=02&UNIT_PRICE=1&ORD_DVSN_CD=01", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "02", + "description": "매도매수구분코드(01 : 매도, 02 : 매수)" + }, + { + "key": "UNIT_PRICE", + "value": "1", + "description": "주문가격\n※ 주문가격이 '0'일 경우\n- 옵션매수 : 현재가\n- 그 이외 : 기준가" + }, + { + "key": "ORD_DVSN_CD", + "value": "01", + "description": "주문구분코드\n01 : 지정가\n02 : 시장가\n03 : 조건부\n04 : 최유리,\n10 : 지정가(IOC)\n11 : 지정가(FOK)\n12 : 시장가(IOC)\n13 : 시장가(FOK)\n14 : 최유리(IOC)\n15 : 최유리(FOK)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내선물옵션] 기본시세", + "item": [ + { + "name": "V_선물옵션 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHMIF10000000", + "type": "text", + "description": "[실전/모의투자]\nFHMIF10000000 : 선물 옵션 시세" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/quotations/inquire-price?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션 시세호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHMIF10010000", + "type": "text", + "description": "[실전/모의투자]\nFHMIF10010000 : 선물 옵션 시세 호가" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/quotations/inquire-asking-price?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-asking-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_선물옵션기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKIF03020100", + "type": "text", + "description": "[실전/모의투자]\nFHKIF03020100" + } + ], + "url": { + "raw": "{{VTS}}/uapi/domestic-futureoption/v1/quotations/inquire-daily-fuopchartprice?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09&fid_input_date_1=20210301&fid_input_date_2=20220810&fid_period_div_code=D", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-daily-fuopchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "fid_input_date_1", + "value": "20210301", + "description": "시작일자 (20220501) (최대100건)" + }, + { + "key": "fid_input_date_2", + "value": "20220810", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "해외주식", + "item": [ + { + "name": "[해외주식] 주문/계좌", + "item": [ + { + "name": "V_해외주식 주문(미국)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTT1002U", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"TSLA\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"900.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문(일본)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0308U", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"450.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문(상해)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0202U", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SHAA\",\r\n \"PDNO\": \"601360\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"7.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문(홍콩)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS1002U", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SEHK\",\r\n \"PDNO\": \"08495\",\r\n \"ORD_QTY\": \"4000\",\r\n \"OVRS_ORD_UNPR\": \"1.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문(심천)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0305U", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SZAA\",\r\n \"PDNO\": \"002051\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"8.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문(베트남)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0311U ", + "type": "text", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"VND\",\r\n \"PDNO\": \"HPG\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"23000.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 정정취소주문(정정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0309U", + "type": "text", + "description": "[실전투자]\nTTTT1004U : 미국 정정 취소 주문\nTTTS1003U : 홍콩 정정 취소 주문\nTTTS0309U : 일본 정정 취소 주문\nTTTS0302U : 상해 취소 주문\nTTTS0306U : 심천 취소 주문\nTTTS0312U : 베트남 취소 주문\n\n[모의투자]\nVTTT1004U : 미국 정정 취소 주문\nVTTS1003U : 홍콩 정정 취소 주문\nVTTS0309U : 일본 정정 취소 주문\nVTTS0302U : 상해 취소 주문\nVTTS0306U : 심천 취소 주문\nVTTS0312U : 베트남 취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORGN_ODNO\": \"0000006616\",\r\n \"RVSE_CNCL_DVSN_CD\": \"01\",\r\n \"ORD_QTY\": \"200\",\r\n \"OVRS_ORD_UNPR\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-rvsecncl", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 정정취소주문(취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS0309U", + "type": "text", + "description": "[실전투자]\nTTTT1004U : 미국 정정 취소 주문\nTTTS1003U : 홍콩 정정 취소 주문\nTTTS0309U : 일본 정정 취소 주문\nTTTS0302U : 상해 취소 주문\nTTTS0306U : 심천 취소 주문\nTTTS0312U : 베트남 취소 주문\n\n[모의투자]\nVTTT1004U : 미국 정정 취소 주문\nVTTS1003U : 홍콩 정정 취소 주문\nVTTS0309U : 일본 정정 취소 주문\nVTTS0302U : 상해 취소 주문\nVTTS0306U : 심천 취소 주문\nVTTS0312U : 베트남 취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORGN_ODNO\": \"0000006616\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORD_QTY\": \"200\",\r\n \"OVRS_ORD_UNPR\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-rvsecncl", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(미국)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH); \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTT3014U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"TSLA\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"FT_ORD_QTY\": \"1\",\r\n \"FT_ORD_UNPR3\": \"900.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(일본)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3013U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"4689\",\r\n \"PRDT_TYPE_CD\": \"515\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(홍콩)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH); \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3013U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"08495\",\r\n \"PRDT_TYPE_CD\": \"501\",\r\n \"OVRS_EXCG_CD\": \"SEHK\",\r\n \"FT_ORD_QTY\": \"4000\",\r\n \"FT_ORD_UNPR3\": \"1.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(상해)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3013U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"601360\",\r\n \"PRDT_TYPE_CD\": \"551\",\r\n \"OVRS_EXCG_CD\": \"SHAA\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"7.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(심천)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3013U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"002051\",\r\n \"PRDT_TYPE_CD\": \"552\",\r\n \"OVRS_EXCG_CD\": \"SZAA\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"8.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수(베트남)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + " \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3013U", + "type": "text", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"HPG\",\r\n \"PRDT_TYPE_CD\": \"508\",\r\n \"OVRS_EXCG_CD\": \"HASE\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"23000.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 예약주문접수 취소", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('VTS')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('VTS_APPKEY'),\r", + " 'appSecret': pm.environment.get('VTS_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"VTS_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTT3017U", + "type": "text", + "description": "[실전투자]\nJTTT3017U : 미국예약주문접수 취소\n\n[모의투자]\nVTTT3017U : 미국예약주문접수 취소\n(일본, 홍콩 등 타국가 개발 진행 예정)" + }, + { + "key": "hashkey", + "value": "{{VTS_HASH}}", + "type": "default", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RSVN_ORD_RCIT_DT\": \"20220816\",\r\n \"OVRS_RSVN_ODNO\": \"41\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 미체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3018R", + "type": "text", + "description": "[실전투자]\nTTTS3018R\n\n[모의투자]\nVTTS3018R" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/inquire-nccs?CANO={{CANO}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=TKSE&SORT_SQN=DS&CTX_AREA_FK200=&CTX_AREA_NK200", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-nccs" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "TKSE", + "description": "해외거래소코드\nNASD : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nDS : 정순\n그외 : 역순" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3012R", + "type": "text", + "description": "[실전투자]\nTTTS3012R\n\n[모의투자]\nVTTS3012R" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/inquire-balance?CANO={{CANO}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=TKSE&TR_CRCY_CD=JPY&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "TKSE", + "description": "해외거래소코드\nNASD : 미국전체\nNAS : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "TR_CRCY_CD", + "value": "JPY", + "description": "거래통화코드\nUSD : 미국달러\nHKD : 홍콩달러\nCNY : 중국위안화\nJPY : 일본엔화\nVND : 베트남동" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 주문체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTTS3035R", + "type": "text", + "description": "[실전투자]\nTTTS3035R\n\n[모의투자]\nVTTS3035R" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/inquire-ccnl?CANO={{CANO}}&ACNT_PRDT_CD=01&PDNO=&ORD_STRT_DT=&ORD_END_DT=&SLL_BUY_DVSN=00&CCLD_NCCS_DVSN=00&OVRS_EXCG_CD=&SORT_SQN=DS&ORD_DT=&ORD_GNO_BRNO=&ODNO=&CTX_AREA_NK200=&CTX_AREA_FK200=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-ccnl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(공백일경우 전종목)" + }, + { + "key": "ORD_STRT_DT", + "value": "", + "description": "주문시작일자(YYYYMMDD)" + }, + { + "key": "ORD_END_DT", + "value": "", + "description": "주문종료일자(YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN", + "value": "00", + "description": "매도매수구분\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "OVRS_EXCG_CD", + "value": "", + "description": "해외거래소코드\nNASD : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nDS : 정순\nAS : 역순" + }, + { + "key": "ORD_DT", + "value": "", + "description": "주문일자(\"\" Null 값 설정)" + }, + { + "key": "ORD_GNO_BRNO", + "value": "", + "description": "주문채번지점번호(\"\" Null 값 설정)" + }, + { + "key": "ODNO", + "value": "", + "description": "주문번호(\"\" Null 값 설정)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 체결기준 현재잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "VTRP6504R", + "type": "text", + "description": "[실전투자]\nCTRP6504R\n\n[모의투자]\nVTRP6504R" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-stock/v1/trading/inquire-present-balance?CANO={{CANO}}&ACNT_PRDT_CD=01&NATN_CD=000&WCRC_FRCR_DVSN_CD=01&TR_MKET_CD=00&INQR_DVSN_CD=00", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-present-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "NATN_CD", + "value": "000", + "description": "국가코드\n000 전체\n840 미국\n344 홍콩\n156 중국\n392 일본\n704 베트남" + }, + { + "key": "WCRC_FRCR_DVSN_CD", + "value": "01", + "description": "원화외화구분코드\n01 : 원화\n02 : 외화" + }, + { + "key": "TR_MKET_CD", + "value": "00", + "description": "거래시장코드\n[Request body NATN_CD 000 설정]\n00 : 전체\n\n[Request body NATN_CD 840 설정]\n00 : 전체\n01 : 나스닥(NASD)\n02 : 뉴욕거래소(NYSE)\n03 : 미국(PINK SHEETS)\n04 : 미국(OTCBB)\n05 : 아멕스(AMEX)\n\n[Request body NATN_CD 156 설정]\n00 : 전체\n01 : 상해B\n02 : 심천B\n03 : 상해A\n04 : 심천A\n\n[Request body NATN_CD 392 설정]\n01 : 일본\n\n[Request body NATN_CD 704 설정]\n01 : 하노이거래\n02 : 호치민거래소\n\n[Request body NATN_CD 344 설정]\n01 : 홍콩\n02 : 홍콩CNY\n03 : 홍콩USD" + }, + { + "key": "INQR_DVSN_CD", + "value": "00", + "description": "조회구분코드\n00 : 전체\n01 : 일반해외주식\n02 : 미니스탁" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[해외주식] 기본시세", + "item": [ + { + "name": "V_해외주식 현재체결가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "HHDFS00000300", + "type": "text", + "description": "[실전투자/모의투자]\nHHDFS00000300" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-price/v1/quotations/price?AUTH=&EXCD=NAS&SYMB=AAPL", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "price" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "AAPL", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 기간별시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "HHDFS76240000", + "type": "text", + "description": "[실전투자/모의투자]\nHHDFS76240000" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-price/v1/quotations/dailyprice?AUTH=&EXCD=NAS&SYMB=AAPL&GUBN=0&BYMD=&MODP=1", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "dailyprice" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "AAPL", + "description": "종목코드" + }, + { + "key": "GUBN", + "value": "0", + "description": "일/주/월구분\n0 : 일\n1 : 주\n2 : 월" + }, + { + "key": "BYMD", + "value": "", + "description": "조회기준일자(YYYYMMDD)\n※ 공란 설정 시, 기준일 오늘 날짜로 설정" + }, + { + "key": "MODP", + "value": "1", + "description": "수정주가반영여부\n0 : 미반영\n1 : 반영" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 종목/지수/환율기간별시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "FHKST03030100", + "type": "text", + "description": "[실전투자/모의투자]\nFHKST03030100" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-price/v1/quotations/inquire-daily-chartprice?FID_COND_MRKT_DIV_CODE=N&FID_INPUT_ISCD=QQQ&FID_INPUT_DATE_1=20220531&FID_INPUT_DATE_2=20220731&FID_PERIOD_DIV_CODE=D", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-daily-chartprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "N", + "description": "시장분류코드(N: 해외지수, X: 환율)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "QQQ", + "description": "종목코드\n※ 해외주식 마스터 코드 참조 \n(포럼 > FAQ > 종목정보 다운로드 > 해외주식)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20220531", + "description": "시작일자(YYYYMMDD)" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20220731", + "description": "종료일자(YYYYMMDD)" + }, + { + "key": "FID_PERIOD_DIV_CODE", + "value": "D", + "description": "기간분류코드(D:일, W:주, M:월, Y:년)" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외주식 조건검색", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTS_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTS_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTS_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "HHDFS76410000", + "type": "text", + "description": "[실전투자/모의투자]\nHHDFS76410000" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-price/v1/quotations/inquire-search?AUTH=&EXCD=NAS&CO_YN_PRICECUR=1&CO_ST_PRICECUR=160&CO_EN_PRICECUR=170&CO_YN_RATE=&CO_ST_RATE=&CO_EN_RATE=&CO_YN_VALX=&CO_ST_VALX=&CO_EN_VALX=&CO_YN_SHAR=&CO_ST_SHAR=&CO_EN_SHAR=&CO_YN_VOLUME=&CO_ST_VOLUME=&CO_EN_VOLUME=&CO_YN_AMT=&CO_ST_AMT=&CO_EN_AMT=&CO_YN_EPS=&CO_ST_EPS=&CO_EN_EPS=&CO_YN_PER=&CO_ST_PER=&CO_EN_PER=", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-search" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nNYS : 뉴욕, NAS : 나스닥, AMS : 아멕스\nHKS : 홍콩, SHS : 상해 , SZS : 심천\nHSX : 호치민, HNX : 하노이\nTSE : 도쿄" + }, + { + "key": "CO_YN_PRICECUR", + "value": "1", + "description": "현재가선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_PRICECUR", + "value": "160", + "description": "현재가시작범위가" + }, + { + "key": "CO_EN_PRICECUR", + "value": "170", + "description": "현재가끝범위가" + }, + { + "key": "CO_YN_RATE", + "value": "", + "description": "등락율선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_RATE", + "value": "", + "description": "등락율시작율" + }, + { + "key": "CO_EN_RATE", + "value": "", + "description": "등락율끝율" + }, + { + "key": "CO_YN_VALX", + "value": "", + "description": "시가총액선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_VALX", + "value": "", + "description": "시가총액시작액" + }, + { + "key": "CO_EN_VALX", + "value": "", + "description": "시가총액끝액" + }, + { + "key": "CO_YN_SHAR", + "value": "", + "description": "발행주식수선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_SHAR", + "value": "", + "description": "발행주식시작수" + }, + { + "key": "CO_EN_SHAR", + "value": "", + "description": "발행주식끝수" + }, + { + "key": "CO_YN_VOLUME", + "value": "", + "description": "거래량선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_VOLUME", + "value": "", + "description": "거래량시작량" + }, + { + "key": "CO_EN_VOLUME", + "value": "", + "description": "거래량끝량" + }, + { + "key": "CO_YN_AMT", + "value": "", + "description": "거래대금선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_AMT", + "value": "", + "description": "거래대금시작금" + }, + { + "key": "CO_EN_AMT", + "value": "", + "description": "거래대금끝금" + }, + { + "key": "CO_YN_EPS", + "value": "", + "description": "EPS선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_EPS", + "value": "", + "description": "EPS시작" + }, + { + "key": "CO_EN_EPS", + "value": "", + "description": "EPS끝" + }, + { + "key": "CO_YN_PER", + "value": "", + "description": "PER선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_PER", + "value": "", + "description": "PER시작" + }, + { + "key": "CO_EN_PER", + "value": "", + "description": "PER끝" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "해외선물옵션", + "item": [ + { + "name": "[해외선물옵션] 기본시세", + "item": [ + { + "name": "V_해외선물종목상세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "HHDFC55010100", + "type": "text", + "description": "[실전투자/모의투자]\nHHDFC55010100" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{VTS}}/uapi/overseas-futureoption/v1/quotations/stock-detail?SRS_CD=6AU22", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "stock-detail" + ], + "query": [ + { + "key": "SRS_CD", + "value": "6AU22", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "V_해외선물종목현재가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text", + "description": "application/json; charset=utf-8" + }, + { + "key": "authorization", + "value": "Bearer {{VTT_TOKEN}}", + "type": "text", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)" + }, + { + "key": "appkey", + "value": "{{VTT_APPKEY}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "appsecret", + "value": "{{VTT_APPSECRET}}", + "type": "text", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)" + }, + { + "key": "tr_id", + "value": "HHDFC55010000", + "type": "text", + "description": "[실전/모의투자]\nHHDFC55010000" + } + ], + "url": { + "raw": "{{VTS}}/uapi/overseas-futureoption/v1/quotations/inquire-price?SRS_CD=6AU22", + "host": [ + "{{VTS}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "SRS_CD", + "value": "6AU22", + "description": "종목코드" + } + ] + } + }, + "response": [] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_환경변수.json b/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_환경변수.json new file mode 100644 index 0000000..48f6793 --- /dev/null +++ b/한국투자증권(API)/legacy/postman/모의계좌_POSTMAN_환경변수.json @@ -0,0 +1 @@ +{"id":"03e21ca7-e652-41b6-8eae-bce9fce1170f","name":"모의Env","values":[{"key":"VTS","value":"https://openapivts.koreainvestment.com:29443","enabled":true,"type":"default"},{"key":"PROD","value":"https://openapi.koreainvestment.com:9443","enabled":true,"type":"default"},{"key":"CANO","value":"","enabled":true,"type":"default"},{"key":"CANO_T","value":"","enabled":true,"type":"default"},{"key":"VTS_APPKEY","value":"","enabled":true,"type":"default"},{"key":"VTS_APPSECRET","value":"","enabled":true,"type":"default"},{"key":"VTS_TOKEN","value":"","enabled":true,"type":"default"},{"key":"VTS_HASH","value":"","enabled":true,"type":"any"},{"key":"VTT_APPKEY","value":"","enabled":true,"type":"default"},{"key":"VTT_APPSECRET","value":"","enabled":true,"type":"default"},{"key":"VTT_TOKEN","value":"","enabled":true,"type":"default"},{"key":"VTT_HASH","value":"","enabled":true,"type":"default"}]} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_샘플코드_v2.6.json b/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_샘플코드_v2.6.json new file mode 100644 index 0000000..a73d6bf --- /dev/null +++ b/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_샘플코드_v2.6.json @@ -0,0 +1,26763 @@ +{ + "info": { + "_postman_id": "f732a2d6-1d0d-4daa-a56b-a4963082b5ee", + "name": "실전투자(실전Env)", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "22257223", + "_collection_link": "https://truefriend-openapi.postman.co/workspace/%ED%95%9C%ED%88%ACAPI_TEST~de90589e-fb42-46d5-b9c4-ced0d1b7d0df/collection/22257223-f732a2d6-1d0d-4daa-a56b-a4963082b5ee?action=share&source=collection_link&creator=22257223" + }, + "item": [ + { + "name": "OAuth", + "item": [ + { + "name": "J_웹소켓접속키발급", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"APPROVAL_KEY\", jsonData.approval_key); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{PROD_APPKEY}}\",\r\n \"secretkey\": \"{{PROD_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/oauth2/Approval", + "host": [ + "{{PROD}}" + ], + "path": [ + "oauth2", + "Approval" + ] + } + }, + "response": [] + }, + { + "name": "J_토큰발급", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"PROD_TOKEN\", jsonData.access_token); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{PROD_APPKEY}}\",\r\n \"appsecret\": \"{{PROD_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/oauth2/tokenP", + "host": [ + "{{PROD}}" + ], + "path": [ + "oauth2", + "tokenP" + ] + } + }, + "response": [] + }, + { + "name": "J_토큰폐기", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"appkey\": \"{{PROD_APPKEY}}\",\r\n \"appsecret\": \"{{PROD_APPSECRET}}\",\r\n \"token\": \"{{PROD_TOKEN}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/oauth2/revokeP", + "host": [ + "{{PROD}}" + ], + "path": [ + "oauth2", + "revokeP" + ] + } + }, + "response": [] + }, + { + "name": "J_해쉬키생성", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"PROD_HASH\", jsonData.HASH); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"CANO\": \"{{CANO_REAL}}\",\r\n\t\"ACNT_PRDT_CD\": \"01\",\r\n\t\"PDNO\": \"071050\",\r\n\t\"ORD_DVSN\": \"01\",\r\n\t\"ORD_QTY\": \"1\",\r\n\t\"ORD_UNPR\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/hashkey", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "hashkey" + ] + } + }, + "response": [] + }, + { + "name": "J_토큰발급(선물옵션)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"PROT_TOKEN\", jsonData.access_token); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"grant_type\": \"client_credentials\",\r\n \"appkey\": \"{{PROT_APPKEY}}\",\r\n \"appsecret\": \"{{PROT_APPSECRET}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/oauth2/tokenP", + "host": [ + "{{PROD}}" + ], + "path": [ + "oauth2", + "tokenP" + ] + } + }, + "response": [] + }, + { + "name": "J_토큰폐기(선물옵션)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"appkey\": \"{{PROT_APPKEY}}\",\r\n \"appsecret\": \"{{PROT_APPSECRET}}\",\r\n \"token\": \"{{PROT_TOKEN}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/oauth2/revokeP", + "host": [ + "{{PROD}}" + ], + "path": [ + "oauth2", + "revokeP" + ] + } + }, + "response": [] + }, + { + "name": "J_해쉬키생성(선물옵션)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "console.log(jsonData)\r", + "\r", + "if (jsonData) { \r", + " pm.environment.set(\"PROT_HASH\", jsonData.HASH); \r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"CANO\": \"{{CANO_REAL_T}}\",\r\n\t\"ACNT_PRDT_CD\": \"03\",\r\n\t\"PDNO\": \"071050\",\r\n\t\"ORD_DVSN\": \"01\",\r\n\t\"ORD_QTY\": \"1\",\r\n\t\"ORD_UNPR\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/hashkey", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "hashkey" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "국내주식", + "item": [ + { + "name": "[국내주식] 주문/계좌", + "item": [ + { + "name": "J_주식주문(현금)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0802U", + "description": "[실전투자]\nTTTC0802U : 주식 현금 매수 주문\nTTTC0801U : 주식 현금 매도 주문\n[모의투자]\nVTTC0802U : 주식 현금 매수 주문\nVTTC0801U : 주식 현금 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"136480\",\r\n \"ORD_DVSN\": \"00\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"2500\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-cash", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-cash" + ] + } + }, + "response": [] + }, + { + "name": "J_주식주문(신용)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0852U", + "description": "[실전투자]\nTTTC0852U : 주식 신용매수 주문\nTTTC0851U : 주식 신용매도 주문\n* 모의투자 사용 불가", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"005930\",\r\n \"CRDT_TYPE\": \"21\",\r\n \"LOAN_DT\": \"20220810\",\r\n \"ORD_DVSN\": \"00\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"55000\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-credit", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-credit" + ] + } + }, + "response": [] + }, + { + "name": "J_주식주문(정정취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + "\r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0803U", + "description": "[실전투자]\nTTTC0803U : 주식 정정 취소 주문\n[모의투자]\nVTTC0803U : 주식 정정 취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"KRX_FWDG_ORD_ORGNO\": \"06010\",\r\n \"ORGN_ODNO\": \"0000002101\",\r\n \"ORD_DVSN\": \"00\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"55000\",\r\n \"QTY_ALL_ORD_YN\": \"Y\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_주식정정취소가능주문조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8036R", + "description": "[실전투자]\nTTTC8036R : 주식 정정 취소 가능 주문 조회\n* 모의투자 사용 불가", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&CTX_AREA_FK100=&CTX_AREA_NK100=&INQR_DVSN_1=1&INQR_DVSN_2=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-psbl-rvsecncl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "INQR_DVSN_1", + "value": "1", + "description": "조회구분1\n0 : 조회순서\n1 : 주문순\n2 : 종목순" + }, + { + "key": "INQR_DVSN_2", + "value": "0", + "description": "조회구분2\n0 : 전체\n1 : 매도\n2 : 매수" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식일별주문체결조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8001R", + "description": "[실전투자]\nTTTC8001R : 주식 일별 주문 체결 조회(3개월이내)\nCTSC9115R : 주식 일별 주문 체결 조회(3개월이전)\n\n[모의투자]\nVTTC8001R : 주식 일별 주문 체결 조회(3개월이내)\nVTSC9115R : 주식 일별 주문 체결 조회(3개월이전)\n* 일별 조회로, 당일 주문내역은 지연될 수 있습니다.", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-daily-ccld?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&INQR_STRT_DT=20220810&INQR_END_DT=20220810&SLL_BUY_DVSN_CD=00&INQR_DVSN=00&PDNO=005930&CCLD_DVSN=00&ORD_GNO_BRNO=&ODNO=&INQR_DVSN_3=00&INQR_DVSN_1=&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-daily-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_STRT_DT", + "value": "20220810", + "description": "조회시작일자(YYYYMMDD)" + }, + { + "key": "INQR_END_DT", + "value": "20220810", + "description": "조회종료일자(YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "INQR_DVSN", + "value": "00", + "description": "조회구분\n00 : 역순\n01 : 정순" + }, + { + "key": "PDNO", + "value": "005930", + "description": "종목번호(6자리)" + }, + { + "key": "CCLD_DVSN", + "value": "00", + "description": "체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "ORD_GNO_BRNO", + "value": "", + "description": "주문시 한국투자증권 시스템에서 지정된 영업점코드" + }, + { + "key": "ODNO", + "value": "", + "description": "주문시 한국투자증권 시스템에서 채번된 주문번호" + }, + { + "key": "INQR_DVSN_3", + "value": "00", + "description": "조회구분3\n00 : 전체\n01 : 현금\n02 : 융자\n03 : 대출\n04 : 대주" + }, + { + "key": "INQR_DVSN_1", + "value": "", + "description": "조회구분1\n공란 : 전체\n1 : ELW\n2 : 프리보드" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식잔고조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8434R", + "description": "[실전투자]\nTTTC8434R : 주식 잔고 조회\n\n[모의투자]\nVTTC8434R : 주식 잔고 조회", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&AFHR_FLPR_YN=N&OFL_YN=&INQR_DVSN=01&UNPR_DVSN=01&FUND_STTL_ICLD_YN=N&FNCG_AMT_AUTO_RDPT_YN=N&PRCS_DVSN=00&CTX_AREA_FK100&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "AFHR_FLPR_YN", + "value": "N", + "description": "시간외단일가여부\nN : 기본값\nY : 시간외단일가" + }, + { + "key": "OFL_YN", + "value": "", + "description": "공란(Default)" + }, + { + "key": "INQR_DVSN", + "value": "01", + "description": "조회구분\n01 : 대출일별\n02 : 종목별" + }, + { + "key": "UNPR_DVSN", + "value": "01", + "description": "단가구분\n01 : 기본값" + }, + { + "key": "FUND_STTL_ICLD_YN", + "value": "N", + "description": "펀드결제분포함여부\nN : 포함하지 않음\nY : 포함" + }, + { + "key": "FNCG_AMT_AUTO_RDPT_YN", + "value": "N", + "description": "융자금액자동상환여부\nN : 기본값" + }, + { + "key": "PRCS_DVSN", + "value": "00", + "description": "처리구분\n00 : 전일매매포함\n01 : 전일매매미포함" + }, + { + "key": "CTX_AREA_FK100", + "value": null, + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_매수가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8908R", + "description": "[실전투자]\nTTTC8908R : 매수 가능 조회\n\n[모의투자]\nVTTC8908R : 매수 가능 조회", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-psbl-order?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=005930&ORD_UNPR=55000&ORD_DVSN=01&OVRS_ICLD_YN=N&CMA_EVLU_AMT_ICLD_YN=N", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "005930", + "description": "종목번호 (6자리)" + }, + { + "key": "ORD_UNPR", + "value": "55000", + "description": "주문단가(1주당 가격)" + }, + { + "key": "ORD_DVSN", + "value": "01", + "description": "주문구분\n00 : 지정가\n01 : 시장가\n02 : 조건부지정가\n03 : 최유리지정가\n04 : 최우선지정가\n05 : 장전 시간외\n06 : 장후 시간외\n07 : 시간외 단일가\n08 : 자기주식\n09 : 자기주식S-Option\n10 : 자기주식금전신탁\n11 : IOC지정가 (즉시체결,잔량취소)\n12 : FOK지정가 (즉시체결,전량취소)\n13 : IOC시장가 (즉시체결,잔량취소)\n14 : FOK시장가 (즉시체결,전량취소)\n15 : IOC최유리 (즉시체결,잔량취소)\n16 : FOK최유리 (즉시체결,전량취소)\n51 : 장중대량\n52 : 장중바스켓\n62 : 장개시전 시간외대량\n63 : 장개시전 시간외바스켓\n67 : 장개시전 금전신탁자사주\n69 : 장개시전 자기주식\n72 : 시간외대량\n77 : 시간외자사주신탁\n79 : 시간외대량자기주식\n80 : 바스켓" + }, + { + "key": "OVRS_ICLD_YN", + "value": "N", + "description": "CMA평가금액포함여부\nY : 포함\nN : 포함하지 않음" + }, + { + "key": "CMA_EVLU_AMT_ICLD_YN", + "value": "N", + "description": "해외포함여부\nY : 포함\nN : 포함하지 않음" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식예약주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC0008U", + "description": "[실전투자]\nCTSC0008U : 국내예약매수입력/주문예약매도입력", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"005930\",\r\n \"ORD_QTY\": \"1\",\r\n \"ORD_UNPR\": \"55000\",\r\n \"SLL_BUY_DVSN_CD\": \"02\",\r\n \"ORD_DVSN_CD\": \"00\",\r\n \"ORD_OBJT_CBLC_DVSN_CD\": \"10\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_주식예약주문정정취소(취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC0009U", + "description": "[실전투자]\nCTSC0009U : 국내주식예약취소주문\nCTSC0013U : 국내주식예약정정주문\n* 모의투자 사용 불가", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RSVN_ORD_SEQ\": \"94877\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-resv-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-resv-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_주식예약주문정정취소(정정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC0013U", + "description": "[실전투자]\nCTSC0009U : 국내주식예약취소주문\nCTSC0013U : 국내주식예약정정주문\n* 모의투자 사용 불가", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"005930\",\r\n \"ORD_QTY\": \"2\",\r\n \"ORD_UNPR\": \"55000\",\r\n \"SLL_BUY_DVSN_CD\": \"02\",\r\n \"ORD_DVSN_CD\": \"00\",\r\n \"ORD_OBJT_CBLC_DVSN_CD\": \"10\",\r\n \"RSVN_ORD_SEQ\": \"88793\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-resv-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-resv-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_주식예약주문조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC0004R", + "description": "[실전투자]\nCTSC0004R : 국내주식예약주문조회\n* 모의투자 사용 불가", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/order-resv-ccnl?RSVN_ORD_ORD_DT=20220729&RSVN_ORD_END_DT=20220810&RSVN_ORD_SEQ&TMNL_MDIA_KIND_CD=00&CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PRCS_DVSN_CD=0&CNCL_YN=Y&PDNO=&SLL_BUY_DVSN_CD&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "order-resv-ccnl" + ], + "query": [ + { + "key": "RSVN_ORD_ORD_DT", + "value": "20220729", + "description": "예약주문종료일자(YYYYMMDD)" + }, + { + "key": "RSVN_ORD_END_DT", + "value": "20220810", + "description": "예약주문종료일자(YYYYMMDD)" + }, + { + "key": "RSVN_ORD_SEQ", + "value": null, + "description": "예약주문순번(공백 입력)" + }, + { + "key": "TMNL_MDIA_KIND_CD", + "value": "00", + "description": "단말매체종류코드(\"00\" 입력)" + }, + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PRCS_DVSN_CD", + "value": "0", + "description": "처리구분코드(\"0\" 입력)" + }, + { + "key": "CNCL_YN", + "value": "Y", + "description": "취소여부(\"Y\" 입력, 유효한 주문만 조회)" + }, + { + "key": "PDNO", + "value": "", + "description": "종목코드(6자리) (공백 입력 시 전체 조회)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": null, + "description": "매도매수구분코드(공백 입력)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_퇴직연금체결기준잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC2202R", + "description": "TTTC2202R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/pension/inquire-present-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=29&USER_DVSN_CD=00&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "pension", + "inquire-present-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "29", + "description": "계좌상품코드" + }, + { + "key": "USER_DVSN_CD", + "value": "00", + "description": "사용자구분코드" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_퇴직연금 미체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC2201R", + "description": "TTTC2201R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/pension/inquire-daily-ccld?CANO={{CANO_REAL}}&ACNT_PRDT_CD=29&USER_DVSN_CD=%%&SLL_BUY_DVSN_CD=00&CCLD_NCCS_DVSN=%%&INQR_DVSN_3=00&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "pension", + "inquire-daily-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "29", + "description": "계좌상품코드" + }, + { + "key": "USER_DVSN_CD", + "value": "%%", + "description": "사용자구분코드" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n00 : 전체 / 01 : 매도 / 02 : 매수" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "%%", + "description": "체결미체결구분\n%% : 전체 / 01 : 체결 / 02 : 미체결" + }, + { + "key": "INQR_DVSN_3", + "value": "00", + "description": "조회구분3\n00 : 전체" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_퇴직연금 매수가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0503R", + "description": "TTTC2201R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/pension/inquire-psbl-order?CANO={{CANO_REAL}}&ACNT_PRDT_CD=29&PDNO=069500&ORD_UNPR=30800&ORD_DVSN=00&CMA_EVLU_AMT_ICLD_YN=Y&ACCA_DVSN_CD=00", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "pension", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "29", + "description": "계좌상품코드" + }, + { + "key": "PDNO", + "value": "069500", + "description": "상품번호" + }, + { + "key": "ORD_UNPR", + "value": "30800", + "description": "주문단가" + }, + { + "key": "ORD_DVSN", + "value": "00", + "description": "주문구분\n00 : 지정가 / 01 : 시장가" + }, + { + "key": "CMA_EVLU_AMT_ICLD_YN", + "value": "Y", + "description": "CMA평가금액포함여부" + }, + { + "key": "ACCA_DVSN_CD", + "value": "00", + "description": "적립금구분코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_퇴직연금 예수금조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0506R", + "description": "TTTC2201R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/pension/inquire-deposit?CANO={{CANO_REAL}}&ACNT_PRDT_CD=29&ACCA_DVSN_CD=00", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "pension", + "inquire-deposit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "29", + "description": "계좌상품코드" + }, + { + "key": "ACCA_DVSN_CD", + "value": "00", + "description": "적립금구분코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_퇴직연금 잔고조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC2208R", + "description": "TTTC2208R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/pension/inquire-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=29&ACCA_DVSN_CD=00&INQR_DVSN=00&CTX_AREA_FK100&CTX_AREA_NK100", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "pension", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "29", + "description": "계좌상품코드" + }, + { + "key": "ACCA_DVSN_CD", + "value": "00", + "description": "적립금구분코드" + }, + { + "key": "INQR_DVSN", + "value": "00", + "description": "조회구분\n00 : 전체" + }, + { + "key": "CTX_AREA_FK100", + "value": null, + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": null, + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식잔고조회_실현손익", + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8494R", + "description": "[실전투자]\nTTTC8494R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-balance-rlz-pl?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&AFHR_FLPR_YN=N&OFL_YN=&INQR_DVSN=02&UNPR_DVSN=01&FUND_STTL_ICLD_YN=N&FNCG_AMT_AUTO_RDPT_YN=N&PRCS_DVSN=01&COST_ICLD_YN=N&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-balance-rlz-pl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호\n계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드\n계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "AFHR_FLPR_YN", + "value": "N", + "description": "시간외단일가여부\nN : 기본값\nY : 시간외단일가" + }, + { + "key": "OFL_YN", + "value": "", + "description": "오프라인여부(공란)" + }, + { + "key": "INQR_DVSN", + "value": "02", + "description": "조회구분(00 : 전체)" + }, + { + "key": "UNPR_DVSN", + "value": "01", + "description": "단가구분(01 : 기본값)" + }, + { + "key": "FUND_STTL_ICLD_YN", + "value": "N", + "description": "펀드결제포함여부\nN : 포함하지 않음\nY : 포함" + }, + { + "key": "FNCG_AMT_AUTO_RDPT_YN", + "value": "N", + "description": "융자금액자동상환여부\nN : 기본값" + }, + { + "key": "PRCS_DVSN", + "value": "01", + "description": "처리구분코드\n00 : 전일매매포함\n01 : 전일매매미포함" + }, + { + "key": "COST_ICLD_YN", + "value": "N", + "description": "비용포함여부\nN : 포함하지 않음\nY : 포함" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100\n공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100 값 : 다음페이지 조회시(2번째부터\n" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100\n공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100 값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_신용매수가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8909R", + "description": "[실전투자]\nTTTC8909R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-credit-psamount?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=005930&ORD_UNPR=60000&ORD_DVSN=01&CRDT_TYPE=21&OVRS_ICLD_YN=N&CMA_EVLU_AMT_ICLD_YN=N", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-credit-psamount" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "005930", + "description": "종목번호 (6자리)" + }, + { + "key": "ORD_UNPR", + "value": "60000", + "description": "주문단가(1주당 가격)" + }, + { + "key": "ORD_DVSN", + "value": "01", + "description": "주문구분\n00 : 지정가\n01 : 시장가\n02 : 조건부지정가\n03 : 최유리지정가\n04 : 최우선지정가\n05 : 장전 시간외\n06 : 장후 시간외\n07 : 시간외 단일가\n08 : 자기주식\n09 : 자기주식S-Option\n10 : 자기주식금전신탁\n11 : IOC지정가 (즉시체결,잔량취소)\n12 : FOK지정가 (즉시체결,전량취소)\n13 : IOC시장가 (즉시체결,잔량취소)\n14 : FOK시장가 (즉시체결,전량취소)\n15 : IOC최유리 (즉시체결,잔량취소)\n16 : FOK최유리 (즉시체결,전량취소)\n51 : 장중대량\n52 : 장중바스켓\n62 : 장개시전 시간외대량\n63 : 장개시전 시간외바스켓\n67 : 장개시전 금전신탁자사주\n69 : 장개시전 자기주식\n72 : 시간외대량\n77 : 시간외자사주신탁\n79 : 시간외대량자기주식\n80 : 바스켓" + }, + { + "key": "CRDT_TYPE", + "value": "21", + "description": "신용유형\n21 : 자기융자신규\n23 : 유통융자신규\n26 : 유통대주상환\n28 : 자기대주상환\n25 : 자기융자상환\n27 : 유통융자상환\n22 : 유통대주신규\n24 : 자기대주신규" + }, + { + "key": "OVRS_ICLD_YN", + "value": "N", + "description": "CMA평가금액포함여부\nY : 포함\nN : 포함하지 않음" + }, + { + "key": "CMA_EVLU_AMT_ICLD_YN", + "value": "N", + "description": "해외포함여부\nY : 포함\nN : 포함하지 않음" + } + ] + } + }, + "response": [] + }, + { + "name": "J_투자계좌자산현황조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTRP6548R", + "description": "[실전투자]\nCTRP6548R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-account-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=21&INQR_DVSN_1&BSPR_BF_DT_APLY_YN", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-account-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "21", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_DVSN_1", + "value": null, + "description": "조회구분1(공백입력)" + }, + { + "key": "BSPR_BF_DT_APLY_YN", + "value": null, + "description": "기준가이전일자적용여부(공백입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_기간별매매손익현황조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8715R", + "description": "[실전투자]\nTTTC8715R", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-period-trade-profit?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=&INQR_STRT_DT=20230216&INQR_END_DT=20240301&SORT_DVSN=02&CBLC_DVSN=00&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-period-trade-profit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(\"\"공란입력 시, 전체)" + }, + { + "key": "INQR_STRT_DT", + "value": "20230216", + "description": "조회시작일자" + }, + { + "key": "INQR_END_DT", + "value": "20240301", + "description": "조회종료일자" + }, + { + "key": "SORT_DVSN", + "value": "02", + "description": "정렬구분\n00: 최근 순, 01: 과거 순, 02: 최근 순" + }, + { + "key": "CBLC_DVSN", + "value": "00", + "description": "잔고구분(00: 전체)" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_기간별손익일별합산조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8708R", + "description": "[실전투자]\nTTTC8708R", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-period-profit?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=&INQR_STRT_DT=20230101&INQR_END_DT=20240301&SORT_DVSN=00&INQR_DVSN=00&CBLC_DVSN=00&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-period-profit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(\"\"공란입력 시, 전체)" + }, + { + "key": "INQR_STRT_DT", + "value": "20230101", + "description": "조회시작일자" + }, + { + "key": "INQR_END_DT", + "value": "20240301", + "description": "조회종료일자" + }, + { + "key": "SORT_DVSN", + "value": "00", + "description": "정렬구분\n00: 최근 순, 01: 과거 순, 02: 최근 순" + }, + { + "key": "INQR_DVSN", + "value": "00", + "description": "조회구분(00 입력)" + }, + { + "key": "CBLC_DVSN", + "value": "00", + "description": "잔고구분(00: 전체)" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_매도가능수량조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8408R", + "description": "[실전투자]\nTTTC8408R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/trading/inquire-psbl-sell?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=136480", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "trading", + "inquire-psbl-sell" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "136480", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 기본시세", + "item": [ + { + "name": "J_주식현재가 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01010100", + "description": "[실전투자/모의투자]\nFHKST01010100 : 주식현재가 시세", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 체결(최근30건)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": " application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": " Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": " {{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": " {{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": " FHKST01010300", + "description": "[실전투자/모의투자]\nFHKST01010300 : 주식현재가 체결", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-ccnl?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-ccnl" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 일자별", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01010400", + "description": "[실전투자/모의투자]\nFHKST01010400 : 주식현재가 일자별", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_period_div_code=D&fid_org_adj_prc=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간 분류 코드\nD : (일)최근 30거래일\nW : (주)최근 30주\nM : (월)최근 30개월" + }, + { + "key": "fid_org_adj_prc", + "value": "1", + "description": "수정주가 원주가 가격\n0 : 수정주가반영\n1 : 수정주가미반영\n* 수정주가는 액면분할/액면병합 등 권리 발생 시 과거 시세를 현재 주가에 맞게 보정한 가격" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 호가 예상체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01010200", + "description": "[실전투자/모의투자]\nFHKST01010200 : 주식현재가 호가 예상체결", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-asking-price-exp-ccn" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 투자자", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01010900", + "description": "[실전/모의투자]\nFHKST01010900 : 주식현재가 투자자", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-investor?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-investor" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 회원사", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01010600", + "description": "[실전/모의투자]\nFHKST01010600 : 주식현재가 회원사", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-member?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-member" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03010100", + "description": "[실전투자/모의투자]\nFHKST03010100", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-itemchartprice?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_input_date_1=20220101&fid_input_date_2=20220809&fid_period_div_code=D&fid_org_adj_prc=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-itemchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "fid_input_date_1", + "value": "20220101", + "description": "시작일자 (20220501)\n(한 번의 호출에 최대 100건의 데이터 수신, 다음 데이터를 받아오려면 OUTPUT 값의 가장 과거 일자의 1일 전 날짜를 FID_INPUT_DATE_2에 넣어 재호출)" + }, + { + "key": "fid_input_date_2", + "value": "20220809", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + }, + { + "key": "fid_org_adj_prc", + "value": "1", + "description": "수정주가 원주가 가격여부 (0:수정주가 1:원주가)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 당일시간대별체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01060000", + "description": "[실전투자/모의투자]\nFHPST01060000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "description": "P : 개인, B : 제휴사", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-time-itemconclusion?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_input_hour_1=115959", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-itemconclusion" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "fid_input_hour_1", + "value": "115959", + "description": "기준시간-이전체결처리 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 시간외 시간별체결", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02310000", + "description": "[실전투자/모의투자]\nFHPST02310000", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-time-overtimeconclusion?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_hour_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-overtimeconclusion" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "fid_hour_cls_code", + "value": "1", + "description": "시간구분코드 (1:시간외)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 시간외 일자별주가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02320000", + "description": "[실전투자/모의투자]\nFHPST02320000", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-overtimeprice?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-overtimeprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장분류코드 (J : 주식, ETF, ETN / W: ELW)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식당일분봉조회(주식)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03010200", + "description": "[모의투자/실전투자]\nFHKST03010100", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-time-itemchartprice?FID_ETC_CLS_CODE=&FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_INPUT_HOUR_1=093000&FID_PW_DATA_INCU_YN=Y", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-itemchartprice" + ], + "query": [ + { + "key": "FID_ETC_CLS_CODE", + "value": "", + "description": "기타 구분 코드(\"\")" + }, + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드(J: 주식, ETF, ETN / W: ELW / U: 업종)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "093000", + "description": "조회 시작일자(HHMMSS)\n조회대상(FID_COND_MRKT_DIV_CODE)에 따라 입력하는 값 상이\n\n종목(J)일 경우, 조회 시작일자(HHMMSS)\nex) \"123000\" 입력 시 12시 30분 이전부터 1분 간격으로 조회\n\n업종(U)일 경우, 조회간격(초) (60 or 120 만 입력 가능)\nex) \"60\" 입력 시 현재시간부터 1분간격으로 조회\n\"120\" 입력 시 현재시간부터 2분간격으로 조회" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거 데이터 포함 여부(Y/N)\n* 업종(U) 조회시에만 동작하는 구분값\nN : 당일데이터만 조회\nY : 이후데이터도 조회\n(조회시점이 083000(오전8:30)일 경우 전일자 업종 시세 데이터도 같이 조회됨)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식당일분봉조회(업종)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03010200", + "description": "[실전투자/모의투자]\nFHKST03010200", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice?FID_ETC_CLS_CODE=&FID_COND_MRKT_DIV_CODE=U&FID_INPUT_ISCD=2001&FID_INPUT_HOUR_1=60&FID_PW_DATA_INCU_YN=Y", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-indexchartprice" + ], + "query": [ + { + "key": "FID_ETC_CLS_CODE", + "value": "", + "description": "기타 구분 코드(\"\")" + }, + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "U", + "description": "시장 분류 코드(J : 주식, ETF, ETN U: 업종)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "2001", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "60", + "description": "조회 시작일자(HHMMSS)\n조회대상(FID_COND_MRKT_DIV_CODE)에 따라 입력하는 값 상이\n\n종목(J)일 경우, 조회 시작일자(HHMMSS)\nex) \"123000\" 입력 시 12시 30분 이전부터 1분 간격으로 조회\n\n업종(U)일 경우, 조회간격(초) (60 or 120 만 입력 가능)\nex) \"60\" 입력 시 현재시간부터 1분간격으로 조회\n\"120\" 입력 시 현재시간부터 2분간격으로 조회" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거 데이터 포함 여부(Y/N)\n* 업종(U) 조회시에만 동작하는 구분값\nN : 당일데이터만 조회\nY : 이후데이터도 조회\n(조회시점이 083000(오전8:30)일 경우 전일자 업종 시세 데이터도 같이 조회됨)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 시세2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01010000", + "description": "[실전투자]\nFHPST01010000 : 주식현재가 시세2", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-price-2?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-price-2" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ETF/ETN현재가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02400000", + "description": "[실전투자]\nFHPST02400000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/etfetn/v1/quotations/inquire-price?fid_cond_mrkt_div_code=J&fid_input_iscd=069500", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "etfetn", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "069500", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_NAV 비교추이(종목)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02440000", + "description": "[실전투자]\nFHPST02440000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/etfetn/v1/quotations/nav-comparison-trend?fid_cond_mrkt_div_code=J&fid_input_iscd=069500", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "etfetn", + "v1", + "quotations", + "nav-comparison-trend" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "069500", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_NAV 비교추이(분)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02440100", + "description": "[실전투자]\nFHPST02440100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/etfetn/v1/quotations/nav-comparison-time-trend?fid_cond_mrkt_div_code=E&fid_input_iscd=069500&fid_hour_cls_code=60", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "etfetn", + "v1", + "quotations", + "nav-comparison-time-trend" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "E", + "description": "시장 분류 코드 (E 입력)" + }, + { + "key": "fid_input_iscd", + "value": "069500", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_hour_cls_code", + "value": "60", + "description": "1분: 60, 3분:180 ... 120분:7200 입력" + } + ] + } + }, + "response": [] + }, + { + "name": "J_NAV 비교추이(일)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02440200", + "description": "[실전투자]\nFHPST02440200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/etfetn/v1/quotations/nav-comparison-daily-trend?fid_cond_mrkt_div_code=J&fid_input_iscd=069500&fid_input_date_1=20240101&fid_input_date_2=20240220", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "etfetn", + "v1", + "quotations", + "nav-comparison-daily-trend" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "069500", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_input_date_1", + "value": "20240101", + "description": "조회 시작일자 (ex. 20240501)" + }, + { + "key": "fid_input_date_2", + "value": "20240220", + "description": "조회 종료일자 (ex. 20240220)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 장마감 예상체결가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST117300C0", + "description": "[실전투자]\nFHKST117300C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/exp-closing-price?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=11173&fid_input_iscd=0001&fid_blng_cls_code=0&fid_rank_sort_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "exp-closing-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "11173", + "description": "화면 분류 코드(11173 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0001", + "description": "업종코드\n'0000':전체, '0001':코스피, '1001':코스닥, '2001':코스피200, '4001':KRX100" + }, + { + "key": "fid_blng_cls_code", + "value": "0", + "description": "소속 구분 코드" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n'0' 전체 '1' 상한가마감예상 '2' 하한가마감예상 '3' 직전대비상승률상위 '4' 직전대비하락률상위\n" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ETF 구성종목시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST121600C0", + "description": "[실전투자]\nFHKST121600C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/etfetn/v1/quotations/inquire-component-stock-price?fid_cond_mrkt_div_code=J&fid_input_iscd=069500&fid_cond_scr_div_code=11216", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "etfetn", + "v1", + "quotations", + "inquire-component-stock-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "069500", + "description": "종목코드(ex. 069500)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "11216", + "description": "화면 구분 코드(11216 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외현재가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02300000", + "description": "[실전투자]\nFHPST02300000 : 주식현재가 시간외현재가", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-overtime-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-overtime-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02300400", + "description": "[실전투자]\nFHPST02300400 : 주식현재가 시간외호가", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-overtime-asking-price?fid_cond_mrkt_div_code=J&fid_input_iscd=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-overtime-asking-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] ELW시세", + "item": [ + { + "name": "J_ELW현재가 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW15010000", + "description": "[실전/모의투자]\nFHKEW15010000 : ELW현재가 시세", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-elw-price?fid_cond_mrkt_div_code=W&fid_input_iscd=57H714", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-elw-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "W", + "description": "시장분류코드 (W : ELW)" + }, + { + "key": "fid_input_iscd", + "value": "57H714", + "description": "종목번호 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 상승률순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02770000", + "description": "[실전투자]\nFHPEW02770000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/ranking/updown-rate?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=20277&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD=00000&FID_INPUT_RMNN_DYNU_1=0&FID_DIV_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_INPUT_DATE_1=1&FID_RANK_SORT_CLS_CODE=0&FID_BLNG_CLS_CODE=0&FID_INPUT_DATE_2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "ranking", + "updown-rate" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20277" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "0" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "1" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 거래량순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02780000", + "description": "[실전투자]\nFHPEW02780000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=20278&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD=00000&FID_INPUT_RMNN_DYNU_1=0&FID_DIV_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_INPUT_DATE_1=&FID_RANK_SORT_CLS_CODE=0&FID_BLNG_CLS_CODE=0&FID_INPUT_ISCD_2=0000&FID_INPUT_DATE_2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20278" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "0" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "0000" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 지표순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02790000", + "description": "[실전투자]\nFHPEW02790000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=20279&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD=00000&FID_DIV_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_RANK_SORT_CLS_CODE=0&FID_BLNG_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20279" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 민감도순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02850000", + "description": "[실전투자]\nFHPEW02850000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=20285&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD=00000&FID_INPUT_RMNN_DYNU_1=0&FID_DIV_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_RANK_SORT_CLS_CODE=0&FID_INPUT_RMNN_DYNU_1=&FID_INPUT_DATE_1=&FID_BLNG_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20285" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "0" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 당일급변종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02870000", + "description": "[실전투자]\nFHPEW02870000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-price?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=20287&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD=00000&FID_MRKT_CLS_CODE=A&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_HOUR_CLS_CODE=1&FID_INPUT_HOUR_1=0&FID_INPUT_HOUR_2=&FID_RANK_SORT_CLS_CODE=1&FID_BLNG_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20287" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000" + }, + { + "key": "FID_MRKT_CLS_CODE", + "value": "A" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "" + }, + { + "key": "FID_HOUR_CLS_CODE", + "value": "1" + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "0" + }, + { + "key": "FID_INPUT_HOUR_2", + "value": "" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "1" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 신규상장종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW154800C0", + "description": "[실전투자]\nFHKEW154800C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/newly-listed?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=11548&FID_DIV_CLS_CODE=02&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD_2=00003&FID_INPUT_DATE_1=20240410&FID_BLNG_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "newly-listed" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11548" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "02" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "00003" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240410" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 투자지표추이(체결)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02740100", + "description": "[실전투자]\nFHPEW02740100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/indicator-trend-ccnl?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "indicator-trend-ccnl" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 투자지표추이(분별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02740300", + "description": "[실전투자]\nFHPEW02740300", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/indicator-trend-minute?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61&FID_HOUR_CLS_CODE=60&FID_PW_DATA_INCU_YN=Y", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "indicator-trend-minute" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + }, + { + "key": "FID_HOUR_CLS_CODE", + "value": "60", + "description": "시간구분코드 : 60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분), 7200(60분)" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거데이터 포함 여부 : N(과거데이터포함X),Y(과거데이터포함O)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 투자지표추이(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02740200", + "description": "[실전투자]\nFHPEW02740200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/indicator-trend-daily?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57K281", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "indicator-trend-daily" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57K281", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 변동성추이(틱)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02840400", + "description": "[실전투자]\nFHPEW02840400", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/volatility-trend-tick?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57K281", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "volatility-trend-tick" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57K281", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 변동성 추이(체결)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02840100", + "description": "[실전투자]\nFHPEW02840100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/volatility-trend-ccnl?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57K281", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "volatility-trend-ccnl" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57K281" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 변동성 추이(분별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02840300", + "description": "[실전투자]\nFHPEW02840300", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/volatility-trend-minute?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61&FID_HOUR_CLS_CODE=60&FID_PW_DATA_INCU_YN=N", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "volatility-trend-minute" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + }, + { + "key": "FID_HOUR_CLS_CODE", + "value": "60", + "description": "시간구분코드\n60(1분), 180(3분), 300(5분), 600(10분), 1800(30분), 3600(60분)" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "N", + "description": "과거데이터 포함 여부\nN(과거데이터포함X),Y(과거데이터포함O)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 변동성추이(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02840200", + "description": "[실전투자]\nFHPEW02840200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/indicator-trend-minute?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "indicator-trend-minute" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 민감도 추이(체결)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02830100", + "description": "[실전투자]\nFHPEW02830100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/sensitivity-trend-ccnl?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "sensitivity-trend-ccnl" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 민감도 추이(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW02830200", + "description": "[실전투자]\nFHPEW02830200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/sensitivity-trend-daily?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57JS61", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "sensitivity-trend-daily" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57JS61", + "description": "종목코드 \nex) 58J297(KBJ297삼성전자콜)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 기초자산별 종목시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW154101C0", + "description": "[실전투자]\nFHKEW154101C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/volatility-trend-daily?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=11541&FID_MRKT_CLS_CODE=A&FID_INPUT_ISCD=00000&FID_UNAS_INPUT_ISCD=005930&FID_VOL_CNT=&FID_TRGT_EXLS_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=&FID_INPUT_VOL_2=&FID_INPUT_RMNN_DYNU_1=&FID_INPUT_RMNN_DYNU_2=&FID_OPTION=0&FID_INPUT_OPTION_1=&FID_INPUT_OPTION_2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "volatility-trend-daily" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장 분류 코드 (W 입력)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11541", + "description": "화면분류코드(11541 입력)" + }, + { + "key": "FID_MRKT_CLS_CODE", + "value": "A", + "description": "시장구분코드: 전체(A),콜(C),풋(P)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000", + "description": "발행회사(전체:00000)" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "005930", + "description": "기초자산입력종목코드(ex. 005930)" + }, + { + "key": "FID_VOL_CNT", + "value": "", + "description": "거래량수 : 전일거래량(정수량미만)" + }, + { + "key": "FID_TRGT_EXLS_CLS_CODE", + "value": "0", + "description": "대상제외구분코드\n거래불가종목제외(0:미체크,1:체크)" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "", + "description": "가격~원이상" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "", + "description": "가격~월이하" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "", + "description": "거래량~계약이상" + }, + { + "key": "FID_INPUT_VOL_2", + "value": "", + "description": "거래량~계약이하" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "", + "description": "잔존일(~일이상)" + }, + { + "key": "FID_INPUT_RMNN_DYNU_2", + "value": "", + "description": "잔존일(~일이하)" + }, + { + "key": "FID_OPTION", + "value": "0", + "description": "옵션상태(0:없음,1:ATM,2:ITM,3:OTM)" + }, + { + "key": "FID_INPUT_OPTION_1", + "value": "", + "description": "공백 입력" + }, + { + "key": "FID_INPUT_OPTION_2", + "value": "", + "description": "공백 입력" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW LP매매추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPEW03760000", + "description": "[실전투자]\nFHPEW03760000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/lp-trade-trend?FID_COND_MRKT_DIV_CODE=W&FID_INPUT_ISCD=57K281", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "lp-trade-trend" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장구분(W 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "57K281", + "description": "종목코드(ex. 57K281)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 비교대상종목조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW151701C0", + "description": "[실전투자]\nFHKEW151701C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/compare-stocks?FID_COND_SCR_DIV_CODE=11517&FID_INPUT_ISCD=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "compare-stocks" + ], + "query": [ + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11517", + "description": "시장구분(11517 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "기초자산 종목코드(ex. 005930)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 종목검색", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW15100000", + "description": "[실전투자]\nFHKEW15100000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/cond-search?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=11510&FID_RANK_SORT_CLS_CODE=0&FID_INPUT_CNT_1=1&FID_RANK_SORT_CLS_CODE_2=&FID_INPUT_CNT_2=&FID_RANK_SORT_CLS_CODE_3=&FID_INPUT_CNT_3=&FID_TRGT_CLS_CODE=&FID_INPUT_ISCD=&FID_UNAS_INPUT_ISCD=&FID_MRKT_CLS_CODE=&FID_INPUT_DATE_1=&FID_INPUT_DATE_2=&FID_INPUT_ISCD_2=&FID_ETC_CLS_CODE=&FID_INPUT_RMNN_DYNU_1=&FID_INPUT_RMNN_DYNU_2=&FID_PRPR_CNT1=&FID_PRPR_CNT2=&FID_RSFL_RATE1=&FID_RSFL_RATE2=&FID_VOL1=&FID_VOL2=&FID_APLY_RANG_PRC_1=&FID_APLY_RANG_PRC_2=&FID_LVRG_VAL1=&FID_LVRG_VAL2=&FID_VOL3=&FID_VOL4=&FID_INTS_VLTL1=&FID_INTS_VLTL2=&FID_PRMM_VAL1=&FID_PRMM_VAL2=&FID_GEAR1=&FID_GEAR2=&FID_PRLS_QRYR_RATE1=&FID_PRLS_QRYR_RATE2=&FID_DELTA1=&FID_DELTA2=&FID_ACPR1=&FID_ACPR2=&FID_STCK_CNVR_RATE1=&FID_STCK_CNVR_RATE2=&FID_DIV_CLS_CODE=&FID_PRIT1=&FID_PRIT2=&FID_CFP1=&FID_CFP2=&FID_INPUT_NMIX_PRICE_1=&FID_INPUT_NMIX_PRICE_2=&FID_EGEA_VAL1=&FID_EGEA_VAL2=&FID_INPUT_DVDN_ERT=&FID_INPUT_HIST_VLTL=&FID_THETA1=&FID_THETA2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "cond-search" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장분류코드(W 입력) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11510", + "description": "화면분류코드(11510 입력)" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위정렬구분코드 - 정렬1정렬안함(0)종목코드(1)현재가(2)대비율(3)거래량(4)행사가격(5)\n전환비율(6)상장일(7)만기일(8)잔존일수(9)레버리지(10)" + }, + { + "key": "FID_INPUT_CNT_1", + "value": "1", + "description": "입력수1 - 정렬1기준상위(1)하위(2)" + }, + { + "key": "FID_RANK_SORT_CLS_CODE_2", + "value": "", + "description": "순위정렬구분코드2" + }, + { + "key": "FID_INPUT_CNT_2", + "value": "", + "description": "입력수2" + }, + { + "key": "FID_RANK_SORT_CLS_CODE_3", + "value": "", + "description": "순위정렬구분코드3" + }, + { + "key": "FID_INPUT_CNT_3", + "value": "", + "description": "입력수3" + }, + { + "key": "FID_TRGT_CLS_CODE", + "value": "", + "description": "대상구분코드 - 0:발행회사종목코드,1:기초자산종목코드,2:FID시장구분코드,3:FID입력날짜1(상장일),\n4:FID입력날짜2(만기일),5:LP회원사종목코드,6:행사가기초자산비교>=(1)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "", + "description": "입력종목코드 - 발행사종목코드전체(00000)" + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "", + "description": "기초자산입력종목코드" + }, + { + "key": "FID_MRKT_CLS_CODE", + "value": "", + "description": "시장구분코드 - 권리유형전체(A)콜(CO)풋(PO)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "", + "description": "입력날짜1 - 상장일전체(0)금일(1)7일이하(2)8~30일(3)31~90일(4)" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "", + "description": "입력날짜2 - 만기일전체(0)1개월(1)1~2(2)2~3(3)3~6(4)6~9(5)9~12(6)12이상(7)" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "", + "description": "입력종목코드2" + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "", + "description": "기타구분코드 - 행사가전체(0)>=(1)" + }, + { + "key": "FID_INPUT_RMNN_DYNU_1", + "value": "", + "description": "잔존일이상" + }, + { + "key": "FID_INPUT_RMNN_DYNU_2", + "value": "", + "description": "잔존일이하" + }, + { + "key": "FID_PRPR_CNT1", + "value": "", + "description": "현재가이상" + }, + { + "key": "FID_PRPR_CNT2", + "value": "", + "description": "현재가이하" + }, + { + "key": "FID_RSFL_RATE1", + "value": "", + "description": "전일대비율이상" + }, + { + "key": "FID_RSFL_RATE2", + "value": "", + "description": "전일대비율이하" + }, + { + "key": "FID_VOL1", + "value": "", + "description": "거래량이상" + }, + { + "key": "FID_VOL2", + "value": "", + "description": "거래량이하" + }, + { + "key": "FID_APLY_RANG_PRC_1", + "value": "", + "description": "적용범위가격1 - 최종거래일from" + }, + { + "key": "FID_APLY_RANG_PRC_2", + "value": "", + "description": "적용범위가격2 - 최종거래일to" + }, + { + "key": "FID_LVRG_VAL1", + "value": "", + "description": "레버리지값1" + }, + { + "key": "FID_LVRG_VAL2", + "value": "", + "description": "레버리지값2" + }, + { + "key": "FID_VOL3", + "value": "", + "description": "거래량3 - LP종료일from" + }, + { + "key": "FID_VOL4", + "value": "", + "description": "거래량4 - LP종료일to" + }, + { + "key": "FID_INTS_VLTL1", + "value": "", + "description": "내재변동성이상" + }, + { + "key": "FID_INTS_VLTL2", + "value": "", + "description": "내재변동성이하" + }, + { + "key": "FID_PRMM_VAL1", + "value": "", + "description": "프리미엄이상" + }, + { + "key": "FID_PRMM_VAL2", + "value": "", + "description": "프리미엄이하" + }, + { + "key": "FID_GEAR1", + "value": "", + "description": "기어링이상" + }, + { + "key": "FID_GEAR2", + "value": "", + "description": "기어링이하" + }, + { + "key": "FID_PRLS_QRYR_RATE1", + "value": "", + "description": "손익분기이상" + }, + { + "key": "FID_PRLS_QRYR_RATE2", + "value": "", + "description": "손익분기이하" + }, + { + "key": "FID_DELTA1", + "value": "", + "description": "델타이상" + }, + { + "key": "FID_DELTA2", + "value": "", + "description": "델타이하" + }, + { + "key": "FID_ACPR1", + "value": "", + "description": "행사가이상 " + }, + { + "key": "FID_ACPR2", + "value": "", + "description": "행사가이 " + }, + { + "key": "FID_STCK_CNVR_RATE1", + "value": "", + "description": "전환비율이상" + }, + { + "key": "FID_STCK_CNVR_RATE2", + "value": "", + "description": "전환비율이하" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "", + "description": "분류구분코드 - 0:전체,1:일반,2:조기종료" + }, + { + "key": "FID_PRIT1", + "value": "", + "description": "패리티이상" + }, + { + "key": "FID_PRIT2", + "value": "", + "description": "패리티이하" + }, + { + "key": "FID_CFP1", + "value": "", + "description": "배리어이상" + }, + { + "key": "FID_CFP2", + "value": "", + "description": "배리어이하" + }, + { + "key": "FID_INPUT_NMIX_PRICE_1", + "value": "", + "description": "LP보유비율이상" + }, + { + "key": "FID_INPUT_NMIX_PRICE_2", + "value": "", + "description": "LP보유비율이하" + }, + { + "key": "FID_EGEA_VAL1", + "value": "", + "description": "접근도이상" + }, + { + "key": "FID_EGEA_VAL2", + "value": "", + "description": "접근도이하" + }, + { + "key": "FID_INPUT_DVDN_ERT", + "value": "", + "description": "손익분기점이상" + }, + { + "key": "FID_INPUT_HIST_VLTL", + "value": "", + "description": "손익분기점이하" + }, + { + "key": "FID_THETA1", + "value": "", + "description": "MONEYNESS이상" + }, + { + "key": "FID_THETA2", + "value": "", + "description": "MONEYNESS이하" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 기초자산 목록조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW154100C0", + "description": "[실전투자]\nFHKEW154100C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/udrl-asset-list?FID_COND_SCR_DIV_CODE=11541&FID_RANK_SORT_CLS_CODE=0&FID_INPUT_ISCD=00000", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "udrl-asset-list" + ], + "query": [ + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11541", + "description": "화면분류코드(11541 입력) " + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위정렬구분코드 - 0(종목명순), 1(콜발행종목순), 2(풋발행종목순), 3(전일대비 상승율순), 4(전일대비 하락율순), 5(현재가 크기순), 6(종목코드순)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "00000", + "description": "발행사코드 - 00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_ELW 만기예정/만기종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKEW154700C0", + "description": "[실전투자]\nFHKEW154700C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/elw/v1/quotations/expiration-stocks?FID_COND_MRKT_DIV_CODE=W&FID_COND_SCR_DIV_CODE=11547&FID_INPUT_DATE_1=20240624&FID_INPUT_DATE_2=20240930&FID_DIV_CLS_CODE=2&FID_ETC_CLS_CODE=&FID_UNAS_INPUT_ISCD=000000&FID_INPUT_ISCD_2=00000&FID_BLNG_CLS_CODE=0&FID_INPUT_OPTION_1=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "elw", + "v1", + "quotations", + "expiration-stocks" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "W", + "description": "시장분류코드(W 입력)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11547", + "description": "화면분류코드(11547 입력) " + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240624", + "description": "입력날짜 ~ (ex) 20240402)" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240930", + "description": "~입력날짜 (ex) 20240408)2001" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "2", + "description": "분류구분코드 - 0(콜),1(풋),2(전체)" + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "", + "description": "기타구분코드(공백 입력) " + }, + { + "key": "FID_UNAS_INPUT_ISCD", + "value": "000000", + "description": "기초자산입력종목코드 - 000000(전체), 2001(KOSPI 200), 기초자산코드(삼성전자-005930)" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "00000", + "description": "발행회사코드 - 00000(전체), 00003(한국투자증권), 00017(KB증권), 00005(미래에셋증권)" + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0", + "description": "결제방법 - 0(전체),1(일반),2(조기종료)" + }, + { + "key": "FID_INPUT_OPTION_1", + "value": "", + "description": "입력옵션1(공백 입력) " + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 업종/기타", + "item": [ + { + "name": "J_국내주식업종기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKUP03500100", + "description": "[실전투자/모의투자]\nFHKUP03500100", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-indexchartprice?fid_cond_mrkt_div_code=U&fid_input_iscd=0001&fid_input_date_1=20210101&fid_input_date_2=20220722&fid_period_div_code=D", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-indexchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "U", + "description": "시장 분류 코드 (U : 업종)" + }, + { + "key": "fid_input_iscd", + "value": "0001", + "description": "0001 : 종합\n0002 : 대형주\n...\n포탈 (FAQ : 종목정보 다운로드 - 업종코드 참조)" + }, + { + "key": "fid_input_date_1", + "value": "20210101", + "description": "시작일자 (20220501)\n(한 번의 호출에 최대 50건의 데이터 수신, 다음 데이터를 받아오려면 OUTPUT 값의 가장 과거 일자의 1일 전 날짜를 FID_INPUT_DATE_2에 넣어 재호출)" + }, + { + "key": "fid_input_date_2", + "value": "20220722", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내휴장일조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTCA0903R", + "description": "[실전투자]\nCTCA0903R", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/chk-holiday?BASS_DT=20230302&CTX_AREA_NK=&CTX_AREA_FK=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "chk-holiday" + ], + "query": [ + { + "key": "BASS_DT", + "value": "20230302", + "description": "기준일자(YYYYMMDD)" + }, + { + "key": "CTX_AREA_NK", + "value": "", + "description": "연속조회(공백으로 입력)" + }, + { + "key": "CTX_AREA_FK", + "value": "", + "description": "연속조회검색조건(공백으로 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_업종분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKUP03500200", + "description": "[실전투자/모의투자]\nFHKUP03500200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "description": "P : 개인", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-time-indexchartprice?FID_COND_MRKT_DIV_CODE=U&FID_INPUT_ISCD=1001&FID_INPUT_HOUR_1=120&FID_PW_DATA_INCU_YN=Y&FID_ETC_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-time-indexchartprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "U", + "description": "시장 분류 코드(U)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "1001", + "description": "종목코드 (0001 : 종합, 1001:코스닥종합) " + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "120", + "description": "입력 시간(초)\nex) 30: 30초, 60: 1분, \n 600:10분, 3600:1시간" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거 데이터 포함 여부\nY (과거) / N (당일)" + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "0", + "description": "기타 구분 코드\n0:기본, 1:장마감, 시간외 제외" + } + ] + } + }, + "response": [] + }, + { + "name": "J_변동성완화장치(VI) 현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01390000", + "description": "[실전투자]\nFHPST01390000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-vi-status?fid_cond_scr_div_code=20139&fid_mrkt_cls_code=0&fid_input_iscd=&fid_rank_sort_cls_code=0&fid_input_date_1=20200420&fid_trgt_cls_code=&fid_trgt_exls_cls_code=&fid_div_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-vi-status" + ], + "query": [ + { + "key": "fid_cond_scr_div_code", + "value": "20139", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_mrkt_cls_code", + "value": "0", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_input_iscd", + "value": "" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0" + }, + { + "key": "fid_input_date_1", + "value": "20200420" + }, + { + "key": "fid_trgt_cls_code", + "value": "" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "" + }, + { + "key": "fid_div_cls_code", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내업종 시간별지수(초)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPUP02110100", + "description": "[실전투자]\nFHPUP02110100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-index-tickprice?fid_cond_mrkt_div_code=U&fid_input_iscd=1001", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-index-tickprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "U", + "description": "시장 분류 코드 (U :업종)" + }, + { + "key": "fid_input_iscd", + "value": "1001", + "description": "종목코드 (4자리)\n코스피(1001)\n코스닥(2001)\n코스피200(1029)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내업종 시간별지수(분)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPUP02110200", + "description": "[실전투자/모의투자]\nFHKST01010100 : 주식현재가 시세", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-index-timeprice?fid_cond_mrkt_div_code=U&fid_input_iscd=1001&fid_input_hour_1=120", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-index-timeprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "U", + "description": "시장 분류 코드 (U :업종)" + }, + { + "key": "fid_input_iscd", + "value": "1001", + "description": "종목코드 (4자리)\n코스피(1001)\n코스닥(2001)\n코스피200(1029)" + }, + { + "key": "fid_input_hour_1", + "value": "120", + "description": "입력 시간1(초단위, 60:1분, 300:5분, 600:10분,...)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 예상체결지수 추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01840000", + "description": "[실전투자]\nFHPST01840000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/exp-index-trend?fid_cond_mrkt_div_code=U&fid_input_iscd=0001&fid_input_hour_1=&fid_mkop_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "exp-index-trend" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "U", + "description": "시장구분코드 (U: 업종)" + }, + { + "key": "fid_input_iscd", + "value": "0001", + "description": "업종코드\n'0001':코스피, '1001':코스닥, '2001':코스피200, '3003':코스닥150, '4001':KRX100" + }, + { + "key": "fid_input_hour_1", + "value": "", + "description": "입력 시간(공란)" + }, + { + "key": "fid_mkop_cls_code", + "value": "1", + "description": "장운영 구분 코드(1: 장시작전, 2: 장마감)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_금리 종합(국내채권/금리)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST07020000", + "description": "[실전투자]\nFHPST07020000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/comp-interest?FID_COND_MRKT_DIV_CODE=I&FID_COND_SCR_DIV_CODE=20702&FID_DIV_CLS_CODE=1&FID_DIV_CLS_CODE1=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "comp-interest" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "I", + "description": "시장 분류 코드 (I 입력) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20702", + "description": "화면 분류 코드(20702 입력)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "1", + "description": "분류구분코드(1 입력)" + }, + { + "key": "FID_DIV_CLS_CODE1", + "value": "", + "description": "분류구분코드1(공백 입력) " + } + ] + } + }, + "response": [] + }, + { + "name": "J_종합 시황/공시(제목)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01011800", + "description": "[실전투자]\nFHKST01011800", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/news-title?FID_NEWS_OFER_ENTP_CODE=&FID_COND_MRKT_CLS_CODE=&FID_INPUT_ISCD=&FID_TITL_CNTT=&FID_INPUT_DATE_1=&FID_INPUT_HOUR_1=&FID_RANK_SORT_CLS_CODE=&FID_INPUT_SRNO=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "news-title" + ], + "query": [ + { + "key": "FID_NEWS_OFER_ENTP_CODE", + "value": "", + "description": "뉴스 제공 업체 코드(공백 입력)" + }, + { + "key": "FID_COND_MRKT_CLS_CODE", + "value": "", + "description": "조건 시장 구분 코드(공백 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "", + "description": "종목코드(공백: 전체, 종목코드 : 해당코드가 등록된 뉴스)" + }, + { + "key": "FID_TITL_CNTT", + "value": "", + "description": "제목 내용(공백 입력)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "", + "description": "입력 날짜(공백: 현재기준, 조회일자(ex 00YYYYMMDD))" + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "", + "description": "입력 시간(공백: 현재기준, 조회시간(ex 0000HHMMSS))" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "", + "description": "순위 정렬 구분 코드(공백 입력)" + }, + { + "key": "FID_INPUT_SRNO", + "value": "", + "description": "입력 일련번호(공백 입력)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 종목정보", + "item": [ + { + "name": "J_상품기본조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)\n\n※ 토큰 지정시 토큰 타입(\"Bearer\") 지정 필요. 즉, 발급받은 접근토큰 앞에 앞에 \"Bearer\" 붙여서 호출\nEX) \"Bearer eyJ..........8GA\"", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF1604R", + "description": "[실전투자]\nCTPF1604R", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/search-info?PDNO=005930&PRDT_TYPE_CD=300", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "search-info" + ], + "query": [ + { + "key": "PDNO", + "value": "005930", + "description": "상품번호\n주식(하이닉스) : 000660 (코드 : 300)\n선물(101S12) : KR4101SC0009 (코드 : 301)\n미국(AAPL) : AAPL (코드 : 512)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "300", + "description": "상품유형코드\n300 주식\n301 선물옵션\n302 채권\n512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스\n515 일본\n501 홍콩 / 543 홍콩CNY / 558 홍콩USD\n507 베트남 하노이 / 508 베트남 호치민\n551 중국 상해A / 552 중국 심천A" + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식기본조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF1002R", + "description": "[실전투자]\nCTOS5011R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/search-stock-info?PDNO=005930&PRDT_TYPE_CD=300", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "search-stock-info" + ], + "query": [ + { + "key": "PDNO", + "value": "005930", + "description": "종목번호 (6자리)\nETN의 경우, Q로 시작 (EX. Q500001)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "300", + "description": "상품유형코드\n300 : 주식\n301 : 선물옵션\n302 : 채권\n306 : ELS" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 대차대조표", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430100", + "description": "[실전투자]\nFHKST66430100 : 국내주식 대차대조표", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/balance-sheet?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "balance-sheet" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 손익계산서", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430200", + "description": "[실전투자]\nFHKST66430200 : 국내주식 손익계산", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/income-statement?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "income-statement" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 재무비율", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430300", + "description": "[실전투자]\nFHKST66430300 : 국내주식 재무비", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/financial-ratio?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "financial-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 수익성비율", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430400", + "description": "[실전투자]\nFHKST66430400 : 국내주식 수익성비율", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/profit-ratio?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "profit-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 기타주요비율", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430500", + "description": "[실전투자]\nFHKST66430500 : 국내주식 기타주요비율", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/other-major-ratios?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "other-major-ratios" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 안정성비율", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430600", + "description": "[실전투자]\nFHKST66430600 : 국내주식 안정성비율", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/stability-ratio?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "stability-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 성장성비율", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST66430800", + "description": "[실전투자]\nFHKST66430800 : 국내주식 성장성비율", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/finance/growth-ratio?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_div_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "finance", + "growth-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_div_cls_code", + "value": "1", + "description": "분류 구분 코드 (0:연말, 1:분기)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 당사 신용가능종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04770000", + "description": "[실전투자]\nFHPST04770000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/credit-by-company?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20477&fid_input_iscd=0000&fid_slct_yn=0&fid_rank_sort_cls_code=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "credit-by-company" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20477", + "description": "화면 분류 코드 (20477입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_slct_yn", + "value": "0", + "description": "선택 여부(0:신용주문가능, 1: 신용주문불가)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "1", + "description": "순위 정렬 구분 코드(0:코드순, 1:이름순)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(배당일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669102C0", + "description": "[실전투자]\nHHKDB669102C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/dividend?cts=&gb1=0&f_dt=20230301&t_dt=20240326&sht_cd=&high_gb=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "dividend" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "gb1", + "value": "0", + "description": "조회구분(0:배당전체, 1:결산배당, 2:중간배당)" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + }, + { + "key": "high_gb", + "value": "", + "description": "공란 입력" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(주식매수청구일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669103C0", + "description": "[실전투자]\nHHKDB669103C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/purreq?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "purreq" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(합병/분할일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669104C0", + "description": "[실전투자]\nHHKDB669104C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/merger-split?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "merger-split" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(액면교체일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669105C0", + "description": "[실전투자]\nHHKDB669105C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/rev-split?cts=&f_dt=20230301&t_dt=20240326&sht_cd=&market_gb=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "rev-split" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + }, + { + "key": "market_gb", + "value": "1", + "description": "시장구분(1 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(자본감소일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669106C0", + "description": "[실전투자]\nHHKDB669106C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/cap-dcrs?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "cap-dcrs" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체조회)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(상장정보일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669107C0", + "description": "[실전투자]\nHHKDB669107C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/list-info?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "list-info" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(공모주청약일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669108C0", + "description": "[실전투자]\nHHKDB669108C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/traded-by-company?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "traded-by-company" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(실권주일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669109C0", + "description": "[실전투자]\nHHKDB669109C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/traded-by-company?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "traded-by-company" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(의무예치일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669110C0", + "description": "[실전투자]\nHHKDB669110C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/traded-by-company?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "traded-by-company" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(유상증자일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669100C0", + "description": "[실전투자]\nHHKDB669100C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/paidin-capin?cts=&gb1=1&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "paidin-capin" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "gb1", + "value": "1", + "description": "조회구분(1':청약일별, '2':기준일별)" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(무상증자일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669101C0", + "description": "[실전투자]\nHHKDB669101C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/bonus-issue?cts=&f_dt=20230301&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "bonus-issue" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20230301", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_예탁원정보(주주총회일정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB669111C0", + "description": "[실전투자]\nHHKDB669111C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ksdinfo/sharehld-meet?cts=&f_dt=20200101&t_dt=20240326&sht_cd=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ksdinfo", + "sharehld-meet" + ], + "query": [ + { + "key": "cts", + "value": "", + "description": "공란 입력" + }, + { + "key": "f_dt", + "value": "20200101", + "description": "조회일자From" + }, + { + "key": "t_dt", + "value": "20240326", + "description": "조회일자To" + }, + { + "key": "sht_cd", + "value": "", + "description": "종목코드(공란입력시, 전체)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 종목추정실적", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKST668300C0", + "description": "[실전투자]\nHHKST668300C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/estimate-perform?SHT_CD=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "estimate-perform" + ], + "query": [ + { + "key": "SHT_CD", + "value": "005930", + "description": "종목코드(ex. 005930)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_당사 대주가능 종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC2702R", + "description": "[실전투자]\nCTSC2702R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/lendable-by-company?EXCG_DVSN_CD=00&PDNO=&THCO_STLN_PSBL_YN=Y&INQR_DVSN_1=0&CTX_AREA_FK200=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "lendable-by-company" + ], + "query": [ + { + "key": "EXCG_DVSN_CD", + "value": "00", + "description": "거래소구분코드 - 00(전체), 02(거래소), 03(코스닥)" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(ex. 005930)" + }, + { + "key": "THCO_STLN_PSBL_YN", + "value": "Y", + "description": "당사대주가능여부(Y/N)" + }, + { + "key": "INQR_DVSN_1", + "value": "0", + "description": "조회구분1(0 입력)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 증권사별 투자의견", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST663400C0", + "description": "[실전투자]\nFHKST663400C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/invest-opbysec?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=16633&FID_INPUT_ISCD=999&FID_DIV_CLS_CODE=0&FID_INPUT_DATE_1=20240428&FID_INPUT_DATE_2=20240728", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "invest-opbysec" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장분류코드(J 입력) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "16633", + "description": "화면분류코드(16634 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "999", + "description": "회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0", + "description": "분류구분코드 - 전체(0) 매수(1) 중립(2) 매도(3)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240428", + "description": "입력날짜1 이후 ~" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240728", + "description": "입력날짜2 ~ 이전" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 종목투자의견", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST663300C0", + "description": "[실전투자]\nFHKST663300C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/invest-opinion?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=16633&FID_INPUT_ISCD=005930&FID_INPUT_DATE_1=20240101&FID_INPUT_DATE_2=20240501", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "invest-opinion" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장분류코드(J 입력) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "16633", + "description": "화면분류코드(16633 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex) 005930(삼성전자))" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240101", + "description": "이후 ~(ex) 20240101)" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240501", + "description": "~ 이전(ex) 20240501)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 시세분석", + "item": [ + { + "name": "J_국내기관_외국인 매매종목가집계", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPTJ04400000", + "description": "[실전투자]\nFHPTJ04400000", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/foreign-institution-total?FID_COND_MRKT_DIV_CODE=V&FID_COND_SCR_DIV_CODE=16449&FID_INPUT_ISCD=0000&FID_DIV_CLS_CODE=0&FID_RANK_SORT_CLS_CODE=0&FID_ETC_CLS_CODE=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "foreign-institution-total" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "V", + "description": "시장 분류 코드\n\"V\"(Default)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "16449", + "description": "조건 화면 분류 코드\n\"16449\"(Default)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0000", + "description": "입력 종목코드\n0000:전체, 0001:코스피, 1001:코스닥 \n포탈 (FAQ : 종목정보 다운로드 - 업종코드 참조)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0", + "description": "분류 구분 코드\n0:수량정렬 1:금액정렬 " + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위 정렬 구분 코드\n0:순매수상위 1:순매도상위 " + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "0", + "description": "기타 구분 정렬\n0:전체 1:외국인 2:기관계 3:기타 " + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목조건검색 목록조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKST03900300", + "description": "[실전투자]\nHHKST03900300", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/psearch-title?user_id=abc1234", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "psearch-title" + ], + "query": [ + { + "key": "user_id", + "value": "abc1234", + "description": "사용자 HTS ID" + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목조건검색조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKST03900400", + "description": "[실전투자]\nHHKST03900400", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/psearch-result?user_id=abc1234&seq=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "psearch-result" + ], + "query": [ + { + "key": "user_id", + "value": "abc1234", + "description": "사용자 HTS ID" + }, + { + "key": "seq", + "value": "0", + "description": "종목조건검색 목록조회 API의 output인 'seq'을 이용(0 부터 시작)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목별프로그램매매추이(체결)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPPG04650100", + "description": "[실전투자]\nFHPPG04650100", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/program-trade-by-stock?FID_INPUT_ISCD=136480", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "program-trade-by-stock" + ], + "query": [ + { + "key": "FID_INPUT_ISCD", + "value": "136480", + "description": "종목코드 (6자리) " + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목별 프로그램매매추이(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPPG04650200", + "description": "[실전투자]\nFHPPG04650200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/program-trade-by-stock-daily?FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_INPUT_DATE_1=20240624", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "program-trade-by-stock-daily" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장구분코드(J: 주식)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240624", + "description": "기준일(ex. 20240624)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목별 외인기관 추정가집계", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHPTJ04160200", + "description": "[실전투자/모의투자]\nFHPST01710000: 거래량순위", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/investor-trend-estimate?MKSC_SHRN_ISCD=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "investor-trend-estimate" + ], + "query": [ + { + "key": "MKSC_SHRN_ISCD", + "value": "005930", + "description": "종목코드 (6자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목별일별매수매도체결량", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03010800", + "description": "[실전투자]\nFHKST03010800", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-daily-trade-volume?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_input_date_1=20200101&fid_input_date_2=20240126&fid_period_div_code=D", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-daily-trade-volume" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식, ETF, ETN)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (6자리)" + }, + { + "key": "fid_input_date_1", + "value": "20200101", + "description": "시작일자 (YYYYMMDD)" + }, + { + "key": "fid_input_date_2", + "value": "20240126", + "description": "종료일자 (YYYYMMDD)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일, W:주, M:월, Y:년)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_시장별 투자자매매동향(시세)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPTJ04030000", + "description": "[실전투자]\nFHPTJ04030000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-investor-time-by-market?FID_INPUT_ISCD=999&FID_INPUT_ISCD_2=S001", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-investor-time-by-market" + ], + "query": [ + { + "key": "FID_INPUT_ISCD", + "value": "999", + "description": "시장구분\n코스피: KSP, 코스닥:KSQ,\n선물,콜옵션,풋옵션 : K2I, 주식선물:999,\nETF: ETF, ELW:ELW, ETN: ETN,\n미니: MKI, 위클리월 : WKM, 위클리목: WKI\n코스닥150: KQI" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "S001", + "description": "업종구분\n- fid_input_iscd: KSP(코스피) 혹은 KSQ(코스닥)인 경우\n코스피(0001_종합, .…0027_제조업 )\n코스닥(1001_종합, …. 1041_IT부품)\n...\n포탈 (FAQ : 종목정보 다운로드(국내) - 업종코드 참조)\n\n- fid_input_iscd가 K2I인 경우F001(선물)\nOC01(콜옵션)\nOP01(풋옵션)\n\n- fid_input_iscd가 999인 경우S001(주식선물)\n\n- fid_input_iscd가 ETF인 경우T000(ETF)\n\n- fid_input_iscd가 ELW인 경우W000(ELW)\n\n- fid_input_iscd가 ETN인 경우E199(ETN)\n\n- fid_input_iscd가 MKI인 경우F004(미니선물)\nOC02(미니콜옵션)\nOP02(미니풋옵션)\n\n- fid_input_iscd가 WKM인 경우OC05(위클리콜(월))\nOP05(위클리풋(월))\n\n- fid_input_iscd가 WKI인 경우OC04(위클리콜(목))\nOP04(위클리풋(목))\n\n- fid_input_iscd가 KQI인 경우F002(코스닥150선물)\nOC03(코스닥150콜옵션)\nOP03(코스닥150풋옵션)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_시장별 투자자매매동향(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPTJ04040000", + "description": "[실전투자]\nFHPTJ04040000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-investor-daily-by-market?FID_COND_MRKT_DIV_CODE=U&FID_INPUT_ISCD=0001&FID_INPUT_DATE_1=20240517&FID_INPUT_ISCD_1=KSP", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-investor-daily-by-market" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "U", + "description": "시장구분코드 (U:업종)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0001", + "description": "업종분류코드" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240517", + "description": "입력 날짜1(YYYYMMDD)" + }, + { + "key": "FID_INPUT_ISCD_1", + "value": "KSP", + "description": "입력 종목코드 - 코스피(KSP), 코스닥(KSQ)," + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 신용잔고 일별추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04760000", + "description": "[실전투자]\nFHPST04760000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/daily-credit-balance?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20476&fid_input_iscd=068270&fid_input_date_1=20240508", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "daily-credit-balance" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20476", + "description": "화면 분류 코드(20476 입력)" + }, + { + "key": "fid_input_iscd", + "value": "068270", + "description": "종목코드 (ex 005930)" + }, + { + "key": "fid_input_date_1", + "value": "20240508", + "description": "결제일자 (ex 20240313)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 예상체결가 추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01810000", + "description": "[실전투자]\nFHPST01810000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/exp-price-trend?fid_cond_mrkt_div_code=J&fid_input_iscd=005930&fid_mkop_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "exp-price-trend" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_input_iscd", + "value": "005930", + "description": "종목코드 (ex. 005930)" + }, + { + "key": "fid_mkop_cls_code", + "value": "0", + "description": "장운영 구분 코드 (0:전체, 4:체결량 0 제외)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 공매도 일별추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04830000", + "description": "[실전투자]\nFHPST04830000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/daily-short-sale?FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_INPUT_DATE_1=20240301&FID_INPUT_DATE_2=20240328", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "daily-short-sale" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex. 005930)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240301", + "description": "누적기간~" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240328", + "description": "~누적기간" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외예상체결등락률", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST11860000", + "description": "[실전투자]\nFHKST11860000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/overtime-exp-trans-fluct?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=11186&FID_INPUT_ISCD=0000&FID_RANK_SORT_CLS_CODE=0&FID_DIV_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_INPUT_VOL_1=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "overtime-exp-trans-fluct" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11186", + "description": "조건 화면 분류 코드(11186 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0000", + "description": "입력 종목코드(0000':전체, '0001':코스피, '1001':코스닥)" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위 정렬 구분 코드(0':상승률'1':상승폭, '2':보합, '3':하락률, '4':하락폭)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0", + "description": "분류 구분 코드(0':전체'1':관리종목, '2':투자주의, '3':투자경고, '4':투자위험예고, '5':투자위험, '6':보통주, '7':우선주)" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "", + "description": "입력 가격2(공백)" + }, + { + "key": "FID_INPUT_VOL_1", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_프로그램매매 투자자매매동향(당일)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHPPG046600C0", + "description": "[실전투자]\nHHPPG046600C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/investor-program-trade-today?MRKT_DIV_CLS_CODE=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "investor-program-trade-today" + ], + "query": [ + { + "key": "MRKT_DIV_CLS_CODE", + "value": "1", + "description": "시장구분코드 - 1:코스피, 4:코스닥" + } + ] + } + }, + "response": [] + }, + { + "name": "J_프로그램매매 종합현황(시간)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPPG04600100", + "description": "[실전투자]\nFHPPG04600100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/comp-program-trade-today?FID_MRKT_CLS_CODE=K&FID_SCTN_CLS_CODE=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "comp-program-trade-today" + ], + "query": [ + { + "key": "FID_MRKT_CLS_CODE", + "value": "K", + "description": "시장 구분 코드(K: 코스피, Q: 코스닥)" + }, + { + "key": "FID_SCTN_CLS_CODE", + "value": "", + "description": "구간 구분 코드(공백 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_프로그램매매 종합현황(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPPG04600000", + "description": "[실전투자]\nFHPPG04600000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/comp-program-trade-daily?FID_MRKT_CLS_CODE=K&FID_INPUT_DATE_1=20230301&FID_INPUT_DATE_2=20240404", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "comp-program-trade-daily" + ], + "query": [ + { + "key": "FID_MRKT_CLS_CODE", + "value": "K", + "description": "시장 구분 코드(K:코스피, Q:코스닥)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20230301", + "description": "검색시작일" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240404", + "description": "검색종료일" + } + ] + } + }, + "response": [] + }, + { + "name": "J_외국계 매매종목 가집계", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST644100C0", + "description": "[실전투자]\nFHKST644100C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/frgnmem-trade-estimate?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=16441&FID_INPUT_ISCD=0000&FID_RANK_SORT_CLS_CODE=0&FID_RANK_SORT_CLS_CODE_2=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "frgnmem-trade-estimate" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장구분코드 (J 입력) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "16441", + "description": "화면분류코드(16441 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "0000", + "description": "업종코드 - 0000(전체), 1001(코스피), 2001(코스닥)" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위정렬구분코드 - 0(금액순), 1(수량순)" + }, + { + "key": "FID_RANK_SORT_CLS_CODE_2", + "value": "0", + "description": "순위정렬구분코드2 - 0(매수순), 1(매도순)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_종목별 외국계 순매수추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST644400C0", + "description": "[실전투자]\nFHKST644400C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/frgnmem-pchs-trend?FID_INPUT_ISCD=005930&FID_INPUT_ISCD_2=99999", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "frgnmem-pchs-trend" + ], + "query": [ + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex. 005930(삼성전자))" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "99999", + "description": "외국계 전체(99999)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 체결금액별 매매비중", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST111900C0", + "description": "[실전투자]\nFHKST111900C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/tradprt-byamt?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=11119&FID_INPUT_ISCD=005930", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "tradprt-byamt" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드 (J 입력)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11119", + "description": "화면분류코드(11119 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex. 005930 (삼성전자))" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내 증시자금 종합", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST649100C0", + "description": "[실전투자]\nFHKST649100C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/mktfunds?FID_INPUT_DATE_1=20240502", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "mktfunds" + ], + "query": [ + { + "key": "FID_INPUT_DATE_1", + "value": "20240502", + "description": "입력날짜1(YYYYMMDD)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_관심종목 그룹 조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKCM113004C7", + "description": "[실전투자]\nHHKCM113004C7", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/intstock-grouplist?TYPE=1&FID_ETC_CLS_CODE=00&USER_ID={{HTS_ID}}", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "intstock-grouplist" + ], + "query": [ + { + "key": "TYPE", + "value": "1", + "description": "관심종목구분코드(1 입력) " + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "00", + "description": "기타 구분 코드(00 입력) " + }, + { + "key": "USER_ID", + "value": "{{HTS_ID}}", + "description": "사용자 HTS_ID" + } + ] + } + }, + "response": [] + }, + { + "name": "J_관심종목 그룹별 종목조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKCM113004C6", + "description": "[실전투자]\nHHKCM113004C6", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/intstock-stocklist-by-group?TYPE=1&USER_ID={{HTS_ID}}&DATA_RANK=&INTER_GRP_CODE=001&INTER_GRP_NAME=&HTS_KOR_ISNM=&CNTG_CLS_CODE=&FID_ETC_CLS_CODE=4", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "intstock-stocklist-by-group" + ], + "query": [ + { + "key": "TYPE", + "value": "1", + "description": "관심종목구분코드(1 입력) " + }, + { + "key": "USER_ID", + "value": "{{HTS_ID}}", + "description": "사용자 HTS_ID" + }, + { + "key": "DATA_RANK", + "value": "", + "description": "공백 입력 " + }, + { + "key": "INTER_GRP_CODE", + "value": "001", + "description": "관심그룹 조회 결과의 그룹 값 입력" + }, + { + "key": "INTER_GRP_NAME", + "value": "", + "description": "공백 입력 " + }, + { + "key": "HTS_KOR_ISNM", + "value": "", + "description": "공백 입력 " + }, + { + "key": "CNTG_CLS_CODE", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_ETC_CLS_CODE", + "value": "4", + "description": "기타구분코드(4 입력) " + } + ] + } + }, + "response": [] + }, + { + "name": "J_관심종목(멀티종목) 시세조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST11300006", + "description": "[실전투자]\nFHKST11300006", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/intstock-multprice?FID_COND_MRKT_DIV_CODE_1=J&FID_INPUT_ISCD_1=419530&FID_COND_MRKT_DIV_CODE_2=J&FID_INPUT_ISCD_2=092070&FID_COND_MRKT_DIV_CODE_3=J&FID_INPUT_ISCD_3=039440&FID_COND_MRKT_DIV_CODE_4=J&FID_INPUT_ISCD_4=102120&FID_COND_MRKT_DIV_CODE_5=J&FID_INPUT_ISCD_5=036930&FID_COND_MRKT_DIV_CODE_6=J&FID_INPUT_ISCD_6=195870&FID_COND_MRKT_DIV_CODE_7=J&FID_INPUT_ISCD_7=217620&FID_COND_MRKT_DIV_CODE_8=J&FID_INPUT_ISCD_8=417840&FID_COND_MRKT_DIV_CODE_9=J&FID_INPUT_ISCD_9=093520&FID_COND_MRKT_DIV_CODE_10=J&FID_INPUT_ISCD_10=098460&FID_COND_MRKT_DIV_CODE_11=J&FID_INPUT_ISCD_11=002070&FID_COND_MRKT_DIV_CODE_12=J&FID_INPUT_ISCD_12=003960&FID_COND_MRKT_DIV_CODE_13=J&FID_INPUT_ISCD_13=083450&FID_COND_MRKT_DIV_CODE_14=J&FID_INPUT_ISCD_14=131290&FID_COND_MRKT_DIV_CODE_15=J&FID_INPUT_ISCD_15=060310&FID_COND_MRKT_DIV_CODE_16=J&FID_INPUT_ISCD_16=095570&FID_COND_MRKT_DIV_CODE_17=J&FID_INPUT_ISCD_17=006840&FID_COND_MRKT_DIV_CODE_18=J&FID_INPUT_ISCD_18=054620&FID_COND_MRKT_DIV_CODE_19=J&FID_INPUT_ISCD_19=265520&FID_COND_MRKT_DIV_CODE_20=J&FID_INPUT_ISCD_20=211270&FID_COND_MRKT_DIV_CODE_21=J&FID_INPUT_ISCD_21=027410&FID_COND_MRKT_DIV_CODE_22=J&FID_INPUT_ISCD_22=282330&FID_COND_MRKT_DIV_CODE_23=J&FID_INPUT_ISCD_23=126600&FID_COND_MRKT_DIV_CODE_24=J&FID_INPUT_ISCD_24=138930&FID_COND_MRKT_DIV_CODE_25=J&FID_INPUT_ISCD_25=001460&FID_COND_MRKT_DIV_CODE_26=J&FID_INPUT_ISCD_26=001465&FID_COND_MRKT_DIV_CODE_27=J&FID_INPUT_ISCD_27=013720&FID_COND_MRKT_DIV_CODE_28=J&FID_INPUT_ISCD_28=001040&FID_COND_MRKT_DIV_CODE_29=J&FID_INPUT_ISCD_29=079160&FID_COND_MRKT_DIV_CODE_30=J&FID_INPUT_ISCD_30=035760", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "intstock-multprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE_1", + "value": "J", + "description": "그룹별종목조회 결과 fid_mrkt_cls_code(시장구분) 1" + }, + { + "key": "FID_INPUT_ISCD_1", + "value": "419530", + "description": "그룹별종목조회 결과 jong_code(종목코드) 1" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_2", + "value": "J", + "description": "※ 총 30종목까지 조회 가능" + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "092070" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_3", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_3", + "value": "039440" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_4", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_4", + "value": "102120" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_5", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_5", + "value": "036930" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_6", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_6", + "value": "195870" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_7", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_7", + "value": "217620" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_8", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_8", + "value": "417840" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_9", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_9", + "value": "093520" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_10", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_10", + "value": "098460" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_11", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_11", + "value": "002070" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_12", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_12", + "value": "003960" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_13", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_13", + "value": "083450" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_14", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_14", + "value": "131290" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_15", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_15", + "value": "060310" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_16", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_16", + "value": "095570" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_17", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_17", + "value": "006840" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_18", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_18", + "value": "054620" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_19", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_19", + "value": "265520" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_20", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_20", + "value": "211270" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_21", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_21", + "value": "027410" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_22", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_22", + "value": "282330" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_23", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_23", + "value": "126600" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_24", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_24", + "value": "138930" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_25", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_25", + "value": "001460" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_26", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_26", + "value": "001465" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_27", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_27", + "value": "013720" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_28", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_28", + "value": "001040" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_29", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_29", + "value": "079160" + }, + { + "key": "FID_COND_MRKT_DIV_CODE_30", + "value": "J" + }, + { + "key": "FID_INPUT_ISCD_30", + "value": "035760" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 상하한가 포착", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST130000C0", + "description": "[실전투자]\nFHKST130000C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/capture-uplowprice?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=11300&FID_PRC_CLS_CODE=0&FID_DIV_CLS_CODE=0&FID_INPUT_ISCD=0000&FID_TRGT_CLS_CODE=&FID_TRGT_EXLS_CLS_CODE=&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_VOL_CNT=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "capture-uplowprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장구분(J 입력)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11300", + "description": "화면분류코드(11300 입력)" + }, + { + "key": "FID_PRC_CLS_CODE", + "value": "0", + "description": "상하한가 구분코드 - 0(상한가),1(하한가)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0", + "description": "분류구분코드 - 0(상하한가종목),6(8%상하한가 근접), 5(10%상하한가 근접), 1(15%상하한가 근접),2(20%상하한가 근접),\n3(25%상하한가 근접)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0000", + "description": "종목코드 - 전체(0000), 코스피(0001),코스닥(1001)" + }, + { + "key": "FID_TRGT_CLS_CODE", + "value": "", + "description": "대상구분코드" + }, + { + "key": "FID_TRGT_EXLS_CLS_CODE", + "value": "", + "description": "대상제외구분코드" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "", + "description": "입력가격1" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "", + "description": "입력가격2" + }, + { + "key": "FID_VOL_CNT", + "value": "", + "description": "거래량수" + } + ] + } + }, + "response": [] + }, + { + "name": "J_회원사 실시간 매매동향(틱)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04320000", + "description": "[실전투자]\nFHPST04320000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/frgnmem-trade-trend?FID_COND_SCR_DIV_CODE=20432&FID_INPUT_ISCD=000660&FID_INPUT_ISCD_2=99999&FID_MRKT_CLS_CODE=A&FID_VOL_CNT=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "frgnmem-trade-trend" + ], + "query": [ + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20432", + "description": "화면분류코드(20432 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "000660", + "description": "종목코드(ex) 005930(삼성전자)) " + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "99999", + "description": "회원사코드 (kis developers 포탈 사이트 포럼-> FAQ -> 종목정보 다운로드(국내) 참조) " + }, + { + "key": "FID_MRKT_CLS_CODE", + "value": "A", + "description": "시장구분코드- A(전체),K(코스피), Q(코스닥), K2(코스닥200), W(ELW)" + }, + { + "key": "FID_VOL_CNT", + "value": "0", + "description": "거래량 ~" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 매물대/거래비중", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01130000", + "description": "[실전투자]\nFHPST01130000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/pbar-tratio?FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_COND_SCR_DIV_CODE=20113&FID_INPUT_HOUR_1=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "pbar-tratio" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장분류코드(J 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex. 005930) " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20113", + "description": "화면분류코드(20113 입력) " + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "", + "description": "입력시간1(공백 입력) " + } + ] + } + }, + "response": [] + }, + { + "name": "J_주식현재가 회원사 종목매매동향", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04540000", + "description": "[실전투자]\nFHPST04540000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/inquire-member-daily?FID_COND_MRKT_DIV_CODE=J&FID_INPUT_ISCD=005930&FID_INPUT_ISCD_2=00003&FID_INPUT_DATE_1=20240501&FID_INPUT_DATE_2=20240624&FID_SCTN_CLS_CODE=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "inquire-member-daily" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장분류코드(J 입력) " + }, + { + "key": "FID_INPUT_ISCD", + "value": "005930", + "description": "종목코드(ex. 005930) " + }, + { + "key": "FID_INPUT_ISCD_2", + "value": "00003", + "description": "회원사코드 (포럼-> FAQ -> 종목정보 다운로드(국내) 참조)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20240501", + "description": "날짜 ~" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20240624", + "description": "~ 날짜" + }, + { + "key": "FID_SCTN_CLS_CODE", + "value": "", + "description": "구간구분코드(공백 입력)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내주식] 순위분석", + "item": [ + { + "name": "J_거래량순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01710000", + "description": "[실전투자/모의투자]\nFHPST01710000: 거래량순위", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/quotations/volume-rank?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=20171&FID_INPUT_ISCD=0002&FID_DIV_CLS_CODE=0&FID_BLNG_CLS_CODE=0&FID_TRGT_CLS_CODE=111111111&FID_TRGT_EXLS_CLS_CODE=000000&FID_INPUT_PRICE_1=0&FID_INPUT_PRICE_2=0&FID_VOL_CNT=0&FID_INPUT_DATE_1=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "quotations", + "volume-rank" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장분류코드(J)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20171", + "description": "화면분류코드(20171)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0002", + "description": "입력종목코드(0000전체, 업종코드 참고)" + }, + { + "key": "FID_DIV_CLS_CODE", + "value": "0", + "description": "분류구분코드\n0:전체 1:보통주 2:우선주 " + }, + { + "key": "FID_BLNG_CLS_CODE", + "value": "0", + "description": "소속구분코드\n0 : 평균거래량 1:거래증가율 2:평균거래회전율 3:거래금액순 4:평균거래금액회전율" + }, + { + "key": "FID_TRGT_CLS_CODE", + "value": "111111111", + "description": "대상구분코드 \n1 or 0 9자리 (차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%) " + }, + { + "key": "FID_TRGT_EXLS_CLS_CODE", + "value": "000000", + "description": "대상제외구분코드\n1 or 0 9자리 (차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%) " + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "0", + "description": "가격~\nex) \"0\"\n\n전체 가격 대상 조회 시 FID_INPUT_PRICE_1, FID_INPUT_PRICE_2 모두 \"\"(공란) 입력" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "0", + "description": "~가격\nex) \"1000000\"\n\n전체 가격 대상 조회 시 FID_INPUT_PRICE_1, FID_INPUT_PRICE_2 모두 \"\"(공란) 입력 " + }, + { + "key": "FID_VOL_CNT", + "value": "0", + "description": "거래량~\nex) \"100000\"\n\n전체 거래량 대상 조회 시 FID_VOL_CNT \"\"(공란) 입력\n" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "0", + "description": "입력 날짜\n\"\"(공란) 입력\n" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 등락률 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01700000", + "description": "[실전투자]\nFHPST01700000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/fluctuation?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20170&fid_input_iscd=0000&fid_rank_sort_cls_code=0&fid_input_cnt_1=0&fid_prc_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_div_cls_code=0&fid_rsfl_rate1=&fid_rsfl_rate2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "fluctuation" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20170", + "description": "화면 분류 코드(20170 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)\n" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0:상승율순 1:하락율순 2:시가대비상승율 3:시가대비하락율 4:변동율" + }, + { + "key": "fid_input_cnt_1", + "value": "0", + "description": "입력수(0:전체 입력)" + }, + { + "key": "fid_prc_cls_code", + "value": "0", + "description": "가격 구분 코드\nfid_rank_sort_cls_code :0 상승율 순일때 (0:저가대비, 1:종가대비)\nfid_rank_sort_cls_code :1 하락율 순일때 (0:고가대비, 1:종가대비)\nfid_rank_sort_cls_code : 기타 (0:전체)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드\n(0:전체 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n(0:전체 입력)" + }, + { + "key": "fid_rsfl_rate1", + "value": "", + "description": "등락 비율1\n입력값 없을때 전체 (비율 ~)" + }, + { + "key": "fid_rsfl_rate2", + "value": "", + "description": "등락 비율2\n입력값 없을때 전체 (~ 비율)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 수익자산지표 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01730000", + "description": "[실전투자]\nFHPST01730000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/profit-asset-index?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20173&fid_input_iscd=0000&fid_div_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_input_option_1=2023&fid_input_option_2=0&fid_rank_sort_cls_code=0&fid_blng_cls_code=0&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "profit-asset-index" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20173", + "description": "화면 분류 코드(20173 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_input_option_1", + "value": "2023", + "description": "입력 옵션1 : 회계연도 (2023)" + }, + { + "key": "fid_input_option_2", + "value": "0", + "description": "입력 옵션2 (0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0:매출이익 1:영업이익 2:경상이익 3:당기순이익 4:자산총계 5:부채총계 6:자본총계" + }, + { + "key": "fid_blng_cls_code", + "value": "0", + "description": "소속 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시가총액 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01740000", + "description": "[실전투자]\nFHPST01740000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/market-cap?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20174&fid_div_cls_code=0&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "market-cap" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20174", + "description": "화면 분류 코드(20174 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 재무비율 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01750000", + "description": "[실전투자]\nFHPST01750000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/finance-ratio?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20175&fid_input_iscd=0000&fid_div_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_input_option_1=2023&fid_input_option_2=3&fid_rank_sort_cls_code=7&fid_blng_cls_code=0&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "finance-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20175", + "description": "화면 분류 코드(20175 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_input_option_1", + "value": "2023", + "description": "입력 옵션1: 회계연도 (2023)\n" + }, + { + "key": "fid_input_option_2", + "value": "3", + "description": "입력 옵션2\n0: 1/4분기 , 1: 반기, 2: 3/4분기, 3: 결산" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "7", + "description": "순위 정렬 구분 코드\n7: 수익성 분석, 11 : 안정성 분석, 15: 성장성 분석, 20: 활동성 분석" + }, + { + "key": "fid_blng_cls_code", + "value": "0", + "description": "소속 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외잔량 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01760000", + "description": "[실전투자]\nFHPST01760000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/after-hour-balance?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20176&fid_rank_sort_cls_code=1&fid_div_cls_code=0&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "after-hour-balance" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20176", + "description": "화면 분류 코드(20176 입력)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "1", + "description": "순위 정렬 구분 코드\n1: 장전 시간외, 2: 장후 시간외, 3:매도잔량, 4:매수잔량" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 우선주/괴리율 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01770000", + "description": "[실전투자]\nFHPST01770000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/prefer-disparate-ratio?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20177&fid_div_cls_code=0&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "prefer-disparate-ratio" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20177", + "description": "화면 분류 코드(20177 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 호가잔량 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01720000", + "description": "[실전투자]\nFHPST01720000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/quote-balance?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20172&fid_input_iscd=0000&fid_rank_sort_cls_code=0&fid_div_cls_code=0&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "quote-balance" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20172", + "description": "화면 분류 코드(20172 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0: 순매수잔량순, 1:순매도잔량순, 2:매수비율순, 3:매도비율순" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 이격도 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01780000", + "description": "[실전투자]\nFHPST01780000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/disparity?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20178&fid_div_cls_code=0&fid_rank_sort_cls_code=0&fid_hour_cls_code=0000&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "disparity" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20178", + "description": "화면 분류 코드(20178 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0: 이격도상위순, 1:이격도하위순" + }, + { + "key": "fid_hour_cls_code", + "value": "0000", + "description": "시간 구분 코드\n5:이격도5, 10:이격도10, 20:이격도20, 60:이격도60, 120:이격도120" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시장가치 순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01790000", + "description": "[실전투자]\nFHPST01790000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/market-value?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20179&fid_input_iscd=0000&fid_div_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_input_option_1=2023&fid_input_option_2=3&fid_rank_sort_cls_code=23&fid_blng_cls_code=0&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "market-value" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20179", + "description": "화면 분류 코드(20179 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_input_option_1", + "value": "2023", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_option_2", + "value": "3", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "23", + "description": "순위 정렬 구분 코드\n가치분석(23:PER, 24:PBR, 25:PCR, 26:PSR, 27: EPS, 28:EVA,\n29: EBITDA, 30: EV/EBITDA, 31:EBITDA/금융비율" + }, + { + "key": "fid_blng_cls_code", + "value": "0", + "description": "소속 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)\n" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 체결강도 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01680000", + "description": "[실전투자]\nFHPST01680000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/volume-power?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20168&fid_input_iscd=0000&fid_div_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "volume-power" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20168", + "description": "화면 분류 코드(20168입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 관심종목등록 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01800000", + "description": "[실전투자]\nFHPST01800000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/top-interest-stock?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20180&fid_input_iscd=0000&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_div_cls_code=0&fid_input_iscd_2=000000&fid_input_cnt_1=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "top-interest-stock" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20180", + "description": "화면 분류 코드(20180 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_iscd_2", + "value": "000000", + "description": "입력 종목코드2(000000 : 필수입력값)" + }, + { + "key": "fid_input_cnt_1", + "value": "1", + "description": "순위검색 입력값(1: 1위부터, 10:10위부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 예상체결 상승/하락상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01820000", + "description": "[실전투자]\nFHPST01820000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/exp-trans-updown?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20182&fid_input_iscd=0000&fid_div_cls_code=0&fid_aply_rang_prc_1=&fid_vol_cnt=&fid_pbmn=&fid_blng_cls_code=0&fid_mkop_cls_code=0&fid_rank_sort_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "exp-trans-updown" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20182", + "description": "화면 분류 코드(20182 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n0:전체 1:보통주 2:우선주\n" + }, + { + "key": "fid_aply_rang_prc_1", + "value": "", + "description": "적용 범위 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_pbmn", + "value": "", + "description": "거래대금\n입력값 없을때 전체 (거래대금 ~) 천원단위" + }, + { + "key": "fid_blng_cls_code", + "value": "0", + "description": "소속 구분 코드(0:전체 입력)" + }, + { + "key": "fid_mkop_cls_code", + "value": "0", + "description": "장운영 구분 코드(0:장전예상 1:장마감예상)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0:상승률1:상승폭2:보합3:하락율4:하락폭5:체결량6:거래대금" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 당사매매종목 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01860000", + "description": "[실전투자]\nFHPST01860000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/traded-by-company?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20186&fid_div_cls_code=0&fid_rank_sort_cls_code=0&fid_input_date_1=20240314&fid_input_date_2=20240315&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_aply_rang_prc_1=&fid_aply_rang_prc_2=&fid_aply_rang_vol=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "traded-by-company" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20186", + "description": "화면 분류 코드(20186 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n0: 전체, 1:관리종목, 2:투자주의, 3:투자경고, 4:투자위험예고, 5:투자위험, 6:보통주, 7:우선주" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0:매도상위,1:매수상위" + }, + { + "key": "fid_input_date_1", + "value": "20240314", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_date_2", + "value": "20240315", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_aply_rang_prc_1", + "value": "", + "description": "적용 범위 가격1(가격 ~)" + }, + { + "key": "fid_aply_rang_prc_2", + "value": "", + "description": "적용 범위 가격2(~ 가격)" + }, + { + "key": "fid_aply_rang_vol", + "value": "0", + "description": "적용 범위 거래량(0: 전체, 100: 100주 이상)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 신고/신저근접종목 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST01870000", + "description": "[실전투자]\nFHPST01870000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/near-new-highlow?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20187&fid_div_cls_code=0&fid_input_cnt_1=&fid_input_cnt_2=&fid_prc_cls_code=0&fid_input_iscd=0000&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_aply_rang_prc_1=&fid_aply_rang_prc_2=&fid_aply_rang_vol=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "near-new-highlow" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20187", + "description": "화면 분류 코드(20187 입력)" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드\n0:전체, 1:관리종목, 2:투자주의, 3:투자경고" + }, + { + "key": "fid_input_cnt_1", + "value": "", + "description": "입력 수1(괴리율 최소)" + }, + { + "key": "fid_input_cnt_2", + "value": "", + "description": "입력 수2(괴리율 최대)" + }, + { + "key": "fid_prc_cls_code", + "value": "0", + "description": "가격 구분 코드\n0:신고근접, 1:신저근접" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "입력 종목코드\n0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200, 4001: KRX100" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_aply_rang_prc_1", + "value": "", + "description": "적용 범위 가격1(가격 ~)" + }, + { + "key": "fid_aply_rang_prc_2", + "value": "", + "description": "적용 범위 가격2(~ 가격)" + }, + { + "key": "fid_aply_rang_vol", + "value": "0", + "description": "적용 범위 거래량(0: 전체, 100: 100주 이상)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 대량체결건수 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST190900C0", + "description": "[실전투자]\nFHKST190900C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/bulk-trans-num?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=11909&fid_input_iscd=0000&fid_rank_sort_cls_code=0&fid_div_cls_code=0&fid_input_price_1=10000000&fid_aply_rang_prc_1=&fid_aply_rang_prc_2=&fid_vol_cnt=&fid_trgt_cls_code=0&fid_trgt_exls_cls_code=0&fid_input_iscd_2=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "bulk-trans-num" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "11909", + "description": "화면 분류 코드(11909 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n0:매수상위, 1:매도상위" + }, + { + "key": "fid_div_cls_code", + "value": "0", + "description": "분류 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_price_1", + "value": "10000000", + "description": "입력 가격1(건별금액 ~)" + }, + { + "key": "fid_aply_rang_prc_1", + "value": "", + "description": "적용 범위 가격1(가격 ~)\n입력값 없을때 전체" + }, + { + "key": "fid_aply_rang_prc_2", + "value": "", + "description": "적용 범위 가격2(~ 가격)\n입력값 없을때 전체" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_input_iscd_2", + "value": "", + "description": "입력 종목코드2\n공백:전체종목, 개별종목 조회시 종목코드 (000660)\n" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 공매도 상위종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST04820000", + "description": "[실전투자]\nFHPST04820000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/short-sale?fid_cond_mrkt_div_code=J&fid_cond_scr_div_code=20482&fid_input_iscd=0000&fid_period_div_code=D&fid_input_cnt_1=000000000000&fid_trgt_exls_cls_code=0&fid_trgt_cls_code=0&fid_aply_rang_prc_1=&fid_aply_rang_prc_2=&fid_aply_rang_vol=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "short-sale" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20482", + "description": "화면 분류 코드(20482 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드\n0000(전체) 코스피(0001), 코스닥(1001), 코스피200(2001)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간 분류 코드\nFID_INPUT_CNT_1이 일, 주 일시 'D', 개월일 시 'M' " + }, + { + "key": "fid_input_cnt_1", + "value": "000000000000", + "description": "입력 수1\n'000000000000':1일, 000000000001:2일, 000000000002:3일, 000000000003:4일 000000000004:1주일, 000000000009:2주일, 000000000014:3주일, 000000000001:1개월, 000000000002:2개월, 000000000003:3개월, \n" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "0", + "description": "대상 제외 구분 코드(0:전체 입력)" + }, + { + "key": "fid_trgt_cls_code", + "value": "0", + "description": "대상 구분 코드(0:전체 입력)" + }, + { + "key": "fid_aply_rang_prc_1", + "value": "", + "description": "적용 범위 가격1(가격 ~)" + }, + { + "key": "fid_aply_rang_prc_2", + "value": "", + "description": "적용 범위 가격2(~ 가격)" + }, + { + "key": "fid_aply_rang_vol", + "value": "0", + "description": "적용 범위 거래량(0: 전체, 100: 100주 이상)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 신용잔고 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST17010000", + "description": "[실전투자]\nFHKST17010000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/credit-balance?fid_cond_scr_div_code=11701&fid_input_iscd=0000&fid_option=2&fid_cond_mrkt_div_code=J&fid_rank_sort_cls_code=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "credit-balance" + ], + "query": [ + { + "key": "fid_cond_scr_div_code", + "value": "11701", + "description": "화면 분류 코드(11701 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "업종코드 입력\n0000:전체, 0001:거래소, 1001:코스닥, 2001:코스피200" + }, + { + "key": "fid_option", + "value": "2", + "description": "증가율기간(2~999)" + }, + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_rank_sort_cls_code", + "value": "0", + "description": "순위 정렬 구분 코드\n(융자)0:잔고비율 상위, 1: 잔고수량 상위, 2: 잔고금액 상위, 3: 잔고비율 증가상위, 4: 잔고비율 감소상위 \n(대주)5:잔고비율 상위, 6: 잔고수량 상위, 7: 잔고금액 상위, 8: 잔고비율 증가상위, 9: 잔고비율 감소상위 " + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 배당률 상위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHKDB13470100", + "description": "[실전투자]\nHHKDB13470100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/dividend-rate?CTS_AREA=&GB1=0&UPJONG=0001&GB2=0&GB3=1&F_DT=20200101&T_DT=20240403&GB4=0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "dividend-rate" + ], + "query": [ + { + "key": "CTS_AREA", + "value": "", + "description": "공백 " + }, + { + "key": "GB1", + "value": "0", + "description": "0:전체, 1:코스피, 2: 코스피200, 3: 코스닥," + }, + { + "key": "UPJONG", + "value": "0001", + "description": "업종구분\n코스피(0001:종합, 0002:대형주.…0027:제조업 ), \n코스닥(1001:종합, …. 1041:IT부품\n코스피200 (2001:KOSPI200, 2007:KOSPI100, 2008:KOSPI50)" + }, + { + "key": "GB2", + "value": "0", + "description": "종목선택(0:전체, 6:보통주, 7:우선주)" + }, + { + "key": "GB3", + "value": "1", + "description": "배당구분(1:주식배당, 2: 현금배당)" + }, + { + "key": "F_DT", + "value": "20200101", + "description": "기준일From" + }, + { + "key": "T_DT", + "value": "20240403", + "description": "기준일To" + }, + { + "key": "GB4", + "value": "0", + "description": "결산/중간배당(0:전체, 1:결산배당, 2:중간배당)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외등락율순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02340000", + "description": "[실전투자]\nFHPST02340000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/overtime-fluctuation?fid_cond_mrkt_div_code=J&fid_mrkt_cls_code=A&fid_cond_scr_div_code=20234&fid_input_iscd=0000&fid_div_cls_code=2&fid_input_price_1=&fid_input_price_2=&fid_vol_cnt=&fid_trgt_cls_code=001111111&fid_trgt_exls_cls_code=111111", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "overtime-fluctuation" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "fid_mrkt_cls_code", + "value": "A", + "description": "시장 구분 코드\t(K 입력)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20234", + "description": "조건 화면 분류 코드(20234 입력)" + }, + { + "key": "fid_input_iscd", + "value": "0000", + "description": "입력 종목코드(0':전체, '1':코스피, '2':코스닥)" + }, + { + "key": "fid_div_cls_code", + "value": "2", + "description": "분류 구분 코드(1':상한가, '2':상승률, '3':보합,'4':하한가,'5':하락률)" + }, + { + "key": "fid_input_price_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "fid_input_price_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "fid_vol_cnt", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "fid_trgt_cls_code", + "value": "001111111", + "description": "대상 구분 코드\t\n1 or 0 9자리 (차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%)" + }, + { + "key": "fid_trgt_exls_cls_code", + "value": "111111", + "description": "대상 제외 구분 코드\t\n1 or 0 6자리 (차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내주식 시간외거래량순위", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPST02350000", + "description": "[실전투자]\nFHPST02350000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-stock/v1/ranking/overtime-volume?FID_COND_MRKT_DIV_CODE=J&FID_COND_SCR_DIV_CODE=20235&FID_INPUT_ISCD=0000&FID_RANK_SORT_CLS_CODE=0&FID_INPUT_PRICE_1=&FID_INPUT_PRICE_2=&FID_VOL_CNT=&FID_TRGT_CLS_CODE=&FID_TRGT_EXLS_CLS_CODE=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-stock", + "v1", + "ranking", + "overtime-volume" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "J", + "description": "시장 분류 코드 (J : 주식)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20235", + "description": "조건 화면 분류 코드(20235 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "0000", + "description": "입력 종목코드\n0000':전체, '0001':코스피, '1001':코스닥" + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "0", + "description": "순위 정렬 구분 코드(0:매수잔량, 1:매도잔량, 2:거래량)" + }, + { + "key": "FID_INPUT_PRICE_1", + "value": "", + "description": "입력 가격1\n입력값 없을때 전체 (가격 ~)" + }, + { + "key": "FID_INPUT_PRICE_2", + "value": "", + "description": "입력 가격2\n입력값 없을때 전체 (~ 가격)" + }, + { + "key": "FID_VOL_CNT", + "value": "", + "description": "거래량 수\n입력값 없을때 전체 (거래량 ~)" + }, + { + "key": "FID_TRGT_CLS_CODE", + "value": "", + "description": "대상 구분 코드\t\n1 or 0 9자리 (차례대로 증거금 30% 40% 50% 60% 100% 신용보증금 30% 40% 50% 60%)" + }, + { + "key": "FID_TRGT_EXLS_CLS_CODE", + "value": "", + "description": "대상 제외 구분 코드\t\n1 or 0 6자리 (차례대로 투자위험/경고/주의 관리종목 정리매매 불성실공시 우선주 거래정지)" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "국내선물옵션", + "item": [ + { + "name": "[국내선물옵션] 주문/계좌", + "item": [ + { + "name": "J_선물옵션 주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROT_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTO1101U", + "description": "[실전투자]\nTTTO1101U : 선물 옵션 매수 매도 주문 주간\nJTCE1001U : 선물 옵션 매수 매도 주문 야간\n\n[모의투자]\nVTTO1101U : 선물 옵션 매수 매도 주문 주간\nVTCE1001U : 선물 옵션 매수 매도 주문 야간", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROT_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"ORD_PRCS_DVSN_CD\": \"02\",\r\n \"CANO\": \"{{CANO_REAL_T}}\",\r\n \"ACNT_PRDT_CD\": \"03\",\r\n \"SLL_BUY_DVSN_CD\": \"02\",\r\n \"SHTN_PDNO\": \"167R12\",\r\n \"ORD_QTY\": \"1\",\r\n \"UNIT_PRICE\": \"0\",\r\n \"NMPR_TYPE_CD\": \"02\",\r\n \"KRX_NMPR_CNDT_CD\": \"0\",\r\n \"ORD_DVSN_CD\": \"02\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 정정취소주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROT_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appKey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appSecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTO1103U", + "description": "[실전투자]\nTTTO1103U : 선물 옵션 정정 취소 주문 주간\nJTCE1002U : 선물 옵션 정정 취소 주문 야간\n\n[모의투자]\nVTTO1103U : 선물 옵션 정정 취소 주문 주간\nVTCE1002U : 선물 옵션 정정 취소 주문 야간", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROT_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"ORD_PRCS_DVSN_CD\": \"02\",\r\n \"CANO\": \"{{CANO_REAL_T}}\",\r\n \"ACNT_PRDT_CD\": \"03\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORGN_ODNO\": \"0000004018\",\r\n \"ORD_QTY\": \"\",\r\n \"UNIT_PRICE\": \"0\",\r\n \"NMPR_TYPE_CD\": \"02\",\r\n \"KRX_NMPR_CNDT_CD\": \"0\",\r\n \"RMN_QTY_YN\": \"Y\",\r\n \"ORD_DVSN_CD\": \"01\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 주문체결내역조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTO5201R", + "description": "[실전투자]\nTTTO5201R : 선물 옵션 주문 체결 내역 조회\n[모의투자]\nVTTO5201R : 선물 옵션 주문 체결 내역 조회", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-ccnl?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&STRT_ORD_DT=20220730&END_ORD_DT=20220830&SLL_BUY_DVSN_CD=00&CCLD_NCCS_DVSN=00&SORT_SQN=DS&STRT_ODNO=&PDNO=&MKET_ID_CD=00&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-ccnl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "STRT_ORD_DT", + "value": "20220730", + "description": "주문내역 조회 시작 일자 (YYYYMMDD)" + }, + { + "key": "END_ORD_DT", + "value": "20220830", + "description": "주문내역 조회 마지막 일자 (YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nAS : 정순\nDS : 역순" + }, + { + "key": "STRT_ODNO", + "value": "", + "description": "시작주문번호(조회 시작 번호 입력)" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호\n공란 : default\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "MKET_ID_CD", + "value": "00", + "description": "공란(Default)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 잔고현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTFO6118R", + "description": "[실전투자]\nCTFO6118R : 선물 옵션 잔고 현황\n\n[모의투자]\nVTFO6118R : 선물 옵션 잔고 현황", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-balance?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&MGNA_DVSN=01&EXCC_STAT_CD=1&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "MGNA_DVSN", + "value": "01", + "description": "증거금 구분(01 : 개시, 02 : 유지)" + }, + { + "key": "EXCC_STAT_CD", + "value": "1", + "description": "정산상태코드(1 : 정산, 2 : 본정산)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 주문가능", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTO5105R", + "description": "[실전투자]\nTTTO5105R : 선물 옵션 주문 가능\n\n[모의투자]\nVTTO5105R : 선물 옵션 주문 가능", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-psbl-order?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&PDNO=101S03&SLL_BUY_DVSN_CD=02&UNIT_PRICE=1&ORD_DVSN_CD=01", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "101S03", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "02", + "description": "매도매수구분코드(01 : 매도, 02 : 매수)" + }, + { + "key": "UNIT_PRICE", + "value": "1", + "description": "주문가격\n※ 주문가격이 '0'일 경우\n- 옵션매수 : 현재가\n- 그 이외 : 기준가" + }, + { + "key": "ORD_DVSN_CD", + "value": "01", + "description": "주문구분코드\n01 : 지정가\n02 : 시장가\n03 : 조건부\n04 : 최유리,\n10 : 지정가(IOC)\n11 : 지정가(FOK)\n12 : 시장가(IOC)\n13 : 시장가(FOK)\n14 : 최유리(IOC)\n15 : 최유리(FOK)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_(야간)선물옵션 주문체결내역조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "JTCE5005R", + "description": "[실전투자]\nJTCE5005R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "description": "고객유형(P: 개인)", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-ngt-ccnl?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&STRT_ORD_DT=20231201&END_ORD_DT=20231214&SLL_BUY_DVSN_CD=00&CCLD_NCCS_DVSN=00&SORT_SQN=&STRT_ODNO=&PDNO=&MKET_ID_CD=&FUOP_DVSN_CD&SCRN_DVSN&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-ngt-ccnl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "STRT_ORD_DT", + "value": "20231201", + "description": "주문내역 조회 시작 일자 (YYYYMMDD)" + }, + { + "key": "END_ORD_DT", + "value": "20231214", + "description": "주문내역 조회 마지막 일자 (YYYYMMDD)\n조회하려는 마지막 일자 다음일자로 조회\n(ex. 20221011 까지의 내역을 조회하고자 할 경우, 20221012로 종료주문일자 설정)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드\n공란 : default (00: 전체 ,01 : 매도, 02 : 매수)" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "SORT_SQN", + "value": "", + "description": "정렬순서\n공란 : default (DS : 정순, 그외 : 역순)" + }, + { + "key": "STRT_ODNO", + "value": "", + "description": "시작주문번호(공란 : default)" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(공란 : default)\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "MKET_ID_CD", + "value": "", + "description": "공란(Default)" + }, + { + "key": "FUOP_DVSN_CD", + "value": null, + "description": "선물옵션구분코드\n공란 : default (00 : 전체, 01 : 선물, 02 : 옵션)" + }, + { + "key": "SCRN_DVSN", + "value": null, + "description": "화면구분(00)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_(야간)선물옵션 잔고현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "JTCE6001R", + "description": "[실전투자]\nJTCE6001R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "description": "고객유형(P: 개인)", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-ngt-balance?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&ACNT_PWD=&MGNA_DVSN=01&EXCC_STAT_CD=1&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-ngt-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "ACNT_PWD", + "value": "", + "description": "계좌비밀번호\n공란(\"\")으로 조회" + }, + { + "key": "MGNA_DVSN", + "value": "01", + "description": "증거금구분(01 : 개시, 02 : 유지)" + }, + { + "key": "EXCC_STAT_CD", + "value": "1", + "description": "정산상태코드\n1 : 정산 (정산가격으로 잔고 조회)\n2 : 본정산 (매입가격으로 잔고 조회)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_(야간)선물옵션 주문가능 조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "JTCE1004R", + "description": "[실전투자]\nJTCE1004R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "description": "고객유형(P: 개인)", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-psbl-ngt-order?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&PDNO=101T03&PRDT_TYPE_CD=301&SLL_BUY_DVSN_CD=02&UNIT_PRICE=322&ORD_DVSN_CD=01", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-psbl-ngt-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "101T03", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "301", + "description": "상품유형코드(301 : 선물옵션)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "02", + "description": "매도매수구분코드(01 : 매도, 02 : 매수)" + }, + { + "key": "UNIT_PRICE", + "value": "322", + "description": "주문가격\n※ 주문가격이 '0'일 경우\n- 옵션매수 : 현재가\n- 그 이외 : 기준가" + }, + { + "key": "ORD_DVSN_CD", + "value": "01", + "description": "주문구분코드\n01 : 지정가\n02 : 시장가\n03 : 조건부\n04 : 최유리,\n10 : 지정가(IOC)\n11 : 지정가(FOK)\n12 : 시장가(IOC)\n13 : 시장가(FOK)\n14 : 최유리(IOC)\n15 : 최유리(FOK)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 잔고정산손익내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTFO6117R", + "description": "[실전투자]\nCTFO6117R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-balance-settlement-pl?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&INQR_DT=20230906&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-balance-settlement-pl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_DT", + "value": "20230906", + "description": "조회일자(YYYYMMDD)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 총자산현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTRP6550R", + "description": "[실전투자]\nCTRP6550R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-deposit?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-deposit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 잔고평가손익내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTFO6159R", + "description": "[실전투자]\nCTFO6159R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-balance-valuation-pl?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&MGNA_DVSN=02&EXCC_STAT_CD=1&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-balance-valuation-pl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "MGNA_DVSN", + "value": "02", + "description": "증거금구분(01 : 개시, 02 : 유지) " + }, + { + "key": "EXCC_STAT_CD", + "value": "1", + "description": "정산상태코드\n1 : 정산 (정산가격으로 잔고 조회)\n2 : 본정산 (매입가격으로 잔고 조회)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션기간약정수수료일별", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTFO6119R", + "description": "[실전투자]\nCTFO6119R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-daily-amount-fee?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&INQR_STRT_DAY=20240401&INQR_END_DAY=20240625&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-daily-amount-fee" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_STRT_DAY", + "value": "20240401", + "description": "조회시작일(YYYYMMDD)" + }, + { + "key": "INQR_END_DAY", + "value": "20240625", + "description": "조회종료일(YYYYMMDD)" + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 기준일체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTFO5139R", + "description": "[실전투자]\nCTFO5139R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/inquire-ccnl-bstime?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&ORD_DT=20230920&FUOP_TR_STRT_TMD=000000&FUOP_TR_END_TMD=240000&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "inquire-ccnl-bstime" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "ORD_DT", + "value": "20230920", + "description": "주문일자(YYYYMMDD)" + }, + { + "key": "FUOP_TR_STRT_TMD", + "value": "000000", + "description": "선물옵션거래시작시간(HHMMSS) " + }, + { + "key": "FUOP_TR_END_TMD", + "value": "240000", + "description": "선물옵션거래종료시간(HHMMSS) " + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "연속조회검색조건200 " + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "연속조회키200 " + } + ] + } + }, + "response": [] + }, + { + "name": "J_(야간)선물옵션증거금상세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "JTCE6003R", + "description": "[실전투자]\nJTCE6003R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/trading/ngt-margin-detail?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=03&MGNA_DVSN_CD=01", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "trading", + "ngt-margin-detail" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "03", + "description": "계좌상품코드" + }, + { + "key": "MGNA_DVSN_CD", + "value": "01", + "description": "증거금 구분코드 - 위탁(01), 유지(02)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[국내선물옵션] 기본시세", + "item": [ + { + "name": "J_선물옵션 시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHMIF10000000", + "description": "[실전/모의투자]\nFHMIF10000000 : 선물 옵션 시세", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/inquire-price?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 시세호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHMIF10010000", + "description": "[실전/모의투자]\nFHMIF10010000 : 선물 옵션 시세 호가", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/inquire-asking-price?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-asking-price" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션기간별시세(일/주/월/년)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKIF03020100", + "description": "[실전/모의투자]\nFHKIF03020100", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/inquire-daily-fuopchartprice?fid_cond_mrkt_div_code=F&fid_input_iscd=101S09&fid_input_date_1=20220301&fid_input_date_2=20220810&fid_period_div_code=D", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-daily-fuopchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드 (F: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션)" + }, + { + "key": "fid_input_iscd", + "value": "101S09", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "fid_input_date_1", + "value": "20220301", + "description": "시작일자 (20220501) (최대100건)" + }, + { + "key": "fid_input_date_2", + "value": "20220810", + "description": "종료일자 (20220530)" + }, + { + "key": "fid_period_div_code", + "value": "D", + "description": "기간분류코드 (D:일봉, W:주봉, M:월봉, Y:년봉)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKIF03020200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/inquire-time-fuopchartprice?fid_cond_mrkt_div_code=F&fid_input_iscd=101T12&fid_hour_cls_code=60&fid_pw_data_incu_yn=Y&fid_fake_tick_incu_yn=N&fid_input_date_1=20230901&fid_input_hour_1=100000", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "inquire-time-fuopchartprice" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장분류코드\nF: 지수선물, O:지수옵션\nJF: 주식선물, JO:주식옵션,\nCF: 상품선물(금), 금리선물(국채), 통화선물(달러)\nCM: 야간선물, EU: 야간옵션" + }, + { + "key": "fid_input_iscd", + "value": "101T12", + "description": "선물옵션종목코드\n선물 6자리 (예: 101S03)\n옵션 9자리 (예: 201S03370)" + }, + { + "key": "fid_hour_cls_code", + "value": "60", + "description": "시간 구분 코드\n(30: 30초, 60: 1분, 3600: 1시간)" + }, + { + "key": "fid_pw_data_incu_yn", + "value": "Y", + "description": "과거 데이터 포함 여부\nY(과거) / N (당일)" + }, + { + "key": "fid_fake_tick_incu_yn", + "value": "N", + "description": "허봉 포함 여부(Y/N)" + }, + { + "key": "fid_input_date_1", + "value": "20230901", + "description": "입력 날짜 기준으로 이전 기간 조회(YYYYMMDD)\nex) 20230908 입력 시, 2023년 9월 8일부터 일자 역순으로 조회" + }, + { + "key": "fid_input_hour_1", + "value": "100000", + "description": "입력 시간 기준으로 이전 시간 조회(HHMMSS)\nex) 093000 입력 시, 오전 9시 30분부터 역순으로 분봉 조회\n\n* CM(야간선물), EU(야간옵션)인 경우, 자정 이후 시간은 +24시간으로 입력\nex) 253000 입력 시, 새벽 1시 30분부터 역순으로 분봉 조회" + } + ] + } + }, + "response": [] + }, + { + "name": "J_선물옵션 일중예상체결추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPIF05110100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/exp-price-trend?FID_COND_MRKT_DIV_CODE=F&FID_INPUT_ISCD=101V06", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "exp-price-trend" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "F", + "description": "시장 분류 코드 (F : 지수선물, O : 지수옵션)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "101V06", + "description": "종목번호 (지수선물:6자리, 지수옵션 9자리)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내옵션전광판_옵션월물리스트", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPIO056104C0", + "description": "[실전투자]\nFHPIO056104C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/display-board-option-list?fid_cond_scr_div_code=509&fid_cond_mrkt_div_code=&fid_cond_mrkt_cls_code=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "display-board-option-list" + ], + "query": [ + { + "key": "fid_cond_scr_div_code", + "value": "509", + "description": "화면 분류 코드(509 입력)" + }, + { + "key": "fid_cond_mrkt_div_code", + "value": "", + "description": "시장 분류 코드(공백 입력)" + }, + { + "key": "fid_cond_mrkt_cls_code", + "value": "", + "description": "시장 구분 코드(공백 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내선물 기초자산시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPIF05030000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/display-board-top?fid_cond_mrkt_div_code=F&fid_input_iscd=101V06&fid_cond_mrkt_div_code1=&fid_cond_scr_div_code=&fid_mtrt_cnt=&fid_cond_mrkt_cls_code=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "display-board-top" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "F", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "fid_input_iscd", + "value": "101V06", + "description": "옵션종목코드(ex. 101V03)" + }, + { + "key": "fid_cond_mrkt_div_code1", + "value": "", + "description": "시장 분류 코드(O 입력)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "fid_mtrt_cnt", + "value": "", + "description": "만기 수\n00000202403:0V03, 00000202404:0V04 ~" + }, + { + "key": "fid_cond_mrkt_cls_code", + "value": "", + "description": "조건 시장 구분 코드\t\n'K21':KOSPI200, 'MKI':미니KOSPI200, 'WKM':KOSPI200위클리(월), 'WKI':KOSPI200위클리(목)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내옵션전광판_콜풋", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPIF05030100", + "description": "[실전투자]\nFHPIF05030100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/display-board-callput?fid_cond_mrkt_div_code=O&fid_cond_scr_div_code=20503&fid_mrkt_cls_code=CO&fid_mtrt_cnt=202407&fid_cond_mrkt_cls_code=&fid_mrkt_cls_code1=PO", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "display-board-callput" + ], + "query": [ + { + "key": "fid_cond_mrkt_div_code", + "value": "O", + "description": "시장구분코드 (O)" + }, + { + "key": "fid_cond_scr_div_code", + "value": "20503", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "fid_mrkt_cls_code", + "value": "CO", + "description": "시장 구분 코드(CO 입력)" + }, + { + "key": "fid_mtrt_cnt", + "value": "202407", + "description": "- FID_COND_MRKT_CLS_CODE : 공백(KOSPI200), MKI(미니KOSPI200), KQI(KOSDAQ150) 인 경우\n: 만기년월(YYYYMM) 입력 (ex. 202407)\n\n- FID_COND_MRKT_CLS_CODE : WKM(KOSPI200위클리(월)), WKI(KOSPI200위클리(목)) 인 경우\n: 만기년월주차(YYMMWW) 입력\n(ex. 2024년도 7월 3주차인 경우, 240703 입력)" + }, + { + "key": "fid_cond_mrkt_cls_code", + "value": "", + "description": "조건 시장 구분 코드\n공백: KOSPI200\nMKI: 미니KOSPI200\nWKM: KOSPI200위클리(월)\nWKI: KOSPI200위클리(목)\nKQI: KOSDAQ150" + }, + { + "key": "fid_mrkt_cls_code1", + "value": "PO", + "description": "시장 구분 코드(PO 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_국내옵션전광판_선물", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHPIF05030200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-futureoption/v1/quotations/display-board-futures?FID_COND_MRKT_DIV_CODE=F&FID_COND_SCR_DIV_CODE=20503&FID_COND_MRKT_CLS_CODE=MKI", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-futureoption", + "v1", + "quotations", + "display-board-futures" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "F", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "20503", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "FID_COND_MRKT_CLS_CODE", + "value": "MKI", + "description": "시장 구분 코드\n공백: KOSPI200\nMKI: 미니KOSPI200\nWKM: KOSPI200위클리(월)\nWKI: KOSPI200위클리(목)\nKQI: KOSDAQ150" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "해외주식", + "item": [ + { + "name": "[해외주식] 주문/계좌", + "item": [ + { + "name": "J_해외주식 주문(미국)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTT1002U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"TSLA\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"900.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문(일본)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS0308U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"450.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문(상해)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + " \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS0202U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SHAA\",\r\n \"PDNO\": \"601360\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"7.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문(홍콩)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + " \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS1002U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SEHK\",\r\n \"PDNO\": \"08495\",\r\n \"ORD_QTY\": \"4000\",\r\n \"OVRS_ORD_UNPR\": \"1.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문(심천)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + " \r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS0305U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"SZAA\",\r\n \"PDNO\": \"002051\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"8.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문(베트남)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS0311U", + "description": "[실전투자]\nTTTT1002U : 미국 매수 주문\nTTTT1006U : 미국 매도 주문\nTTTS0308U : 일본 매수 주문\nTTTS0307U : 일본 매도 주문\nTTTS0202U : 상해 매수 주문\nTTTS1005U : 상해 매도 주문\nTTTS1002U : 홍콩 매수 주문\nTTTS1001U : 홍콩 매도 주문\nTTTS0305U : 심천 매수 주문\nTTTS0304U : 심천 매도 주문\nTTTS0311U : 베트남 매수 주문\nTTTS0310U : 베트남 매도 주문\n\n[모의투자]\nVTTT1002U : 미국 매수 주문\nVTTT1001U : 미국 매도 주문\nVTTS0308U : 일본 매수 주문\nVTTS0307U : 일본 매도 주문\nVTTS0202U : 상해 매수 주문\nVTTS1005U : 상해 매도 주문\nVTTS1002U : 홍콩 매수 주문\nVTTS1001U : 홍콩 매도 주문\nVTTS0305U : 심천 매수 주문\nVTTS0304U : 심천 매도 주문\nVTTS0311U : 베트남 매수 주문\nVTTS0310U : 베트남 매도 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"VND\",\r\n \"PDNO\": \"HPG\",\r\n \"ORD_QTY\": \"100\",\r\n \"OVRS_ORD_UNPR\": \"23000.0\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 정정취소주문(정정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTT1004U", + "description": "[실전투자]\nTTTT1004U : 미국 정정 취소 주문\nTTTS1003U : 홍콩 정정 취소 주문\nTTTS0309U : 일본 정정 취소 주문\nTTTS0302U : 상해 취소 주문\nTTTS0306U : 심천 취소 주문\nTTTS0312U : 베트남 취소 주문\n\n[모의투자]\nVTTT1004U : 미국 정정 취소 주문\nVTTS1003U : 홍콩 정정 취소 주문\nVTTS0309U : 일본 정정 취소 주문\nVTTS0302U : 상해 취소 주문\nVTTS0306U : 심천 취소 주문\nVTTS0312U : 베트남 취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORGN_ODNO\": \"0000006616\",\r\n \"RVSE_CNCL_DVSN_CD\": \"01\",\r\n \"ORD_QTY\": \"200\",\r\n \"OVRS_ORD_UNPR\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 정정취소주문(취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTT1004U ", + "description": "[실전투자]\nTTTT1004U : 미국 정정 취소 주문\nTTTS1003U : 홍콩 정정 취소 주문\nTTTS0309U : 일본 정정 취소 주문\nTTTS0302U : 상해 취소 주문\nTTTS0306U : 심천 취소 주문\nTTTS0312U : 베트남 취소 주문\n\n[모의투자]\nVTTT1004U : 미국 정정 취소 주문\nVTTS1003U : 홍콩 정정 취소 주문\nVTTS0309U : 일본 정정 취소 주문\nVTTS0302U : 상해 취소 주문\nVTTS0306U : 심천 취소 주문\nVTTS0312U : 베트남 취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"PDNO\": \"4689\",\r\n \"ORGN_ODNO\": \"0000006616\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORD_QTY\": \"200\",\r\n \"OVRS_ORD_UNPR\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(미국)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTT3014U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"TSLA\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"FT_ORD_QTY\": \"1\",\r\n \"FT_ORD_UNPR3\": \"900.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(일본)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3013U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"4689\",\r\n \"PRDT_TYPE_CD\": \"515\",\r\n \"OVRS_EXCG_CD\": \"TKSE\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"450.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(홍콩)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3013U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"08495\",\r\n \"PRDT_TYPE_CD\": \"501\",\r\n \"OVRS_EXCG_CD\": \"SEHK\",\r\n \"FT_ORD_QTY\": \"4000\",\r\n \"FT_ORD_UNPR3\": \"1.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(상해)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3013U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"601360\",\r\n \"PRDT_TYPE_CD\": \"551\",\r\n \"OVRS_EXCG_CD\": \"SHAA\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"7.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(심천)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3013U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"002051\",\r\n \"PRDT_TYPE_CD\": \"552\",\r\n \"OVRS_EXCG_CD\": \"SZAA\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"8.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수(베트남)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3013U", + "description": "[실전투자]\nTTTT3016U : 미국 매도 예약 주문\nTTTT3014U : 미국 매수 예약 주문\nTTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문\n\n[모의투자]\nVTTT3016U : 미국 매도 예약 주문\nVTTT3014U : 미국 매수 예약 주문\nVTTS3013U : 중국/홍콩/일본/베트남 예약 매수/매도/취소 주문", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RVSE_CNCL_DVSN_CD\": \"00\",\r\n \"PDNO\": \"HPG\",\r\n \"PRDT_TYPE_CD\": \"508\",\r\n \"OVRS_EXCG_CD\": \"HASE\",\r\n \"FT_ORD_QTY\": \"100\",\r\n \"FT_ORD_UNPR3\": \"23000.0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문접수 취소", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTT3017U", + "description": "[실전투자]\nTTTT3017U : 미국예약주문접수 취소\n\n[모의투자]\nVTTT3017U : 미국예약주문접수 취소\n(일본, 홍콩 등 타국가 개발 진행 예정)", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"RSVN_ORD_RCIT_DT\": \"20220810\",\r\n \"OVRS_RSVN_ODNO\": \"0030008244\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv-ccnl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv-ccnl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 미체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3018R ", + "description": "[실전투자]\nTTTS3018R\n\n[모의투자]\nVTTS3018R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-nccs?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=TKSE&SORT_SQN=DS&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-nccs" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "TKSE", + "description": "해외거래소코드\nNASD : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nDS : 정순\n그외 : 역순" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3012R", + "description": "[실전투자]\nTTTS3012R\n\n[모의투자]\nVTTS3012R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=NASD&TR_CRCY_CD=USD&CTX_AREA_FK200=&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "NASD", + "description": "해외거래소코드\nNASD : 미국전체\nNAS : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "TR_CRCY_CD", + "value": "USD", + "description": "거래통화코드\nUSD : 미국달러\nHKD : 홍콩달러\nCNY : 중국위안화\nJPY : 일본엔화\nVND : 베트남동" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 주문체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3035R", + "description": "[실전투자]\nTTTS3035R\n\n[모의투자]\nVTTS3035R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-ccnl?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=&ORD_STRT_DT=&ORD_END_DT=&SLL_BUY_DVSN=00&CCLD_NCCS_DVSN=00&OVRS_EXCG_CD=NASD&SORT_SQN=DS&ORD_DT=&ORD_GNO_BRNO=&ODNO=&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-ccnl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호(공백일경우 전종목)" + }, + { + "key": "ORD_STRT_DT", + "value": "", + "description": "주문시작일자(YYYYMMDD)" + }, + { + "key": "ORD_END_DT", + "value": "", + "description": "주문종료일자(YYYYMMDD)" + }, + { + "key": "SLL_BUY_DVSN", + "value": "00", + "description": "매도매수구분\n00 : 전체\n01 : 매도\n02 : 매수" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n00 : 전체\n01 : 체결\n02 : 미체결" + }, + { + "key": "OVRS_EXCG_CD", + "value": "NASD", + "description": "해외거래소코드\nNASD : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "SORT_SQN", + "value": "DS", + "description": "정렬순서\nDS : 정순\nAS : 역순" + }, + { + "key": "ORD_DT", + "value": "", + "description": "주문일자 (\"\" Null 값 설정)" + }, + { + "key": "ORD_GNO_BRNO", + "value": "", + "description": "주문채번지점번호(\"\" Null 값 설정)" + }, + { + "key": "ODNO", + "value": "", + "description": "주문번호(\"\" Null 값 설정)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 체결기준 현재잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTRP6504R", + "description": "[실전투자]\nCTRP6504R\n\n[모의투자]\nVTRP6504R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-present-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&NATN_CD=000&WCRC_FRCR_DVSN_CD=01&TR_MKET_CD=00&INQR_DVSN_CD=00", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-present-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "NATN_CD", + "value": "000", + "description": "국가코드\n000 전체\n840 미국\n344 홍콩\n156 중국\n392 일본\n704 베트남" + }, + { + "key": "WCRC_FRCR_DVSN_CD", + "value": "01", + "description": "원화외화구분코드\n01 : 원화\n02 : 외화" + }, + { + "key": "TR_MKET_CD", + "value": "00", + "description": "거래시장코드\n[Request body NATN_CD 000 설정]\n00 : 전체\n[Request body NATN_CD 840 설정]\n00 : 전체\n01 : 나스닥(NASD)\n02 : 뉴욕거래소(NYSE)\n03 : 미국(PINK SHEETS)\n04 : 미국(OTCBB)\n05 : 아멕스(AMEX)\n[Request body NATN_CD 156 설정]\n00 : 전체\n01 : 상해B\n02 : 심천B\n03 : 상해A\n04 : 심천A\n[Request body NATN_CD 392 설정]\n01 : 일본\n[Request body NATN_CD 704 설정]\n01 : 하노이거래\n02 : 호치민거래소\n[Request body NATN_CD 344 설정]\n01 : 홍콩\n02 : 홍콩CNY\n03 : 홍콩USD" + }, + { + "key": "INQR_DVSN_CD", + "value": "00", + "description": "조회구분코드\n00 : 전체\n01 : 일반해외주식\n02 : 미니스탁" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 예약주문조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3014R", + "description": "[실전투자]\nTTTS3014R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/order-resv-list?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&INQR_STRT_DT=20220809&INQR_END_DT=20220830&INQR_DVSN_CD=00&PRDT_TYPE_CD=512&OVRS_EXCG_CD=NASD&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "order-resv-list" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_STRT_DT", + "value": "20220809", + "description": "조회시작일자(YYYYMMDD)" + }, + { + "key": "INQR_END_DT", + "value": "20220830", + "description": "조회종료일자(YYYYMMDD)" + }, + { + "key": "INQR_DVSN_CD", + "value": "00", + "description": "조회구분코드\n00 : 전체\n01 : 일반해외주식\n02 : 미니스탁" + }, + { + "key": "PRDT_TYPE_CD", + "value": "512", + "description": "상품유형코드\n512 : 미국 나스닥 / 513 : 미국 뉴욕거래소 / 529 : 미국 아멕스\n515 : 일본\n501 : 홍콩 / 543 : 홍콩CNY / 558 : 홍콩USD\n507 : 베트남 하노이거래소 / 508 : 베트남 호치민거래소\n551 : 중국 상해A / 552 : 중국 심천A" + }, + { + "key": "OVRS_EXCG_CD", + "value": "NASD", + "description": "해외거래소코드\nNASD : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSHAA : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 베트남 하노이\nVNSE : 베트남 호치민" + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK100값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK100값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 매수가능금액조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3007R", + "description": "[실전투자]\nTTTS3007R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-psamount?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=NASD&OVRS_ORD_UNPR=1.4&ITEM_CD=TRVG", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-psamount" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "NASD", + "description": "해외거래소코드\nNASD : 나스닥 / NYSE : 뉴욕 / AMEX : 아멕스\nSEHK : 홍콩 / SHAA : 중국상해 / SZAA : 중국심천\nTKSE : 일본 / HASE : 하노이거래소 / VNSE : 호치민거래소" + }, + { + "key": "OVRS_ORD_UNPR", + "value": "1.4", + "description": "해외주문단가 (23.8) 정수부분 23자리, 소수부분 8자리" + }, + { + "key": "ITEM_CD", + "value": "TRVG", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 미국주간주문(매수)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS6036U", + "description": "[실전투자]\n미국주간매수 : TTTS6036U\n미국주간매도 : TTTS6037U", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"DLPN\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"0.8\",\r\n\t\"CTAC_TLNO\": \"\",\r\n\t\"MGCO_APTM_ODNO\": \"\",\r\n\t\"ORD_SVR_DVSN_CD\": \"0\",\r\n\t\"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/daytime-order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "daytime-order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 미국주간주문(매도)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS6037U", + "description": "[실전투자]\n미국주간매수 : TTTS6036U\n미국주간매도 : TTTS6037U", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"GRAB\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"2.86\",\r\n\t\"CTAC_TLNO\": \"\",\r\n\t\"MGCO_APTM_ODNO\": \"\",\r\n\t\"ORD_SVR_DVSN_CD\": \"0\",\r\n\t\"ORD_DVSN\": \"00\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/daytime-order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "daytime-order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 미국주간정정취소(정정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS6038U", + "description": "[실전투자]\n미국주간 정정취소 : TTTS6038U", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "default", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"DLPN\",\r\n \"ORGN_ODNO\": \"14\",\r\n \"RVSE_CNCL_DVSN_CD\": \"01\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"1.9\",\r\n \"CTAC_TLNO\": \"\",\r\n\t\"MGCO_APTM_ODNO\": \"\",\r\n\t\"ORD_SVR_DVSN_CD\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "daytime-order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 미국주간정정취소(취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROD_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROD_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROD_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS6038U", + "description": "[실전투자]\n미국주간 정정취소 : TTTS6038U", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROD_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"OVRS_EXCG_CD\": \"NASD\",\r\n \"PDNO\": \"DLPN\",\r\n \"ORGN_ODNO\": \"169\",\r\n \"RVSE_CNCL_DVSN_CD\": \"02\",\r\n \"ORD_QTY\": \"1\",\r\n \"OVRS_ORD_UNPR\": \"1.9\",\r\n \"CTAC_TLNO\": \"\",\r\n\t\"MGCO_APTM_ODNO\": \"\",\r\n\t\"ORD_SVR_DVSN_CD\": \"0\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/daytime-order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "daytime-order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 기간손익", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTS3039R", + "description": "TTTS3039R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-period-profit?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&OVRS_EXCG_CD=NASD&NATN_CD=&CRCY_CD=USD&PDNO=&INQR_STRT_DT=20231001&INQR_END_DT=20231023&WCRC_FRCR_DVSN_CD=01&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-period-profit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_EXCG_CD", + "value": "NASD", + "description": "해외거래소코드\n공란 : 전체 \nNASD : 미국전체\nNAS : 나스닥\nNYSE : 뉴욕\nAMEX : 아멕스\nSEHK : 홍콩\nSEHK : 중국상해\nSZAA : 중국심천\nTKSE : 일본\nHASE : 하노이거래소\nVNSE : 호치민거래소\n" + }, + { + "key": "NATN_CD", + "value": "", + "description": "국가코드\n공란 : 전체\n840 미국\n344 홍콩\n156 중국\n392 일본\n704 베트남" + }, + { + "key": "CRCY_CD", + "value": "USD", + "description": "통화코드\nUSD : 미국달러\nHKD : 홍콩달러\nCNY : 중국위안화\nJPY : 일본엔화\nVND : 베트남동" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호" + }, + { + "key": "INQR_STRT_DT", + "value": "20231001", + "description": "조회시작일자(YYYYMMDD)" + }, + { + "key": "INQR_END_DT", + "value": "20231023", + "description": "조회종료일자(YYYYMMDD)" + }, + { + "key": "WCRC_FRCR_DVSN_CD", + "value": "01", + "description": "원화외화구분코드\n01 : 외화\n02 : 원화" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_FK200값 : 다음페이지 조회시(2번째부터)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "공란 : 최초 조회시\n이전 조회 Output CTX_AREA_NK200값 : 다음페이지 조회시(2번째부터)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외증거금 통화별조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC2101R", + "description": "[실전투자]\nTTTC2101R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/foreign-margin?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "foreign-margin" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호 8자리 " + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드 2자리 " + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 일별거래내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTOS4001R", + "description": "[실전투자]\nCTOS4001R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-period-trans?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&ERLM_STRT_DT=20240101&ERLM_END_DT=20240625&OVRS_EXCG_CD=&PDNO=&SLL_BUY_DVSN_CD=00&LOAN_DVSN_CD=&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-period-trans" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "ERLM_STRT_DT", + "value": "20240101", + "description": "입력날짜 ~ (ex) 20240420)" + }, + { + "key": "ERLM_END_DT", + "value": "20240625", + "description": "~입력날짜 (ex) 20240520)" + }, + { + "key": "OVRS_EXCG_CD", + "value": "", + "description": "해외거래소코드 - 공백 (전체조회)," + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호 - 공백 (전체조회), 개별종목 조회는 상품번호입력" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "00", + "description": "매도매수구분코드 - 00(전체), 01(매도), 02(매수) " + }, + { + "key": "LOAN_DVSN_CD", + "value": "", + "description": "대출구분코드(공백 입력) " + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 결제기준잔고", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTRP6010R", + "description": "[실전투자]\nCTRP6010R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/trading/inquire-paymt-stdr-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&BASS_DT=20240625&WCRC_FRCR_DVSN_CD=01&INQR_DVSN_CD=00", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "trading", + "inquire-paymt-stdr-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "BASS_DT", + "value": "20240625", + "description": "기준일자" + }, + { + "key": "WCRC_FRCR_DVSN_CD", + "value": "01", + "description": "원화외화구분코드 - 01(원화기준),02(외화기준) " + }, + { + "key": "INQR_DVSN_CD", + "value": "00", + "description": "조회구분코드 - 00(전체), 01(일반), 02(미니스탁) " + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[해외주식] 기본시세", + "item": [ + { + "name": "J_해외주식 현재체결가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS00000300", + "description": "[실전투자/모의투자]\nHHDFS00000300", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/price?AUTH=&EXCD=NAS&SYMB=AAPL", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "price" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "AAPL", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 기간별시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS76240000", + "description": "[실전투자/모의투자]\nHHDFS76240000", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/dailyprice?AUTH=&EXCD=NAS&SYMB=AAPL&GUBN=0&BYMD=&MODP=1", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "dailyprice" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "AAPL", + "description": "종목코드" + }, + { + "key": "GUBN", + "value": "0", + "description": "일/주/월구분\n0 : 일\n1 : 주\n2 : 월" + }, + { + "key": "BYMD", + "value": "", + "description": "조회기준일자(YYYYMMDD)\n※ 공란 설정 시, 기준일 오늘 날짜로 설정" + }, + { + "key": "MODP", + "value": "1", + "description": "수정주가반영여부\n0 : 미반영\n1 : 반영" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 종목/지수/환율기간별시세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03030100", + "description": "[실전투자/모의투자]\nFHKST03030100", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/inquire-daily-chartprice?FID_COND_MRKT_DIV_CODE=N&FID_INPUT_ISCD=QQQ&FID_INPUT_DATE_1=20220531&FID_INPUT_DATE_2=20220731&FID_PERIOD_DIV_CODE=D", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-daily-chartprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "N", + "description": "시장분류코드(N: 해외지수, X: 환율. I: 국채, S: 금선물)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "QQQ", + "description": "종목코드\n※ 해외주식 마스터 코드 참조 \n(포럼 > FAQ > 종목정보 다운로드 > 해외주식)" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "20220531", + "description": "시작일자(YYYYMMDD)" + }, + { + "key": "FID_INPUT_DATE_2", + "value": "20220731", + "description": "종료일자(YYYYMMDD)" + }, + { + "key": "FID_PERIOD_DIV_CODE", + "value": "D", + "description": "기간분류코드(D:일, W:주, M:월, Y:년)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 조건검색", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS76410000", + "description": "[실전투자/모의투자]\nHHDFS76410000", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/inquire-search?AUTH=&EXCD=NAS&CO_YN_PRICECUR=1&CO_ST_PRICECUR=160&CO_EN_PRICECUR=170&CO_YN_RATE=&CO_ST_RATE=&CO_EN_RATE=&CO_YN_VALX=&CO_ST_VALX=&CO_EN_VALX=&CO_YN_SHAR=&CO_ST_SHAR=&CO_EN_SHAR=&CO_YN_VOLUME=&CO_ST_VOLUME=&CO_EN_VOLUME=&CO_YN_AMT=&CO_ST_AMT=&CO_EN_AMT=&CO_YN_EPS=&CO_ST_EPS=&CO_EN_EPS=&CO_YN_PER=&CO_ST_PER=&CO_EN_PER=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-search" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nNYS : 뉴욕, NAS : 나스닥, AMS : 아멕스\nHKS : 홍콩, SHS : 상해 , SZS : 심천\nHSX : 호치민, HNX : 하노이\nTSE : 도쿄" + }, + { + "key": "CO_YN_PRICECUR", + "value": "1", + "description": "현재가선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_PRICECUR", + "value": "160", + "description": "현재가시작범위가" + }, + { + "key": "CO_EN_PRICECUR", + "value": "170", + "description": "현재가끝범위가" + }, + { + "key": "CO_YN_RATE", + "value": "", + "description": "등락율선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_RATE", + "value": "", + "description": "등락율시작율" + }, + { + "key": "CO_EN_RATE", + "value": "", + "description": "등락율끝율" + }, + { + "key": "CO_YN_VALX", + "value": "", + "description": "시가총액선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_VALX", + "value": "", + "description": "시가총액시작액" + }, + { + "key": "CO_EN_VALX", + "value": "", + "description": "시가총액끝액" + }, + { + "key": "CO_YN_SHAR", + "value": "", + "description": "발행주식수선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_SHAR", + "value": "", + "description": "발행주식시작수" + }, + { + "key": "CO_EN_SHAR", + "value": "", + "description": "발행주식끝수" + }, + { + "key": "CO_YN_VOLUME", + "value": "", + "description": "거래량선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_VOLUME", + "value": "", + "description": "거래량시작량" + }, + { + "key": "CO_EN_VOLUME", + "value": "", + "description": "거래량끝량" + }, + { + "key": "CO_YN_AMT", + "value": "", + "description": "거래대금선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_AMT", + "value": "", + "description": "거래대금시작금" + }, + { + "key": "CO_EN_AMT", + "value": "", + "description": "거래대금끝금" + }, + { + "key": "CO_YN_EPS", + "value": "", + "description": "EPS선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_EPS", + "value": "", + "description": "EPS시작" + }, + { + "key": "CO_EN_EPS", + "value": "", + "description": "EPS끝" + }, + { + "key": "CO_YN_PER", + "value": "", + "description": "PER선택조건\n해당조건 사용시(1), 미사용시 필수항목아님" + }, + { + "key": "CO_ST_PER", + "value": "", + "description": "PER시작" + }, + { + "key": "CO_EN_PER", + "value": "", + "description": "PER끝" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외결제일자조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTOS5011R", + "description": "[실전투자]\nCTOS5011R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-stock/v1/quotations/countries-holiday?TRAD_DT=20230512&CTX_AREA_NK=&CTX_AREA_FK=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-stock", + "v1", + "quotations", + "countries-holiday" + ], + "query": [ + { + "key": "TRAD_DT", + "value": "20230512", + "description": "기준일자(YYYYMMDD) " + }, + { + "key": "CTX_AREA_NK", + "value": "", + "description": "연속조회키(공백으로 입력) " + }, + { + "key": "CTX_AREA_FK", + "value": "", + "description": "연속조회검색조건(공백으로 입력) " + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 현재가상세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS76200200", + "description": "[실전투자/모의투자]\nHHDFS00000300", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/price-detail?AUTH=&EXCD=NAS&SYMB=AAPL", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "price-detail" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보\n\"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "AAPL", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS76950200", + "description": "[실전투자]\nHHDFS76950200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice?AUTH=&EXCD=NAS&SYMB=TSLA&NMIN=5&PINC=1&NEXT=&NREC=120&FILL=&KEYB=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-time-itemchartprice" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보 \"\" (Null 값 설정)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드 \nNYS : 뉴욕, NAS : 나스닥, AMS : 아멕스\nHKS : 홍콩, SHS : 상해 , \nSZS : 심천 HSX : 호치민, \nHNX : 하노이 TSE : 도쿄" + }, + { + "key": "SYMB", + "value": "TSLA", + "description": "종목코드(ex. TSLA)" + }, + { + "key": "NMIN", + "value": "5", + "description": "분갭(1: 1분봉, 2: 2분봉, ...)" + }, + { + "key": "PINC", + "value": "1", + "description": "전일포함여부(0:당일 1:전일포함)" + }, + { + "key": "NEXT", + "value": "", + "description": "다음여부 \"\"(Null 값 설정)" + }, + { + "key": "NREC", + "value": "120", + "description": "레코드요청갯수(최대 120)" + }, + { + "key": "FILL", + "value": "", + "description": "미체결채움구분 \"\"(Null 값 설정)" + }, + { + "key": "KEYB", + "value": "", + "description": "NEXT KEY BUFF \"\"(Null 값 설정)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외지수분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST03030200", + "description": "[실전투자]\nFHKST03030200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/inquire-time-indexchartprice?FID_COND_MRKT_DIV_CODE=N&FID_INPUT_ISCD=SPX&FID_HOUR_CLS_CODE=0&FID_PW_DATA_INCU_YN=Y", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-time-indexchartprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "N", + "description": "시장분류코드(N:해외지수 X:환율 KX:원화환율)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "SPX", + "description": "종목코드(ex. .DJI)" + }, + { + "key": "FID_HOUR_CLS_CODE", + "value": "0", + "description": "시간구분코드(0:정규장 1:시간외)" + }, + { + "key": "FID_PW_DATA_INCU_YN", + "value": "Y", + "description": "과거데이터포함여부(Y/N)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 상품기본정보", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF1702R", + "description": "[실전투자]\nCTPF1702R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/search-info?PDNO=AAPL&PRDT_TYPE_CD=512", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "search-info" + ], + "query": [ + { + "key": "PDNO", + "value": "AAPL", + "description": "종목코드 (ex. AAPL)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "512", + "description": "상품유형코드\n512 미국 나스닥 / 513 미국 뉴욕 / 529 미국 아멕스\n515 일본\n501 홍콩 / 543 홍콩CNY / 558 홍콩USD\n507 베트남 하노이 / 508 베트남 호치민\n551 중국 상해A / 552 중국 심천A" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 현재가 10호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS76200100", + "description": "[실전투자]\nHHDFS76200100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/inquire-asking-price?AUTH=&EXCD=NAS&SYMB=TSLA", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "inquire-asking-price" + ], + "query": [ + { + "key": "AUTH", + "value": "", + "description": "사용자권한정보(공백 입력)" + }, + { + "key": "EXCD", + "value": "NAS", + "description": "거래소코드\nHKS : 홍콩\nNYS : 뉴욕\nNAS : 나스닥\nAMS : 아멕스\nTSE : 도쿄\nSHS : 상해\nSZS : 심천\nSHI : 상해지수\nSZI : 심천지수\nHSX : 호치민\nHNX : 하노이" + }, + { + "key": "SYMB", + "value": "TSLA", + "description": "종목코드(ex. TSLA)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[해외주식] 시세분석", + "item": [ + { + "name": "J_해외주식 기간별권리조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTRGT011R", + "description": "[실전투자]\nCTRGT011R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/period-rights?RGHT_TYPE_CD=%%&INQR_DVSN_CD=02&INQR_STRT_DT=20240417&INQR_END_DT=20240417&PDNO=&PRDT_TYPE_CD=&CTX_AREA_NK50=&CTX_AREA_FK50=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "period-rights" + ], + "query": [ + { + "key": "RGHT_TYPE_CD", + "value": "%%", + "description": "권리유형코드 : %%(전체), 01(유상), 02(무상), 03(배당), 11(합병), 14(액면분할), 15(액면병합), 17(감자), 54(WR청구), 61(원리금상환), 71(WR소멸), 74(배당옵션), 75(특별배당), 76(ISINCODE변경), 77(실권주청약)" + }, + { + "key": "INQR_DVSN_CD", + "value": "02", + "description": "조회구분코드 : 02(현지기준일), 03(청약시작일), 04(청약종료일)" + }, + { + "key": "INQR_STRT_DT", + "value": "20240417", + "description": "조회시작일자" + }, + { + "key": "INQR_END_DT", + "value": "20240417", + "description": "조회종료일자" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호" + }, + { + "key": "PRDT_TYPE_CD", + "value": "", + "description": "상품유형코드" + }, + { + "key": "CTX_AREA_NK50", + "value": "", + "description": "연속조회키50" + }, + { + "key": "CTX_AREA_FK50", + "value": "", + "description": "연속조회검색조건50" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외뉴스종합(제목)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHPSTH60100C1", + "description": "[실전투자]\nHHPSTH60100C1", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/news-title?INFO_GB=&CLASS_CD=&NATION_CD=&EXCHANGE_CD=&SYMB=&DATA_DT=&DATA_TM=&CTS=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "news-title" + ], + "query": [ + { + "key": "INFO_GB", + "value": "", + "description": "뉴스구분(전체: 공백)" + }, + { + "key": "CLASS_CD", + "value": "", + "description": "중분류(전체: 공백)" + }, + { + "key": "NATION_CD", + "value": "", + "description": "국가코드(전체: 공백)\nCN(중국), HK(홍콩), US(미국)" + }, + { + "key": "EXCHANGE_CD", + "value": "", + "description": "거래소코드" + }, + { + "key": "SYMB", + "value": "", + "description": "종목코드(전체: 공백)" + }, + { + "key": "DATA_DT", + "value": "", + "description": "조회일자(전체: 공백, ex.20240502)" + }, + { + "key": "DATA_TM", + "value": "", + "description": "조회시간(전체: 공백, ex. 135524)" + }, + { + "key": "CTS", + "value": "", + "description": "조회일자(공백 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외주식 권리종합", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFS78330900", + "description": "[실전투자]\nHHDFS78330900", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/rights-by-ice?NCOD=US&SYMB=MAIN&ST_YMD=20240309&ED_YMD=20240801", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "rights-by-ice" + ], + "query": [ + { + "key": "NCOD", + "value": "US", + "description": "조회구분(1(코스피), 2(코스닥), 3(종목))" + }, + { + "key": "SYMB", + "value": "MAIN", + "description": "종목코드(ex. 005930)" + }, + { + "key": "ST_YMD", + "value": "20240309", + "description": "조회시작일시(YYYYMMDD)" + }, + { + "key": "ED_YMD", + "value": "20240801", + "description": "조회종료일시(YYYYMMDD)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_당사 해외주식담보대출 가능 종목", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTLN4050R", + "description": "[실전투자]\nCTLN4050R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/colable-by-company?PDNO=AMD&PRDT_TYPE_CD=&INQR_STRT_DT=&INQR_END_DT=&INQR_DVSN=&NATN_CD=840&INQR_SQN_DVSN=02&RT_DVSN_CD=&RT=&LOAN_PSBL_YN=&CTX_AREA_FK100=&CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "colable-by-company" + ], + "query": [ + { + "key": "PDNO", + "value": "AMD", + "description": "상품번호(ex) AMD)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "", + "description": "공백 입력 " + }, + { + "key": "INQR_STRT_DT", + "value": "", + "description": "공백 입력 " + }, + { + "key": "INQR_END_DT", + "value": "", + "description": "공백 입력" + }, + { + "key": "INQR_DVSN", + "value": "", + "description": "공백 입력" + }, + { + "key": "NATN_CD", + "value": "840", + "description": "국가코드 - 840(미국), 344(홍콩), 156(중국)" + }, + { + "key": "INQR_SQN_DVSN", + "value": "02", + "description": "조회순서구분 - 01(이름순), 02(코드순)" + }, + { + "key": "RT_DVSN_CD", + "value": "", + "description": "공백 입력" + }, + { + "key": "RT", + "value": "", + "description": "공백 입력" + }, + { + "key": "LOAN_PSBL_YN", + "value": "", + "description": "공백 입력" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "공백 입력" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "공백 입력" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외속보(제목)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKST01011801", + "description": "[실전투자]\nFHKST01011801", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-price/v1/quotations/brknews-title?FID_NEWS_OFER_ENTP_CODE=0&FID_COND_MRKT_CLS_CODE=00&FID_INPUT_ISCD=&FID_TITL_CNTT=&FID_INPUT_DATE_1=&FID_INPUT_HOUR_1=&FID_RANK_SORT_CLS_CODE=&FID_INPUT_SRNO=&FID_COND_SCR_DIV_CODE=11801", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-price", + "v1", + "quotations", + "brknews-title" + ], + "query": [ + { + "key": "FID_NEWS_OFER_ENTP_CODE", + "value": "0", + "description": "뉴스제공업체구분(0:전체조회) " + }, + { + "key": "FID_COND_MRKT_CLS_CODE", + "value": "00", + "description": "공백 입력 " + }, + { + "key": "FID_INPUT_ISCD", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_TITL_CNTT", + "value": "", + "description": "공백 입력" + }, + { + "key": "FID_INPUT_DATE_1", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_INPUT_HOUR_1", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_RANK_SORT_CLS_CODE", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_INPUT_SRNO", + "value": "", + "description": "공백 입력 " + }, + { + "key": "FID_COND_SCR_DIV_CODE", + "value": "11801", + "description": "화면분류코드(11801 입력)" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "해외선물옵션", + "item": [ + { + "name": "[해외선물옵션] 주문/계좌", + "item": [ + { + "name": "J_해외선물옵션 주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROT_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3001U", + "description": "[실전투자]\nOTFM3001U : ASFM선물옵션주문신규", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROT_HASH}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL_T}}\",\r\n \"ACNT_PRDT_CD\": \"08\",\r\n \"OVRS_FUTR_FX_PDNO\": \"6BZ22\",\r\n \"SLL_BUY_DVSN_CD\": \"02\",\r\n \"FM_LQD_USTL_CCLD_DT\": \"\",\r\n \"FM_LQD_USTL_CCNO\": \"\",\r\n \"PRIC_DVSN_CD\": \"1\",\r\n \"FM_LIMIT_ORD_PRIC\": \"1.17\",\r\n \"FM_STOP_ORD_PRIC\": \"\",\r\n \"FM_ORD_QTY\": \"1\",\r\n \"FM_LQD_LMT_ORD_PRIC\": \"\",\r\n \"FM_LQD_STOP_ORD_PRIC\": \"\",\r\n \"CCLD_CNDT_CD\": \"6\",\r\n \"CPLX_ORD_DVSN_CD\": \"0\",\r\n \"ECIS_RSVN_ORD_YN\": \"N\",\r\n \"FM_HDGE_ORD_SCRN_YN\": \"N\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/order", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "order" + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 정정취소주문(정정)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROT_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3002U", + "description": "[실전투자]\nOTFM3002U : 해외선물옵션주문정정\nOTFM3003U : 해외선물옵션주문취소", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROT_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL_T}}\",\r\n \"ACNT_PRDT_CD\": \"08\",\r\n \"ORGN_ORD_DT\": \"20220719\",\r\n \"ORGN_ODNO\": \"00281045\",\r\n \"FM_LIMIT_ORD_PRIC\": \"1.185\",\r\n \"FM_STOP_ORD_PRIC\": \"\",\r\n \"FM_LQD_LMT_ORD_PRIC\": \"\",\r\n \"FM_LQD_STOP_ORD_PRIC\": \"\",\r\n \"FM_HDGE_ORD_SCRN_YN\": \"N\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 정정취소주문(취소)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: pm.environment.get('PROD')+'/uapi/hashkey',\r", + " method: 'POST',\r", + " header: {\r", + " 'Content-Type': 'application/json',\r", + " 'appKey': pm.environment.get('PROT_APPKEY'),\r", + " 'appSecret': pm.environment.get('PROT_APPSECRET')\r", + " },\r", + " body: {mode: 'raw', raw: request.data}\r", + " \r", + "}, function (err, res) {\r", + " res_data = res.json();\r", + " console.log(res_data);\r", + "\r", + " // 환경변수 값 세팅 \r", + " pm.environment.set(\"PROT_HASH\", res.json().HASH);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3003U", + "description": "[실전투자]\nOTFM3002U : 해외선물옵션주문정정\nOTFM3003U : 해외선물옵션주문취소", + "type": "text" + }, + { + "key": "hashkey", + "value": "{{PROT_HASH}}", + "description": "[POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값\n* API문서 > hashkey 참조", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL_T}}\",\r\n \"ACNT_PRDT_CD\": \"08\",\r\n \"ORGN_ORD_DT\": \"20220719\",\r\n \"ORGN_ODNO\": \"00281047\",\r\n \"FM_MKPR_CVSN_YN\": \"N\",\r\n \"FM_HDGE_ORD_SCRN_YN\": \"N\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 당일주문내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3116R", + "description": "[실전투자]\nOTFM3116R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-ccld?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&CCLD_NCCS_DVSN=01&SLL_BUY_DVSN_CD=02&FUOP_DVSN=02&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "01", + "description": "체결미체결구분(01:전체 / 02:체결 / 03:미체결)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "02", + "description": "매도매수구분코드(01:매도 / 02:매수)" + }, + { + "key": "FUOP_DVSN", + "value": "02", + "description": "선물옵션구분(00:전체 / 01:선물 / 02:옵션)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 미결제내역조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM1412R", + "description": "[실전투자]\nOTFM1412R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-unpd?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&FUOP_DVSN=00&CTX_AREA_FK100= &CTX_AREA_NK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-unpd" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "FUOP_DVSN", + "value": "00", + "description": "선물옵션구분(00: 전체 / 01:선물 / 02: 옵션)" + }, + { + "key": "CTX_AREA_FK100", + "value": " ", + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": "", + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 주문가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3304R", + "description": "[실전투자]\nOTFM3304R", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-psamount?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&OVRS_FUTR_FX_PDNO=6AU22&SLL_BUY_DVSN_CD=02&FM_ORD_PRIC=&ECIS_RSVN_ORD_YN=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-psamount" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "OVRS_FUTR_FX_PDNO", + "value": "6AU22", + "description": "해외선물FX상품번호" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "02", + "description": "매도매수구분코드(01 : 매도 / 02 : 매수)" + }, + { + "key": "FM_ORD_PRIC", + "value": "", + "description": "FM주문가격" + }, + { + "key": "ECIS_RSVN_ORD_YN", + "value": "", + "description": "행사예약주문여부" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 기간계좌손익 일별 Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3118R", + "description": "[실전투자]\nOTFM3118R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-period-ccld?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&INQR_TERM_FROM_DT=20220901&INQR_TERM_TO_DT=20221117&CRCY_CD=%%%&WHOL_TRSL_YN=N&FUOP_DVSN=00&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-period-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "INQR_TERM_FROM_DT", + "value": "20220901", + "description": "조회기간FROM일자(YYYYMMDD)" + }, + { + "key": "INQR_TERM_TO_DT", + "value": "20221117", + "description": "조회기간TO일자(YYYYMMDD)" + }, + { + "key": "CRCY_CD", + "value": "%%%", + "description": "통화코드\n%%% : 전체\nTUS: TOT_USD / TKR: TOT_KRW\nKRW: 한국 / USD: 미국\nEUR: EUR / HKD: 홍콩\nCNY: 중국 / JPY: 일본\nVND: 베트남" + }, + { + "key": "WHOL_TRSL_YN", + "value": "N", + "description": "전체환산여부(N)" + }, + { + "key": "FUOP_DVSN", + "value": "00", + "description": "선물옵션구분\n00:전체 / 01:선물 / 02:옵션" + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "연속조회키100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 일별체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3122R", + "description": "[실전투자]\nOTFM3122R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-daily-ccld?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&STRT_DT=20221117&END_DT=20221117&FUOP_DVSN_CD=00&FM_PDGR_CD=&CRCY_CD=%%%&FM_ITEM_FTNG_YN=N&SLL_BUY_DVSN_CD=%%&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-daily-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "STRT_DT", + "value": "20221117", + "description": "시작일자(YYYYMMDD)" + }, + { + "key": "END_DT", + "value": "20221117", + "description": "종료일자(YYYYMMDD)" + }, + { + "key": "FUOP_DVSN_CD", + "value": "00", + "description": "선물옵션구분코드\n00:전체 / 01:선물 / 02:옵션" + }, + { + "key": "FM_PDGR_CD", + "value": "", + "description": "FM상품군코드\n공란(Default)" + }, + { + "key": "CRCY_CD", + "value": "%%%", + "description": "통화코드\n%%% : 전체\nTUS: TOT_USD / TKR: TOT_KRW\nKRW: 한국 / USD: 미국\nEUR: EUR / HKD: 홍콩\nCNY: 중국 / JPY: 일본\nVND: 베트남" + }, + { + "key": "FM_ITEM_FTNG_YN", + "value": "N", + "description": "FM종목합산여부\nN" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "%%", + "description": "매도매수구분코드\n%%: 전체 / 01 : 매도 / 02 : 매수" + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 예수금현황", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM1411R", + "description": "[실전투자]\nOTFM1411R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-deposit?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&CRCY_CD=%%%&INQR_DT=20221117", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-deposit" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "CRCY_CD", + "value": "%%%", + "description": "통화코드\n%%% : 전체\nTUS: TOT_USD / TKR: TOT_KRW\nKRW: 한국 / USD: 미국\nEUR: EUR / HKD: 홍콩\nCNY: 중국 / JPY: 일본\nVND: 베트남" + }, + { + "key": "INQR_DT", + "value": "20221117", + "description": "조회일자(YYYYMMDD)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 일별 주문내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3120R", + "description": "[실전투자]\nOTFM3120R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-daily-order?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&STRT_DT=20220801&END_DT=20221117&FM_PDGR_CD=&CCLD_NCCS_DVSN=00&SLL_BUY_DVSN_CD=%%&FUOP_DVSN=00&CTX_AREA_FK200&CTX_AREA_NK200", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-daily-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "STRT_DT", + "value": "20220801", + "description": "시작일자(YYYYMMDD)" + }, + { + "key": "END_DT", + "value": "20221117", + "description": "종료일자(YYYYMMDD)" + }, + { + "key": "FM_PDGR_CD", + "value": "", + "description": "FM상품군코드\n공란(Default)" + }, + { + "key": "CCLD_NCCS_DVSN", + "value": "00", + "description": "체결미체결구분\n01:전체 / 02:체결 / 03:미체결" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "%%", + "description": "매도매수구분코드\n%%: 전체 / 01 : 매도 / 02 : 매수" + }, + { + "key": "FUOP_DVSN", + "value": "00", + "description": "선물옵션구분코드\n00:전체 / 01:선물 / 02:옵션" + }, + { + "key": "CTX_AREA_FK200", + "value": null, + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": null, + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 기간계좌거래내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3114R", + "description": "[실전투자]\nOTFM3114R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/inquire-period-trans?INQR_TERM_FROM_DT=20220801&INQR_TERM_TO_DT=20221117&CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&ACNT_TR_TYPE_CD=1&CRCY_CD=%%%&CTX_AREA_FK100&CTX_AREA_NK100&PWD_CHK_YN=N", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "inquire-period-trans" + ], + "query": [ + { + "key": "INQR_TERM_FROM_DT", + "value": "20220801", + "description": "조회기간FROM일자(YYYYMMDD)" + }, + { + "key": "INQR_TERM_TO_DT", + "value": "20221117", + "description": "조회기간TO일자(YYYYMMDD)" + }, + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "계좌번호 체계(8-2)의 앞 8자리" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌번호 체계(8-2)의 뒤 2자리" + }, + { + "key": "ACNT_TR_TYPE_CD", + "value": "1", + "description": "계좌거래유형코드" + }, + { + "key": "CRCY_CD", + "value": "%%%", + "description": "통화코드\n%%% : 전체\nTUS: TOT_USD / TKR: TOT_KRW\nKRW: 한국 / USD: 미국\nEUR: EUR / HKD: 홍콩\nCNY: 중국 / JPY: 일본\nVND: 베트남" + }, + { + "key": "CTX_AREA_FK100", + "value": null, + "description": "연속조회검색조건100" + }, + { + "key": "CTX_AREA_NK100", + "value": null, + "description": "연속조회키100" + }, + { + "key": "PWD_CHK_YN", + "value": "N", + "description": "비밀번호체크여부(Y/N)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물옵션 증거금상세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM3115R", + "description": "[실전투자]\nOTFM3115R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/trading/margin-detail?CANO={{CANO_REAL_T}}&ACNT_PRDT_CD=08&CRCY_CD=TKR&INQR_DT=20240625", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "trading", + "margin-detail" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL_T}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "08", + "description": "계좌상품코드" + }, + { + "key": "CRCY_CD", + "value": "TKR", + "description": "통화코드 - TKR(TOT_KRW), TUS(TOT_USD), \nUSD(미국달러), HKD(홍콩달러),\nCNY(중국위안화), JPY )일본엔화), VND(베트남동)" + }, + { + "key": "INQR_DT", + "value": "20240625", + "description": "조회일자(YYYYMMDD)" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[해외선물옵션] 기본시세", + "item": [ + { + "name": "J_해외선물종목상세", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55010100", + "description": "[실전투자]\nHHDFC55010100", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/stock-detail?SRS_CD=DXM24", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "stock-detail" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물종목현재가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55010000", + "description": "[실전/모의투자]\nHHDFC55010000", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/inquire-price?SRS_CD=DXM24", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물분봉조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55020400", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice?SRS_CD=DXM24&EXCH_CD=ICE&START_DATE_TIME=&CLOSE_DATE_TIME=20240426&QRY_TP=&QRY_CNT=120&QRY_GAP=1&INDEX_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "inquire-time-futurechartprice" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "종목코드 \t(ex. 6AZ23)" + }, + { + "key": "EXCH_CD", + "value": "ICE", + "description": "거래소코드 (ex. CME)" + }, + { + "key": "START_DATE_TIME", + "value": "", + "description": "사용하지 않는 인자값\n공란 입력 (\"\")" + }, + { + "key": "CLOSE_DATE_TIME", + "value": "20240426", + "description": "조회일자 입력 (ex. \"20231214\")" + }, + { + "key": "QRY_TP", + "value": "", + "description": "공란 입력 (\"\")" + }, + { + "key": "QRY_CNT", + "value": "120", + "description": "120 입력 시, 가장 최근 분봉 120건 조회\n240 입력 시, 240 이전 분봉 ~ 120 이전 분봉 조회\n360 입력 시, 360 이전 분봉 ~ 240 이전 분봉 조회" + }, + { + "key": "QRY_GAP", + "value": "1", + "description": "1: 1분봉, 5: 5분봉 ..." + }, + { + "key": "INDEX_KEY", + "value": "", + "description": "공란 입력 (\"\")" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 체결추이(주간)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55020000", + "description": "[실전투자]\nHHDFC55020000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/weekly-ccnl?SRS_CD=DXM24&EXCH_CD=ICE&START_DATE_TIME=&CLOSE_DATE_TIME=20240423&QRY_TP=&QRY_CNT=30&QRY_GAP=&INDEX_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "weekly-ccnl" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "EXCH_CD", + "value": "ICE", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "START_DATE_TIME", + "value": "", + "description": "시장 구분 코드\n'':KOSPI200, 'MKI':미니KOSPI200, 'WKM':KOSPI200위클리(월), 'WKI':KOSPI200위클리(목)" + }, + { + "key": "CLOSE_DATE_TIME", + "value": "20240423" + }, + { + "key": "QRY_TP", + "value": "" + }, + { + "key": "QRY_CNT", + "value": "30" + }, + { + "key": "QRY_GAP", + "value": "" + }, + { + "key": "INDEX_KEY", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 체결추이(일간)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55020100", + "description": "[실전투자]\nHHDFC55020100", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/daily-ccnl?SRS_CD=DXM24&EXCH_CD=ICE&START_DATE_TIME=&CLOSE_DATE_TIME=20240424&QRY_TP=&QRY_CNT=40&QRY_GAP=&INDEX_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "daily-ccnl" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "EXCH_CD", + "value": "ICE", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "START_DATE_TIME", + "value": "", + "description": "시장 구분 코드\n'':KOSPI200, 'MKI':미니KOSPI200, 'WKM':KOSPI200위클리(월), 'WKI':KOSPI200위클리(목)" + }, + { + "key": "CLOSE_DATE_TIME", + "value": "20240424" + }, + { + "key": "QRY_TP", + "value": "" + }, + { + "key": "QRY_CNT", + "value": "40" + }, + { + "key": "QRY_GAP", + "value": "" + }, + { + "key": "INDEX_KEY", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 체결추이(틱)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55020200", + "description": "[실전투자]\nHHDFC55020200", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/tick-ccnl?SRS_CD=DXM24&EXCH_CD=ICE&START_DATE_TIME=&CLOSE_DATE_TIME=20240424&QRY_TP=Q&QRY_CNT=30&QRY_GAP=&INDEX_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "tick-ccnl" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "EXCH_CD", + "value": "ICE", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "START_DATE_TIME", + "value": "", + "description": "시장 구분 코드\n'':KOSPI200, 'MKI':미니KOSPI200, 'WKM':KOSPI200위클리(월), 'WKI':KOSPI200위클리(목)" + }, + { + "key": "CLOSE_DATE_TIME", + "value": "20240424" + }, + { + "key": "QRY_TP", + "value": "Q" + }, + { + "key": "QRY_CNT", + "value": "30" + }, + { + "key": "QRY_GAP", + "value": "" + }, + { + "key": "INDEX_KEY", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 체결추이(월간)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55020300", + "description": "[실전투자]\nHHDFC55020300", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/monthly-ccnl?SRS_CD=DXM24&EXCH_CD=ICE&START_DATE_TIME=&CLOSE_DATE_TIME=20240423&QRY_TP=&QRY_CNT=30&QRY_GAP=&INDEX_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "monthly-ccnl" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "EXCH_CD", + "value": "ICE", + "description": "화면 분류 코드(20503 입력)" + }, + { + "key": "START_DATE_TIME", + "value": "", + "description": "시장 구분 코드\n'':KOSPI200, 'MKI':미니KOSPI200, 'WKM':KOSPI200위클리(월), 'WKI':KOSPI200위클리(목)" + }, + { + "key": "CLOSE_DATE_TIME", + "value": "20240423" + }, + { + "key": "QRY_TP", + "value": "" + }, + { + "key": "QRY_CNT", + "value": "30" + }, + { + "key": "QRY_GAP", + "value": "" + }, + { + "key": "INDEX_KEY", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC86000000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/inquire-asking-price?SRS_CD=DXM24", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "inquire-asking-price" + ], + "query": [ + { + "key": "SRS_CD", + "value": "DXM24", + "description": "종목코드" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 상품기본정보", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFC55200000", + "description": "[실전투자]\nHHDFC55200000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/search-contract-detail?QRY_CNT=2&SRS_CD_01=6AM24&SRS_CD_02=10YK24", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "search-contract-detail" + ], + "query": [ + { + "key": "QRY_CNT", + "value": "2", + "description": "품목입력개수 - SRS_CD 요청 개수 입력 " + }, + { + "key": "SRS_CD_01", + "value": "6AM24", + "description": "품목종류1 - SRS_CD_01 ~SRS_CD_32 까지 인자값 추가해서 입력" + }, + { + "key": "SRS_CD_02", + "value": "10YK24" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 장운영시간", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "OTFM2229R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/market-time?FM_PDGR_CD=&FM_CLAS_CD=&FM_EXCG_CD=CME&OPT_YN=%&CTX_AREA_NK200=&CTX_AREA_FK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "market-time" + ], + "query": [ + { + "key": "FM_PDGR_CD", + "value": "", + "description": "상품군코드(ex. 6A)" + }, + { + "key": "FM_CLAS_CD", + "value": "", + "description": "클래스코드 - 공백(전체), 001(통화), 002(금리), 003(지수), 004(농산물),005(축산물),006(금속),007(에너지)" + }, + { + "key": "FM_EXCG_CD", + "value": "CME", + "description": "거래소코드 - CME(CME), EUREX(EUREX), HKEx(HKEx), ICE(ICE), SGX(SGX), OSE(OSE), ASX(ASX), CBOE(CBOE), MDEX(MDEX), NYSE(NYSE), BMF(BMF),FTX(FTX), HNX(HNX), ETC(기타)" + }, + { + "key": "OPT_YN", + "value": "%", + "description": "옵션여부 - %(전체), N(선물), Y(옵션)" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회키200" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외선물 미결제추이", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDDB95030000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/investor-unpd-trend?PROD_ISCD=GE&BSOP_DATE=20240625&UPMU_GUBUN=0&CTS_KEY=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "investor-unpd-trend" + ], + "query": [ + { + "key": "PROD_ISCD", + "value": "GE", + "description": "상품 - 금리 (GE, ZB, ZF,ZN,ZT), 금속(GC, PA, PL,SI, HG), 농산물(CC, CT,KC, OJ, SB, ZC,ZL, ZM, ZO, ZR, ZS, ZW), 에너지(CL, HO, NG, WBS), 지수(ES, NQ, TF, YM, VX), 축산물(GF, HE, LE), 통화(6A, 6B, 6C, 6E, 6J, 6N, 6S, DX)" + }, + { + "key": "BSOP_DATE", + "value": "20240625", + "description": "기준일(ex)20240513)" + }, + { + "key": "UPMU_GUBUN", + "value": "0", + "description": "구분 - 0(수량), 1(증감)" + }, + { + "key": "CTS_KEY", + "value": "", + "description": "공백 입력" + } + ] + } + }, + "response": [] + }, + { + "name": "J_해외옵션 호가", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROT_TOKEN}}", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROT_APPKEY}}", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROT_APPSECRET}}", + "type": "text" + }, + { + "key": "tr_id", + "value": "HHDFO86000000", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/overseas-futureoption/v1/quotations/opt-asking-price?SRS_CD=OESU24 C5525", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "overseas-futureoption", + "v1", + "quotations", + "opt-asking-price" + ], + "query": [ + { + "key": "SRS_CD", + "value": "OESU24 C5525", + "description": "종목명" + } + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "장내채권", + "item": [ + { + "name": "[장내채권] 주문/계좌", + "item": [ + { + "name": "J_장내채권 매수주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0952U", + "description": "[실전투자]\nTTTC0952U", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"KR6095572D81\",\r\n \"ORD_QTY2\": \"1\",\r\n \"BOND_ORD_UNPR\":\"10000.0\",\r\n \"SAMT_MKET_PTCI_YN\":\"N\",\r\n \"BOND_RTL_MKET_YN\":\"N\",\r\n \"IDCR_STFNO\":\"\",\r\n \"MGCO_APTM_ODNO\":\"\",\r\n \"ORD_SVR_DVSN_CD\":\"0\",\r\n \"CTAC_TLNO\":\"\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/buy", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "buy" + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 매도주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0958U", + "description": "[실전투자]\nTTTC0958U", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"ORD_DVSN\":\"01\",\r\n \"PDNO\":\"KR6095572D81\",\r\n \"ORD_QTY2\":\"1\",\r\n \"BOND_ORD_UNPR\":\"10450.0\",\r\n \"SPRX_YN\":\"N\",\r\n \"BUY_DT\":\"\",\r\n \"BUY_SEQ\":\"\",\r\n \"SAMT_MKET_PTCI_YN\":\"N\",\r\n \"SLL_AGCO_OPPS_SLL_YN\":\"N\",\r\n \"BOND_RTL_MKET_YN\":\"N\",\r\n \"MGCO_APTM_ODNO\":\"\",\r\n \"ORD_SVR_DVSN_CD\":\"0\",\r\n \"CTAC_TLNO\":\"\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/sell", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "sell" + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 정정취소주문", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC0953U", + "description": "[실전투자]\nTTTC0953U", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"CANO\": \"{{CANO_REAL}}\",\r\n \"ACNT_PRDT_CD\": \"01\",\r\n \"PDNO\": \"KR6095572D81\",\r\n \"ORGN_ODNO\": \"0000017402\",\r\n \"ORD_QTY2\": \"2\",\r\n \"BOND_ORD_UNPR\": \"10451\",\r\n \"QTY_ALL_ORD_YN\": \"Y\",\r\n \"RVSE_CNCL_DVSN_CD\": \"01\",\r\n \"MGCO_APTM_ODNO\": \"\",\r\n \"ORD_SVR_DVSN_CD\": \"0\",\r\n \"CTAC_TLNO\": \"\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/order-rvsecncl", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "order-rvsecncl" + ] + } + }, + "response": [] + }, + { + "name": "J_채권정정취소가능주문조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC8035R", + "description": "[실전투자]\nCTSC8035R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/inquire-psbl-rvsecncl?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&ORD_DT=&ODNO=&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "inquire-psbl-rvsecncl" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "ORD_DT", + "value": "", + "description": "공백 입력" + }, + { + "key": "ODNO", + "value": "", + "description": "공백 입력" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회검색조건200" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회키200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 주문체결내역", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC8013R", + "description": "[실전투자]\nCTSC8013R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/inquire-daily-ccld?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&INQR_STRT_DT=20240401&INQR_END_DT=20240425&SLL_BUY_DVSN_CD=%&SORT_SQN_DVSN=01&PDNO=&NCCS_YN=N&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "inquire-daily-ccld" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "INQR_STRT_DT", + "value": "20240401", + "description": "조회시작일자\n일자 ~ (1주일 이내)" + }, + { + "key": "INQR_END_DT", + "value": "20240425", + "description": "조회종료일자\n~ 일자 (조회 당일)" + }, + { + "key": "SLL_BUY_DVSN_CD", + "value": "%", + "description": "매도매수구분코드 %(전체), 01(매도), 02(매수)" + }, + { + "key": "SORT_SQN_DVSN", + "value": "01", + "description": "정렬순서구분 01(주문순서), 02(주문역순)" + }, + { + "key": "PDNO", + "value": "", + "description": "상품번호" + }, + { + "key": "NCCS_YN", + "value": "N", + "description": "미체결여부 N(전체), C(체결), Y(미체결)" + }, + { + "key": "CTX_AREA_FK200", + "value": "", + "description": "연속조회키200" + }, + { + "key": "CTX_AREA_NK200", + "value": "", + "description": "연속조회검색조건200" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 잔고조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTSC8407R", + "description": "[실전투자]\nCTSC8407R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/inquire-balance?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&INQR_CNDT=00&PDNO=&BUY_DT=&CTX_AREA_FK200=&CTX_AREA_NK200=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "inquire-balance" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "INQR_CNDT", + "value": "00", + "description": "조회조건 00: 전체, 01: 상품번호단위 " + }, + { + "key": "PDNO", + "value": "", + "description": "INQR_CNDT: 01 입력 시 채권종목코드 입" + }, + { + "key": "BUY_DT", + "value": "", + "description": "공백 입력" + }, + { + "key": "CTX_AREA_FK200", + "value": "" + }, + { + "key": "CTX_AREA_NK200", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 매수가능조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "TTTC8910R", + "description": "[실전투자]\nTTTC8910R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/trading/inquire-psbl-order?CANO={{CANO_REAL}}&ACNT_PRDT_CD=01&PDNO=KR6095572D81&BOND_ORD_UNPR=10450.0", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "trading", + "inquire-psbl-order" + ], + "query": [ + { + "key": "CANO", + "value": "{{CANO_REAL}}", + "description": "종합계좌번호" + }, + { + "key": "ACNT_PRDT_CD", + "value": "01", + "description": "계좌상품코드" + }, + { + "key": "PDNO", + "value": "KR6095572D81", + "description": "채권종목코드(ex KR2033022D33)" + }, + { + "key": "BOND_ORD_UNPR", + "value": "10450.0", + "description": "채권주문단가" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "[장내채권] 기본시세", + "item": [ + { + "name": "J_장내채권 발행정보", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF1101R", + "description": "[실전투자]\nCTPF1101R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/issue-info?PDNO=KR6449111CB8&PRDT_TYPE_CD=302", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "issue-info" + ], + "query": [ + { + "key": "PDNO", + "value": "KR6449111CB8", + "description": "시장 분류 코드(F 입력)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "302", + "description": "화면 분류 코드(20503 입력)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권현재가(호가)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKBJ773401C0", + "description": "[실전투자]\nFHKBJ773401C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/inquire-asking-price?FID_COND_MRKT_DIV_CODE=B&FID_INPUT_ISCD=KR2088012A16", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "inquire-asking-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "B", + "description": "시장 분류 코드 (B 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "KR2088012A16", + "description": "채권종목코드(ex KR2033022D33)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 평균단가조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF2005R", + "description": "[실전투자]\nCTPF2005R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/avg-unit?INQR_STRT_DT=20240101&INQR_END_DT=20240425&PDNO=KR2033022D33&PRDT_TYPE_CD=302&VRFC_KIND_CD=00&CTX_AREA_NK30=&CTX_AREA_FK100=", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "avg-unit" + ], + "query": [ + { + "key": "INQR_STRT_DT", + "value": "20240101", + "description": "조회시작일자(YYYYMMDD)" + }, + { + "key": "INQR_END_DT", + "value": "20240425", + "description": "조회종료일자(YYYYMMDD)" + }, + { + "key": "PDNO", + "value": "KR2033022D33", + "description": "채권종목코드(ex KR2033022D33)" + }, + { + "key": "PRDT_TYPE_CD", + "value": "302", + "description": "상품유형코드(302 입력)" + }, + { + "key": "VRFC_KIND_CD", + "value": "00", + "description": "검증종류코드(00 입력)" + }, + { + "key": "CTX_AREA_NK30", + "value": "", + "description": "연속조회키30" + }, + { + "key": "CTX_AREA_FK100", + "value": "", + "description": "연속조회검색조건100" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 기간별시세(일)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKBJ773701C0", + "description": "[실전투자]\nFHKBJ773701C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/inquire-daily-itemchartprice?FID_COND_MRKT_DIV_CODE=B&FID_INPUT_ISCD=KR2033022D33", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "inquire-daily-itemchartprice" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "B", + "description": "시장 구분 코드(B 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "KR2033022D33", + "description": "채권종목코드(ex KR2033022D33)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권현재가(시세)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKBJ773400C0", + "description": "[실전투자]\nFHKBJ773400C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/inquire-price?FID_COND_MRKT_DIV_CODE=B&FID_INPUT_ISCD=KR2033022D33", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "inquire-price" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "B", + "description": "시장 구분 코드(B 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "KR2033022D33", + "description": "채권종목코드(ex KR2033022D33)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권현재가(체결)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKBJ773403C0", + "description": "[실전투자]\nFHKBJ773403C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/inquire-ccnl?FID_COND_MRKT_DIV_CODE=B&FID_INPUT_ISCD=KR6095572D81", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "inquire-ccnl" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "B" + }, + { + "key": "FID_INPUT_ISCD", + "value": "KR6095572D81" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권현재가(일별)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "FHKBJ773404C0", + "description": "[실전투자]\nFHKBJ773404C0", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/inquire-ccnl?FID_COND_MRKT_DIV_CODE=B&FID_INPUT_ISCD=KR6095572D81", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "inquire-ccnl" + ], + "query": [ + { + "key": "FID_COND_MRKT_DIV_CODE", + "value": "B", + "description": "시장 구분 코드(B 입력)" + }, + { + "key": "FID_INPUT_ISCD", + "value": "KR6095572D81", + "description": "채권종목코드(ex KR2033022D33)" + } + ] + } + }, + "response": [] + }, + { + "name": "J_장내채권 기본조회", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "content-type", + "value": "application/json", + "description": "application/json; charset=utf-8", + "type": "text" + }, + { + "key": "authorization", + "value": "Bearer {{PROD_TOKEN}}", + "description": "OAuth 토큰이 필요한 API 경우 발급한 Access token\n일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)\n법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)", + "type": "text" + }, + { + "key": "appkey", + "value": "{{PROD_APPKEY}}", + "description": "한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "appsecret", + "value": "{{PROD_APPSECRET}}", + "description": "한국투자증권 홈페이지에서 발급받은 appsecret (절대 노출되지 않도록 주의해주세요.)", + "type": "text" + }, + { + "key": "tr_id", + "value": "CTPF1114R", + "description": "[실전투자]\nCTPF1114R", + "type": "text" + }, + { + "key": "custtype", + "value": "P", + "type": "text" + }, + { + "key": "tr_cont", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{PROD}}/uapi/domestic-bond/v1/quotations/search-bond-info?PDNO=KR2033022D33&PRDT_TYPE_CD=302", + "host": [ + "{{PROD}}" + ], + "path": [ + "uapi", + "domestic-bond", + "v1", + "quotations", + "search-bond-info" + ], + "query": [ + { + "key": "PDNO", + "value": "KR2033022D33", + "description": "상품번호" + }, + { + "key": "PRDT_TYPE_CD", + "value": "302", + "description": "상품유형코드" + } + ] + } + }, + "response": [] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_환경변수.json b/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_환경변수.json new file mode 100644 index 0000000..6b2f2c6 --- /dev/null +++ b/한국투자증권(API)/legacy/postman/실전계좌_POSTMAN_환경변수.json @@ -0,0 +1 @@ +{"id":"a1551400-f523-4e7a-8232-63f8b2b775a3","name":"실전Env","values":[{"key":"VTS","value":"https://openapivts.koreainvestment.com:29443","enabled":true,"type":"default"},{"key":"PROD","value":"https://openapi.koreainvestment.com:9443","enabled":true,"type":"default"},{"key":"CANO_REAL","value":"","enabled":true,"type":"default"},{"key":"CANO_REAL_T","value":"","enabled":true,"type":"default"},{"key":"PROD_APPKEY","value":"","enabled":true,"type":"default"},{"key":"PROD_APPSECRET","value":"","enabled":true,"type":"default"},{"key":"PROD_TOKEN","value":"","enabled":true,"type":"default"},{"key":"PROD_HASH","value":"","enabled":true,"type":"default"},{"key":"PROT_APPKEY","value":"","enabled":true,"type":"default"},{"key":"PROT_APPSECRET","value":"","enabled":true,"type":"default"},{"key":"PROT_TOKEN","value":"","enabled":true,"type":"default"},{"key":"PROT_HASH","value":"","enabled":true,"type":"default"}]} \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/README.md b/한국투자증권(API)/legacy/rest/README.md new file mode 100644 index 0000000..cc14d42 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/README.md @@ -0,0 +1,64 @@ +![header](https://capsule-render.vercel.app/api?type=waving&color=gradient&height=300§ion=header&text=한국투자증권%20KIS%20Developers&fontSize=50&animation=fadeIn&fontAlignY=38&desc=개발%20환경%20준비%20(파이썬%20세팅하기)&descAlignY=51&descAlign=62) + +## 1. 개발 환경 준비 (파이썬 세팅하기) + +### **1.1. 아나콘다(파이썬) 설치** + +① 아나콘다 홈페이지([https://www.anaconda.com/download#downloads](https://www.anaconda.com/download#downloads))에서 본인 OS에 맞는 인스톨러를 다운로드 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/7c3fdfe0-24b3-4dae-80ae-9c3eb83b1ba2) + +② 설치파일 관리자 권한으로 실행 > Next 클릭 > 라이선스 화면 I Agree 클릭 > 설치타입 ‘All Users’ 클릭 > 설치 경로 C:\Anaconda3 으로 변경 & Next 클릭 > Advanced Options 화면에서 기본 값 그대로 Install 클릭 + +③ 설치 완료 + +### **1.2. 가상환경 생성 + 모듈 설치** + +① Windows 로고 키 클릭 > Anaconda prompt 클릭 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/8ae27b27-3990-4a70-b98d-41e2e6457440) + +② prompt 창에서 아래 명령어를 순서대로 입력 + +**- (가상환경 생성 명령어) conda create –n koreainvest python=3.8** + +**- (가상환경 실행 명령어) conda activate koreainvest** + +**- (모듈 설치 명령어) pip install websockets pycryptodome requests pyyaml** + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/2a6651cf-25be-45fd-bd7e-5634cf3866fe) + +- python websocket 사용을 위해 websockets 라이브러리를 설치하며, 주식체결통보 AES256 복호화 사용을 위한 pycrypodome 를 설치합니다. +- REST api 호출을 위해 requests 라이브러리를 설치하며, 개인정보(appkey, appsecret 등) 파일을 읽어들이기 위해 pyyaml 라이브러리를 설치합니다. + +### **1.3. Pycharm 설치** + +Pycharm은 파이썬 개발에 가장 널리 사용되는 통합 개발 환경으로 community 버전은 무료로 설치 가능합니다. + +① Jetbrain 홈페이지(https://www.jetbrains.com/ko-kr/pycharm/download) 에서 Pycharm 인스톨러를 다운로드 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/0a816854-f748-4778-aeca-5f8cf66fc118) + +② 인스톨러 실행 > Next 클릭 > 설치 완료 시 Finish 클릭 > Pycharm 실행 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/c368369d-ea00-470e-92bc-c2d7bde015f1) + +### **1.4. Project 생성 및 Python Interpreter 설정하기** + +① New Project 클릭 > 하단에 Previously configured Interpreter 클릭 > 우측의 Add Interpreter – Add Local Interpreter 클릭 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/2e90ce4b-c7d8-4b41-a2f2-9fce45660a83) + +② 새 창이 뜨면 좌측의 Conda Environment 클릭 > Use existing environment - koreainvest 선택 > OK 클릭 > Create 클릭 + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/4bbf7777-6d23-46ed-8914-ba294bd708c7) + +### **1.5. (option) Postman 설치 및 사용하기** + +포스트맨(Postman)은 개발자들이 API를 디자인하고 빌드하고 테스트하고 반복하기 위한 API 플랫폼입니다. + +Postman는 테스트베드 기능을 효율적으로 제공하여, 코드를 작성하기 전 API를 호출해보고 응답값을 확인해볼 수 있는 테스트해볼 수 있으며, 여러 언어(C, Java, Python 등)로 샘플코드를 자동으로 생성해주는 기능을 제공합니다. + +![image](https://github.com/koreainvestment/open-trading-api/assets/87407853/dcfea9fb-5a95-49a9-86f2-f333b5b2f067) + + - 진행방법: 한국투자 Github ([https://github.com/koreainvestment/open-trading-api/tree/main/postman](https://github.com/koreainvestment/open-trading-api/tree/main/postman)) 의 순서대로 진행 diff --git a/한국투자증권(API)/legacy/rest/config.yaml b/한국투자증권(API)/legacy/rest/config.yaml new file mode 100644 index 0000000..117448b --- /dev/null +++ b/한국투자증권(API)/legacy/rest/config.yaml @@ -0,0 +1,14 @@ +# 홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 +APP_KEY: "PS..." +APP_SECRET: "UH..." + +# 계좌번호 앞 8자리 +C ANO: "12345678" +# 계좌번호 뒤 2자리 +ACNT_PRDT_CD: "01" + +# 도메인 +URL_BASE: "https://openapi.koreainvestment.com:9443" + +# HTS ID +HTS_ID: "hantu34" \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/current_price_samle.py b/한국투자증권(API)/legacy/rest/current_price_samle.py new file mode 100644 index 0000000..41df6db --- /dev/null +++ b/한국투자증권(API)/legacy/rest/current_price_samle.py @@ -0,0 +1,54 @@ +import requests +import json + +APP_KEY = "" +APP_SECRET = "" +ACCESS_TOKEN = "" +URL_BASE = "https://openapi.koreainvestment.com:9443" #실전투자 + +# Auth +def auth(): + headers = {"content-type":"application/json"} + body = { + "grant_type":"client_credentials", + "appkey":APP_KEY, + "appsecret":APP_SECRET + } + PATH = "oauth2/tokenP" + URL = f"{URL_BASE}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + + global ACCESS_TOKEN + ACCESS_TOKEN = res.json()["access_token"] + +# 주식현재가 시세 +def get_current_price(stock_no): + PATH = "uapi/domestic-stock/v1/quotations/inquire-price" + URL = f"{URL_BASE}/{PATH}" + + # 헤더 설정 + headers = {"Content-Type":"application/json", + "authorization": f"Bearer {ACCESS_TOKEN}", + "appKey":APP_KEY, + "appSecret":APP_SECRET, + "tr_id":"FHKST01010100"} + + params = { + "fid_cond_mrkt_div_code":"J", + "fid_input_iscd": stock_no + } + + # 호출 + res = requests.get(URL, headers=headers, params=params) + + if res.status_code == 200 and res.json()["rt_cd"] == "0" : + return(res.json()) + # 토큰 만료 시 + elif res.status_code == 200 and res.json()["msg_cd"] == "EGW00123" : + auth() + get_current_price(stock_no) + else: + print("Error Code : " + str(res.status_code) + " | " + res.text) + return None + +get_current_price("005930") diff --git a/한국투자증권(API)/legacy/rest/get_interest_stocks_price.py b/한국투자증권(API)/legacy/rest/get_interest_stocks_price.py new file mode 100644 index 0000000..6dbfd34 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/get_interest_stocks_price.py @@ -0,0 +1,141 @@ +## 관심종목 복수시세조회 파이썬 샘플코드 +### config.yaml 파일을 설정한 뒤 get_interest_stocks_price.py를 실행하여 +### 1) 관심종목 그룹조회 → 2) 관심종목 그룹별 종목조회 → 3) 관심종목(멀티종목) 시세조회 순서대로 호출하여 관심종목 복수시세 조회 가능 + +# (0) 필요 모듈 임포트 +import pandas as pd +import requests +import json +import yaml +import time + +# (1) 개인정보 파일 가져오기 +with open('config.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) +APP_KEY = _cfg['APP_KEY'] +APP_SECRET = _cfg['APP_SECRET'] +ACCESS_TOKEN = "" +ACCESS_TOKEN_EXPIRED = "" +CANO = _cfg['CANO'] +ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] +URL_BASE = _cfg['URL_BASE'] +HTS_ID = _cfg['HTS_ID'] + +# (2) 함수 정의 +## 1. 접근 토큰 발급 +def get_access_token(): + """ OAuth 인증 > 접근토큰발급 """ + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": APP_KEY, + "appsecret": APP_SECRET} + PATH = "oauth2/tokenP" + URL = f"{URL_BASE}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + time.sleep(0.1) # 유량제한 예방 (REST: 1초당 20건 제한) + try: + ACCESS_TOKEN = res.json()["access_token"] + ACCESS_TOKEN_EXPIRED = res.json()["access_token_token_expired"] + return ACCESS_TOKEN, ACCESS_TOKEN_EXPIRED + except: + print("접근 토큰 발급이 불가능합니다") + print(res.json()) + +## 2. 관심종목 그룹 조회 +def get_interest_groups(): + PATH = "/uapi/domestic-stock/v1/quotations/intstock-grouplist" + URL = f"{URL_BASE}/{PATH}" + params = { + "TYPE": "1", + "FID_ETC_CLS_CODE": "00", + "USER_ID": HTS_ID + } + headers = { + "content-type": "application/json", + "authorization": f"Bearer {ACCESS_TOKEN}", + "appKey": APP_KEY, + "appSecret": APP_SECRET, + "tr_id": "HHKCM113004C7", # 실전투자 + "custtype": "P" + } + time.sleep(0.05) # 유량제한 예방 (REST: 1초당 20건 제한) + res = requests.get(URL, headers=headers, params=params) + return res.json() + +## 3. 관심종목 그룹별 종목 조회 +def get_group_stocks(interest_group): + PATH = "/uapi/domestic-stock/v1/quotations/intstock-stocklist-by-group" + URL = f"{URL_BASE}/{PATH}" + params = { + "TYPE": "1", + "USER_ID": HTS_ID, + "DATA_RANK": "", + "INTER_GRP_CODE": interest_group, + "INTER_GRP_NAME": "", + "HTS_KOR_ISNM": "", + "CNTG_CLS_CODE": "", + "FID_ETC_CLS_CODE": "4" + } + headers = { + "content-type": "application/json", + "authorization": f"Bearer {ACCESS_TOKEN}", + "appKey": APP_KEY, + "appSecret": APP_SECRET, + "tr_id": "HHKCM113004C6", # 실전투자 + "custtype": "P" + } + time.sleep(0.05) # 유량제한 예방 (REST: 1초당 20건 제한) + res = requests.get(URL, headers=headers, params=params) + return res.json() + +## 4. 관심종목(멀티종목) 시세조회 (30종목까지 조회 가능) +def get_multi_stock_prices(jongs): + PATH = "/uapi/domestic-stock/v1/quotations/intstock-multprice" + URL = f"{URL_BASE}/{PATH}" + headers = { + "content-type": "application/json", + "authorization": f"Bearer {ACCESS_TOKEN}", + "appKey": APP_KEY, + "appSecret": APP_SECRET, + "tr_id": "FHKST11300006", # 실전투자 + "custtype": "P" + } + time.sleep(0.05) # 유량제한 예방 (REST: 1초당 20건 제한) + res = requests.get(URL, headers=headers, params=jongs) + print(res.text) + print(res.json()) + return res.json() + +# (3) 함수 실행 +## 1. 접근토큰 발급 +ACCESS_TOKEN, ACCESS_TOKEN_EXPIRED = get_access_token() + +## 2. 관심종목 그룹 조회 +interest_groups = get_interest_groups() +print(interest_groups) + +## 3. 사용자로부터 관심종목 그룹 선택 +interest_group = str(input("관심종목 그룹 번호(inter_grp_code)를 입력하세요: ")) + +## 4. 선택한 관심종목 그룹별 종목 조회 +group_stocks = get_group_stocks(interest_group) +print(group_stocks) +interest_mrkt_code_list = [item["fid_mrkt_cls_code"] for item in group_stocks["output2"]] +interest_jong_code_list = [item["jong_code"] for item in group_stocks["output2"]] + +print(interest_mrkt_code_list) +print(interest_jong_code_list) + +## 5. 관심종목 최대30종목 리스트 생성 +jongs = {} +for i in range(min(len(interest_jong_code_list), 30)): # 관심종목 (최대) 30종목 리스트 생성 + jongs[f"FID_COND_MRKT_DIV_CODE_{i}"] = interest_mrkt_code_list[i] + jongs[f"FID_INPUT_ISCD_{i}"] = interest_jong_code_list[i] +print("jongs",jongs) +print("jongs 길이",len(jongs)) + +## 6. 관심종목 시세 조회 +multi_stock_prices = get_multi_stock_prices(jongs) +print(multi_stock_prices) # 최대 30개 관심종목 데이터 출력 +print(pd.DataFrame(multi_stock_prices['output'])) # 전체 데이터 데이터프레임으로 변환 +print(pd.DataFrame(multi_stock_prices['output'])[['inter_kor_isnm','inter_shrn_iscd','inter2_prpr']]) #종목 한글명, 종목코드, 현재가만 출력 \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/get_ovsfut_chart_price.py b/한국투자증권(API)/legacy/rest/get_ovsfut_chart_price.py new file mode 100644 index 0000000..bd51666 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/get_ovsfut_chart_price.py @@ -0,0 +1,150 @@ +## 해외선물분봉조회: 해외선물 상품의 특정 기간동안의 분봉을 받아서 엑셀로 저장하는 파이썬 샘플코드 +## config.yaml 파일을 설정한 뒤 get_ovsfut_chart_price.py를 실행해서 분봉 데이터 저장 가능 +## 해외선물 종목정보 마스터파일 다운로드 : https://new.real.download.dws.co.kr/common/master/ffcode.mst.zip + +# (0) 필요 모듈 임포트 +import pandas as pd +import requests +import json +import yaml +import time + + +# (1) 개인정보 파일 가져오기 +with open('config.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) +APP_KEY = _cfg['APP_KEY'] +APP_SECRET = _cfg['APP_SECRET'] +ACCESS_TOKEN = "" +ACCESS_TOKEN_EXPIRED = "" +CANO = _cfg['CANO'] +ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] +URL_BASE = _cfg['URL_BASE'] +HTS_ID = _cfg['HTS_ID'] + + +# (2) 함수 정의 +def get_access_token(): + """ OAuth 인증 > 접근토큰발급 """ + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": APP_KEY, + "appsecret": APP_SECRET} + PATH = "oauth2/tokenP" + URL = f"{URL_BASE}/{PATH}" + res = requests.post(URL, headers=headers, data=json.dumps(body)) + time.sleep(0.1) + try: + ACCESS_TOKEN = res.json()["access_token"] + ACCESS_TOKEN_EXPIRED = res.json()["access_token_token_expired"] + return ACCESS_TOKEN, ACCESS_TOKEN_EXPIRED + except: + print("접근 토큰 발급이 불가능합니다") + print(res.json()) + + +def get_overseas_future_time_price(SRS="6AZ23", EXCH="CME", STRT_DT="",END_DT="", CNT="100", GAP="1", dataframe=None, file_name=None): # 해외선물옵션시세 > 해외선물 분봉조회 + """ + 해외선물옵션시세 > 해외선물 분봉조회를 위한 함수 + + Parameters: + - SRS: 종목 코드 + - EXCH: 거래소 코드 + - STRT_DT: 조회 시작일 + - END_DT: 조회 종료일 + - CNT: 호출건당 조회 갯수 + - GAP: 조회 간격 + - dataframe: 초기 데이터프레임 + - file_name: 저장할 파일 이름 + + Returns"": + - 최종 데이터프레임 + """ + PATH = "/uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice" + URL = f"{URL_BASE}/{PATH}" + headers = {"Content-Type":"application/json", + "authorization":f"Bearer {ACCESS_TOKEN}", + "appKey":APP_KEY, + "appSecret":APP_SECRET, + "tr_id":"HHDFC55020400", # 실전투자 + "custtype":"P" + } + params = { + "SRS_CD": SRS, + "EXCH_CD": EXCH, + "START_DATE_TIME": "", + "CLOSE_DATE_TIME": END_DT, + "QRY_TP": "", + "QRY_CNT": CNT, + "QRY_GAP": GAP, + "INDEX_KEY": "" + } + res = requests.get(URL, headers=headers, params=params) + time.sleep(0.1) # 유량제한 예방 (REST: 1초당 20건 제한) + output = res.json()['output1'] + + # 파일 이름이 제공되지 않은 경우에만 생성 + if file_name is None: + file_name = f"{SRS}_{EXCH}_{STRT_DT}_{END_DT}" + + # 초기 dataframe 생성 + if dataframe is None: + dataframe = pd.DataFrame() + + current_dataframe = pd.DataFrame(output) + + # 이전 응답값이 존재하고, 이전 응답값과 현재 응답값이 동일하면 + if not dataframe.empty and dataframe.iloc[-1,0] == current_dataframe.iloc[-1,0] and dataframe.iloc[-1,1] == current_dataframe.iloc[-1,1]: + + # 이전 데이터프레임에 현재 데이터프레임 추가 + dataframe = pd.concat([dataframe, current_dataframe], ignore_index=True) + + # STRT_DT와 END_DT가 같은 경우 현재 dataframe을 return + if STRT_DT == END_DT: + dataframe = dataframe.drop_duplicates(ignore_index=True) + + # 최종 데이터프레임 정제 작업(이상치 삭제 및 date, time으로 정렬) + ## 'data_date'와 'data_time'을 문자열로 변환하여 문자열을 합쳐 datetime 형식으로 만들기 + dataframe['datetime'] = pd.to_datetime(dataframe['data_date'].astype(str) + dataframe['data_time'].astype(str).str.zfill(6), errors='coerce', format='%Y%m%d%H%M%S') + ## 유효한 datetime이 아닌 행 삭제 + dataframe = dataframe.dropna(subset=['datetime']) + ## 'datetime'을 기준으로 정렬 후 'datetime' 열 삭제 + dataframe = dataframe.sort_values(by=['datetime']).drop(columns=['datetime']).reset_index(drop=True) + + # 현재 위치에 엑셀파일로 저장 + dataframe.to_excel(f"{file_name}.xlsx",index=False) + print("File Saved") + + # 최종 데이터프레임 return + return dataframe + + else: + # END_DT를 하루 이전으로 설정하고 재귀호출 + END_DT = pd.to_datetime(END_DT) - pd.DateOffset(days=1) + END_DT = END_DT.strftime("%Y%m%d") + return get_overseas_future_time_price(SRS, EXCH, STRT_DT, END_DT, "100", GAP, dataframe, file_name) + else: + # 이전 데이터프레임에 현재 데이터프레임 추가 + dataframe = pd.concat([dataframe, current_dataframe], ignore_index=True) + + # 이전 응답값과 현재 응답값이 다르면 CNT를 100늘려서 재호출 + CNT = str(int(CNT) + 100) + # print(SRS, EXCH, STRT_DT, END_DT, CNT, GAP) + return get_overseas_future_time_price(SRS, EXCH, STRT_DT, END_DT, CNT, GAP, dataframe, file_name) + + +# (3) 함수 실행 +# 접근토큰 발급 +ACCESS_TOKEN, ACCESS_TOKEN_EXPIRED = get_access_token() + +# 사용자 입력 받기 +SRS = input("종목 코드를 입력하세요(ex. 6AZ23): ") +EXCH = input("거래소 코드를 입력하세요(ex. CME): ") +STRT_DT = input("조회 시작일을 입력하세요 (YYYYMMDD 형식): ") +END_DT = input("조회 종료일을 입력하세요 (YYYYMMDD 형식): ") +GAP = input("조회 간격(분)을 입력하세요 (ex. 1) : ") + +# 해외선물분봉조회 호출 +print("Downloading...") +result_dataframe = get_overseas_future_time_price(SRS=SRS, EXCH=EXCH, STRT_DT=STRT_DT, END_DT=END_DT, CNT="100", GAP=GAP) +result_dataframe[:3] \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/get_ovsstk_chart_price.py b/한국투자증권(API)/legacy/rest/get_ovsstk_chart_price.py new file mode 100644 index 0000000..c856191 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/get_ovsstk_chart_price.py @@ -0,0 +1,182 @@ +## 해외주식분봉조회: 해외주식 종목의 특정 기간동안의 분봉을 받아서 엑셀로 저장하는 파이썬 샘플코드 (최대 약 1개월 기간 분봉 확인 가능) +## config.yaml 파일을 설정한 뒤 get_ovsstk_chart_price.py를 실행해서 분봉 데이터 저장 가능 +## 해외주식 종목정보 마스터파일 다운로드 : +### (나스닥) https://new.real.download.dws.co.kr/common/master/nasmst.cod.zip +### (뉴욕) https://new.real.download.dws.co.kr/common/master/nysmst.cod.zip +### (아멕스) https://new.real.download.dws.co.kr/common/master/amsmst.cod.zip + +# (0) 필요 모듈 임포트 +from datetime import datetime, timedelta +import pandas as pd +import requests +import json +import yaml +import time + +# (1) 개인정보 파일 가져오기 +with open('config.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) +APP_KEY = _cfg['APP_KEY'] +APP_SECRET = _cfg['APP_SECRET'] +ACCESS_TOKEN = "" +ACCESS_TOKEN_EXPIRED = "" +CANO = _cfg['CANO'] +ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] +URL_BASE = _cfg['URL_BASE'] +HTS_ID = _cfg['HTS_ID'] +print(APP_KEY, APP_SECRET, ACCESS_TOKEN, HTS_ID) + +# (2) 함수 정의 +## 1. 접근 토큰 발급 +def get_access_token(): + """ OAuth 인증 > 접근토큰발급 """ + headers = {"content-type": "application/json"} + body = { + "grant_type": "client_credentials", + "appkey": APP_KEY, + "appsecret": APP_SECRET + } + PATH = "oauth2/tokenP" + URL = f"{URL_BASE}/{PATH}" + + time.sleep(0.1) # 유량제한 예방 (REST: 1초당 20건 제한) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + + if res.status_code == 200: + try: + access_token = res.json().get("access_token") + access_token_expired = res.json().get("access_token_expired") # 수정된 키 + return access_token, access_token_expired + except KeyError as e: + print(f"토큰 발급 중 키 에러 발생: {e}") + print(res.json()) + return None, None + else: + print("접근 토큰 발급이 불가능합니다. 응답 코드:", res.status_code) + print("응답 내용:", res.json()) + return None, None + +## 2. 해외 주식 분봉 조회 +def call_api(exc_code, sym_code, nmin, keyb="", next_value="", access_token=""): + PATH = "/uapi/overseas-price/v1/quotations/inquire-time-itemchartprice" + URL = f"{URL_BASE}/{PATH}" + + params = { + "AUTH": "", + "EXCD": exc_code, # 거래소 코드 + "SYMB": sym_code, # 종목 코드 + "NMIN": nmin, # 분봉 주기 + "PINC": "1", + "NEXT": next_value, + "NREC": "120", + "FILL": "", + "KEYB": keyb + } + + print(params) + + headers = { + 'content-type': 'application/json', + 'authorization': f'Bearer {access_token}', # 매개변수로 받은 access_token 사용 + 'appkey': APP_KEY, # 미리 정의된 appkey 사용 + 'appsecret': APP_SECRET, # 미리 정의된 appsecret 사용 + 'tr_id': 'HHDFS76950200', + 'custtype': 'P' + } + + time.sleep(0.1) # 유량제한 예방 (REST: 1초당 20건 제한) + response = requests.get(URL, headers=headers, params=params) + + if response.status_code == 200: + data = response.json() + print("API 호출 성공") + return data + else: + print(f"API 호출 실패, 상태 코드: {response.status_code}") + try: + print("오류 메시지:", response.json()) + except json.JSONDecodeError: + print("JSON 디코딩 실패. 응답:", response.text) + return None + +## 3. 다음 조회용 keyb 값 계산 함수 (nmin에 따라 시간 조정) +def get_next_keyb(output2, nmin): + last_record = output2[-1] + last_time_str = last_record["xymd"] + last_record["xhms"] # YYYYMMDDHHMMSS 형태의 문자열 + last_time = datetime.strptime(last_time_str, "%Y%m%d%H%M%S") # 문자열을 datetime 객체로 변환 + next_keyb_time = last_time - timedelta(minutes=nmin) # nmin 값만큼 이전 시간 계산 + return next_keyb_time.strftime("%Y%m%d%H%M%S") # 다시 문자열로 변환하여 반환 + +## 4. 데이터를 판다스 DataFrame으로 변환하는 함수 +def convert_to_dataframe(data): + if "output2" in data: + # output2 데이터를 데이터프레임으로 변환 + df = pd.DataFrame(data["output2"]) + + # 필요한 열만 선택 및 시간 데이터 처리 + df = df[['tymd', 'xhms', 'open', 'high', 'low', 'last', 'evol', 'eamt']] + df['datetime'] = pd.to_datetime(df['tymd'] + df['xhms'], format='%Y%m%d%H%M%S') + + # 데이터프레임 정리 (시간 순서대로 정렬) + df = df.sort_values(by='datetime').reset_index(drop=True) + + # 필요 없는 열 삭제 + df.drop(columns=['tymd', 'xhms'], inplace=True) + + return df + else: + return pd.DataFrame() + +## 5. 반복 조회 및 데이터 저장 함수 +def fetch_and_save_data(exc_code, sym_code, nmin, period, access_token): + all_data = pd.DataFrame() # 전체 데이터를 저장할 데이터프레임 + first_call = call_api(exc_code, sym_code, nmin, access_token=access_token) + + if not first_call: + return + + # 첫 조회 데이터 변환 및 저장 + df = convert_to_dataframe(first_call) + all_data = pd.concat([all_data, df], ignore_index=True) + + # 다음 조회를 위한 변수 초기화 + next_value = first_call["output1"]["next"] + keyb = get_next_keyb(first_call["output2"], nmin) # nmin에 따라 1분 또는 n분 전 시간 계산 + + for _ in range(period - 1): + # 다음 조회 실행 + next_call = call_api(exc_code, sym_code, nmin, keyb=keyb, next_value=next_value, access_token=access_token) + + if not next_call: + break + + # 다음 조회 데이터 변환 및 저장 + df = convert_to_dataframe(next_call) + all_data = pd.concat([all_data, df], ignore_index=True) + + # 다음 조회를 위한 keyb 및 next 값 갱신 + next_value = next_call["output1"]["next"] + keyb = get_next_keyb(next_call["output2"], nmin) # nmin에 따라 갱신된 keyb 값 + + # 결과 데이터프레임을 시간순으로 정렬하여 저장 + all_data = all_data.sort_values(by='datetime').reset_index(drop=True).drop_duplicates() # 중복 제거 + all_data.to_csv(f'{sym_code}_fetched_data.csv', index=False) # CSV 파일로 저장 + print(f"{sym_code} 데이터가 CSV 파일로 저장되었습니다.") + + return all_data + +# (4) 함수 실행 +## 1. 접근토큰 발급 +ACCESS_TOKEN, ACCESS_TOKEN_EXPIRED = get_access_token() + +if ACCESS_TOKEN: + ## 2. 사용자 입력 받기 + exc_code = input("거래소 코드를 입력하세요 (예: NAS): ") + sym_code = input("종목 코드를 입력하세요 (예: TSLA): ") + nmin = int(input("분봉 주기를 입력하세요 (예: 1, 5, 10): ")) + period = int(input("반복 조회할 횟수를 입력하세요 (예: 4): ")) + + ## 3. 사용자 입력에 따른 분봉 조회 후 데이터 저장 + all_data = fetch_and_save_data(exc_code, sym_code, nmin, period, ACCESS_TOKEN) +else: + print("토큰 발급 실패로 프로그램이 종료됩니다.") \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/kis_api.py b/한국투자증권(API)/legacy/rest/kis_api.py new file mode 100644 index 0000000..17a9c33 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/kis_api.py @@ -0,0 +1,663 @@ +# -*- coding: utf-8 -*- +""" +Created on Mon Apr 18 11:23:04 2022 + +@author: KIS Developers +""" + +import time, copy +import yaml +import requests +import json + +import pandas as pd + +from collections import namedtuple +from datetime import datetime + +with open(r'kisdev_vi.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) + +_TRENV = tuple() +_last_auth_time = datetime.now() +_autoReAuth = False +_DEBUG = True +_isPaper = True + +_base_headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8", + 'User-Agent': _cfg['my_agent'] +} + + +def _getBaseHeader(): + if _autoReAuth: reAuth() + return copy.deepcopy(_base_headers) + + +def _setTRENV(cfg): + nt1 = namedtuple('KISEnv', ['my_app','my_sec','my_acct', 'my_prod', 'my_token', 'my_url']) + d = { + 'my_app': cfg['my_app'], + 'my_sec': cfg['my_sec'], + 'my_acct': cfg['my_acct'], + 'my_prod': cfg['my_prod'], + 'my_token': cfg['my_token'], + 'my_url' : cfg['my_url'] + } + + global _TRENV + _TRENV = nt1(**d) + +def isPaperTrading(): + return _isPaper + +def changeTREnv(token_key, svr='prod', product='01'): + cfg = dict() + + global _isPaper + if svr == 'prod': + ak1 = 'my_app' + ak2 = 'my_sec' + _isPaper = False + elif svr == 'vps': + ak1 = 'paper_app' + ak2 = 'paper_sec' + _isPaper = True + + cfg['my_app'] = _cfg[ak1] + cfg['my_sec'] = _cfg[ak2] + + if svr == 'prod' and product == '01': + cfg['my_acct'] = _cfg['my_acct_stock'] + elif svr == 'prod' and product == '03': + cfg['my_acct'] = _cfg['my_acct_future'] + elif svr == 'vps' and product == '01': + cfg['my_acct'] = _cfg['my_paper_stock'] + elif svr == 'vps' and product == '03': + cfg['my_acct'] = _cfg['my_paper_future'] + + cfg['my_prod'] = product + cfg['my_token'] = token_key + cfg['my_url'] = _cfg[svr] + + _setTRENV(cfg) + + +def _getResultObject(json_data): + _tc_ = namedtuple('res', json_data.keys()) + + return _tc_(**json_data) + +def auth(svr='prod', product='01'): + + p = { + "grant_type": "client_credentials", + } + print(svr) + if svr == 'prod': + ak1 = 'my_app' + ak2 = 'my_sec' + elif svr == 'vps': + ak1 = 'paper_app' + ak2 = 'paper_sec' + + p["appkey"] = _cfg[ak1] + p["appsecret"] = _cfg[ak2] + + + url = f'{_cfg[svr]}/oauth2/tokenP' + + res = requests.post(url, data=json.dumps(p), headers=_getBaseHeader()) + rescode = res.status_code + if rescode == 200: + my_token = _getResultObject(res.json()).access_token + else: + print('Get Authentification token fail!\nYou have to restart your app!!!') + return + + changeTREnv(f"Bearer {my_token}", svr, product) + + _base_headers["authorization"] = _TRENV.my_token + _base_headers["appkey"] = _TRENV.my_app + _base_headers["appsecret"] = _TRENV.my_sec + + global _last_auth_time + _last_auth_time = datetime.now() + + if (_DEBUG): + print(f'[{_last_auth_time}] => get AUTH Key completed!') + +#end of initialize +def reAuth(svr='prod', product='01'): + n2 = datetime.now() + if (n2-_last_auth_time).seconds >= 86400: + auth(svr, product) + +def getEnv(): + return _cfg +def getTREnv(): + return _TRENV + +#주문 API에서 사용할 hash key값을 받아 header에 설정해 주는 함수 +# Input: HTTP Header, HTTP post param +# Output: None +def set_order_hash_key(h, p): + + url = f"{getTREnv().my_url}/uapi/hashkey" + + res = requests.post(url, data=json.dumps(p), headers=h) + rescode = res.status_code + if rescode == 200: + h['hashkey'] = _getResultObject(res.json()).HASH + else: + print("Error:", rescode) + +class APIResp: + def __init__(self, resp): + self._rescode = resp.status_code + self._resp = resp + self._header = self._setHeader() + self._body = self._setBody() + self._err_code = self._body.rt_cd + self._err_message = self._body.msg1 + + def getResCode(self): + return self._rescode + + def _setHeader(self): + fld = dict() + for x in self._resp.headers.keys(): + if x.islower(): + fld[x] = self._resp.headers.get(x) + _th_ = namedtuple('header', fld.keys()) + + return _th_(**fld) + + def _setBody(self): + _tb_ = namedtuple('body', self._resp.json().keys()) + + return _tb_(**self._resp.json()) + + def getHeader(self): + return self._header + + def getBody(self): + return self._body + + def getResponse(self): + return self._resp + + def isOK(self): + try: + if(self.getBody().rt_cd == '0'): + return True + else: + return False + except: + return False + + def getErrorCode(self): + return self._err_code + + def getErrorMessage(self): + return self._err_message + + def printAll(self): + print("
") + for x in self.getHeader()._fields: + print(f'\t-{x}: {getattr(self.getHeader(), x)}') + print("") + for x in self.getBody()._fields: + print(f'\t-{x}: {getattr(self.getBody(), x)}') + + def printError(self): + print('-------------------------------\nError in response: ', self.getResCode()) + print(self.getBody().rt_cd, self.getErrorCode(), self.getErrorMessage()) + print('-------------------------------') + +# end of class APIResp + + +########### API call wrapping + +def _url_fetch(api_url, ptr_id, params, appendHeaders=None, postFlag=False, hashFlag=True): + url = f"{getTREnv().my_url}{api_url}" + + headers = _getBaseHeader() + + #추가 Header 설정 + tr_id = ptr_id + if ptr_id[0] in ('T', 'J', 'C'): + if isPaperTrading(): + tr_id = 'V' + ptr_id[1:] + + headers["tr_id"] = tr_id + headers["custtype"] = "P" + + if appendHeaders is not None: + if len(appendHeaders) > 0: + for x in appendHeaders.keys(): + headers[x] = appendHeaders.get(x) + + if(_DEBUG): + print("< Sending Info >") + print(f"URL: {url}, TR: {tr_id}") + print(f"
\n{headers}") + print(f"\n{params}") + + if (postFlag): + if(hashFlag): set_order_hash_key(headers, params) + res = requests.post(url, headers=headers, data=json.dumps(params)) + else: + res = requests.get(url, headers=headers, params=params) + + if res.status_code == 200: + ar = APIResp(res) + if (_DEBUG): ar.printAll() + return ar + else: + print("Error Code : " + str(res.status_code) + " | " + res.text) + return None + + +# 계좌 잔고를 DataFrame 으로 반환 +# Input: None (Option) rtCashFlag=True 면 예수금 총액을 반환하게 된다 +# Output: DataFrame (Option) rtCashFlag=True 면 예수금 총액을 반환하게 된다 + +def get_acct_balance(rtCashFlag=False): + url = '/uapi/domestic-stock/v1/trading/inquire-balance' + tr_id = "TTTC8434R" + + params = { + 'CANO': getTREnv().my_acct, + 'ACNT_PRDT_CD': '01', + 'AFHR_FLPR_YN': 'N', + 'FNCG_AMT_AUTO_RDPT_YN': 'N', + 'FUND_STTL_ICLD_YN': 'N', + 'INQR_DVSN': '01', + 'OFL_YN': 'N', + 'PRCS_DVSN': '01', + 'UNPR_DVSN': '01', + 'CTX_AREA_FK100': '', + 'CTX_AREA_NK100': '' + } + + t1 = _url_fetch(url, tr_id, params) + if rtCashFlag and t1.isOK(): + r2 = t1.getBody().output2 + return int(r2[0]['dnca_tot_amt']) + + output1 = t1.getBody().output1 + if t1.isOK() and output1: #body 의 rt_cd 가 0 인 경우만 성공 + tdf = pd.DataFrame(output1) + tdf.set_index('pdno', inplace=True) + cf1 = ['prdt_name','hldg_qty', 'ord_psbl_qty', 'pchs_avg_pric', 'evlu_pfls_rt', 'prpr', 'bfdy_cprs_icdc', 'fltt_rt'] + cf2 = ['종목명', '보유수량', '매도가능수량', '매입단가', '수익율', '현재가' ,'전일대비', '등락'] + tdf = tdf[cf1] + tdf[cf1[1:]] = tdf[cf1[1:]].apply(pd.to_numeric) + ren_dict = dict(zip(cf1, cf2)) + return tdf.rename(columns=ren_dict) + + else: + t1.printError() + return pd.DataFrame() + + + +#종목의 주식, ETF, 선물/옵션 등의 구분값을 반환. 현재는 무조건 주식(J)만 반환 +def _getStockDiv(stock_no): + return 'J' + +# 종목별 현재가를 dict 로 반환 +# Input: 종목코드 +# Output: 현재가 Info dictionary. 반환된 dict 가 len(dict) < 1 경우는 에러로 보면 됨 + +def get_current_price(stock_no): + url = "/uapi/domestic-stock/v1/quotations/inquire-price" + tr_id = "FHKST01010100" + + params = { + 'FID_COND_MRKT_DIV_CODE': _getStockDiv(stock_no), + 'FID_INPUT_ISCD': stock_no + } + + t1 = _url_fetch(url, tr_id, params) + + if t1.isOK(): + return t1.getBody().output + else: + t1.printError() + return dict() + +# 주문 base function +# Input: 종목코드, 주문수량, 주문가격, Buy Flag(If True, it's Buy order), order_type="00"(지정가) +# Output: HTTP Response + +def do_order(stock_code, order_qty, order_price, prd_code="01", buy_flag=True, order_type="00"): + + url = "/uapi/domestic-stock/v1/trading/order-cash" + + if buy_flag: + tr_id = "TTTC0802U" #buy + else: + tr_id = "TTTC0801U" #sell + + params = { + 'CANO': getTREnv().my_acct, + 'ACNT_PRDT_CD': prd_code, + 'PDNO': stock_code, + 'ORD_DVSN': order_type, + 'ORD_QTY': str(order_qty), + 'ORD_UNPR': str(order_price), + 'CTAC_TLNO': '', + 'SLL_TYPE': '01', + 'ALGO_NO': '' + } + + t1 = _url_fetch(url, tr_id, params, postFlag=True, hashFlag=True) + + if t1.isOK(): + return t1 + else: + t1.printError() + return None + +# 사자 주문. 내부적으로는 do_order 를 호출한다. +# Input: 종목코드, 주문수량, 주문가격 +# Output: True, False + +def do_sell(stock_code, order_qty, order_price, prd_code="01", order_type="00"): + t1 = do_order(stock_code, order_qty, order_price, buy_flag=False, order_type=order_type) + return t1.isOK() + +# 팔자 주문. 내부적으로는 do_order 를 호출한다. +# Input: 종목코드, 주문수량, 주문가격 +# Output: True, False + +def do_buy(stock_code, order_qty, order_price, prd_code="01", order_type="00"): + t1 = do_order(stock_code, order_qty, order_price, buy_flag=True, order_type=order_type) + return t1.isOK() + +# 정정취소 가능한 주문 목록을 DataFrame 으로 반환 +# Input: None +# Output: DataFrame + +def get_orders(prd_code='01'): + url = "/uapi/domestic-stock/v1/trading/inquire-psbl-rvsecncl" + + tr_id = "TTTC8036R" + + params = { + "CANO": getTREnv().my_acct, + "ACNT_PRDT_CD": prd_code, + "CTX_AREA_FK100": '', + "CTX_AREA_NK100": '', + "INQR_DVSN_1": '0', + "INQR_DVSN_2": '0' + } + + t1 = _url_fetch(url, tr_id, params) + if t1.isOK(): + tdf = pd.DataFrame(t1.getBody().output) + tdf.set_index('odno', inplace=True) + cf1 = ['pdno', 'ord_qty', 'ord_unpr', 'ord_tmd', 'ord_gno_brno','orgn_odno'] + cf2 = ['종목코드', '주문수량', '주문가격', '시간', '주문점', '원번호'] + tdf = tdf[cf1] + ren_dict = dict(zip(cf1, cf2)) + + return tdf.rename(columns=ren_dict) + + else: + t1.printError() + return pd.DataFrame() + + +# 특정 주문 취소(01)/정정(02) +# Input: 주문 번호(get_orders 를 호출하여 얻은 DataFrame 의 index column 값이 취소 가능한 주문번호임) +# 주문점(통상 06010), 주문수량, 주문가격, 상품코드(01), 주문유형(00), 정정구분(취소-02, 정정-01) +# Output: APIResp object + +def _do_cancel_revise(order_no, order_branch, order_qty, order_price, prd_code, order_dv, cncl_dv, qty_all_yn): + url = "/uapi/domestic-stock/v1/trading/order-rvsecncl" + + tr_id = "TTTC0803U" + + params = { + "CANO": getTREnv().my_acct, + "ACNT_PRDT_CD": prd_code, + "KRX_FWDG_ORD_ORGNO": order_branch, + "ORGN_ODNO": order_no, + "ORD_DVSN": order_dv, + "RVSE_CNCL_DVSN_CD": cncl_dv, #취소(02) + "ORD_QTY": str(order_qty), + "ORD_UNPR": str(order_price), + "QTY_ALL_ORD_YN": qty_all_yn + } + + t1 = _url_fetch(url, tr_id, params=params, postFlag=True) + + if t1.isOK(): + return t1 + else: + t1.printError() + return None + +# 특정 주문 취소 +# +def do_cancel(order_no, order_qty, order_price="01", order_branch='06010', prd_code='01', order_dv='00', cncl_dv='02',qty_all_yn="Y"): + return _do_cancel_revise(order_no, order_branch, order_qty, order_price, prd_code, order_dv, cncl_dv, qty_all_yn) + +# 특정 주문 정정 +# +def do_revise(order_no, order_qty, order_price, order_branch='06010', prd_code='01', order_dv='00', cncl_dv='01', qty_all_yn="Y"): + return _do_cancel_revise(order_no, order_branch, order_qty, order_price, prd_code, order_dv, cncl_dv, qty_all_yn) + +# 모든 주문 취소 +# Input: None +# Output: None + +def do_cancel_all(): + tdf = get_orders() + od_list = tdf.index.to_list() + qty_list = tdf['주문수량'].to_list() + price_list = tdf['주문가격'].to_list() + branch_list = tdf['주문점'].to_list() + cnt = 0 + for x in od_list: + ar = do_cancel(x, qty_list[cnt], price_list[cnt], branch_list[cnt]) + cnt += 1 + print(ar.getErrorCode(), ar.getErrorMessage()) + time.sleep(.2) + + + +# 내 계좌의 일별 주문 체결 조회 +# Input: 시작일, 종료일 (Option)지정하지 않으면 현재일 +# output: DataFrame + +def get_my_complete(sdt, edt=None, prd_code='01', zipFlag=True): + url = "/uapi/domestic-stock/v1/trading/inquire-daily-ccld" + tr_id = "TTTC8001R" + + if (edt is None): + ltdt = datetime.now().strftime('%Y%m%d') + else: + ltdt = edt + + params = { + "CANO": getTREnv().my_acct, + "ACNT_PRDT_CD": prd_code, + "INQR_STRT_DT": sdt, + "INQR_END_DT": ltdt, + "SLL_BUY_DVSN_CD": '00', + "INQR_DVSN": '00', + "PDNO": "", + "CCLD_DVSN": "00", + "ORD_GNO_BRNO": "", + "ODNO":"", + "INQR_DVSN_3": "00", + "INQR_DVSN_1": "", + "INQR_DVSN_2": "", + "CTX_AREA_FK100": "", + "CTX_AREA_NK100": "" + } + + t1 = _url_fetch(url, tr_id, params) + + #output1 과 output2 로 나뉘어서 결과가 옴. 지금은 output1만 DF 로 변환 + if t1.isOK(): + tdf = pd.DataFrame(t1.getBody().output1) + tdf.set_index('odno', inplace=True) + if (zipFlag): + return tdf[['ord_dt','orgn_odno', 'sll_buy_dvsn_cd_name', 'pdno', 'ord_qty', 'ord_unpr', 'avg_prvs', 'cncl_yn','tot_ccld_amt','rmn_qty']] + else: + return tdf + else: + t1.printError() + return pd.DataFrame() + + +# 매수 가능(현금) 조회 +# Input: None +# Output: 매수 가능 현금 액수 +def get_buyable_cash(stock_code='', qry_price=0, prd_code='01'): + url = "/uapi/domestic-stock/v1/trading/inquire-daily-ccld" + tr_id = "TTTC8908R" + + params = { + "CANO": getTREnv().my_acct, + "ACNT_PRDT_CD": prd_code, + "PDNO": stock_code, + "ORD_UNPR": str(qry_price), + "ORD_DVSN": "02", + "CMA_EVLU_AMT_ICLD_YN": "Y", #API 설명부분 수정 필요 (YN) + "OVRS_ICLD_YN": "N" + } + + t1 = _url_fetch(url, tr_id, params) + + if t1.isOK(): + return int(t1.getBody().output['ord_psbl_cash']) + else: + t1.printError() + return 0 + + +# 시세 Function + +# 종목별 체결 Data +# Input: 종목코드 +# Output: 체결 Data DataFrame +# 주식체결시간, 주식현재가, 전일대비, 전일대비부호, 체결거래량, 당일 체결강도, 전일대비율 +def get_stock_completed(stock_no): + url = "/uapi/domestic-stock/v1/quotations/inquire-ccnl" + + tr_id = "FHKST01010300" + + params = { + "FID_COND_MRKT_DIV_CODE": "J", + "FID_INPUT_ISCD": stock_no + } + + t1 = _url_fetch(url, tr_id, params) + + if t1.isOK(): + return pd.DataFrame(t1.getBody().output) + else: + t1.printError() + return pd.DataFrame() + +# 종목별 history data (현재 기준 30개만 조회 가능) +# Input: 종목코드, 구분(D, W, M 기본값은 D) +# output: 시세 History DataFrame +def get_stock_history(stock_no, gb_cd='D'): + url = "/uapi/domestic-stock/v1/quotations/inquire-daily-price" + tr_id = "FHKST01010400" + + params = { + "FID_COND_MRKT_DIV_CODE": _getStockDiv(stock_no), + "FID_INPUT_ISCD": stock_no, + "FID_PERIOD_DIV_CODE": gb_cd, + "FID_ORG_ADJ_PRC": "0000000001" + } + + t1 = _url_fetch(url, tr_id, params) + + if t1.isOK(): + return pd.DataFrame(t1.getBody().output) + else: + t1.printError() + return pd.DataFrame() + +# 종목별 history data 를 표준 OHLCV DataFrame 으로 반환 +# Input: 종목코드, 구분(D, W, M 기본값은 D), (Option)adVar 을 True 로 설정하면 +# OHLCV 외에 inter_volatile 과 pct_change 를 추가로 반환한다. +# output: 시세 History OHLCV DataFrame +def get_stock_history_by_ohlcv(stock_no, gb_cd='D', adVar=False): + hdf1 = get_stock_history(stock_no, gb_cd) + + chosend_fld = ['stck_bsop_date', 'stck_oprc', 'stck_hgpr', 'stck_lwpr', 'stck_clpr', 'acml_vol'] + renamed_fld = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume'] + + hdf1 = hdf1[chosend_fld] + ren_dict = dict() + i = 0 + for x in chosend_fld: + ren_dict[x] = renamed_fld[i] + i += 1 + + hdf1.rename(columns = ren_dict, inplace=True) + hdf1[['Date']] = hdf1[['Date']].apply(pd.to_datetime) + hdf1[['Open','High','Low','Close','Volume']] = hdf1[['Open','High','Low','Close','Volume']].apply(pd.to_numeric) + hdf1.set_index('Date', inplace=True) + + if(adVar): + hdf1['inter_volatile'] = (hdf1['High']-hdf1['Low'])/hdf1['Close'] + hdf1['pct_change'] = (hdf1['Close'] - hdf1['Close'].shift(-1))/hdf1['Close'].shift(-1) * 100 + + + return hdf1 + + +# 투자자별 매매 동향 +# Input: 종목코드 +# output: 매매 동향 History DataFrame (Date, PerBuy, ForBuy, OrgBuy) 30개 row를 반환 +def get_stock_investor(stock_no): + url = "/uapi/domestic-stock/v1/quotations/inquire-investor" + tr_id = "FHKST01010900" + + params = { + "FID_COND_MRKT_DIV_CODE": _getStockDiv(stock_no), + "FID_INPUT_ISCD": stock_no + } + + t1 = _url_fetch(url, tr_id, params) + + if t1.isOK(): + hdf1 = pd.DataFrame(t1.getBody().output) + + chosend_fld = ['stck_bsop_date', 'prsn_ntby_qty', 'frgn_ntby_qty', 'orgn_ntby_qty'] + renamed_fld = ['Date', 'PerBuy', 'ForBuy', 'OrgBuy'] + + hdf1 = hdf1[chosend_fld] + ren_dict = dict() + i = 0 + for x in chosend_fld: + ren_dict[x] = renamed_fld[i] + i += 1 + + hdf1.rename(columns = ren_dict, inplace=True) + hdf1[['Date']] = hdf1[['Date']].apply(pd.to_datetime) + hdf1[['PerBuy','ForBuy','OrgBuy']] = hdf1[['PerBuy','ForBuy','OrgBuy']].apply(pd.to_numeric) + hdf1['EtcBuy'] = (hdf1['PerBuy'] + hdf1['ForBuy'] + hdf1['OrgBuy']) * -1 + hdf1.set_index('Date', inplace=True) + #sum을 맨 마지막에 추가하는 경우 + #tdf.append(tdf.sum(numeric_only=True), ignore_index=True) <- index를 없애고 만드는 경우 + #tdf.loc['Total'] = tdf.sum() <- index 에 Total 을 추가하는 경우 + return hdf1 + else: + t1.printError() + return pd.DataFrame() diff --git a/한국투자증권(API)/legacy/rest/kis_auth.py b/한국투자증권(API)/legacy/rest/kis_auth.py new file mode 100644 index 0000000..54565df --- /dev/null +++ b/한국투자증권(API)/legacy/rest/kis_auth.py @@ -0,0 +1,208 @@ +""" +해당 접근토큰발급관리 파일을 그대로 사용하시면 오류 발생할 수 있습니다. +토큰저장 및 발급 함수 등을 참고하시되 본인 환경에 맞게 코드 수정하셔서 사용하시기 바랍니다. + +Created on Wed Feb 15 16:57:19 2023 + +@author: Administrator +""" + +import time, copy +import yaml +import requests +import json + +import os + +import pandas as pd + +from collections import namedtuple +from datetime import datetime + +config_root = os.getcwd() + '\\' +# config_root = 'd:\\KIS\\config\\' # 토큰 파일이 저장될 폴더, 제3자가 찾지 어렵도록 경로 설정하시기 바랍니다. +#token_tmp = config_root + 'KIS000000' # 토큰 로컬저장시 파일 이름 지정, 파일이름을 토큰값이 유추가능한 파일명은 삼가바랍니다. +#token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d%H%M%S") # 토큰 로컬저장시 파일명 년월일시분초 +token_tmp = config_root + 'KIS' + datetime.today().strftime("%Y%m%d") # 토큰 로컬저장시 파일명 년월일 + +# 접근토큰 관리하는 파일 존재여부 체크, 없으면 생성 +if os.path.exists(token_tmp) == False: + f = open(token_tmp, "w+") + +# 앱키, 앱시크리트, 토큰, 계좌번호 등 저장관리, 자신만의 경로와 파일명으로 설정하시기 바랍니다. +# pip install PyYAML (패키지설치) +with open(config_root + 'kis_devlp.yaml', encoding='UTF-8') as f: + _cfg = yaml.load(f, Loader=yaml.FullLoader) + +_TRENV = tuple() +_last_auth_time = datetime.now() +_autoReAuth = False +_DEBUG = False +_isPaper = False + +# 기본 헤더값 정의 +_base_headers = { + "Content-Type": "application/json", + "Accept": "text/plain", + "charset": "UTF-8", + 'User-Agent': _cfg['my_agent'] +} + +# 토큰 발급 받아 저장 (토큰값, 토큰 유효시간,1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def save_token(my_token, my_expired): + valid_date = datetime.strptime(my_expired, '%Y-%m-%d %H:%M:%S') + print('Save token date: ', valid_date) + with open(token_tmp, 'w', encoding='utf-8') as f: + f.write(f'token: {my_token}\n') + f.write(f'valid-date: {valid_date}\n') + + +# 토큰 확인 (토큰값, 토큰 유효시간_1일, 6시간 이내 발급신청시는 기존 토큰값과 동일, 발급시 알림톡 발송) +def read_token(): + try: + # 토큰이 저장된 파일 읽기 + with open(token_tmp, encoding='UTF-8') as f: + tkg_tmp = yaml.load(f, Loader=yaml.FullLoader) + + # 토큰 만료 일,시간 + exp_dt = datetime.strftime(tkg_tmp['valid-date'], '%Y-%m-%d %H:%M:%S') + # 현재일자,시간 + now_dt = datetime.today().strftime("%Y-%m-%d %H:%M:%S") + + print('expire dt: ', exp_dt, ' vs now dt:', now_dt) + # 저장된 토큰 만료일자 체크 (만료일시 > 현재일시 인경우 보관 토큰 리턴) + if exp_dt > now_dt: + return tkg_tmp['token'] + else: + # print('Need new token: ', tkg_tmp['valid-date']) + return None + except Exception as e: + # print('read token error: ', e) + return None + +# 토큰 유효시간 체크해서 만료된 토큰이면 재발급처리 +def _getBaseHeader(): + if _autoReAuth: reAuth() + return copy.deepcopy(_base_headers) + + +# 가져오기 : 앱키, 앱시크리트, 종합계좌번호(계좌번호 중 숫자8자리), 계좌상품코드(계좌번호 중 숫자2자리), 토큰, 도메인 +def _setTRENV(cfg): + nt1 = namedtuple('KISEnv', ['my_app', 'my_sec', 'my_acct', 'my_prod', 'my_token', 'my_url']) + d = { + 'my_app': cfg['my_app'], # 앱키 + 'my_sec': cfg['my_sec'], # 앱시크리트 + 'my_acct': cfg['my_acct'], # 종합계좌번호(8자리) + 'my_prod': cfg['my_prod'], # 계좌상품코드(2자리) + 'my_token': cfg['my_token'], # 토큰 + 'my_url': cfg['my_url'] # 실전 도메인 (https://openapi.koreainvestment.com:9443) + } # 모의 도메인 (https://openapivts.koreainvestment.com:29443) + + global _TRENV + _TRENV = nt1(**d) + + +def isPaperTrading(): # 모의투자 매매 + return _isPaper + + +# 실전투자면 'prod', 모의투자면 'vps'를 셋팅 하시기 바랍니다. +def changeTREnv(token_key, svr='prod', product='01'): + cfg = dict() + + global _isPaper + if svr == 'prod': # 실전투자 + ak1 = 'my_app' # 실전투자용 앱키 + ak2 = 'my_sec' # 실전투자용 앱시크리트 + _isPaper = False + elif svr == 'vps': # 모의투자 + ak1 = 'paper_app' # 모의투자용 앱키 + ak2 = 'paper_sec' # 모의투자용 앱시크리트 + _isPaper = True + + cfg['my_app'] = _cfg[ak1] + cfg['my_sec'] = _cfg[ak2] + + if svr == 'prod' and product == '01': # 실전투자 주식투자, 위탁계좌, 투자계좌 + cfg['my_acct'] = _cfg['my_acct_stock'] + elif svr == 'prod' and product == '03': # 실전투자 선물옵션(파생) + cfg['my_acct'] = _cfg['my_acct_future'] + elif svr == 'vps' and product == '01': # 모의투자 주식투자, 위탁계좌, 투자계좌 + cfg['my_acct'] = _cfg['my_paper_stock'] + elif svr == 'vps' and product == '03': # 모의투자 선물옵션(파생) + cfg['my_acct'] = _cfg['my_paper_future'] + + cfg['my_prod'] = product + cfg['my_token'] = token_key + cfg['my_url'] = _cfg[svr] + + _setTRENV(cfg) + + +def _getResultObject(json_data): + _tc_ = namedtuple('res', json_data.keys()) + + return _tc_(**json_data) + + +# Token 발급, 유효기간 1일, 6시간 이내 발급시 기존 token값 유지, 발급시 알림톡 무조건 발송 +def auth(svr='prod', product='01', url=None): + p = { + "grant_type": "client_credentials", + } + # 개인 환경파일 "kis_devlp.yaml" 파일을 참조하여 앱키, 앱시크리트 정보 가져오기 + # 개인 환경파일명과 위치는 고객님만 아는 위치로 설정 바랍니다. + if svr == 'prod': # 실전투자 + ak1 = 'my_app' # 앱키 (실전투자용) + ak2 = 'my_sec' # 앱시크리트 (실전투자용) + elif svr == 'vps': # 모의투자 + ak1 = 'paper_app' # 앱키 (모의투자용) + ak2 = 'paper_sec' # 앱시크리트 (모의투자용) + + # 앱키, 앱시크리트 가져오기 + p["appkey"] = _cfg[ak1] + p["appsecret"] = _cfg[ak2] + + # 기존 발급된 토큰이 있는지 확인 + saved_token = read_token() # 기존 발급 토큰 확인 + print("saved_token: ", saved_token) + if saved_token is None: # 기존 발급 토큰 확인이 안되면 발급처리 + url = f'{_cfg[svr]}/oauth2/tokenP' + res = requests.post(url, data=json.dumps(p), headers=_getBaseHeader()) # 토큰 발급 + rescode = res.status_code + if rescode == 200: # 토큰 정상 발급 + my_token = _getResultObject(res.json()).access_token # 토큰값 가져오기 + my_expired= _getResultObject(res.json()).access_token_token_expired # 토큰값 만료일시 가져오기 + save_token(my_token, my_expired) # 새로 발급 받은 토큰 저장 + else: + print('Get Authentification token fail!\nYou have to restart your app!!!') + return + else: + my_token = saved_token # 기존 발급 토큰 확인되어 기존 토큰 사용 + + # 발급토큰 정보 포함해서 헤더값 저장 관리, API 호출시 필요 + changeTREnv(f"Bearer {my_token}", svr, product) + + _base_headers["authorization"] = _TRENV.my_token + _base_headers["appkey"] = _TRENV.my_app + _base_headers["appsecret"] = _TRENV.my_sec + + global _last_auth_time + _last_auth_time = datetime.now() + + if (_DEBUG): + print(f'[{_last_auth_time}] => get AUTH Key completed!') + + +# end of initialize, 토큰 재발급, 토큰 발급시 유효시간 1일 +# 프로그램 실행시 _last_auth_time에 저장하여 유효시간 체크, 유효시간 만료시 토큰 발급 처리 +def reAuth(svr='prod', product='01'): + n2 = datetime.now() + if (n2 - _last_auth_time).seconds >= 86400: # 유효시간 1일 + auth(svr, product) + +# 접근토큰발급 저장 +auth() +# 접근토큰 조회 +gettoken = read_token() +print(gettoken) diff --git a/한국투자증권(API)/legacy/rest/kis_devlp.yaml b/한국투자증권(API)/legacy/rest/kis_devlp.yaml new file mode 100644 index 0000000..e83fb65 --- /dev/null +++ b/한국투자증권(API)/legacy/rest/kis_devlp.yaml @@ -0,0 +1,28 @@ +#홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 +#실전투자 +my_app: "" +my_sec: "" + +#모의투자 +paper_app: "" +paper_sec: "" + +#계좌번호 앞 8자리 +my_acct_stock: "12345678" +my_acct_future: "" +my_paper_stock: "" +my_paper_future: "" + +#계좌번호 뒤 2자리 +my_prod: "01" + +#domain info +prod: "https://openapi.koreainvestment.com:9443" #서비스 +ops: "ws://ops.koreainvestment.com:21000" #웹소켓 +vps: "https://openapivts.koreainvestment.com:29443" #모의투자서비스 +vops: "ws://ops.koreainvestment.com:31000" #모의투자웹소켓 + +my_token: "" + +# User-Agent; Chrome > F12 개발자 모드 > Console > navigator.userAgent > 자신의 userAgent 확인가능 +my_agent : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" diff --git a/한국투자증권(API)/legacy/rest/kisdev_vi.yaml b/한국투자증권(API)/legacy/rest/kisdev_vi.yaml new file mode 100644 index 0000000..476cd6d --- /dev/null +++ b/한국투자증권(API)/legacy/rest/kisdev_vi.yaml @@ -0,0 +1,20 @@ +my_app: "" +my_sec: "" +paper_app: "" +paper_sec: "" +my_acct_stock: "" +my_acct_future: "" +my_paper_stock: "" +my_paper_future: "" + + +# User Agent +my_agent: "'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36" + + + +#domain info +prod: "https://openapi.koreainvestment.com:9443" #서비스 +ops: "ws://ops.koreainvestment.com:21000" #웹소켓 +vps: "https://openapivts.koreainvestment.com:29443" #모의투자서비스 +vops: "ws://ops.koreainvestment.com:31000" #모의투자웹소켓 \ No newline at end of file diff --git a/한국투자증권(API)/legacy/rest/vba_sample.xlsm b/한국투자증권(API)/legacy/rest/vba_sample.xlsm new file mode 100644 index 0000000000000000000000000000000000000000..496235f1d72ce723225efffaba31be35bed7db74 GIT binary patch literal 79260 zcmeFX^;29y+bv3P2@Db>xCEEMT>^waf+ZnXa2*I1+!>q%w*Uz;xCD21cXwxSm%#>x zxxDwgx9Xhw&VTTo{-Jm8>aJbgUF%tEb?@hsG8+0T6igIs6ciK&l~rfA9|UXbsvg^Afg_@5^Af zkTIrHhi6x$$tTb*qkIT3w05$s+{JV{UI4GhwbbAUQ`q6&Tg3R zG6WXHDJZEiw&v&k{8GA2+;eSy`MGd|NHS@`xMC4TM&@K!*|0pd*Bak=QF2!Wng67z z(q|PFuO!#ocLaK4p~Dr4N;9)WBsk6&Fw=Q_A744r6Oo2v+ZGAi2-h&@ z%6WxYOdo2982qnd}{hqtR<{%R5FYMb_A&BcG2#c_m-1uWtg9ynhVB&?$BI}wom=n;HiMG z!t_f=cVBCGrTPR;xwb{znz2sI$}CV3{$FEMr^Q;YO(T75dT! z{>N)e9_v%!r-6r5a2J-x;{=f9_KbRB#m!+4) ztEzYNz6?E6dJG%5on4J3lv8$>RcdDV>gWGq1yCE6^M-1*ot2vKD`gOxBDmG>acFr} zGU{-E;bu#)B!c*r1XG=RX=pOs(G`n>#VP5%W65R@k=yL`?9Cs=kDhF9tuY+M4TV|C zgX>K1r!U@B5{~m|Q{s^1QHPRA{R#Nir>eVVdRO*hR!-xjG_;~#B=ay~JQX~jlz)IP z^HWUac6BeenH=ySKj@$WBbLE!T*_0MEzr2QHOQ>f`1Gr24;a+Qr6cf zVP%6r%KQVR5P1Nf*rkf4CrcMsJL#a$bkFwin$D}a4uQYF(Z*RBUn%nZ3>8o8__L5C z;YiO^_^IGE?HI494Jt7i7ruCHgbZo3;r_h8k+BD)b$+`G?mXBnt&WT``9Rw7LV+`G zsqAHQnaTM$Z@L5jAxU4!&q?1t0xNI%kF)=V_#4#zK1f>^PQAEvCve2JR(E;h-a2hi z&f8K19jU*STZRJ-X?)QVjGm$L-!aEV{O54snUp_Zpr8PrM?7Qhe??o#S5=$kx6hgl zr|VfGwYFHSjM~`%ec3cLK0qL%jCSjpuC{<*mEqw%t7|1!K6*+c3rfjUiVIMr%3232naN8A@*aCv+ZWrzDUi{nSf(7A_Nb z4Z6a6${Ixto;QEqe7ZrMpC9M$NB?8q%m*wmL2)))035UjUQ6fQ#LnP3VX>fQ*Zc9 z!_wPqZqDtC_n>ymW%qjnhfl8@)a`@I%XpIL?A5fAA=(Zy=|0W(RV^Mdk+JXJsKZ_i zG_kxaqAH7W3_!O#Wd8e6O^^n=O!haO*HbYn^9?;&W__hPWJl!-MYY^dd#tuMRtdkB zn8byh{&-kT(9&^O?KhC;M+)RIPs&AynU0aXFcVpuh*_bFZvPaEuCPh=)v&VowB0>x znY|ABbFvXWd)6gL)*l&Wddfg}<^q)lLSl3a%>ZJf`S?$VCwvyuI`Ydj1%|)`2jgTs z46&id~Xw>(-Kq zz@bOX;>mT2ZBMq+J0^EPz(U2C|GKaWlW`AY&yt8R_6=JoesmzVy(qUnC$&o!gv}r$ zlj&;WwcE*B-Kvx7a`~)k{i4%IzMk_)fP~84za}XHyuqJqAT7MhqGXN*gW;3jTkA-r2>|*24Ke1lyuD z9K9_3YW3Ns60X?5Dt4AabLnYg{86kw8Rx&PuX#84?v9Yni=%)o)(Cszl#)K;*?v7~ zCOpXluPb(NSfC#QzcXFNOWv-qzLv5^SFHa!uQEvSKu-Jqt0f1hD)J&mq)4E@Q25<$ zFy{xemI5Kac%KK=uc=Z6^LiigQL%OVJ#18JT~@`HzsMfqX@17x44Dd~NI9G;$vhz8Qb~6TJcwwjEYR?h?xSIV-p5bH3YDj|c94 z66`YXtIY5WkF3g%dd^>m+WSdAV(%7IvsE1P;$DD)N=x4n%Qn-TA-%3PPi$c0>t}1o zo90!0!p^%ky_ZYVdf7HV4X`Mm1j z5?bkk_vi{qL5-u`msO)p(%9@i86Xp31ZskqofR!~u||Q8sIJI`pwZjaKyHApxL6bC zX@xCaK7k5%bnYwbM@BU~G%_nK`;+y;p{1P20K?dKVoZ7Q!OI^h)L>}-qilQgbwp2J z(~Lzh;w9p6uU_iE;GUhE;6N(1Lep-JtH0_^LVW2!ZU^iG-e8D!B>j%sL~BDqE3KOr^-&$KIl#dY`xlY$Pt+V( zrL7o=^u6j2lQHT}p9j$|9aD&?xZPWEp8i1Pz1r0=v!mm^`Rh=8mWlC^y8vU+(b-ui z^1|^^YIITU?FigJrb5r++fNF*{&73bb5Py*vrV^Y)7q;Rbs~l+nhn7pOtT~HK_Tjl|;SKi92Mt2`)7G1PH<^C~-+zmV zP?OLYnX#LU?qztNHi7}o5y;E3o$|*UDez%% z8EbmO)fk+tU^%}~+j~%vBwj2NmUv1AO7#qtqYjEo zfiUgZwn!JOFT@9Gxr(vU{@V0O!hDr)Ppxu?77oQpx6vKFUlhFBESLH6l?4lgH(_U?E&f+ z+5=D=JdTGEpI#~gMm@zEhZ&cl==I`YFV^rK98U=%=Y><`FBt5CbHG2v`-SKLcWPLP zIhQC`J61YMFx-XI`lU5>Q6!8!jwO~QE2kM=-738DbUcvI(% zaqFi$$j$gN1VS~^e;`5n#xIQ_)elHvA4?=?1>6po zu?TsPu|7t&q&|%=T>0IChmhbRq;sTYI%h+_TTj{oM~6%pxevL!7aGk0z!9vJmZ)|) zdxmHjV+Cx;lS04%(LStz$h-XHQ}8(b&-%nk z!JK2jc`#!KiYbuAk1oGa{gIra$uVwjaV zXm+(&qc_Rk!y}S5?-O0r*ikkPw(y9!3VIs@L2bDjFO=-9^Ulx`ypeDo`&Cr*D^7Vn zKP?-%GMGFDFu=HLXy02#mL5DlBtH#;A8&3A;fNIn-z$f+M(3kBV8$`!Uzhfj`+F6Z z1c~@TTE9o4{^8?rRyDEZ)r^IpKO>W6W{}n^0ri+@BT8{G%7@e5%ZZ%@@{G&S_pA|v zn;IkvV5{%@Q~Rs8JFHH&;}uu#SS)3$o|hvv+O!ZZ`*pETEr*GUVfo<& z5hR0gNA~07YKEz4l_vd=NQ9 z_G|9Jp}o#@K*Z_Q_~UNJZM&1Oz-1j|0|hFoT8aVEwj<|$8Z=r#EU_Z@lQaAtVrcIq zkZ#vhFxC5^w{9Y6zc+A4L>RL>2e0p9Zc z3Fy>8)r&U`C3eb(JUwQ82_i>;rdZTf~|0ZixwXJV!eS=15tUi5&j(Qxf zz3jov0Zy8?WnpW$L?u?`Cr=`hL(a=H6D~nGk$H@%V;6mT?;9lF9@aPIk5I3jR{eTx zttkAU+1@XF+G*k=6t&r=Gl}7!ReK7V{wPwnb5=$%d@sQL+^3beL zoQ(aAmJ1LZ@%A?x!%mKG@KZf)2fEiy;B?}YSS)@6b3o3t%ZQxo%v}tZMV@?aWHN#C zG5SNT1xL&!?|@yZR}IdqkM=;o5uooSrFMV5p0WoDm%)_o$z`J@l6}Y_b6{N8T&QTwWNoof((jGZFb9k(#KnzJkSzr^rM7l3i}%%Q)6Z(zgUA$hky9i z={_Je&v~2^FtuHf7w7M8Q%~#u?z|N#wmp_>0i89w-c!GTDcI>w^Bkig>Ppa)DsiUr z=JiBbJ${oq`5u4?ULo+O-!KLy$j!dR0~6AesAs@hG(kZm^#GIAE~lCu~cK8 zmoAd{hV(D4!FTPxvO#18tYLmw6s*zkxn8a+=%M@H5Z|6-qYTj9j!P=}O8UHbHYa*+ zRI^n$>6D^gI@Ix>kiG9K=sa_zts?cY;64LS&;uI943B%f^wNhR(Mr4ci^8Eh9drgR zxK2S@PO0s;08SIRN&$`FwBa#8^uJN%)yT6OFhR4gftrP~jTG+4Q|?Rrk*N0&(||_4 zuY@BeA5?>a$6N(HDG0v@{wcTLvBTZnJqR?mk1fMK?OipKmsg{$m+j=LXGnpM;H;sw ze80%u_Z}GDfZ|!M$#%X>!swjI`hFpZ?i}Qz_Cw}6yIht1JzjeW| z0K%o~(c5K1rdEhD%LB<*2|0*eM{5E!#X)L+l!st(>o2{1a!Fa6xh{<*kT~ZT&T{w~ zqSj)*Dfqs6ExhckCZw1wW9KJmI2d2IAM>CvnSFT1Cfc(%R22^xdPlRbA~sBPx#-4e z;%D8gsi0o?)Rym<9F9d@ofh1M6ZIS7fvZ^aIfWo5YZ#uCRudwSG;)l|?`+aEQ<)5_ zbDOl-AvHLXv@(elgE?y^$A|D`W5TTQw7K+af2f*Sge~H`6zVxKbnNwJor0Fl6BS@x8nmwz1z>R1`bvE2sD9#L|U|46Mb4KiPj~1tUivr?`d&&Fy!+p)P`&i2eRHGt`ac`TXM`~>^41MgJ{(1a9 zMuVc28*z~XWAtA)`q)2SPO$yjICjN~#nPDG2;ZQhaKJ$|g6Lt$YGD z87topJ=CS&{=$C4O5;J7**l-Duwym(&F6(v41`3)Ic5({kTA0orIjL6&Oa3GEAE7q z|ImxSxDzh^(j@c-%G3YgCn+I84gDMoBMa+S6?&gb?S0 zLXVMs0mgfiE=8yr0(Xe(m2#x$GVjO1C_+kcWk)q}J@L|A4vSqTe^`cc zU><&u6>#Z!awfLR|F*_QvdQn|&k=~-;Mvq=H4S{4F6uFkO5G*V$jaNV1?ri1a$gDq zf8h>r$U|1`tFLe2%7=W1oH%pdTY+IodV}Ldw6$$&<#3R44Kw7p@?3`ETj=Gf-|Ngw(S40i# z$p8fa9LkKjT5^?xbe*1w9l?L7oZ7vn)nL8)a~qnN(DRdRr>A>|OGzxEA#8Zj9jc!> z{_niB_QJJDBh6Rj@`cey_mtSRzYbva_U7Qd{VS2#W)#{bR&q0E$E~#EiDt%~A2yj9 zXGzldo2fQX0k8VQdJm0O^`;fWhTrSC9rCROym;7K95waJLc`ax4F;W$L=y{THmPg{ zj5{-WJB4wJJOw;Ef6VxheRNan z5!57#HECBodwD^hg5e*Noj?92U#Zd>b8Maa+WggXvNUi^wlw{Ty`DfEj2s)G@jdNsULO`gRKjJpUiDXr!@4e*p5GifLcLnI zZVpk7dboY3et%Bp)IOBq9=C?1Trszf%<^=7$}jV7MQzY$HF)iO^tRx_VQ#3NvwXSv zD|_>b6IDn1%_Yl<<`NCEq1Uo3YFIDvGG8BX{kK=96{EnpZm7BJc(Q|knx}mEj}|Nq z_WJbgC*+qM*W_jUmQyPm$asUr#NyZqY@A)JCP8&QMD<-?LZ9zK=sW&-o@2ZN(X0HU zVs6fY4$!9KchZMB&NH7SUD-c+Gt;7Ld#&^L_*y99XusyXCxX)^y z6h94Y-I=@-Tp|C|GF;l9o=N3>=+wUH)XcLei_9Okli`6bo!kIwA#M|?;bX|9qwAPe zPq%Oac)h;;0Rp}JXU#COfTx~&UJizkGWy|Nxf8k@1FK)dqTcI2zf!o%#gZPo@qK*2 z;`4Z!=Ca)fseRO6i`2s?f1Ui^e*flrU;Q%e1d;!z+{8NwQOYY&zOCXqgQQUa$y6Ry zx9>%qGQwoFBWAn<9GFYMOGSYo*@M+6T8Purs4C3f-{H#3Az5^iX57r12>L0PcKCsB zJ_ONVQRL2JukEn(icl@WH%;YA#5E@$=2{dO{?*C*!$ZO!(&9QAgtpcE4&&1N(hgLkwt)@DfHID$kY>#_Q zb-Eve?~dU`_Me3>ZyhwxH1EaToKJ)ukh>1doK#|f9UR-8dCURLQhzsAZM|Pvy0l6h zUEuHZmneF-!+xjpgupMJXj#|ZN%0Crlqiy=TjKj^qQ= zmVi^esQ35XWn6sIVoZieipYIsTWJ8aeVp%0B`(gA^&=xV46P*2fBj1CvGiG5zw(`b z$P_PG`t)>jU9Bd2keTO04eq?md;4T)p*|EH@6ea320r{%E}4%gYW1D^xE4Y4RDf{h z?J^?Ir0Vazam?Es3#6qbzrAg^@SGu^{y6~Wk&1*m-r3MfHl?3^b)J@S;ahVc1P^aS z*@9k^+jy+~1(<(DbX|nlVD)H`WtB;IeYbaO7Ki_wsrHhI=G=_2i5=C_HCo49Z(Y5g zKkb9Q!@U$fih1yEJK_nVlV1q+tHk%?D|Ioyr~8C35j&5V6a8J&$DrY7va6Kl`MQ5; z`NWE_f9aqfwY>td6P*EUc6Kjr$7!}ko_FRzW5U|89xAR9K6zJRT1pNCh}g19i$G;x zjE{PRBV_ZE(;*F-_(;Kph}HSH=6>cff~Up$;it2^ zPrmX)!6~a7^(B3Io`c%&VGo-n=INV9yW}c6MC%3fxfxqik&$Z9p4%)jT@O`Hb6PUgQp!o#YJHjMaUC*EJ*KBuMcFr+k$Y@eT80@NE zrvhNjRON$d?rp^T?g#mZA;@ccDdZ1j8OCZw6OA*~lI+}I=(s-4<&N-gAU@A7C&qog z$nWyZOHxb2#Y|)jChW$wPv^}lgdGc3tNOd0Ye&82@zZ0P+v0llzFLkiug^-2FJ@=X z!#u%b`ibtIjKdW8nb2Z@>)uC*de4FRr^YsdpLhuJ`GKf;3HUfM#W%-$4Q`1=g!0Xt z$}+j7^zXzBgOlXfLbDW&CX1|$YOkMTO?>Dy?3XhYLJ{$Vuah=9N zC%>*b%%1h~q?}y{C^?(AxA?#XF6IBJtVaP}b(KrLn*FFys$6Joa5LNS7jHgFeD15S zN<>+?^XjnFFqwsKx((SF`O7G8t2Dr(B<6IqWX`5n6i6=DS#{ho*xNXAKG$)rzmc`y zC^{fO{R8dQpCim5u>uz1Hml@uUym{qC8%MQXHs`|s5gT!aDMLbcuk2@g72nK8y3tt zq{d!TJw@dmoUtCC?9XkxnA$5gz-Hzr1*|$uQqk+%!i4=0TX9zjs_#=!oKO8{m`3MF zr%^YNu5iu^xuL${Y%L#f<=%55^{hY@D=~{uKLa`$m|u}v!u$#sS&jYbz^_(&)=TY2 z5dwR7r{t@^W+S;*mTaT0t<};$FGrqUMC51WCSP=xG~0QR(v38wy1=RLJxOC1@`c;6 z^!60MQy{vDN1MCY>ivBEwR^>)_iCChrrr}7p+Njbef4Rc#9x%Yp_ic@aK9klzLB&V%Yv+ELjNObs2I79fyj7yv@w?I& z0spNtw^cZ*PFIx@BP@2qj8PT2E)N`YZQ6W(295cG4L$g zPM^6Fw-FibSw4M%Rvw-vM6u=RO|B2R>IKMdFs<`^QTg7I`5`vk0k_ThJQbq`oY@rs^2VcqaDVz0^JgdIf5!n^dBQKt~*Ir4# zpfmZDRWvG=d64{QJB~NBl3KZ2yAs5I^G`3OhC|vJz-c?Ka7+}ZmE^5?YSQL@6r7Ima@9COdGm!2&QFjt9-PD<7T93P;#oIsuPc7fb{^ zb+t%}qQCCLKl4g2UVJAQ9{}+%%|ErwBFsQ1M3Ih;r2>1*ZucwTdKu@l3`l_^8ATrJ zEi`8zkLuiEPL0cfpeXd~z7x}f1I_q=do}#<4+#eSNJoiAOfO&ej#*6*detsI4HZQk|3&s#lHW1w0dZC@}TQuco?hcacbpQ8N; z;5XRfcJrjN5G8^=D+312HtuzoS*6wRd?xrMqET9gYyI>)>X#8{b zs>HK6Ozh>jZgSjQY)TBMhN||Add#tV{4z|CoAY+`?)@u(#Y1dmpm&yyURe7C=zCag zfo%=XO)SJ|L^I`=A$jU0KAnt>%yQ7{$=g+OGw_ya$_&!x8!BvA~S#eb+4Q zx8pi6*{tf9>)G8SAIGTgTCv6Nt!<%z?fR3xTbAQ-pS><09t&anZc@qAP#W?O&=X5b z-D4E*@INNa*vB#>z}5q<&ou0cG9zwW|26ExALBpuP+pl^yCsdPO!Y%8O}VbZG?Gom`z4g- zW-?z6@z+Ub>>LvofWKcL51S#fdjP+|REJhit%sxi%jl|S^YPr2urCd|D}1$;O4erk zvz%-zr&Q;3(tWOfv?=`ZkjSS78WTwybGh1^1Q<6dHNhNxhi74PphP|5IXq zQ@4(~b#_EJ;!FkIoA$8eEv}+~w?vMM73DNK(#nhH5854lmlkGy7Zg z-!i!$7&5B;A{|cAMk$?qA+`dzjE7u|(9)^iyGfb_;BVINLF(ELV$+Vzz5&!>C%t>( z=Z2LKAdER~SoC#X|0y9D)rn1@_60JUP-d7}25Oi1Xvg3O$3ICXMl760bmVG#@meyz zUjK`BbFt#H>$~V>KfSI#atreM%+oFy2Dd=zK2iXx}bW#uW35h$o-BoAiMG< zHE4U2T#P%+^X+;l`6WL#_V%W7rC6t)EZvM~CCzH)s|l$vS^H1CMLFF#0@cyxF~(8KvGdc1 zDH7R@776dRftTvM@oK7*wfIM5_Bts+&G$TEo_HeMBc1E#T;DtfyCf?FB{|6qYtR3N z%!&jLyDPo{+ue+=ebN&idj=jQ-#rw5N;Tel$EBna`mIvAXi$q>Cqqs7cL6Xt70H+NASq zcwdk{RGWw&yAfo2HYi9X>;q|q-xUIGv3yJuo6(k;J)?Z#CLi{>B7pDtfQ|~6fu?ZL zr+og+uOVQG$5P7+5ym_Bjtu9&APH!<94lanXY(9`)oj^fvw*;c=&`06u7GCk4gum9 z3Ac`ZAjxT?wLjcpIX~`%@v_1)c}zL414%rriaj^8O37+Qz57?%P{;8i1;?sX@5t3~2Ga4?DZcS-_)yN_2~~4pyxS zsX&23+oedRwH3$|PkRCIjX8qBO$LSyO&0NFSfsq?yx= z;G70j;}bKTS+5NJJ)JC{*?t9|04E9gKDce~(4D-7sH_wqf)T6JI<*er4XgHsT>;#v zPr(Uu6o^wdRwkD@5l)vp&|CNPPPIQn0K6_RicIV0s_hY6UlGQ4tMSv3vGPd$3YgIx z#gk`P_0%B5e7W>_J?cVEg>BUBUu=C~OmIUjvxPljR-g-f&G`9CReg6!1U;NvZht<& z4VhK20Lx8fSJ|a!nn1BE{n4zx;=hCQr<2|8xe9wiY3_&9|@^&S_o z{puXlt_p>BhJ{U*zgT|Qu23B&a$3muk?pIoW@5V)E?{@5I|$4huSy*Dy4XoB6gHTZ z6mjBrF`_!w*P2T5U{@H06-HRkVr0G@Jh2YcV7O{i+fkxhrMT{HJQ7G zIH`PhS&zDntINxAG*9iFzwd~0Ym8O8vks?)pq48TFI`$jl{$R0L|gOf4SO|93jYx$ z^h~f`Otn+rnHy8m`+At-T>Y{H<{aveYv%oimWVI=`}NGtGFZ@%8z!D;ZbDZ7TXXnD@0p|RM?6ca9l<`) z9kF|VP`yUQ^Hekb^>%lAMyDnUfGz}|Cys6Gap#2MYN=~OroI(N7E@li)#-j$+(J#~ zY3#6l9=kTcPSic7z9DRPasD>#v1UAQgGuxn+L;{(bq+-FT__izG_&nm`LO>znmfgn z`sE!|?Ze%ym&Sh0NlmX2o`-%xStTWqvV(=C5N!_|oWa_D3>4xXDYwA8sd}}BDra-{ zlh2$zP;DK$DT)Xe{y;tDR(+Y>PUk!&N7sQyJ9gBT=0f>mZFj_`q!0C4@nHg~VQi4t z0zn%yuX$u@7{xio+Hx=XgV63>NR(ogu zp4fzbZca(5ls{T%vBzk`tNf>9vS9_8$vZj3^;zjyNM{+*W z2^kGpN482F_Y-T2j!$CwE$z}d4gFQTUi@neIRZva#>5{^jNh>WZd81=L&Bc=&?KSt z->-D~XlSUaY#}_PFVzN`H`g9wNY+0=3lG{=sEfxBU=v&{TXOXGU7= zsRQznQ1l9OV5OnWjT^JpGQ9Nam<~+n(2P@u{Hc9*)d^rV-sEZ3D56`!gpgCzD}Uu> z^e3|Y(C&JC7Y!1XeYcm3#E*bGNqe!7>$@-2=OrPYu@-R4?k;Dt-Azpo{e=$_31#qI z-?8Vd>7l;Hi_N;>@E5xN%nf=~Z{2B|L25d%>D52Zk+!{N{N8K_DYg}>a&x=JYjC4< z6fe@rXW&s61XkO2*rB!Ua89l^zu?l7{10RtOM_xk6-)XsO7H~xZUM|`X%nv@SCl#G zt2@t>Sm(_!kotpzOnr3gPp!u;cLqiTXmU%p)?=mvRnKuSaf3bwrXu<}>bJC*>G^Rc zK6ggod2WRk2Oc1`jzdzBH^>S%W+{h+wj#y13%&oc0 zZ$=>SEvXj{BjzuQsOeWDjwX}w)s*qois^PHK&AaOcp)8*e_Fy_W!#7(v&QInfsj^Z zA+D`UaU3lXiDgJeH?(PEwPTpUZ@PU3nECfAIp(P8M--GO%*UHBx90qZp}}WKaq02U z``_d1r!!3ZQaUjrHEG*H3)SCocfa{5+?~nl7R#+iK|Wt+%si_Zf6w;^VVflzv>PqPk#1@qD%gi>degFx7DU%ObNZ864u;l0*_VZA1irqSrYv?8;B@Ib zPcxov4-RW0<;t)&ZC+hJZ*F@_yuYMX2>s=jA>|yO_z7)D+W265ifM%U+-D^ltr8jcS@xcQ_3TAL;*+2W)4dO zYKzsy_M-oUOwe+s@lXjaX5y9AYP71tya&TbjwyjD#=$?;gt3q4fbk#m!G7o^zXZNv z#XI31N$W7bZ(sg3sG{nD>iZT1NhhHliz5@%@-<-}i4mXLOAc8ZugaM6S_@*6=1g(g z4N#T&M&HWBvuUe*Cziou9hq`0#wiC{*)8Xy62sZ}@%X`i8z)^lfmlVt9KE`<0OKqV zJ7SG6a?xLabpgvB*DvnvZ-vBFM2kzh@!Gay#+=E1W}{fDN$-_0lD zt9ImuQg7H?^SywIhlRv&QCk?T&^WI z_P{W^`tO6$obcv-p_7pE3?0maq zjE9b2SKq>d8uBov>w-G^>M*8y>zFqyU9{TuzG%7Fb^m|q2BTfoWMz5{L_B!n6+F(_ zXb-MXK>-2{z!$%ky!5 zt?k3EYFuaHrDW#j8k^-p1AEjl)Du{KTgMr>NreG9B7wS&h}>b_4-%iy8HJmV~g zppp?;&+4w2o*axdF>+E#9wz>s_E?qy6IbS>q>b*|C@B#@>}QdX^r6Cvq5CyW>Fdp` zC$Xr6*Bgcr(%dj=1sz!aK<*P>SGOMAw0H&Av2ewXUXy9R23ax|(fYBbmKmgG7P(sC z3^G)32tAlmCx3JH>XHXF)o)3Ha0=gRioi3A4u$rW%Id$s1Bg&3?D?=~d&}JU+E@ju zxymkpW(&7Yaycjv+hl0=j5%Wa;eej*S{{7xrT^c6Pe{{?RB`cfYZ}!1LM8++gUiiy zn(-7?_ah5S!l~^h*sIkaVvvg*=V*#%#m5`h^;qkAP8$g}=ii+ki^%Q&@(Z|Gm&<#b z&rA1|o8KO?T+{V8gTi)xG;-JweHE=(-HR(LU*efNAFZ>dSx7r?E27CV&SDSPHF$KL z_{Y1S_z>P!x*HX%I{nlKrpt!CId&=a=b7g}XunkKGvg(5XB>RewXz_+;(R{HsQl5K zvPdgcIREiz_in=bt;1oq&~a z5VAegC8j;pz!a`44ZXL>_{7v|rWRexeX#F7lV!i@i3j}loL@6GUVE93ULF0~czWI` zS21z9_)e-NCt|_$;@N##W=vyGz9u)V#Q2nK{fXN7GFo71Pc6e^`?wcx4{@YOAniri zyq+twdv`GW;PY4)zb+vtekik*oS#3GpiV6gyBzp>u#^{+++R*>I#zUXG5H~c4Nc6| z&lyR$JDuqJ-RIcL(e$6_CNwNV$NVS2NYd5P)YQlH5+@zm9Sx>vzw@KOD1O|@`Zbts z^d@3ze4u^#!ujsQ?cfLG@%Ek0r;nLfYj1||4N^I>CW_*Uv6KskJGT~wNg9*O38Esa z$eLQ7y(vwjKD9jiI1K;JT8q5a_j*%f4*CQUu)gSW1naq+E%kkw`^0xNxinYW-k^c7e&P>S!g-K!T zJTU-rK%1oW)1}qtTEF{PcEl%T^#r6Jma3s2{!mhWA}h@xwI9rX9l6wie7q~@H==41 z&s`!qaYsGPyJJE8+A??C@^ZX0{^Y=P_G*`*cQbDA|4rGv6EJz2Sf~KwmkROk9`$`r zRIV89v2m#?PQdc9cqJ%x2AvmmqVn9MMjqbrg5^~Z`wK6?R@wW>5hPaA>?wJYe15*c zH-9+rRX5ui-$ZwPVKM_gB=`4+Di(I-4!P8dVnBqP#zm#e!{nFL;85+zzco4F>!s~i z|0IOaui5?fr$qHeQ@CQ?zYSj@Dlga@_FnMDsARv6qawD`G>&$YGU0~3d=y;@7A~lA zKYI_C1q{2rmsv2mTiP+L2_K%gJbuWcTPAGMSYwTB*}NE@FC**E|9Vwn4alPD?-bgE zx^IP(Fv;g6lv;klA3a>=VVo7dP^lljXY_d?Hy|nOQmZ6DOs6-zzOE|XC);nRr@n)rF`oT&`zOu&MlI(v z9jxjw$VI>vf;{6$!gsd@eCa7E357Jpg4^294%S|@-*z=lgWy0o>lg&{`tdDzeGr7j z<6p7Yqp-cwjU{fFq1Y~kYyn&Hu7h{C6p(W5>$fUT`gFnBiBBYZSnx4@$&K4|8Q0Ur zY2Q7F^oD#a_^HbuTn5-AwM8Q*DC}ZRoxHW~C*Cmf7y|FAAd3tKBpj>G^w&GCKGqh% zF~_QB3O*g<$bhrKnP)TAdup(Ud(gubIZwvL=g-)=G7R>Qz{56l$$v*5ujUv(6B8?$ zR=%Vt3*IKKOOi7t3(2c_MX#sCPaJ_?`87V{Q@~fvGL9Er#vg@Mt@>$r9ZB3-(+89# zT|#p!`=frfXXq?M2PMGJSu=X3joPBmr!MvmT+aDPwj4(uk*#N%zsYRV@(L8!vFg{n z-DRFr>&F`R()6^~zbt<;XkXLTjwZ+=nW`V0U*OQ2(-aXLAT?8L|2TIyF?{$J6JnqF znGa~`+Y!_R$8THGBH+0%CcFA2Eu1)%WNBn41-`4h<7Jwqvgh16HWt?NskeW};*;n) zdsI9RXZxfBHH<;rkXYgw7q2#S)@S(k_te;ySX-AmtS%fT*rfhFeD(6150&ujJp7w< zLLs?JS=KLWF>=2&dZq);0$wfL|5BVyt03FZ;O3)`!?#0g zWjofnMlFxOqNnn;p*oz0Q`-0*Tapy7=&x_-p`gs?4BP0+JXADN(x3!pk-W2V(MFbN zYp6)-uoEkzWWIQ`Kv3!$)Z^67>h}7Jb6>OkEy5`?0LgJQ(#=N5EZy)t@nP|}8ABJ_ z59G@98^2tbQt8?3h_7r|zf+OBkYG^AK-32wsN{}7u);=rEocH#^v})`nHLO_xjd+S z>@lBc3JQO=Z#(;p2-qkgq|KpMXFXVlELMK$T-(_ni~S7J|HZTj9qTV--W>^GlW8MBL3${vH#K5RBjFA~a8Y(e?Z-zWOBu@bL`I*x z5d+J<`od^L@Z;D0$5{ULilN&qQL|l{yi0j>p`#rkAv1Yn}5fSX%h|2N8@al$a2~Au2|Tp&Z#7%&}ckod5v!i;K<;kKr49h0b9~i z5dGBrE#||6c!jA&xlENoCAr_FpfPP@P(LF=miO;_@?!1lv%WSJwK9@LugZl%KJ@HK zznbc1tW+;m#5Y2-dP_c1<6dt-aKfMvQM4TKK7V1~|On!+utUIiqMe+=g zpc#K_LLgczr*dBwePh*IL+!&J;m>RBnF*$kk1g#=nWX#4Mg(Tn5p$y^QLqd@uK0WP z4mA2?O4t1|Kr#AVNAhqXQNl^in>HtDp%79d!#2L}Ga+yZuPC7`CA1e)R&t;`+b9^- ziI-##36NgRgDN;I%VN~(EnGm;zgkJOl9|eE5cx@37TBe-zikR45 zMW(;R<0|$Lty)$I?<5H!D*#k34qfCa&;4jELWx=k&#B5aeKFxb(l*=B^-|F4odm)p z$EGV3CKA{lV^vWa__CHAuRc_i@0VNmuGa?sJmmM8_`xrMz;fDJ+KM-2moZ6`Tq2qS zmMSip8f7B%X0DFGU?txqL)6PMF%&!&-1MJllw{1V0cxnJ67t;U0v%ZDIG)L z?G0k+F3UycNILzlFT7qx-+D-+y+ot!zzcnpDyk6(JMM{b8fx`T#CLa{dH?YOEH5%A zJ}_4ntpyGvBkzOhZ#nU>^PgaBNk3T646pZY@s_d7Ih;YxPssaPTv^NRrmktKw7p}N z8Y}h2kN+P4Q$Vc0r>a|i0J8cvZZo%uyCA_?{M@e+Ig1b!%Z{+L-hLw$1542#3;RnsB;Bxu|NE2m)CXe*==RQ6jHLp)}}N{N~GQnnKWn;aHYavcF5fz(urAcvO8i zf=|#pc?m$Pm>UZnj36~xU@)TKkhlyL@m2I84%)NV4&5F`R3u(OyG~qm$S1bLYr}a3 zrPUAS`6=>@?u`&Tx&Dz)_v_U}zgW*#&<^JVoRwkC2kVup-Zaq-^^l=PrR#Ae>iH*g zoL2gC`(&6OkY-81fb|kCnr0FX)~uvq1o}^kN9=?#WF#x6+-9?*wHHjd@H?)R9QXZ2 z^<9l0d~dQIc-f*R?4_jC@}Cu)UO*qLdM5h*qMh^OK|M^#pA-J+(94kWu%}WyreM7l zzaB?zCqThRa2fqekPXP;a~?U4`xJHihQdESKcJpZn$LFg`;&=h{rxFCe*@)tz9Pj* z^B3WK8PA98AK`!2dD4C?F>l{e^ZPVritB{)5Jo>nK$+*F-(l$4yTAta_4!FR!x3Xw zAOxnUHxN_^ZH)(e@~H8s@vHGXndr|`Dg9yn@G+`{3PVjz63&mIf3M+R>g?$Gd=-)u z+mnE)-mgHx#^mETPpNToZk|dR=jp^axz0Jx!)AS~Yoh-5sPBhR&nc{iuVNR}xMg8L z5!Q_Z^Y$IoHv)?^=$XOW>H$Sl7$68F{UFTUm@;suzP@m5prR3KQ!Y<(ma&LIIfRRr zq{O5X-%)$Nh2bOMj@;101Py4J$#GE#>g+K(cgld$IjfVLF1b<`7IMuK+R1(wi8p}1 z*80@+ioMqJO8KAg+JiI+2g2Y*P$P-)krpNMH>-Sv!*|BP$(sLj3H-9w@0H;S0yzq< zpXJUp2Ck&z7TnHbt(f?;Fo{2h6pTn4NGU98kP0JqiRJ#ZaLWJGa3XGTFR)<5ekS*o zyWUqPqT@sAy9HO$HLe%U>5$T#QBMw0SS1zZNu_s$ zW4l_9nm^Nd?Z`WtGP0k`%zjKn7x_IO-z|7tEq(k$*4K%7AHTj1<2(BmSNW3r>i!An zFZmeYWm2xWB3>r5q)~%&1%8L~@QjI<#L0=^`WDRIK90XQr@lX<=*N{PKJoldOYf(D zN_zhc@IFcDC!+Hgq5o0z59!s=`C*ms%KI_r`QHQImZ^SRnVvJ64ada@H=jh$)%fRF z`Nq?AO}GCIbX)(rnE3T>;@A6$U;jJt>yk<7iO-O?v<_01P*d1tbO!o(f}NrtT|jkE<08;E7bwbK?hCd+t`8AE@Q_VmO76ZFFpbm}HX`Zlk zAZ)Nab_l$s-WEFMj{ZPztc-{7p|TXYopQqY*_;o`@P zrJqOZv$QrV9s9tQ^h&xEHBO`SO5m)FfwKc$}W<0wTr(#O%|#?FJ<|E^^}b$?)q=OBM`X3V@53A=j#QR4kari{d^-u3Uh z(4xbXn5hS}YD`B-?t&7~SR|Yd8$iPOVFa~_bCsI8^m^u%m*3|8hm`&GASE6$V%u>S zFJsg2o(_0F_^IK&74q|^g!fkWgz$a{8}QiqCcNY7{nf(zvsZ*SBkWo8^@qUw;x*&v z{Xu(;HxrQIJTrnI=b2FjInTpLkGsyRdA_=JG_hXT!UwGvP6v0c^+99x!d5=57f$9Y zg#MT-)SaS7PU26N!cU!Bz;_({f66#dLT{ARTU%PBq<)9;AIoa^Il+tQ^_rY-;yE=n z)O()>jI_3iYm9&7CzIvVCMZ9)eM-qzX_R+O-2Q2Jjon!0Sy;Jf@l8vXE?Yh^{PnJJ z9*n;3O)7k+jG7m&J6@IiN%U<+Dt)67N8?&|sdP7PTwmkcfM4uA4AY>AE0t;{@bNCZ z=gHVa`gP*d9<{urQq`j;5`fH9{S|ZRI--JZQIn;;*{?S^n5fuaEpoB zvDOdU<2tICa6OUF%X5s?kBn`X*wk!1s|F(XQ$G;rPwS@g_Qm;Po{ymzW zxyAGZUQtf9i|czN-ccLPbHKTv?E2Rn^=tIliLztq9@pu)T)xk7@GN4i{v+!O>w8D_n&5@qz~(m9(T24wVUTc=KAN=FQf}Os{XP2D(CC>UzewG zx}8dI%MD0(YCUisNn!Pg0M{w();0!v13L|rg5Zk(*aJk`{9Q{K#TP$T+`((jChKj}B=Alu&zI1bz ztg!z7xArPo)S3St_9{5!!yo&<7y75bo+@nwAj?*nr&>HcRgMYCSJ)s@%~UEDE=jdi zF^yEXT`0A?y0^dX%bt~?UFy(g7!#1c>d34p2w0Nc#)DG zEJJ$S#fzY|-W4NJ_8qj*(PsbL(y`3Yc9${*(i}ik(YGtfdxhZTuFO@tO_^papGliC z{z+UeQ6To&ExwC%iPvuaG57=Su@ce=HM@BZK2@nFeXc67_h~x8zKq?!l>Qq_VGrgF zsHpY7I8Wz%UPQ|8Zz;QziR~vWId_!(M4`5ya8F=AL3llc`pAc^fF4hs9BCxL+ET_V z(Vc;CDqbsVdsxfx9kstEzFYHpwek|@^yQ@!+1~pJA?GNYdC>_ zfQ!<`$O>s5w{iU^j^a%GAU)^ak$S#gr1n&1pxp6>qVr?V39NF|$5Wn46RI)AvrQ6a zg9%Q@1|X9=Ojr{b#I+W9B^bo!%>x za@uGN$;Xy<0Lo3O!@L1Q}{LsIr~7+&f@D62~u+a01e z2sd^*t?2P9&k`6m>OG=d>FsD|7^0~o&rp@)$=ISmf9><4_67K%Ku>77=2+ig0oK(e zJ$u%ySwn7v{wt=D8ukeoWLoy>E@}}i$GwSdJhhEAEj^c3E?mT818?5Ps9@|ZdbvaiSLqFNx*A8kebRiS1^; zJ5u|Rl_&?hu*BM7k%hYd-HCGDspT?L%h60iEi_fmqZ(9(pK6|hspYa0u=v zi&W`|>aL#WNNV|vM0wb(U=gdCRz*l3RC}@1{MvfE0W)+!e3Mj2S=-%q^_JVZUj7QM>Lv6^$yhNWF8g|>sdvnBtM4kpk4 z$IBsO&!@-AIX?w$=AWYf(2dh>%?4_kGflrIUGxJ_n+;=Up)~ylgYd~rF`!E^dbZrU z;ENeiRD(>VGUcp?1;-v)QZqm{D-evvXdn)1QZoQry&%D%B<(Tv{wRgVoC)fs+|be{ z`-@Q5;<)pS>M8qKBw$EswyR9}_K=XMZJ9>aSkE-{)8)tWFG-3^J;#+fCW+}z)q{+d zU&w#({6B=0=l{oD%ciqM_HVhxH-I4^c}q1aq#X;8BML)sn81TN7pB^!6{_;^J1&91 zpyyL@hME^Afl>PmT4H(%sqVkEhqy&$Vn1*q5Qc1kzc74jl|3ZL7vKtmeOShf77R%A zAn(CvF=2t!yKuK?GGkBc4FK3D0`yPMVD z#i%3I{#L_encC5os1Zo9MA1>MvuPNIrT8k}=P6sh&$rLwQ%_=-xCOZE!N28LnJ00I z$!EjlD0r?3Isr)uoIR{hY1iDpy(eWv8c!(a581T-ll@onKc2bn4kNY3Gs^x0@0I=! z>2a632T8%Nh37)b2N%)}+yZ*(l$-PcmvF+2f|Do(?$VQ)OGoEZzL{{Lfa;GR*-g)a zP-ka<1gN6Bsp_}z40d6@J$~-nRq8$bu+(9iYK*ngdbcXMzCrKqD)e`Bb{U0LbS2nt z;w!W(iN8Bi+JWC$%HhzbR-USw6n_N$sKQ&MTpyoN>z6*73d9V zkF|C(RnD>NiFNT$o&TfU<7km5khAgc2K+k>?3`%QS#JUC^Jx9RR#u=jwz$HPr6{kd z(NbD?=1JzJJsNZAeS!9r+6LneWo?kmSEY0-f1N_tM^@?nF&5Pn{F{b<$DOAz>w4aA z)qX*A+W{?z(!qnC9$J^9&rYMVi;G12f6%=gSVRtTx2eHZ^049W>@kZec!mhi1flO& z`e@R1qguY}%2s8tg_gJynK?ZkSN3@T^x#7h{|=sp4ol=Hedo-3_` z9QgMrZ4~%>pu3ddxQKV)!?c|y-owmL@nL)q`l9p8X0w4RxhQ2F06yk-O-`#2!k6W& z_Q7|X->nWpuVGq*_G$tQ$6T!+GoQgCSSF)A{lT5wAUk^f_@Qmu>8GRet9HPTjUJC$ zt*ZO#JI5g zzgW#{Bt*1OH88qEr#8K=!SOt{I_>MRtE0LTdOibsLxjRe%-=x5kCMV00y88tDObv# zP@jP)9k3MbGAde)&Yoc4PB@!YZ0HXn#)r{XXLR&$Z)=4^7SI(Lm#E)Hq-|p?&>M&i zwCxRq+eY`Nt+O{u-^NjJ1b3p?|K6zXy9puX)!y8Ls=~5mw?7y(V0&u%w_H_Vk%}-5 znJQGQZAAye2){yl$lKba@M^wC$$)NAW6~RmU)1fBp4BOOR)^;kc1@+U`~v%S-9@g_ z-J$+oFk0Y$y1B45gte^INfb-qvy1-3C8l1eL&yuME-_jA- z4j&Ay(P#gMRR7se_DlEp1gv(nc5aQikMlfbjUJ=24kuU3cPG?)j_(9$80o9TUd4HZ zmL6&Wi1dw&R{&;CjgK)xsJ>et=qghBJE|dfhax)}ngC86P+oKAWRwXgW7OFgWLj*# zdKXFA2jP!r*=s<6fX5-wwb$s5mBG2M3))QVOIVLofNu{fiP#EwK~E~vqlLOTZLFdv zmT=r6Ew0v^e*soNQ-V* zY?}HnNV?=ZE+QR4S zT2bH9B$q8gn43h-tBj9>b3w$%S;+V}^cN>{z?;*Z}*_Tn3nd68367xa&PUah1DciN`1>N%^z)C+*XTo`q`2PQMTpsYlC3Obk ztAGxxP%!k-Q@)yTO*aqhI3J$>V1AXr3#}(7)^w4HP)Fie!s;mjKMRi7w@3L;0+?#O z(0|SJpQOLhenQ!DJmR>4p9#N7ouL6di*AJ9fln#^kyplJ?H{@98usTU(coZIf6K33 ziklrpqESga>p&^#zs{Qh6rYR|OwS;dqS;aHtpOLP|M;xSwyG1*4fuL9gk>o*;S7uB5i6rbSI3h3eTX0kBPy4+l{0lcmIuqYh{9iSA z`eU7K3PcI_F;yS#l^FxaWP@z4cr+Y8k=|%{zM6n1Z>31WbA#h)=gZ;_1yxe(ZEF7` zT-PBV;YqtErdyQ#(?oD33^iPD23$8NxDrn^Tv;RI09>lnaJ`6>aD5BuNihd-y>>KQ zle4E_J5#}SEaj`hu64E0)%(sKw3iBB@J)JMCaADloLZt7vqn?lJa&E7M?yX`SL+Ep?rK;y$6_tL}4E>-FeD4KLots?Obk?{rJM z)EQ}ef}iYiJb*g2O##oDSeMoQ?PmK)yMVFZNBd&yGrZIhQ3u99p2uzRXg|`?b%0w{ zGjLw%_jV-uwL{H?Wx+=MQBaNF8t>RS8eLx5KO=^l6uKUZKW06>W<7eGI)@GNdy=QR z@;H)xPyT`*H(IgEQ$stxJavNnlOn9)dlbwfX1}kTpRgNW zN0CS^Z#VVa(-8pms?WW79M03ur~xv8P#x3+>wKzj6W)X_eyagFcGMExV4 zCi_fFo@?>O>M`|f5=TE0(ElfMXgAkj&xEkh^|E*5*qPU+=JU$sIOg$njjzXoOV*zhE}yQSgiW&V8a88l zuJM>~;;m+^zeuc8{03=^#A>7D!uNz6^>Tc#>>rSysTV2rs>_ga-|`?mDXzN$Kf>MM zH1uo}v-S#0(OQS%N$jFZYCh!ZxD?a=|Hje#*!5T9QxaWBIv9+Y>ze6A{0e)|KYqVj zeg%Be7=C4Z!>sRy(fisb$~Agl%g1h{`Oq^r5KiPZwyFImUku={tgo-EtE+Y0x~jgu zs%W$v$5Xd!N=bikH$3oJp77g)@`PU)=}9s7WB877FdWZ(peI+)eQ3B{f{em>@cakx z+pze*-@tPExJ%t#uHa67fH#CQ%{S9!W*Ror6Usm34z+F`hgR8%y(t&}PGhze2UXS| zk?s1|j&A8LzOAgdudKLB7O$%+USCz*;+CczIdOk4_>5^OkdziA&Hav0B>xUrVy&De zR^I3?j=I~KjH{VintfQm%KxK;dgavqNwa?w_DUA-bxUpE{%QIJPy8EsCaQZkU3^@x zG(EZKCLZqt9>*0Ox?9nqyB!5$Q^JQ5k+*=Kb4K&Ulow3im=Xi!AvdSltxdh41nO3& zHVQX&WEIXsT(xJ_Z^PH3EAn&J7xHra8_f$!2keu4Uy|D+Uyu#aSiMPD*ohfg1 zr`!=Y-=DxUgAUsNY5t9MEI~AgEm>}HkIE^LvPO&lL*yLnL-#ngWTk4* z_%5#SgWrjraYqTTMdK516y~|^Lr6*Ac-yeiyBg`)<7FoJh!& zC88(M?=x_Yg8d=93w8WGZC|+;^K!eL{VWjM%(NZzOpMcSJIuFTX4;Lf7KgOSgqM>4 zQ9tpe87U)o^EPUxj6TjZ$7V+Q7q(l^i0YUQLo4Xf*9Mg@ejqvnf?WwKCU)G26lQ0- z-6G2-;%2~aua5X_!?nLwtZ!ij`xaKTZ()V|7FN9P4|}8bJlj4Iw8iYl($9IwN7&k( zb9@o0B6!=}3qAQz7K*L*3h0PD;D-&{b++s2#aeH+rZs)Y9RAIQC>E+?W2*E92 zmUwrKNSA}BY&WZb*>N*sHX=@05wq*cc8He{FZFR4?QE0* zsm_+;^E-@XjFNrhV5x1WA&}Kkde4vJG1~CQ&3M=~JEn&#zI$y&T^5Y?3kO6Yf?l5; zsPqUc=C!bbUT0U&s1|oW=VGkuxEbvF;M5@%+q(8k0q;T`*V?-^5NwrE`(|0~?1(Rq zJU1|SfB~(aTk7r0J!?ZOYg<0lt6m+zdN>E>(PjYaG;c>NzEs7pww+yWhOf>vhI4zp zE2tqJqEHgBWk>DVB?ydm&le?_A?g48^*lKLZc(*Q9;K>2z9{A&zTutf83;^Wz4gy( z2aC_<4yh>A!$(Wwb3Y73y=~rXZ(jY};T4}Rw#DnrP}2tn>uYk4%#UAp&i7~Yy`SlN z715)gTYjJ@lyz`!O7p7twK9*ftlPr6=!d%XkQd65VIK7*?Vume+fRZhdlQz zefT<=`Qobj6LT7kq0L6*wQGXc6#PYd@!7N$ah&l5KG^$6)~fa!YMh5l+tX?m??EKS zvsImwNA8X147hMI`|!=w#hzyn<{`T=w0$tIp)VBw>(1+A(Vkg`9pT?~q~&|Pxg$$d zpk>=FXCG@+W^De(Ay-FW@K%IZmciE>qf??I&4aTFG8soX5k=PNlkGMYNLg5sl!X;a zSy-`@@ks|$whh_MV9Jj)2|I%+Pb#!IY}J`&3}s;jQEpe^kVi5^)&^k(Q5IHQU>CwD zx4RfcIUhlE+aDTsB8c+T*QUIXZp(B}Via2)Em>q#*GLtJ_qp6P_0wA$&t|U~$wr`L zVMR(7R;c7GpN!8g$Y6-%xEUk4J;ydO#SD=gH)ACCU6;eK$YL6zA{Y5&&E&@09(8T- zJyzTLaDH8Vv8}fKdSQh>K8*OsHXEWJd*|ga`teyt0QNBW@lbZ$A?v(4_VL3RCHH=% zKvb%b#uujBhUb|9jiF%E5shs%rDidhy6-YBmoQFnF zy(=0WHPsInwust0YA-B*(HXBCscZfGby8Ttho{&2{CQ2b3`8D&#kZjSruva-Yi)}Q zroOScdU(pl*6OM4&a<=1YHjt8xP6;TkIj+wLn^dzyR+_p+5c)}UQ7LBg|AJkUH8g0 zt0OD_E;P?J&vu>diBMDc;fHUhafqik5O2$UX9^-O)_e}y)wmh`H@rg3ukTjzeFb7u z2D3A>Gbg_zyoZ*i+uVr$+syF18|)>`JD2>$#XFn5t8;FVb;kM4HcwY`EYjldHl#YE zJ2t65R?^uP9y}mD5m={H^hYD{104%Rr?fL zGQZ=fg|ebxVPADrws>z2Zr>@YUbL+r*(HzL;Mn%ExaaVTcy}!u#MMhf~u5=^O zslU$nRYt^qIis^}O<-TIQQ(SATJ4&bHz%)qRir(CUfy+i9rk%HbcsjqIqg&P&R^4# z71;YfGQK^HR$2!-9gj_Z$<~(rwHXKI4b1EQ$T-?_V8*@~x7t@{x6R0(S@7-xAEJ8= zf(id{QDy&vig`y$I%me+m)$?P__tp}y_encdkZeRfAOySYpyT5*17-ARk&!uv#w{i z<{rBKN9o^Bf3^78^ung%%Uw&GiZ@TKFP>NY^;y3znqTybBa;smeSUI!(SgZ@2j>5z z=1T)N9!}3$?`wXvzWc@blSETi<5S;Paf;hjpyGo2YyQE=VUXhLTM(i+hcSwC9zcj< zVZ|sGR*>Qm6$LnV(-G&Xqu)E?JmMU5BGm8^=e&&P=Vi>vV4UEC&LhnQN1EH#8Zpl= zjoU{;L8CqxetqbK=dWz9SMD?-I5c0hs`AC#e`LRK$2B+JxwSW3cG($xqTsBpRUB!% z-P_dYYpZW;zkmJR)$iRc8=hD^!z4AQ`Wco8gtt-o3b|4W|da&6pp7wTW=ViYP$>(iTZnKBY>0gs3hAjT5fA; z^{sEMcdhr8+E?_38$y|#GY&7X?I1RY>`d*^4<1CHkl}|$Nc_-;#?DaC{!r`QmN2e7 z;1-sCqBZ1g8DKx{_cjQiWFf~ZFyKlAoj1{Q&P|1~8R&@}tHkzfuRUz5zg0VbfX$bByPX+U^@h*FN$MO|@mdmi>=`)!D1FYriz_2U+g9OQ&={ws!XJ z+YF~aQZQRZS#%na632Sj;`P{C9CiMIrtZzg{l?CpI;J_+h5G+8dl_u>hEIvFPR(sG zvN}VM z{_{l(9|@JuEKaK{_`!&4b%AfvE5FQo)A?R@ytFrP33qy2&Mr>-UG|&K|Cv4b?mD-M zrCjas4;hT4Jb2sNB|E%PL{n`FUw9>&Q9H{m+tcVT1r|&PQ^sksj;3rY_$6XnGB&ZW zqA8;{I-GL0_^lMbmQA#wJQf@jF==}z7LgazM%-P-WEDQy-syGf@X1~sKiQMM+jexN z89v$Rjy~d0!IQn(w{j>Zg%v$HZiY|JnUllt$vJyrH06TtkSL;Mm$1SokEokD1}8tC z`QIlA%LNS=Dpyp{o?ci%lZ6$vT=Z4wu*vy|n_T4hO9#RvH#1JM@Rh!kTXu@}ge{Z8 znbP6g9?ATdocNy`k=Jv?^v+=&4tX#yC+}cPp7Jmja&+d}TQa@5!;|4RA?l-2MLqV+ zstqj(jvTw_D1TWvXP0jjRcVBtKC~x6AEoUnqRXqx6+-v zQ9hR)9Xwd6gACs(g%#j9A2Es_m_0HR-qJf_x6Uej_*(bH{IfZ+YYXOv!jBv|l?Cx& zL*LEFZd?Uw4a%dYoa&S=PUor+@o+=7dRbmZ}66c*XyE;D%XZ`-@0 zhUXg3^^;ux#nxF>FGmClx@(m(%g*V8vO56?tY;br;n zUAXy{#o3u1OOGzC5c6!;=GdgW!0}ib;tgLySl?62nw&p!PTrdo|(uD(UyNjo72cyRGxo(_epTF@O;s8g>_e=ZK z=Y_4(VLDU1aaU7bA>#d}KTxnWJ#HR^g?+>NVxrE>ob-o>X4B;2{7!d!)};4yHVvg` zD6{R4dMoqiy9)BZDDK%->soZ3t1i&@d?xL>=k6J_|E#?xD{6zc-uwq{o#sJ&-?O#5 zI)oM8*U`QvzEel{y#%|d>1op@b*A5$_nvUdl^3eZHyGjGi!jbE8ESo2gl&@?Z@yMn z{(O32pd3)i%-c>l?nQLnqTDK&>eaf>N9Cn-Inu@e1XMEt?df9nz z?e!lxRS?BrJCFREbN;a>G8SSN_MM%734wVRx3@O@r?1{>_t?*sZ}6WwBp1Hy_Re_S zZ+9+&@cG8HNcOwV_+Y2 zQvaNV{+b>-CmsWtyradBz*Mo z?d`t{)(z&+Ugd z+LwB@J>#6Y&H1p%%vf-&0G5|~V97pMG+33DJ9x{U!3VP&YT#wsHGPVGn=Z7;aD|us$=!>NiO-k>x=TzEylp$yn_Qjbgv)0f6_%N z0KLJpQ}e>kFC8-M%^O@T@bCNbx<{JhPs9eAy?-A&d+oJ9yEPa)bo|(?`e1OM5&7Xz zTITaN+5e_)-^x9*Y~i}JgL@m&UfQ#ALby%M%;p#JsI z^*A*14ec-4e&>Sh%-Wp)OW2u*HFc(c|2a$cge2@BH4g_QAQ2Kamx?3=Q0f8*b*Weg z5EcswB%oNeoP zz2^Pvt=E^-OIy55&b{BCJ0AiBj>~Q|K`QO(&y7Aj%DLd^@@<&ssB!S=%_XZ~aIjhM z3Q38YN9!4ji()3ITRZs%eLG)`zbBZv2C^N^D;Boxg-UyLkMC@wiK_H{KPW-LFwDm| z%GhicM`4!i^;O?oG$1s==RJbN(F8g%y>%djkd@ud(Qs{LsK8{;c;#!Rho9|JKCUrD zHFw#8MvrE2^Z?OaF(zEa<^O*-bhjLRh>~U7U!{a$Q(Pp`!iGytsEtvLN!iE&G;X;( z7s8dv$mP%Qd$2hoGd*;d&&kM};lfNdAiI1*Qn_%`6Z^+t0pn$5S`cOciGQm_Hz*wm zEH@R?+5AL5cBML%rToa~L2BU2SFu>9!KWG=B2^WlB`cokmz>!iixb=V7osr{KcV@Fi`95F zBOu0w5v_(=X|0)!3MOEEY{LUaQ`O$k`UqifNnYa+=yNRGIDT&CY6N?2uv)RoyuGph z7b1b5Vs1vSEYv)}y8BsY$!E)(Q9qd{_zE8sPtZrpx_Aj)yfb^!u95w`tK=#o}c?Kl2l1_$k~V*wqlvzd;_QPm-w*aMtaN zCSHGhGF{9JVKf7#MKfgDQ4gB7aP8BA-pF_Si0(*DZ)EtX-pI;caaWh-QNi+%+AwPf z*nHw{k)N4XV=eiv?mSV4+-APKU_JR3vIS2nZYnxj@0+)*aQXj7?oRIe>rctQbn!86 zRrV8~YE{Ajp}U#+_A;uQTvBo|EmRv?6guA^d?8LBkXpF#pKI` zPh}$iSy`res;j!@oWzh^#7R?}K zVFk@=91%>=d7!e8P~u<&$?qn_g^}6zM=g+2d7!q@?|Zz9y^B zBgDY8ysjCwp7T+2oXsI$Gy?@TIab2E)__gvZLldf4FpCrL|}Fr3GC=-gaUx+DZAw6 z@?D|Kf0*qJ>a?!KU6*{``;+^{UtKA$B{17xY+Y+uQiEn~7`Ykfe*UI-pI`0sWvpT3 zIk!4sn?K_-a>V#)m*vKhR>i{0z8HV}{L)qNfjJfh_Xv+Zw$xg1--@;0!J}dF`7+G? zqKf_TSmd0r*s^W~cMlSn0yfTeheo$I#*9A28KnFt>)D!$;RHr`M-;Op_1`#;N~9tW z?%1#YNBWD+Tdd2=6;^)!SXL3=Y@h31mR-aDxT$wmS5PoP&j}Iz5QRrJx*<9X{^HTx zpkFE>0dDrU``g3%H43Nkip>6y8rY{$C|Ljp18ddo1$POfiME@4LpPVeSn>#7Q%dLp z5-ZAa6y9~0sqvaZrO zbCdZpe%9}%{ulbl{ZTv`%e0-wu*o)Y@AYpa5;i;edV(TY9=Qj=Whxvp2vf2^iD$yxt&Z8o4;9@}Dg_TWqf2#%R zyi_r?8(m)XG`*O56U{7|5aL|#(&q^e#3{H3k#fObV5odTT(am_4l znfoBK-`~q5MGBs7eSXm z?}ILbKAisbzrpJm=wr|)pmESJ=nCj6=o;uc=u6NI&}X2}LH`5#2j~mXKS6&7{U6X* zpb^k0i2MHkhSv$uJZohoygR(m>=YP8#wg6}V9r#k*=gdfqd?w{2QujzLp8U&(GvX#dV_O#WXMD zc`=^Z@a!{`6X4q*rGyA!*o#IrSWxBSr zaNkY0*H88XL4+6e-+l zkFU^ku7szzmyfo1=<;X=FV7`Io)|#E0p?LRY9MgD=eCe}`U4fAmt|vdEYP8Q=E^E%O*hDAOD2;N@LN`;Oca z-gIG1xKA1N299zMm3`mxJ+D`Ow=+r>v_T?qH+9w(R(w(NX#W@eU);IV|Ao8l{w4oA zN&R0G)%5tMpme`mqR_jwMKzZCb>zaus<^LkfA&xON&fhj{GytLqT!;Ne@h%l6^C(A zWGC4_E>K1K5&jXo1i3XEM^-oWZ2H%nmm-G+ALX)!ox*~rtV4l!(@qJ8Q0wz8fkq)L zekJYZvPA`~_-MXHkeh9)IFIr>a;milhxTS10S?XQXktz2*7KwuN~1u4U6uy}w$or( z|LBH3e%S;8P}l~S)#4=V%T#}nDFv&KK*oRN8TB?GY*d6XalE|M(rwV^-28OOfeji5 zq=Z&hhGy8WS(}j41W|syUbdN?Ccln9o_O1FL8r#u#BGJz4rl@|@HN4reQch6{G}~q zj)lgV;e23$*c%!l&UU1IPNd4*J20eB;JCqWpQExJs(ka+Ju>kbltnjKTK00;Z)$}c ziZTJ7nhbkx^H1y(xRtgy(eZRBQAbN<;vIDJdTz4W$2=5pU41Z`D_vmbwV zo`3BJ$XgmU`zKDz<^Ue1z&Tka; zB~10>m-u%Q^Pjj^ReQi_&le<128nCp%XXe?vmpkm8!hMdlcZ*}4KH2-Ue=h}l*>R_ zqN-M_Q*Z?wRs*Ft+bWtd+in;biSL}1E^lc<6mTSyX+$)%W^TV`shHwmhCJOnTDA02 z`mO6h#hnYQGOT_+13^0EE}^VSUGYNUa%xg}HetEscU|W-{MW8sX9aHYeX%b&whY*b zRrP`M-Vx?0es&Ap!m-d)U8Y;;#vb7f7*aEOkz78JJCkC!`1d{0Gt_6tV!0|W`1Ui)Inu6K&u?~VAvL!7|rl}n_ES~7Eb~y zvMac^o!1EOxsRECkKE>vafOS)7=q>y-fR!4lM`noea=|)Dg@(Lu*;t+Aop@XOa7>b zM9{ocevXn5`ljjiH8S!B@J4hocrkxTdh6~c2r=VUBU2UB0boxFX(450;Qd82hoBZf z1uCP#x!onU+Fafm)S9P|LI`j2Kq_|+su5~WEzaHS;QZzlsm;`UiUJb|MTX>G94j)c zm&pO@R3;%EK-*3%b$z@s;PMx-ywFQTW+S}2Z3iS;gW=lTSY%XIuk%y+*2QzaCYp&w zGd$8p0Ft5-mF{osKt+t8s9hxvCOn4icU$kA>*7ON!|WI4_!6p`UsN@gq60crP2#+_ z_ROk5GduBUhA4Wl11WlH?9ZfHCWmGX~pCSlxPNz4-?0rhbb*HUlwfVagk-1*)~a( z2_^`LAD2|=j+jW3IE~iQE6h_I=Rr*x$pjzO0mh-`YxZTZRxV?!Hv0t(oFkWD zEjDy8m0|Z6r{ZG8dR4U6Mwa!vhegApkY}H(*-T%T80JP)^9%16=RuPf5KDUQ>L0cr z>M#5NC`(%Z!uVGx2kG|Z$rY4>Ad}I{g5pQwrS5oXj8sQkrMXw$5gwCLmOF*H%b9os zI%)YxNX>myNN=hCCbrK9s z9TVh;JqU5rm!(gr#8*C0i7QoNmH3uQY!W7RGUY0<-#nF=@*|XD2tsPI%n!_EMdBiH zxSso3Bu-r?ws5Z@M4s4ad$0oj1MWwsfcyGTu-L}E1`uc8KpgXs`&Oh8<$CZZ>0|@Z z;f?MUR-i-)x%l1%?+sK1q=?L5y?m5Z>Tx9%3{R=L$N1u5N#p4 z3N)q?@$U8A4T@Zt^PB;1LgB%Cc@hB~!2?%?YKG^!W+C>#HxX;JqUq!HG4cNPo$ zz(kPelRu}!NOGTiwkrm|y7Z_xJ+#gZ^==&&7z0e(vwh3cw`E)O{{L-OSTHNV-DFzQ z2TT%Ag{M2r!Kci~bihm7^u&`KZd32&ZH^*~BR$0n+bn)9mxFDxVJ72gn-D;ouEQLT zd=HNj%C)7smbZUvCZddUOum@AzZVvnlR}`NnxuNMMr4`Lwc7lx+)ue2^|n40XJ?0%M;}Z&8+`{n0TUL-Ooe{)@Me`IY=&qhTUcy*lfciVxGNpg}@ zGcRsrNVnN%PWT-(A$d+tmpIqF9xUi&u899J*T9{Z{q#}G9cfvgpFK>_v^D3>iG%Wi z&>~wSF0x^Fk?leFQCVkcu}t@hTj@(SjZ4S;gM@j)T-iCfFTJ=M;$qC`+bpifer@NO zh(*POYJNCvBl`n>?LJu{(+E(hlfpsraRGKdF1lEcRjv}>?Vbp|0 ztyVMg_$7Z|V)%5!I`sV)F>l-0<#;;HQ?X>SAwXZmIkh+UiQ+LAT{sBr= z(S?l{{-0{{gY>N(YZ4DLYl)Qw=Uwq(cKq*N6W?_Rh$>gM0uoN~MCH|o`W$f$=jn-n zbDv@6GbjzEUik0okjH1Ofx+1ZGjyde4CaD6;@VO0o4hwVe6~^rL>c+&e}88HU_hV0 z44-hW@at2ZgFSa;1(tksXf>LR`F+HXkoX5Fwh?ABiXoo_z#?L%A&)+cVAbrW3D4nb zIkkmaAd(Xj&M6>n4V@bi`y>A5wTduVpUGWm)S98;i1sxL3(R`JkwGkuUaC^S;6;ps z2TqJ)S2aU+$blfCndv1#qWXGn$YIMCG{b__+bTE^q=QJ(ds&bz9cq`C0tstqThI&y z63tK`|3KLldpMBnTQsi}vJ@`@a=L4(!8?H;*K7cPL#+{Kv)39OxtudH?U5P5OUvT< zK89d>sSzzXmbKe+$NHi)?!#b$T{PX(h+u{LZu`!#G#zaP6Hj0sNE1w?Ltx9^w3AMc#Z;lcYz1q_=g<_ zDlph_HZb0dxal*_nCrd#MnOO}zx>$T6Y9kfY8J%1BGfcLF_TV><;UXUl;q^Z6an94 zgXUyUok76$GP7*#G``WrCTXy~)WkkH8c}akaPY?Bb$}>_*0&vd@EzP>jCs7W3>pd3 z>_$DuG_lqad8VhTpI#_BP_pB=|7E4KBaxpZAR~M|$i}3^q#jhLJ8&_VDO|xYA5c!w z!i2q|!tVxz3lp58!rhe9w@s9vEh`Zv&94!~_Xv~5=a+~8!T9QIBFK!M8BKY_^w&9QlF)eylQn&+HQ^R-W{zpD=TbR9}8>z;8isiU09uZt_n{OKQ|Qi~861 zkM@XkrP19>Z;Hmy6XLhaEn;m=^f#wV#M&P8S>fo=7O}-5POK42&!1-`iHyXyoOe3F zHc#^7LYV~p75;!FqRRh`SGCpGh>9DmI8k>cSCcS*;L*+n$-nVdS=niF;jR?Q75`1P z7gShMfpP#;_)qE`X@ii#QO@m#EXEken}GO4-o;$x8uVCX2Rsc%tc5D{hG zzLZb$kChwlL+F}o2qyfCt|lHwlgq0fA&iv=d8@{DIO((YwDZe+i6Iv4zlJDYfz>_K zM(-jAK19e=XrE%w}9hx{ivACo7tZ3DN%AE49 z+wyyPc(;MQBGJXDd7VZ%Oh)7h7?^sxai+v#P*@UZ%x+q@hMi^<_El^zwOy;O-EZ7@ zS9s_^mEMc08lcjBwoY|i3_I)TFZ?IJZm+$WIxia}R?|k2`wlXRu%z=<^$r!~A7qtJ z6a}^YDZinF7V<^bpr*Q)OhH=d5LxPT(Z5Wl4uimcF64q|G8GDzv_}I>_&-VGrYiAXc{R&IPJ^8Icir9z!7#y8;A)td$ zet;l1u!|rj{uY8_XG%ly`pG`1A=rfw$Z~P4;Cf)H-_|oQ7*%a1O<%(*7>6p}30E#V z_XBZIad3eJ+Yg-6J*myKSAA5*o-4!8Fx3SAVyB^A3hm5%bBkZ@eW-2S6KI2v2W0k6 zEdEs&SJYdi)FlQcg$+>&%HbBOKS&=}4x#}eqj5o={5yGDiea%~v+na(nhr0_1HvA0r#FJ~@8IYOZITrf!Ps;;M zsxTW4_xsW=>>=I!H*fi7yt&i&7Wo;EFHH3RZL~0Ya_%>C-{*zLqCgX^N=9EjcY?P; za3vT>fJFFt>;(Z9W^Ogki28&uRhWB$ z1OJ6pR6ZVhlPuvuNvP{f{usgdHU-uNW|>sfFEG^BsHi_|GSJD0S?E4`w_QGeQ=tD4 zF+kovSBC_*=;6gfi*s8pfE%!zIp!O(O%DX2=;IUiB& z;+%s9i=GseC^&D6z=Y+Z8B!qhcf6>;1GU80uypbbuA#n#N5BgSqzF3&*REjBXA7DE z1QJLz4G7e7gg|;duQ;>OY!JVJ22_5e+|d8=3+Cje5v`Jgp<&NjM+phkLGy z6Dp*hu4TY?^j=3HSF^PDItp2j!oAl~#Af8Pjg@f6Q4||sR;ZZ)-#0)V&aXGw>Yskj zN3q9RyGP!vP~&WJH%!cW@qP%%TtM@);|>n+NAEF}vqFM?c^d0C>f!p){q#3{{eMz- zjm|@{R8otmHT)4#Xl#}!`(l$Y3Gyx%xCAH(4k-k^GOq*=4t27TM4sv8)9Bp<<~Ys>x{&s4gE0Ocb?Ox3!J zJn-BT;^LQaHGHB0Yz-v7u==ehB*aN90Djv&Yi&DOe_UW_9~T|>QMbxJIURu)VZ%ub zf1Q`;(nJ>tV-0QOrBWWwj00lcC0-9bclBXk1Tu+0Phg-Z@Z(!5Ld#i{$A1=Og@>oH!#yrr)}Yz1-T6n?J+%J>}Pl} zCBf9_^_K&@kh&?3QkP{M3ZQ(71;gP!JfE9l6l}9P(injl4%0D7R>;cZ*qT))CwI<#}nu9Wl7d3}wSaUGIAk4A)50QlnlE=xkY*MVQ5{6StM|KC(a&jsv(Wymxi8LaFF-%mLVdy`rQWm# z)AT%@y1TOf98n*3jm+WImNn6_&*cu^6qp4+S^H_oHmSRWtgu%7dR(WTBgBod296M? zTsjoZ>KB)lq2>-Pr5uZb3eyY{uE;<3cw+AEj7KO!<9fDg8FacZ4_EcIRn>C%w|nwB z`uzaI6nEm37PCjs6nxHazN-j^HhXq<`SrSA{}njtQ(0!KA|r|Xq(lK+HUEKsowyYI zDLS_Ot-3~uyHZ9(y$-ez(u7eD^=;}eXqhuqpp82)C(r3& zy`dS{8#ln@p}k4B;<4A*6CCU9*Ko@9aINCp^_Noq+_0sioUX3UOZNcX9;-Yv-(L4d z?KzXSy8_L?+znJeBKV+oCxzY#7|p8Vy*-lrmufPAUzzv?MhsVOx(A)wC{}K{qbeE39w6D1$Xif7r4CeCT;5IpkRs$rxDM? zVjK0q*xn}+c8*FU8KkYt?oz`*j`lvF*82Dk;f))szZ{@%3=jzyiBc!uu6y=B#8-(^ z1Ye+{M|nvhq?H~xtMHJ|a#w`O^j^qW_q_Vts+zdUTxDE`)3yM%9QC(4%?7c)8da5= zEs!j(tj&fsN1b1WeQLf1sx+|T2pf(<$hgW#J8U?%)X%$!;%X~v`$DJS5A+n*bW;&w zL>qQVbs~;L*7rQ&>INt>1`ydf#hu*Ndh1m_L8ij*~@VJSvaD=#dKw=qQs^xl;L_F!U%oJ=Xt7a1%+h8RFd6uQX z#jUbXp-u-Ii&LG!M(Cw-QzMSJT?-I|3=v!_OW7O(UY87ny%uElE|HY;twbiVupoP7 zW)Yg+A<071J0z>*l3C8(4sB})xBIdX&(o>RLihh=@9P7ix~_fqnR6J10c1c_ zM8v~@GAP1;ph!f9FU4;ZOiZu64#F5fgb~nUn$`g|(KLysY11?}eZe+u6Pp{cX|3sP z8jPBlw7F^$^X%=r1x)&4a+B1gNosDC^L}feedI8XQTzJ(?jQHSnZ3{2Yk#k`_S$Qo zv$r*KM|#wfh~%!(-41K?^Go%`wH+}Poxf`AnAa(Vm1Mu%R9Kc@+ozC`g*{PvZ{|I) z*)(m30+Y2PWt3C0dJf$E0N$=qEmNfJS$xSQv5m>j!1uz!%6;vQy0%7tS536N0^ivlrEly5D$HmZZ!mUMDpa-?Z+DsGqHyH}TE+8P>w0^P~-FjlMdq@riD2F!Q;_ zzD>_Hx*J}qUwhl(rv9)%*~G5Qry5^K$=Id@R&58Mp}w10kB)f#i( zZ;XibHBDdE-z5Kg)Au*)dkpTx#)xGn@T&D---mNg;_ck-7WHfCC-+W#mdVv?ZO_Zv z$v02V=v%K@WB1+FXZ!XkPjvVCd80~J7H^B`U;oPb!Qx{tvDA+CA=g@)Z~RMg$-LFd z;PTZ9Tec40A>b`)8|E4tBT1vId-~>;w#wS}8J0n*)JqeB+Q-_)SeCv8!(hW^U#n$p zr_b`2H>E$>mRUOXTF2+aPVAPY^A)rjQ0;I2ZDYrxalO-OoIUQ?xa>j88?jmPXq&rt zmUDXh7}+hg`&iOZEFo57^lYqcb`4s~?pe_Cnsr{7%bjsve&;y}Uyn`5c~07Me_eP% zZbpX3K6-5LT`No7^m_I;qdtPwvlAxtGdoX3c`aSm1yfo)>US)z94YEc&bb-?%koLg zk0$+ROqa64=k+&3*V?bB@y<&nVTCJW4=A_XcZ%h(Q)6CxI;lFfNPRmZM_%&us7rD7 zX)h^*@<7xir6{J$@^%ip-}2t%B2}sz9q+SfKeV()RF7_rcyQ8WC1vZlUD`_Nggqwl z=ax9{|IFQL-)4zPi9Rv@!_3O`&;Mda+Z?zXyrw%hvLZtJUAV@n!sZNhh4YtdsR~3tsT)l{`Nq=SE7xX((n;VXMOvDAJ=YH`MyknXE$KA zM(oSfr*F)3!Wt8!#l);o|Hqh(88I!_fH-F z+gj;(G+Qlu|IOQO^4lJ0nAV*VtE|bWTT}dC*oo{ad#-hHc2^hqcvqDROKG*l9`9%eL1kn{S{`@I%#migA@3}zq8lW0Bg2!W z%yi4`bgBR|PH$4wO>8nhy~)zT#^|Rv*>HT5Wh^xnJ}uHWv7&WPzKazzwy|QyK2`%* z%J8*E)?43LK6pa9yX(F{ZPb0a*k9(Zaz^joQg^%S@Jj4m_IsDC>`1C}?T83`FFYQv z_jYwX3#J1*vTxwUe@sonW27J5JGn@DcY1fCJpQh+T@?$~g>MVr5mqkK^4B~+jS$Q$ zO_e5A(2Fl^mH2ec-rTpgP_fe+019N}dcL8l4QmF0EZU(2JcpT6)-k73Vpg#m&_g+@ zzwbL9hw3{#dM)gsG^ud~rdBH*ZHKLRA*)c8yTaH+U7R}G`e4VIZiP4nHd+2%)lb6HanD|0Udv_wUAGTwp+|z*%l#WH!wDvi-Js;+oR*SEU z$~`fKU$bN^E*ae=cZaw6+;kGovG5aPRZoDMx!cvl^Z$_7mwl&=^?DYxvsGoKa$vM) zx;{w8yzq}NrtvlKo{dN2M_UC6E zRlABxJ%M{Ro%P{!9CcZ@S6!WwA3kr2XI2T84k2EZ+7>ov9!|ja&F`*|BHql#aO{k# z9-t2=%SwLS_rSnH`K1Lu2sE;SYPI&kD5tf|vM9pybQ7KP+R*U^2_U_qL zHyG)3_pJ2Iuf@xB&J5|>?Gb99zOm0?c3;fx&NoL@1oF}yUm2g9pst>L`=bfYJ04A# za?&yFeQ%L_QkXy1xhE<+DlKY_JFV9D8oS^6SZdKvr&O>`U)`n-e8s!fnP!>(P4-se zyz*})KP_i<)hf$2(HEgTnNK>MceJvlS+_Ohf2}U?Rg{9AvWqr4iA1(mYJEw_DNSvRU}V9Yn!t1?XeneVBK zz(gC@6ZFrC8Lu(Fu!NU^gs$1Km#zn+hmdh)YKKt^B#hCEyx#wmn^DDNE z5gE@N3Og+?N}n))qoPS`;ulPM?I*8>&yVeP!y7`T0zIM7<=r zqAq$c@_o76j_-W$z-Ni$_Oe-F9b+GrH+1_R&_DHkOrG>p_MBY4XhG!D^wIC5-;(#R zt@2hmFTAp~C-CTzX?xkD@}u%;dt*!Q`u;!KpJ)AYzx=vfz2ZM!mroqwPY1)BoAh9rFwjgXbDu4KBHhD+Ri`8uw+STs6=gBX15yU;vXrGn#xdK`aWUJZuwQ| z-=r5t-;D2+9XG=$2i_QUOSKPQ*0j`Pq^e*TE%*oGOsr+4Mo12PZ*9lBxc`-}=1gru zEc?8O+=+0HCgBa}sOC-$fT=m18XFaGuurfs$oB1Uuw=XfZDC=_c-xtrI+i?5g0Ff) zGApamlp3ws!J4C(vP!c@;pCO{i$m#28lDOpv}m?8PgC-=Phzo+R^%uoIR3(r?ZQxW zIgTpLuF(=N49&E$JZ+Vhq+J|BqS1O<_AqQc#!_9YG;IFkV1XzWX~jlasWp0e5i=iA zo|aIENq^%)Bp;#5jc5QoW1lWuQFvSaxRgm{!&SJ7et7_4;G2O?6gLw$_D;hU&VOt0 z?8bdzNM@@v3o2`2Nw_cKG_g4Vvsh>l=T-4pKT3+8B_gK%6Iher1Kg(0F< z_oWNxhCWX}Go($(=0vkv%LK`s8%nyJ1@%@~GWCYuFVr57p)6@5%5E-e8n1_y|6V}W ztI;=eOnr1FL_g`rJ~5^s))%$6TZ9|^s~;D1?S8s|czt^NC7?@`deKVt+C}HaPA$J4 z$6|t81MzI%#t!m#Xn_Rw`y_m`k=LBSmblTCN~gBOLtP3ygk8E&rBOO=bS7M+ZP#`M8CKQF_tlb zAI}i5ZwIw~{At!qRfuO*sLR#c-^4$hck0phs}Ya$5Ev2l*XbuoMZ*aK%|&+-fpW&2 zz=;q72yw2TMuYoC-?IJ2`&8c={Kn(yTTb72Jbg>g8;_@NRj12_8=+Z!%eZUj2VRJi zi6i0^{!0g`u{bOLr9;1!9u1%PMSlQ)T{$ec&AN)krt>zIRguomm z5s3bi9eU)j;K+Hyk;h2PesP^Sc34pCE3(cXj$KW$>#vsgQWP9wbhzL-<@_rlmj3b3 z-10RHd*a}zxGK0asKIXVa-gNn-xys_bnF|;en%C=wFF1#)w4|y5Iz`s{yzEt7}-2E zQ_ss>|NOsG{-ww#H|EOx^ZvU0CDIK@&!m31o+OAd=vy*=dBGE=4kXwCeJE$AgiElA z_lpO&E02A~V_LA2JGOHhoj$1*njk2T}WX>Ed-vgxPIogD98vXH^vO|v%X#+nmUxb4znPjxi_+es*{?onvEiHQa>*@tPM>8$1IGo?%V%3MW+)QtpqV9y>s;E5 z=LX#MxV^Z~VaDl!Hl2w(3io>!bRDOwfrhA>3)VL8_mj~Pc1eK22~>r231<2mzr#jrp&pD!C72hSem_~gkF6u%JB#tcUT%19Hzh)gYfq5^J+9E)De0ZSxs z^1t=tA+!*|#}O@pLB@hMClH~LO9Xi=={|`~5f&9RPy!GYOx-%PC0prjI$H z=p%$J2Nf?8wj53$MWJmuik6->Y)~rK6zHHNIDP2Ru0^{E_p8g2!52go6b#uGBT@yQYwnih7&+@X>t zJ3zvei3`oj;pr6#O=Eh+5xCU+@A=mk&cC#I@mgV?Hj^y{mE!-cA^R+FCR|vz%C(tx zwix{$uYEl9)=<*FNNk+mJ&>IC0+I(}ii$ZV4Mek98Rv;%ByNWNcql!dgl*w!lBzr- z6W0t3*#^WwRIVis&_I-?E#`S5QBcLDZ#&oqPEZc);gMv~t)4X@te(xFrApA4+3H!2 z=K;ux#e&}A;eL$q=Ple4lP&*-e`Q)G(-;aWCFjQT2#>U)DNyjP1#xW;KhsYHbmOV(pSalj#g9?~I$>A+P}~p9ai!~yJC)*2wV3LwTzA}Q6c?2rNe|R}u$2reA34pO zYH}uIvgT%OYHFTlpN^U5InvUyAhAUM47YH0-Y}WzHXL-9CHX(8i{_B_h-_b_VI92+ zy)&DJ_26|92Gs!(pxIte_wzBCj1Tc7x}#Vn_`$<yD_>3kM;NqW%I0shU@M`g2wXXD6JMd-iREkwjWsgl7zCZkaUZ{rlUtuG05styy_`drE;XXF9KwF>&@SHWUrQssM{{c`Wf}7T8AOh(U#lHW zf`p;W=T&K!FfT}sr|jYY;52Y)J&e{c@BwBe8OQs9>@xg;HzHW|4z%0VHE@!6hNf-O z%z4W@5XNZz0M2o}?aM>0W04usMcrlAncccg@>nhoL`KbEpkJlsX-T*0mTyuV$wUdt zqa`>ys*HTzVCYZ7NIonNv09f9oNrDht(&p2*JJx(ZkLPIis>e%1|bX^hRKK;P0n^R zW6~adU8V{hn~yLIrXF{}}pLri*0=Y!EHlCK!8T5Vjs0bQlu*yJl>+i)|5U zkG^Kwj!ZY(E3hF5LiEyMQ`+%Vr_4%bKf^wCSm1qktRBBa)!jzn9uV$3 z23+K~OSlJwD~WpP_OdY6#gnnHQ^Kxus|epE+$V%PDBKcJKRx&B{vCQ*qD|5QByhxJ zBcK}{xcM1yYNr93BL=~#zI{P(XP1pxkx~H}9|AUoB)7-pujKv+8i#fBw!o>n0v^E) zAgiu|zmwoyHf1W#0^1Xe1Nc~|tSX6q`0Xr(^@YIk!tm-5ICF89+Q|?&2{;|yLDmzb zlf}j{m+-6buM+-s*z~Sb`17#zG9df~@FzfEQrs!PuM++w_&doTFtr0OXC!+l1l$38 z+T(g$TM`!Q59v76w0awM*=+H6>EcWX_$ZtqcV36%oIzY<0q(LnYzmNQ&2Xc<G7m34EGg zUNGUK3L|Jt0WHy*ge?ee&=^(6pfNsF3tIA$on$|wU!Y0HWH13#yr6| zfG2>)_E4IF#vTt&A8?|v9utkZDb1jMCmQooT?CDxA-SJuY(SKOXsn0W5;#O-JpxWN z_K=86G6)J_KRmK>i^%Xhu6b0 zr$CfwuH9%z%N(QBiHi+bBDP%9Ym(@=>20dF`>=l^#%fybh>R;$+~`HnjW-yFo_B&|9Yb_j ztZ_+Lm7W11vz^n2cl*OKg>>SMxZJa77hNl1-tGH%_$pKQyYfYu*y1E;ODv7>^b0_5 zjoaSi_)&mFNqYN|?J^LQp4XHf$Z@rPQXs5_wZHK#%&+)_zqLKC~Ybi&*PEvJe(M!)YJ~1M?T_kD!v)+-Ttvm z_3ALy;~a28wWkAc6$zgc?M3-{w^u5wXaN;|gUNOHLWSJbLGT_b81Sc2zri0FH&0QK zKfEE^!v>+>JEGq$Y%czqFZVk(F~+qSH@$B_ZBOO!Zod+)0G@!n{XBnz`!$VbV3bC$ z=&wVDe?8JA8lrNA!95$e$jeJ*(c4QR67?7~ zL**d<*}zk>$|dRu;dupKsC@MH*Xi9%p9GJLdr&E$46f4NRZuxb@)_fNW)C8d|AG*375FX_ zoH~i{=}N;*^2nS{0q|*(6`cM~z=>!KIF%7qO8;yc@ z1gG*-I=z5jG}X(XhX&M(!Uqt3!PH+yJGr2eo(n-IhXBXBv{%p%sj#mHrQ<~#QF=7~ zQae#u=~;#60yhBYtprmGhnqR`Ne~(z_YkKC=}MxVDTX0GRfHM+;sQ@l`bPbTwg|UZ z$PZ&I)N{n~vI0)!FkpsD<7_ajQk2nye1gM_XDY+h!VEa&=SEtXBe4dWI*Gi9ehfPF z0-5;7i?9UT1Yd=;&Gbd_2<`{mOjneTk&c<{4j86svL|@({P${^Lm1gh;PmE&ZrOg_A)szTJ0 z%o!dNoaEHy{tSX2M<09%W0hGB8+=b?QiJmC75$NhG8pYdcuA&qrShEt9`zmJ8Rb1k z{Rlj>+@u#js6WkklwN!go*Q@+pYZ77?L~Ae#zRN2JO)0|4B;F6P0ubiq)~bNL3F%R z(CF3Zkl=oS(<$;N7@16LxOrO%H&hx8m|~MDX8^YmzQ^P@U@pK`3HX)cgkE1Vmzeq3 z=-&ds&3sJlMD0VS95Wvq@IJuJI3Nnuq2D}PzGv6C=exRq4?RzmrPA&em39^qMZsjQ^AleH%cyRF;l0)zQ}FNmDJmT2;N`3lZ1`=5a9&D$;Ny}hjSaVixfv;W3D7t zfuC&5s_u^`8*`8Fla0AS_{qjxCGg3{Op3W-V+O78vXNc+oL)|DW4@s0%NbIXliQdb zdKqkFW47sjj(=X1(;&LbHf92t);A0r^G*)e*D=mhI>MIBHCf>&MG1bu|3ly(6BvshOj-;`o>AhSJ17zv4r4)yq?8g4`8&xU)bDZV zmxd5==fZAH3Q{nB5{z07GL|7t6@ItyXJY+?CJmu%+vkJpF6`ViA=c9w$7m8g(gq(v zJ*5i>u{QE}Fb?2Ew`3eJ==Qjda|PX!p&=CAlCgpMeJUJ>-sXI5gbX1>xA82I?bO?u z(`}^=kH@PxtVh6!ZfUYc_(ZpzdYTSX`5i8H6Qjuo;W%+F6n_gppf6qOG^4Mj1oU+H zTFM?l14Q$Eoc2bp7tvY@O-iWlMCWHrbWW2-Gd&x0ep2w1QMS^qD861t3Y!_9=$w|Z zIyqeT)8r)7I>|!>=Q1aW^#tPpZbN1JbR1hU7J0}pM`gC6t;h&RemmgjuSh=vpCsTC za>)jq1e2c|+D5F~M6hI_li^lx69+eJ1<@6suvJ~giDeC!<%x}v5*kdy)V7^LaHBl~ zVxYsihJ!J~NY@Iw^&_EI0Hf>6>?6gPo{>~Oh!pEKwc`LVzwaOniB(Kx`{YtjpNyWy zO%xFT9=XPp(1V-~qABKA)ByV_oQkf;8H-mN2+tu(LT2y>xlvxvm&|hq(F3)9KQ>Uo zhFCau%ffFe#j&@J{p44lK6@;U-K|J4>Cb_b94^a27(YAO)-={5g=jXfa#3{+cGado zw+TxxXM<4r-Jme4?>SNa9z0X|9ujV^aEW=S9tUB(DW12Wd`;Q1rR8gutXNdDrhLK8 zcq*?bS~!IQ7A&n=S+izAby<0l+nqmqh8uK~j+lD7RY*@S@e5pHP?%K9?_&q$+uT@JOIu@S)Apjntt`qbrmM7yNMR}Lw`iL%wy9$s@I zN|FlSC&>RJc{Xd72G~Ss7SCPy<-e#u|6$*6kG-NEJJk0&HWl|^m67+~dvclQPJP)B z&jX;S7#!);*n+dJv46kXf#ZMxe-ig>_NlD0^CDdv^b_@$`;YH`@l_+~qfZ~&f9#cC zJ8{(N>pPDhL2_)<*0sb0Oj4vlyw`lEhundpq3X}Lph z*LbwnakT6s9FO4dBjh4V=dw&@-4<$(hcCCYm&bcpPJ`kvu`&G6J6g~p`X!gzfm|8^ z20)qNjBkjJ9pG9wY5dqZQ68d4e1e3jz0%oPl<2HX zluGn|7I?fKoIWxYqGfX$shpy%$lK50(G zzhv?!IY#jazEjYrU$`{F9Ax;+d|7o(D0xI9lg{5ZR;)8!Q6wOhiov}`cqE&0SvVD; zt}0t7a46p@vIQwhnXvL>a} z)699opl^y#d|ZWi!R0pUL*Z_bKA8t8e`DFJQ#_OA$oWM)lYF6PGS}(+kj$ps)`kNQ z*3i&URM*^yVPXwNW;(hNJE^q~^9RKXnDV3NUZ`cnAu9VixI2J4rQ=Db9}4%9nM}wT zqDMov82qnG95Z#%h(A(NP&#B1BpFjuP*|GlHn(2r_8Z{l!<{I}7p0w(k+r$DnMPgG zI-Wh!`-3l{b1Da!C5_Q~xSZ*bBX{$qT0hEZXf)<foMwqt!F#nJiQ@aT}p|v&M z&PQUzjQB!5fV49ea~mq<7wHR_{an`I^n80cohvK@hY4;_Th}&K;uH(o%7_k?yQQ&( z9H5JIGwDv5!;)#cWeM5XW@wQ!r6IwGqPK$#dEVeTG#tpxZc*DP3aLo zkn4y0pu%kroS!;DsKi$^BjGNWH#b&Zibp2r8*P_hx$u9hpI%L0|67k|e=oZJYxHN5 zJAdo>$Bdx)#~00~bh$^ftKs>$5lKWN*X~c3if%XE(NN+|=0Sn_gGf(#$2#LAL7uMf(0WY@JOrQmO};^2xbh$G$@O%NNgIVp>_ z)0nYxg=aAh7}e~(7B`LsRV6iSW_w4VP2Y$zqV%$cCP|ez%S1i$t6nzPyLZjugU1hf zUHXv}(k)HacD#4BiXXKa$u@+IYm^qz$-oKN{av0OK4Wujn+<1#Nh%$#?|c{ok>HL zbNfa~Ubv#R}+h`Ed7%GYlDQHa`mw!AO;gw zieo-D2XN?gO9wLs6WfgJO@UF=>G%vtbUHJ7UFoRpdY5-PGkQI_nSHh7ALQ{R(lne= zYFHVVVP;Sk-0YFLnL(1Q!pgu5Gs7b@+}j=UY-K^#vOq>ab;9oA%q-az$i&gr*edil zSax4oUQ35D_}Uz*v#gbU6|;Q@>2z$Av)2Drsi%8-wzO+|V%Yc?N1aDE8yp_B(m_Up zW~kT**26lcs1HUIbVYn` zb|8O!yl=~`6LKDlg;i&4TlY<4({gL$V60IZ>jz?;WUDz2V~xsYxWjHbG`#`Vri%Qk z^648UwM?l`wfq3Hl4A{7)e(KmH? zvFg3dk1gGOrLFaWE!fW%W(iMG_Vx{uZGMEOTz&orExk%8}VIwYE>gbKeesZt=t;5y#Vgv4gBDsZn(#=A4LL>Mh)7!TE{< z`bol;ccexsJ5|{}<7g=kS@q^OH2x{@TI9mLo*hb&PbstQuqQ>^Q>4J_zSA#$+Bfv} z*3;|GY&}hXZ0eD*+Sb!+`?sDh@jut}OjE#fqUm>@DXlFhn%e7~Cz?()Mbb~pi%ldi z{@}}-S8ZL+`kTu8oBEsXP}S=AycF^d+}^RIzp10=EB#HaE&WaYOEHSGzv*n+%806I zN#XrXe<7s)ri^cu^f#@smvn0VO~2d-T%}g&Z~F4){-$Rir3mMN^L}Dof755p*!H-; zsq8UqXr3l51v>qmSl6p;TzFumzxGmp6M_fB-Ru`OWqE(o=iQUvvZ#bJD{Q5V{JtsC z!$e;0_BSn;>S7l)m4%;@K2QD0DXIF^{)eUZqF1C;i?;s^{iTFY zcHA@g``GWd@4a(p&YU@OW;^H1nWW0WsjnS* z?Z}}c1G9RagDnjK}}!Cb&Hi81l9|CXKCZOj!V0AphpvZXhF-M=Igi3rmUo9_5#xl z=tQ(LeB+WjlaiCqKquPj)5Hn@-HABn1l>vhIbp3c-!!P5HCwxrhcigg;WWq&lRut{ z1M59mltXSi6++18^2<_}W}emGyWP6oY=txHl=&C~*PBC;yV$bZS7-S8w`XnJ3;*@4 zIA#`Jj3eW#{2HZnI2XV-4K4hVQzPTiz~N*YEgTK}1-5XlYTh{8rIvM(3vJu{kvU7W zb=uYq5$VI)ZStIIO3nLf=_Fgl0<>?94V>+J-L^^d8s}Fo$c?1#OUcu8sfVVEJsz7q zui~`l7gpi`YyZBKq-V~!BpK)Bp?yQNYQtc3w$Hs8=WktXFBme1#^+h*J(a%C#73@d z@U^j{InqRf`O*ru|GGqJXU!3yF1ZUSX6U=2v6WeE*iv2^UIu=iu-aItW zlH6jM<(&OkM6Ek5w_a_sKc&4m!Rl-t*mz*6DJ>iQ0K0+VzDq?vkZt*G&7AhbuKl*5 z+SNEF;vSc&_1i{2z-~apsLK;8YM)%+UvVY|@ifnN6MW2uJsh{QIH1}tTVSi6s)bA$ zIMnt?5~QvZw23=Ych2eV#<3-yS9{wJU$t|Mt=gHCH81Jv?2PWD-tueT5+^5BbsCFjt)Z@0Su?&bB30)XePXB$l&p`dSUPc5u6ntymOIzc%qh* zXNSdOP9D85n^4Cm3))JMYyhll9v!ySETcyPFT zSZhTlCkq6jVK`m{k0`%!x^Gm}P{C7vwZ4lv+4=kE+j{DNEHUazr zh5ao2q0_6$(ywl6Mfz-nJTde7ByHS>+TaGb2mz>UAhIbsyi2-GhAyV^rQtc+@SknN z7X0re4-a3SHH<{%N8jy@ewea$L-fv?ifB&WOqfQ;aYTh;Sj7p^>Kw8y$=eAqf4x4V zVvO8|?|TUjjB^xJaBbdOf@2ImGoVTaQBdKvL9&CE4s<>=-O19VBb(u`Wer33&VQNk z1ANr`$uFOn35#y)Q7;=L*?x*_#vnz&^kC8#Kt2BcGJ}8Th-ca-aNkLaHWU6}Y(S_R z)~EFHOFu;m#8;VW0p96b>L9KmvG8Ag#6MpjG5ueC#Q)ts z;z^9qy@~UPdNq%z7xRb}(UN-3Bj!YN^DvJnixwpI5p!bmh&h}`%o#n8KomKTKmS@Piy10DM<{ zbXgU*)pk3K*lDMfsy^!!Ij?~&Yql0e@2#dc*aW4iPq2OEr_T6KYBuDIn+=skixOr- z7R-iL#AZWfVm35I%!U}OW{xY@*P8SK)(7YnrQO}{dObyNT(V4Xznnk!6 zn#(veA0D>gfBlG|xjuS$?4h|VY7EUa#?U+igEBJXNc_Su_E~UjyL@Q)NwXS;jJ;!& zEkV;Y*tTukx^3IGZQHtS+qP}nwr#unHm9HGoi+30duOfrb52H`Q&lT=?99kQ#;!KR zpd0k(5P=yStq^0>pYXI+9jwE+=~sAjI7^P})9`qzV?z_eL33gTg-nD|NKgR2owKje z;BuP(7#s$hI~1G+jVMmmSLc1V^-(q;1;hbYb==d-2m5|p>VpRttPj{N;0b+EO=P$k zjXf8_c+DMD{{|YlMa9_V63}}mTORf6hvrxMMBoK?xDaR`d_oQF+y2a30dX1@fH0Kt z2ZpI5^S5IEt$`ElM#qSoPT=ht!EsL8zUEtXas|M!Ut4Nwet;_LdlwOwfkSGWPOc|_ z>TA|PgJPfXJvC^0DZOM>j4Mu@+b5%*I3heH}$0X-K|$(Hii*7%5H5`%-AHgW^nC4}FJw*aK?lmJN!#9|Kqt^@a$8TxC6)G1$fc$B>Rt!hs!LnV z=(CIVZl8!c+kxz2e5U<&)j&`2P3wU#b`5Tu>%m6wrK@(;{_Wm7UCr%&2k>fk+s%MW ztE3nG&Fg+(a`@W*htC#%-!rf_{DCLLD!j^8sKah$4*u{Lqc-2bGkXpGA=W@M{Hm|E zT$wv(^LOo5vn`FyArv&z*e;HMr>z;d6&}|DAR<@#S6@95t^D^vV!P?hNP(rWtC(@- zTv2m_HH1cRuz#8FSMGtLEctDYid#DC-RJ0O_KOO(%;p_-!r2m*dpWqF_s167jn7<1tM9DS?e%t@ z!)66d5Tg?-BNWyX5&1iFeT+0K)8*{#?2+(4)C>}9u3oYZc4+l)klIO{rR-J+UoL2z>!*ov;oH1ZT_xqT}pn6QDYXs+T z(SP1mZ$V`HOd*Cc!D8GwM$7Wt(!RSv04V}LDrFoht?gQG7nrbv5jg8FG3|CWK%D_? zcCt4r)aYW(U1aqnO$TjTvPbcB$HqP+uCYO|mRk-#^;1N7JLPx5+43XB-6|&cK~n}F zpst-hV;1yI8;|t?Q=C1TnT9zQ8Ah$>sTr-NzU_1jbBB;qOg!Ph7~Lh8mOQFwC(NGZ z1mjR%oeP z!>O6y3UpGOg^h5Zc=cS@!yYYPk{hCO_Q`TMmv}Jkms=acQYHipbq<(URbT@> zy6T9*ba3qsvZ2&R&oJ*BU_jqH&-s|AZG=v`Kx0t$$Ny}l;kLKL2It^EZE0n^LtRlk zS8imy(bHI-4%MA&$D9^HJ^a^&Nb7rWfudvV<;r!;8<=ui-xghfD{SZEY%oRJ(aG zf;^C+*XeCm;9TOBffg&CeSCWMTA{Y*q=rD{X{EgC3-J>_9q{ez{#D#vY%hcPk5J*Q z>4v<^Bcz7=(ozAW1+JA8&MJcEq#qm}yh1v^ z#ZLH}xCS8XMj+?D_FFTJL?Y%N5=OT-Bsj63KLQ<$c^&C0#H}Fy?0dT~Y_aW<{uR*L zg*&X~`D+WY&-yf%((hT~O_rc0OFSbgbIAVm*b~h}RC1t+uN9dW1Y-^{{0ALdv!DVD ztLW(+&lxcomgfM(QqIo+Rbg$8IPH#`fl;As1LsA>PnZ|QJL_JLxT4Dup=Gt3Pb`vv zWG$KP{ln*y$KkmX=IBgF{}y#`AB1-Rv#+4O_)8v5uqB+&?i72x@8+=Z#{k->lK00T z9sC;1fR!EJS`q{s{9Vl_P!mZRfDpJxXz)SC6|?tDpu4diO7zuMHy}k?*~(k@hf{7( zjIlu6n3I2yWo>eB&B%X*GS-%vJrC2=e7P>a)4Uy#M3c7eW0~68zQNW~V->QTjQb zLcc@tcn>6l`x^n)A_??5*G75u^7~txWi&eu0 zD_^hYdWHtqz|xIZU=QI{DVzPe=bF*AYbsDJeWg*5qV=@oQ#_9@A?U36<2?M<_?#= z1erdmqJR=X?o4;7)EjN?#_v?@NK4T9H_aM?5s@*^FUXDgFz!NY2R=c&LBQeg{^7Q{ zVD5&;c=sN0bR!h>>w#uSD(ZV6LMX#mX@zP|wP}UYSC^aVmJ^=_)}zV-+nu4$->yp~ zAj0F3`%OP{nmdGag@i|m91jrRxO-wo)_vmiUb-?U$I)46f&M@JCGT z&(!ehcWZVxE>~}5Z{Dj!1wHs^T61(h_MAqkNFAQgKuram`kG7s!CisX8Y*)wt0vx$ zBYapA#`v4-U^XW}qBsIl%S5b!enSKbnKY-551u+|&3f$2SiuYD7aC%njS@zPR1~k^ zZYoIxz~=eNNUXvZVi+L{EDS3zA~LA`vjPeElNF9(P?mN>wrkkk9>ZEd|3O zSLLrKY{t28u3BDpY$wooUMv+B$*8!YmTD%1myC{fvZ~%j^p1LU_0`Pb3oy^>Q~q z7e3g%gBp&)UNgWFoK;Hp%C!i6yg@dD@9;VK{fL7DsIoeNNhKJH6&oPyQFP(sp-+;$ zei=z**p+!e;+_rl(_Gk;Xab#t$9gVtfhv~h2U_F0})!l0_nzjx_I?=KBCSMZl_-V6=f_KB#vOeIY6A@57MogxseV znL&>Q9)Wm6DGowy@BYoOP5FbwAs-0D-_e3uvU4V&jt&7-pa<*0+L^+i!t8WMLKsEp zN@xIlf}zn&g55;5qD7a8>R`>&kV&4_(lwMoQOK#+CV#2JM7WDN{RMi}vFt!#Is4Hw z9c}?~7M7Jt>zz*~($5De6yWun{DJ5cZZ8p80XRo3d3q>@MYFm3Wt#JRVC^ZuU?2Af z%Ap98-5m+00$RPb|M+VaOlXAHTEh>&kq>6aDNZCLWy@!)L2Iu<-b9_kw8YGB@&D@q z|8oQ!JqFwSE75m^BaoI9!WTcE;%gu>(CFSb>wL}U8R8o9Qz7lf z+${s{Zapn^z$PDyqSuJlcae<&LDk4R0MivdNfO7_|3+usUoG^}R9>=UV&# z<$z8>5NQG12a7E{r0u9JqrUK}QTB#tz_q15CfJQ`KXtCI;(FjkzLU8azBMr48-G4* z1vq3s-E0V3Nd2gBt~qeamD!=+62JpD8(v+|qDnp^HvA}t^2mOj%b32*#(0}46(oz2 zVhc6tOh-^m2Fdy1wR=(Y{lf!>s2i?i2-?=e0ne8!sUUs`3lxPMm@m5VT zaH7V^yhGtUyc>o4($BHbq{wL@V{ke!S*%$ArD4K76G9hAz2j8)eZf3bu*Cm!`F5147EhqDBy~DOjr`_lCUP$I?SAOW~ z)~3T|?9XAWiyQCfd?Xvn=am6ZmRrVt8d>kYq?}hFQ3CVzUy0sb+^Cnz1 zd*K#Sg<86@T$U$7Pw#p)Wg)q$(alyrap|Ru9rBg#gRwtpyLAtvBNvGTY*=<4Cvrk|t~}2l zW^gXo-M95#esAbL8bQOQ(0C#%LRbvfCS*ujLpXNRdmZqbRqc}-~c_@sDkQHBcjSKu&ua3Dj8w857`{R95Jp{cET=$0utrG)eeiV*^K z08qp0d~=D*@4!7OKAvPg>Y%SPZPKwcCLiE>tHiDUTHme^_$1{O#~O=Ne>P6B&!B0K zSJg*43GUMg?|{LFBQpaphj{yU1s0ffyy0PD?*HX4zn{K@kg2V5&`#5}X;j)+*i=~C znOl4#8^fwjYU2Sxv?}XIZi!O%D^J&CJmhwlQuZg*fXZw-4HLIruJJwwniz)ERS^NW)t*XTv!Ekc)-ugPRQ!3JF^7_ z0Ocxna_L#8DCPo}V+AS-BL~MJ0u2j8gy7F60paUjJ(n-{nnZlQACG3=1L43ym7+4oHYT%jNx~3NpP&#?JJFJy@>_i)2(YYvw zPLT_!T88=}Apn$|Wk~{O76thl?!S>M-SS&LyuCGc(&PhmESE_D5pkUL;=Ha}d!JWRs1|@m9_0euV zI7Sp!UtAaXSd=Ma`u)4k2l%)DphZ)S%Cp%^)Q3fnXSNb?jlJdNOM0rtng*s|=+fzq zhk-)0KiUy0B{4}5lS3X&lVn4UfD1M$Srko3@3-Xzp%x4wiZJ%@gfdDRMxe>*Au`u6 zf$^ViVgM`-mqCUSJT<$pg-8?o;|Y!wR%R4v=G=faQOh=T;Ycc0iu^p#JS9`2osZsf zi!Uktqrr`!+m%EtF$2Z2ivXL%3OmaTR-G6%vwNcz4>rK+-bjrE*{j$Ta|w7aea$yYY6gSmK*Z%7cH$?fL;lPJ(G!bIrLiLz zRsDoiSH30H^|eLyOh#1PNzKjdBP*B0d_-qUg(@FPLHuZIk~oE!vO3SbG>VdI$Ypax z-{K`6|*=G|d6XoN#?6y|4g8la?2!ngBDa7aPI<~X+vA9N%$9dgW zE5|eOowv~0oXBBV>H}v>fHmt2Rpt- zrR3lJ%jyeqU*OAbQ&LutlwOG+TACZeK5&Nm0eY@qf$-xap%c-|?km7kx3%FLsiu!z z5YFqH@7A_o*VB)iasLNHguH%lZRra`H^1v*R%LTy9c@3+un`{s4q0RRb;Tk~Mh+=a!`vR%IbJg^l&4 z6-9aG>UzeHg{o`Y%)%vA{nq9uYp;bB_M=xz~zh#Y$qU#a| zO*sT@p0ew8LekgQVB&L1DoMiHJNhJTJ-vBs2xWYOPfgP+5#>34+l#!{Nf6GBhg8x+l|;&AImOXzq_ojf z*P+ucw(JS18dW|fV+|(ao2;!U8UBu)g)N-;RQ^a}z784^^(lJ4+D9j={Aaf`8s@bw zsv=o6)$8{DFOAij=1vgEV??FZPKCXG&8&l5aSbp@el4*% zo2ff-mra-9pIYOAzjEA~$$Hp--ZC@8$BteQMIt5QIx&EDwAn&rP800MRP_QQ-RL0L znSm0U& z7F!IQWPcEelkL6p%=Z;2^*|I@xR0`pIX6xmj4r|##(WhkmLf&qkX zsZ%G%MnnoC#3&jLUty{yeCK!BM*)e$XcXe8H-tcBl$Lm=U^G&6*RNZkjb!jeR&{lm z6Gjz4-T?d~fLP;d-Z5aV`Da7%EM+FZb^s9efWuucyj0ZNP6U5B>Vt^_31bH&T9Ua& zwTWZI&R?|<&;bbI5l9pmg#>oajwbY_3Y@b-_h`|-ZAm#>2t3l=(qGmC;QhpOEA^nW zYZI^&>|r{3tQD(^1p-HPuM;0@@=xC;<=qny{lVd|7xYas)sMj5X~2uX3BJE>HEywX zz$edJE6)Cq38thM>&`0wt7?=Rc@Kju?v5ltE3mrF$Sz#|;^STqPCoA^E{c5_qAs<) zW*`RWSS{YMDevUHtd0k5o!zh(z`s<$6zn%!0S{KdzsrL78_??9X`A5UE*t;C)}hw^ z`PU(k-i$7Ta%M$0Nd>($0;;nS>w?=?3GH0Q$wACk0(7F4cjf6LwAV*oiBN7Jw4faG zX)T4}I&6cM3?>t0lt42;Iar#(6Lk8oiUxS#QnW#`R09sP?O8!eD#GKSAM~I# zYeH;*2D7$9&ix&8gFQfxaGVv>jV{}D@9Z{5!ZoMuS)DgY*`G~wwh1V4RPJSNOg20$f?)~ z=&=km=)1>-f1VPkD+O4Iied#|`WRmb?t&()F_8z%FC}Z1NV?p?zo>hYEL-|FNpsJU zm7p0ou!$tjjZ2kM(-Y0mJph>vFi4@&9&QxVld}{diC(;nMk9AFr;r)(9|+r4&OmRJkD$t>k6lSzS}7Y&G6 zwP3yX0vvgl_|xni0;wexjy2Wg7uO(ePYzE^CYkC=eP@1$C3%y1i!=*)=4tmpK{16l zpu=?m8lIB4t&ZS&dUZiO0Gx*hqBqR@|=Eg!8x zN{v|C0oBt6dhUwTEwiJne#h|ln^1e^dg0ju;e#-`BhH6SQSU|gXN-T>y53&yAf(oX z1lqys^yTV9f6hP3e_Y;1^rXA)Ep0||ZubF$@(*yLR^wUR0y6L^En_}kAbKDl{TVOrWxc7Ds6*n!sZt7di=*K*FGX1Sx1FVZ&0<#~dg?HF%xdaL z#)p|dJU338D;RkAG&9cD?m0p*ca1OimApSNC8DQ~-i+i2Wp!f|h|ftYy)hG}w4}a$ zpMyt+EAchgn>xRSv!$-SZ<(x*!0ba@v>i82V$|qrKW?bky?h_PiA7*C)e|9NeGtiw zLxSmmn3(&9P?>~2O-83?s*yl+Knm&}Td}i^ni<{;|DpBAZsE+-#bb{N#6*$-ouC6a z)i4nhjVq=y+S7=p3KNUD4mi5UjTk&^*QNoQmpTP|S5?sSd#3h3&AC+qiqeC(K3u@C z+5GH()!wvjF*j70CORZz@W*x@_U%DO%{F{l3P0#T~9=Yvd#6=s?R`%4jibBJ^=7ERDasiH$wt&gGQr_Vdr zLDYlAp@VzKVsSiU^^ruqAyA?7axNVPdVH;$T?J&LB}gHIPkcX--<+Pr8q||(7+nn+ z$~8zCaeqk=$17`oQDO>9s{XV+bU?F262$lt=F~qdsOi7sdgx&I0pj1!+!FWtj_x%?H@QJV1g-l?opY`a$Fwfo|`rK7aq>w!&fJGJ7Y`QjVdC4-tS9SaMRU!Q4Y|(S@CS^C`1PSKsu{g*@{^wbw~l%>b&3 z9Yd7X7=e37RBDmTni25eFbAiyEU}Qu>?LBMKQ@$UmQ{M~&VlR~i!`2)n1|pafd)Ax zq#KO@63l=S^Du{TXOL*rQG#g`C8UJGiNuL%m)K}5SN6Mu2EL!L65N)6i&uTjE%2RM zS{Its^v3P-B+1+3WVI<8OLkP(qll3g zJgb=0c8Rw#DvT*2A&B3i@v@%>nXZu9Dj%3YEp&@5QPTBXZesIeL>vXadXsQe!8;$~ z2;PXUu@g;oegI2uORgHvU~uI?4B%2BYbY?51y^2kUM>I=BeY*)skJNb?fzZ?*WFoW zH1GxN%P^w`!OF1GTK3Zr;j#*W=s5<;m_Ss$CxalF+QGOkQ8C&y^@$RCvQmZ=udq%&G*fpVv zGKbXAtqBo1c?q0QJpD7+?7x$Ul}WH(Tp&87Ax`K9vj`o)!l*B_rS|N+96xkimtH7G zQ?r&Y(-z)8aAd?{OgWB=OK0=x{A4&+pUpw&C^WV#+C4+ukqUD>G^(L^ZDmyh6Qb1Psm=xx)gV>Ax zhY+qMFDBwIgCQ&EIR#DWvsM?Z{%33arpdEw*$JnAUSce8Ehn*<7=Nq7JYrZY@gm^x z2FkkeLRfv25#XR6UN?{ot5wGoZL)SKekV>J>O#Av^uKmi`2Om!lpZiWF*-7^q@d}) zo%oZ5&4%65l$gizTPFM*L~eEVfa-ZKVct2xqJWNFKllm6ug8d+f;7o($WjMm+tUAl zHUYV-hgW}BtfNL8Z~JR{o_9V$iJZ527xHd~I{y`H7{j$Ldz-R22$Qr}=U-_U0K|yG zyF>R(f1=M<)^R zfv$}AtXH2%)dw8SmMyz>c70fCZHhep4E>;Q?rzPi-jC`0VBKk$cz}Hv#P?;^_k0P6 z)rQZ~`0f+;+J=#H>kkiQgH^PM9t}7n3|W=|3-)&d!0^9!it|xoLZ83j?CSSXJ9*LOxgr> zN&w3?RRyk+3ILA76f2LPa%ZqN>!S$Rrvr(Xx3mQQt_1D^XYb_CToJ^ABUlg*lE zm|Y`omR>D;8ze8U610gy!qvi|bH&XBtb|IvWUp-Rh;+~P&Hi-Hj!T2pfFu{IEdW^0 zW}|VGQzC#hkyaO@#7e&pB~F5ZrQ>-Ol*qKKg__}MyuY`4wdWqv>^ygB;c^2LiR8XLx4Xpbxi2XrBN4;3scDzuc$=s?Yq4C?eN8A#O`8Od&Rk zu6uM%{XzDnujHuM@j%#FEAXfwID3zLNvr&-hrH_&Az`3-;_xwieDpW$0 zQ4Mn=;rV`6lPBoUM#&JVpv#+6;cz4}I`9q?8y%U2#2nISP9uY&#{`Cd(rw&x8~hnNmtq3(GR5*~Y@xHo#@n zO3u-BX2_B>6rETnLCnh|?dOv6&fCWjp~o_cXkbFKAU%!PGVmueHOW-&gcj%287t~M zpHwQ^bhe(6NrH~vxT}Z^J8(5nEJ!4vd{6Qz3wbjiB2xri!31CNFodnhH@&}tu9%F- zt~p>5^R~Rq#Mmiac7$DCnZJeXxFfe5~@aQGg_-@HuSQQHeHNqphx?ctkOv zqOEj9Li3e`=msa6RISHA1H+o z)<(u(G{ax|4|s+pm?8q`pB0GhwSce}0|RmZ0Dzw#U;ue3U=S1lFaU^On-G8>{(&<|{Qlcy@qzdjn$V&plvOE>@nG)v9eBgT)VR{ucXHASir%r^#G&sGT?eYG;b8_>t=oZTlSGU(-C>ZZ)ijJm&;^L){0@1tk zCz~NGphd^RYAgioq16s0qT3Uiq%G%bZS&~~YiW>Fwl1q&zO3x6(p5F^mRGPLTimZu zn0@Tl^fJ){EK?tSzUbDhZD}Y4FlPzODbaS$^etUKf5-flU5!QC-1cnMWWCGyy1+VZ zq4xvR4N&~p!RpzC?~D9TyUXrgq8rKmKTU5NSUvjYPTlQ3YI$)9@467Wf6bP4SJzNX z2F{~UcJI2qy5mu&6k{POuH$56G-#QQw1Tbb3*i1BiX`G!VZ$(Ta}W#c{7Ep#2UiIe z5aDb>jEC~t6-n>KRG+DQay*o=d9+bY8wuzP`&J?ev4die>ES6KjOs3b#umxtVs3eO zdtNW^zdlA^eP=dQOQJlvC~_{IbND{rYj62nzCVvcPvLtcGI_&KIltHC^teB+U(wS; z@lI>p->(bJV)1#tZYueFz4hyNWas2V;l+d6oiOn^R@Fgpo9;#jkCrWA1cjrpC_pyR z7I_e{`X-@;ZQ9^ib=-*olj{NLXY4SwUk8op!itZj42%I@F$!^0)N$=4T8cf~8DdLc zMiSd&Iz#62tFHluMg6@VF~_Lu(_sXy=ei^nXy#Bx)!84gx%$=?Ix~YXe7A`UgB(~9 zXJihX5$ZdP`9nmBj+0%*K^!#JAOy=`cdxeXIiof_w}(T?kU~HU&>n!LVcB$rodSq5 z#{nbCZtiqQ1hL1zM3@#Fc<2Zgl%&%av5jVITxv+>^k~mg`3U_IMmYX`d`yH1dq6e0Ee*$eg5hbZ?*i+islBCY{K@2XS5<4;wo{Gvv?!l z@Re=pu*B9HV$fVNuX^qK(r?}T=(e#%A2+66YUc}dJvMh}wu@n--yjQ~_o&NvO)hU_ z4|cKK2<2}mmt`MY60Hc((;Fdui4ny)G9a152#5&=b%g`;lUti3BW3#cy@Oo2Da zUMvPQc{Z_^Wl_Y&k$8a#P#I29hcQjy)~0<& z#2LKU7%#p6_`^BDB-M6CgjWKmR*+aBAPgdlBUz9_-Pt<cNywZP37ykzkw`MsO@#|KAySg@dzsrY|n}f_gryZ$*`$twpq9A=XJ)~kxW09`J&Msk9{W!6#pDNk5*=DbON=H63L+pW=ckOa>mk(y+EEvK})|~CC9);_-gjQ{GIWtWaJ@7opL0-ZSONT zWNUZmp+e}=J}0U+DAFx%5(qS(a}Gx;YzAT5Nb6__xfyOk+E>|eJ1>D@c&Or#U21og zT4nRMYs>uWk7dVM`qYl>37s@`VT|OjrXwhxfG#};T%ZD{Qq^;|%4yl^xvG{A(ArH4lnjAtrL&bl&(>YoPtiudRTnta zH7hmX+7&Al%VPox_vVD6U30Vx-QtCpi)+zYtKI1o#<@pjUM4+%FVxy=zyCFxZBAPw zy!|FNE-C;3jQ`1IZg!4VPUa>i&QA3I{bKr0N*l_Uwmlp}9K8j6fP=bCd6SWhYf6KM zG4(fQRwwTaC4exGXb3};pq1D>ul)RVfXu9?2KGWckxlZZ7@j z%c^bZ{hEHSvEXwFEjTkX&%a@v$-kAW94?rI7fE(`JW*b%yUJ{t@btE+Mc*!`ZOCpb z=cMyqjYd~dU5T+aSk74#ZQM=uxNjM^t0=fJA+~Xt@_g#$N-Dj{Z=UUJ+}Lbh$2Igh zi(MIRU0`ZC4UTn;J8tpK`2DT|YdTy(QP&s2PUwu{IO`dvIA5I6^AZbV}25sT1x{ zYMkCY?0eW1p<25b2XjzjH+fLA$UED^BIA;7wlvG)xU^bJNgMM(WU`>L=v|P>cf}eL zNte~ok+!XugYZ1kAMNAx?o)reiz2r5MCEF#v6I?5EY@a|RatVI8F59V=B2&SI-Od8 z_C*x~>OF5@>2yJZ9UtBE8vnliN>uT><0!I=xMCP3_4A2v$Q8ehQK3^mYa8>$Hog5( z(8Zg#sLL(ZJA72-`f3+RC)PvstLid+GL2}n_oJb*&@otKnmfGP>9~r|8iPNDyyd6j z{KbU@?0&?CJMbyHF>D<5`Z4(R#kJXacQ$+w&}9DHC?Bgw_*@hm(Y#6 z;n8q<#?;T0VsLLuFdfu^Ja_{L7NjL$Xx+>R3QaA~eQOIEWXl?KolhBio5g8*q zzeois1lm(5sb5ASIP8|IN~oE`6?TWKA}A!%ssW_QRJ6w>nT}k%NyB_JzrfB$kp8uj-Z&+_kxA>|)-k{yi;sno>}5%g zs%D(XWc5*{V6PM_eH)g5;Kar>!qagAl85NL@%j8{wPgDGe;wiYJqlDi`~BZFpalQ_ z_~1w;u8*p8s`c9PU(@i{O!h$11Wy1?;0Kq`4+L33=SQ;V7o4GDLMEw`Wc*-oP^Hqj`E z;JC*%Dl+W@Qd71&U5j%>M-0Y@n}xEH3n>rQrjgX+91_8Ck7*2>3;?SF#uBvP{*N7= ze&?S&w9xmy$!y3YyL_L|(}yFfa4_iRP$j7|x!4yb^y_p#kEbIwrQ<%i)2bs;3_A#+ zS+OY+h^hmLeRZbB&^|Z^HDe-vT>?hPf}7DSYZ6Y7FsC39GGQIB(0AG(ydxg);)_^1 zab1FZLsO26A)MfU!VB@A@ZSB(>5_;~1^h<0SuFOMRCp-Mqvlvce+m$igPP|zXgzUp zjNrcv8TyUOyLO;G0n#Nx_%t&_6}_47lqYJT5D6<`V2Lh)@sz(-8t(Fec30ahwPQXC!BXe)l3V9{4?UtYP>+7LXM)B&PlUkT>p^yn3=@L4SW; z^&}J3|1Fq&T;G)@!4C23=<^xwJ_o%i5}e4G#(6qQK(b+EO2F}uTy4UvFQo8{jN)_;N}r zP67$1M3WfeLlQ&1=8+!5PfF96sXBwVzMVkH5cD{1NAq~vQ0VGG-P$W@hORR_l!;uiry4SdoI-%WOxcvNoY zKDTn^jg{E!GCa$u3LR6GTy;JPt!gJbGI143gQ;u~B`Q(@H)w`7j`t zN;eKj?YK}fcWCPga%m?GAh&g(6j1jv1Z7xId^7+eIfl z#@<|9_E!*cRc5z~x;zg$^?Y)asdOq&lWb|(Cabs2?`xa>=k5N~@9VUe@9VBL_vdSo z{^yfxW9H&>uBox2owkSi131}EVIIkqUHa!}!Zn(+&azXKb`Q!#PU|WL9v{Ev%b|Do z-69F$3LIMp$&^YFi!RcWwBZnVorkXvnAKy_-l99s(5Dc@;mkvlp|97t4f`tt0?6v` z%o-%&S@40z-<8nkz#=q9_Od6*lkrhipOI3=+9NY&zhwH0`5Ak>N#538p#SaKKdE7T z4Hysr;Q9Ag;{Ri|q~~a2{eRDy{(BpM?mu=_Lci=F15C)Rc$d%-mjf4qp!qo+@`5eI z2yoDn4eAA6=i=#M~`NYd@To`WHzjXF?uSB^VB{fV|ol&b`kth!@?W8`HYD*qxoaL z)_{n@mJ#=}zvU4nYja>*xt)OZDVUUl{&(-ub^^D53U$VAwGDzhej&u5*Wl z)&LN&6SDD7b#U|L`~(n${LpFyG4G49^!lalxxD&B8RQiwT%=>g(1-X`~$_`60Ex9n>9Qs zZi#I?&wcUGNa7HXAmns7RQI*-Z}3x|*-HW{0TjMhS8Tge-prSI6Da-EtJY`>7U|5m za>64n^ob6TSc;30ghq|h^P{m?B-}wkEXnoyHx8#tUw>oE4D-!{9Dwva2cYxcFr{JB z85PpwB7`$MH*Y3M4u>b;B--`~ap!zx=Joc&0@Djw%z_D+AkQ6+_ixwUcKj1C@}!%% z(FvcyH*;32Z<7eb0^(`G7KuRF65~vDj$fogRc;i*$vC2nCD~DrK#Xgq(*;+gu@pL{ zAW96wAyU%%aAbutHpJD9IF^wfMh?U?M5vNAiHyda5V5r+#ihKp5P+2sa%(CSq0jSR z>CRf4)S(v9MBusoB9Ts;TMCjYOO^anz?@9Hiv(n%*P7pryKpAEN`)=cZfosOO%|5Cb27x`W$enJvYPLQU{EfdJ{hrM`yX6tqzw zk1wyV0MdcHJ51^3u;i%vaCp~zkilwQ+O;UmDH9OX5(~4UM1%V9rY~XrSn5G*(H3pm z$9l~n37r@c@gwVf%k(*+7$>wy9IjVfZ0wxIBCRnW$EXjB=O9i#2;esWGNf-_4!Fufc_Q;4%)T`-X457hG9QcYi+( z|6VzlXILwhjxB}@+rBVhxG~ZJ0CHn68p6)$R#t2Rh-n(pd-UcK4cA>rF4Z54eyn;0 zSASQp^kF#r!nRTSVRhIVWwVv}VIMtzzKS;GL!AjP7}S&=;S2n~jXCb7aAD#g000co z|DRX6{~fW1RHtJ$SrK~B&$!AuMjMX&236}iM+zca#))h*h30`}6wvAu%H*56ceLn5 z{CoIgJ%V`EAK<=15@>%=?dOG@#uSh4K1@THcikV}Ii#|i=Zcm8Ej?@5tRix##ZRRw zy_VwN>cQ%ive3k;S2!}dv=%t)h3fhJS*Q3?CKJQ}hw$KVK{kr0KTYOF#H7}$K;V!y zEM_*nD^JzcFz+YwqLk{++rII_Ol;R8jC%fqK@~%a&OEG^J|+WNATj~-Nsp|N#MN|q zM%5+W2y3|g&uQ2zAd~&nc|PzeGWN|}nP zU`08Q7k?|8Hsv~P_Dzof8tLtTOAHlndP662MePoOXeQeuP3{5f3%VpmszN8NPB5){ zReGXUUrjd(fB|mS8h)y|+dxEHzdD5lEW%&iMflZD_gkA{Vw?D|b*ewNOD9@{sgO7? zAG9D=_?9>}W(7xOIv^_-2sCPx40pYW5*Gs83|=jMY)nj$ssfex0Q!WIPI8d`kb22s z_dYiAgUSE`u>QSV{=QcJAE$0z5t}1_j6#But6AZ&z+p%q{D zX@s|GhF*uaiblBGI6y~!t(Ud(J@L1gflMw(8GB8gy!bd)MU+{Mj`hA}t`r^uk z{mO0gCyr8lvX_91s_}+WL!|^)>i=r*E2H9Ay0vk)0D-}RySsaEf&_;E0fIXW?w&w! zcMriK1RdNVxVr=h5*Qo;LGC2yJ#TV2=e_IRpWpg!F|5@rx}L78UAueBvwP+bFanKA zdG~?RzGGmtg(4}PTF+^0slWkqDjDlO23{(;?vKnlPa2!lJcLDxkx}b#McG;sJa!AP z$gG@jLo0yo73BJ^$%G3i(_qF92V4ufICwVtn(yx+Z&ocsd9O)+_M+9Fc(m|iaKhX! zuM28nq#1SzV)PoDf_VtlE$~dc)A|-mr?|r0pvF2;__0E7{rQyjNZC`P&r1bIwC2)e zFJVVKE$(NH@Ra<0lIhS~wllv~#p&jZ=kU7IV$j(39Q$p#4Z`sknPV=rbiH!br>);O zb`1%L7Zl%c=0qqd>a3MeV7yMzV9WuQ;4lf)QtwFYdSvha zp>ovX)023b{Bz62LFbknXTLQ!FK*(I{l}FQoF(LC_BfZ1jCcX6*@hHPYYeE+1iErA z9F=9&4H7ZZ*fk=B_RJ!uTi=zOTORP#0h+Y{hkjo}{r>Up!>$^qwE}rshr|DOPiyuc zPwThp9af8CSS|S1n2W<5_<~7^-Ily@WY5@J5-zYjk;%&n6I%wXWGrUu;?%t8L$Xkq z&z|>}&q~~v$lc}E=+0M@2NS-M|(_88IVb%c;@lhsxyqv)VoN^LPxYKK!&%o!t~HoUe3 za~MTW56O;|_r!l>ZB(}kQ53h1)t!}BWc1d>hEb)KGR z|8V0}y?+3=gH`BT39So_70(e6!80N}xrK(l24g|Iu$R+Xyl?9HXP}(8_+vGDl4JFl z`1Lz_YJ>I}keIPHF@z$&ENt8RMz0{U3jWo5%4{8N^s({J&&lk+L9tgUYA3Y#r#>o< zqmMcoCs2RcsAi4MV~%G{AQ@@eguaVAXG62h^=NKmkV7lhdRA6g^^;IzW$e?`3|2`J z9O?cyX2oL-7MWCo;(BrU0QQ!v^Ye>s#FNX>^WpkKx(LHlEW{tg%h-y&;Hy3aH3%IDi=_hsdVE>T8FJOoAhCZf|5z2}F_bu5N4Tm(W& zkSVBk;xb!UkU_7Gni~($K(FvuUGwf}xJu?h@>XAq;~!~B^9?nPKbFRFf2|woU~&0A z(G;2Bad_MMHw^`)z)AD;@|pb=P&Y{5!)HhRSrnm$KA3w$0DLRiFtbyuhyTehdqMIw z$_66e)jv7{yK}FNf*=aRi3SCQ`-c(hY+>YN`brJx^uv<<5q2)q9EH4#8n+eoiZo4x zb}=4aKXLvM1sqjQ;FlORRW*&tWyRYMd$yw^sygBcVk)?pH10_JaF{rRbZ7)y^S5mwkE%$|ScS>)4=b`4lYHaCH;+_lkqD1x&@kv47H#MEiAP@Rb!qMp* zL`iEgNa^Y04G~+kd&y`Geip08#ONOOQ>r*fjIXw*HAzvi-Ztj1c*#-GIdCzB`UUPR zV1`pEh69U6xI_Kvs)VW*jtn_;hD#P5FCqtTltl@4#36VIyydS<=ZGdB3sEWT@d%{=!>$f=I$aiu7Z*@xHkCp)qn;rCOasHA|7#zd3%{PxU zkj%WuCos>!AnBaq$z}>Nd{}=0;*%Jz-4wv!>6D2oZ`v5f_sfsX$Snv$sg1fg;{}D` z{-L{ZLjJGvY$BzI;RMODER`BM2?i2+@;Zh*_-5NfD-JBKiOok=Fr-9VMC`FFO(~p1 zE>fM%%;jpxyrl7n(};t#4+)4o8Pyw}<{rJxc~6Z_l=T{wp^Nfq5V82Kc$kcmHiG@a z0MPTPfaT;SQb_EhkkPTT-B59;%!{{G0~(WOuMZ8L#4f4ZKzDM6dxav1zjlhv?6pWv zFK1>W7HN=bA;2IdO$KdoWOpL2iRRhBzG}=^jvc04I!0F9AQ@-T8tK_uwm~2rxla^R zlB+k9tacs>Qj7kkvTwA4&XdiB+s1>!O>=46>(hnlW9q%Zg}i#}s~qM*tyq-3$#$pn z^6*njX}t*JQs zeXeaEZ!a`^!^YMit?KDykICuD&Sp<~{3>Z5!yJN^sKva#){qLno#TtSL6{`GOL1E} zLZ2qlq-hzVg@NeO^HD#$C{2812?88Cw3lBfR69pIPu$OMC~hd&v8~4KQ|#efim4(b z7X{Yk(qGm1o_OBwA6(C;Z%nI-&RlPirpvS$1k*~lkEMqlD*1ZVdtBe$hm=$))Bf|b z%-?uoEf1o!0}#*iU-_bcd!GL~`02N2Xbk_LK(ygsiy|$zoLW}e3Sm^c>B~>P(xE*A zY!XB=m&MY=HP`8(@NcFlzCJC`0g%jAKa)>O&nfWkH=)!eUw+ue%(u<`x_@=g_yoW#eOb(YKf% z!;z(m;u%Oq6QYQEh_kJ?8l0Fd67TV+!cz|_z*|ivsW^<}A%dPw=ojAkQX_(Cs@ItP z@|)6n`b{|gNI;#=a~6m8H=XS`)X6tJN&q{~!93h5_I$g_?H7Y#467EC#EH^ckqOrP z=(Nx)lH)}FM+Hnp$5nm{ZPV+qT0|{}iYogfDx^IFY+zo8oKu=7-)C|s>!b2V1(ntW zZB=zyc%wFmj=o3bb0O75^#@Lhd{MMG9gcK#=@!0JR!>XMtTX9# zi>dUYb#FFprqH0tt7r?7!Wd_p*QY_0b<)|RnB?B0<(DLiv;l78x1L(h%41B^`}?wl z4SE??B6}p%U)A1g;$y)q@*nV%%ER`Uo9s|H_0u(vP*y;#WyUu14}sLy#!{zxn<^VB zkWdJ?h1{OR=|k6s+PT4xCm0~n3s8>{8Zd}%+lTpZ!)g`5@p+V$)ydlB#v!IN?c+k5s;`K z^p+tdpHD4vPNFc;z!SNG{ZsDbdfEERT3q-UxMiIhgJJ5;Nb1MSt>Lpsio>K z)SsYtH%LYG+kE6iZq66`vi&SUp||NzpvXDScHU+C`ncSJM==i#kpddL|X%Ky@9l3?%(L3H0r?J-~X ziVOX-c+<==lNfWZx+>{3*->l3!Z8E++#(6o7PyNf>zvh+d2fhb6PUZn>B(=CiSF*+ z`W|Ly^+jJKn$1plm_F+T(XyLQY}TomB_89CZfA0i2qCE<*+ve16ZgEcIJq+4@L87@ z^aBH60HU3?y|Yl~bm88uNr^|abx8=dg)WIuOHCT;eASXW@-lM7m=uPB^eAmf*ds*f z_Q&1#Vx_?x-W(Mt<0j}61kg@q=(4bXsI`2Px zHYRZ}^Smw?C-}9E&gXNJwbzr8`D=8bxXQXgxopSrXOGf3Py_|zbwzou7Mi}i2i92? zEbYk&MeRI!(*YG?Zpy#A?zV9MK0iOl)s+Bzyx=g)bZ6+1$CVZ!^SFx=i~}d0N@(8VzVMQ8DU@! zzzoaOAsj^ry1KD(5cnQd2BQCxLHOAib7;2v%87L2asm--!4U=1bIhy4T}#2b_*4Xa zWzw|d^R2d!bWakf(l&tnHS^rsX)93Mo4u38`1@Ovw}`rr$YQD?S{+@q(=}e;`lL0c z&Y0@e(f~0`L4))xpT((qj4gaDLvmn#A3MZ7QDdt4EkcN&SuoZ$_Hh8v$+*rckU za)FfjunQm8Rb_4U4vXseu!gby*i|z4j?j{y>lF;vmhdm~tC}yhEuhfyPZ|<>6AV}` zbV*3eojI5lWHf$H+wzG-8bvs6cdRSV)GcQ}v5RLpFoH&84(j5*k|4nM3_-_6Beoc1 zwnWh}$en1D{>t+bjVYK?8i2#{ekL$0tJl$Tl;-5_66&LX>gAq7iOY03V1rS^5 zgcHZEwB2r93}5b#irTH*U+XP$e_lO9dL8?SQc>i_{d7IdtzPuj_xmY2H?IiE^RUOK z_yT~1&d|udNw$oSovB_dVpS&-^sskC@L%DdUDbIIEr!*wbT%#z&9HTDOMETt=bb9{ z;~dxXy+%yCfq0dF*JqjJQ@&J)rbE#|LH*z{LRg9p5UUz!>ZE201pW*ZKlq!2#n{qr zKc!8+O9i*LExo{29#Map7)429Tv6chy+5BT^6S?zQV!UNeGTRg;4cgKN6g+ZhGIK{ zJB=+g&&qm(3u4yXCU~eCFPG9+g|{y zG0G=Ug$0;LLg~9_`6;r3yJp?M$}a8N8EnrFwq6rz6n*=0hF%p))$f85z9`M=ENPD2 zf4^Q|Ke}s~T0?hJQi_I?_5bseV+5CSd*c=Vf>~%xK`w_0+7zYXaR+mK{@%3d7DYHk z1r>5P97hO=er|3I6mpE%E!=(q%Q8cgBH|7j)ffUyHbi!Rmu?SfMOoVaO1kX-lCDCR z3RYhmtK4D&MpKjQBXN@8lGLSef!Fas`qw!S@j5xZ^+MPV46?pQxW~lr5bc`wdLxHZ zYT2bQy>@vb*u2!@4Q}aM&RmD<1FRA2qpcfZ3ePvqb?=^zOyZfnaawDB>0`2cKB8%1 zGIjid6ona$nOdto$=Q%gi&Yn-k>lzBbZCI8A!VpNf77je?w;oOHA3 zbiX&t4w?01Pue!juO4Ef&OR;9BDIncz3>A*0stPuvLGs%4UAzd^{&p0@2n8wbi ziZPWRTO!93#?^Fshx8m{5?ToX`#o%c+dqmID9Z2I`9pUhB7Ope1a0Et479h^wzXmX zBgJS5G`0PeVI<3ggQm-Y`mr7Uziz>!9pNzSXb5YdHNk|X%n^62*j;xWyyiCzYqdZQ z&K^s(G`i~xJY`0veRkxlyMkrW&N6Vyyc*Y-Iyc?hC{I!uSkdjnX*}GB$d*j{yZ~B` zeb82(@VZSQ)A1%wY2H&Fwl@WtGy61XNsRJ%d^&wC~+>ybmT1|b802|7z_Q)=`glB_BSiYnCMCp^6Lp~ zfGR>gHw$ZhcVP3it4{W+CjRQz$~FLcQpIwTK(Ou<`619FR_YF60H>)Y|GR z&h;b1A!bRLrS++7`@K`!^R1Gm27>1o&F9ladwmCo2YvO^qqaUiS8EIh-Y`>!0JU`d zPMg3nt;z(CL*?)gVQeI~npN8mSMq$aUC!tBle}||0MO*KejxP__JrW5WbS;zBv|n1 zHc0h`3PXWyhuyR7+YKf}cz@sXGDj&0nUMcfL4G0i6+g@t6QGmLAN&5#qo21vv?z9r zPBt_sH>x`tToWCa-LRF02{rtY%Jc$bzN4UJVqhxX}ft17KjQkWt| zT6Epf>X#qkM#$wOCsc(zCb+f(@e2+f%gb?ucxm>;HH65$60sb1?X+kJUokUwdae_m zmT`*5JxVa#kCWG(gXyxoBQ3LmL+9B#K3FwE4ZI3hF$&l>Zfu8s+XzJ+B zHIF(5tB`2(tPx?8|kgX|GYEQ z0_ErXAaUdm*gwi{9xmelYW?<8EY*x%GUpRX?N@w4o$EI*HUJPd?xiEY6^`Y3~c<=$segy-_L4NB(upfwmGu3l){J-&W$_a zi;;x9fb2qmCbwg(O@(dl18tqP#HiUX-WK{{qfUqs+$-hIqtix%f-(k|TMWW# zOIns$Bb2;?xn%r8J5;1o|MCnsdt}`qAOokWe@3c8t7`jdx#OH5^LY-aLn->37hD+Q zieyglBSh4ld~n<$%qY4LtgKRX$&gQ{H_~ph?5EDd*hFSJyO=p>xuipelk6P2fX%dV zh8M6q2~Rb#!!evr$WkRpr7wc3p-qTXnAf-h1mJBEpLNYu!09LI%-OGXkX3SC)s^)bkH;q8TX%}XEB z)w70$r>2+(*A5n)Eu(w$SAl`Of3l5HIKiq+k)6JAGv4$l4;=q$5i zBe^@qja+<&4LmQspgahPc-IYrv{v`s?76E#viF)FkEx$Avn?Ghhbf?xB`4{Zyda3U z;1TNmR%^mBsWPmcza$(|;}F?ciUF^qYIX-7%;|17uBjtvN`(n#;^GI+`IB{*u-G#) zk$-w^9X^jX^Ij)WsfGb|!r7RumlGozz&HpJDA-YxQq-Pql2}cfH-TQ^-UxR+EFoTb zUKX7zho zOXfM6`o!y(+{&zAjRQja{XD)I5pmUxf#ma+rslqU`EtXz8Lh#K$j7lyTUS>>YsEoD zL86yV%Ev~~s3C7!m<}CFN7YJapLG>wHT4W)&IA;yWj$eE19iKn$d~wpe6u2DHyYX& zrAf#04in?y>yF;@3wXa13)*X?-YiXbyQ(5>*2{-SwFec@USj|l$}gZ(En#PQ_v`)wQ23ZM3*b2rWC5 zJh{BBJFHb-gpyT{)EFv*nQot8g-jDp;A2}q$+1SWDI_1j&18K{;aw7B67LtK zWbgukS()gFv6I!>qp(G+<2uCL-esfy{6iE?oL=>Hu}}SHW&Ib&DeDLK-YUM}QzPT= z_y;a^bNUyk!gDY>V&C8bQ8f+1bEIN#~kC;cFXOg!M6-qT% z?c6+er?+$03D??gD(>hHy&HXB5YM_*Dp}nhZbv6850aiQznSJ6zuMr8!Hl{X&?xQV zF5NH?E!Gy=?Jj6m6`gP2o*sce*Z0|3XyqA9*~@8C7`}-1d{VYoT1z-nln z)K)Ueze!)A;U`j`e)EwW)5nWs^46vmuDyBnfNu5V-N2&A)$MK6$fii*EUSq{x>!Cz zR%E*dXa&~*kXxxVzmS+ImODA^q-Ec|fvkX81uA)KtiwL`K`mqCBXl~+22N(VPwGnJ z%Ds}Yvb}-+T?6Q=K8PffU$dW}vp6IJQDC`y#HPONtyA9Dqpd^#TCi&$y(5)g5%FOY z1)lUyI;EZF7|U^`(vJDeo9_GIxfIGques8mv4XyEdZCK(M$B4=uxhPXkP^uB2(LW< zS(VbG(w%G+DYJ})GJR`gde{$o<}=)MPh#_&ty2;O2&}&hj##4SxsUYMc<6obRGd1=9kmcws zvppsWu^QDN?2$*myMQM4PNx6o1O76TgX2~ey4bM#R^ji%;x2h^*Ll!w5g5Fj$oN#f zQ3q^Gc`Rk~mhZeKNlQskBn-e{uk7zDvECjr8b|QGNwo|r*gbSmJ=Urv`T<$IrALJD zGwjsb8jN&fkC=2PK1F0$cUr?nzngja0-5KC$`pAPenGGZxi{%hoP)?CT7A1p^iwV}c+%MGNp%u22eiksDkGn%6t@s5R&SEMrmlzc<=sAjU;b%C&4o!!)Zo6aG zCYPqTSo>|-B7eS+wT<$l70%^cG7*DYf!RgRW?-FPzBLQ6AS|*3m>Y4d77(N|%Qm}P zn`fQZCtU{<)7&d$)OWi}SJ>U8V<|%|T#4KxoIwc0f2b2Q3^Rm?@n@ZT&71}s7_#?5 zAk~3C>fHa@^d#*e!DKt2p}L2Isk8o%y{Mw_SAbd#Hp(+dFGa}ag#r=tE;gQ#Ot#%H39yJ%0BG=@C5_E07edfc7OP~frkJOYdU`cWL*4v z-hZp`e2DU}*5Mb*;Qd3Cf2@3X2>6ir{|gWU8v4hI{#JPU8{n@pfQNt&S@6FApTqnF z{5Lb<0Vn<;&_jCgFQ7p9ha>yBZa>}4hbRwee!ozlQ2x_!ev2t!zZ9m?;VjfW@?bHcw+3UL1s$|Uh3h{ z9wtD3fj%evpMd^Mhdc!RYuNo4Boq`oG4yXyn?E+^UxV;}!}?3`_IE7aC(uw2L%9!o zKQv~3^=BmiIlVtaVb1>!kNxA?|26XT3k7mS@%xPa8i#r~n!ko#en*j_e2DUo!}!nB wF=hM@)A_0O4+rvBbLjVh2r&J&sDBzqDhlurHUktC0pw=_a`ce}@=$^LFOepVhX4Qo literal 0 HcmV?d00001 diff --git a/한국투자증권(API)/legacy/rest/한국투자증권 오픈API엑셀_샘플(국내주식시세주문).xlsm b/한국투자증권(API)/legacy/rest/한국투자증권 오픈API엑셀_샘플(국내주식시세주문).xlsm new file mode 100644 index 0000000000000000000000000000000000000000..2f2812ec95d0717bbf1aa213ff8025ed83648cc1 GIT binary patch literal 138921 zcmeFY^M55x+wPr-Cbn(c&cwED+qRudY}tZjNC%}e#XZh*3?VGcV z`fz(+X&t2ADkdtLg5-Mw(R8DC`>=YhquHV>Q?ia8ZKhWTvax&@)5?V=>tI+=mXEQy zh(sGjaRlAZ+v+Bgq=X%P^jsjsg|*QWPwq8wv3PSmGwfB$@>=t*{)urgkJf{JZ<$DRIqTa^to190Nl%MAXa0NepurDPA*_%n)mQPVr$8vbM-U1uy zEtuP8pK1i1rH=AR3 z&q2gf)46{rIr^#PG&JTc`U&msGaf$10af%J&4;#fjcJ`da|_Hi%&b`|J>h7c|9RUk zZ|W!JQ@cw*j6J6e_DW|c@1s^esMcX+OYoU7b4GIl!U=TR|dW{tL75 zTc~9OdR_(;qc>pl0F<0`Fgow{ntm`DX-KKH=R7x?z=Aa`xodf6OG^K<0P?&;$83HtEb=sSa6CM0YD-?o!)PwYa3iq zr^EOUyG#`k2uPfSO)ize$uD+J-ziA!lZ5RmcKYF+7w#7xQbokw$ecT4D9T$(awSH# z2!-da1#97^XjCx35eu<`QMgn6)CZ;1HuayXzAf-8TvP_vG_&TM#!sdDEF~44K=X#O zOP8fOz%c~_oSB27?vksLU>}B z5*Z@Sx%W|TV7ea5bn9mY?<*hvJ>nmMTeA7>pG49+yLxB;Rnzswa|{5mZ?2ZKf9u4> z#@<5T#>V0g!v8>rV|?UJjcXy z0*F#&9n=G;Ce4M*xd@FD+ds|(_BcLuG*E-Ke^)$9``4kWPuo~EseV&cNk~Po6mCPB zeK5q})aR$|E9m3->PDb9E*2Tfu0$LXucq!nt$b;@u!r=&GjKW`Fzz@=JxVrKT_^*r z&d;_iUNK1+e}}`nGL*s^BcK`YDv?~o4|2=}>?JkeTV-nt4f-LYdmy(86N0c}IO!Qw z5x+aEO2D*l)u`lm`(~@2)1%r1ww+d9o`Rp=ne8g*Bc&Mc2c&`or@FZmsF*#$R3>F# zPF}n*N1G)V_WGZ9;krL8)jomzQ;$^#N}w?Y0s!Fs4gdiA)fK;b?0@g86-rtb>%vH0 zwEMiFZpno+<}Qt6=6&A77yM*{E!Psi#>MNk^~Ca{g|*V*Of?a)GD5hBbk#`zQQ zT$&CFyeh0ct)l}Cuf=`Z%^?yJKW-9fhu<^A@?Cpv=`svHfj*sfVV77ItoW9wjPBN_ zQ(=LoLgT`T$eZ(6UPDO~-A$@zC*hmmOVoSq$;XY!tUF?S7Xh6$_&yK2jg(&W&E8M7 z!JoInVBNf8FKzW0+R4fHHR%-1OW|VYUU{lVN~@YZCU&tC#U?=F_uCzr2lv)Uw&$o$ z*IH|uj-iN&==E`6f!{KqS~6(g0<^+Vi>^Q2Js_W(ATV}~s4s=j$+HeJS?hNNPM=uVEk7%n}#fRqiVFN}?KiTiIp32rXuURRp!!=acljWUPCEc9JaQb~E z0+Zkjn^bjc!bwV?n(7T{G>BE%F9WIi_}J{`l+GWGGSvTZ_*QFv-l1;3kM5qWOJ zanR%6uh}`>lumqFpWH}az2ZJ!B>4@%t&rfKNtu4sZ)KT;IE3Ypz|UI~4ok<>>)@E+ zPSWyH5y2?z(%BrS3JFkE1IczHzn?lhygV-q5uUsh2~M{#gAO_1`N|OZO1oR}IVApS zZKfXh+^6Dfi`|1gv5RU{u1(I~)WObDA?U@WPzfGgZB)*E9=kn1;o|l5Xk=^eaHZJm z8b<4+3NY%DnjNO*xNOcSw9AXk#SN2d#HeASsB31LCHB*3Ktl`1>W9t`lDI$VYDo^Y z{w`diy(J7=Tl$#hKBnkYtgIqcZd8(_#yIcC&XnOkhtBc-lKt#KG)BlKBG23mE_a+J8yX!PLme(Si1_ z9n&9<^rwwQ?+GFWKZh?SN!P#?452f|PG_`xAA%mfab^u^5 z*BJT1No0XBU;WZ);;eG`sVJ}CQxrd`Q~aUOTy4)D@1kwPI;f?ttQIHpeQ_EK%`6LP zjH){ohUfX|d2Q!c$tj!8U^;zFcC( zoRubYgjSk>8u9^4)wPWqW0|uN25oxIg|T6J5%21t8jq<5T5|H8T!pgQPnz(3=k!CT zHL+CdU5sayGfNfj`v-S7IiE3xt|8Uzn>cyRhS4tGG45fTbYdepIVn7B%A(ms+(*1}&-YQytd?zk{ZMz0wLF6YtjH+V|VY zw83`<>^bO!9#2T5`rXm#aV}@e9qajIcvx0dtcpKe^-_zDof@u`y*~`EJ61G@9aF1z z*QDO{>^`m2HYzO64SkOFi(%GEu;}Gp<$Pdj%BLEoXDEjZjwR$_`CCus=XR|tr5GXlj#;A%p=vs z52v5HIdOQa;@}MVZqr0)Ejc9VatK3pI*xkLq(N~|Ae*$A{0)f=jw?vPTEUZi!S)#w zCNUL374s294e9jvz)AzCF$OQAH!^Xd)QZ z^L_hC6)Kqp0;rXRgCTKJYrrX@BQh7Ce;$h+O+&`k`AYTc_6BK2RXnbBVrFRu>40o) zA97s?goY+#&tw_!hGt6cF#kZ%5;dt+T$A>T6IYHL7Yo{oz-j6)?%=n^4$i#Rr> zNYv(MK;NvenlhT`QASn6q?3M}N6*0{xM3X8#^VH%PTcVJ_OAv%?fnc6S`L+Pp-ZIX zE%MkkstF*=_+ek{1`s)qIO*ca3;npWfrBN;eG)lR4ks|n%rSnZB$#jARCsgP!h=R< zwmM8n8ElXEEXDiV$|15Tpq~My(3=fiV3Bn^N?PR)_q~SLk zH6E*Rl?$L$Gz^uXftiJ^>JMeAlzbq_8CCn;8s7^0S-&6w-5tBH)9fQPKSV}j8e#l` z8t^V&p}($&j$)DtM&$_uDFO~D58)4Ou)8bfHGN+1bWG zGnpDT_>TX;PJ>6u5<-gLwvZI!KfV+1b`>& z5^SgVR@mM+qTypawsWyPWvPsS$%Me?)$aGBe^X;7!4`H6g#Ts&{O6~HT)ki)D~^AD z+6NXxN3b9HCt7-eB53gT!e7xkq3b1#jP0s1+luA;*AW;y;h(!g+kqDr#iehfCr95o zq2p(|oKhJ6YM!1%=iit5(`NR6wJGyoZIVWUJ->qec?{vFKzR6n-HT^$Xec9K-Kbay zJdd8B<8Ou>&boWA!qg*r#WZGV-<4ghMy2 z^E4HD$R(jDhWO&o#gd=ma`yP)O52L_GM}L@=}iF=t5ZizNXk5LF)*`0{g)3vEC6zF_dOV5MAC0@u@Ql`;Y>ZKPmy+x>#M zz_D4VU-7M(>=WSV2cf3 z^MW&PMPHCHVCtG0xqkvi*R zyEqdj9K9%}xU3~-ft&;!KyGC9VPZH@{N#su6#HXRb(?O1Y^J?;fjRlpfI~5vt4EK| zJ1+McYU0-YL5NBO44g*t9g2li*|9*Lcm2gv1%1ELNU=&+ewX#x?_WX2uwrCfUq%#w z`>}#=ji?Tw*oRkR)+1pY<2Zn9?qDSj+QK}B$7mTaT?m!u+>W|DYMZp;@4!~d+|Xn2 z2~=swKXY9o83Iden~(OpRQVS&Q;yM#j;w^S@>yBpX`MbE3O~fMn~TM{S+3A1tab49 z7M?^LhLsbH2pIe^*U(wWFL+YR@0)V=li8I)J1n_Wk??CqNG$H7g`Op|{OK=btZfyA zieq*jNG%@Hcc5fkBe!ViMS<(_ zxnZO-)IOsc89~L8eFkNqYcaifVr5VUUvU|s9gSnMFdSXZ&R!i1| zC2%D+u?9`q59SD<%PqVQdpVHV*`r%n<=-~MG(jHofZfpNdz_J zu9NbDtKF|3FZWCPr%SA_xZaj+!SCrf-{={J!1l_wd{%sJ*Y4MNtGYd+&OVMFQGL2z z9!}rKBHr7xt8}{Tp<}K_QlF3=PTMik^k1U}6nN_jeu;VZ`o_JDgMmCqd>dGw_$bP? zSbIgJ`(>srqshB$A~^~op;G0+OLv6n{n*X)0r^i#&)|l+!1+>o&6m|t7BcG)bwOk+)+ysQO}O;NLqVs-V*aIJBujx}rz zksph~jvufzSzHwF9+33MsUNL*FE8Dh(`uk{5CXZj$Kk|UDr@~&Vi>`b3?$3l37(7^ z{DV+$gfT%M7DT8MV_+aOq7W`mNt`Vz!mett|H=VJ(OU?bTrmF(z~i+qvR4-PK#XqA zNNkw=tD>O1iuGQyTyH%)Y*@=7kCWDF8JoHTksoVA#tRvupfJxx63j89c%~x&DZt@Oj>(go zLP4;*|*BWgO&<;RE5Pb_f0l?gq}=a4@SWjV}rSO-g7WHx9(-=j}xrXKc-L?taX zQnEEj(!;z>#?paEni;(euOF{vlk``<2c6^P5pE zUx%aznhrqPpzV`E>o*gJ=p zgPWZ_ZW^Z31o5?wQREb_jI?yISc9ymLm!+&^eNBk)lVz(Fm6|WR(Q8AAK#1h(#hjJ zbK~L($`xab2mES(FguL?3#KxoR=(Az#=1qkr?$(+!(8nV?R|!YB#!07GB{91iwX$A zZIa0;7ML66(@};XOVV)OJ=dx4?US4N=@(b(*X?sR63*E42XrQ<6KNw3*J{(X;n%tdY8lV$tIQIu_ zXQR#n+vha;B}J25KG|uX`S4E1qcIzn49*4RL{;JKXj;OfbX$g4{EB9((`dF&<1rNb zEuJJz12e9< ztu{t1l^|s)3z4z>*FinB)e}eZ$F*-@hsBL1-8FuJ^9weS{eGgi>pyYI$4k%}N!Bi|&ad2dc4m!A zw_=F#*dGeDjtH)TgU_*f{z+TSA@%4QAL8aA#>Hh(xJk$}`<$i(D3M}6 z`Qwt0vYxMfM!zcg-bf?${N%pSfMTdCYHuf$k&wc2W(DOJ#^PRuq8m+VCB14S{ApOo zqP|A4{KrHN@7a`bfE?-N6lx|>>#>XQ#!LyLOxtabZY>(j! zh7-bZfm@hyOeM21lcNN%YXo`pISY8C+Xn8qcI#7?RuY9JyZ+m-sAkd@67km2SasP_WdCf}oVL`Ff0O zXC*vDP}3nBMsu~A?S=A-mGv1f1bI9!uCa z4;tVU7kL&Y6JJ&Lv96!knV44v!+3%<3BnGPit@sbZ$Z#FY-I#2K`#jG5vdDv#1kb& zV#$z=f-t+PFLoNDO3^4799u*%Uxb`}_*9J#T7<`?lUOJ}%WsjfWMfu~R75RKZ@aO9 zPt0OzB}B0%OB%p$PL*^m_szU)APb&s=UKIgn^=Ehz2{|8x#-b6Jvh<|>e`KlkX!H4 zcBqY%Kbkbn>b$BQ)N3W)j7XfN#uMc3kbTNsNx2BRAwWH3jQX6t8OJyxDigt)jru|{1 zea06nTg)?mMc^+G3DbMJ-(KwPj$z)M4c$)^Qzi`1w4J34R3~UKUit4$Z$F$K?Y=** zHS2VCg*8(d*L_Y1u0r`lR584%jqPq64TPKp7sXtpp<=ovkFFg3#3l>V;_U+ z^%YqtziwFlDO~mQqId`Rh9VTMSYjPtTdQu381rdh%{UpVspErUmU5+BvuKs!dx$1- zukPw#nK$s|-Y*zChf7%r2_SY!B%hvZN9gFxcv6YZbYltU@233YlRR6jbI>qlCuw)o z2AGd8JYO(8Z9J$WHS)p&7ELeNX8lJPLR|2TgMGnJ`+xM9Z2uvd+~k7VIojpbq*0On zZ@?iCFiOZ)=T3DOs|G9S{THPnn{4=g{omkNX|Q5jey6Yg#!b0jEe$9Gl+!mc+3d)4 zV{F$>CG+oY&}Gb)zD+>h5hUt3CSe%Q^;LBd5M8E{ySvQ90B^>}k2WGp@zNSf_=F=I zl_kU2=E14a?`6z=B9~-NrI$0$4i`NgwR&R^cWv6mhhJJRt`hJ-7O@E;`fZ$~kZtTg zJY3v2+cPEmh@Jcs4lf46jl^@+#RaQaft#E!8mgHEZ9KwIQ^qsRG2#9QrTn}c$;r7T zesV`J)*#j_R|dI`L_T8OSeOo3K(J;I?9g_1ZuvY==x~moUtNPrtTVJwUcwN}jDp`v z{Msz~6GLAYqBmYije?lEVbHBJ2}MG0H4mw3Zi`>da(Ojeu_@;s3Zj%=ZBPWHq!h(N zI4AJPAk{fBlzGiF_M~$)2jAfGQrHJm$^rcZ+~LZ``aJDGaQGT{CR!`Y$p|CtXKPZm z?iKXpox+8$3`H@Tgu=I%>fZ!%(S?Mo4y3>wWVcV@U%VLNa8DQtu*>OX|(Lb7*;HjO6bB)Vj&J6}9+-Eb&6}6jR1fmUAj7J;zeX_9B z93gYGe>0R^?s6rE!g=g91m#`0p2iLtEf7FDrR~9uXtpOM^O?T46cRCTWRtu#wI<10 zr+C+F$oNJnP@WWiKIM*L!$U*k&BDZ;Fs=#HkL9QC)lRcQNG#Vnnr~p)%jeXA zqa42|s$KWal<`9w1b)|X*tuI^{a|V39FFM@ySf?TUi^U}xwL7%$G4mxO>#{Y+4q;% z`3u0%6-HwNQ!HQJlS8zMqwO))Mqd#%GcF5q@;SzQVCs%fo6R7Rt724`Sgw)fp7usy zd6aT*lkvl7Gf*Y^SU=l9;9l zH7qAPB?(@@6A4&75dXKCWZz#@@I^Y#rFK6n3<2!COGkLb<>=E|k;X(4@=}Fn&v@K~ z3fY^<*D73za@1CfzuqT1luTPk8Kq+UI4@T_N??TTMdH^WWb8`L;>GZJ88KC9*;&kH z4+a>7wM)H5{=pqdkX>y^{1#VP$Y*1wMGTN^jgBmB3Ews=#~S?_SDlFzq$37y5*5vW#a?3paGu``EC#$Mr^nlO! z=Lb-od~5w?l5HSd9JK_Ow$YqC5C!(afWtfT`rY^=v!4_qsd=K3|e*}z!0Wx~(x77x!O@NeIqvtZ7-ts<^n zR(s44vKz=Me{!x~4w=RCd3wr*|GW%?b?h=u`~_j0!5GUqJz6ni-H?**=Cy)C;$!b{ zl0s2qwP&4XYb+Rq&9MTY+GpD-FN9xOPOl0Df7&ZxQ5&Uz{@J#ben%4jku!H8Ws=Fn zedPpttvj7sbltF(Jt6%{I%h-1Ay&IT4|~L^+eI>arWNV4)P)~2m``SlzeY)o$&u5V)%rk>7Y*sLzQ z)%;HRjo^X(hylH6t~8wqm+A7Aj4{{%HtT2yLAvjuj{+K_TVAR|VkhYQJeatMsa|g1 z^6~zBXm7IU?|z1dV_v=i<*4da0@p!1;E zM{uwEAL)3;4sHkhC2qq1k&di?(~;X|jSg-D@{YG=e0w0;=%^2z5L{FNSS#EatPR+Y zPa|m?~_@PYFEBBd{s%~Klt8x0{(6x4rZC{yMdmM0G^Fpp=@ z&hLOQ3t~VP)KXEW!5Mqol3BqDZlmob!Q7zE|!B27O*l$E(U=8F0`RH8} zVSeOb(n(6>K@HOoM@<&$RDq=tKW&_vmdI+gDJ8^L+%d@ajqjWRdQU4Wz%&`;s3+@E+5?AiEB>Q@;xOsG=>^K`K#k_0T$t{aqs z4Of3)mdxo^FcaY{B%mn)%Er3Qt3SHo4euCVg(6VuG;#{*r{LuDx3qgJvLKp}jRZyG z3nD+O_T_m6qlf^ywZp;zK?VuW7@!>y$TIu_u9*5~2<@w{)~V#%d`to$td$a<|tm1b`J^YCm5{o_ze zxFvh$;JtP9aQ}WAEs=|?JLc%1W!#B!*%~1d zk1`X?F3m81jVSX*y>Gxhe!K0g<-({yqlPtAvcc%#v2`@4XFkdZ9Bh4H@?sBcBNru! z-H=!L4S5K0k=HRgYXh-Mhq7JQWxBNe<0&Mr%DRIR}KFEC?4j&#q;0Nm$4GFY-Z`bi%p6@kWqm{!X=c1Fg-FY z+c#^^rFI|Yfmo$Q@$AU?cYg&5D6!oLSv`Ht$E4GKDB+2ppP&Dkj~Oq~DhT~9hGYRh zW?QNV6(%?kqD+*70U;_v<{Kp`&3n9B5N&}37b76-Sw9;re*2CqC(J(sxA*ib9R6!Q zMoPzG*ehrTNTF|5X4Ou+mtaE4Npu+ey+LFRS;!-Z@QyTkHp9?=m@Vghwohiuu@iPOXAuTwsNZq`RP90&ygL~Si;ygI#LKV z1v9}*2EvqZVggltClqYHDxIkBJ)MxL_17?`yN_hN2532lXf`pbj) zLi~FL%>2CHtVI3wf$v_%)>fX;TVEbdUN$@u z1}5B=>K$~*n~h`qk7jHio`=pSo~K}|O>n!lwKATq#&%mQeLmBxyT^aCUQzVoqHB3~ zw{@h%X<IqER7f4n*-E6En{H~4|6a;GR|Hjen?+)Bw!Y5*OBwMsuq5mDyb2GWMgE* zU@Q2x1U^=%SHDUqlT>Q9khxU>Os)ssX>k&y%*ZjvJ6S;1@Nd~>AewwY>P4R*jfTdZ zr5vR+l%V?L1-_lh8U|Ak)bg97k-I)Wk_ebrPqCum2&Ublht~SxNg;q}6EuIDVCuC< zkwxhDJ0k~GX4#SBmNiTlZH`9KSWqt5BSZtaOs4VxM3K7jgoO-s{+>K)>R3CzASx5c zSh-~X{Qc!A&#u4WJV(RaVOs@!dCDCzBp8eY;Sp-9$J>S(Ixg$PyaLYMq)FuhL)D%@ zc|gza@+HixjVMlyC6npB1u@l=(C}*f-)8_`m1_|&9oxQ5hdYv!3ntku&7+M8hu#hI z8^lGygTLo)r9TwSebmfdOdMvi@tipY@7OM<4(wEHWlzbx1gyl+aD>2L(3m+cR?&Lhb{OwJHQco~;(ah0@v<%v?)G-FF&5fxC z8>hujKh*h3;7dwq)|uMWUXlx48W~jGLKDV_VD1Wm^HVFgLEYM;KbM>vRo-2Ou${@x# z3kN?@P->FbA*(V_RP0DpmhpIg`8qZ_WknvL9yd(Uw~3)4-k#LJ9|qz&N*oIBtGjfy z=70gmyrq>-&VfWrqDJ&2P`!8RHRpDUmGqLIl9a()beI*QZuT0C+n+nGmouwU3msne zX_PZBLgu}3vG`{wbmlh|pJ1HOhIQ3(~K^Ln#ucH>=beK_BqI?XYkZ@qzqrm_pC zV0rtvJe|DsRnx-Se0Y8?MU3^`xA&!I+iZ3@W=3BPXWr{j71@}WTCdPjUB0jrgG6sB zfJW{g36s@qL6V_ZZ?k4<4taAt0AlUjr`*qZP8Mj^IbN(jF!pusxO_&E;Qr(L=sd*f zDu3We^gqIpi&-H`j#WgF zkmnYZFC}L1C4%>3sdQ!P^MU-zyZFaDDT(7#H}tk%q;cjb6

$?eRO_(R>m!RR8HndVSAS#%BUa*HmlXAvAo%)^=P#}v`F&+wItj%qJQH1l z`{_7;gw4F(m0*!v%Kn7J76_%d2@5`Wf}*YhzHz?72StI1${V5^5y~<21@g27L^ri= zDC;SbG@uqBtC6h7jY3O@E=(l`)X+3DreL@@WI!(!${Jo2U6++c{VVH2rspSWJAu)K z$(JV~!7+M`i*O^(<81YhAREq~ZtK_+lW{ z^Qd}}N@MpLGxL7Ha03tjnUEy|gSa0Pe`Q=AA`p&nISLBSK{rr@papR3*seO!VTR&g zU&Vh~SXWF_6wZi=f~%xX2B{a{ji^Lyk`tq(jHb?q7vKG&?&N*Hiyz@(-OJ==1pbzQ zy=NgV;p>hC%tGlla2{6G%5Re^H2|P9!7&WIhVMum;Ee_Yq=7kUuVD}Km2qiuJ^#wM zNRn}6Dy}^F0b3&h@hm~K_TJ7acHV z09$7>dI4a>MChkQg4((6IY?|;-C1KW<4>M1X8152!}7R#`igYr0(l8wZb@;5{&f8f z+wk6QmM_P4oRC+5xf?yXSfH=klkf#bSosp@)hHCF&I;PqUc;CwS}1roahZHM$uNCn zmSaoE9ON)Ea-l4TKVTdTy_@E@h^vGre>X;(+Fh|^JH6j~&Pygbva>;o7VdOIm<;I~ z*mZQZ`KXMDMyP192)X5k)8L#e_X^FXJZlX&A^MH9QC(~hyIXR%O zY}oiJf0P2a=KqlP7}S$*VsMUMCquqD5#aF$jB52MPUR)Jkfl*UQ!Q1YjPmBLpkH9j zZxFU_9>^u{g!>DOG=+b_Nc@`uo}7ZJeypXC_Ifj`d|dkueh& zYXZWDUM_?6HyUoxylA4BoI)LAg>dPF1;!-X*e@_<{sH6CzrmP+n*0Sux;Cl5z({`>2>TZpg&(_G3c!G2 z-#Jw}NhPpSX;1>l)t(*ttiP7-9z4wg?^7ENo^!`Cyz^6QN| z(qi;Orv@3&7k3$NMT zoL%0x506JGS2`W+T^~5zRdd%kUt><#z}*GZ1^Fv#M7g)LnBU%G_<{P5=>CM&oxT9XfIqs@IZ0RHbq zJZF79S$i9EBLhboeKYHGFCSZtrNqrXLdiac%3n~Gcy&a)l;Kipb-?6xfF8)ycYO>6 z!wky$mK-yKIf9}&QV6ODKh11@_M)`wabCitJ8@Z_n$=pR>DQekZ5X?x;$GBcHt4-h z={Ji7o3(>Glf>&6Ws);Wxh!YSpFeJRT=ot01jA&BbhH+`eArC5;dcj8&>iJSDi1rWCHfk>8Gt0xhFOYw(kbdC`iN)6=Z-56 zc=9f)5qBxH8r*iapX%azz(G_7-zd%-{Df;3q~KdY3_f?%9n>t|Y`rM1$P4hSP=Su{3(>5D zD0=~ZfrMysTyWfts7h=V0dlNxY?g@oH!~zNC^M|mP(}V1yu!=7KX(S^_Ej z&cHi{*=hnWh?6kJ@5$#4UX15U2kBGHwU2?d zh5RKu!aIux^wZjzH`o{UcbAT6$QI#v97m`Y~>SU++QK+o*&%X zV6;!x)mm_RH^*LI8K6&kpBr4yeH9q*-FXd}4qoB!0?A9gXj*G95N_8pH1F>=o)=-Q zms)L;(q{KjcX`~k2sL^0;%0dKYstcvvlM;4U-JgB-H-{3Nr^S(BJx{lF>7++_O?8m z@kR>~K+YHQK&h~$H8u;BOEno-_q@O=V(Y06m2^->&&I z9lsSHeJuEVJh)`Ps=qXMKgT$4Hk!?y4dn~OU!INVNRh;!1dPo4iQqc#j$CNfB1&hk zVXh=f;)LUT+-YUI>o>TX9Y2}wbE1k1Bok(HBI9CYjz2*My`A@36~c182E1>A z?oRoTeJsw=ehzlCzphmKJjc*{ywHByVWnB)eE`>kL~OdgsZHg7JkGEp_`qDv!?@Nz z^^x68?!|yV_^4f*EPd8qlU6R8s4};(7aA0s*wUFc!gmp?NV5-Xg01QyJ+Q@Orjg>hX`;JzgMxmUjRG}_d!I9#*e4ST20j0F2 zSi*6hCd=&Zv#)_r7OYRA2t6QGGV1ZQ-@1593M`W!4=nphm}_3}+SV=+QdXOl9#|$j zC+S&1;Ftw{2$9Tag7e~893QW1++U)Gs(wC$*gIsz5RLylj`EC=JjJH3DpBv0g`Blv z{(xhr9XHiP+aO#P)gOISgU|^;I zq5Jd)E31pHxbTx(NDf+)ML3^F~*#K!^QonC(ndKIv|P z`{Km4*N9ulsHKFgzTo19rsbaKmSR$zo*_fXVi7TZ`Zkv8yw4bz7G{ z(yB5dnWNa1Lg;jvlGL-lt*?i2RCF#9_WtOU3#&hl8Tn0UQ<29#l_;q4H@`;Ie6aueNyv!=eDkQiI^TCg&L=BV?^JF4LWiAV?J9l;Y2F4r#R({T+13 zDf5bRy5?vYrHF1}F6@XwyR_!x2o&u)*He^Ey`3VZOYs`b+L5y9g#y31PPkX1K<~H< z0@V#OxN+4o4$7Ol3;FYwUsHPtDC2C5)iqC`&8a|MhDZf1c@|lt99)bjQ)PprP3Exz znt8Z`rX9X-eF?OVi>!nxcbZ_l2jk%HV75v%;eGyyIjkTK6>`lJvNTq+KCB<#%ISsZ zj3xnaeG0!fg|pX(SDkT+yg^)(6jQt*ndyTqfiv&yoHxPm^KDMF#3UQWdI()~YYx@i zp31G4^gd$+Lx!JwFq$)0d-lewH^Y!?bvbe=Ez4k*`e{0)`&? z#=1g4so2I9&YaTaj8bg1cu$G=oU1pY@{8R_XAHIaIA&pUhVsl$31e1M$*aVIi|W21ID^9D_P^TRc>aL^>EeN+_hX6M5G2^(V#0 zUWxdFH?)=S;Xt%HWCye{n&_>bO|EXH34*r9>)-Z!=BIi2pFqQ@`L;PPCVg=getfFx z6wh6%^r$qs+EmV&HG_Ygu1$w&3tVkOA4F||)kA@xiL~8!VVWqha;thKJMi?njkvlkDAZEtg8Aw{&Ip_NXkL_!PT3%mM!h_R&veMgy0EL(0~j8VL~7R1y`>=y z;)LhDm6IIs&rg@c-XK&nbA23U!FBU*8qI{}f{kTnZyMy6Mbn8uN$M+Z6#;#-|L)~D zBf^dg{aUh}FNd4xsrWFH5W{moSlMZ&h2d zl52Pa0~mv|bZvX}IjHSZJmpx5RmJf1zHxWt!)9-wGvqY7fB%`(es`L+8DMPybU-Wq zY{^K@n>WV0KeqI8lIwTlc7DQr&hVqbldHoUDs(*Cd?d#FxfJI8Bu4mSIBJMvbgEH{ zch;_R*7;re1=oq4xFzuedM3MTU?2fv0cY(<`DW$=Gd5e9JKQCs;z5Kw_X2h^$!pQZ zXM@M|6FQ-r?4aAYxtpR}shj57ZBNJhl@N5j?!Bk)jro58bU=&0yZx2?koE^}So@pu zxr^Gm-fDkyz0!95R{Ep;5$JB&{-Xc4z^T_JdZ@PBKiodY-2&t{WIkddwR9i9+%$NY zAAFA96^4BH*X|o9egDpZhX-ZQ$9Zf&rtiA$={@6ma7^wk86Hz7^O@(Gl+%L|QOfBG zma`<~)Nu}$v-`$bU!N7>TW#Zus=K(mZ)APGgzhi_y*1yS-t+DC(E@Kwp$5m)=w`+>a zgkZaZ`GcUbT~{|yPDRS8w#rc>vt3SA%BkV(+egZ=+jU9!>TP_T?Ya`GcdK1%m?hoH zKHO=deK^gd)^ex|~y}eB3Q*b-FBl`YWR@7wOc0O0LsB5$6rPqSr3MP^ON1<2i7-PJdR+h5>~e>Z$DM8M^C`CkI@`IO{uw2QcCzW)v0ut~Qo9d3 zu1MzCjx8`9XI^zZwL9nJcr7?itze73`PK_g6J_3^u6E&h-g})lo!25Dh^Mk6o&Uvl5UgdRJKaSk^d+PdLTyGn{RXlCkDL4H^#Ww(b?4@mP`b+K- zHVCW!R{iOKh)nUyBz1I z@bfx+G7dh@_C5Ulvj{u}PC9bq&s%;jPr|K$*NjUeH+1{P=}&Ti?Fav!B@Y+0*;FTZcaAYN2|sCTW`&oEh*eDZRVV;}g!G+(hph_%^P0pTvpo zt}J#^F%E_55y!*14cL#nvwG*^b`>Z7d*rn?`_Vozu}>1bK|Q!55@x?Wy**vrfyLA; zwERpzef$My7BY3bh~ci|5j@h`UcQP`QvQ5M`Rlb`ZaUt@_Uvr8UPTYKTW-3qs|lS( zJK9;tlR^jmOKt-78}8_jHMa>pa{>CE-pyUyJw~_+wa3hU?HAmU*6nczzHf2Ab2eZP zyFC`cyV3T@P3wAh*5m8Sk6DlQe(5PYT?+K$J-trXBI<#uS!g{953n!4;1s~4+jSE* zjkh^tRy|@5>N*;~;_mrI{oB-IZ%4oTk?UcX98;c9z32<->3HxkUNLIjg}=Y%Vq8@5 zLfe5?OuQsEZix^x(L-r`PRTKz%Wd2(52yFP;QI|ILC& zxAR?UZu;+BjQ8ur-x7F3+gZlNSzK?;2a>9O!T7?p17a(SP{*CUvu>(S-TDaCb73d$ z%)%d6A)BqTwze6*d%N>}cl~i90eKts$34B@aU0;r5Vo#gY=&P`FqrN!q(L@3OzmW==c-I_rc!p z{4CI(cKk_$_h#`YhwElM#r~kuD`AZ%v_`9*N7Qx3r}p|BRrFxLxU;w6E^JXZDMRbi z+>P&`!9Q1^gKqb`@ucg+&OKezQSG0)pV;F|9P(QFrd7GDuW6TL+x0KGlx_QGw(Yu} zSF*lg<7006xRO8BQQwpPxYcflQ;Oa>uKd_dy-$6|C)5s!J@{@J?63;mbU*FI{NRJm z@h&sYcG@8Uc`ZA9$z@(O&PqR}JzH@x)3pqK3`IAMyHnt~UA4q}@ePFS&ebln9yz1x zMVYsU_`f%u^{>xEhB?f)7`*B8{`Gp>b+f;5v1=-!ZsOilzXW)+etk;6X-zg!`VpBu z3Y&UwYy~C79B=xHpD(?keEr~JzJi}`YD4*QDqn8;c|Tvf-;etA_I1X1DBYVb`SjHd zmEVx^Ct7|eeonjW>8-m{Xdet8H*KFm@aX=v1rH3IasKND{bx__xvs{&x88qSfPC$r zYiocw(0_4^+<3X8|15){6_-ERvXkAvWN*#1eQx?wEkCj9?@fQkrzfGOIkuy=Tp!u~ zRj{tF?_XJPwfk3fL-}STU(3IiH3TD0UuPJ^ zr7euVZa=2W`EsSA)+N-mD*I|+O$X~n9cNX2OpC6qaox*3%NAvAjcXRp7YvPiXq*q( zJOn#FJ|%g~XRaFz=A4??_@Z4t_u;vQ zA&q;<=2{wy8t#SIyj)xJvwNdo*@>}7J&h<_VRlNOot56$BTV1lk{5$5Y}p&dCCI2^ ze%%yVbxWo#gD(x(h)nJ~4noE(7ah@8RlPVr;yxx!ppH6tC`&$~U+H~C&Ko(GtH^}} z%48i|e0qP8>mr*kH?8+W%{~G1v;D*9^yhH8*6IIcKMb=ATvWByCU@5TbLVsJ>+Toa zH!x~(=t)Q4TAM-pnEe({cuB8mu?7U?{=A8O?AZ0P@G z9eNXV_6N$*>og@s{o}f|^=WObwdS>{ojA2i=bQO}K9}Tt^ISK-I%vt*gw`iF_i7Vr zPgmEo3LdtNP3L3RyzgfE6Zt5oi8Jq)8M9!jGJm6nr{mqn5zp&#(iF;YrI)Hn2 z#$HtmlQx6T-17_ClP|a;t@@BYFUUE__jW$dSTZ)bJG*{>`k4OLW!Z!CA5%{guj+F3Oh2 zGtZ(oZQ@}<*1$FL@!)++BbUg0-sJvAMdv+GUJpJS&ifU%KD^h#&o$ip2-9;td#$d+ zzfn7}yav)DQZDLt^xr|$v5srx!&~4~zqIRX=81az)$>x0pLRd7<8v^M+4iGcV=v-) z+(%xo9)*1vqi|odA7_V!u3f{*XAzTPxprk@?I4A9%!o&$bK>hI_(#nZz`Gi7hFHE ze#W;bkGDE>0)W9!TcMO^2_G zjh<0UegXZ8^fb!lyvEc&D|G7nqrkj&6>Y&aAMIBayJ9-w$D4*VZ-RM!Uy5Tc#QWO~ zB-)*_d2gKOu!D69(kntMgj`!s&U&)5kU_iWqMJMX&dy_Nq5WznW<;nv^4}))o&(NW zb_H44V+r(hpgmRlgPyeLZ@At5e8scqX1>w@e>{XvJ!z!Y_|aZlK4)T6_>7AAJa=Gy z+b7_2HToSA`I|T4-H6>;Rvl>`$%}s8kMB+Rl8W#5z&CJ>d_02oPl_I`^@ffW-Qc7> zGq@f$A7#F<`6%Vv^HJufoE*;feAL8^DbVeHZ0NI~+x^(IJLTK`*q(RV{m-Ve()N0z zb_j719gF8hob7TbpLBkkp8nDicc2L8!(sHqI&|tA#!tU9^d*T4ameSq+R%+XNRL@` zV-M0z@XZFs z*EsYgKlylg_)NL4S@kA872wMV-%Nln=kw`yE(zcCTWdvo-=opS2mi-s9&EFc>_77U zMA@nruNyxaUWY!g4*g_+9!u$Z|AEvyfzPaW+OiKXC55jpd}-l35~%lJfUh8YsQ_Ok zz{mQs+(VXqSk!C?AKU52q6hO0qD>#bGdb+mToamu_lJV_9(WIf_rQX56VDcQwDR}h zNdVGGSuftDowR4(mKfPAZ!0^b-bQoSiNuAVUr%!YFD#3Mz0vH9^+vM~;T2Ywok)Mk zi_bdQF5*p@8)i-7>9CE8J=m!`lnPcSg!JJ~uA~z%%p)O$py&|e9cpFM_Pip5Sd>o+ zrx8W@PJvAr!Ui>t^}&}5K0WSKEc&d_UCcjg#Q1u~PMjExAt!bU?-ZN)gqF!~DJ+8? zeTDCW>2eyvZ#;u}RkRWM5nNai+zp(>3Yk2(f$pRPp9CHhJPlkG%xK%+r}-%}4Sf8s z@_Q*gPDat?{T&w0S-4=~l7;!SoOzcAUcuty84J%^c+SFA3)d_>Z{YV2wBH#sY$3s$da2kyo_vp8nGhMur+zhLsD1jq3$9zLDd_Pz|r ziNj~I!qWpDKA}e+=s~NNeEQu^Me=f@G%Gv_ydkREDKkd;f|a)}JO`1t;pgph5?fSR zJ$x4ichy)feKIBV9eA--+NZltPUC0~_5=$;??&D!;it|OOU|s&H-kQB$*GB)9oRFR z_vOT#y6|tsvpvfi$G4#_eA*4VDa_q0V0^_JdTJc^9M4HxIOp@YPDNwX%XMam1Me$Q z_7t83-mPB^^1vohl(i5-XPYic-Z;Mfuby@TKj{sNz7mp`aYIdSP?uiVlTW*`j(lH9 zQsX}5KSF1H)5Oq!7fu=Bq0Z_lHsn=x6ducm<1A}d=y6=A`SN29pJGF~aD^StqR>^$ z5xfKQ%|@rpKI*J~o&b5Na{_ndAZHtO_B6(8z;1K+3>xXwGwIXuRs>?ZEg%w?v!HqU_-(#QClA^V@0}4jwC$YmQ|5dKKkdvX%22LqcRn#jf1nK; z!q2vA3eQfgVOE23#8w`k!h#&yszeMrZB^0qL@)H2*LWLkwIp=a?vj_7Pr(IjrRvob ze%flq;*W8VX}4`3ZH102b-}j^HSVF^k{YYN$tS!5c~!s5gwSc*tjM8l2RnIs7(+@@ z?iP&2v%;^&T%jlM7PWbw?mA1BKJ}1t*+$DD^j^qc4bou;4^@hDxrR8;n3>c#ruklI(X%PoM5OaXeuZ=7$N=!M_*3N8)MRM>$!c?||12`gGTs3XwzqtY{t;Kj$=t zf8Oa-JNbLqcJsnd-&^S9iPQJ^R22IleQ(8=f14AdQ-Dt2!@$+*7aC(+L%bqx??*lK zy;P769=7$M&I{4^Iwg@q8_o*mH;8Le7WH2c9cceWUx(YAC11B4PTkV2*{KhF^%%VbzhXc#7mMFoW3tne?HYlIgCHc z7XL~JKihXz^Qbn3gLl}LGCk6vGuxC;BL(cQ+LTW(nKsP{KmBb==xo!9Pj{U;ja8fS zsl2c@t!W+=1D85^VvH?y%@aL}-_L0ZPd~)<<0%{H6Wf8?$XSh})Q3+Cv8*&sQ-V2X z;8Q&0=X|Cim~%fqtz+mbz8u$C1vcvrHR%Y%nZwA&CwN#ErwD1mqz?)PRBfl<#pXJ* ziZ1VBvv4)Q&zQLhaid1MymM_qu!ni+lE$$#)=EvGtNF$UbzSK5N#gc?q{kY~)5G_; zWdu{^pvL&}>Sl*e>d+s!=9=+&9#Bv6kWQX?pZ_k0PsV_*+PdCZF6MY~hfmdzrx(`Z zlQ6`b-|}e~%G`mygno_H{5B)>ZJ_gsAtS$}v6`z-X^eKqTo>51*9_@a-F^EDKW#e~ z;4yZt2@h?uAZ5|c%YIq6If(~bcIHzmVRq&dD%6>FP6?*WjK<1_1;MoQl+W{kQ?YpX zw2HR*UCzAls94ciZchTgZL=i0skxKJ%07H5#n@*hkk{B}Rrsm1+Mb2)asC`bA^Pg3YymknAxIpH~o-`pw*y%*~*KIOr@YD^dUINEy2r(@3ikghvz zo(9%7>~=Dwhxk}l(Pgi|!Z`~UEL^hil!Yq+`Nlu_WJYk#a}=aG(Q_;3Jc4P%)et#b zQTG_1MnK)k-%lKf6&x2b!o$6ttnheX&1pJ(d$Us!OgXcia`c=*cy?k=qMm|KV@*Om z6=CAZs_<+=tl+mfN#}Tk36A(bVw%Pn%i>Pj;>lV(1&e3O;+e5{sus_@#lt5Wj6Ta2 zPt)Sz(-Ve=-&$uMr#>DrZ1@;X_~8McrzDv6sR%xZ{lluo!>0sHeB)h3wo8n2C!wo3 zwqV*k&IOH%w|JS6#>$8JWCQ6O_mhIjpYeHI^#lTai9VkL-NXbw9TDcwB}JEa(OQ^K zBbdFTnLu9StFs|=`d(G^p-mP$c`&RVb{aw-Kru1g;b*-zV=pe})E!+lX1&K*(saz{dz^;w z(1yIbOgUMcR)nV)Gt)E+lreG8$K4L^(rTUYmKKfmyam|A7T&Q9Ym17|X_^_yo5l)e zL1ZdF5jy*9{6myOU&5UgV%6W@=k#lg^;g2l2=*`*7c|D$)Z@(fc(XGnJSuJrop|1- zV=X4~RV>w5)oV%U+}Ex9bk|87YOf>fdz^ZbE_0rOV2+zp8ml?aoX}a;ve4Cd;nQ7b z1=#rZYM?AV-u398d_=jNLd71@<;HPJ3I>Oh))?znJSAb#2Zc`lg5YhyQyL@g>ASAF zt>JHy*9E->taZb_H|ZVYNRP81^uxHkDEJ)ks=~TI@-Ct2gINpn&WxewEL^a#x|7%* z^P}5nXYwdNxzFL2) z6gtP#RpGZ~vcIc$_lAr|yvwCyBle1k!PAEm?{=}TZNiwvJ6xLQZgm&S@XT2}^A^vd z$nlVE$>+hkKx4d=DdwySojS)JZOM-lLkG5dLerHFDT^m#@nkKYlEqW8cxEh~n#Hpq zJX``TT0BjQXH|H%(1sj{#3l)iu{XZk=_iKHY__!U9K`RMP6?0NqZ1yAk$V9#jwuV8 z2Wyi}PQ8;S%J|a&-S2k+9(_LrJ>VC#4h5Xz#M0lV1T!wp02?_q;Wzs1RPVONUXai^ z#aWQN$MJI%O^st}9dty?XRJsA8<`o>L;77-=xJOY6ubj?F2Ha4*Mg$!{dthn#Rf|N#eHHCpS$DzLfiuUnOxkTxa2$9^Fm1IgnDKB$Fzp%RpbC8wIQ0vroV4H^e)AP?G+eQkzx z)uug8HH3%vaOZ`75Uh)Wd0N%-)f_4PxRQgd{6kKLI4}mW&lZG-bEJyKs@-RU{K!k6 zpA-6dmL>dKamPD*s-<%Y*z}_c=^gzD_wR(C{yD2LVshN63SI4oTXGfyawwDYz$Ky6 zXX=7!f~H{lM)C=*!vi>_1e2Zd<@-7PI(!FWPiD$HYHEs%4WeMgf zCpZgS6AUQ6p`RI84WSR%b`tbLZ|-of?3~X!R$K?!PI$Gum_wt zqsw9)Q-Uco2W;k<1=8W4QR*N(z7A>qdlFNmNBH{+Xnx{F{kti%ieL5&EnE%CQTsEf zim~k{6FS?sAegqD6-;~1 z3EoMa1@8cE2;NJfXSICVHVJHOn<8Con-(5l2eEC2blA2Jr!2A9wxIZBys+?8P>$HP zB4yFGvmrdRZOxLu5W+*-E(Ymh+a-}d44yi$v2E%}U3b4;V%xOPlemx(OxsQgrk)kS zwC$W=k2(n62iy=$+s4neY?}Z!w)KeZcqn6TzoKg!CM}$@aN5Ed3ui4nXyIJ2EVT~_ z{}FxY8x_HH$7%?F9P|~W1kIm)I6B)AqEOR?Yv;omo-*)Yjny{FRpD05A|P_yh&j7@@=)R zh5pOI5OdcwPAQGm_&Y@m-Kc*>cz9|E4|Pjj=+GbYe9Rw0=xn1yu?ZLP7=zo0S3 zZrHgqucA){>C#UtlDCY!Gr*>ws^67q>mz#1jSXm>_u>>6Ox@Cgw*hAa)5i*e+3vG~ zlfVmtY1<~SiGeGmOAK5U9#H(}xDN5d$FvSMUD-28mpZ0Nhs@`x8?dS4LI=NIOD+nX zF=tgU{WJb_pj;D^Nq1W7o#T-nzTMBsD!Ps*ISUsoT(a<#g)0G>jQOU35)JoxZmPQDtfDp zjLcM!4m(q3nsgawGa)=2e{&)9UeKp>UaY53cfq@WYl2l=)fo4=5EBG%Vcms?_KAO7 z>p+|!wrz_UF!l6=hx+sb8{4LX{4!6-klryT?{TuEqmNLBK?|2GJY(Uig%>Pb7tA^~ zsgHWz74=%DT;~%kHy%BMQw-RjgOP5>AJIP-pmR?r5?KbdL1Q@&sx$6kJbnDw!)Go$ zb_6p^4Y4WlC`>&3a3)e2~yIdUG&z$9A zadc84%Ao00esg}G<0;uEisRSw6XpDbhhM*9kpVtDkMQ`!L~&yBF`fVYj&}e*KYsuP ztNf**iOIZ|Crg|BdmJx~- z?Nu!gQ(P_%=l5ML7O#%xRqL1bo6`5U^fdYJcf1qD(o0abP*$FFFnQoZd%g276}@MR zFBD%I8XHpWi1s@M_fmY5-b8*fKXE-jyw9(KhjiV@+V4I1T=wxG)dp%_oG(FG7Yh|mRXB}^>ILsebQ@_Nv*BhG1d!_sY+O!O_ zlqQPTM`)jNVW^CMc}N_ErAEfDdY6mi!y{B-Qe_&;m*KNU&&M5)$3p>aC%xhoqbBX> zja{28qq^lGs88`jmx^pPV=`afNiEOw#*1aR=Uy<6OrjZ)8xn0*V2*Y@VJ-9w{9@dM zHm9<8WnhvSxX*-4C_> zhEXMWzIO$@x{)V~SIRHaEya7iN%<*2$QhwiPtaG#wbxEg!Xd48HvX7(yn)Q=3*LpN zP7OSB?EK>%aQ6IDPoF;d_(|{hv$*)UcjBq+v*%Agks0tZPn|va`1uRov2!OuJvVUv z^zn}kJO#qeV;7KfCokxDc@F*d-2bBPOQ55?t~6gQl1f4XiOn*Lc@mOK*g_HlvnVVo zNd=TGBv~Z^24blsl~93HRjw)lVlgF~CbZ)Y*l`ngI+MstJnjrhV~+=uoSs2&Zi6XJ2qeBXQjUsWmz8)xb1(K+zy|Npn&`|i81|HTy>sCPum@;YwJC2O>A{Nnsvz*S8JQ6zP-`aDqGrHTbjLY ziGiX*;uGjbgU4In=<;lGH&mcQ=!A4{b~m+2??zW+qg-h}=36J`rwt8Z_0Z(`puG2Zq%Z=0vBz0EB*G&eUW7Sn?3bzFONd>_(A6y zn+c%xvfb-0N6T$4)gjb|Y4m=EovUm2denq^n%dm0t?eysp5~@Sz=kcDDfHciq754M zX1$mPa12BNU{G`G9c+M;rhrr~w`_FdJ&>YFFtA z>g7gUYwC{}gyOeCis{zh2&S`*`c}|;>LGIytbAxN5 z6oWO#anoCs-|bMG@I6>;@Y&H=2#l#*a*K=xb_NyC7>t3_fFuMSGa3SSG9-h816^3L zvfmfksn`o2c^WW}+`(g!!5|n-e-Eoy_3y>LOir#F+4`~A$uR_?(LuDcw-1|ooo54x zu~V~{ilrz6^If5&Cr=L;kch00fFX{_dS9d`x(Ezxlzhw(xCQXj;6nnzJ-+@xkHJ}@ z^SZ-E`{3`ret(U*_@aa1a3~T>TYtN|Dyx^TTDqc2bzAk@?0*mBi6PnJ@AVD#$I6p3 zq-vdPxfhHPm}N?PiKz)eBq3XcF{3{aQ6j!>uyX7;CW_1y*i4e?MH&f^CIdQaWLsp=->Jt#JgEi532#5) z;n%WeGzNAPvkLzFuE797AL`oW?~cjc{vq@=#M!-T5DZ<9EGs4?oS1%&S@Gr})dyyS zkQUl22ZKglmR1e3UEb4`(rz>aPz^?9S>+<20hxWXafKOZ&>!vgh5bE~Hl)81`~yUT z9hGFL4OzG?#ED6?8#dMhZ#e&~eAiAdn=yQ?QtJUr;u`;G0nKvLpwq@g2fF1ZKV+;P zj_~)X&(upm-Zchb!bG7HaX`bOtRc`%U~^}vhinG;;3*;RYCKi@WGy5#^h~x;g}}*R z|K>s7hfcvaAP;CvJtQedcjyNb-x0GB`5>kZMuPG{vugQ}OlexJ!||=_@k9QtjrB#a zUwynDgX29}$f(PJ2k?S%kWVS?%uy@xqk?kp0A<5HUGo7^rNxD` zo=e9L&gAEQnaEj!$h%gIY&v#)>9pNcu<=#PoD*}@^}y_qmqC8PMJ2@QGNbNA?0_zlGNT+%K??pG z9Z1aUuhqVMve38-P~k7{w<8`i#tl=(!ePp|I81pT98<=`OkMGM=BcJH@x~+syZL zTE1se@}0qNDMqX%;=I)Y*LbIR9&7EZYQ2?;AL8BH#wzyes`}>`UAVc`- zRruc$--+M2Ij#W=g2LoveFzN!JJk!Q)hYf4>(c@o5{X|0YONImI;>OI_v3N(-HiQR z@4#gMtzt?{bnpkMfdXR?1!u$Mqll*JR~$5BzZE(;jHpDsf_Ck=wUJM3hj*a!K25V9 z%=1&^8Q&X3=-|3VKHaZZ6a8X6UqL&Z4{$_&b3RzFRP|rmR1PoX&;i73B;b6{621cO&qzS`|Vh<#RmH(vR^dkCT)-&1nm#mzhD%8W2d^O>p34IDFkH(M36|A?T-X~Do zlc2m~R=fBCczSZ?oJWr1K1JQWq41B-52)u;#l{e^ZP7jitB{)5Jo@7Ahq6reutqS?*aQZFyJHI3`hKX0wFLn z{ehrDXesn~u$PV-j~c%k&(n$iJd@HN)(@ZJYN#I6)Fk2jIQsV*{-w^2p3hey0kJ&^ znCg876f7+t$9YsWgaUL`3V_lQ=zfXNXih53CHGCDjm&Pp<14^)N zY?!z2qP{U$l0iQVo>UJgn!>n1kQfAE?!}aWt8@>9V?&iqPk;TPa^MrP?-zDM=;IFwp zHN9f5^}JGUC%pC{O~QdNcnQ=_K6dZk65Pa;wjTYWw1*vypE^nP~sn${g@1?3f!p0QV{c<&UWiGBDI z@^L@n8wGzw&ql$!aGVqOt5Nm+>if`$`fkFNbdBppb2_9nXVsHU6xT>ac~a>e;n=Cx zqvp?aUMupBr;P09N~0f>(M5hQ#CH=O*GeCMpY_E%zCUh#9m99_ixDGI*Vmy*=r8#g z;AK*-xhh^Jvt&^7V( zhsGwMZ_#@U^%#uy!}@9j6gP^!qb^68yzmEPKcA+te5xCY;iP|07u1-M2F(+;4Tb$I zj~xPUsc(gDxN9)bA6v}B^U&fHxt(&tg}Iy;Ew^!><_&bzkDNtH{RpEWjbTky{f>G+ zoIkbTz#2TMTo2v0QoH`H^__H_fRt{?^DygF@;uUCikGl5E1)~lghYxDu#QvpQ2Kei z9!hJWGO-Vw5(UmPP!v#+le7#nYvC97J{+mXsHb)waDuz~veJ>AwAR%=j9-fXpTl`P zYRHXF{1T#r{EvEnt^GNq_O$eR_H+MFsb}Ii%2AH=aeVvf^Pu*>>)B7;A6U@Y$lshz zo3|2SRqsDay#L6Mk$7*t{(S%~+6;-A`a846OqApq}tzs>y*Df`RFXv9NCOFQY{&2k#vGXd|1J~h0zLw^30@ZLT-ydTB}JQ=*>>ixCC z`?FVt_sW!dejj)|hK~pEo+nz{o$1ujkpIyx_Yp?wBwqC)J?Y?Wmxi8}=StMm8Yu|4 z*3%kkm67sJqI5judB+OsEpgl`X>>`#tPanp&FBw>cB^d{=3m{^i^%T&P&APR?N2_h zPLZ#$bmF?!cp@MtX-&un*0~}JedtoyaP|78C+eGSd)vVO9Vz%c26)fGd4)c)GnB05 za>ouewK$!-3OyfB51eAMcFgs|_PCBJCtXjJ!>8NQ^&{!+vV7OLb;xqFuc=(`gmQ(~ zR4zE7+?;DF7nxA*KJ<0G{%^AJ#U_;d!Zno}90$*Qu@rn)FrZ8~6X({(nXJ?&^E(Es zs(h=UTua!!CiUu*@89F;nN!S6;1%UmtGKaG;vKcoJiogElwJRtr+$qeJ5e^B?s1)- zFW~!p8_y!r^&h!cSr_C>PM{p=FYkxb!-Z zH0X?Buk6Mag@aTe%mj-doP!JoVG#qfASm5&781p2tD%Lb(3mj9kvAtAUL#?>$947{ z#gA8rBkK2D?(piA<~!J#PBBInWRzkX&l9BLbCTzE(#8`U{l|KoVycaJc3z#I=L^^^ zLT0SMF|_0`l!XbAI^y3+BZ_`n)KC!822DE$Y5v0Q>Qf!VBqiwgL%FB=mZV8+Nw-UW zb1T{-{ouJhpLrfjdQgj$^k5~@lMdc$t@W-LiL%R}ZH+e9=a!CThPHc@36JIgqKdv< zP2MY3oZZ#FIt`g7ozJ8#82_Z;JRY=~d>82w@5KB=@CV#uC8QH-cBk9;RHL5sxvIe4 zr|AUylD>Z_{Wq4vKFk|XQR{zkp3eEagp}XkQuZPr&j;c(BPr(=I~9NDyb6E!FzO>8 zwi$S>DoRd!}ztv1Gzr6}en)G=j z9**KY@$W3slaA2@{sAsZ8zU>FaoooBpE!y$@PqW6dq?W|eu>&snSpZ08;Z`SpA(qn zsE?;Sl_6APif79bMuQ1X!>ot8_U`<&B% z!kT!{m}kDzdu38i8_x&pGB<$(a*8rz{ZcP>2mA(TH|dIYZ!x+F+esPp?}S4~%3cnG zNj(T8fd2^e zgr-Z4`3;s^Jw38&-}?3I$!*Z@#4s+yJ^@2Y)6U#MEu!ggH@R)5wvDER=8EbiOL?pS zyf3qnZ^|}y0zQ8e&$M{pY;hf&#d$mD3w+OddYaIuq})IS?uE*uCDfm~bt+e-qy?fZ zGmRCoD`;a!U%z5?*&gMgQ_z}{-{k&@Se?aOQA?Nc{~g8bCwbc)#YwoHg70@q{vFJ@ zs#@jWk;uOzH9w^uT|dt4Dw%WH3YEW7mLH6L3Og~XiWwIX5$CEg}KZW@)>x1n} zVmYwJm8x1|yV38i)PCe9%E2xyv36KwiSB=IqFirkxt!E;G?P#ZO_i%s4Jw08HBZ6R za(RhzuwP7Dm8$eoRXU=&tLHhAT0T2b9%rdo#A>Eh5z+_MUMw}gwz_V_3>_BVBo$H? zH-szbPg5wk*ca^%1X7U&Lr*M{kX*J{+3|ui-e=Z7NWBd_JFAE-dX-mTH5Z@_Q@c_Q zZ3lU0Q~o6#OrHNwlta?br_<$}pIY^NDEbfGIPKOfpr-jV^n21pAMmur@84Z44S&BN zd?`~5=u(W8O?NE#P(~EhAXBMKFg>u~*eA>ChR9|Gg3%ZayFpFrhCr(qVSP@%A4*YW z%mnQyozT)I`-{-k;-vko>M8qKf;cy3yULVr9|?)tmT4S~^-M!QU4A0}lBBrQb4;!; z(Hu+0I6cUC`Gx!k&;LV6dH#RWv2rF`WdBx~d;=H)lDAZ&LfWwaIifJ&hUq$}b8)I& zTCpk*f8jC+40=8lXQ+8`5*W45pe3ff4M+Fi+(VqAI(4Ih>y!` zA1N$jPQAOC{auDSChGlGsvT{)8i5qc6&>X|n}Kndim!@;Rf|_0bRRVN)Kl0cZbK_o z__qox^At`o`Rq413Z83%PC!xuXAkRB+9MC{>`NJu#uLiM zjI;m1d!_$FdeWip6jJc>@?1#y&O*9@Ie$N$X_LO&63&xRa1!OfU3wsM>F9jQrxLCY zQ2h}kd+8An>h2zl09AB1RsANO!7j|b&&PecM!kpslsZgPjj>i9`qU)XH|X7gVqaHx zkH5HvE&zuNe1&!;@porRJMb4vVVXa+@>JEN_#@~?72YD{`uL1mzx2I^U3e;Pb@{P> z=&}2H=_jvz-DMet$Pn}qaAx2dxV+BfZ*zbhPO&;6H}L)jr&z0=S1Uds%isgFJ^5{(U?o`3$&-yHW+s*YlCFI8l_wLatd7^TdVt*4U5F7_%{Rp zPTEgn*7dyKuKjuFZUb5nrDFy?G_)>9pPfc!4;P8{+n`%Gu!tPwUPFVc7z;aViBKq630%UTLJF}e-L^Bp;k@!{5113YbVyDWKcPQCtkv!M)wg& zpq$Q)@my^kaA!vw9I1e=$hchn z_D4F}V}braY^Y;@Alxy&KONouQTil~gCn>T#s2q4b>9sLDR1F z!!PBU0)kYAamZA;vYG=X9SkFE3e#gqrKr_>kCFkMqRyZ<62GY1Cp~LW^sE8TPg*sV z((()J+jSSYO815a`@v{||LNtz))3aRRyR>hPq&hLK-bF*y^?_l23A6oVXQR$0>LBt z0x+H>Qw6@IE3gwj7+Ryx{*S2sv!Cpj?(vhb+R@s%^~OHV^OW^^jLJHkTrJ-{soryZ zPlAS#zDn#>oL6Y+p%#Eh-^4frVCK~L7~6yDyG?ozUy>ufJb^E=Nf>Tr_b1XMNOShb3L!&wH=!R$R@==-$> z)2vDF0zZSa=!C_lq5p!UOTOb0(lL}Z{d=-AQ}&ytF&isksm?}YcKjAPRt>rPsW z=yh(cR{=85BnwNgY=!umtHB`HR}c4t3_axL7>j0^C0p4 z|L1r*;D^f^{D_MJI;=vt(6>(cSi+^;II!bziPt2 zuszb9_@3gos=+fD>+Vn>O1O`y`U)q&G1(y7D;*EVPoy^*p05Hbu=~e+hL@(ov(@&j z{bg~df-0%?4z>RguDof2aHZW7)2+(>X)?GHh8nK70ufo)Yr_*Xzf_H930{>>05w3$zci%kofN+KnC_SSN$V8nYN_k=6ZZ)X-+eScSMWWtM8oS<18(`S(Z=pjr3t7J#D1Csg&PANU%1#)QJ}@4=8EIloeBtl1)oQ57sMnO^e5U?FF2v!!8lM zYK^npYUCnUG4Y*s!aLp49(6|AncydTY!9GLZBxK=Ce~%Pzs+brX%~?GeY_8~KEq2L z5p`hv<9XcHD(y!)z7BA!Y6dPS{obxbzjmp)FfG`qKMJbxo8wKNqw(dH{WD^(Nuld8 z`D518Z`7m5sdHE$zbARBtB)hu_vEj+sui<5HMA4UQzytjDZ*;Lc^1Gw&O7z%8m{3q zxSH_Zr(hN_`hE5Mgx$nCN#(T@c5{}K^w_$y+g$8yBB%fKtB`qJH107B>S#mliqWU$AlAa7i0Y;Vx!_WNMj^c8zmRMC*-J?<9lWQfc#8rk#gT! ziIn?R71C2;{#E!9?gnR|XPcb0S6GVHx)e`h6*W@xA=k#G820}+kKe~`yc(a9=t9!L zV9Z$8Oef=4*n9r*`?c~b;FHq$&WR1PzMIDHYo93B=zXmayOG}4&fY{gk=NLv_MbvA zgulfD1B-il+BR;i85pREMk{bUwM|n>`hz>+fzR@UA8+d;{CI=kDRINc@EsFiIFb24 zPp+N&&~Up98HMvu_3yxM!{q0G4a@11j(uv5IZtZ;hkpsvLL*&iq`aM*@1IouDR-)M z^8~cYcI-_B_;&`gtvIN~gAv)Of9>j(&eA&;mkum0?UAJ$Yf3lOlzN@gup=k#?+2eT zBL$Mugru?G5sKvB0ZXivGsMc9ouyG{CzA;^Q%iFY>sR@Ilu@so+CORZZ_-}L()~`U z?b|<1zu<{~GtWeI?`DdR>y@S_mz>1ogTUjsqCeNQzX3`HPuG%x}x8Q5ZRrxvd3wb&Ijpv1G5+zN(iSf;5 z0`^J1FUjo@a+>ce5#;K09@1-_NB=TuxZYE_Yc(14_xz29{{vE-QvvJD_;bI}{Oml9 zkDW*72e`m$v=4J{1es@^zbI-QM^pi37q~ZeO89hyZL^> zU7Y!sK|{C}@+?P@k+3sAC8`ZP)e$6)B>1Q!##!MJ8}0uz|He9&BO1ikT&K84<&;QS zqsjjvJ`eVxdu&^CQ#ELO7gzYf@5Iiytqjfgfn&iU#?3VSNd3iIzr8|2uJD!!r(CAOhN^8K;I`yJ!n-q zdyKRfUri2avjH#83vYoYzO*1^#O;kn`tUaWoNv+T!`s=v$?f)zppBzg#pCSu4rsf* z$^0_dPT>wC^1ra$epa|*IxMZAr(g$E$@qb&4+wrG%oy2mf224s$LSQg77;fBfY<5> z;FgVL!qk}xGx)bKqkjuC{I@XUe}C8?wNAGj6hTYO`e5eyD)J|mPWwD}M5>717Uz3FM@R2EBeHLP(iv!b(C()m#oD) za&_Ff$y12n+{2$0pT&8J1EIOa6h`K*)uFlVGon(3<+f*5gpVO4w}83h-E|^U4xhH% zssd=ojR@L^KxIbIZdkla`~VTO#VP54)knOU24is}g0`hWs>s>)CK-_G%sRfX%fFIQ zvu_?Qw~RCfa=Xg!`Efi(-+;IgAG>bX%y8xRuCHv!g)>0$kSInF>~llaRlY>%SDJU83V$*KQ94+ho+bMY`-=@l}!MhlUR`!1ePh zY6l9=SrFUWQV6wetqy2Cnh&#UBcOFgZC5P5LdCPToLgmtv(E947WCJyrsjEs!cM@F z7q#YDw@}m!ub62?mt;r`MjTy%;oA{zSq5KkicXD=wG7WG%3)mPL{wS3TXtGhU}a%OR>o~&I<&GdV=Lp6 z4z6q&u^PdZA8i&^23O81w%9DL93!T(FoP<0s_@8T*&?@9m_e0=87J6*u*#hdMpZ6E zP~FalN9_ozJnglqFJ@YDoLP)&tD`52Y*(FBfq9=VSnrwH)^sj!{a79XCkr!jvM@s@ z=elKlZc#QvCdZAK$({L@v8hJL7%!z7Cth>~35mUUB_?s&}6>VCYw?UBL; zPpPH8^G0EYLq3Lh$QBEtA=fU*XEfwZ=XZ^)hFWKYOV-0PepD%?OjCf|f+c&-0l8s2juecX=-r^aXvB9#eXxbZFT%%Ll z+g#H+?dRq!uD5s|b-K5dKR8c%MpUTbPJ6@uvi`-`0Z+zvtb&)lH9a>;n zV3}`uD%2c)vP7AK+sw=i69tF^3U_wqlxbXQC5y8PQ@ga5)7OI1%xEaLU``lUMidoXJ-R@U7S z9zHCqBCvX^9E?Wdhr5=D?%Il;Aw=7iHLzYoprPU}&|ODIUe3ksv}todd;N~B9!ij+ zB?GRg^w!=Q+__uSykyxlwnv_{#OFjMjFo~r7AYa^Y73#QMX-eq0jK$m!wpWiuc`i1MfxqQ{F>u09UGm0?I>Ql=sCx8+Y64~_@m4p zX1-ebTxM}|>6M-p&81tWc}f?QetpibN*0#<{P>ikC7+*?S#o$v@!^F(sr%B<&BrqH zH@RCL^Yp&7FiSM&Ha+u06}Pxk1uibSzwU4R`3zd@x(y+V^BJ=^{{e(77G}(1VFoQ8 zQ&E8nHXpa2KJoqI_T%3fvg$7^uUGH(M{pRwbZzxZ+kRxdc;|ID-?hCzy!eVe_*Bt3OPe^}v8}eb$=%^; z>b!r`-LCiUmW@wsT(J0S{--t#<-=ZO;P%Y6P@8?f_x-P{(}Q2TEYD53r`OwIJ8@yN ztvUBw15E{;InBAP^||G)-NN>)=;#l_18$FBM54Za+8*EpJ}N0r2=5)HF}Sr6KOX8Eb; z*rw+}AX@w;7b2VA&@>XwDEP|5j?d-gEF2}~&s?EiYW@UEZS zchmO+ZJ`rA@+ajx@~*54*$!QK`s=P8k3Hntk@uV{>t5HZZ@+gM;*zJ=^2kYp9i&|zj59Y_hgR$YGQ0q?(oI84PPm#@y zO=~60Jf1&cxo;F*`^Y^q&64w4-ron-<*m!B|I&iL&2`?eVruW>8|Lo4!*BORisq{5 zjdp*e%(e+Oetj0Nt-&|c+`Gkpzkl~nZ8K~eLxX>ww-UC0qo>7Jrxkepx!s}Bxe?nY zgb02=5VhK)yQcot!f&mf{*5&o7SvsQb~Nwxa{n4{Oz8NxO+GQ;FRP;A`_Gmxc{Efp zyELPr=x@gy>x$f2ulyqSP5XO!@$&w_W!&*`C9gE&w|Q^c|7YItyBnPMW6as(pQ6GkTf1xRI-GK?j;CCexz}=HjS)`S?u=Tk(__d zkN>GZ@_N3Q**&VmBM(o{pME4JPggNEa&-2F+j43PMyJ3ZLwKT6MM18bQy*F$9DDGR zt>R^2pIgx`%;?9$41a8Gda+Q4KE9#zCsR7CZPwbwb)nFf6NPo{1=Y@icKLi>bofZM z4my076lTEVLc}b7VD8v#cwz5~-9D%Ik?Wn83eV-ot}nVF6n^yh>0F2hV=Bn;GuD@F z-Pv!uhAr(e%WbZVD~|UZ_GqYTzKUx6{Gv<6bP#f97nfM#4kMWHZ#sLU{;KP$Zp?E0 zXG@FaasR+O#XBlniskz=Pql?E&V0||uC{xh$^87c9napL6-h8d0;)TrOV!5oy z=FN(}B}TH!fNeQx1p1nOPZ+1B_Uzk0j1%6h({)pz=+T=KHBcGl}Yt9>bi&o^d7 z^4_(_H)(_5Upc(5IWB<+w!9g;^tf~&5W&k8h(b_&xNX{S{p;7g_xSh9ee;%7IKMf# zQ9ifo?5fJ?1&fxfKKycyT+zDXp_&(`e7*4>YBpod1jK2mjIkr>n|OXMJy7 z`CU`$Gp~Cvb@4qdRqIp$-Al8+6{~iRg-<-Ov-7vXhT(kL zLA_>0%-qt`;Xu{OU~I`d8~%&HO-qXE3K)Z_pt(Xt+J$l)6k;a?YFR7Hc+ojt>&8Q( z(TNRE=os1S2ZfH6BkP5BC29)^hNLEv6oS99%oI~$getJJDr2irx{@}BEuCVu#kSFi z{5#XvJ*RY+Xz!>W6flnt#(+n8BEx6hBertK?S!mfwaDVPJ(hQbndT36I+JIQ%B zv=qY9Gkej4MX>1H2MhV(lHr=%g5lft4L_9ESO@Rbo|#jv?blEBMAruxo85z5*s`Dw z5#2ypg9U4<8?HQ5X#nf#{b$F(3 z5!19~Df2;H(vTb2?xo_M+OJX!G9PW&>+^vj31;NL`e)deK{GC`b9+Q-b);NkROUc{ zz;oJ-CP<~-19L-<5AiNIqGT&(9F-0My|HjP3?w!RUnVJW<4_H2aZ>Ckb!Ugbpl=mu z@b?5e!$7v8nFXSjJy5}q=u%BHny50>djWAumSsQ2;l@U@Bph>Ow@Pz+UZ2PW@Aps= zM-b@b#5RKnLRM}UPuaBTFy-tPQ z4iTksei&o@e`UIKVO4autH))6xwX4l2w_x@IV6A($+p= zqsv=sn->%Iro@#Fp+3{XkNIb%tw69Z2P+%P&D-i~ej(xnv&@a?<+;(1uzUrzM7n?-z-SV9izbP;LvG}4 z-l}JW-C=M05S?Ms-C-f8yTi)5B^@2nPY9PxsS37E0h>?U&-XFY8muMX(On>_k;^Pl z&|L$Cvr8i-(Er0V+#r| zB?oDP@`Gj@L`P%veo1+A{}lrdr+PY|ZDd8WN%0eYL}DC71~K@pC(ya5z(MG21dY2RCtttXV2- zshayFne4WuLpFW{88z$>HTAX%5}JgKQhtcu5$cdIo@sfXu(st;QIyokB|Z{Y?20^H zOYY;^quiIcLAazkkX^?<9yZ_$b{3K zMdXyy77odZiCn8;J+O~Qsv zj%Dzw)nZdh3vA#`fQHc|X_%Wp4LjQEpa5Wc+Ah7lWM>fjE4!^$liV@Cxl8w4$I9W&C0n~ zR2YB!{KDn2{+Sjf{|FB~xzL*X(2BL+!J}dF`ZCz{f|~pBc-ZvdsNzl~e;*Q91vcJx z2Sv2jMGig98>E~qHC$!sU>xgxPaL@*=|4D|il@R3Y~QEFntPuxnrORO6|}Js#+`5Bl|_WkUlDn0H&z}PpO28 zN3bIFFGa4*&}?ZO$_zCT-GXD%)X<-MBQG5?tjFD<4FUr?$tE*IcW6f7uYO&+>RHQ8 z6_w^qHSIoZ>D2mi+-f{{U!8drY~I%T=Hx#6TkNx%T4^;3*_39Yi^?bgcvzhAsRg&Z z8G{JBP}WQ-4s00>9ozim zA*e;QF=F8$x0)Ir5%Uh&`!F*vd3*h#j|s^S>DTDY8Hob9ApH+h@6jG|UpPZ!xwhRH zJk}!VzVR)|3Nu0S2}Sg%tyi=N+R(R?dnK02?u=!MW=u6iK-d> zTu?tK7!>piimPrB*NAondjaKp0v7}FEW)g}`&unf=cNjujp_6tt?BvH8)$NYg^*-< zo<8|O36{Z5Tu(-cG)Bokh?En4jA2kV3(hE^g0gIgzn;K9`OX@*v5-!Os7ciA-RH3Z zkUE<+@9fiY=_^wZ56|G=kjNb2dE^lP$VGyI>T<~7y;;L$mmbU}T5|ZP9_)q2akMG8 zacWouS!AsJ*kqlU&^}Nbs2#K)bO3Y^^epHP=wBU%&qqMdP5jv(`eY~I_b-C}0_p&Dg1SJ*K*vFc zKqo{@4vqa>IU_I&VtT?&Vyb9T>$a(eHTG*fZhbX1$rCw z4(MIb-$A_~C#Vn94;lcy1iB1*4|D~@??-+B`VjOH=wr|)pnre{L03W7K-WPxK%atc zf<6O%4*DO^KS5uB{ssCH^#4F#fo_3@K*OLB&?x9@&~4B+pgW*%LEnM+d9Uw5KY;!h z^do2tG!D88x(B)sdI0(f^dHdApogGeK)-_c*W?j={+<6l2%696cld9S8f?(=QKV?I zJ+@TOyAnokFBxibQ|r+rww_Oh+%bTX2iK!c*eEG*^X5KJhzw+fx+M-Jtp>p0vsQ2c$<_e{6qetWn)V69Z@s&B8(EB&JIiQX@Izqog=_X}6c!^^(+ z5_-SLuk7-jg;IR(h=cA|xy%|3V#snjqa`G$ZiU;#6|08uEbqvP& zVeMq^h)^BoL->a76lPVfyS1XeYyH2czZf=5NXZ5{BxpL|+0fSR9g@;8cL zp)6q+pDik3btw941i9Jz(hDf3Ewe&(`5#ZZ=jz(7&ZN5P2p)?9)*+tnfxH|!y z^^K_Q5fqOS0Gq9KS}hHPeUbWaa&O^^Barc5eO9v-$Q`A@Yz&jVLbet9oEx7h+`l&3 z0V$!ClcPzdZ2EfCV1g*WMlavUO%P>Ao{GQgxTw?MPU5aoV+Z7c2P7M3(LOoTKJwxw zGSfoiv=9L>M(nk95NA7*KPQspuI(67C~(~1x6e}<4t0+C+HSezEJ~+qElqp)>^G@Y z0Yw=i#9L{!roPPr~O*@k+D6Cs1GZ)8y4UBXBo_kNvd_ctDaR9{Snk~!uFmuA@r#0c@i`kFlvnLH+H-`7(thH)Xdu|hl_?%oNYPHnr$}?tW-69nbT965c?fTW9twNt(m*8T1v-xNFt+qTdR>> zPPua0 zPkD|1%(q3^%AZ{#muNUBNtfmlH3;AjE|I^upUn5k_wlDVG@LZ%efKx%G5T6;QfOph z$T<4_7S1Qdb-8`a2qlP1qyqt1;G!N<@4rT3fjd0r8~pjar!$rzlZ_9a*Rmp6mz}AD*WAlYze{d)$oaxWeGW^a=#ySh&-d$|d*kK}*h% zn{d#$P;s7;68idywKy{DCU8u2k$ApfK}z$kdI&LNRv=S3)B#}s327l^W#RQjlOW(Z zP=QLVZP@0NSZz*E4Ql1nNGXCBxi5+50oOt8si|QX*FU>)X;LFKo1(x4LXjcy7st|6 z>lLz(I-N$y`q0*s3!NXY^Skmz6ccorNUMWaw`IRnYcPBp8trn0a;o0&hS+GoRPz}! zMLbYw7+Do#C@vnDT}Zm}8;oIUTcB;P%v7nib#CM)_Ul4}d^*@2EY#*ULn&jbvpBy} zm- ze5O9Rpe`CG^nFsm@|@51f`*%uk=;}ldS5z4Zc4yS!G=M!}Ksdg;I#|zbfY<@$xp(CCWE?SFH9?tEyx9SR;as zLX(`+Isl!bLbdKAuCFvwnBS_F1QKq;_J^%|`VGlJtzp{H=_*29`HQ;JlD}W4u8g1g z=I*JLXmZycO_E9vv?1@nXxu&{8s7`K?IgBV5muYH>XyDU6lO&ne(o4E18p${>^?vD|S8g_Gv`6_R{Wcy>$|d0HLIt0_ zy2+#sC7nTTGHDmFt*9bP?A*nY?+Xs7lAgw6F=H`h)L7!sf|YwyIV+#BRhWJJ`p%OJ zuofHI*s|b<^OJCaa*aAdYa@$$U4!C5@svZ)Rc@qjNDVVWD+GBD3$mff3+N_2e+3ZR z5BBE05A-IjZ(i)nl!J7s7=@Bj5@aHJNm#HrR_2P8Map!vRhD)2ZP9TVWx1D^wS_zz@u;n$Y(c%ZQ8hNwZ5CA{qqOi*Ks&+G z)Nx^^#Em95eOa_YExG!>T2iK#s3mvQ5|b#toh?yId}gX8ln>!8fgrRp-TcU0oG;0j zgy{K?`I4m75)1!%3Xv@_+8!;1|AGJ2F62Kx7AUdtpZ$n)uOptN$bT!+h_c*Rl@zj; zX!At(N-NN(M0|Yjgx3bD0y0FVavttV67`ff6$nqMbhQz}4R|7ISl=dUi=n`sIEXh9 z9l6n_LdmW*owdp=m>-=4dP3pBbBPiGb-@j7g=&WT+GZYhLp>2^w4#Y)_K~r^_O64D z9`cNln45&rSj+cM`>yPcPOJFJ?j2Z;k~Lz*Ywu!jYPO{x=D2RORrE(^PE~n6HUr^*=+4n;Y=~l z++=Y-55sJ!Hd?V8d$y3o6^;7p<|JJr&^3ks;}{C@oNRR#OYaAq^fL{?ZRVnK#DmXx zmS$d!-J3Da-Xn@=CX3M|JTu^GHS)=#tkz&C^NE0!c`le|oOoZI#sk>IaII<@zUF_( zr>d-(ftHxptcSC%gukUv!WkLCB@qV_&PCh_-cD*l_4MT#df~duJ_!6eYnW(sx!VN?tMI67PzuD{+wuo|JwR^g4XmK zhe&)j0KaF+l3ZH=RLst!ol{{_v8JZyvE%WjwO2Z$;`|H3VgF}HOHe~@66Tk2gJNaa z;J`AcpeTz&wdTAjI`gB9k{6_7wqfQJsVE;_a|J$}8c{(|_2%j;h55J2&Jv%M*$eKA zHJ9Qye2_A~rmS;@rBu73E$VvlvBz+ASF8O7S@UFU?2%QOUF(#=;MH;FKWzJ_jFDrc zhJ9fjOS;Tn(?jl|QR#CEy0Bs8Yk|Uc_NwHcGYtH>*-xLa+>;ge_}GJm^_w&AojjoE z3(B|E;d~o*<=Y;G9Fw;f707ijyS!Co{fKPXH$apv%95W~sOb5f5Eo-s-(qn-`CBVv zBIXqk>e(T*jqLUNt@A{IH}0;~L5cMkwO^c^IAs7W|3~*cZ+gY?RI7Tb{P(yufz)z!Goa>_8_KRd*5in&y+Dup zo&OB8pFwFT>EeG^hul7EB@E8inxQL&A#nzG#J8j1i#)eKyf#z0L^1iwe}88T?{L2G z>s677-FIe%mK<|X1)7EhJ;aYt_z6&MCCp?vOKt&hBVs4ukzTBD`Lt&U_aSQqwTYS| zRuEF&DIk8mogWeVGyZ0p#h9!~qeFA<$lA zL<3i;rGSmpRa=_&lRio6FRAPV^)77WNkXm>RncS@-<4%4O6(w2sl zgrt5k-|fCElteG`0e|y}oO%4WMlU_Js?n>@$0->IGfdHI+(1cvR1vv~Ugu#+qDhz} za-Wk1h!t6rE_CC5Ho?G$2PBEzOgJN0)=u|b>r1kj4+05p-b7C$loRb!K*g4uYPE14 zB8`P>fp?3C6)D)Prv@MrhjK1A0g6Q8RznE26NU5BLmy6M9J%(+TsIW*Pdg5@VX)(z zf2EYPhe8&t2J|tszU|nJ1>px{%p+yR&`6kILh5-| zinWT!Ha%VO%v|yQ!tEz~uXs1K#S0RIWT?uGf=q}{=t6nA{g<-XyrnGrKGh(e8@ETC z_g$Z8Zd`*nZx_{|Y7ysT$P2{@vn$21U801M*@a?2JH9fF2r#2(hh{ByzMEOd+G9rd zewEWST`{Lm5ak`ad)moaRz`NrN0c^9YOXxj=QF3f(D%f%w*_Zpg_RneMf2Nx$GXJ2 zqKM9gx5dL~gXFCei$q%)@y(e+iM9)UmNzu8Nn)``;wvSx3l~^vJS(*=Vb1v3W=emY zE0?0b!#}W4T=u`Q>Xw>HaY3yW$Lp?UMaRwVd!l_#;_u9ID>p$z+&PPK#(tCG0U#EZ zqD%lF{)>8BRx4t0c*B|%<)vi>HDM8~7NJC9k<46o>B+D;Fm#kq-!m^QfCx8lTPPp} z$4d+kA#}|$1QNda*Wyp0u_fh;31is-X8G{;2Kt;m`NARO#L8IdhyVe0AT*+Pp!X^EpTw|@0XZi0Q-Q@X9lcD9(yBoLEcZSpp9bJJ!BGNY5Oah?P|(5z^WL{4`}&I zPHiDA5{Rt<_0=z$0<^LLvdHU_Z?Rkx2<7Xqm7F&q6>sY{K`RVfv$i=m=wDFTjq+40 zZh|E0!UyyM&ThCJb)T7kd`HJ;dwmpDQwzvmrKR+N;!ZzB?8QDTj!3@f*G721k03X& ziy89k%g3?88~#Z?o6o{vRE3!|eGMySJOX(KT+eLZ2P8w~ zfjJgz-+x}WMVn?X|FD=lUyPq+D+s}*c0-K}+L<}#CZDW_P}_PS)CQjLOY0t;|C=r* zzdPSs7w?}CJV3>H4>nP~0s5E{7&Ry+yR?Hut2SQmDqmrG22Fwp>GBHY^JW0^ z*cfa*BH=Xc!Pr`|8sQlb^@(7rFzX@@6bvpc zdn)KQS;#<1sN+k)Fu|(o{j2@cO={{F7;39i)*Ln&=tRWMbsf9ks+hgr-*6Pg4M5=cA& z9@O&WL3#~SkXGmPfCdE$a*dHN6U+ICMi8_WO#%gn+(bb}>&R&!8lDn_xM|yj8fhkK z8SouFS69dt9PPQfLe`)V&(#%)8F_8xr2NqpbEBR@LR;1?~ZwZ^5IA zJ0oxSUx~aX3s^GMNRiXCK6wi&i+kCW?*0?$yTGE6p-^t-o95+~EoLW`Kj7W4)0-gJ zW#59A&4`Wuq+UQX+8HyK!K~fd$k)_4RdvuhqjBSby#Wq?HvFl(vv+QjOAK?7w)(IXxBu2oT0KfCH%afB;i4Zm^G>ax(yrL7v0I zTFBidenw%_*A#Yc!R9%@c)KJhTHeLkYZd|7)o`rV-j`d$mN`WL`y;2ADs-0^@Z6)4 zf|qawyrTh_4TQhon$0Jr#3?KUF5ClaRV!I@LTG3m5ufnVG%G$i6N=|y!zm0u&dYRB zypx2nh8FU25rflWfW&v138U^(kwD%1n*5mRd@e;5>MSfy21Hp%>;fE0i@qiRr$akh3ty&rOkolmiRsXX+An_lfW#@s)cBe?F!~T!}BRAriO03 z@BCaJwjT3P_mwA#Xc z2|$Qp^~YLa=R}5?JNvfARt;?gAl=io$&{cd=;WLO%uAaFh^&ftYVGTiZ_*8>=jo(f zWxeN#n&9hXCR0^hPe(nMHF#TS7XD=Ir6Jp-?i2F7D$Q##?RuU(H_RD$@|^d=fe21N zzqlARwrMHv;c%!hO`_)VeWOmqXYEQ|OcBw}L*WtX2f+>Ea^R=v__jBz z>!hwSIVpwl7kO^mJRL=w4Q_@UnuN&l z159p;oNO~5ew91PGvs~?p`4FbDbL?{an@gJH?@_}6&2YjZcyBlWoKvGt6#4=Z_;*_ zqDe>`0tTmBp4VV;KgY4eoGtNzCE1v?*0^%MCe zr_(e1USZCWo0-s-oZ7z>67e^i4=G-OQ0A)emQ$745@I+{^nJ84%T`AH_PVesD)MvE z=*`Rv_5OzZW5L*~!`E}j3nHy|!P1_;J}RmC`pA7^pI^a_PgP9Vs%lj0bylGnzoe-S zo#}@E@Lag7F|*{7p7}*RXO-`bEW-7GbLz;wmvcDR>48FNlZN_*<5UQZ7&qf>$PIaW zkBHkbB$cL;whp^f0|PnQhk$VF5jaFQZ?5>VkG|PQ#9bna8U%LTpQVrP)!dp z2~$Wb-FHsuCaPsE4VLRY@U+gEHCg4AF=biaF>MXDIk4rZzte6uNc0t`yvS^UWN}$l z2CO;id{XV>vn^1iffYyCa1=qtRZQAp!?CGm<|PzURaVs#G!Flur}?Ivng}LZuv4ZJ z^MtdW=Lu&gz?Lxp&dw|EWi{7WuL%e;3BHo=&t)_C=YpqTpt^XO8F?4mGwENbqZjzU z#^8hG5;!0d0iG1xGPoQMItoof$L0XXicEm^KA7_f$QYIT1YJ`^hQoTNsq%fiH5HX@ zhqphWbdXxlI4l!KE)^f~%uJ(Ab`J$lhG)Xi>LMP2=bQlC8DJzJYhqfKo470~0H`*< zXhLtm244sS?2!yV5f*|FKMzPO!V9&0Pm+iwy%w1QEyWdFoMY?%vG?uqQC{bnXD*UP z7tlxu7(j?YU~2#YBM?Rqum&VR*kB8T9XZR^BS1vh3W$qSC3WHvmsn05TaMFI$vSH} z>mkO4hCi)Z%-|Wu0I~B!CESJjkGU&uu7oIuz*Wh1t(^q z)%DN7xfao+4w3B7JmlNtTeEBH_Dy#QeTHPS&}T?)$=^1OWSkQK^9;8ES$LE8J8h>#%1FiU&h1be^dQ==`SfGhT@&?R?>o6nF1gG;A_AqUFK1-bHXRM` zJ#wJ6ebL=U9Zh`Z z#nAMh;8{Y2TolXHI{0z3DFei(2DUK?21caM`<@bm+Hq2Irdm~#A{%~LnrUVS3} z;yr(M&!y@Y&Wi=dj*i9lgqmiZ4{X@HJ9ufw?x47JKh7aw7j+0@jl;R@QSN>Aj@v_Z zjYn7dFZnhmIUs0!>d18eEkDP^VDm?t4*B=AHTnPbHQzslZuK8~GILf%!QA5k-^eDe z2JCEY`O^c(Zl2k*WLIf-yr6LTCI3$gmIbDT;ytTNmmZxSi2IH{4dULt78NlDRn}7GE?Hc>OsaPLIv0c+S`P=-#ZV6^j-na;DAbdEoYqac)D1W^udk`c}ahJ=GN;ECZd1fk5%~cK2&<+qW|rGJO69*{w=>fcw1AlwFP~xZv~@8 zrB^m&ti8S9Oz?vbUl0}I!t__3E#A3cef00MD+1e}oqDA(XUX~CrNB_$yx{u$cK_d3 zh)4ZzT(>^z+dHkO$?tsCe<*wBv_sinn0H-p{{1r_bZ+;(l#@UEkNt(o|Fz=&oD=^1 z`BPq+^=5fv(Kg&C`sWLunN<+@;*_P)&rQF3_9L4@-}A4CyfhC3->I4GQ!dV0l&s&D z_0jphM`o(kkLcx^#xu|VYx%U?+d})+tjc-kuz1-Ye<^sz_w}ry+$RfXeXDBkUBemA zSH;Vt{}O*Bb8mLVBbkq6#=rAO=5vo^zPxP4h6AA^)zzWs%FrDvszVi_vR?)7*zwat z=xC^4J35>y!n|(Zm+O6fcOIM4-Fh^&D(T~ePYZDfrETBQGhc7~XjIfGe~RY)GH~IR>RHhGIV&=^EpN}j4<|H1=F#)6 z55X+^yO*dbMIOc5iQf^S9QmqhwqmcUG?u>IK5_ckQ3%wc@?8Jv@C_Bd8{)8c{%BB5 zNUq4uD)E(<`9IEID-h;ap@PwS#dY#mq5KEMboHxHA^a?qe+G*RM~l?uSX}p%w_^!& zJ(e){V+~;`qv>ewzRaKQxb%|m)9nwZ8uK1rfqQEns1@9M%j%Br#g^Cyaz4BL_G86+ zW2drHU(PDR_TKjPA3*7#j^Z=e_>ZAUR=)3RpS^Cq?;n;PpBz>M}yTlZ(3$U2o# z8{qQS=2o^4BI#S~o4bh{Uyjt_=vq!o-=4L>9PR)J!baXBFG>wz%^tA<>iAdQ>#jYz(BPC6=m2GXF=v^WuVyU-;BKPU6mOpTEfGKe7G!eP|cY9=|)v ztvbicj|ZwZ9em--wOcl>O;IGec6WUPfZn{z#Ro*=|_aQ1xc7| zkecHkD!u;pO&7OZ*iu>jXIr)w-BkCHvimo+ZHlhX#rQTD-FP#X6@T~A)>F46KU?O6 zUeCJ}no^syKzw|A>J{N6YzcG<|=-yYGa2zLk>+xiC_xx2^o3Br- z-hib;nAc$AL9uQ#ep$O|%kfRV?AMl~IWEoHImCmLH5NMtD z$}7#R@!y=C_+;XT58vi|HPo2DJDBw+*nO23?0&KMfqS~YHtla`VFS#*##K>yna~2? z-RKeM`+kJEN@#$03GMmJU9aWM|HiKyabLufoe%E4lv^6_zP)KnBQ{f(F7o~U(d=lS zx-jUhcsT##rLRrhl&UNX|L&|6k?8L0KK?|c^u8w|*AIl3{35wNJ};xSptLh@dEUaj zyW$HQn_dx*WG|Y+zY?WAN5{c_OsC z{F&0y`wod)mVLN+)hB9~pA8f(c(d%u+Oqa&Sv2tK@sS*LJI}o8NcYsUfx;!JEHpR2 zJn+gR2eac@(SrJLpj3RTG4P{hPX}IG9)EJz(z$_GzPo&0AXZTjSX&TyY`W8!xg)b{ zN`0Ur>*rru9IF3P_0VIj|7CNwKjQ=bzE4M&j77`i71@!D>vLvg%=FFAaSGssGhWHb z_|zYLeBQ0`oGaC(cdY=eKvKUc-B7pSroxQ{S+DxOS2Jtp?a>dcZYX_w%jVV+-zB+t zj03(k&t|{iyA1>77kvx<`R}Xpg9kr+G4PW>Jd}}t_GW(#FXrCi|L5H57uu?SZ{6>` zQ1YwX6P2xp2C=nbY-MZg$m-JC%BEd`xW8a+bnIgnGHT=8IdP%jQqlgVXAbTEO2(ss zMak>pd-J9>h4$vHkGAjF+1fa?w`pN))t&#dBKUF<7F24s9sKZDg8Qc)8Jhk%@p1rD z{pD{&w-x0T`W6j68uy(ERPV{^PP~~}A%2t)vu}*ve>87qc7cCK;I?32&W`MD81QsH zbce6}cSDD>7d_XT@sq&KWplP14m!TOinh*s*>ygd#)Hepz~VV8~}?e+8i-86&7z} z%~L#mDlAH{1==q%O0e6R&R$Wn#0THbIVGZImlNFOw1h=Vo(MKLIeGZ8nzGAdWyKDj z);2p+#4VLhu+n+EpiGF|sbDy3bSyMFHl-H7?z()JGkbLGhLEUq8k}P1@)(#-QM__8 za9f*L5NmL7uTfZ}@xqw;W$wH-}G_{JRU!aePO|0;0k3BeQ-{jPK(wUDtoccvU!Jp}t{L+O>;(a-pprC`Y(o{i5T8hN>W+#w9>6@~q z80gG_ZxO=9CghuO$qnT?-*)=Ahd!m^X`&?2`?D*fllq0F_pT@I;qO!B z7eSQ-_vupF=Ugs5+~%y>hhGwfwx){2(}$1If6Pfm#LtRxW}~ttBDTj-mBBV=dxBL8 zI=s6wTJMlg9F++de3H%$K~e93R|Iw5l5}z_kRj}MU3{esKMhw7z6c2X=~EF(Oerc2 zF)FhFu2*J+5&ZJa2yv^>^hE+Mo<7C0H|1X>>XDc9 zj-ueSfUZE1Q$USk%6bSQ%(csCT-Tk^J$1|d`>#`VoBI0?r*7$f|KZdvsP8|Vy4_F7 z>idydb<5s+#|K>~3{WEqgYqwbdrlN)%D?=bI#I~`H$`E#{F@{HV%rc9G#&UmMgE;C z|K`iT5LDm=@^7L1J5ByAl7FYmzcb|DneuOh;&4CJCIETkM`<-JuyB<1t%Y!Q6I1?;O&0L02@hV$g2h=3M?4#m|oxaGMjfld_=JnX?k1 zme(>##W--3y?3_^03!(Hq(!3sm4sE`40qs42EI$+x*zD7WKR2lt74MGKaQDt@#01#FURVVQ<&VR0HnKjR;K?EF{$hWRfw9CJ;&yozv6Jd5uR!AyEIwu^Lr}3yHK$3Zr zsCQ`U!`gjRyQ)nL$e6CS7{RQo0UoE=sC4{P_oYxjb7&uG4{>u2A5 zML$cs724gZ-A3)UYxj%VJ)_<8+I?NSca|!Cf2rd+ub(uiZjr%Z8av#+01?}Fc%geStPk~o0`GwF!tU-S?NA?j9w>sje z?7F>8YKcKQ=J*7 z<~>_-{hp)WTv5~F1o2ZFv<*IgyIv&II@(u($W?@H{-hx-z2`n7;z@h z&nd?@58pRDMl#V{RnHWUck2~KkhpWKW53A0@>U_s!97;5XQwGVK33l*OL+bAZO*EC zr}$BUBAX^^(4X06CJgE)Oc>NVYm+Rpbxv?ynhAq#dct6x1CAK|mHfbKtnQja@JLq? zJ3%U4IC4F4tRE;Uxz2}-CHZ3Mc}?Ack(oob5>rm_u#Olww$66luwKnfZ4ojVe;m zWt99kR-PG_<>8$Fx%ZGU%2zACc3+x3W6osMyGF^+KsJ(B|K*QGSxg04U z>%Hf4f==1O@d>3`Cs=FChj2o|xjLaF9H>++CX^7uDfv&=ARiv-x{(#F=9tpThet3e zA1c^;$;a~XIWyL9napAtvew|Rild@hARi4*t<1;7+RGF7p{(C+r28M^pLZYssKFC% zoXEMn-yS`2cw CJnt-jSszcGW5Q5W3O8#jUgekG__@Kjon!5Y%X%vRysF`TOg(Q z|MRh&)zD11nBA&%ZpabaQ13;~TVp>TEB+roF;k5XVL5ZEXbPSXmK`?b_Y6sxl&L8g^(bG^87%T4(kU8={5IHW{btqF?#_uxc7G%6S~)WHsx# z%VXBF1-76Lc0tbA=vmKNJP*N6Y}4cIBDim%{rNe*J`wQ$4w|wcn={vxZ$viORx<+Q z$p(9(v7LE!Qc+Rf^wV?2zJQn=K4W<|oPnYY)0Q-ub9#ky2AJr(CqOIExolIyp-*@*8F^Z5f(mT|eU`yu5N;%+wqT zs>@&UZ>*wq>^&mdm)WeNR?+WVuIC>obsZ1@J=<%ke%U5-@GpDRd7=*bkdS>oqhppn z$(056`KolA%)TDmXZH70ms}1Eu)5%reLlaq;`@UC7+U0V)hgRFTw*4tim2T`Q?p#u zp9ManKi0%ovn-Vxl;sLD>zG>(B_N_}O_d2p*)B|k%()>Gk%t{2yL)*ktCnW0Ct-$J z&P_2P(z+J2RlXIkZ+e?HX6VXj)R9jG>M5=U3xMW)K&5l+%9R7CtgxQH4m+3cXx+n> zKHLpDPnYm0Hh3Dxd)Thm|z2zDQz74M)?Rk zZt$S0_o3X<_rPiKOi$bDnah$7}k0Nt$6avV>*8RBo@oYP5liQ^$yLu(3ARt zO&yPkk7?>@@5wt{9v4q)Y8WDqTFRz9m7)M!#|)L1i}O0f^!E&rSIHns90THYwWcbv zQAGSK((XY$b*0ev{Hx}_NS4xH`pHX;q=Rx+*Uap4TpYwGs9o}vxk;*fwCw7UFBj^` z(x99yO-pn^bAlkG=cJ~@f>5J(AyV^La>XS*CpDRc-SCE!*pHv!i;Jz|22q9YUQEWX zgj*?mg?O5)Nxfpv_{DXG*$4AX#UrO9+xjmycqrt;;y)I@I$5p9%%@p1V?F4+C!mYY*XlF zys2!t{vgW`coDXngsHhMd@6o$Fs^XOD=znA-L;3pAq-=>iNhboueP=+e^FGd5u@5) z32E=s{;5dYX-yx5zghF-RC`WAxm5hVMdKywXp}KWhrI(J1l=^f$-sC#!Qy|8>`g?hB5Y8@OiCDh?Ng1Yt5p5 z`X|dD0f73?O$h#)W0rI)A`qhwQu$|6Jj>* znp624_kHOqzuDodZ^wP(VLv}Ptbd)tOsSbh8?LX4BNf#O3;&7h{iI|n<1#<06jiy8 z`{$z7ybfUUNiuh{>PT-7{q;+HZ!YucoXR7{tQT!H@L?F3DCk+%QRIh)s0|s9;>-B$Pd^L_jUur+ zT?Ru814B=Y;psjThzIWu&JKPu_|3pS1TF_yj>(gYGx%;dzDCk%257i@bbZBGh#vJ# zdM}(kwr()#!T_V(DjSZ#7*~(3uU_r;X}4dy1KJ(b?vQqewL7BSQMg|6mVsDaOVO+uN&WBeU#^T|YyY=t=LLwqt_>Gb(USuT`AqqnLay>Ya@qTl2Ld~*v=2Ps#K z!Yf^^vv4c!6+2y6Ld3sb-fb+?HQ7F>a_~-XZeeebvX8p+jBgNY(G$zTC)VNLnyc|m zwqNPwwns_<{7{~}>=t!8xA4z{)K!YESNZi|ygV^Keo=#e z_r7a>yycMm)7kYzaLnn0Ue}@UX?vqO&&0dX{#UthuX1=d`SpsI@#GeMEl8V&BJj+A z_k4H$gW_iV`xl*m#>viO`gUw`yQJEy$@Ns1rhMWO_mZ3R0?m-gJtE>Q2tpPz;Jvi)Yg(dCDF%Cz&7TNue;d%?{sd{z|WokKof9=*x3A6atr z_f>5_qNt-$xgKqLZ;r$Ga|<^I*)D;#C*M)D89fv1QV7du)#9(O+NHYS5EF&?jlE@B zk|%GH{RX=oQn<1U4LZLjFD!>PlrtwWjQo<{pw%zvM?AmHc9iL1yr&Td6YJI+zGs0l z9jq5aKZJ4|LA80&4_P?h_v^hpDTJ@mZ94fxEkB>VKK-ye#GCE0(g^hXi zE7H*tk3)82{tpE^P!J|x0dP0+Iglp5e+t~lE&Cs4mpyrMa7=dqWk7dOyF=O?hRZs& z(>1KqJ@78+@73>mbl6VR-zfYE-9Kv3u2+892V%dKx@F$8U*o1tQSOl+=AZ3;Kk~`) zpd7G#Ou3v(gZGU&hrH-}ta4MjPetdE6lPd;$!5q0rD){Q-sTNmnYH{2Y%VZ&Ln}4T6TtcmhA=bVGsH+@{hADlk9UR z=>NilPY-bFv9Ws*EhmfzdVDp1CLd9j6Vls{aJD|fgi3q}c(=umI!*df;GHi0C!Roh zQx=X#Ngso!)q@Yym9%hUryD?D?}4{cZai@EiCcIB;;l#C*bdA_J7DZO)bMIQCF)A& z5O`BAmp~FpZ}hO(DmRvE2y#mqULwXElfMYC2&oiXuB*}?M%z@PE*Gp;Apl9=DrSN*h!dScRZx^SYNu->~UH2CBe&d6XN z1)n7Us2IlkX(5E2I35tvE@$cfaEBfXn{dMx4}-bgknSg#@i^c2As$Rd%J@%PHp3mZ zzXi~EN^tK&fK1g2$ z+{+F$1NX86Dd3)V0O|Fz16`oE?SPS=9^keeu;t3O14hpKL2v87p&tTn>%YNAf!q3T z@C4Fn>%ZY218(cTogQ2N4c-8HTmKE8R@R%Pw>BSJ|4GkDZfZa4f%4A$abCgbwXOf; zGox0V3fawF1@z(pL7iji?2IgTmKnvGiWH= zCSECfc#i4xwz~AK{u=bHN9$XaMcanesW`smU#DF!eZ{Fi(SUCV^D5?jFP`1B31F=n zPiLP(GrimKB;rqip=r;IzI8H<9{3<|TW<~hY2aRZ+XvjM{T>1CrMFR})7D$|JEfij zxAoTa!}@{SddqqweLZknZw=lI+}2xzGat6z8axGhTW<~C1>DwKgZBWp_155{z-_%X z_z-YgZ(}L<<^rq*YFCJ&uEpI%DEx zdicz;Wq$bVr6m`x7P~te+GfejDTQhS`W8U&bHPF8%ILy-r6zT=TBY@*6A) ztO5C=ybpt4Jzf|+?$YgP0=Socw*t5IoAU?c(+k{7zdL|?>3279FZ~_>?xo*YW|^Sh zW*iU!ZtJ&^%hSMZ{Wf?UxL3Pe2i(?gyPs+6x8ainy{+E{Zv$@Yx4}Ds+xl(z4+6LK z+tBv`xAi++yKMN3fZo<`Lyr~p3Hoj4%hqp651FvrW#+@Q%K~%ewtgG_JYDSWhj$`Q z$|Ci_*rjefyZhn2z$l+~KfE6NZ2b*^#}H^3-tLEY%Q^gs^B*Iiq3j!e5zz2?Ie6Ip z3t{zBs1pg$F@Gzy)|h_CWy}Yd@d^9A&7fg^ZMrr*kAlvOFUYSG81v!g_m+#U7c>mN z64Cd}Q+mYkBUi@r#r*e!hWRBwmODRuUX6^i{)MiuF1WV+G3l>k8F`GW2S9JzA2Y5V25#FQ zwj&{wDa+YzS0d=&vpoAOd9m#i!!h52WpBlA+UW>z+ddikIB?rO8N3a+ZJ)xLe-gND zpG>})wxq{AKqu&J`(*f^2A;6!4Ng9`eIoxh)IIGJ*D*V^{H7Z>Fud110q4cyC|Am` zv`@&8oF4&Z+b4!^AcimL ze1W$fcOZT*J?;hWrN`K`I6;qDU#y=2(0l3eFmNwDj)0Gs9@hc4^|%drC;udH zFFhUsZtJm;&oLY0%qxYWVa4_tMir;9hzfWnFscQ3$xLr?!6C zdTQ`0(0l1=J@9MMQ^^N)LOr$fm2R9s`aUg(?s+zMzhW44lv%r9F^Xq*zaoq}r5qc( zY0BT$TgF=jI);C*`Mo;OQAbR_g8ISd8t`Dg_{{!t#I?@E&7EF)XJc_q!$ntvC$9%D zeEA&Lt{0zHbgt^~9mdzZ@3Q;`!+vm))Ob4m9YH)^?Qk7%Fa2!;?xnwd!0mRJc8TTR z3EWG6PXqVT-$CGB`Wq^nsJ~ShJCc7CxR?I+0JrrQ-2yc)0NhJ|>w(+)OS|l)zoxxw z2E8rkraeyq_tM`k;9mMW1l-nN6K_9oTYuBFv!*}J4!2u>DF=PD!ziZ+-e0R83)I2; z(c=y+kM4Ojw;uO^jL8HC~bzBRt#JIV+1^$c+LydLq#)8G%K!SA#1 zu1d%q3NQgaEota?Tlk0%`U85#+hCi_w@16Z+U?VB zzjg<-JE+|u?G9^qM7!J{8BbF#(KL8C4bBs0Mo*aj)5s6&b>y9ixT&Y1H28oEuUe+~ z^ttd9aMtVhfgAa-%lDZy{2xz)Ka>W)&xMCEfkOFcNkhLo4Zh8Vw}KDTUzaBRRcZLd z(%_Lacqk1%`fn5Kr2*+-eGR*CQ(uE=@O~FQtoii1aQx!A%c8v1Q%@O5eM@-+D>cHwdK z0jQ6*9GdYA_sQp_;S)+zK0)AS9@Mr=!iCeWcY*)q(eZgs(i2Yscgx}FmH&UqVJFh_ z+mOR3`b6a8mP3{U>*e2D4pZ!-{a=(rlP|X%8vV89&B!6k;kO}g!#h*?j?Z4S#HI}b#9g0T9B7K zo>k>`6#8fLz?~|$a3#)nb2|mku=1>Tzvbta6XK+aY5y|PXg}#2RC&s(*HIl8 z&$)8T4APcs<#9Y;NI%cHh84|tIiTLqS>;v|;}2W@ zh~?)t4lj9*O~REtH+axfo|A4|%X5bZ&a>3L#I-yRc+l*J38>;SA!zpFEH#(kyv|Z{ zI}K?l&mG!NdFD0+6&7cywV(2wn5A%@rEb%H%5#tQ^DOls{T}i>>VZ?9Lzs#*XQ}07 z(-Y2@+h^02JXew4K3A>fncEJ$&S7&40B~&L)Kd$P6Q0B7QooVsF72m0bE)6RYM=H~ zKDkB0$Tqj97(cfq89%pG&`;Us5-|N$@DFG|`HWipV^{_^VMD6Eq>ga8-lU<+@();k zZsQ;gb%e|2%nNlSLjQZ{2)9(Y>xeoMQ#gxif{w(2Up@0pjWcJyEq{mQ=Qe0V(<$+Z z^%%$Nu1UDkk$w+)>PRF!InBIppd)WGE_H;s(Gd@tR_I8A>D2cPaGSlCj?@#^I>PPz z^ixN;HJ*Oj{9f&+j&Lh9aq38e_ESd&nSS8Zkxt?sI>N2*Zk#&Or}#*lKj5aBs4vpy zb6d5Sj&NJGmyV1mo)c^-bp+P~NV%fTkE*iDD~68rsJw)EKS8th-@t41*)D6D98u*j zWpYTBzugAeamh9%WbyB``1dM2O#W3C|3OVpnIBgC`B!yQbXyQpKt-l6@J^V8Z-IY;GRmGe67r<|v>pK^Yheh)eC_rNLVgDR|) z^I)BaM{}}|CDnsozs3&&bh=*Kih&<^7Iej6YU7?oVnz+l4O6&n08h6Hj2-)P&{It?~C*{$cGWeaP|;sk)YYxXfz8My#|o zTWPD;IQevIoc<0A@6&#^HE|^aQm-4x|2^88q@tOmgIuOZSp1o&gRQ`g4)Q3R(ZK=B zKPdf^@2%nSzX|dN{&7IVY3L)gLR!B#)jC-(VxnHt@ZOqc51Ku^w??-$96Ruso|k@w znN{76aG*p#^@~S<=%;@1xF`M8uOaPcI}*uJIQ6Su`>9`T^n2(RkMnu8Bd1kZsb9T{ zW`fPXS}(on9r+(WBC1S^C|6b5Pq}JU{xIb#MZcD-4uwm(>eA&& zx$0IlljQ2Orl(x>TJ(LICpb^&GxP&ja)nDZmoQ!>Gxe6g!SWB2fu`Y9OsH0E%&im_Dx#~#gcXWlS$KQecM6kqT$|0oqi#>oM%0D6R5iw6LVHz9N z%Xqbo8rJ^(fI{U8r!2KrlEn zEAEdVV~Ahar*zdM?n6LZQY-EwT~&zrk*>_R?-QZ{(zz6%RUJ6aWs7;VWG>MJ=joqc zd`Dmli+w_A@=})2KS+}oaX+X}5bG+iPar?iWUa7Iu@R?0@%`ct+at|sm<5{YJul&2 zE2Rg4J`eWW_xIaBF3=1k)!EB``{g++&MKxMh$$(SQ|AgPflYW8vT+=i|Xn|B_fI5BqUxLOW9cZ?kcKkoa>I zgPcd~^@(K>ds~C^_=G5)BFzBiLu|Q0>Ong17V4pNeo@FX083$#>`MCgsg=F&OPt@( z33({4X5+qys}YWm%a(*H+d9!mc>_OGP* zzWgHnXAAg1>Az6K3L2wMC_4a??-27N{a5tM?-KH3bFQHOS~x$aK8(gb#E?t<#|Y9h ziU_CZd11d>$kUIW1-iY6=P6H&C%D8EOb;reCUG!*j$?B?$WFYtuYkTXiu)mO9;e=~ zC@albiFs6z2Tj0*F&;^32gy&>w%$A%(lkh(IH+PzZ=NXP7xn=wR0LgL2DV>CP6eHp zFyt(pM|x!#7a-}Q94;de_>dMD=|Xx^gGYqiMLy%u+28;y;Z}IPF3*g#G$(wG*W$9L zRyy4_i`}u>=J8hB9Ntu`vwFt#sZ%r3YT#;GnX?)$*sW7MUZ=G(ZM7k7RgKeY@xoVI zJ!y8wsv5i7HpS((TWv|?SsKs@g_Q&FB-R>_*IVbZ9RTZ^V#1TB**Qi(D}$#+^J-X> zgM64uj>GsS4uEU(EpwMZ?q}KGh-G3S050a!h)~C!~3FSfX7X6jOh+BZ53050c`&Pa1qI!S5#oiU$~&abo=64mzWBQmcdcM+?@H7 z@j}sp;-yPWMJ4$KIeLBO^b9@FBleiA_w5_RG-}(h*_EhJ+caV!U+BF350UNXRyOD(jWGZt{Jn3&jlkllmJ^;|y7;!<{&I=+;H-e~exHW^c$#g6_`$+k5XTE#?*^)#K#ErIIIwhD zpO>Ez{BQc z&6r~V>!OJe`<5YdjD;`~c(Rh4W2~ZmjJLr2QhA+N9%l{k{1!2lf)e?}V<}%Nuyf33 zhS_RNF&G-AIE#QO&LCjw63?F%Qx{A-AWBk>bx7GWf;R z%v6JfMo)`Kj?bwQpBL|k$2yS?3laZlXgcA&p@M|(&jlk1(^g7X*VjHQR}A$aPF_zt zuTB>NojgiI2@3725Zmh$Q+T` z0g!;dO*ttGaH2n-A5PvA@EN7QJ~<|sUtLWu7>ti0f8l}4^ygpKj+gK;H_BH8esned zh1_j8{({$Ugl|zCpmg4!AKDzqUva!%$#<(~AU{Stz*G-uf4+foxx`QKx(2SJ9)SED z?~@&ibnt`kLjJF|RhQb_qU?(A`v!5Q?5g|+`h`A^D1TfjN2J3{eSdmLhW_~;Kdv07 z*RLo1bNDf|9{6410@f?YnJ3svJb)kaKMa~7$)9*0>BtEiFOCnCTMm%&?_zvdJe77w zxu7ObvDLb!Sgj5^T5wzzj=(lZ_;P~ExNMO8%99hl^708*n@n*dMwFwV{oSyE-Z3Af zL{Xn<`{kjw-~1=lM8xak2!H6;FMZY4eCXHxGrsihZ(nQk?|+Z>lc4AHtLC+%hu;wU z=Pa}n?`x)V;nn4B47$~at4dL(PY3xDk$XGU$p>CH^j@!nl?A*X238tMUr!I>Ljn#< z_mb+mx(0D&IjN0(<%GAw1-%uaeHf(aQBDY*M&&edegXq1P`L}}4pY?AZ$u74{T$!# zwYw+NQ^2A@wr+&M;rF`^t)tP$j;LP${_LhGsnu$Jv|m(`h8yFDJ0 z$6oFjNYlZi9p@epk1o>k>b~-WjE7+S#_>b%XZ5zJ2|A>i?%WJv2ViZtTO0 zQjgPRDzkWPSH}yf|9kO#ka3|JfUj4_e|1n9dkUY8^E?$^k7ib zf~80se*oss`}i~z8sc69`RDNb7QbQFpMM-6Kl(2CVwuHWRoAyVnw%=g#mldEU68I8 z7SCN=w6LIW4Y7cpUAXubQ(nP*Q}N>b9BKV9hevtfAn1p{4`KC2;CmP}1^FKagra(i zm}0P}8{&tw+;_?k*IZ36`RDWuYh~~_`JSJBH~eh+_x$X-`I#U$501yd@^7zxf%?of z=_6O?N5N<;*mZ;xC-S~w_*gI&BL_bKD{(HjM=S@H7p~H3$2IZksD6BN=yJily7zvb z3P+7;=yJh43d{99-_Yd-@{e%g`RM(CPYv>H!E%8hw}|gym~z2#fmDvRbC`0$a)D4z ze7>vnizZmV0(}~T`l8&>Ev9E7Mfm}P>mDF?ei!^xuu5|Ftt{aCp>ot!+7GrGLHu2M zKej3dD%FF$ADpoXwktsSOX%mJ%f$>@PHHEX8=8(r4rr(Jeugg>djs<9z}ZV-UA=Ey z4lb7l%YIkV?a=)aJw(6I`+0_cz7d1z_oGps>82~_D8Hb62BsJw4^us)HzLPiK)r8& zU0l#-t|p%>54Ho#)Zd~{Pw%w@`(7UTmgSMT%MF=e=LbKaFv%iupuM8&imSpp>$kmr zjTCa@>(>H(N%NooSL@e<>6z%AcICRYz&EzQdE_5HNQ3R2`mbAKpi1N`cR+doyhpwR zdsSQ2nm(-zdy=lh!Tm7B$lj0APo4_6VixfQKMIHKIu4fTn9mRC_2ULdiWinF3AS(j z-X7&z?RJM>Pp0oNMYQ8Gh;~&ONJq

1egrGpOlv`f#?-Ubm$TR&vvv?lPNuiq+x) z_b|y`S2b0*-?nri-6EzMk-jhx6t?dpF?B(^z-|hcp#{4xknoIBAHFg?xdtOUD9q5lOw3m^CtjG%K+)-L2EYieva+JS_U$-PEUIdH_o z{e?Wj_3>nKx!dCKn$Wa4$693vGiMW6mX|?lw^Vuh>N^1TZ2yXJ9BlvnZP-nH7kmf# zm}KiK)Q|Q7IO{6d>;|v#;Cj1Y2hcxPuvUxjt-oEAFptUW1%8dz{fCdV?i%hs6KP2I z;qQU%9gJTc1U`WL3cZAe<5%0@I`V}rkmC484`O_nWLlCRI!r!NhXQp9@1`{>0qTTG2&suI&;vHnwH`_SVK z+jS9Ap4=n{djl#Vy(Zdc7mMvh?>fv^EaF-moJae}3P3|}K!ANC(Pvpp4e8UqD0g_R$FLGrT@%X?`ut?j!;7 zi1;Ut1BpI-;(L~kw*f&=`wnMq%ZdXKN6S+>xOm(^QHd$ zY`A*~c7DUvFZj^}^HWLByIy~gVEyuHcGki21;rzATp>>3u~|%caXb>jeEA~D^LpL( z(i$(Z@yq6z7Feob2e9^bXBnxfvKh4DAq$BMy$1QYwFDi;?B4JY5*~s+7E2c!Z$k%* z67sP_U(P4-3@^{}czy20Hcw5JS3RfK!-ioB!$V4HO8Itj=J3&DU->_5CC#Sx1IG{Q zl6QoMK$DoeR(goLo&0EF=}McGc;usGc4ko#xU7}i6mE8kGGjF^M9S(IewoE>w>Uz% zES67VmZGDF3S2uFE&6%rz?XxGNNr#j+g#}4ao?D*F+Z7CqOy7UjY&CtzI&Su7Ckpa z>a;N_X7upTHmqXjFD4d8xlO0d%Ocd5Mw^_PU1F(2!b=D&Z+ksDZHG_v)FdlOz6}@44SJHorzi81dF`K# zWHNt7on5c~({z7k9EcY?$F@X)yJxKX)tRvq(=E|3x60Yex}&t{#F-6VoLVwz=GiGV zo}FG>W^vh+>I6sG1X4eUn2Z7Sa8n839!+I(LQKZj7)z9r5j zdhqPi&5bht)a4`&k8O^#tS+US*MhgAIp=&eqq_eVwYh-TK9IxDCl50GZL4i=ug#sh zx;Sxeo=mqpJX*!aE+9@XU*uU(Q}sfXE>E4jcO(;$;UQ<2!x-kN(00L5mt$j>!|{6u z+Leu%KP_Leh;%v%Ivt%3o;U4^J{^m@-9Lun-jb$!Ivq|pbVYL7K&K=9XG_(-_;@Ae z=ybq|d8^=hNZ!4jj#p~ZROGx~yYB9EM5?u&jz8)%_+QK%7pby#I_~8!m)JTT z);*n$-ziqj>~yTdDvmC*a-ZfjSC!?o`30Nmn1hLmPypke&F<^-!xYp>Eb(`Z#WaCDVA~xl?hIExlZdLl095EHHgc6`DffJvbBpl z&0TW7!-2uuR&LZbZY$ToWjt7`)4GUcr}$q9YM#gQQ@3)PI5Ra{?BcpO&luflF0+eU z9}No|qtnR;ca4P29At+8UT)o2@8JXg_5P~5ef5hN+@7DbuReEuM%yR&XOWj$ zo_>)Cu5k-XeSo%r=*SdA3iyghrshO4N+*)BIV*pJ*;@i&>MT`(e;t9*l<(Fcq_U6d zw97{T_@<_E5#U}&(7z4=meVGyH!VhdB?z!+vrP1QKv)1+R`DPk3cMvXze;7ZxYgMx z>1$BbC-(x(63N$n3(WYCO|Ys&s)*$4?h~Ee$v6$g**Jh%u$dE_-F>3ByH8IfZ+Bvw zBA9jfsn@%9L-vMDrd|eci)c$EZ*QaE?(I_)Xwco82?MkRw`#%L+bFnuuMa71qDCE? zM;5FPA(AOaH?`&9GTH2gr@7RHzLgY;RoWDuXXfocmQK$v32X+X)DQ}xlDQb4dAh_=Em{ZKY`+L1>mufO!dF;Cxf*D!U1%wEI#^g zC&L_*%ksH=rf7xy-P97bZ(oha_bMW?9z9v}RqY@4@qVL{%n^~!|vj!;*vNl=GOdM+FAvB>a0j`=R@-=81SLFV|8PvT~MK! z6i@A$>(wUrD{a#%^Rlx;OfiKq(|-`7M-%5Z^&YiB|LJKpU_j$t>34RdcBL|>)`-?@ z_u4ADxN{l%GT!F8Qnk#(Kv2|F&0S}T;Q21@Z7wZM+iQ$wrq*Z_ePVTQbL-NyizkCE z*t6co#Iia2=h1|W< zs)(e`tJw3_H(8Y1_C1l?{KS8R-NpuX;~&pAHd|j*N(W!>?kT&t+x3$RyD#kC7TMl- zVfR?v^ndQ}YkBV5^#(JOGyvO^H=1EW^b&*GYSR2{F z{cdI5i^iLI130%~=)Bzs;D0Qs15D<~;fV#o|TXa14 zA%&-FlS6;RFe?NRL=fRpL1-f&wIQjm1i>wXlKLNOY-9zyKsR%$a%PzCZ#wo?&6fJ| zl_Y1(rusYTH|GnH1U4vRHpn)r!b9pgpa%{V0vV6=K&WKjZ0az=?2Z2&9cL`y?A5Y| zP)S(Wih@0Ns6N!rg!lx(-n}6;a((Q>AsbdQ;V9LoSRC90c5G7pSZ66u{kNH@1-2&Y zzRf5>s`m?y+w;T2!kMBZkzx5n-zZ}(5uK=B@`=t-8^$H(Gsv$x#^>oSS&9k;?zPZ)A#JQUH9*n4{H#0>GT;pN7?-W!3n*vmTyhl7<&^0xvY&NmLZ;TM-15|;g zmv!u<+$PpV*$qKW0NKrK&;-gJKBBVRTX;{~FNx%57rXBmavaKV9F*f&AI~Y>1nkBq zs0hGrau^lxn}Vpf(5Q z;k|kHo{G*4h=wqL?%mW9xs&VUV(L5mTvjIsrZt`1BL4T8q*48ddRiyv?BssM&1_UZ zs?P4@$|G9yT&3?;uZwAwcd1XSr$@@4is+1#uLy~hb8>?|LH>2bg#>wm{O`Xw6=!JF z^GU7ah-9Gj`?hfjBVtFuX>D{Q@QvMSXVP=K_Ny=GwQogqae*%G-}k)9t@C$I8#S?9P)P&V2WjEa4uWfBTJg?sG;tk_nvr^5pS@ zZI@o@`7m%2|1uQy$99#spZF&51|N7s_=`K5d!j4%gzR_RZ*oseJ26Lp!o06D?L^uM z-$=ue93J-~@jw0JlTV;qw89p7BI3kDFA~Xcmq^inh!p;ZNb!HndYC2w37Q?@BtqDU zRG2ieIjH;xvx*o-B!w3SW9YmR8}Uln%Khhyyl5?c=~S9`othhKJq}8e&feG?xf=23X}(DI|Ol%TfuLN zfzVPl9s*NGbbQ7M0^!3jK8?a;kWm?=s&_TrmjiqmysDIWHy2r*2n(k|9J}AyT-NT8Ot|9Dj0J zURXP^E87*vZrUhEO?@tiVuD0yraW`K{#b14bfes(+j8^Vh;}B=sz-(W)eT3V&Eg5w z*FjzHMt$8z#<8&r$FF@SQdHN!hyqPLld9^XrtTLwC2Hy>K~#ZOe}loFHp99X?WU=#Xs+NL0Iu@(8d{2bWb=R7&z^1gf*c|h^2sQPEd37qhKmVS>)$P$}a$^lusl}M4u%rq34e*+)pAyOnVGDS4)h_~9f2PcF# zLw{>!xp}`6VsPmo2v_-;<<)00^{r@U<^I{aGp;5+u(-rV zt;?-UbvLfqraKwx`jIQQ@^LP=a_cDV^vbyvXhT$~&#j!j$$B!o(zT9ny}!hkTUqvC zPf2cNVu^v|R^nfFNt!HGJ%=Ay08N5k0;c&4mBl*`Q zvXop|hHP3R#|IQ27R$DAt?gQEBX{(UIm^0o)q8gq%Nn^^vgx_%Ty>8Q4<6$RPG0o* zMr@6Ccx%hrxWk;msdlP$lMQCsiyXi9@5_@8`o!hC?ON;SYaed_1C7oGe?xkHSHtfc z(D0&Fm&Q5W=KrR47kLfJBwXK1QYL+wt8{eT?|tk3NaaVc-Lf;HEN97QusrYljQ?`Y zTeh^#4(Dgi&z36qX|osK^HtjB(z%hW?|=UMBB8o7OiL0eun;Jg0J8voM3|dA-$AHs z0^m1L86HWv$)g_2W^Mz}hP4PWQV;=Jr?_l{i3`AG_Af3y24)-Mm^ja4E5<-|ql?lL zi@X|)Kj+hGmn|XUa;}zn+#*KJ3$fLYDSjdr*Hjs{PAjaZ5@|uzC$6Z%s;ji3N~9%K zBCV+sX;GC(tE$XTGa-PN4yH82>XO+XY>?gVDW9Wq*7BR$5q6_JYE99KFeQL55v3ys zdqmytqSBE^1=10qFKFY0N=KkVD0K2zL|@Rx8HN{h@hP*iwFO#6vpL#V&#%;h`T+Rr zWAXu_MF4Ip#z1ovf?1WupA0%TsN793TUw=KG|6x1!s|y<3`Pis38or4S?Uu*Uirta zxjmC&aJ%9b9Y8P`=n85J5wvo?=!8R-n(CJU08j1+tw#h#0AAn8%zYzMm@p;cgsJU< zf6S4X$oR3Ebfso}c7D_|rxWX^+R1ps!qE%-)oBamX)@Dj<7jR3hQmkhZQXTrQC^&l zj8YYjUhsf(&8p=15ipnPzw2_*iesEGmD+Mk%hHWag}kq*0`R%2aAti;zo}G)0(3Y` zsy^r^ysf1p4nUdxAwj(cL3y&5l|b3ijY}5pr(_eR=dpfat%6ZJ#lB|wWlJ*)!`2vk z6T60Oe2~rOk`g1H9NitUz%N9oTEG81$>p9Ca5_2enF-=@#rrV*922TXobK=;N)utV zB74Rbu=Met0Fa(Maf6lNPr*c*&B9Im{D`6fsA1duq*t0aP8%5|FZ6E;c}>3D>8{jz zn%|vQ<1p7c9VB(G1D(^BURr#c?zNDH>Rn2nWz4b)^B;so4kAUGly__GzMVACB#|Ob z@(^m$Y4LrWp4LrGdRlC1b-P-R`in1|KboWc+P5a3*~U%g*$JaQ;C3;|i{#~QGT)SU zI>)-C%Faidj31PB6Z;NWrTB}cMVq>CTbQ5MqJ56B+N}Nv=FFO8wj=Tq@}%tdn#5Ua zFaFT$mrr4ohE;EF3jvkIy)n&l>j-5=BsaI-TCvK!|6c9V$Ck`1E~{0ZR65FzGd;X< z_6oV%(LH)!75)YGRaGpTpv+tFDd-z61wB!-NWuM_`=Y3;I{J}~Y@n;Us~VBLtNLMv z?oZ-sNawU{^G%)Awz_~*W#ACo+p4416pk9H3alb+)n}Nt>Sm@>wN?CX8iD-@d)9tRbUL$SiQ0QP4*>XWgnT)kQQjHPFEVq{+s5?8mn6~&Q<;HoSd%?51Cuc zpLpU3(HB^}7N-1#l_~tY`I?z|ZOE+r1S95nsR0#3&cVq&9~%sWL)8 z2lMbGA&?@GA}PlEPhXO)D*1>kciU%qZ7;|TF}oNgEIX_(efR|$J#oe_%&EmrkNu&u zrF8}U3d3bMS+)7XjfkfYBVg|LaEWT~c(F?_UjEX|?i-aI#n!(fTWm=Xf&vG+^jk`ff@O^EKow~6HD07M;5a!KVK?a#4=w_hIxhWe^>8;lt9nUvpx8^ ztw4S}8Iuyo0wcG;*&b3f!x)%JCUIqfo@a{#5Y_PuMdj+iuL|M=lXRD%z$7juAm_+L zISDs{$%Jayie?R2k^1^7${Dhvkn5{x_K+2YUSCDILsk@aeH9sptSJ2YD#{zOqKIp+ zC=_1y7tF6*s{g7x3KxT1(=ztcJ^npo0vgKrwNR>?@RW|*V-U>*YBtpI~F?_w4 zrB%$b1FUY5_DRUt3bKSYE$R_W#ukv9zWI=zNPx<9WRemOzS*uaUS1Ivn4~fXdUiyB zWeXVvmm|rf8SxN;O*kEeeTAo^>FJpMr<-RK_au`^I(-1hRu=|OJ&C*219@-i|Ar0< z%?mGs@5QSw_4Mp4hPZArGUKD36!MP?XM1$5I1Y8&pra;n{+<~}d$9QF9`WgD@zXs* zaX%Dy(Q*Ed3+A4_7AC9UC0yz`-Q(}cQqhs`>M{3_#c-1;w1F`4ueX8yYUgO}_>Qo~ zR9Yjn_FJhD`!+tS{UZa~7jK283g=_V z<@=%PQDni{9uEE$2SPF6E7Ac+BzTMj`hc+Oqv5~NwE+^t)dp@i2GqvTF>vNcyaha! zz92YykSJF|Luvy(zl3gpA47V+=6g8!2jl7|nx6YuGX3%=WdRXjjR3Im2)Kg)tUv%F zQe&_F5bF45dzf*sn>>5Arw_J)Saly!LKz6#0$oV>uMnw#3=RSKSYF|=DhE6k>EYlX zKGwx=pbMnO@&exw9*e#1#~N^x-p9gPg~#Fst#!!9@=|1jhY*nM;x`A_e#pj=2bc=3 z@CsbhQwR}0=76|%@f!i#E`KB78~G3T#tgOM@*Fw*O`C zS^%3Wvi2lRpR}b#Km^nxML-48(w5d|Unwn?w$MTWt07Hp+d!I>Bn7IXMbrh~kM)7> zBC_nR_{0@m1k{4!+x4-c!s;)mtD>SP=*o)Z|IXaGH#cbmNvSR>w>_DA=W%A{%*>gY zbI#mr1Y`mz&#`c`06BmLz&Jn^AP;al;0(Z-fU^K4fO7!(fC4}vpa@V5FadG_;{o(C zga9NC3i1(1d$CV3zPBL%g28j?QtIgntQhoT&%qxU=GWa*jJAUOUH)J?I>VxU`|j z3b{1xdcF&}Gsz8!h}J?8>`X#$ak`$WLY64>7N_gkDI}tjkX4J0tZJcmCNYsA8XvMm zv5_Gv4T&hi{bX54L=o;MCxk>4;ePVmkccAOPnL&76ybhyVn{^V{iJ(JJ7#q)VApcV z#f)7_OCI|8pSGG39zVR>;)lcDHHCb0erEP!lcZqO!2sfj*9BvWr65*~A?h7Kn*TwTr%&xSX zUC5K^*;Y~BjmOG(b_h3K_?O|81axg2D7*34n9?;;xMjj^6Ykx@J#M&&KSFkw;#IeF z#h)tD3wMrimkQTHUl*eM#PcM9XNhnh7VfH{a=abFjh8ptEKj&ggu79=`-Gc89|pr^ z7w+A{)zQbdaODYiiEuXxHy%gc=$a(lrNWIj%Kiny-IyUi--siybZr&x5FCZ2%P!n_ z9HphpBHYJ?tHY5sy2^xmqi}Z$7k2mjS}NQf!X1etYjn*KZaj`KaQwo3T(~=hI|oNe z=qflvc9#e@9!DYQYCB7IHwrfuN2lm26YfIc#^=la3kziT1>wdQ3xAXB9#XB`>j8`@$}&PqgdR2D+whvVp1+A zT@$6qNguAIQQp&XQX7uX?T<)KI_xlcMBPyy@yp{8=l1}Q_^wCgqUCZd^!25z6aAiy|YG z*X8vTuRT2id0iOB8xKhrNDIpQ{iwx1!kcj$+k0?C5lwt^NWD65nrqa{rOy@aM z0o9{Q4(Rk`X*Vw0{Mzk-;_eKnw*)T#!eU%FL>P`*-kfsoidd9 zAc+^Ekumrxo(SqC2i0kVgmrJChC}A!khIpi*8uC@X@2Y8TyEXlms|Iex3KQb<<`A@ zePrFMdiUbD!qjw{ueOv-O>>2*X{m2;38`7QKQ}eaB~#Pw2MqWx4Kg(?^=&`Ex-vD* z^_!X&t7?{kFfv7Eq*ZzCfC2wxh}m)A8NE=c#Bl@uTv&qk<@Tka+K~?;xg9HneJM9z zMUTQoHl;Eq^sEtv5IthM|4czTohjfo>9lz7I51q#&NzMdf#X%A5f#q_iY1%?70doz zr9M$A83CCAb*^8Rr6M&>l4F`s;+!v(IMZY$PWw4jX9If~bXM_GrXwPWvqP3X(8 zUw;jDpwlqc>OkL_0LA8gFdwy~puq+Ibi^qI<+daKNAOxn{z9I3A_L838+RKY%U)l$ z&Bx*$ULRL2^&Y{GV~{!XooO)46gKEU(EG>Z6B&OTf>vS_5eAh!;z{x&sG_7x`LTZr zgHbMjhRHxGDgJD}bPTikJVQm5#a$T7vc5x7shEkZ9OX3z&_XtiAcn+r^LgE)m=|?S z;T7fv7MvEKKp&zenT*n}p8rPiUjzS*=D#ugHowAD4` z`-+>-&+Bu+?{270K`>J+oS6Vg)uim0QrVKqDtH4Zj5rFJndwM@58Fkhr?fVQo`TEm3mQ291j=aqwy3O(&;T;wbey9>i+mp{KE)-xq?P zgTCF- zCAU3hu0H*yLcAl#)tqR*&`=x|21}OhcZo{v0_dJhMg#43W7%?lH{e9o@rg&rb_jdc zcwx_)AzY%?<034M4PewN(?!@w-UW1Qp(d`sUv=Fpde)b*8)->#>0x#i);0Z7RQkoJ zQ!nL|4-kx#9p1V_DYv@*sL`xHF2nr|^c=AMc>B}v)*tUZU7z~x)hPvc4nBU<0rR@v z;jBM?_;>PO_6Y<7CODk=$4Kcl z^G*}*a`GsoTmN{a`AeC1Zc^u++bKO_(aaSpKHT`*7wR zn*9zk@66E5I~L45V~?PDXY4O&-ccGR-1#SoGc-+eV)mi_p<^!ydw6C3`C2?5oqvd0 zi9hlDquu{lwapXeJ@#KZ8khY6^7`t~3EL2*tNj=4iz2-!f9=X5ob;C z|02met+v9ge>>uKwf~j6S^rd|>l;D-H*4rmVwKAPivX7ct^iyK_#I#|U9#Fgx@Q|eHHF&fY$+U0R9Ph6R-vF7T|5bJAkc# zZGe9P-UYk|_&>n=fb9Uv=L5JO0zLx#Tljq<+?{Yg1AGqn0dcdo44krHhx-N_|(&nU--|G58g;Y5yM!21}6*7`sn)ee<%MiQZK{RJ^9D7U$^|@ zyr6Yx&JnZ@&H6RUKYFtcv6)7<x39bTYtQWKH@U;!5;Y-q#_khxa+?M5Vx!KZwAZg zR{oK$fB&YT|Dohx$v>C;tDNLrC>ZJAF2wy}z`J6|(nj&#E#F{m8jk*L#PI9;*t1s@ z-$T5udM{u&>tdFigy1)KdO{1!t z`WLO-YbGC4@))68Wwg+}U+%R|U2oh#`Gz6)BD{o)xEZ;WPQDIL?nQDslBp?Icyh1h zh<*^c*ZD!~4a*U<-pKwX%Dt4<30MA=%HkBof!a%C`B$D;Zz%FF%WrD^aj5wx<;c;$ zJOPuh7uwR;nf`@waoJ)HSx;kNbbV(+RcSo!+?YqvzdQ=fuP62|-! zoGdu&NbEnlWBnknzxtuDg8<>Kf7T$bVt=4re`&d%h5;V*me!xih(U|@aPxl-al2Z7 z<%OH6CLYuJ`=|F`bJI8B+J6Km3(orJ{`Z%% z|NY|Ez5l%+VE>y1LEn*MZzK(`^`Q-@%$4g|IUnf z2L$=I?pUNE3+Qn7UpqqVzcR2KjPxS;d!+lXkGtG|bw~OSadkKH{}lOuCRSs9`~U8o ze&GARi0l77^0$l8Ncw->Zg{*4xjPv!kS2o&`XStL0rK~EmLF>U5pD!#MAdFEEiDgGy~w8|(1o z;o9{#q0~NyYA+q5(#Y~~vb5>;b%>(`s}6RQpk4B2(8qlfcE=UsEWvy_OVDmq&JrAN zi1VK%Fyts_2?`y$XT@296nxrFK1+~>&$`KH3GyZ7EWt@OcE31FkkX=@CBS!o<+B8d zcJ(a5faZgpB~ZTq5rswy_5BaBQKIjE&^JO3_5F{2hy#|w=o=ux-~S*y^j(k>0Q4P@ zGyr}7gT4ns$Lh4-|Df-I&^JK3`u+#up>Kc~0rVXa`UZ&d{SW#s2z>*DzW+hr@u2U2 zP<-w8Kh73@`Ea}X{s(;@cloOv=8jj+zGw}yIyxW7ydNjw)bnpY=X}tC zCOF*l2ULUZ*?+xw#M*y_H~*~uS>~TZ9c9Zo;o`#eu;W73Y^;7r*24*%#mOuWSG-O+w^ zZ~sBx6T{cx_+@5Op$jX(IqWJN5v^nsn2F*0WMMDZ26kirMf3k~7&FslV|M25_VSS4 z&=dLolfHvCz6<*^V>ik{`cFFT3E6Pi`|oMU|G1Oo%={~fBW*vj76m-q{Yd2J-@c4k z|29ofez|bT9!S1GW^rlPYvk3{`YqVM1s?e-hH&>i_aMbjzwbHJyp#8f5ozj**0l3? z(O?a1JVmd+A)dALjVX;{m+6`9(J1=N(O@>Uu%OEAnk6l^dZXzabiTgttQdX5S^9)n zy<68eE;^=9yuJ@7`|nwze!`jhg#JwDZufX?E{Als{y65r3pQ-b#o8TEdM4qW8^iP$ zu&7h&#)~~+)>xb`k2~IAC}IivWL+PeFK0OmhGvd74mGl&MW@%*+MP&0&r?_3=BZ7q ztj)=)i;^-&Gq0n5Xl1!6jTN-w*to@OAB<14&t$qqrpktfV!QQnQzdI?XZAOl^)l1S z_S8Gtbqh@_v$!O;*qBwsM&)G9zqE=)875k+kNmBQ84Rdv&I3cm-M9yF7jJlOu6gWoM+df+%g)g0~_a)9#N8&*d0=1gOW)D&hXm?E>IeSA%B~h59pIkygb9@{Gqz-Wq$eG{fbT%A5@@H?^C~`R^@N z>^L6oXz3#O(IzFhrfj0gJfpJ0WG<^Hshm8qpr)*{;=2Kq_iV}SlpJF-&3~?9Lpd(= z7q8Sz_-b4=7go1ORy$g#+-0>m$n%|7h)hH@N6Qqa9hCOS0aNs7LK(yK>KfBT$~5na zD%M*>Rx$LsK*_2L^ffMj{!{N#Qlq^cj>(dz)#2TrppdY#)!WkQ-H3KiJ+r33- z$g@vXT4dgI$>QGjA0@%Oi7uzN>Dbeia?UHZv{g3LO495v>`FV3pKqm#pw!js&N*4> zH}fXiovmK!&Hk!KwPbZUZNtz*Qh6B=!{M-dxUa`{lY+I-Zt)DSsA4HHeZ1&=7Pqa! z(kzX8E!ejhy?hedCNM5xIPFoz7lm}#8=Jg@p?*iOFJZWNWUwz`sC|}*H4B5pT-ich z$aCc1( z@>ne`Qnkxrx3zi(&HzpBAE6_&b{d2NeZd@%Qg~Nc+#ZR-_JG<62D+>Ey6w)!ne*wH zm#WNZljd6?T8w3rCCH|%QbRIW3!7VC&lCZy`yT z#LIUFy z?qNnf1xd<0C3d&RTZU1-@d>p*aLQ*EKTtqT%QKKMWfoVwsCvn`GK(MWsA7FYi}|r- z79STwJ)WmVKe^}s)OO`Gx#e0lH|nBj{0G0FvB={qT-&w|loBPN7Nug&>+Nq(x8(J< zRiWE>ck%(Hb{j#G-l#L7Gq?H&)h-R)rbv23cvUDMVgJ=B7E z1zoD5)!~RcL%yd%UX78M7~I}v9@qJQL`@N2^k9ibk=zS;moD>YhEW+!`d~|3kNMV~-D*B%KB=6ISUj{XNK?|ld+dnWm2vdbL zuiWmGS}mGZo`Me608iUh=+6PY2~3ukGJz&Qq?X6We-_ab5rf#u_upc)@!8kFXw1(6 zkE5K*oL;F>a-WJWOT{dAIU9dKi*Z_js19k%0r^R0D6iI|576-Co!;6u4P%?o6k}Rx zwm6>flSVF5Ehw45unwW#ZgID*U#Rwm3TeK#sLA5KbgJsb$1zIx_BI-P@_+|B-#MI? zBN%$kZ(kTV=6OHdhC!6Tid+r{xB{}-SxY>iz-Idore`hRkc(uxJkVF>jZfaKcJ4{U z7|+dCi$H~3Im-Wt7H_QfI1s*HSj-Rwq4tS`2 z70ewRkLHo2euS%3nt#{rDw~q4S=m6fu~@O3^1NT}=Q5n_j6cpld=ZPY5bwuo>rhI{ za?A0Yz8>oktnv~KT6Ws7-Os+g7B^>#^Jl%MqOJD2S~%L*zgF{>dwvEwwcv!Zhs+6I z0|5n}l|8B)tsaGYp672#w6=K04!M~DC#9t-e@^%T%#?|4z489~Msun)7 z^r%iqk;VZl#Uo!6qo-oLt+X6@Oog1s!&>pGF$YUSs0B}Uyml-N^>9G~gbfsH!JmWs zTCiQS!{3Qm+H0_`Gc9tF0H=LM*b3FXrD4*1XTyROhYavP-Qf~HzC)FJboY^6Y?P(L@!D? z8s#JG^=uY=tvs)Cq^swpbTfLZhyU8pWv>|v9Nm96-%#`lDutF(wJ3p;Z>{Hn26gBc zZE$N*&RUc?3qH!$o9IXBy{J(=a8!ZdGA|2XLihqe!Or!Tyz_Ju6|cE&>d=3>lHU!YN% zfhVG12FgWTB^RS%EU2YW&~&53J&67r@?P7_alx;JTVQWB|fXYk}y-~`8%EDucB&yV;~cQra-UbhkNnT zXS_pE$NB>Xi#JFrm}JSNtj3{V+4?%Rlf0CycX|OZaq%k}%N?K3fceVji|6l^3Md>N z?%k3ETP?#|_djQ5kG^i-VrIGP2XE}lN3Hf%l*BW9z9IU~aecnM%LP{26+a5yl+Tw4 zaw#v+&A>}|jBI+)NlPPQ4bun4^ZC}$nI&8U2o>3aCEx_p1kS~s=ru%Tnda2CZjN|D zr&ne|x2iu_DxYuN8*(;A%4P-LS>y91W5~PE^;`LbBA2-=0JThlll8$dVRS)n10q4G zun{XIw0U?fP#_^Pd3ig(;?w6l$Dk!dCeqPMmFa3CRNr)>=~#}c^IO||zMBJ3jRh)t zKO$X=6`BT?DvP7){NfFt@2&t;)c*9U8@ldMN~On(xcn`h%~5qeQ|t4s4?vX-RCH>c zuICBW2c0T7j-%>)EXL=1B>>epprQkabm0RQa;FKbU@k}1+0xnP+ZBK+7pUkg0bOyV zVU?%Oati}LFmrvRLLBUtgs7YF9nn=hlX#8j0z%nysfDd zsyvRWxC>NY1)$0UDpDBJ)kLV|@k-o6r=xcZgfgK~`gW-B!}TYMcZGun0QpmwQ^KjC z50)R1yQj-Z94TC!G}5}0KiQblc+jS$_728H4fj*EgHg9I?)hy}(Yo`Nva8%--u7P0+&j`gR{V<}sJ-i{e|4G(Ek2?8sW10U(uPwT{QZTMGaGVGEB{+j@|V+3T=9}Nocdql)S(?Q z+x4Y?w5_^g?xc6F(S}oB9y;XedFhw5Pq@W$$&Xw2&-g+cPW|(vODksm<(~OvtFJqG zkFB5Uv4Hv`yqyoxW%|{+DBW8A2AX)NefvU91mippzHh;F?J4}Jo?+DyErN=r`qoD9 z8WyE^*qcF2W)P1i*iJGwNlgsQlhwo}WLe3u-cb@mcEi{V^%43Rd=LP|kTY&{F?NB# ztYhO{UOb!CLY4vbZ2uFAyhud^IUc=IPsygj1-w_XSW!kiHbLk>FWXa!P4Y^5sh(0z zE*Yga<0&Yrsc3&wMH`?#%*feziMSn` z84IN!_x1b$iJmOSAaMkV1U%nD7%F>_z=M0WuT}&jQ1E#qS+KL`UrM}Ei%0gq7Bb>K zTm(`fH9{CZSCai3KMhRJk=6`Wbw3>G^-s(4QHR}oE%Y6b8!kOkvR%m|8oLm!i|Ko~cXEIcNH{7hC zE^2CZ&Sp?~7#L}ua-fEYW?boXr-4LZP}{7$j6zAR^g1MUF-+DdS(@oyRwj8!q?=eR zi*%fgS3&R;e>v8*kh9df+_OET`rJq|Rs%iOyIiwpLq^?;M~P-@-hKN040DmgZk_#& zk))s`6utgTMOG;!y^ta4**wp!5aK3aJo%!cnYqwB*Wxy#yIgt$iD(IVHL~)&@eoKA z7)cGgb(MlZQ#j8Ch^^yz3Mg)ir3MSscC$7?NNI4@&noqLTRuXBL`LsC_eye!zK2XS zidP|uO_^N250wro7%=kpFq1cKX<%)K{&Q2$=;% zNN{!}Nq!xILAg1x-<+>P3pT53xrjkti+c z3hks)fLa^%nGSxJV32*lHY^oToy79o^pL+>+-S;4Ln(^IMk*0XvIyetMDZ*qJQhlT zM1ceakSxtNVn``{UlBVGg7h^G`b=N~mio^y_(a_^G6zF%8gD=aWR7zTwCnOLMZ|5-VCc_jBl2Dh?v9nq;jmNis;;~$UJ=mD*sn?QFxlbnOk z?-X5fK0{J|(Nhbco0%(dOOIjD^d&Nlhv%&(sI&s>t_{va&oD5|YL17N__OhNt+UNd zjV=jigc%byi6e2Zj<<6*cT- zsQ2WO>R1tI;Td?XYCMy<6UH;W49~&hX7%0X4c|Sn`M&>ZJT^Y|{MuxgIrJ6dZ}Uf+ z@1sa&&HOSI>Qqu6(8yB4pND2M#$ah_nJu-Qk2yA;?qLoAt?kqW#0xFcFpy&yzGs0+ zyMk-3B)YeHKgA4zkAO8v!?zNx%NnrSnf-#oj8sZ+|7oa55b5N3WELhQe2Lye%c6(C zAfp7m@VpN^N1jtuT<}ep?~eqg`6U#IL6P9=yRB1p)efG-5)CGH1m8(tCOow z_aL=WH(9@pxq2L?kzTCK2@4&WGh1OrpiBsYfonoHuP3fhU|mp0Iaavl4MS@w6FKJr zo&>0&6a?r`WITa&o`+YrxOb(&E+NBRtl(ikRl&lfY)u`u>CjD=W(Y)F=AO{GZk zz*tLG9D!u4ZmoafCe28Bdc*1+>7>sOj8^H)!MZ?Ls%3r7Gmx#;GKN%P?iJ(4R9-8F z;1f@8*zkwHfXpIf<6BQWBZ8h^`_%XAKlvOCrHjDL-*#;4*fwN3_+jUiPd&bV4;64D z#&*!`IV%A?GM+gnyXJAW_6n8@c!XA*KmO|&WnAb;{r^{JDr1?8TU=$_j?pKt!~Fb7 z4jFu7Cwd|ATIlq9cP<^ks3L8R<2h$973kqi%(9q-SLb8xHE+h}gW3i|TGPD``E z2*+SF>zH*0SPnj|cpi78y3Q*Jiw?99#mL!(Vu<^3U*f(Cns>a~v2ERI<8GoD&(YQ5 zw%!554e{uh*W#|j1S}q{juv;n?Zhc8)@Fx!uFG-Scj(Kk#cgXd&vkn|Z0Ok%xgib;J^q|(p0MD ze&wfN-fr9{%S5X8xLV9M)beJs@IkdaPP0I2yY)&86qoBle3iwU4SV%9~kLXo@H`yziuJ(9yoxf`DI=PtY~ZT{Sa*Bw~;E4h=G$ep2mMBO<);r&mn@0Hv& zvG>9@Ay$~m8q>gZx)_5r&(FuMy1y8n4?q6Mdg44A-+KH(^K;)l{GNI3<_+H+ID>YQ zMFka=w|l8M{o9;+Y(%~S&&KMksG`PPHMzLPTvYrRW;<+cJ&lE~`L|7`Mf7v;JaPZ# z)wF_WTTBCi7N)d`DJ2R8j(K_U@Elf?L0bzY&Fc+R8cOZJJ~D`76uOG1FGZurF=a{p z@!#atx4d(@4fY{H3rFpy>Psxr3=Gp~P5qLg7mjkgVu%a! zzX_J;fw{y%edeR@#H#-17z|Km%CT-XL}LhaF4sUk9aoXnZYStTX*L8HlG$B`7<@u; z7;vVs;qX6+jYQ02**b_4NPiH|hAhBDrPY#eLf8tcyOM&Zy9* z;aEQD0d+XIf;B=MKY`m-ssO(bnEz*Sx~Tjw(<{5Mq+nEru|1=3RAI3xyWR9=K|y;_ zR(o{jVpIF=46DrMG}y&6$&)r>es0dl_Bs--xtvk)tZt&+>UMcxcj8T}#ughU26dGs zC1pjhEy$^xSY0`~ctCmi(BGvjs!GeqNgHiUtE^x6Oj>z|z21#|JB)gCas9E-(vxtE z!Qjc+csA>^NEgfM-Ox0*u!ok*n)e62?Y&}Vwd-_ES((PdOnok^HI2*29R-VlqLNX$ zd1H%px-4T+o-sQsGc7ZB!O)CjYpw2fcdK)>&EY6LMfYr4+GK3??9IdKptDMb}by1VrPj=!Phr_+?Ba*V%C*96_hS7S8%^?^$DaC5>Hv%Ew7#C*o#z(${Cb{psGMtS!5evUVnA;nz3lgXuLd zjoF)&y(=kuXHxbpaCRqsuzTb;SL{u?cigU|aXXXfcX!gNuSY&{{obV9T}in+lkOk~ zX-A%!{&~_P3orO^k#YQG7sOv~%ugN@XZTZnFTMGcv&{Y2J5$VMY;tVQ`N=uclXHf_ zF(F2NXErP#7_JIjon66D8be;l>I#Nw~d*n@X;1<*eG;$AVLn+A5UsGu{`X z@2`Y&dtI&lXEZ`nl~CFCUAE?=fMWs!6su+QTYVgYI5LscwTwb1puQq288F5kjysYoV-&R4-m~UfJ>668{s>Hk& z9N&oeGed-(gs^rIhH^x`69dzW&M17u`2h> z^}&t$JR0t`5REzyVY@?wJ%BJQnE0jCFb#DK>|)na7Zb6lG*J)7f4Tj(S5t4ho-I$e zZl@swBJZTL!nopTq~M~?Nv%iJ2whht*99sKPgCzsQtyVVcc&9iyY%2RJSl*N!|`GKY z@_#fY0+&)qZU&YUwp zXJ*cvIoI$;9f&m>&iN?YnAZxFkYYbHLW{lbuo7d_J~4JeS%V#S`|*Ry^wNewVG`zW zX&BpNlu>3YXga-MOWA{dH~{0)T`(4ZK$#6bfag!c-i*fB0|GO7(X7x=#%GTz{?dJn zPySvO=JpJGjc^MQ6=UOGi1v2yTXt)?9Sd4rz6EgCg%Y9xFaHs~8tDw9-&aub?E92s zGfL>Q{7Cf>q`|1$VtX)od>FE1FW%RNz%=+}YOEt0DgFTO8KcZ;|$`m50J z3LzTfR6)0oVtsK0EJ>w(K!VNDFd@SKMF6+E$=Ir5qI=HW1Y3i#DA zM`4D{xayeWF#L^<8G)UriJ?5r83iwdPl3v57h?#&gS1xT z8cw59q1o^ev|&TFhr>~I3b&~l_7LWK7*M`3gz`BW!0=+&CmvJuPAb`G(l`vBXs$g3 zK98%^XaqfqlnjktjJ*SNX3f?$8r$r+W7~E*wr$%^$4gLwnV&HyUw9g7CD?2rsx-ONHW!66Yx% z@@*uAiU~E8&(LH`1#Twre*dK#BYAu5DBY-~&L=PV0ucG0C1bn1z$eRQm2W%EA#1MD z!DO?-;lVe(J>R#3+x4dy#ib-CUVQ_|d@wb5JeR#$O+M1{bV8^p9?DW$Kqw!7YzlL> z+X@BI3h|tz)Hm)1IRmV9X2r!7gKg{qLE^^aeP4PITIp1EBTBg1m+oToJdypfX z<}mGJAw8%Vb?&}w?)doJ36Ar&fxZhpY5&HCGKkLI~MJ@j+^1U|G8*G2es(W z>03%>-UkE`l7Z%FU5>b=SU-|{6-#9`CXM@1(YY*91f+V+@lZN-sI#De!(O5JTzU;2 zXe8@fdCP#Vx-LFIO4u@ZjZ{`TzuYR?o}^fzw%l=90)o2hu-_K^9_Vq!Gq67{IclSp zpdzd=X14@JZ2CiCR4V!*@p`0s3tTEVpvwm2f2Pcay?7dU9I>MMX^x!)+P0=C7;YN< zCUB~Eq~uGU&Yw^tiQBPu3IKEJz-(ySU~peeJF-y=-;y9_lsMtTnOt#4$jCS#072Do z!6WvJp0m^r`Bx2R-=u%ZLmh|u{{Q9??7^cbuO@o}OEg;EE&IPCldO6PQjd=AEo%EeS z44CPL$54&{X!eA79?)T828Ynr<}CDnb;L^at?kY#&1h;sA_`@7^GMHN#fF|g^9(WDdIKX6vbQP(wb6{LP_u*uf+!I#F4eOon- zBx(x#HrfJZ0S-JZ521~wOQO3?Rk+a};tU^Dry@Imfv!_lf|}MTl1mx5znG$wu)qxY zdi7m;qjNj^YxV2G{#1UW7Nic`4*Lhex!WIptpFm@9z`P| zc^p5iRMcP>JNRLiwHfFNpuay#x8nK@F%icJEU=^%VBfvkmKYqhv|@7Q28Par+(7vB z%-_pCGL$=VL7UkZ)laEs(SZpA4DJ;%)j2l+txvJZgLBt{af-X3^syw#v8&{lK1gyw z72xv}t+Kc?DlH#;Zl)KX>m!XtG_wU41( zq!(tpE0%T34#dMFLxBMciIzLM&}Cs#ph945i&|}T6_dCVNUR?+*|NHPq_rech4u36 z&h0oxe(-^G@33e&w?~2w>t%cHD|!LAIc->nL2!J92h`kH)?+fu>86$KoZ-XAG~uMz z_Ur7v$%IS$^ZDk6w4Eeo=43tg^K8aWX{8S5>uAPiJHP6a!hJv>uZfK6Q>^z_;}zW8 zc$NPYTB4w{YVLkQxx8iG!*5$_kb5mUQJ6=&nN9IjcB&Q18TZZ@jx zF2TQqrZ>~U*m_%r=WClI<#@36d+$KHOh;Q=jowu`T#q;R^;<`+%;dT2O}x!I+ts|k z&D_qcoeK{+_`6k@v~$^#ghYXMGdM?7b*8j}x!qbZn=$+Q!Tq56#;d)hN}e=mCn=pKFm|1D@kfq{qx*U>;IgB>cL-P8b`>=89^-N^$lX zn9;CFMil;|qS5;Zsj!OdBChDcaaLIm@;{n8`lK>6V^8nt@aNnSa?mEg`fvLq)Z~Hh zznhzBoJV5NGNpK789az^6Fp`pC$-8xFc7U$Fz=VfK_*2KGo~o;8zI?NYrTk8xo3j+ z0q-e!=oyL0M((lZ!v4x1HwFH_SfGqrIU;6|On5@&cB11cx58c`7PL=OAu9&(mjH1OE- zPj;=56B`?sj&r-h*<+e~d+D}8nuk6G?tOW##Bq*mLzm(?v&0$c;y4eW%)O(GZ|v+* z{teH%#V(dB8NWt@b00y0?c7-zCOeKU6e}!|iY%3a6l~4&GRhDWOAr$)5EF|L6U+O} zazqSGBAYb7M|CvZT5YJ%%bu*l<5ZH_U>BOGYP=Ec@n8dXhuT?ID{T>hN4>;KcTguw za76is0SK5KHh5}OB#j!4Mp+%E)qNUEJ)qxONp}yEc!Wt87beZI>NmvSSoLdGtCBgb z23l`OV{FAsMO$YkWtdTC26ZAdF_`TKlfqS4+Lvxj@MesWq+d)Z5@??c6Yn%|Xevk( z?}iEi7Ft+x{uV{gaD`}XfPcnTGfU#2e4kC$pO z+dp?CHFz2{mSp)YJMH@r4^EX#^7WcjC=A_H5|hK-hXmz5LO6JKaEO?u-o>>~l2OAA zX(X-p>d=hgJgzYL-?aIJ*~y-mmA4JZtbVX;b3ZHA*B?e2S1ZfDq{--2A(X*O(Kq;k$AJvHm~|ns5^EJyZh%s>BS3tn zQ%R)KhCv*ehp)47n!0@nfw}`N;NJk>giT+0ue_X*R%eYu07E5qpSU|OQpGN@@SCbC%sr8ykril)k&V+FMMvUW5EkMR4{+j3YXZkKiU`_^J=!ePMoP9C+>@g z?`8{VPrOIc_cK9^xDqnT!71W92q}x3^lX)CgBxY%t181AnRWHrVjB_+zqj-#;wcE0 zD~nN0Dz%LpTAvW87xZL(+Q*{ocdU%x6uC=KS5z-}@s^`ao(^T>Vs*^xB=o7rn;U^u zkNCCJH>$8hlB7EsU(-X62Y5GA<7V0V_G^)t>06iXzi6Y$WL7xj_Zx*FH|q%^HnyPH zB=UC1D5{T@Ah%564)A%CF_>}{`bWL#(rb_`xnQEnjLxt5Fr{R`vV)cc^GNMEEw?YzIo70pdSEz@i#}U7MBD5bXOBFh~`FRoj-J{VM=YD zlmR1k<=IFOF`_;3h`{9F>UEjia(ILx8hqOb_EWD^A8n@7r=LAp>GdRNr2=W^whR+^ zY=D*$_Y!J$;Jx9d%I#y(rj{P8-GX{Wx|E-|5MyW01DWE2m^H?uj9ByEGc**7DwXbe zRg!L@7;m0?b!RK>RAV1uf?cxUv18`D;&4tLvQkX3DrNaRo6Bc7&h}dq*`He(3zY~2 z9REQZ6oZu>n(t3GKB<$2*?Vf+h7bcU;A&WjQqPcblYbR%yvPe|46;1x7?7r8ZfiW7$daS>Gx_@~^hIwN$`3 z#GjjeLv;GqZS_BwgcS8cSTh3sc^nZT91+`p3_@^1=eHX1^#pUlh;qS*YyY@S2uH-$ zpSzRa>j`~5SL4^%5?>FJ14r2OFGI^>KInlEv;On)zN+4kp?{3>6LCge!H^MX`!&uy zJhuTf3|5jQwy%mwnSymMN%pZ3lq*S-TlsmSn2>XeAKU9p0~0hqAZ;*$`2 z%C*Fg3f`W9Cf+x;`m@0oo>Y(G7Y-1y(Swe&Q>H{Mb(;W+Jg-bg0Na7UF$kKtQQi2v zfLX4vzUK|xbd~62c)%Hsj1014c_s~ItD#9HvkPS`u*CH&b{0=3{<+JapGlYxtt8r&7y5;hb9rd6jZXx70uy?$@byp z`uof4dLwV=^LA>hj`rvEs)|nA^L1-$W=H4i3$u_Au1(wngA=h1k+GmQPP5XJS4i{G zn%bDMx=}br#3K0{jXnB9;;RQxq3;C$3CV+~?$>n;(>6{A6jQ0G$lqcpf_&|8`Z=Jnc6 zEIcAoHC>~B5aD4z^k@Dp!AFZIkj{N^Jrc!#BzT6u2tH*pYIgu};1cW&4(gKfnwOkE zrn)vf5WOlrkTevYAHlY0Aw)GaPHbXqBEx=&+U@6eJ|K|hgDvnYWQ+-9 z4VB{6_7}ptp4A_3wfkC1oi@$_b;uF2ER-gT4TJrb3wxY)Ln&rXD8zAAN_aJBJ`0Pr z2dd$ggtQ!ICLN~(wSvlV(yTo>JSGw5tdZ_FhTREd7h=3=xNc(FZPMH!bERR-EIdy=AE@yHtm@&t#K=-qJb2W!^pxp1!`( zq8BAg=;!T{i^pX@AnLpaAm8>*yL=)>* zcFL`^yioGf5|^O+^m~{N*qX3}U{^dhiBV~3xEAwEO$60nPJ>Z4hjs?Ut@>D6mm4>g zU39{B+=JOYu2E(aJZhKLI?<$}?1imoe+G@0au0NUk_P)l;XE+Ce*bKzWI4Cqf9huH zzE{aH+nhrBPS9!gYu_cE=25?C4ysS3CtbJm|vc0Ud6*3BH4YLdZ zuBNezO=bdHpBi+EcRr=Cy*=nKr??Mu*AE$0g%%g$JIT?;&o+ z-5!KWs3%8`Zuo=n-4xulWb`OF_fzt(xWV61%F+}=A75GIt&;7!wvYF&#ux$O86^CM z>WK%pgA0NC6oN}+Dg;BuL;MkB4g(TX_LD}+EJp_cLkbmo6!OzDxE%mbZM5W$vw%Ef{~MwT5m#a*_D_J`CN46xA$Dk*D64xHc* ztjz6Ul>@xT0C>UHl&zw0LPnRBIaBHC1_dqEVE*dtBZJWZqRPq` z_2Ua?#S+ko{dFr8U+J(eB2Yy&6vPf_Zm&`_TT}jS^JhtQzIbCjUFKZ`!l_Wiq`sdk z@vm#<1KA>33WRjUfc1>Ew1mN!-AAjTVz5OsV=`sQc14Isa}bi|eCH2i85qHszS5Ch zd0=xijHela*!HqjFE2(hz$Hu)@)G;O*tW7&Hw@i?@ok=5@U_WyTZkuD5K^vu#Ehpw zf!Ln1RU@N);EH0KO!Wu--9L(U37M_|?;W+VT?06{1dwrM^XF$pVc55_bnAbTuw{*a zrVZW_-P_IT+3igc&K)DB-2D`f()&d+yk3fb9DEnTBqrDIbdsd7Zrp7f^HE!g|*%YqGL*R6Eugm)stdSOZ5@98YJGGE`PuHWJvg;n(tb?whHIV zgRbQ4Zy}D}LL|IdBaG)#R+H6VeJAg}gLCjX6LW@x?*V?nfe}&xe8ja1%t#Jw0^K9$ z(+V#cgrqWjV|tLFl)SOTvgECO^&1F-*a@;#42)_(O5RyghbP~od``Erh!*6KQXBDQ zUti$0CY3+wPX|$Ph^s@9VD2@g>_w4Ii9)4f_`DiO*vUej;`&I$v*0Am^6kg?Awf$S z=;eU!F{DYphP~2FNTTv}Ptkw`Cq^l2lZ@l@${2pTC5@a20}7R3m7(G=mH#Kq)Je42w`2 zB{l1Lsa6IT)5o=fAr8fE(vF!hShPouv(**orVzZfjaJl1w^fZfqMFY5;ph@aIIo{* zZz|9&=v?g9lRbirYc@G2LQ1ng72p@2=+^S1gqj&nQXYq-*sUvDJW17i`S2IfyxMP` z7rRfGn5@E}X|b$WB4!y@SZ1o4<_IkxiA4zewd~$fYWurd%hH;BW$cyASHc$KkrO4Q z2P^%#F8i^H{zWw}t+;W+=mD$~%WnR%)&ulsOlr;>t*kx>RCo$TFhiM z*wXc9053}Kq~mZFRE^8|I!i(QLfvsS=chYhkxKgkJoB&YrP_to769P}T0;{gcZTbA z^QnFubyqC!*A+v>3`Lxfk@l2_(HEKCx5u5l-Y=`2-XDWHyzj3*yzf_uygo0J@VuY5 zm$pMAo+|UPf=-kjlq)z+Mskcu6M$j5cN6ZR4;8)cp=h0;E6GR4gT14{kKV2874J;q zN7Is((;D&x2e}_s%fUh%+P^NI0W<2H67OuNP14mg$OUDu$$J4liQngw7KadQPrZV~ zLfIw%1f85J$0?Mnj~F=#U5^elKk@!u`^m!fTgUqJ}#R8T>FtE6Zv{x^68 z`Nl}oSTcJ5cJALxQyf-1Ga6^S&!3aZ38j}E$edxr?uEJp&nv>zV5w4r)mU(Ftr9T~3QSZ)}&927^?6<5b@t zWU;G6$6&jV2) zL!4_3WZ;>A7;o273iv(rsN1_2EbJ_tJ%PDCRe#{m7c`+yE>j%hdka1Dx^^qtF+8BubhLqC56M6@1ahBa~}|Y4m*9;bP5| zxzM7!!V}rD(i7plP24F-uH_9;QIA`gGuLq9XP?Wd2LA!ADbiq`Ng;^zSnfQ8@IrAM zW5~2FMjlPUMRj-;*!DP8@7M$o~j8yB96+c;cGU!lor6@tN}c zGO2&ht5A=pv;9}b#{R!>`oE10fv(Om5z>qmWEW82qyfv#fNsShvVS zQxb!j08<Y|%h7pmQH&EIWokx?BySxd0vw`vRm388=zmE1n)MW{952KuEgYQp{`h)U2`9M$ld5M!Upr#4> z%AR!?3Q>>sf|^{(rRmH(M_}s$BLst#_6AAXO)5=v zf^i0m;gCBYaUr>2;-vY__5*3Jml>a0;Zp!V>L_YFFRHM!zIfWF-1`fpe}^$tvC!tf zvPG8vgd%H}fax&}@{Bda0C2#Z72yhz{g|$e3=vD6bZXQ8vBmxykE4Dx^5!k(F+)J0 zcG&vc@}S1?*>T{1qDc3JVuyO0?*EOV+`psv&|6n@AS_40@$l1pk9?sXOntHOJ4Xc!|Lp;m##xak$Db;% z`dwsJzB2dDS5w)1vR%4)56qthuLVC1tsnTN7(5PGrn(sAs-OkDdObMpt+TPx!ou`? z+(d>(E2K+nvs}$*f4ipiASeciy!z$5AK8oMR;z1Na+W?BZadKzZb$QgSvxm5LJWDS zMd(eOe4n}>a6UQ64*1`C>~Ei5zuu;clQbjc97EIc_`ObDC(Vddat@qUZ-7$w z$ce7qhS(FAM|p? zfvQ|e=JXOR3^|arN-ge9TJ3}?WhSR%6lq?Sq1y+VGz8OG5LbU+KZKk4R|M^ zDXF16hDmd0VY-D$mHV>XQ-_@Y6U5X17euMQ2Ql7(0jHL4$4&r`s? zKkg>MRmiEJxV9zkaze+iEfsl&;`v2vz z|5qHt`EMAC{~zu67Yw8R#4%(>fPQJ$^-kq}jpu)9$I5)mV-(66d3VW|c67*AvVSQs z?3V&3qBxFiBhn{Ffu-lc@72sav6)U7S<;){W^42a%dHu3{bh(O^?psoHvE>4_+JWq zo;rZ3?s3chYc~{P4fdVmh>-8rQ>hOHv)xs*=i>+IY&@q@D1oJkSDGSeUKB`*bOBL%;r+udE3*0jaRx6!?$g5yYE8P;Y z+T2-sa0yxic2?I~X@OiBVir=(TEj6{evPO;#hk{l5oQM!Zs9MZikI#;{J>6`alp?9 zPYAO_K56L%j|0j?`kflFxZ^PFhBxSU)KbD4ONSBGAZ0zs$z6HUvYU1hk|7CLv@H+tfO3KO@*-nU$SF1k2N z3PNR2W8C@u7&Nr1#5L%OG&B`E5|yRzJY7E>>zy(p4$+V5HuW82=|~P{^$5oxd5;pt zB8TcPxZ1KHK%(DLN+)JPqa@M8yW^3_TOcj@Y@rdxzh0t+Fy7%k2Vds0*7ZjQ5{E{CZ>JJ;ir5k~2Vs?rzf+-v z!s9TWbVzE*9!=q=gvg zB={QegX1)9I3kJdrT6WaA_iZ?^JY9dcU!**hgqosPc6|~HX{^oi3rIio^nydQ?n6v z2Dj%9ejUVLmqKJj9p6IwQ^V4tH{Wl+XPFwx5Z@8J!a(u5J!D)mZ^;oflEHdUWUZUZ zF>&Nu{B+BFMYm$veC`nW&zTlMK!k&0J5YJw4(KiG=V1{s1IzoAZ_$IVt~O;ezZ*pR zEYnlq&0nR5lz@WYy`j5T{4syDHj}Z}g?Fjr`0Z1Gf_bM)&fxR`)`Guw#{U+hgZeX> zkdRBk5(kicY7vUSv+&0(0D>?Fc)J9ADF=MuUEft&W2sF z4*!QL1K#div%6^~8WrdW`0I!Xc~RN%lcTI$!mI16=dG3(Cx@u^JE3nnEJI`UedB0Kb+GH8?u zfulfA5ca*CIw9s-ST;xK{77S@Ky=)0y@Uy9G2*pp1IWsID?kqXD)|aRH3`IHuIH(Fs%&XI(!_h&$iuN7vwYISFoNv{J)Ea5P zx~|Y;oAW^c!s4Y`PZlGLIUbfk&P|DXRDz=}4KN^r)4oxpi zQPkb4k?fbC^>IEQGzusZ(NT6HF3{Zysd$>p5e)G;JSK{;Q&uqc1ncITEmw0REphYC z08}{=W_m!JZTyL3k&{3sm$qY2oa&(BK%O#JHn{b1`|)9>)I&1HhYpS_#yc`5sma# z-FA8?JoR@K)we<=J#E<#|l{SRq)Tv*R+_*$MUqb&UP3Mvyd!BWx zRAImiZ!f1gPWUIP@h2X?7D#*XtOs9l*KfGcrGsn;zn*H%*9#;_5#YH$xMGyLa-u=Y z{hq(DNau&JJgqxyn}kKljLZ%n;>o_^fNui&=^`@oLT4r8D`+8)aoVxfLPSP1cQxlG z>I^z(-g1sAq~MO9ch@EVTT9@FmngZpIAC*>?Y{Gg6Dw$A7E$GU^P=j+98C9iI3FJVu( zccA2pwzE{|`#?`Io`QVW9k)T$@3$U^{WI1cREe}lDXhf?mqKj-$BJ9V@Bp?)a5yaSVeQSKxv%F4}4-xBMx-)_?f}XagV|{Rb2`bdCH6#?#8=~ zy zjolgX>V|Ex82z6=%Y=;U=0UOXg|fndqFq7>rBT4N$(r|MSbA(z<&MBZYxOe3@ zRMd*4YL&ieF)J7B6Jdj2q%nE{U`B`OBasgJUo9Lqw5=YU6PXL7EuXXd*st++Tt5Ls zdrE-6BsBCtaa!4929i>Xm+l2Me0r~tK}K`tlN~2C<<>G6e^aK*j|15BMKOHS-N?k)wkgo#+KHKfc zA?g0!ZMhM?d&^G?8Jou%-n(qemYE4BW31D1L^crC>ddwYSY5x{wi5W{V#Mu2hXJ0E z^Lnp1F2x>ig^%Zce^J%i+uE!;7Dm;Wd4jE=i#4TvTS4b~ZyCTXX+47u7nfMr&`3NyJl`d^Fx+W)e z#g1e}6~E_Cz+>}ME_Pa)X|qgy$JBqFV|dw%Awu9jF{`u>LSrY>p!t)ly?FFm3wp%L z2P(`-DH1NY&Wh8v1r8?dFC8~6npUZYt*wXV)*9ERiIrhFVA@y%3b#8*?lj4RJTTL$ z28r5uzdl^uV7R>x(%N*qcAS5CxHm}O7&f6KT<3?I>-Eh!{8#<6)BXLmwzQGg+w18# zwO6H5vv8Nw-sBxU{CE{(MdPn|hP0UP?qdWXVSnJ)JmU~(BoOP#ij=kbGO8WmhbyD; zJ5wejc_NiYYlGLMt(F<+Rco0>}k ziXlEUu$|795LlPUaB#ca7TalrR}y0pz$!io2+E}=&N-lny{E|D^me#Eh(Iz>ORtun zC&=d1J6gS)mDwquc`QKaLHa&Nk{wt-P5=QzE7U(G%A6xYqSB&|mg$a~Bm$lAEU1Jb zw0q4|lvHLGUNtqSTf~*9NrkGTlG8vPf<|0hw24wf?@HYH5ngoUp6RF9aLLxubz%oaSw<0{(-W;kVlTk-g$qODrQ zfXuFu_>jKhO|w^0C424Y7#7sjK~=LZ{|&DAr>EnNZZn0iZ)RSM^vw~ehp4I0u(ELj zpCM1mHkS@oY00D382TLUy%BY?ky+V%0-tdg9jrt2cTIppC1cr^@rx@M#Ou4JCarB-8AvnOhdrkw#ow|-5$nN$(-C4Xuo<|av z8F!pNta4LcM3W*mBw1DjvPUPp)1DolYEr~k}-H9y(#ecsJPm)cSvkefI zm7AyGt|eW@^(Q^*fWnCDN=j4e$~%8fZ*M@gT8s8#X4~vXe-Ac~Pnb${$qHZ**BH;s zpHP&eqfCr+?D;ysM6SMLLf|t>-324(cX+~|=-eR#|IjI1#Ya0QBSp;@TEo_P;8_Qj zIMUZkjqDqx8!1m&KH4`tMHn}GIL zUAXfyx&RRg8_>9_dL@+^HTa&3T@iayR1 z;Hk2Mz?nRGtZVI+o@ABRCYZe|qL_hZWhKmA_-UYl?Tlyd=4h|(?*W$uVIW8=j!ck2l*+?>8+Zt`RcoiNr4<<8E9 zTCrxkH8--)4Q5tuFI%~Hc!u-P8~R~+@wqSh`M0HFKKL7s^e^3x!~_69{vW4yG&Qm^ zqW$alUwMNwHH~mARupgAJ6@REizk-dQ6!tHLFa~XYor=!aa<#f2eML(@SX-KHJVh z>4IstJv#{+JSz5Ir-?2l^?j`l^qQh&(hP=1iAFS{w{C_WTZdl7^R~sc3Pt#_#w?zkrYszJY*6eI#)kQCh&8p(J?V=a{)W3HG>Ig zwggA1i+LNHygEV}YQz;Si%REDOFPT7mGwMj<*Z0%w@c(EZ`;*9jC25tR0r=*+SMx? zY6<~Nnfx*eG#yjD3zv^yFqDDwqtRB^-5b?eu2SAlFb^AOeZaJR@8(JuUHC8%+Z@#zG?iU`4$v?1)8iIn zh_X5vM!<5aO^r9Sh=w)Q%%Ub&DZikO;wkyt62X zo!SzFKoRWb*}5%9#EScRe=rGB5NHnC4X`9EtG1AXFG1=sU|7+`l@^fz*6_P9!;Bp_ z&G#7v$>doqg9$6A3Zf|;>Z3$Hy)(Vd-0&eG5P{W{CNw~gsSFndL@D1G0YkQI8H zewE}~lbN3)4yoP_GC|Kf!nm%lj`Hdh`J|*wGou0a!h4D8dB`>7s`(>b^urR{dS$|> zy-i9O_zwbF+UHXHC5sRgtIxJl=O}gS@{``}C5UnL3y_ERt8e4qU79qn2si>~Yk!N*0Df|eFi12V z5#ScUspQ0#@C$)RV~gh`P_}lCfMHU?%B_u{A_TZ3Xd)Z#YY~F;v-(GnB6A_RFV!O* zAK#&(@XSM+z;3zd*;bUUvf(<-;8Bv8G|Nez zOb#j;Qk$hIu(63*RNap)>ZXXduD9B1USLjC2M;w*Czeij($N=~D%y|4m?PSC!bnI- zk58GKu;tHk%W3GgDP`|D30+Ko&fXX-?#qQP>~f%Jf+Aky zB7#8kI%c=0z@ihf4!4YikeT4Zr+$0NDRgGY3aE zOCyIr^}#-sRqIujZyk75E(ng5N4mq+FcQKzKlpsD$$r5sQB%t?$l-E@P3*w|zd(UD zw89<<`*L?}n4fRx@sckm%r+~<(A-A4y>)!{MbDjy^%gn#8%cr4SbmPxQja;vA!rjn zxGW|!R+p>eYk#L;lRl%aI43<`)EPIg&wnxxtgZp@TMTWNH|KU*=g`p$I$^9Hz%~}g z$B>_jkJqRq77;FIr9T17V0FeIShGefpuz*{`Q_QH#@VcEkv9}0o6`U`+MvqgrEG^k z9phIViI=lx{#Fg+3}bvmh$Lc9ZZ22C2;d~F7K80$X>m3{GXgIP;K578Yu}#b#FZZJ zSGqFNA5_|h3*5ru{t^?8=T=booz%INB7MHH3`-`z`K&(vwkPxu$le%6Y!QWhBPJyCEw3=av`y9v( z0TX+rv+B_51&D zB=DGc_lfp2YH?cE9x^U&JXh1=f9;`Ko)LdIlBbRI0!v{l1_3wWn*#UTHd(@#ck&-T z$$Ilz2K3Mp(TLq{^+3Z1K0^GC{6J8(u=6qvF z%^J{?nvF_XKKP3BQ;i86l%+9XCfX!-+yf0l%U7Z<`^23$c`5jTwdp$+7{zS4JHK@R z145{mDeoeBAnyVzqV?P@CT{$djTMpDStiZl;q?v!bXq8DCfhc|4{7XibZHdrG4yb% z2cXNH!wt$0KpWTFen7v=;MtTO2_5GN=K&p@0i@PNvvJl$#-#N|Zn%Ms*`dcY%e`l5 zHW6eK23%ojwC8Sp>@IBK}8Y>84i6 zrr^ouyRQYef0LC;YS-*C_?oIJkbm*PKe)hD&)&#T!O{Lt_4^Mctf@=ctcqZE&{lo& zPnmsf>KU#sYpT*>OE_iw`1Q52vn>%&Se}5;Ues%@H7<{D* zym6hzbLpMYqb~2Wicv6`f&G#UbXh^hZo}m3r_#-YEjQmKT9b5<5m?{Dm0hPrYwS?6 z%p)jrb@X{K@^PahbrP{ePtbwOlI9ScWVo~S=5>=AQNTeGJ$AoMxcE~#o6m97k=cIr zR%+~50(ujs(I@N*=ni;+F~TTQ@hQqdSbv~j=`vg9Y`dUj;;oDL?eiLbLu>GXI$3fl z)qzSvNPCTt3e)Cgl7BvsmKuev7!h#+ZW0sZk`OCGZ8E_+e#o;v$&V)WDG^^0;_p|$ zers7@=Y&HeENGhbDO*)`3}cJRvq0Vl#z2lj8oojAUgE(h;1 zANL09Ii>jZELyZ{DnAHHu0MkQ*%TDFWbnuVR&AIq1ZECo6)7nJo%D;=3R*TroMOzT z9+$iqTS#yim|n9<*th1zl9vM4@#t5Mij_>lJe?A8SGX5F7bkBj5G@8Z2F!?4HxUv< zy|#!~fO;$t{uY&162;P9A@rbOs1s9}u3I>yf`cpkz^@VB5ZQ?YO106(#%zLWYz1vI zDX{_cf@sZTUP_^#_k#(bugsmke?{)38`W%~SA{ec`sB6PPBKDduWBi0%(z0Fro=uaF%I zd_E}UZnMqVfP>Xdrj@T^wPV^$fv-&ent&fWO0L7UMya_hG%n=%tpKNERd< z7tE&=%%iBF42xC0Z9NGWtg^UVZ*A8;^lIMLo^ErHE;)JBZmF@BJ~y)**SVfdS95!} zxY?YWe)F|DE^xAzE`MsAzgP0@_U5>2b$kk*FCinNd;0-rV0qXbhjl5;EZ_DoeyJBN zdR5nMYTF=roFAIo=3HD~TPb5;+-qcADz_??0pDL^XcP@q)v9b=J3YI@v=wPrp3`72 zJO$LX%avVo)&k2|Cvkkor(o9`3KX7+XwF2anI$MPVE=J2_K2TdL4Ytzh=X zo7t(-Q$b4<59+NjdIQ%u34~C!3+we)$*ojbATpn$C;d$~?C%TdKr6Fn^HXZg>?zlj z)>Wb=sllX$o)|HLOcp>6I7}VXWizEiWtPes4->(kuhBcx+*$~lls~Gwbd_4-u%Vth zc!L!X%)5L1onLO_pK*aepyv!tzPf)D2I@z7+xBPJ>|>zvlv^m-1vGP*qf2oL{q#ki zzeTnjhB~otI!K<%c9(w+g!(UUUwf=A9DMSD1;~1=mN|Xi0X&L0wcWqpT)@X5fQzC8 zl);0h()js`A%Lc``T3syYy|v#!w^AJrTl!!ptykU!9n~$prH8!ea(UcU{8I)LjEz9 z{c{w`1?5)+yZJ&5S!BX%SPa6`b#ek#)xrl*UJmnJ9K_dk8vHqA)>B<*1Pq}P2kJl> z)N>;1)r+vGhyaJy(A3bd=dvDxl{h^SrVKm9v-yM=j)3lE{OG$ zif_ninrd%uoG*@!VQIAoJeYPQoUi+7wToA!Ew~{Qnks6Zi5FBjcSg?7tFyg+NjPo~ z=g0Z+-R9#0n;etrueCF4stBeEi*_hQA4RL&MswtBccu)iMiC{&&20#u>iD`N*5Q8P z7mP$m#2AXQ8ow*>xV-YOBPJ;$H>n|M^|@x&d)dJCWG&XS{Bbcq1}wihnnwhnbivuo=Bdr zx3j%_N(JfAmHF$J0taQ1{cg=-W6BznkE9>5i+>Z8yfmQE{QjB2|4F(1gM9mwL;r6! zp0kyu;J=u8^wdB5Kk~vh^SrQ~KWJIrX!e>BCseYbmpdEm&`v^qd3s@v1 z8iQO~Y`9>$`});5;r`$pv{=h7-sPOM)U4WGsDEt%BS{c0J=m$<;qLX!i*`ypYOZ7h zClcOcyGHhM`E??$h+iBP@H{>cOMk2})!~ywh|-l@7%^LPHVh4mE-mOFOh_n==gqqYs(V4jzvrM#4J1S~Yfh@hl#WP^XEBj} zoQ1*g6_SwPW3lWOF~j~BHdZ*YdxVzGB%+WBT#0BdEYN4cdzgpnsgUrB@iCAS8m4A; zl(Ea*L8z+ukl;DJq7ka2s2Q#%DB`pmXN|uw7y?=!^7H(8r#XI5P-q6Ww)vmKg0%P4&o2XX+-%W+6%}d5)`WZXe>=nj~vEKt6XmtP+HG; zO+$NEZiIg#bH)hISM!uqPgnDFq3oYID`M6-w zXj(Oe#@Kkzs09NfdB}}zu%49;Cm|!(oBoC1-JyP}3;}cuNY^lq)h>Qvh&HioxW?jq zk$UPkQ*a!#wq=mv=#_D?sxBCIs2#Eo&jo;9$w<$Kzj<6zcxB;kP#h>e`Kq>QQoiuueQ))hPN7TSqHY9$fOdCvStioO&FVMgwsW* zEjWs1w8isE_#ry~JSAJ?ZkMlmhIEynnYf5)h#%wfoSuGqU*}{G$2=t&FVDFdNe#7= z(3#8~G|3t#-J(n%XE981f+~PoMNPc$xqq47y_)QM?Fw`FT%iJ>^7L5^E&t%l;htT| zNjD@-$-s?8PD#Hu+LRPoYXwfkMZ_>+@O3!Iz`K*-r!b&wZU?@3D+1{~>8tK$4WQ=G ze%l*Ei2_oYCVitUh__5OT^%%)1C8^RZii-`Sx z_nXE#)86(2XlNW9fh6~b>-}zsOEb@>_xn8*6AL$%dQN&^eIQYm*zsdPqHWU+doq)8%X-ckHXXcB#qF? z#j9-n5XQoPX8*G%r2B^_j8yD3U;puhC~q+9lf5V$$w>odEb+Kfbe)M$u3zstqG^6J%BYw-fn4aFF2wkA5#loV0IcZ#4gh8>m7 zjOWToTTYSaD|>jYJ;)F(wMpL|#3BNRV`Go$ktVjU49>no;he}3rD$dTOh~$sA$A9* z5jhZ>V<^Olt+!<97z5F;a1!n(4>J~i2IqJ8#tAyen9)e^86wZuv-fPLK?VFKBI8X$ zb0eblriJvkzLx>BPfT6atD%&)=ZG?!Roc>V`+L`{-Y}>~tkD~UdyLyyn*y!|VJ37) zL7*B=fWM*-4ABy5c15ojvp69-Q#qK>K+~#d9wf0oBsj%ZhKhn%&L=nJZIVTZy2x8tVr1v$)61 z8fBuTOUorCMA|AD#>Msiz2e9yVlNHnOF4-Xu{raNBd~i!cuFTRSv~X`U(pbQ1>f+3 z{GOv2A0Lu}4c4tNvr)Od0_!1mTe|Y4+M3ZQvR2m)cB<+}4 zQsP%`+cy0YXyev^`c$#}@lYV(?iA3f;Iq#F1aDK#Zl($14lx?mU-?`e2A67_`b&gw z8(3HOT0614!$6ZJ4*6a9(^!ETwJ1cUO7%?OvGq;+79Pnx0CpgUw8B(RI1H++h<0B* z)5Hg>^aT%=E^BLs;xGGfrVvEu!@_2Q>SBRE9Flp5iGbX7Ip#+-d#)2HllLNexUXVN zu417limHKhjvE_=)a;24nXoda0ox^RIFIlK$Msz|ZqQ=(d%h;l3FfuY6x9LeR`r*b zF+La))N9^g9gyTC<@1OE_x~4`nIprydQuA=&9|v$xSxsYm8eCv#Lv z#;~4*_ND;`GSGAZ9HR@e8m{uAdnqL97e%hPuT94EGzpH@P0dhxVF4R3)BB^m@YGJF zABeb809>m#t`{Vkpz6~-Tsnn~J{`>R!A!?*j$q;Dq&&hH2K9sx5Cno?;ofiM78$EP z08DjP&tEKd!NqozuYxrZ8EAoa&{&H0m$@1FTa9diP$j4%&V*XLXZHYClR(8NRO}id zV3ByaPFES6X;ewiCSKr_Jrgs~;-H+8Y!ps8LsN-0-5p1vp%h%j{nMF#Hx*p1adY7z z72trGJhnRl1F)cM`4Xo6W&Jy;<*^SS#j^%G!FIAiIgQH0xqvT-qdlUi5L05l zUQ6UNv>;#DigX`zI&u?8p6=W%pdE+yXqJ;+ws6vu(F~eEAVO1s4J{>aqbU+6XjI%+P z;jR`Nyt0XLb`PsFW`N8XV@NML`*_$>x3v2_SdB^Cz<>qUakVnPou|1d)c{!_u@Q0F zw^DbK$W1F)`#BVBQzeT>Q&Rfwtzi&vak55SRd5r&GAMs>Alj^DL}ddf0wcVBhBmdJ zXc@l%!q8>USMmEL$@SOA=hr(Aw)fZh?r_e{_g8Z>&A0b`e|vMa&X4OK?>}dm8Jwey z9}_=-^1*WyR3L_ucrlH|iOM=P%rm6V+9Byj-Csh?c`dHTc(DjXx* z;6u=fV?`-fH)xb<(BG6k5l1e#|J}E)6EgqrF}?j|OizuUz(4$Fz5EX=;y>jc29zeP zF<4-`Ku$PlJ4D(kB$|jWtan!E^l`Wc^NwZ)nz&puyIR7eOkhO@h^4TpUE% zPT5e}^zO1c1g*2mDb_ts2u?*@7xwT{SC6YVUg%b-t!d3Nzc%t)Ez~5M!7t_KZcYa! z&HAe>BoCO;=(-e$JV3jBvUtblY4aomZ~<@AnMQ7xVA#XV5=(;q+-g$|gwhv~?4Q=x z^1$%%h}AZ5FyE55F1-zLP=`kjVQVk=zq`Q&`#{){pRpIv1c%73h5S0R;uXf2&}tv% zff?gZ3nE?ZaJG543yQ5D;~NSIphLYKkc?PNtHD&~yX*A}Icx(4{)!iNpA3+7&X~m` zl2B^_Uoxc?-(X-D2O+3Xf+pEutc*p~sYUu#>+q=9WF1sL`03Iai`y`Mlmd zQDt>K)fgR;#E&zL-J zOB2zrMtuTRr;^3&9OF$qcP{}QHk{259ZR^u8}#ek|IfwzkNzjF%|J*iBS549scr^A z0vN!H&OL%gt#Y8)U_V@O<1W-fd5y#L(T;YUp~i#qxy_--1hS2jg`q4nk>%Ax>qADM z!M7b*YfhC4i*{M$7v}ff%jQnj@QwDOeB+MHS2>agF7+W!y+ijSpZCeT)sbg&v9Z8|jzWg-?4_^!*AyMe zX3dQSw4ymc2qUh02C@n<*abUb2zeJ*A&J;RO+>-I0#y(vB2uvj2_bC9{u@G4PztXG zTDakr9kVh0ww>GJ+#*2&|06;E52vAWcauwMwlQt|5#*MuJvYQX03r_$xo#w#Uj1H+ z>@n$yh+hI0^_U?0z|;8L!KQozlf~}9!4$YIllH{dOj_F%d!vJG2mYGJv2pFCGJ7I& z@lCJ$`+p?v%cf?EZgL?{EaZJ-D3VV6a3)H?0=!fP_rTJpKIVH3k<9$OPdS8}8|iYF zwmhaHDpE^XMF78VUeuF>qI1g&Ev9T1AW%jpV3a@^OKQi;M0TdBxJuYeyDuJd(YMW} z&7p4pcyz}sx1%Pvz4?msE7Xl1Vsv?lt+FS`o{?aIirQ=uw(88V2fG6tV_7jDv90)S zYxgd+`bv?wF!-E!Xe5tFc5??l?@Lj+-7e{}<9aHEG~&ijl=$0ll?u&NQRGXDGydj~ zp5Bo!%O>AUgE7R*M{nA9-hvvQ-$7;_5|pG*Rz3L(+Gfv(84vB^YAMbGCpmnshb5R z8+o5)qTPr)gRYz?7!U#{VkQ%`l9zV;ui3{S)}|Vf;04^eJ~n}{2t;v9`OvjO*r*Fj znk;5z=CxcVZ-C0$yhWUqR{pREWN}ON(6t8GM(L|LGd-gMD0w)~?HFlf(uxX`g#et2 zKT#utKmq!CU_3WJ6>d%_|jx-bH2$gxS{KbfF|DiBp2Gj`t8Z0i49& zBGWU?3TGg&kMD0*KY+E46KF|dD}h_=Di6I-2#F$cwp9YIk1?cUj3=WhGMC>ik9$UH zXe8n}E<(#y{8ou$@)8^`LdGF5OVn79uCFTJf-j-X^6+Wvp`lN_#~@k%uMrVw&UYA=FWnbXv$xr43cr zB#gV-vuk3@)e1Utl-l!Pc*Znr!wXK^XAE%_$0vhL-kFcI`gY1plj(hO8`ArGzcu56 zK}`D4HG?gnu75-5Nb%ME_Iw8Uq*?SycqXv)lmRx}w(t{u1K+8-pJ}tu;RHiVA|2$y zOU9sfi7?00q@kPrQie&PR8Gntf$P%?b$PPz7FQMj0VOr$(zMqr@9ay%0f7hny#~ z=KK?C+do??@@EN>uxPK2-Htc))mkMYVxX}iL7Yh3P97G~^HteD7(s9x)DK30wk(iC zY-RN95TW#>6wb~TS?KUjj6nSaA?R<|0)BHEoa7)Z93`DU80I@8b6m}kr=qB+MFde9 zO0A-KG$fvsP^lCd_vGz%BxOxe!P6F zcFxNYMtGugwJremgiMnxa`JiLHU2VaVReBs1*tGN;y*yGGL=p}0({QPOV6aW;7jcY zgu$cG<&o{5o#i>K!e)4m0C3==BIrk0j18XJ1B{cQ4e*rA@x@u77q&%dqa%qLBM-8ZdjrfOdqVb{4os3KcrXgc;fN%a zNUn5+=>w#}GS%K4IoUaJ<2u__+@6AJ7n$wRY475#L=K3UA;9z3-6b|t)jXZq-kmKU zZbwc~5r_1jpEg~e#QobH6`;)wZC@YGZ-<)?i-VD65l$I^(i5o5@M}(^O-TcHIXhgu z**KVa@f?eAZkkc!lFji}MZ2(fV_~o*Qp%gmr<2`N;u*QUP90bH3lysnn#F7KAb?fi zdbCmoN`L^(HBNw;c^C^D^Z}6YgE@8`MgdwT*RxcI&lpZA7r^We%nlzv%oom;Dt2pl zGt`Wh6qjA|0;IaK%udd841C@-L7;yhn}84lCjtLh57qzIdKmwQ_00TOj~}DHg$B70 z9Lk@Na0w+L438|!_9xXRVml9Ve?WK=!dQ1Q{=J?c0VUQuA*&Y<<4)-_UL{=di;Ig4 z76u#RWh#B4o0J2~vstm^8cx)R)ZR9?yC4m+t1e<=Ev{y%t&$Kck)XG;)Wy9L z!SMxRpus_S05|Q{694>COC2}Zot5^Ow?jWnfIkqWtLxQOCp>h&m~F|s@HVa;>jIY} z3W;+B4)MqIm9+ONjAcqzH)Lk;FGI!mCkmzw5Qq^bhF?mRvIi40swG^+j~Azk`%M@I z+CVl~fcB*U`-8AyR+Y`go=b4#3MO>R>V13=ZnNknP1kFD`eYE;DGGhIXgsadk#~6?30|Dk4 z3F@#7YV#N`1$7fBCMAW7H#CU}8bc9QF~cy%PWu*V^FlC*C}F{**V?XyV@=`nP_aAT z?yS9?`Ki0T+T6c?8`U~&*-dPuj8&!;?65B6_v#JoL>9f zL!CkT+*1>L#Lb>&yjG;#M_i|%97EJ0CtFXk(j{n?nJxpZ%fTbLMymXFW9HP|Z%Suei+l3sO5keE~*?rZ^5 zL90x5y1hVB-$dY^8yfrf&S#e!`(yQoI2*|EA4B_p%Crq=a5(Ibz)fi#e)BSr1pcN) z5_|JQ~PLXdfs8RAKAXF|7U$@L=VFUEwkW zJM00!YPolst|;+v=bq5?y0xpn>X;t?EML)f2|9M+cy(6WsBVf`-rW8&-jHa^@=CJ0 zu6L@PtZvV_^LmcR(D~Xs6Oi+6_Zhn{2V}B*UfwJzU(?doyhxFGC0_R!q}~R&lTFO{ z>+h2sgYvGGX7UVDH2H>q^ZBBmP}!uV&~Nmb&K@2TvPh4EJborCaIZ{8Kv05Gx1c&opEaNjtOwn z@UVHh9b2&@ptn<_Qf0BE-?lw#^3MLLg=*|#6P@x-PH?quc05w$`^}qQibVwkqLYfF z2J)`m641)C5~{Kdg+=9=BGsi+mEGvecJotSdn-sD5Tt0k@($*G=sH@P=sJ8)18U-` zy1lE4TjyB9s#+TO+am|&?(wZ{9R*%_%_T(r(Wdk+zpDOqeTj$rFXhRR*HjFBi+HdYBVy{b6IJ80 z__$$uh7?Ip%KIUrf@q^7YBc)k=6?(jA(Em;uTw<#^wTIcl4p(Z&1w|2YB=7oueCD7 z9X7m3;yI2cw(w}#g2E(mwS0y@NWT7%$)>oPY;h z00k6!P$s0YkZc)Xb`iHzu{vpMIg#Qp*x$7qeZC8<#SejYe+ciYp9x~Q4e{Jl;(kjB z!79xO79hD;)&9C6)i5D1V|Si=LiosEl5q&-Gy zlK{^>Zy|-6kSE$6c|i^g9Ai`kW@w7*5fXucW4k;#y20-ZRQ4lc$%@IfTTra ztf&!gq0GF!U_noU;h_xN*)1k4+>x%aBGmh?oh2(r4`xOfTy#x_* zf@=AoYCBCsWBXx5m<~i&tz_m1l{n!9{RwXI>Dv|lCd_;O+;CB>`Hk8ePcynM89hpK z6B@4Eo?`rgi61G$qFOkA!yYMbn;v;`y#{sPt`f4nYtkVzX798)+Z`|GIs{TktTtRa z*83`ifyi96Ab^C2ap|CC5ID64o>niU5m>Y!aAZY~acb679TFc!6F?z`bN(xPKDkk^ zxvanhssMzYxc<+hBf=9X2;XmwH7f-^yC8upV*Mfa&EJZx!Nnk0I{6nskl&rS37sy$ zx>6bQ1@6}<4@%XM67jc)DdzhaaX^kFkC8KGH^a}rWKl-US6UIf8fqZ zzCPdT9aw(nLV}@l3G!Ym5dP28ab86^WA0mYGCMXEbfY&hJk`w`i8jXQh_3^qZij;V zsZTnl_XOvpY9K3M=^YGOmgs;|l1ImHiyaJTBPydDDx4>x7C^?&)jQn-N+*H0j@OZh z?Oz!@Uh)@Nmcm;Q5v6p*(kZze^dBF#S%YL`4F^Q+N9T_WKd~L$h|I8Gy0qtk%+Gs4 zRAzX=p3epL4tY;rh!d^y2B~xcLQYAXz&@;hYELq*7)n|+q}5WP3N?16K; z%Qp5yOIf)+T@)0U0pL4QF=2!7%G-aufEQ)?2tPz62@Cs8e%4QYNJ&|U=^cc`-W8gg z3>t(8R^&w-`oy1ee2KijEeNYeS93&pGR4x2K3C9iP-!LH^GbuKL=9_L%s#I6r;_y_ zzePB_UufU4JvKmG>dx_jUgcmIFT|~kwn1Rvl<;0?q?mn83a*xi%0Sl!L3tv9g$TbN$JUH_uUMd?m!d$Xu?VQ?1#9?;qNI5u9E3uk zr~(6}@oUgM`2c27V_0ayCjOsMFgh_!Gr$THe`^^+2&Pp|!K3L>-~$$7H07&t=2vkR z1Y_31Ra=XCgY}yaLZTBOzR6_@M~?6|pwzsJDnR%p(Bt%bATA8w2!q5*PgI^|pl~wg zEARDlDY?sQ=+dNCPHA_7YQUlYSTBXU>j^>m%V+YB8>v7+w!buRP3gB|6|RJp9u}XA zc|s5*aE0cNQ3ZW;oFME#;Gd|zxdPhQznR|ZX?(j0i|}S{LLdo>G|LV}tzZ9X__wvy zfXno=3bKeJiya@Xx3h2gSIC_|q;Y4Qv&R6;?c%BpYEwf;fYlHwB^Tt5D6 z9$H(~DuSh;6J<%;V(J621?L+~w8tn67W7Z)M5q}B4X zvlPFXT}!Tw%7^_*X}4B??UZ^CJ6A~K?2*ny;5NrB9^-MD7tbpoj*d?M5(}NGJf8Kx zV|qPE4Pn*aU&|_XEGn|kJ7vDhep%Ib*V!sY&^CW}(2yx#i5e8KwY@%d)~_#ebf+3u z@gPj4iT`Y0?q+Fyqg}LIo>(Ehf82FVrh+dxAD-Q$SFVp{SLk=l{b)m|e(ztJm#Kt% z&jQmRRJV6Of8SJ0`@Fy2=lFa~>-fBU%x`}`#_)XJ-pBCxe4WyKe;vcjh&E|)BN>?} zbWC@vDapJMWqbDm(*Z3F%8gDg3aD9HSM8`B5_R~s`yJZ&tkvo8aBc{ewR%RTQnUBG zy&@E1w!PfIgZr3bT2JzoS|Ms`r52a(6|pTWQn6$Ntl#bAJE=sc2O#z>VhU#TKY1?X zTA%ev273pXB#*D(9kP6sr=+|}rQAkPa#DK+*?xLI9sPUGrBT;ki~65z%KT3@<-efU z|7I)y*Umq+lK;1MD9Zn<9h&|R?NIFhOFIoYL;&1ztq7dB6TAc>F?>qtV zwao@TIY*eg*nYR`Nn2Kqu4an=E#8F{^e^!)C4L+qy6a3?eZR6uu}W9|=Z!g!gcu(5 zYkG#YH3b1!-c>ki1odBv1-Lb4y%NSTj)O?<4p!p8EsPbo43-fyMUZWJte}=gtmBrw zY?({gYdf{ye#-QDCx)8E1@G`Ja*!{Q6g%MPGxVP{r9Z7;q!z`T)aYO(@PIBlH_$zl zP2=vAjS;^A>k!Lkm5*%$Vg05YIJbzSS>;e&^A7xZRzdr%_|*^znkq;wA0s8)bc%wQ zAC;{g)ilbI6KpYC9Ht(An{tlbi*a5&_i5y;-&q$lCzL|l8MhyQ^m{k^?BD*zeocmc zpt1_Mby?dLL&Rnwjf%%uy9zNY&|9%d$}iN|OP*3LG*s;kln3wxkuPOhYeaTxES<{e zD}o=dobIxlm5W4jxwLHp)TbDBYlXPIo^!v_rHAJHk?txx z%djWU;OBlg+thOjadD_kMN+foSw<`FVb1M5(z3oeTLtw9y?_t5ak%aR-5C{Cw<*4) zHa8U@H`qm}lGuw3M9=mQF;pR~OkT&fGZmi>O2k$ruahc0hsKcw_Y@Zlr_Upy-Vg5T zaq%do$N4QevL^gnp6RqTF}-+8%BjhPQQ~7z&~B@T;Nw7^K#5#PXmqKDJnv~V7)?6t zLvgqL1beuX+SyO%!B&4DF||GWPz&Zh=7)JHTUQpTij?Z6m?ELB+M{hx(_*i#IhdxY z7x3~6aBgwQjXql^ciuZ_R;n*GRVE~gmgFN>gPsL{x$S-xNC?+;XIaw;o5t3#O%<}( z@bnt09qLkwA4yt{MJ`HpUy7ph1{vER*`VadPxYFU(YugDPo*!~6W3Z#n02%QAwF)= zh3$*Ot*CICkl}Z}AHMD$D%gLnSGe$eEjU8Gv+w}u8%M(thb;SGW_Nzv4?c(F_;h;T zKiu8yh4i~@V{d(Ve?CQ7ID3j;wS4Pyd5H)(%zEqDEys|P*#hLy>k{&?@cVtr^VZrj zbekQqKYfm(>>yT?RN|aC5Ff@DSuD5Wq+UaHzxy!0{)mMBPcmi|769YmPZtC`mH#&M z|F;q6Kl_plXpUPOh}myq-0;}8n4EUu1jPeS%HQIJU5n5__UlS0hM9^j$o?(AQgho4 z`fX!;8fCJ7N%`^n3%}qP$1@(y&gq`eqWlj{B-%u&tF`byUPI?wF5TaUyIr?#ogQ13 zI5HW#8M&*fJlZxk%rQSl5pE?)j2P4Ji~Eyj-tR5kRzIq$)?Z&2*WXv0DVJBr$L){q z+rNT_kLQmzy}uux4h~-5tUqhqz3aWyc>r2BudtOpJ{+EJ4_?ihwKp+=xi)eH`C_v; z|1!r&N$g%;d6-(-*sv_0-(NnKggowV!LL?ct9aaedp5hdE1P$3c%pP>Y@R_Zm47U# zayE+!(MWQBVKXncU*11Ce;>KO+v=;`tEgosPO;-ub(`eDRBTS?WUJ$T1P*>Sv~FMc zaQ*bYac%Kl|9)xNtn_Xhj{blrt~f_ep~(4oz6TRGxrXLo++xZFKHok2?JzMRj53)} z@4|vHvPmjo(A>pk^%dLoNhb|ui`ua9x0`eM%NmvH)vWz<_19;{ys_>`_4V?yaW^`} z$M*5#`{O4UsgZ00k81wvI!-?>DCBBFxb>$^R)NC|b&Y#{mzG!CwoJ2*`}yQ>JC`Dx zM*=^&FsqG?H2PsU1Y=hjvL@K^I~4V^noUX?eSm9Sm?t&u~0H-}ZSjeTVI z*F(oP_lKzuI1J=!9!S%a%KPGK`{t7bU|VoWPLA>sVW15Z)`uKijVJaI+ZdcG9icZZ zqjZK?{cq_Uyz*%ixztXM*T_blafVBS>4PhV>rWGY_k)iSf*^^*{aOtk$FO(W5vFm~YylYohG4T-7nN z!!Zo!oDL5aT(4E7fGA*$Hq})b8PtQX8E_wS0jP773^I-v=Ht898mS>1Wnd>uK^7mc zqm z6+R%c?mw(Ji(g55T<>5F7e5E`Zt)w8FVry&w31SyFO%kPm9Jdt5uY&rg&Hgghr#_? zik%pmF&fo5f7-M^KK{j=zMd+v8uA=@l_0iQ@H}4!q+yU)CKB7_s%#B@1R#Ao0UQdn zzS!SLBd0hvtf~=W>dMKp+5QIt9baYj-E1p2jBy_m|uR!u_cH4m1!RDI}XK0%@Os;G0Kc}d20aL5Dv zKVPic*uFb*cs+e|n4yj+v0O5+C61A5T+u~?Dj}qS1LF!eIDuO7AeaXkJuUeiZj@<% zF!F#S+4-<&A^b2N#rFz-%{&;!OIT3dPo2kgq*-Giu9yKkDuWS2bOJ6R^KqXKrs~DnA=ufgXADtJubYu5n7BKoHDtu+ypmXe*SAu{(d*>YoC7&Vo&AU^RDx4-YQ`Uxwl;K@Wa>)DM9L4thQwVT;wi=303 zn_1_gE!3XPG>&L;M^px77r1coo`c%Kp^`dzd3ss`r=g8}<0m%R@5BnZv`>=7xD9|f z2gi&w0Ye_ zfwm8scnNaZOhcZWI3?HvTb*cLb-lE$M5!$_!)`be~gbpS}x*x|3e z5H706n0ZQCv2E@uU%GOoQ*da*-oOY=1XuR6-ghJyk{!BX&T9b1lMwp`sCE7+7 z_WdqlBH3P)A@tSB%MsJ!8SQ8kh}bK9u`UZz_dcKw;1nz-B?F93M}GnG>u*9ooCdK{qUTLDfEFEvk(O|0WT086Er>-siqzNm-K~)LqCjHdM zLH{QhkeVIp;!IKx3@7%wCVL7QJvtrO1~!C!w~p4IWm{BG6-F z^TE$IH|#x&QNPr1HzJwQmN2!}KGO~TJTf%zRaM3@YGmmUuGLI|DE*JzRGDv@FAzK^ z8V9)p5d_tKLBotu57~}|ZP|GUiAp_P)uX497Vcjp;8+R!!A)dFn&_82XIuc4DS9%o zuB}U7WcyaJG3Q)@fWD1sNarNoa71DgHg|xgeAqHeb{(%G@aLq=wg~fGI!)lF9Q;Jo zsR|n&s!&jN;QGHg_(+DP1cr86j-?lfWiF}0{zZI^KuLST{uBX9`2+}!u-XFioFIxvkt> z>ni0V(YgUE--!97K(Y8*W2`GO-PTS-xPcDA zDg}~SO@gQ<$TNS)9*%Ot(Ve8PGCN}}baCL$Q}_+>63%uUWU_dLZ#IGU+3HJ*o9L~q zSZIJRF?UfEIgXFHUA@30P!jnd1=SejJ7Qj%VqSML`%7D#=|srBc^4BhRk8foe=TR9 zG{S;twLfSs4zIE$kgdS#5*&2%z*ATzmsEx3Xm~ z^dwZ@wx^e#`XDQCqNF%0Q_8edG%cC(+^hUTh|HZ30pwNV+O2is%IypRpwtl!T2@J0e-?7!VZ&F=Uu8Uqlfz!3(?o zUOy`>h&7x+x(eGRSl30R2)XAm9teK{%{nb6G#M-QZCiTqLc1dkMYm?GYb}{WM#xJp zy_pbcq{6DzhgfJ0CR{SJIa$g|Uta|e$w=#T+?P;NqCZ&yr%-KGQzQjTXSYB|>>{(M zjEXTF#YTPeyFsWJk|O~-DE<_0qV`e>5`^FB1gWP<)~1w+ZbgJKG!Aqa=wb#khou-7 zBO@w~ycgi$1>t@!4Fq>aD2Z1^6wDN1p_hBd=qbIBicN`V0k^6I-MQ_st{j^^?L#YE zfOIMGLa?9OryH>l|S2%riw%r_IunDm9Pawoa#`x{1qfW1#)@leu~Y9UXP%RzK|qs&o;@0V@q0)u*x zS=`idQ$-re94YhziP250XHBz2?~xNY_tV{SO)55H9YVdXF(>1ZHfNjKX#U1cE8@D6 z%(QCZNmQ4xI~H-8wq-tKrer%?Z;8)7K}4&yc$Q1XQleK?KGSXI-tKGlrz4~#eK)O1 z5e_JI514V?lfH1Qb)g?t`sayGp_jX2VM$RIbb)30K)Uz3!A!SNFON8QW)-NUZt}LS z6Z9cS*_0*G7g>>ofY2X$I1%4p`7Y=fAi2h*}{@m7p}9tf+; zPTU>6oGCCGp+X#X9~j-oqY)Qp11=wajH2ym>{xL^;SLHLcYh=-tm8>*9m%~LRfu`S zi#|bw8>Ae|9~>T~NR3}ZELDW3i_Fjx?cFA#e@Cz!SsYoVxwd9s0n;dPbuTO@;_)57 zjx~*aBwh=r8#noI#SuaIZHBU{Xhruu7nv2J`Po0{a&*@iVu14n>?tW4xd+xXFjePrw01n2;N&xp)-w*%$HAM4t#OnK-pS%iNkb8Ca({}6P2;;^pDK<;dRri z%#~toCR|O~VR*5GG7G9TY-8?wrHkda1M%K$Cpe4t#;g%3khe>rcyV!AeVp>kReH^X zOQg%8AW^5L`q{hzh4TIUv7j(f`@E!HURfSh>qu&UMI#c6>@<<7dht*6%A6cU3PgN2 zx??xI>2u9ZJ=m1;FFDc!61&_`gP5fFBb{aRY0Yt_F3b~!qio7%fx>NH2{@;wH{-sy z?R(9j5qOYA0sf3R#D0pM=wGMrQty4kgA$jXU2Ib+oX7X}jMm#|Y|%HRF^|bG0_WYA z2<|_of7U3k^#nqp6hO-ORF#=VM8wo0ZAFxOa78F_`5h(lBXuzijtsPbPz(zRW*&7+ zY8tv}!wV){VuByvym+1!G+U=O7OJbt*VwP>MmKYi&qOQWq{p%Lmg?h;)TR7o-|$8m zinjhO@v+OGJx(*CbcWb$@ZHzOwZV+5SYrcq-k5ku)bke}N&6Yl}0tD%x;1af>> zRR!|6bB0H}+C{yWx9TqanX!2cWPB{ahwBe^Drjw&dqksXzef{2(ksyAsjWOA(7dym zsllI7XXbXS!J^sMdxy6aK)C1tdm} zkcr8R+Egtq`S}@d9o}Z|dQ+w=g+5^m-Dr}=ZE?=5;qA8(*2qeh<5O&EPG1_e=fo;S zq5>LA_-9JA&@bM0U*#|%h(kJHc_1LpP$(_;fDs}M(&vrT#X`%bbUz>f794}LIjT>> z&kT2?a{AbIqsmo}Uq>n!&)xTWx8Uz&Mzn%~&opqiw`R!)jC#4>ZQWd6xPPnro+E)` z&5{WEY+7TlN2j>+jUe0lX_*b_x5O+j{8!s9L8uKwBlC6@B(A^HM-S#rT3@de`Ae!TH|E?Eaju&vUArAJhz42_@n*<59BDj0r!LNP$l$v7es7fdRdBny zbqdJoR5?QV7g3wY6gMk^un05M#%GL$9VvndCy$&t5bZE#?tb9=)Q-LGT(Fw2Jd0}5 z&BdZ>-$p*P&Y>=$r^*{_8BJBwB#x%iTeE58^oW8;UfiErQ{hVQ9af*-M^3fr9x2Cj z3whN9B$85gbCHo;d99t&^;%@?IZ+;UxQwE{x61u7qTbPxx)RldiE`0wPd>-TtqSq> z(_b zLgWW`GOSS;0uw0Ir~I$y#5~#$D`G~tS50cZA1&c=6(P@LJ&FkF({!siGeLuKMXS!H z^jqqN#Y-dlKy&YrBG&NRXW5H%p^zkVJlxh`&-?^c&%3mV3fSTfb$Eiqqj<=il# zFuXeTa8xnrVS7&&k=xY~MSE2HBsTsm@ItXzIqqTdT1(@7kz43r_oYEab0KK@1U79r;bUjyr9K2YP*CAtb@9=y&H?jnU&zHZPKPZPC< z^(4Q(<*mW!*js_UD(!a%*hA9jERt6P+j~JpNy8`E$0@9xK45ww8lvqx{evIW3BqT! z5a|qTUIU9D=UG&XRJ-Qtg@qGP-9pB^Ur89zsbf@v)PWnf%A|v|VNKI}^zxfPe?$k3 zCl(i|P?{D;5n(l0yA~|zVFi}&%M2tQpi+x$y-*4EdCtEe{5TDjI=g&xC#lOE~!{T#pyTkzyz`UaQaT*hCzNnB+WP4;m`ke^JfzxsJQb-*tKf8Pokrwae z5rWtLp+#m4?pSFRv!$$b+mh{ehmwzH$VjlOSWr9O(&~EYQ_zEh zh$git2+!;HF0?Px4U$qPd^Ebo!2b$(ZJ}9=jib|2KA)zUgsY}44vSQxa5^lyGOYP< zp#YZ=MO0$yGCnd`jcF2ha#{6> zb?L`jU1q`!o6D!i_l@cXMn-BUyjQ?ypEhSi50yT36hs)DJUp>;JjwN7*hb~|FupvM zeLQpRSRjATlF{WU?}Bpj*|5BRQZ4e@zO%LmRtX#UY^L9|{GBuY*0oFBhg_zkWP%$9 zXMA3BhuG}5#=?A9%U?08t{tY7bJ z7kJs=Q2v00M)S7rl$G<7$7_qbPvcJ#4_99uYTTIo_sv$nKa|X|1tuFLx@a&n@eB>w7oskqGSMxAv< zHHH@wgGAarvZC~z0;INggH7Wl9fn)7|SnK8qonXaeg;_izn3_3k9Hi^lao%N1NDVm!T#xrKZU-F)I zF*lL*hbSl$yl7U{A&#tjTx1phPMc9GRGBkgL!lF--%@N`6zHo!KeH6_CW~XpS8?Z% zP?JLHLkMeb_q(0!XXskEq9r+@&oD25)aY_mP{r!LbZBI8^}4b)MY@SZu-+8z%UsFg z=sQWhrensdY=};DPPx?1?gJ{irJa__^{`u(0;?-e$vim{CuF&g zrpaH%IDcLCIL$4;;_P+N!euCDA4kvZ6&vyA$#%3%-}sYL-VM2DTMh1lx-21evb&#o zmQQ2l@4gx9N7vOP#^pXKuwvf28>mTwbsr-6k>3@hc6d!~esVllN+sJ!M1Th;`>-E{ z4?!=4!dfZENR4W;_LBjnU~ubu&$)SL`#pRTkNEeLmacDj;J=gba@8qV5*R;fz$m-? z{RlI%u{Zg5h@DR>9+7%7O{}1nDb#w=_wMl}6Xcjy==ARP6cub+Ow`WWrBb4JYkO<= z#`2tK1t;C*9`29J6t^gWGyHdUb#8yr@lu5|jnEMO%LJQc6+M$lq{q>bIefPJRlpKr= zYz?GMOsoUQmlGp=a3oLe=U`Lt1Yl9qn%R-I9JH>yl{{MXmAk@g@>ydSNoe z_sG1XVTAMEz)SGOWTAHjxtTH6gM}(G4o3``k3=78LA9EhYJZH7V~|l-y!e=hSGC`o@@wr)bjS zGx-ERW5URnH{@P%#)SnE3HL43onp4!0;=-ovt5bJShPgoH-*4oAj!kGkaI>5`v-qa z^8fh`>c(*~j19Yy^&)~Z^(n4vCY>y(PYo$3E>(cyCH5t1I|7n{)1=q8#wRNE3>Abr zSLsR%3oI038J`H&YPno2pSTPPkxIvmD)c9~^3}SUm%n{WT8iD@U9Bau!e7c*@P3z5 zqj^Q}q^Y63l4kIWgl$5uo-18#_-V~4IF1ubcO~ZVY2E7j+6%jHKn{Zy3?8kTy%ldK zU0TQae>Msl5A1Jb6hw&Etr2J;T41uc222!2jt&qTD-Ej$EPD1P4;)zTLrkooHbJvR z|9fKwstPE6Jq^J~Y!}g{tEc&+#uK|;a3emuXcE>0RZN#c*g0D6E5D%qx<@F_z_`kW zd3gGALa6cedhADK&R!KR+R!jJatUOi#f?EiP{@5+j2?X*jay9JFY|MuDtyg1(WSWGD-zCd@;Lh;PXI4^BKuc{Bw?3vLx2aj`qQNfEP!s z@@v{)9@58|_kCMfFHXV-@_M9?qrA$i%CdEEklX}Icr~auFFo3Af8R{lmXErny(%Mw zUeQ3nY-csHc+lfZft%=l)i9s;UW%sC#oIeA1RdAJg`Rb~c;!bPYW2zu(O?T&g*d+9 zy6WXYEelrBO1PuvQQ24SH+xq}^{_X>Pj(4%_F?L2Tc(}2lH$M?Yh3e8EBmDo9}hyJ z=*c)ajXbS8RC?t%^nw>->zB-W1}TRso+(;$CN7mmYFy}>=pQnwSDEADezwYo8IJIu zueU6?`a9bjnG+tfj~F6Q+VK?ZkcM%`J4xfrVxmJ>FY-nL>FL^TI6(pe{81#mQF3nT zt3Q8o+Sg~m^R`78$&q3c2;l^0I*!@qiTgh_FZ&&-z(?jm)8ogUq4O1u$Bw5yNNJ=zHpJ@>JOoCuJY~_7NQ6_-r;6uSwabpf z#2rr3#4@7Oo$T!)H30_oD$9K_hWW+&L$|oO%6+}d9t#qMpgg23)a1YN2Ki$i#i=(q zZjsozqJhhrq5ETvD{(;DVh{i64%sI4!sWjpWW2=L6o~)4lO8L{|Jk$| zQqZJPI)vv|Y~}tz`FiWBl%9LOT+u7vs84dkn&WD{XGdRWW;Rc22c|DM%gH_c)=qzZ zr5K>Zo*cVB(_s?mm61weL^Q#wAZTDJPhTE1S-2j2J)au08HL@S44j(!txpJ_psc=R zo}jOiMPIr|-HV2l3=GYmTUXgf`eQ2)sHPb2TRJ6Lg!3uK=DyTRV1bi%6Sn?eUDG9o~(P z)rZ?pan_%?+bQ3&+ZcbdQhBo+f@8gIy6(Ima-nK}J!+BP)HJ`zCFWxs$;j$xp3c+> z)*vcp^0>r)!wqmq-*bjd?W$DmYSi4@m>hST9Wh#hx2DE1hw>xZ1t=}w z7vL7NbmwdFI~v?uGGK2CQH%(1(ZE&oM_a9j{!JS~Aq2#`!8x zS0nKT(K2bAL9I=sKA?E6On_niowy6PW<3oSRxe6wb~SGO^9hORtD=WU`wX9Mc4lgp z>+gV)yJu`4CEypf4TkLrv^XPlv$4Ok-Do)Ui=aPN zGLJzi5AT=@#u5iI3ON{?AYy5a&FXp+rbROVu%YATwZqWW>TSof)E@|#fOtTS@*LPoqPnsbRS9_?=$+R|c+?g>F~4ca%#`_Lpb4#=9e;T7AAW6IP;j>=S%7KDeskmwTE?{9b#= zb$4IJO(@kW$?=AvdR#VxtMQ`&gPqnd8KFdJYW#zmW~MPbc9Z%ZEpP7YYR$For(82-Fsxk6B3YJ&PwP|W zapZZg^i*Ok=lJVG0nf2lQjEl7pVcWR(^RAeAM-g`ZZc|+3(mQVjhm&Yfk|ifx#U^a zRoAZCtfuh{35qDry^qH z%eY~e+oPO2e6J}psj8(NXXsIea?&-n>FQ>eSm_*3{{sthHiOPZA)0tXkH^B?Jk3v+ zy&h#PMN}`>-I&jfcRtKtrPo5KhG=FcfAy*Icxcu`Q+)jx%M@QVohLh%qvVzR|kzro@A4u zk;T$AqgJ@#tG}6z<6QY}aTraccG1^t&+=J$u+CQO%-WfU!o&4#1H&VtHOI0M@LpHk zM09Ji7Xx!zughWa#+a_|p@+r%e(m5JJVDhYTI~7~oXy#xn8gj5T(v1{XV=ezi>WhL zr|XaNPw6&1Dj({Q4m%gfS)6SwK8=xYC*Pe28szCaoZ|?`3EO+Gn%l&cJEtp@ts(Ha z`DKlw(8srngWagRV9%w|I_~z^<&-L!uDz#juL@tr;Iw`<*P9=dVbQaEUZ2y$J5QId z>Lpkne_TR|8tv4VSMSFJ4^K|Qy5|L>hgpowS5JclWRQ&^o7YN*N9TdbVWU4j@-Hiw^>=NUIyIe8{$C~u<+ zKCP%;0aueH@~X96Y0UOdKDmClY@JCk&y>N?@wrFbf9 zwO;0}0=Xr#p`hk7zmZs~O81f6mfn}G!E^%oeU&(+wvUU{BdX=9O*RSh((e_@UCv!f z#u7J87<~=4#H2$m);1gBqP-T8=3p5c&3DD}Q+xOQOKC3MZEsw)O8CfOerHz<8tdX8-DkP}?X&-|J_`-K_>bV>X==LAoX*vJxw11yY`+t94;rX|D|31z8ThG|g%piZG zDe1S2V*i`Xv#ig!yBC4YA3orakNBq}AgJ2~^br4d&w-4A_tcwNaRW9QPam`Ha|Y#E zf=8K|91U=E#TqOn`>j&mM^S@Ow(8?&@9%O7aC9Cik_oNJ=8vNL=A%W}QH;`&hE@-3 zo;s!72*=GJnGcm4p2iL9TF<}QXb`R#5U87+UPjF%`(m*!prB?&&T8_)i|zF|!aJ+? z<3rHtM>C6Qd05Ch_DCd)oup_6SX(Mci7!}uPz$(7wD!SH%*I4^iREHzAMHfCR-RMD zghQQ~#l5|~rtaPct`F<=c8RU+Ldx8>ds?n8uuT(l_&?vx?h3isUxi>vzb9cc7hl%} zxOe=yPlkxZ1SD!kLjZC%BTyn-qj{xe1b9q+%iW9*eEe9nMQwl+achX4imR=O1Nd7P zQIPo&P^!vGwF6uw3qXK__U}pp;Oh8?M+MZ80`|hn52HKwK;zW`LcTf7oR1Gt=1LI|N0*l;e;83dM+a2tE=8bB%hGpO!4 z#Sy3qfmS5| zFr+_VGAMthf>?8HBNIdXBZw#KaWCEa00Q6&XT?HEO`zrd= zGUy`@tYIs>n06=th3Y3c`wTx)&JDW-PtGpCdMp9}qWlTO$?_`@7d#LvYg=+Y0P6k8 zE-UsQL4Vo>-7nY->(6M0i6J zy7di9d3sm*<^V9j@#tYG1Uhgj(EA`PC64hf8VX>^E-)OZzPAK{+ys{L$F${OZejv~ zRtwxoil*|)ow!cRbB)4u>hyE9xMQ&%Dne1)NAe*uI}L~wym_>JdL0h12^g}@;F zuJoDz1@Mol1THa1CDR7JL}H7-AVRx3T%eYh8w-3O*zzxc(5*YTz$B&sy(PGzzV7yfXcQ!oogiC=t5nZO4I7$L2<-lb0<4t+?5qyiF zJ0Gwn3FCa>O9ae$0xSuBT(6b;LopC@6Dt!I=)Z95#MGQfbq3G@0@gP`2=ecWe<&2- z0C9a_;s9@{7h9|I)(DWVOb1;qes^g^_#c;=8`zr|D?B zBVa+WLG#Z+E#+|Sg1bh7jkS1A8EE-Y&Yv9z?t&jSklQ(>_B~uJa2H5Fz7uxNKtQON zK}3LkLkzY)eth5M`>U@me0TMK-hP3-9ClOS91yn%HR0#ISh!X3YmW8OFF0_=;*VbW z=V}lTL_Z^b=imv?M<3QU*iE`~n$!wZ)9-kC!$KusJc`euv}?Zuh58r6LVt8*Jx3xS zply6_^?%)3VFACcewzJXR6pFl_-oG5uQ+gTbHA?o-hLXVUziMc zsqkwKC&n*0aM!j!?xLPI00IIgCenAa?zj2pd{0$D1{GL>A|OZrf5d@}LpdzqAraw! E0Iwx4Jpcdz literal 0 HcmV?d00001 diff --git a/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dpr b/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dpr new file mode 100644 index 0000000..fc9a596 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dpr @@ -0,0 +1,14 @@ +program KISWebSocket; + +uses + Vcl.Forms, + MainForm in 'MainForm.pas' {Form1}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dproj b/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dproj new file mode 100644 index 0000000..e69aae2 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/delphi/KISWebSocket.dproj @@ -0,0 +1,1119 @@ + + + {A18D804D-3745-4E7A-B4B7-BF0D2F4735C1} + 20.1 + VCL + True + Debug + Win32 + KISWebSocket + 3 + Application + KISWebSocket.dpr + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + KISWebSocket + + + sgcWebSocketsD12;vclwinx;fmx;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;FireDACCommonODBC;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;Skia.Package.RTL;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;bindcompfmx;inetdb;FireDACSqliteDriver;DbxClientDriver;soapmidas;vclactnband;fmxFireDAC;dbexpress;DBXMySQLDriver;VclSmp;inet;vcltouch;fmxase;dbrtl;Skia.Package.FMX;fmxdae;FireDACMSAccDriver;CustomIPTransport;vcldsnap;DBXInterBaseDriver;IndySystem;Skia.Package.VCL;vcldb;vclFireDAC;bindcomp;FireDACCommon;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;adortl;vclimg;FireDACPgDriver;FireDAC;inetdbxpress;xmlrtl;tethering;bindcompvcl;dsnap;CloudService;fmxobj;bindcompvclsmp;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + vclwinx;fmx;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;FireDACCommonODBC;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;bindcompfmx;inetdb;FireDACSqliteDriver;DbxClientDriver;soapmidas;vclactnband;fmxFireDAC;dbexpress;DBXMySQLDriver;VclSmp;inet;vcltouch;fmxase;dbrtl;fmxdae;FireDACMSAccDriver;CustomIPTransport;vcldsnap;DBXInterBaseDriver;IndySystem;Skia.Package.VCL;vcldb;vclFireDAC;bindcomp;FireDACCommon;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;adortl;vclimg;FireDACPgDriver;FireDAC;inetdbxpress;xmlrtl;tethering;bindcompvcl;dsnap;CloudService;fmxobj;bindcompvclsmp;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DEBUG;$(DCC_Define) + true + false + true + true + true + true + true + + + false + PerMonitorV2 + + + PerMonitorV2 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + PerMonitorV2 + + + PerMonitorV2 + + + + MainSource + + +

Form1 + dfm + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + + + + Delphi.Personality.12 + Application + + + + KISWebSocket.dpr + + + + + + KISWebSocket.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + + + 12 + + + + + diff --git a/한국투자증권(API)/legacy/websocket/delphi/MainForm.dfm b/한국투자증권(API)/legacy/websocket/delphi/MainForm.dfm new file mode 100644 index 0000000..4fd18d3 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/delphi/MainForm.dfm @@ -0,0 +1,183 @@ +object Form1: TForm1 + Left = 0 + Top = 0 + Caption = #54620#44397#53804#51088#51613#44428' WebSocket '#53580#49828#53944' v1.0' + ClientHeight = 600 + ClientWidth = 750 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poScreenCenter + OnCreate = FormCreate + TextHeight = 15 + object Label1: TLabel + Left = 24 + Top = 24 + Width = 73 + Height = 15 + Caption = 'Approval Key:' + end + object Label2: TLabel + Left = 24 + Top = 58 + Width = 32 + Height = 15 + Caption = 'TR_ID:' + end + object Label3: TLabel + Left = 24 + Top = 92 + Width = 89 + Height = 15 + Caption = 'TR_KEY:'#51333#47785#53076#46300 + end + object edtApprovalKey: TEdit + Left = 120 + Top = 21 + Width = 420 + Height = 23 + TabOrder = 0 + TextHint = 'Approval Key '#51077#47141' (e.g. e44ffe64-7a22-...)' + end + object edtTrId: TEdit + Left = 120 + Top = 55 + Width = 150 + Height = 23 + TabOrder = 1 + Text = 'H0STCNT0' + TextHint = 'TR_ID ('#50696': H0STCNT0)' + OnChange = edtTrIdChange + end + object edtTrKey: TEdit + Left = 120 + Top = 89 + Width = 150 + Height = 23 + TabOrder = 2 + Text = '005930' + TextHint = #51333#47785#53076#46300' ('#50696': 005930)' + end + object btnConnect: TButton + Left = 560 + Top = 19 + Width = 170 + Height = 30 + Caption = #50672#44208 + TabOrder = 3 + OnClick = btnConnectClick + end + object btnSubscribe: TButton + Left = 560 + Top = 55 + Width = 80 + Height = 30 + Caption = #44396#46021 + TabOrder = 4 + OnClick = btnSubscribeClick + end + object btnUnsubscribe: TButton + Left = 650 + Top = 55 + Width = 80 + Height = 30 + Caption = #44396#46021#54644#51228 + TabOrder = 5 + OnClick = btnUnsubscribeClick + end + object btnDisconnect: TButton + Left = 560 + Top = 91 + Width = 170 + Height = 30 + Caption = #50672#44208' '#54644#51228 + TabOrder = 6 + OnClick = btnDisconnectClick + end + object Memo1: TMemo + Left = 24 + Top = 136 + Width = 706 + Height = 441 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Consolas' + Font.Style = [] + ParentFont = False + ScrollBars = ssVertical + TabOrder = 7 + end + object sgcWebSocketClient1: TsgcWebSocketClient + Port = 80 + ConnectTimeout = 0 + ReadTimeout = -1 + WriteTimeout = 0 + TLS = False + Proxy.Enabled = False + Proxy.Port = 8080 + Proxy.ProxyType = pxyHTTP + HeartBeat.Enabled = True + HeartBeat.HeartBeatType = hbtAlways + HeartBeat.Interval = 30000 + HeartBeat.Timeout = 0 + IPVersion = Id_IPv4 + OnConnect = sgcWebSocketClient1Connect + OnMessage = sgcWebSocketClient1Message + OnDisconnect = sgcWebSocketClient1Disconnect + OnError = sgcWebSocketClient1Error + Authentication.Enabled = False + Authentication.URL.Enabled = True + Authentication.Session.Enabled = False + Authentication.Basic.Enabled = False + Authentication.Token.Enabled = False + Authentication.Token.AuthName = 'Bearer' + Extensions.DeflateFrame.Enabled = False + Extensions.DeflateFrame.WindowBits = 15 + Extensions.PerMessage_Deflate.Enabled = False + Extensions.PerMessage_Deflate.ClientMaxWindowBits = 15 + Extensions.PerMessage_Deflate.ClientNoContextTakeOver = False + Extensions.PerMessage_Deflate.MemLevel = 9 + Extensions.PerMessage_Deflate.ServerMaxWindowBits = 15 + Extensions.PerMessage_Deflate.ServerNoContextTakeOver = False + Options.CleanDisconnect = False + Options.FragmentedMessages = frgOnlyBuffer + Options.Parameters = '/' + Options.RaiseDisconnectExceptions = True + Options.ValidateUTF8 = False + Specifications.Drafts.Hixie76 = False + Specifications.RFC6455 = True + NotifyEvents = neAsynchronous + LogFile.Enabled = False + QueueOptions.Binary.Level = qmNone + QueueOptions.Ping.Level = qmNone + QueueOptions.Text.Level = qmNone + WatchDog.Attempts = 0 + WatchDog.Enabled = False + WatchDog.Interval = 10 + Throttle.BitsPerSec = 0 + Throttle.Enabled = False + LoadBalancer.Enabled = False + LoadBalancer.Port = 0 + LoadBalancer.TLS = False + TLSOptions.VerifyCertificate = False + TLSOptions.VerifyDepth = 0 + TLSOptions.Version = tlsUndefined + TLSOptions.IOHandler = iohOpenSSL + TLSOptions.OpenSSL_Options.APIVersion = oslAPI_1_0 + TLSOptions.OpenSSL_Options.LegacyProvider.Enabled = False + TLSOptions.OpenSSL_Options.LegacyProvider.LibPath = oslpNone + TLSOptions.OpenSSL_Options.LibPath = oslpNone + TLSOptions.OpenSSL_Options.UnixSymLinks = oslsSymLinksDefault + TLSOptions.OpenSSL_Options.VersionMin = tlsUndefined + TLSOptions.OpenSSL_Options.X509Checks.Mode = [] + TLSOptions.SChannel_Options.CertStoreName = scsnMY + TLSOptions.SChannel_Options.CertStorePath = scspStoreCurrentUser + TLSOptions.SChannel_Options.UseLegacyCredentials = False + Left = 400 + Top = 64 + end +end diff --git a/한국투자증권(API)/legacy/websocket/delphi/MainForm.pas b/한국투자증권(API)/legacy/websocket/delphi/MainForm.pas new file mode 100644 index 0000000..4cbbe6b --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/delphi/MainForm.pas @@ -0,0 +1,306 @@ +unit MainForm; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, System.JSON, + Vcl.Forms, Vcl.Controls, Vcl.StdCtrls, Vcl.Dialogs, + sgcWebSocket, sgcWebSocket_Classes, sgcWebSocket_Client, sgcBase_Classes, + sgcSocket_Classes, sgcTCP_Classes, sgcWebSocket_Classes_Indy; + +type + TForm1 = class(TForm) + sgcWebSocketClient1: TsgcWebSocketClient; + btnConnect: TButton; + btnSubscribe: TButton; + btnUnsubscribe: TButton; + btnDisconnect: TButton; + Memo1: TMemo; + edtApprovalKey: TEdit; + edtTrId: TEdit; + edtTrKey: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + procedure btnConnectClick(Sender: TObject); + procedure btnSubscribeClick(Sender: TObject); + procedure btnUnsubscribeClick(Sender: TObject); + procedure btnDisconnectClick(Sender: TObject); + procedure sgcWebSocketClient1Connect(Connection: TsgcWSConnection); + procedure sgcWebSocketClient1Disconnect(Connection: TsgcWSConnection; Code: Integer); + procedure sgcWebSocketClient1Message(Connection: TsgcWSConnection; const Text: string); + procedure sgcWebSocketClient1Error(Connection: TsgcWSConnection; const Error: string); + procedure FormCreate(Sender: TObject); + procedure edtTrIdChange(Sender: TObject); + private + APPROVAL_KEY: string; + procedure LogMessage(const Msg: string); + procedure SendSubscription(const TrType: string); + procedure UpdateWebSocketURL; + public + end; + +var + Form1: TForm1; + +implementation + +{$R *.dfm} + +procedure TForm1.FormCreate(Sender: TObject); +begin + // 웹소켓 초기 설정 + sgcWebSocketClient1.Active := False; + sgcWebSocketClient1.HeartBeat.Enabled := True; + sgcWebSocketClient1.HeartBeat.Interval := 30000; + + btnSubscribe.Enabled := False; + btnUnsubscribe.Enabled := False; + btnDisconnect.Enabled := False; + + Memo1.Clear; + + // 기본값 설정 + edtTrId.Text := 'H0STCNT0'; // 국내주식 체결통보 + edtTrKey.Text := '005930'; // 삼성전자 + + // URL 초기 설정 + UpdateWebSocketURL; + + LogMessage('═══════════════════════════════════════════'); + LogMessage(' 한국투자증권 웹소켓 클라이언트 v1.0'); + LogMessage('═══════════════════════════════════════════'); + LogMessage(''); + LogMessage('[TR_ID 예시]'); + LogMessage(' H0STCNT0 : 국내주식 체결가'); + LogMessage(' H0STASP0 : 국내주식 호가'); + LogMessage(' HDFSCNT0 : 해외주식 지연체결가'); + LogMessage(' HDFSASP0 : 해외주식 호가'); + LogMessage(''); + LogMessage('[종목코드 예시]'); + LogMessage(' 국내: 005930 (삼성전자), 000660 (SK하이닉스)'); + LogMessage(' 해외: DNASTSLA (나스닥 테슬라), DNYSBABA (뉴욕 알리바바)'); + LogMessage('═══════════════════════════════════════════'); +end; + +procedure TForm1.UpdateWebSocketURL; +var + trId: string; +begin + trId := Trim(edtTrId.Text); + if trId <> '' then + begin + sgcWebSocketClient1.URL := 'ws://ops.koreainvestment.com:21000/tryitout/' + trId; + LogMessage('URL 업데이트: ws://ops.koreainvestment.com:21000/tryitout/' + trId); + end; +end; + +procedure TForm1.edtTrIdChange(Sender: TObject); +begin + // TR_ID가 변경되면 URL도 자동 업데이트 + if not sgcWebSocketClient1.Active then + UpdateWebSocketURL; +end; + +procedure TForm1.LogMessage(const Msg: string); +begin + Memo1.Lines.Add(FormatDateTime('[hh:nn:ss] ', Now) + Msg); + if Memo1.Lines.Count > 0 then + Memo1.Perform(EM_SCROLLCARET, 0, 0); +end; + +procedure TForm1.btnConnectClick(Sender: TObject); +var + trId: string; +begin + APPROVAL_KEY := Trim(edtApprovalKey.Text); + trId := Trim(edtTrId.Text); + + if APPROVAL_KEY = '' then + begin + ShowMessage('Approval Key를 입력해주세요.'); + edtApprovalKey.SetFocus; + Exit; + end; + + if trId = '' then + begin + ShowMessage('TR_ID를 입력해주세요.'); + edtTrId.SetFocus; + Exit; + end; + + try + // URL 최종 확인 및 업데이트 + UpdateWebSocketURL; + + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + LogMessage('웹소켓 연결 시도...'); + LogMessage('TR_ID: ' + trId); + sgcWebSocketClient1.Active := True; + except + on E: Exception do + begin + LogMessage('연결 실패: ' + E.Message); + ShowMessage('연결 실패: ' + E.Message); + end; + end; +end; + +procedure TForm1.btnDisconnectClick(Sender: TObject); +begin + if sgcWebSocketClient1.Active then + begin + LogMessage('연결 해제 중...'); + sgcWebSocketClient1.Active := False; + end; +end; + +procedure TForm1.SendSubscription(const TrType: string); +var + jHeader, jBody, jInput, jSend: TJSONObject; + sJson: string; +begin + if not sgcWebSocketClient1.Active then + begin + ShowMessage('웹소켓이 연결되지 않았습니다.'); + Exit; + end; + + jHeader := TJSONObject.Create; + jInput := TJSONObject.Create; + jBody := TJSONObject.Create; + jSend := TJSONObject.Create; + + try + // Header 구성 + jHeader.AddPair('approval_key', APPROVAL_KEY); + jHeader.AddPair('custtype', 'P'); + jHeader.AddPair('tr_type', TrType); + jHeader.AddPair('content-type', 'utf-8'); + + // Input 구성 + jInput.AddPair('tr_id', 'H0STCNT0'); + jInput.AddPair('tr_key', '000660'); + + // Body 구성 + jBody.AddPair('input', jInput); // jInput 소유권은 jBody가 가져감 + + // 전체 JSON 구성 + jSend.AddPair('header', jHeader); // jHeader 소유권은 jSend가 가져감 + jSend.AddPair('body', jBody); // jBody 소유권은 jSend가 가져감 + + sJson := jSend.ToJSON; + + LogMessage('전송 데이터: ' + sJson); + sgcWebSocketClient1.WriteData(sJson); + + if TrType = '1' then + LogMessage('구독 요청 전송 완료') + else + LogMessage('구독 해제 요청 전송 완료'); + + finally + // ✅ 하위 객체는 해제하지 말고, 최상위 객체(jSend)만 해제 + jSend.Free; + end; +end; + +procedure TForm1.btnSubscribeClick(Sender: TObject); +begin + SendSubscription('1'); +end; + +procedure TForm1.btnUnsubscribeClick(Sender: TObject); +begin + SendSubscription('2'); +end; + +procedure TForm1.sgcWebSocketClient1Connect(Connection: TsgcWSConnection); +begin + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + LogMessage('✓ 웹소켓 연결 성공!'); + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + + btnConnect.Enabled := False; + btnSubscribe.Enabled := True; + btnUnsubscribe.Enabled := True; + btnDisconnect.Enabled := True; + edtApprovalKey.Enabled := False; + +end; + +procedure TForm1.sgcWebSocketClient1Disconnect(Connection: TsgcWSConnection; Code: Integer); +begin + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + LogMessage('✗ 웹소켓 연결 해제됨'); + LogMessage('종료 코드: ' + IntToStr(Code)); + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + + btnConnect.Enabled := True; + btnSubscribe.Enabled := False; + btnUnsubscribe.Enabled := False; + btnDisconnect.Enabled := False; + edtApprovalKey.Enabled := True; + +end; + +procedure TForm1.sgcWebSocketClient1Message(Connection: TsgcWSConnection; const Text: string); +var + jResponse: TJSONObject; + jHeader, jBody: TJSONObject; + trId, rtCd, msgCd, msg1: string; +begin + LogMessage('수신: ' + Text); + + try + jResponse := TJSONObject.ParseJSONValue(Text) as TJSONObject; + if Assigned(jResponse) then + try + // Header 파싱 + if jResponse.TryGetValue('header', jHeader) then + begin + jHeader.TryGetValue('tr_id', trId); + LogMessage('TR_ID: ' + trId); + end; + + // Body 파싱 + if jResponse.TryGetValue('body', jBody) then + begin + // 응답 코드 확인 + rtCd := jBody.GetValue('rt_cd', ''); + msgCd := jBody.GetValue('msg_cd', ''); + msg1 := jBody.GetValue('msg1', ''); + + if rtCd <> '' then + begin + if rtCd = '0' then + LogMessage('✓ 성공: ' + msg1 + ' [' + msgCd + ']') + else + LogMessage('✗ 실패: ' + msg1 + ' [' + msgCd + ']'); + end + else + begin + // 실시간 체결 데이터 + LogMessage('실시간 데이터: ' + jBody.ToJSON); + end; + end; + + finally + jResponse.Free; + end; + except + on E: Exception do + LogMessage('메시지 파싱 오류: ' + E.Message); + end; +end; + +procedure TForm1.sgcWebSocketClient1Error(Connection: TsgcWSConnection; const Error: string); +begin + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + LogMessage('❌ 에러 발생: ' + Error); + LogMessage('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + ShowMessage('에러: ' + Error); +end; + +end. \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/python/multi_processing_sample_ws.py b/한국투자증권(API)/legacy/websocket/python/multi_processing_sample_ws.py new file mode 100644 index 0000000..6a991b0 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/multi_processing_sample_ws.py @@ -0,0 +1,560 @@ +import asyncio +import websockets +import json +import time +from multiprocessing import Process, Queue, Manager +import json +import time +import requests +import asyncio +import websockets +import urllib3 +import os + +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +# 국내주식호가 출력라이브러리 +def stockhoka(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + +""" + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + print("주식매매 구분코드 [%s]" % (recvvalue[58])) +""" + + +# 국내주식체결처리 출력라이브러리 +def stockspurchase(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량|매수호가잔량|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드|정적VI발동기준가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + ## print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + ## print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식체결통보 출력라이브러리 +def stocksigningnotice_domestic(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[13] == '2': # 체결통보 +## print("#### 국내주식 체결 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|체결수량|체결단가|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|주문가격" + menustr1 = menulist.split('|') + else: +## print("#### 국내주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|주문수량|주문가격|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|체결단가" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +def data_processor_worker(worker_id, data_queue, stock_code): + """ + 데이터 처리 전용 워커 프로세스 + + Args: + worker_id: 워커 식별 번호 + data_queue: 메인 프로세스로부터 데이터를 받을 큐 + stock_code: 담당 종목코드 + """ + import sys + + process_id = os.getpid() + print(f"\n{'#'*80}") + print(f"[Processor-{worker_id}] 시작: PID={process_id}, 담당종목={stock_code}") + print(f"{'#'*80}\n") + + processed_count = 0 + message = None # 에러 추적용 + error_count = 0 + + try: + while True: + try: + # 큐에서 데이터 가져오기 (타임아웃 1초) + message = data_queue.get(timeout=1.0) + + if message is None: # 종료 신호 + print(f"[Processor-{worker_id}] [PID:{process_id}] 종료 신호 수신") + break + + # 메시지 유효성 검사 + if not isinstance(message, dict): + print(f"[Processor-{worker_id}] [PID:{process_id}] 잘못된 메시지 타입: {type(message)}, 내용: {message}") + continue + + msg_type = message.get('type') + data = message.get('data') + source_stock = message.get('stock_code') + + if not msg_type: + print(f"[Processor-{worker_id}] [PID:{process_id}] 메시지 타입 없음: {message}") + continue + + if not source_stock: + print(f"[Processor-{worker_id}] [PID:{process_id}] 종목코드 없음: {message}") + continue + + # 자신이 담당하는 종목의 데이터만 처리 + if source_stock != stock_code: + continue + + processed_count += 1 + + if msg_type == 'hoka': + print(f"[Processor-{worker_id}] [PID:{process_id}] [종목:{stock_code}] " + f"호가 데이터 처리 중... (처리건수: {processed_count})") + stockhoka(data) + + elif msg_type == 'chegyeol': + data_cnt = message.get('data_cnt', 1) + print(f"[Processor-{worker_id}] [PID:{process_id}] [종목:{stock_code}] " + f"체결 데이터 처리 중... (체결건수: {data_cnt}, 총처리: {processed_count})") + stockspurchase(data_cnt, data) + + elif msg_type == 'signing_notice': + aes_key = message.get('aes_key') + aes_iv = message.get('aes_iv') + print(f"[Processor-{worker_id}] [PID:{process_id}] [종목:{stock_code}] " + f"체결통보 처리 중... (처리건수: {processed_count})") + stocksigningnotice(data, aes_key, aes_iv) + + except Exception as e: + error_count += 1 + error_msg = str(e) + + # Queue.Empty는 정상 동작 + if "Empty" in str(type(e).__name__): + continue + + # 기타 에러는 상세 출력 + import traceback + error_details = traceback.format_exc() + + print(f"\n{'!'*80}") + print(f"[Processor-{worker_id}] [PID:{process_id}] 🔴 처리 에러 발생 (에러 #{error_count})") + print(f" 에러 타입: {type(e).__name__}") + print(f" 에러 메시지: '{error_msg}' (길이: {len(error_msg)})") + print(f" 에러 repr: {repr(e)}") + + if message: + print(f" 문제 메시지 타입: {type(message)}") + try: + print(f" 문제 메시지 내용: {message}") + except: + print(f" 문제 메시지 내용: [출력 불가]") + else: + print(f" 문제 메시지: None") + + print(f"\n 상세 스택 트레이스:") + print(error_details) + print(f"{'!'*80}\n") + + # 에러가 너무 많으면 종료 + if error_count > 100: + print(f"[Processor-{worker_id}] [PID:{process_id}] 에러 과다 발생으로 종료") + break + + continue + + except KeyboardInterrupt: + print(f"[Processor-{worker_id}] [PID:{process_id}] 인터럽트로 종료") + except Exception as e: + print(f"[Processor-{worker_id}] [PID:{process_id}] 치명적 에러: {e}") + import traceback + traceback.print_exc() + + print(f"[Processor-{worker_id}] [PID:{process_id}] 종료. 총 처리건수: {processed_count}, 에러: {error_count}") + + +def parse_stock_code_from_data(raw_data, trid): + """ + 실시간 데이터에서 종목코드 추출 + + Args: + raw_data: 파이프로 구분된 실시간 데이터 + trid: TR ID (H0STCNT0, H0STASP0 등) + + Returns: + 종목코드 (6자리) + """ + try: + # 디버깅: 처음 3번만 전체 데이터 출력 + if not hasattr(parse_stock_code_from_data, 'debug_count'): + parse_stock_code_from_data.debug_count = 0 + + if parse_stock_code_from_data.debug_count < 3: + print(f"\n[DEBUG parse_stock_code] TR_ID: {trid}") + print(f"[DEBUG parse_stock_code] Raw data: {raw_data[:200]}") + parse_stock_code_from_data.debug_count += 1 + + # 한국투자증권 실시간 데이터는 ^ 구분자로 필드가 나뉨 + fields = raw_data.split('^') + + if parse_stock_code_from_data.debug_count <= 3: + print(f"[DEBUG parse_stock_code] 필드 개수: {len(fields)}") + print(f"[DEBUG parse_stock_code] 첫 5개 필드: {fields[:5]}\n") + + if len(fields) > 0: + # 첫 번째 필드가 보통 종목코드 + stock_code = fields[0].strip() + + # 종목코드 검증 (6자리 숫자) + if stock_code.isdigit() and len(stock_code) == 6: + return stock_code + + # 파싱 실패 시 None 반환 + return None + except Exception as e: + print(f"[parse_stock_code] 에러: {e}, data: {raw_data[:100]}") + return None + + +async def websocket_receiver(url, approval_key, stock_codes, data_queues, custtype='P'): + """ + 단일 웹소켓 세션으로 여러 종목 데이터 수신 + 수신한 데이터를 각 프로세스의 큐에 분배 + + Args: + url: 웹소켓 URL + approval_key: 승인 키 + stock_codes: 구독할 종목 리스트 + data_queues: 각 워커의 데이터 큐 딕셔너리 {종목코드: Queue} + custtype: 고객 타입 + """ + main_pid = os.getpid() + aes_key = None + aes_iv = None + + retry_count = 0 + max_retries = 5 + + while retry_count < max_retries: + try: + print(f"\n{'='*80}") + print(f"[WebSocket Main] PID: {main_pid}") + print(f"[WebSocket Main] 연결 시도... URL: {url}") + print(f"[WebSocket Main] 구독 종목: {', '.join(stock_codes)}") + print(f"{'='*80}\n") + + async with websockets.connect(url, ping_interval=None) as websocket: + # 웹소켓 세션 정보 + local_address = websocket.local_address + remote_address = websocket.remote_address + + print(f"\n{'*'*80}") + print(f"[WebSocket Main] 세션 정보") + print(f" - 메인 프로세스 PID: {main_pid}") + print(f" - 로컬 주소: {local_address[0]}:{local_address[1]}") + print(f" - 원격 주소: {remote_address[0]}:{remote_address[1]}") + print(f" - 웹소켓 객체 ID: {id(websocket)}") + print(f" - 구독 종목 수: {len(stock_codes)}") + print(f"{'*'*80}\n") + + # 각 종목에 대해 구독 요청 전송 + for i, stock_code in enumerate(stock_codes): + await asyncio.sleep(0.5) # 요청 간격 + + senddata = { + "header": { + "approval_key": approval_key, + "custtype": custtype, + "tr_type": "1", + "content-type": "utf-8" + }, + "body": { + "input": { + "tr_id": "H0STCNT0", # 주식체결 + "tr_key": stock_code + } + } + } + + senddata_str = json.dumps(senddata, ensure_ascii=False) + print(f"[WebSocket Main] [{i+1}/{len(stock_codes)}] 구독 요청: {stock_code}") + await websocket.send(senddata_str) + + retry_count = 0 # 연결 성공 시 재시도 카운트 초기화 + subscribe_count = 0 + + # 데이터 수신 및 분배 루프 + print(f"\n[WebSocket Main] 데이터 수신 대기 중...\n") + + while True: + try: + data = await asyncio.wait_for(websocket.recv(), timeout=30.0) + except asyncio.TimeoutError: + print(f"[WebSocket Main] 타임아웃 - 연결 유지 중...") + continue + + # 실시간 데이터 처리 (0 또는 1로 시작) + if data[0] in ('0', '1'): + recvstr = data.split('|') + + if len(recvstr) < 4: + print(f"[WebSocket Main] Invalid data: {data}") + continue + + trid0 = recvstr[1] + raw_data = recvstr[3] + + # 실제 데이터에서 종목코드 추출 + target_stock = parse_stock_code_from_data(raw_data, trid0) + + # 종목코드 추출 실패 또는 구독하지 않은 종목 + if not target_stock: + print(f"[WebSocket Main] ⚠️ 종목코드 추출 실패: {raw_data[:50]}...") + continue + + if target_stock not in data_queues: + print(f"[WebSocket Main] ⚠️ 구독하지 않은 종목: {target_stock}") + continue + + if data[0] == '0': + # 주식호가 + if trid0 == "H0STASP0": + message = { + 'type': 'hoka', + 'data': raw_data, + 'stock_code': target_stock + } + data_queues[target_stock].put(message) + print(f"[WebSocket Main] 호가 데이터 → Processor (종목: {target_stock})") + + # 주식체결 + elif trid0 == "H0STCNT0": + data_cnt = int(recvstr[2]) + message = { + 'type': 'chegyeol', + 'data': raw_data, + 'data_cnt': data_cnt, + 'stock_code': target_stock + } + data_queues[target_stock].put(message) + print(f"[WebSocket Main] 체결 데이터 → Processor (종목: {target_stock}, 건수: {data_cnt})") + + elif data[0] == '1': + # 주식체결 통보 + if trid0 in ("K0STCNI0", "K0STCNI9", "H0STCNI0", "H0STCNI9"): + if aes_key and aes_iv: + message = { + 'type': 'signing_notice', + 'data': raw_data, + 'aes_key': aes_key, + 'aes_iv': aes_iv, + 'stock_code': target_stock + } + data_queues[target_stock].put(message) + print(f"[WebSocket Main] 체결통보 → Processor (종목: {target_stock})") + + # JSON 메시지 처리 + else: + try: + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + # PINGPONG 처리 + if trid == "PINGPONG": + print(f"[WebSocket Main] RECV [PINGPONG]") + await websocket.send(data) + print(f"[WebSocket Main] SEND [PINGPONG]") + + # 일반 응답 처리 + else: + rt_cd = jsonObject["body"]["rt_cd"] + tr_key = jsonObject["header"]["tr_key"] + msg = jsonObject["body"].get("msg1", "") + + if rt_cd == '1': # 에러 + print(f"[WebSocket Main] ❌ ERROR [종목:{tr_key}] MSG [{msg}]") + + elif rt_cd == '0': # 정상 + print(f"[WebSocket Main] ✓ SUCCESS [종목:{tr_key}] MSG [{msg}]") + + if "SUBSCRIBE SUCCESS" in msg or "SUCCESS" in msg: + subscribe_count += 1 + print(f"[WebSocket Main] 🎉 구독 완료! ({subscribe_count}/{len(stock_codes)})") + + # AES 키 저장 + if trid in ("H0STCNI0", "H0STCNI9"): + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print(f"[WebSocket Main] AES KEY 저장: {aes_key[:20]}...") + + except json.JSONDecodeError as e: + print(f"[WebSocket Main] JSON error: {e}") + except KeyError as e: + print(f"[WebSocket Main] Key error: {e}") + + except websockets.exceptions.ConnectionClosed as e: + print(f"[WebSocket Main] 연결 종료: {e}") + retry_count += 1 + await asyncio.sleep(2 ** retry_count) + + except Exception as e: + print(f"[WebSocket Main] Exception: {e}") + import traceback + traceback.print_exc() + retry_count += 1 + await asyncio.sleep(2 ** retry_count) + + print(f"[WebSocket Main] 최대 재시도 횟수 초과") + + +def main(): + """메인 함수""" + + # API 키 설정 + g_appkey = '앱키 입력해주세요' + g_appsecret = '앱시크릿키 입력해주세요' + + custtype = 'P' # 개인 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + + # 모니터링할 종목 리스트 + stock_codes = [ + '005930', # 삼성전자 + '000660', # SK하이닉스 + '035420', # NAVER + '005380', # 현대차 + '051910', # LG화학 + ] + + print(f"\n{'='*80}") + print(f"메인 프로세스 PID: {os.getpid()}") + print(f"구독 종목: {', '.join(stock_codes)}") + print(f"{'='*80}\n") + + try: + # 1. Approval key 발급 + print("=== Approval Key 발급 중 ===") + approval_key = get_approval(g_appkey, g_appsecret) + print(f"Approval Key: {approval_key}\n") + + # 2. 각 종목별 데이터 큐 생성 (Manager 사용) + manager = Manager() + data_queues = {} + + for stock_code in stock_codes: + data_queues[stock_code] = manager.Queue(maxsize=1000) + + # 3. 데이터 처리 워커 프로세스 생성 + processes = [] + + for i, stock_code in enumerate(stock_codes): + worker_id = i + 1 + p = Process( + target=data_processor_worker, + args=(worker_id, data_queues[stock_code], stock_code) + ) + p.start() + processes.append(p) + print(f"✓ Processor-{worker_id} 시작: PID={p.pid}, 종목={stock_code}") + time.sleep(0.2) + + print(f"\n=== 모든 프로세서 시작 완료 ({len(processes)}개) ===\n") + + # 4. 웹소켓 수신 시작 (메인 프로세스에서 실행) + print("=== 웹소켓 연결 시작 ===\n") + asyncio.run(websocket_receiver(url, approval_key, stock_codes, data_queues, custtype)) + + except KeyboardInterrupt: + print("\n\n=== 프로그램 종료 중 ===") + + # 모든 워커에 종료 신호 전송 + for stock_code in stock_codes: + try: + data_queues[stock_code].put(None) + except: + pass + + # 프로세스 종료 대기 + for p in processes: + p.join(timeout=2) + if p.is_alive(): + p.terminate() + + print("모든 프로세서 종료 완료") + + except Exception as e: + print(f"메인 프로세스 에러: {e}") + import traceback + traceback.print_exc() + + for p in processes: + p.terminate() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/python/ops_ws_sample.py b/한국투자증권(API)/legacy/websocket/python/ops_ws_sample.py new file mode 100644 index 0000000..488fe8d --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ops_ws_sample.py @@ -0,0 +1,299 @@ +# 웹 소켓 모듈을 선언한다. +import websockets +import json +import requests +import os +import asyncio +import time + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + +# 주식체결 출력라이브러리 +def stockhoka(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + print("주식매매 구분코드 [%s]" % (recvvalue[58])) + + +# 주식체결처리 출력라이브러리 +def stockspurchase(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량|매수호가잔량|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드|정적VI발동기준가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]"%(cnt+1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식체결통보 출력라이브러리 +def stocksigningnotice(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[13] == '2': # 체결통보 + print("#### 국내주식 체결 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|체결수량|체결단가|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|주문가격" + menustr1 = menulist.split('|') + else: + print("#### 국내주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|주문수량|주문가격|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|체결단가" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +async def connect(): + + try: + # 웹 소켓에 접속.( 주석은 koreainvest test server for websocket) + ## 시세데이터를 받기위한 데이터를 미리 할당해서 사용한다. + + g_appkey = '앱키를 입력하세요' + g_appsecret = '앱 시크릿키를 입력하세요' + + stockcode = '005930' # 테스트용 임시 종목 설정, 삼성전자 + htsid = 'HTS ID를 입력하세요' # 체결통보용 htsid 입력 + custtype = 'P' # customer type, 개인:'P' 법인 'B' + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + async with websockets.connect(url, ping_interval=None) as websocket: + + """" 주석처리는 더블쿼트 3개로 처리 + """ + print("1.주식호가, 2.주식호가해제, 3.주식체결, 4.주식체결해제, 5.주식체결통보(고객), 6.주식체결통보해제(고객), 7.주식체결통보(모의), 8.주식체결통보해제(모의)") + print("Input Command :") + cmd = input() + + # 입력값 체크 step + if cmd < '0' or cmd > '8': + print("> Wrong Input Data", cmd) + elif cmd == '0': + print("Exit!!") + + # 입력값에 따라 전송 데이터셋 구분 처리 + if cmd == '1': # 주식호가 등록 + tr_id = 'H0STASP0' + tr_type = '1' + elif cmd == '2': # 주식호가 등록해제 + tr_id = 'H0STASP0' + tr_type = '2' + elif cmd == '3': # 주식체결 등록 + tr_id = 'H0STCNT0' + tr_type = '1' + elif cmd == '4': # 주식체결 등록해제 + tr_id = 'H0STCNT0' + tr_type = '2' + elif cmd == '5': # 주식체결통보 등록(고객용) + tr_id = 'H0STCNI0' # 고객체결통보 + tr_type = '1' + elif cmd == '6': # 주식체결통보 등록해제(고객용) + tr_id = 'H0STCNI0' # 고객체결통보 + tr_type = '2' + elif cmd == '7': # 주식체결통보 등록(모의) + tr_id = 'H0STCNI9' #테스트용 직원체결통보 + tr_type = '1' + elif cmd == '8': # 주식체결통보 등록해제(모의) + tr_id = 'H0STCNI9' # 테스트용 직원체결통보 + tr_type = '2' + else: + senddata = 'wrong inert data' + + # send json, 체결통보는 tr_key 입력항목이 상이하므로 분리를 한다. + if cmd == '5' or cmd == '6' or cmd == '7' or cmd == '8': + senddata = '{"header":{"approval_key":"' + g_approval_key + '","custtype":"'+custtype+'","tr_type":"' + tr_type + '","content-type":"utf-8"},"body":{"input":{"tr_id":"' + tr_id + '","tr_key":"' + htsid + '"}}}' + else : + senddata = '{"header":{"approval_key":"' + g_approval_key + '","custtype":"'+custtype+'","tr_type":"' + tr_type + '","content-type":"utf-8"},"body":{"input":{"tr_id":"' + tr_id + '","tr_key":"' + stockcode + '"}}}' + + print('Input Command is :', senddata) + + await websocket.send(senddata) + # 무한히 데이터가 오기만 기다린다. + while True: + data = await websocket.recv() + # print("Recev Command is :", data) + + if data[0] == '0' or data[0] == '1': # 실시간 데이터일 경우 + trid = jsonObject["header"]["tr_id"] + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + if trid0 == "H0STASP0": # 주식호가tr 일경우의 처리 단계 + print("#### 주식호가 ####") + stockhoka(recvstr[3]) + await asyncio.sleep(1) + + elif trid0 == "H0STCNT0": # 주식체결 데이터 처리 + print("#### 주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase(data_cnt, recvstr[3]) + + elif data[0] == '1': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + if trid0 == "H0STCNI0" or trid0 == "H0STCNI9": # 주실체결 통보 처리 + stocksigningnotice(recvstr[3], aes_key, aes_iv) + + # clearConsole() + # break; + else: + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + if rt_cd == '1': # 에러일 경우 처리 + print("### ERROR RETURN CODE [ %s ] MSG [ %s ]" % (rt_cd, jsonObject["body"]["msg1"])) + break + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ] MSG [ %s ]" % (rt_cd, jsonObject["body"]["msg1"])) + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0STCNI0" or trid == "H0STCNI9": + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/python/ws_commodity_future.py b/한국투자증권(API)/legacy/websocket/python/ws_commodity_future.py new file mode 100644 index 0000000..0d0018c --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_commodity_future.py @@ -0,0 +1,283 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +# 상품선물호가 출력라이브러리 +def stockhoka_productfuts(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("상품선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 상품선물체결처리 출력라이브러리 +def stockspurchase_productfuts(data_cnt, data): + print("============================================") + # print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드|미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가|선물매수호가|매도호가잔량|매수호가잔량|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|협의대량거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_futsoptn(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + print(aes_dec_str) + pValue = aes_dec_str.split('^') + print(pValue) + + if pValue[6] == '0': # 체결통보 + print("#### 지수선물옵션 체결 통보 ####") + menulist_sign = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_sign.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # pValue[6] == 'L', 주문·정정·취소·거부 접수 통보 + + if pValue[5] == '1': # 정정 접수 통보 (정정구분이 1일 경우) + print("#### 지수선물옵션 정정 접수 통보 ####") + menulist_revise = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|정정수량|정정단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_revise.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[5] == '2': # 취소 접수 통보 (정정구분이 2일 경우) + print("#### 지수선물옵션 취소 접수 통보 ####") + menulist_cancel = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|취소수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_cancel.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[11] == '1': # 거부 접수 통보 (거부여부가 1일 경우) + print("#### 지수선물옵션 거부 접수 통보 ####") + menulist_refuse = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|주문단가|주문시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_refuse.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # 주문 접수 통보 + print("#### 지수선물옵션 주문접수 통보 ####") + menulist_order = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_order.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +### 앱키 정의 ### + +async def connect(): + + try: + g_appkey = "앱키를 입력하세요" + g_appsecret = "앱 시크릿키를 입력하세요" + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 + code_list = [['1','H0CFASP0','175V08'],['1','H0CFCNT0','175T11'], # 상품선물호가, 체결가 + ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + senddata_list=[] + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print(f"Recev Command is :{data}") # 정제되지 않은 Request / Response 출력 + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0CFASP0": # 상품선물호가 tr 일경우의 처리 단계 + print("#### 상품선물호가 ####") + stockhoka_productfuts(recvstr[3]) + + elif trid0 == "H0CFCNT0": # 상품선물체결 데이터 처리 + print("#### 상품선물체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_productfuts(data_cnt, recvstr[3]) + + elif data[0] == '1': + + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0IFCNI0": # 선물옵션체결 통보 처리 + print("#### 선물옵션 통보 처리 ####") + stocksigningnotice_futsoptn(recvstr[3], aes_key, aes_iv) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0IFCNI0": + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/python/ws_domestic+overseas_stock.py b/한국투자증권(API)/legacy/websocket/python/ws_domestic+overseas_stock.py new file mode 100644 index 0000000..a1ddbc1 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_domestic+overseas_stock.py @@ -0,0 +1,397 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + +# [필수] 유료 시세 수신을 위한 access_token 발급 함수 +# 해외주식/해외선물 유료 시세 수신 전 반드시 이 함수를 호출해 access_token을 발급받아야 함 +# +# === 해외 유료 시세 수신 안내 === +# ▒ 해외주식 (HDFSASP0, HDFSASP1, HDFSCNT0: 미국, 중국, 일본, 베트남, 홍콩) +# - 무료 시세: 별도 신청 없이 수신 가능 +# - 유료 시세: HTS 또는 MTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7781] 시세신청(실시간) +# > MTS(한국투자 앱): 고객지원 > 거래서비스 신청 > 해외증권 > 해외 실시간 시세 신청 +# +# ▒ 해외선물 (HDFFF020, HDFFF010: CME, SGX / 기타 거래소는 무료 시세 제공) +# - CME, SGX: 무료 시세 없음 → 유료 시세 신청 필수 +# - 유료 시세: HTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7936] 해외선물옵션 실시간 시세신청/조회 +# +# ▒ 유료 시세 수신 절차 +# 1. HTS 또는 MTS에서 유료 시세 신청 +# 2. get_access_token()으로 access_token 발급 (※ 신청 후에 발급해야 유효) +# 3. 토큰 발급 시점 기준 최대 2시간 이내에 유료 권한 자동 반영 +# 4. 이후 웹소켓 연결 → 유료 시세 수신 가능 +def get_access_token(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "appsecret": secret} + PATH = "oauth2/tokenP" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + access_token = res.json()["access_token"] + return access_token + +### 1. 국내주식 ### + +# 국내주식호가 출력라이브러리 +def stockhoka_domestic(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + print("주식매매 구분코드 [%s]" % (recvvalue[58])) + + +# 국내주식체결처리 출력라이브러리 +def stockspurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량|매수호가잔량|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드|정적VI발동기준가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식체결통보 출력라이브러리 +def stocksigningnotice_domestic(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[13] == '2': # 체결통보 + print("#### 국내주식 체결 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|체결수량|체결단가|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|주문가격" + menustr1 = menulist.split('|') + else: + print("#### 국내주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|주문수량|주문가격|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|체결단가" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +### 2. 해외주식 ### + +# 해외주식호가 출력라이브러리 +def stockhoka_overseas(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("실시간종목코드 [" + recvvalue[0] + "]" + ", 종목코드 [" + recvvalue[1] + "]") + print("소숫점자리수 [" + recvvalue[2] + "]") + print("현지일자 [" + recvvalue[3] + "]" + ", 현지시간 [" + recvvalue[4] + "]") + print("한국일자 [" + recvvalue[5] + "]" + ", 한국시간 [" + recvvalue[6] + "]") + print("======================================") + print("매수총 잔량 [%s]" % (recvvalue[7])) + print("매수총잔량대비 [%s]" % (recvvalue[9])) + print("매도총 잔량 [%s]" % (recvvalue[8])) + print("매도총잔략대비 [%s]" % (recvvalue[10])) + print("매수호가 [%s]" % (recvvalue[11])) + print("매도호가 [%s]" % (recvvalue[12])) + print("매수잔량 [%s]" % (recvvalue[13])) + print("매도잔량 [%s]" % (recvvalue[14])) + print("매수잔량대비 [%s]" % (recvvalue[15])) + print("매도잔량대비 [%s]" % (recvvalue[16])) + + +# 해외주식체결처리 출력라이브러리 +def stockspurchase_overseas(data_cnt, data): + print("============================================") + menulist = "실시간종목코드|종목코드|수수점자리수|현지영업일자|현지일자|현지시간|한국일자|한국시간|시가|고가|저가|현재가|대비구분|전일대비|등락율|매수호가|매도호가|매수잔량|매도잔량|체결량|거래량|거래대금|매도체결량|매수체결량|체결강도|시장구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + + +# 해외주식체결통보 출력라이브러리 +def stocksigningnotice_overseas(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[12] == '2': # 체결통보 + print("#### 해외주식 체결 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + else: + print("#### 해외주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|주문수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량_미출력|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +### 웹소켓 연결 ### + +async def connect(): + try: + + g_appkey = "앱키를 입력하세요" + g_appsecret = "앱 시크릿키를 입력하세요" + + # 해외주식/해외선물(CME, SGX) 유료시세 사용 시 필수(2시간 이내 유료신청정보 동기화) + # access_token = get_access_token(appkey, appsecret) + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 # 모의투자 국내주식 체결통보: H0STCNI9 + code_list = [['1','H0STASP0','005930'],['1','H0STCNT0','005930'],['1','H0STCNI0','HTS ID를 입력하세요'], + ['1','H0STASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + code_list = [['1','H0STASP0','005930'],['1','H0STASP0','RBAQAAPL']] + code_list = [['1','H0STASP0','005930'],['1','H0STCNT0','005930'],['1','H0STCNI0','HTS ID를 입력하세요'], + ['1','H0STASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + senddata_list=[] + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print(f"Recev Command is :{data}") + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0STASP0": # 주식호가tr 일경우의 처리 단계 + print("#### 주식호가 ####") + stockhoka_domestic(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "H0STCNT0": # 주식체결 데이터 처리 + print("#### 주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_domestic(data_cnt, recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "HDFSASP1": # 해외주식호가tr 일경우의 처리 단계 + print("#### 해외주식호가 ####") + stockhoka_overseas(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "HDFSCNT0": # 주식체결 데이터 처리 + print("#### 해외주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_overseas(data_cnt, recvstr[3]) + await asyncio.sleep(0.5) + + elif data[0] == '1': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0STCNI0" or trid0 == "H0STCNI9": # 주실체결 통보 처리 + stocksigningnotice_domestic(recvstr[3], aes_key, aes_iv) + + elif trid0 == "H0GSCNI0" or trid0 == "H0GSCNI9": # 해외주실체결 통보 처리 + stocksigningnotice_overseas(recvstr[3], aes_key, aes_iv) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0STCNI0" or trid == "H0STCNI9": + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "H0GSCNI0" or trid == "H0GSCNI9": + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) diff --git a/한국투자증권(API)/legacy/websocket/python/ws_domestic_future.py b/한국투자증권(API)/legacy/websocket/python/ws_domestic_future.py new file mode 100644 index 0000000..7436b46 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_domestic_future.py @@ -0,0 +1,633 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +# 지수선물호가 출력라이브러리 +def stockhoka_futs(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("지수선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 지수옵션호가 출력라이브러리 +def stockhoka_optn(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("지수옵션 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 지수선물체결처리 출력라이브러리 +def stockspurchase_futs(data_cnt, data): + print("============================================") + # print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드|미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가|선물매수호가|매도호가잔량|매수호가잔량|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|협의대량거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 지수옵션체결처리 출력라이브러리 +def stockspurchase_optn(data_cnt, data): + print("============================================") + # print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|평균변동성|협의대량누적거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 상품선물호가 출력라이브러리 +def stockhoka_productfuts(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("상품선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 상품선물체결처리 출력라이브러리 +def stockspurchase_productfuts(data_cnt, data): + print("============================================") + # print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드|미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가|선물매수호가|매도호가잔량|매수호가잔량|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|협의대량거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 주식선물호가 출력라이브러리 +def stockhoka_stockfuts(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("주식선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 주식선물체결처리 출력라이브러리 +def stockspurchase_stockfuts(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|주식현재가|전일대비부호|전일대비|선물전일대비율|주식시가2|주식최고가|주식최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드1|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가2대비현재가|최고가시간|최고가대비현재가부호|최고가대비현재가|최저가시간|최저가대비현재가부호|최저가대비현재가|매수2비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|매도호가1|매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 주식옵션호가 출력라이브러리 +def stockhoka_stockoptn(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("주식옵션 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 주식옵션체결처리 출력라이브러리 +def stockspurchase_stockoptn(data_cnt, data): + print("============================================") + # print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가2|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간선물(CME)체결처리 출력라이브러리 +def stockspurchase_cmefuts(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가2|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드1|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가1|선물매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간선물(CME)호가 출력라이브러리 +def stockhoka_cmefuts(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("야간선물(CME) ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 야간옵션(EUREX)체결처리 출력라이브러리 +def stockspurchase_eurexoptn(data_cnt, data): + print("============================================") + print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가2|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간옵션(EUREX)호가 출력라이브러리 +def stockhoka_eurexoptn(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("야간옵션(EUREX) ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + +# 야간옵션(EUREX)예상체결처리 출력라이브러리 +def stocksexppurchase_eurexoptn(data_cnt, data): + print("============================================") + print(data) + menulist = "옵션단축종목코드|영업시간|예상체결가|예상체결대비|예상체결대비부호|예상체결전일대비율|예상장운영구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_futsoptn(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + print(aes_dec_str) + pValue = aes_dec_str.split('^') + print(pValue) + + if pValue[6] == '0': # 체결통보 + print("#### 지수선물옵션 체결 통보 ####") + menulist_sign = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_sign.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # pValue[6] == 'L', 주문·정정·취소·거부 접수 통보 + + if pValue[5] == '1': # 정정 접수 통보 (정정구분이 1일 경우) + print("#### 선물옵션 정정 접수 통보 ####") + menulist_revise = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|정정수량|정정단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_revise.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[5] == '2': # 취소 접수 통보 (정정구분이 2일 경우) + print("#### 선물옵션 취소 접수 통보 ####") + menulist_cancel = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|취소수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_cancel.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[11] == '1': # 거부 접수 통보 (거부여부가 1일 경우) + print("#### 선물옵션 거부 접수 통보 ####") + menulist_refuse = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|주문단가|주문시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_refuse.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # 주문 접수 통보 + print("#### 선물옵션 주문접수 통보 ####") + menulist_order = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_order.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +### 앱키 정의 ### + +async def connect(): + try: + g_appkey = "앱키를 입력하세요" + g_appsecret = "앱 시크릿키를 입력하세요" + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + ### 3-1. 국내 지수선물옵션 호가, 체결가, 체결통보 ### # 모의투자 선물옵션 체결통보: H0IFCNI9 + # code_list = [['1','H0IFASP0','101T12'],['1','H0IFCNT0','101T12'], # 지수선물호가, 체결가 + # ['1','H0IOASP0','201T11317'],['1','H0IOCNT0','201T11317'], # 지수옵션호가, 체결가 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-2. 국내 상품선물 호가, 체결가, 체결통보 ### + # code_list = [['1','H0CFASP0','175T11'],['1','H0CFCNT0','175T11'], # 상품선물호가, 체결가 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-3. 국내 주식선물옵션 호가, 체결가, 체결통보 ### + # code_list = [['1', 'H0ZFCNT0', '111V06'], ['1', 'H0ZFASP0', '111V06'],['1', 'H0ZFANC0', '111V06'], # 주식선물호가, 체결가, 예상체결 + # ['1', 'H0ZOCNT0', '211V05059'], ['1', 'H0ZOASP0', '211V05059'], ['1', 'H0ZOANC0', '211V05059'], # 주식옵션호가, 체결가, 예상체결 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-4. 국내 야간옵션(EUREX) 호가, 체결가, 예상체결, 체결통보 ### + # code_list = [['1', 'H0EUCNT0', '101V06'], ['1', 'H0EUASP0', '101V06'], ['1', 'H0EUANC0', '101V06'], ['1', 'H0EUCNI0', 'HTS ID를 입력하세요']] + + ### 3-5. 국내 야간선물(CME) 호가, 체결가, 체결통보 ### + # code_list = [['1', 'H0MFCNT0', '101V06'], ['1', 'H0MFASP0', '101V06'], ['1', 'H0MFCNI0', 'HTS ID를 입력하세요']] + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 + code_list = [['1','H0IFASP0','101T12'],['1','H0IFCNT0','101T12'], # 지수선물호가, 체결가 + ['1','H0IOASP0','201T11317'],['1','H0IOCNT0','201T11317'], # 지수옵션호가, 체결가 + ['1','H0CFASP0','175V06'],['1','H0CFCNT0','175V06'], # 상품선물호가, 체결가 + ['1', 'H0ZFCNT0', '111V06'], ['1', 'H0ZFASP0', '111V06'], # 주식선물 체결, 호가 + ['1', 'H0ZOCNT0', '211V05059'], ['1', 'H0ZOASP0', '211V05059'], # 주식옵션 체결, 호가 + ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + senddata_list=[] + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print(f"Recev Command is :{data}") # 정제되지 않은 Request / Response 출력 + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0IFASP0": # 지수선물호가 tr 일경우의 처리 단계 + print("#### 지수선물 호가 ####") + stockhoka_futs(recvstr[3]) + # await asyncio.sleep(0.5) + + elif trid0 == "H0IFCNT0": # 지수선물체결 데이터 처리 + print("#### 지수선물 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_futs(data_cnt, recvstr[3]) + # await asyncio.sleep(0.5) + + elif trid0 == "H0IOASP0": # 지수옵션호가 tr 일경우의 처리 단계 + print("#### 지수옵션 호가 ####") + stockhoka_optn(recvstr[3]) + # await asyncio.sleep(0.5) + + elif trid0 == "H0IOCNT0": # 지수옵션체결 데이터 처리 + print("#### 지수옵션 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_optn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.5) + + elif trid0 == "H0CFASP0": # 상품선물호가 tr 일경우의 처리 단계 + print("#### 상품선물 호가 ####") + stockhoka_productfuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0CFCNT0": # 상품선물체결 데이터 처리 + print("#### 상품선물 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_productfuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFCNT0": # 주식선물 체결 데이터 처리 + print("#### 주식선물 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_stockfuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFASP0": # 주식선물 호가 데이터 처리 + print("#### 주식선물 호가 ####") + stockhoka_stockfuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFANC0": # 주식선물 예상체결 데이터 처리 + print("#### 주식선물 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_stockfuts(data_cnt, recvstr[3]) + + elif trid0 == "H0ZOCNT0": # 주식옵션 체결 데이터 처리 + print("#### 주식옵션 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_stockoptn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZOASP0": # 주식옵션 호가 데이터 처리 + print("#### 주식옵션 호가 ####") + stockhoka_stockoptn(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZOANC0": # 주식옵션 예상체결 데이터 처리 + print("#### 주식옵션 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_stockoptn(data_cnt, recvstr[3]) + + + elif trid0 == "H0MFCNT0": # 야간선물(CME) 체결 데이터 처리 + print("#### 야간선물(CME) 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_cmefuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0MFASP0": # 야간선물(CME) 호가 데이터 처리 + print("#### 야간선물(CME) 호가 ####") + stockhoka_cmefuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUCNT0": # 야간옵션(EUREX) 체결 데이터 처리 + print("#### 야간옵션(EUREX) 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_eurexoptn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUASP0": # 야간옵션(EUREX) 호가 데이터 처리 + print("#### 야간옵션(EUREX) 호가 ####") + stockhoka_eurexoptn(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUANC0": # 야간옵션(EUREX) 예상체결 데이터 처리 + print("#### 야간옵션(EUREX) 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_eurexoptn(data_cnt, recvstr[3]) + + + elif data[0] == '1': + + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0IFCNI0": # 지수선물옵션체결 통보 처리 + stocksigningnotice_futsoptn(recvstr[3], aes_key, aes_iv) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0IFCNI0" or trid == "H0MFCNI0" or trid == "H0EUCNI0": # 지수/상품/주식 선물옵션 & 야간선물옵션 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) diff --git a/한국투자증권(API)/legacy/websocket/python/ws_domestic_overseas_all.py b/한국투자증권(API)/legacy/websocket/python/ws_domestic_overseas_all.py new file mode 100644 index 0000000..3461071 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_domestic_overseas_all.py @@ -0,0 +1,1508 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + +# [필수] 유료 시세 수신을 위한 access_token 발급 함수 +# 해외주식/해외선물 유료 시세 수신 전 반드시 이 함수를 호출해 access_token을 발급받아야 함 +# +# === 해외 유료 시세 수신 안내 === +# ▒ 해외주식 (HDFSASP0, HDFSASP1, HDFSCNT0: 미국, 중국, 일본, 베트남, 홍콩) +# - 무료 시세: 별도 신청 없이 수신 가능 +# - 유료 시세: HTS 또는 MTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7781] 시세신청(실시간) +# > MTS(한국투자 앱): 고객지원 > 거래서비스 신청 > 해외증권 > 해외 실시간 시세 신청 +# +# ▒ 해외선물 (HDFFF020, HDFFF010: CME, SGX / 기타 거래소는 무료 시세 제공) +# - CME, SGX: 무료 시세 없음 → 유료 시세 신청 필수 +# - 유료 시세: HTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7936] 해외선물옵션 실시간 시세신청/조회 +# +# ▒ 유료 시세 수신 절차 +# 1. HTS 또는 MTS에서 유료 시세 신청 +# 2. get_access_token()으로 access_token 발급 (※ 신청 후에 발급해야 유효) +# 3. 토큰 발급 시점 기준 최대 2시간 이내에 유료 권한 자동 반영 +# 4. 이후 웹소켓 연결 → 유료 시세 수신 가능 +def get_access_token(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "appsecret": secret} + PATH = "oauth2/tokenP" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + access_token = res.json()["access_token"] + return access_token + +### 1-1. 국내주식 ### + +# 국내주식호가 출력라이브러리 +def stockhoka_domestic(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + print("주식매매 구분코드 [%s]" % (recvvalue[58])) + + +# 국내주식체결처리 출력라이브러리 +def stockspurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량|매수호가잔량|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드|정적VI발동기준가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식예상체결 출력라이브러리 +def stockexppurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비구분|전일대비|등락율|가중평균주식가격|시가|고가|저가|매도호가|매수호가|거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량1|매수호가잔량1|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식체결통보 출력라이브러리 +def stocksigningnotice_domestic(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[13] == '2': # 체결통보 + print("#### 국내주식 체결 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|체결수량|체결단가|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|주문가격" + menustr1 = menulist.split('|') + else: + print("#### 국내주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|주문수량|주문가격|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|체결단가" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +# 국내주식 실시간회원사 출력라이브러리 +def stocksmember_domestic(data_cnt, data): + print("============================================") + print(data) + menulist = "유가증권단축종목코드|매도2회원사명1|매도2회원사명2|매도2회원사명3|매도2회원사명4|매도2회원사명5|매수회원사명1|매수회원사명2|매수회원사명3|매수회원사명4|매수회원사명5|총매도수량1|총매도수량2|총매도수량3|총매도수량4|총매도수량5|총매수2수량1|총매수2수량2|총매수2수량3|총매수2수량4|총매수2수량5|매도거래원구분1|매도거래원구분2|매도거래원구분3|매도거래원구분4|매도거래원구분5|매수거래원구분1|매수거래원구분2|매수거래원구분3|매수거래원구분4|매수거래원구분5|매도거래원코드1|매도거래원코드2|매도거래원코드3|매도거래원코드4|매도거래원코드5|매수거래원코드1|매수거래원코드2|매수거래원코드3|매수거래원코드4|매수거래원코드5|매도회원사비중1|매도회원사비중2|매도회원사비중3|매도회원사비중4|매도회원사비중5|매수2회원사비중1|매수2회원사비중2|매수2회원사비중3|매수2회원사비중4|매수2회원사비중5|매도수량증감1|매도수량증감2|매도수량증감3|매도수량증감4|매도수량증감5|매수2수량증감1|매수2수량증감2|매수2수량증감3|매수2수량증감4|매수2수량증감5|외국계총매도수량|외국계총매수2수량|외국계총매도수량증감|외국계총매수2수량증감|외국계순매수수량|외국계매도비중|외국계매수2비중|매도2영문회원사명1|매도2영문회원사명2|매도2영문회원사명3|매도2영문회원사명4|매도2영문회원사명5|매수영문회원사명1|매수영문회원사명2|매수영문회원사명3|매수영문회원사명4|매수영문회원사명5" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식 실시간프로그램매매 출력라이브러리 +def stocksprogramtrade_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|매도체결량|매도거래대금|매수2체결량|매수2거래대금|순매수체결량|순매수거래대금|매도호가잔량|매수호가잔량|전체순매수호가잔량" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식 장운영정보 출력라이브러리 +def stocksmarketinfo_domestic(data_cnt, data): + print("============================================") + print(data) + menulist = "유가증권단축종목코드|거래정지여부|거래정지사유내용|장운영구분코드|예상장운영구분코드|임의연장구분코드|동시호가배분처리구분코드|종목상태구분코드|VI적용구분코드|시간외단일가VI적용구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 국내주식시간외체결 출력라이브러리 +def stockoverpurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비구분|전일대비|등락율|가중평균주식가격|시가|고가|저가|매도호가|매수호가|거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량1|매수호가잔량1|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식시간외예상체결 출력라이브러리 +def stockoverexppurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비구분|전일대비|등락율|가중평균주식가격|시가|고가|저가|매도호가|매수호가|거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량1|매수호가잔량1|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식시간외호가 출력라이브러리 +def stockoverhoka_domestic(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockoverhoka_domestic[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + + +# 국내ETF NAV추이 출력라이브러리 +def etfnavtrend_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|NAV|NAV전일대비부호|NAV전일대비|NAV전일대비율|NAV시가|NAV고가|NAV저가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +### 1-2. 국내지수 ### + +# 국내지수체결 출력라이브러리 +def indexpurchase_domestic(data_cnt, data): + print("============================================") + menulist = "업종구분코드|영업시간|현재가지수|전일대비부호|업종지수전일대비|누적거래량|누적거래대금|건별거래량|건별거래대금|전일대비율|시가지수|지수최고가|지수최저가|시가대비지수현재가|시가대비지수부호|최고가대비지수현재가|최고가대비지수부호|최저가대비지수현재가|최저가대비지수부호|전일종가대비시가2비율|전일종가대비최고가비율|전일종가대비최저가비율|상한종목수|상승종목수|보합종목수|하락종목수|하한종목수|기세상승종목수|기세하락종목수|TICK대비" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 국내지수예상체결 출력라이브러리 +def indexexppurchase_domestic(data_cnt, data): + print("============================================") + menulist = "업종구분코드|영업시간|현재가지수|전일대비부호|업종지수전일대비|누적거래량|누적거래대금|건별거래량|건별거래대금|전일대비율|상한종목수|상승종목수|보합종목수|하락종목수|하한종목수" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 국내지수 실시간프로그램매매 출력라이브러리 +def indexprogramtrade_domestic(data_cnt, data): + print("============================================") + menulist = "업종구분코드|영업시간|차익매도위탁체결량|차익매도자기체결량|차익매수2위탁체결량|차익매수2자기체결량|비차익매도위탁체결량|비차익매도자기체결량|비차익매수2위탁체결량|비차익매수2자기체결량|차익매도위탁체결금액|차익매도자기체결금액|차익매수2위탁체결금액|차익매수2자기체결금액|비차익매도위탁체결금액|비차익매도자기체결금액|비차익매수2위탁체결금액|비차익매수2자기체결금액|차익합계매도거래량|차익합계매도거래량비율|차익합계매도거래대금|차익합계매도거래대금비율|차익합계매수2거래량|차익합계매수거래량비율|차익합계매수2거래대금|차익합계매수거래대금비율|차익합계순매수수량|차익합계순매수수량비율|차익합계순매수거래대금|차익합계순매수거래대금비율|비차익합계매도거래량|비차익합계매도거래량비율|비차익합계매도거래대금|비차익합계매도거래대금비율|비차익합계매수2거래량|비차익합계매수거래량비율|비차익합계매수2거래대금|비차익합계매수거래대금비율|비차익합계순매수수량|비차익합계순매수수량비율|비차익합계순매수거래대금|비차익합계순매수거래대금비|전체위탁매도거래량|위탁매도거래량비율|전체위탁매도거래대금|위탁매도거래대금비율|전체위탁매수2거래량|위탁매수거래량비율|전체위탁매수2거래대금|위탁매수거래대금비율|전체위탁순매수수량|위탁순매수수량비율|전체위탁순매수거래대금|위탁순매수금액비율|전체자기매도거래량|자기매도거래량비율|전체자기매도거래대금|자기매도거래대금비율|전체자기매수2거래량|자기매수거래량비율|전체자기매수2거래대금|자기매수거래대금비율|전체자기순매수수량|자기순매수량비율|전체자기순매수거래대금|자기순매수대금비율|총매도수량|전체매도거래량비율|총매도거래대금|전체매도거래대금비율|총매수수량|전체매수거래량비율|총매수2거래대금|전체매수거래대금비율|전체순매수수량|전체합계순매수수량비율|전체순매수거래대금|전체순매수거래대금비율|차익위탁순매수수량|차익위탁순매수거래대금|차익자기순매수수량|차익자기순매수거래대금|비차익위탁순매수수량|비차익위탁순매수거래대금|비차익자기순매수수량|비차익자기순매수거래대금|누적거래량|누적거래대금" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +### 1-3. ELW ### + +# ELW호가 출력라이브러리 +def elwhoka_domestic(data): + """ 넘겨받는데이터가 정상인지 확인 + print("elwhoka_domestic[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("ELW 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s] LP매도호가잔량10 [%s]" % (recvvalue[12], recvvalue[32], recvvalue[59])) + print("매도호가09 [%s] 잔량09 [%s] LP매도호가잔량09 [%s]" % (recvvalue[11], recvvalue[31], recvvalue[58])) + print("매도호가08 [%s] 잔량08 [%s] LP매도호가잔량08 [%s]" % (recvvalue[10], recvvalue[30], recvvalue[57])) + print("매도호가07 [%s] 잔량07 [%s] LP매도호가잔량07 [%s]" % (recvvalue[9], recvvalue[29], recvvalue[56])) + print("매도호가06 [%s] 잔량06 [%s] LP매도호가잔량06 [%s]" % (recvvalue[8], recvvalue[28], recvvalue[55])) + print("매도호가05 [%s] 잔량05 [%s] LP매도호가잔량05 [%s]" % (recvvalue[7], recvvalue[27], recvvalue[54])) + print("매도호가04 [%s] 잔량04 [%s] LP매도호가잔량04 [%s]" % (recvvalue[6], recvvalue[26], recvvalue[53])) + print("매도호가03 [%s] 잔량03 [%s] LP매도호가잔량03 [%s]" % (recvvalue[5], recvvalue[25], recvvalue[52])) + print("매도호가02 [%s] 잔량02 [%s] LP매도호가잔량02 [%s]" % (recvvalue[4], recvvalue[24], recvvalue[51])) + print("매도호가01 [%s] 잔량01 [%s] LP매도호가잔량01 [%s]" % (recvvalue[3], recvvalue[23], recvvalue[50])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s] LP매수호가잔량01 [%s]" % (recvvalue[13], recvvalue[33], recvvalue[60])) + print("매수호가02 [%s] 잔량02 [%s] LP매수호가잔량02 [%s]" % (recvvalue[14], recvvalue[34], recvvalue[61])) + print("매수호가03 [%s] 잔량03 [%s] LP매수호가잔량03 [%s]" % (recvvalue[15], recvvalue[35], recvvalue[62])) + print("매수호가04 [%s] 잔량04 [%s] LP매수호가잔량04 [%s]" % (recvvalue[16], recvvalue[36], recvvalue[63])) + print("매수호가05 [%s] 잔량05 [%s] LP매수호가잔량05 [%s]" % (recvvalue[17], recvvalue[37], recvvalue[64])) + print("매수호가06 [%s] 잔량06 [%s] LP매수호가잔량06 [%s]" % (recvvalue[18], recvvalue[38], recvvalue[65])) + print("매수호가07 [%s] 잔량07 [%s] LP매수호가잔량07 [%s]" % (recvvalue[19], recvvalue[39], recvvalue[66])) + print("매수호가08 [%s] 잔량08 [%s] LP매수호가잔량08 [%s]" % (recvvalue[20], recvvalue[40], recvvalue[67])) + print("매수호가09 [%s] 잔량09 [%s] LP매수호가잔량09 [%s]" % (recvvalue[21], recvvalue[41], recvvalue[68])) + print("매수호가10 [%s] 잔량10 [%s] LP매수호가잔량10 [%s]" % (recvvalue[22], recvvalue[42], recvvalue[69])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("LP총매도호가잔량 [%s]" % (recvvalue[70])) + print("LP총매수호가잔량 [%s]" % (recvvalue[71])) + print("예상 체결가 [%s]" % (recvvalue[45])) + print("예상 체결량 [%s]" % (recvvalue[46])) + print("예상 체결대비부호 [%s]" % (recvvalue[47])) + print("예상 체결대비 [%s]" % (recvvalue[48])) + print("예상 체결전일대비율 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[72])) + + +# ELW체결처리 출력라이브러리 +def elwpurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가2|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분코드|매수2비율|전일거래량대비등락율|시가시간|시가2대비현재가부호|시가2대비현재가|최고가시간|최고가대비현재가부호|최고가대비현재가|최저가시간|최저가대비현재가부호|최저가대비현재가|영업일자|신장운영구분코드|거래정지여부|매도호가잔량1|매수호가잔량1|총매도호가잔량|총매수호가잔량|시간가치값|패리티|프리미엄값|기어링|손익분기비율|내재가치값|프리미엄비율|자본지지점|레버리지값|델타|감마|베가|세타|로우|HTS내재변동성|HTS이론가|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|접근도|LP보유량|LP보유비율|LP순매도량" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# ELW예상체결처리 출력라이브러리 +def elwexppurchase_domestic(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가2|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분코드|매수2비율|전일거래량대비등락율|시가시간|시가2대비현재가부호|시가2대비현재가|최고가시간|최고가대비현재가부호|최고가대비현재가|최저가시간|최저가대비현재가부호|최저가대비현재가|영업일자|신장운영구분코드|거래정지여부|매도호가잔량1|매수호가잔량1|총매도호가잔량|총매수호가잔량|시간가치값|패리티|프리미엄값|기어링|손익분기비율|내재가치값|프리미엄비율|자본지지점|레버리지값|델타|감마|베가|세타|로우|HTS내재변동성|HTS이론가|거래량회전율|LP보유량|LP보유비율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + + +### 2. 해외주식 ### + +# 해외주식(아시아)호가 출력라이브러리 +def stockhoka_overseas_asia(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("실시간종목코드 [" + recvvalue[0] + "]" + ", 종목코드 [" + recvvalue[1] + "]") + print("소숫점자리수 [" + recvvalue[2] + "]") + print("현지일자 [" + recvvalue[3] + "]" + ", 현지시간 [" + recvvalue[4] + "]") + print("한국일자 [" + recvvalue[5] + "]" + ", 한국시간 [" + recvvalue[6] + "]") + print("======================================") + print("매수총 잔량 [%s]" % (recvvalue[7])) + print("매수총잔량대비 [%s]" % (recvvalue[9])) + print("매도총 잔량 [%s]" % (recvvalue[8])) + print("매도총잔략대비 [%s]" % (recvvalue[10])) + print("매수호가 [%s]" % (recvvalue[11])) + print("매도호가 [%s]" % (recvvalue[12])) + print("매수잔량 [%s]" % (recvvalue[13])) + print("매도잔량 [%s]" % (recvvalue[14])) + print("매수잔량대비 [%s]" % (recvvalue[15])) + print("매도잔량대비 [%s]" % (recvvalue[16])) + + +# 해외주식(미국)호가 출력라이브러리 +def stockhoka_overseas_usa(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("실시간종목코드 [" + recvvalue[0] + "]" + ", 종목코드 [" + recvvalue[1] + "]") + print("소숫점자리수 [" + recvvalue[2] + "]") + print("현지일자 [" + recvvalue[3] + "]" + ", 현지시간 [" + recvvalue[4] + "]") + print("한국일자 [" + recvvalue[5] + "]" + ", 한국시간 [" + recvvalue[6] + "]") + print("======================================") + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[12], recvvalue[14])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[11], recvvalue[13])) + print("======================================") + print("매수총 잔량 [%s]" % (recvvalue[7])) + print("매수총잔량대비 [%s]" % (recvvalue[9])) + print("매도총 잔량 [%s]" % (recvvalue[8])) + print("매도총잔략대비 [%s]" % (recvvalue[10])) + + +# 해외주식체결처리 출력라이브러리 +def stockspurchase_overseas(data_cnt, data): + print("============================================") + menulist = "실시간종목코드|종목코드|수수점자리수|현지영업일자|현지일자|현지시간|한국일자|한국시간|시가|고가|저가|현재가|대비구분|전일대비|등락율|매수호가|매도호가|매수잔량|매도잔량|체결량|거래량|거래대금|매도체결량|매수체결량|체결강도|시장구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 해외주식체결통보 출력라이브러리 +def stocksigningnotice_overseas(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[12] == '2': # 체결통보 + print("#### 해외주식 체결 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + else: + print("#### 해외주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|주문수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량_미출력|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +### 3. 국내선물옵션 ### + +# 지수선물호가 출력라이브러리 +def stockhoka_futs(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("지수선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 지수옵션호가 출력라이브러리 +def stockhoka_optn(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("지수옵션 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 지수선물체결처리 출력라이브러리 +def stockspurchase_futs(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드|미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가|선물매수호가|매도호가잔량|매수호가잔량|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|협의대량거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 지수옵션체결처리 출력라이브러리 +def stockspurchase_optn(data_cnt, data): + print("============================================") + # print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|평균변동성|협의대량누적거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 상품선물호가 출력라이브러리 +def stockhoka_productfuts(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("상품선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 상품선물체결처리 출력라이브러리 +def stockspurchase_productfuts(data_cnt, data): + print("============================================") + # print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드|미결제약정수량|미결제약정수량증감|시가시간|시가대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가|선물매수호가|매도호가잔량|매수호가잔량|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|협의대량거래량|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 주식선물호가 출력라이브러리 +def stockhoka_stockfuts(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("주식선물 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 주식선물체결처리 출력라이브러리 +def stockspurchase_stockfuts(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|주식현재가|전일대비부호|전일대비|선물전일대비율|주식시가2|주식최고가|주식최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드1|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가2대비현재가|최고가시간|최고가대비현재가부호|최고가대비현재가|최저가시간|최저가대비현재가부호|최저가대비현재가|매수2비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|매도호가1|매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율|실시간상한가|실시간하한가|실시간가격제한구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 주식선물예상체결처리 출력라이브러리 +def stocksexppurchase_stockfuts(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|예상체결가|예상체결대비|예상체결대비부호|예상체결전일대비율|예상장운영구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 주식옵션호가 출력라이브러리 +def stockhoka_stockoptn(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("주식옵션 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 주식옵션체결처리 출력라이브러리 +def stockspurchase_stockoptn(data_cnt, data): + print("============================================") + # print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가2|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 주식옵션예상체결처리 출력라이브러리 +def stocksexppurchase_stockoptn(data_cnt, data): + print("============================================") + print(data) + menulist = "옵션단축종목코드|영업시간|예상체결가|예상체결대비|예상체결대비부호|예상체결전일대비율|예상장운영구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간선물(CME)체결처리 출력라이브러리 +def stockspurchase_cmefuts(data_cnt, data): + print("============================================") + print(data) + menulist = "선물단축종목코드|영업시간|선물전일대비|전일대비부호|선물전일대비율|선물현재가|선물시가2|선물최고가|선물최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|시장베이시스|괴리율|근월물약정가|원월물약정가|스프레드1|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|체결강도|괴리도|미결제약정직전수량증감|이론베이시스|선물매도호가1|선물매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간선물(CME)호가 출력라이브러리 +def stockhoka_cmefuts(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("야간선물(CME) ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("선물매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("선물매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("선물매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("선물매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("선물매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("선물매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("선물매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("선물매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("선물매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("선물매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + + +# 야간옵션(EUREX)체결처리 출력라이브러리 +def stockspurchase_eurexoptn(data_cnt, data): + print("============================================") + print(data) + menulist = "옵션단축종목코드|영업시간|옵션현재가|전일대비부호|옵션전일대비|전일대비율|옵션시가2|옵션최고가|옵션최저가|최종거래량|누적거래량|누적거래대금|HTS이론가|HTS미결제약정수량|미결제약정수량증감|시가시간|시가2대비현재가부호|시가대비지수현재가|최고가시간|최고가대비현재가부호|최고가대비지수현재가|최저가시간|최저가대비현재가부호|최저가대비지수현재가|매수2비율|프리미엄값|내재가치값|시간가치값|델타|감마|베가|세타|로우|HTS내재변동성|괴리도|미결제약정직전수량증감|이론베이시스|역사적변동성|체결강도|괴리율|시장베이시스|옵션매도호가1|옵션매수호가1|매도호가잔량1|매수호가잔량1|매도체결건수|매수체결건수|순매수체결건수|총매도수량|총매수수량|총매도호가잔량|총매수호가잔량|전일거래량대비등락율" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 야간옵션(EUREX)호가 출력라이브러리 +def stockhoka_eurexoptn(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("야간옵션(EUREX) ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("옵션매도호가1 ["+recvvalue[ 2]+"]"+", 매도호가건수1 ["+recvvalue[12]+"]"+", 매도호가잔량1 ["+recvvalue[22]+"]") + print("옵션매도호가2 ["+recvvalue[ 3]+"]"+", 매도호가건수2 ["+recvvalue[13]+"]"+", 매도호가잔량2 ["+recvvalue[23]+"]") + print("옵션매도호가3 ["+recvvalue[ 4]+"]"+", 매도호가건수3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[24]+"]") + print("옵션매도호가4 ["+recvvalue[ 5]+"]"+", 매도호가건수4 ["+recvvalue[15]+"]"+", 매도호가잔량4 ["+recvvalue[25]+"]") + print("옵션매도호가5 ["+recvvalue[ 6]+"]"+", 매도호가건수5 ["+recvvalue[16]+"]"+", 매도호가잔량5 ["+recvvalue[26]+"]") + print("옵션매수호가1 ["+recvvalue[ 7]+"]"+", 매수호가건수1 ["+recvvalue[17]+"]"+", 매수호가잔량1 ["+recvvalue[27]+"]") + print("옵션매수호가2 ["+recvvalue[ 8]+"]"+", 매수호가건수2 ["+recvvalue[18]+"]"+", 매수호가잔량2 ["+recvvalue[28]+"]") + print("옵션매수호가3 ["+recvvalue[ 9]+"]"+", 매수호가건수3 ["+recvvalue[19]+"]"+", 매수호가잔량3 ["+recvvalue[29]+"]") + print("옵션매수호가4 ["+recvvalue[10 ]+"]"+", 매수호가건수4 ["+recvvalue[20]+"]"+", 매수호가잔량4 ["+recvvalue[30]+"]") + print("옵션매수호가5 ["+recvvalue[11]+"]"+", 매수호가건수5 ["+recvvalue[21]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가건수 ["+recvvalue[32]+"]"+", 총매도호가잔량 ["+recvvalue[34]+"]"+", 총매도호가잔량증감 ["+recvvalue[36]+"]") + print("총매수호가건수 ["+recvvalue[33]+"]"+", 총매수호가잔량 ["+recvvalue[35]+"]"+", 총매수호가잔량증감 ["+recvvalue[37]+"]") + +# 야간옵션(EUREX)예상체결처리 출력라이브러리 +def stocksexppurchase_eurexoptn(data_cnt, data): + print("============================================") + print(data) + menulist = "옵션단축종목코드|영업시간|예상체결가|예상체결대비|예상체결대비부호|예상체결전일대비율|예상장운영구분코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_futsoptn(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + # print(aes_dec_str) + pValue = aes_dec_str.split('^') + # print(pValue) + + if pValue[6] == '0': # 체결통보 + print("#### 국내선물옵션 체결 통보 ####") + menulist_sign = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_sign.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # pValue[6] == 'L', 주문·정정·취소·거부 접수 통보 + + if pValue[5] == '1': # 정정 접수 통보 (정정구분이 1일 경우) + print("#### 국내선물옵션 정정 접수 통보 ####") + menulist_revise = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|정정수량|정정단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_revise.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[5] == '2': # 취소 접수 통보 (정정구분이 2일 경우) + print("#### 국내선물옵션 취소 접수 통보 ####") + menulist_cancel = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|취소수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_cancel.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[11] == '1': # 거부 접수 통보 (거부여부가 1일 경우) + print("#### 국내선물옵션 거부 접수 통보 ####") + menulist_refuse = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|주문단가|주문시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_refuse.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # 주문 접수 통보 + print("#### 국내선물옵션 주문 접수 통보 ####") + menulist_order = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건|주문그룹ID|주문그룹SEQ|주문가격" + menustr = menulist_order.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +# 야간선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_ngtfutsoptn(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + # print(aes_dec_str) + pValue = aes_dec_str.split('^') + # print(pValue) + + if pValue[6] == '0': # 체결통보 + print("#### 야간선물옵션 체결 통보 ####") + menulist_sign = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|주문조건" + menustr = menulist_sign.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # pValue[6] == 'L', 주문·정정·취소·거부 접수 통보 + + if pValue[5] == '1': # 정정 접수 통보 (정정구분이 1일 경우) + print("#### 야간선물옵션 정정 접수 통보 ####") + menulist_revise = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|정정수량|정정단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건" + menustr = menulist_revise.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[5] == '2': # 취소 접수 통보 (정정구분이 2일 경우) + print("#### 야간선물옵션 취소 접수 통보 ####") + menulist_cancel = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|취소수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건" + menustr = menulist_cancel.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + elif pValue[11] == '1': # 거부 접수 통보 (거부여부가 1일 경우) + print("#### 야간선물옵션 거부 접수 통보 ####") + menulist_refuse = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|주문단가|주문시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건" + menustr = menulist_refuse.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + else: # 주문 접수 통보 + print("#### 국내선물옵션 주문 접수 통보 ####") + menulist_order = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|단축종목코드|주문수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|체결수량|계좌명|체결종목명|주문조건" + menustr = menulist_order.split('|') + i = 0 + for menu in menustr: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +### 4. 해외선물옵션 ### + +# 해외선물옵션호가 출력라이브러리 +def stockhoka_overseafut(data): + print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("종목코드 ["+recvvalue[ 0]+"]") + print("수신일자 ["+recvvalue[ 1]+"]") + print("수신시각 ["+recvvalue[ 2]+"]") + print("전일종가 ["+recvvalue[ 3]+"]") + print("====================================") + print("매수1수량 ["+recvvalue[ 4]+"]"+", 매수1번호 ["+recvvalue[ 5]+"]"+", 매수1호가 ["+recvvalue[ 6]+"]") + print("매도1수량 ["+recvvalue[ 7]+"]"+", 매도1번호 ["+recvvalue[ 8]+"]"+", 매도1호가 ["+recvvalue[ 9]+"]") + print("매수2수량 ["+recvvalue[10]+"]"+", 매수2번호 ["+recvvalue[11]+"]"+", 매수2호가 ["+recvvalue[12]+"]") + print("매도2수량 ["+recvvalue[13]+"]"+", 매도2번호 ["+recvvalue[14]+"]"+", 매도2호가 ["+recvvalue[15]+"]") + print("매수3수량 ["+recvvalue[16]+"]"+", 매수3번호 ["+recvvalue[17]+"]"+", 매수3호가 ["+recvvalue[18]+"]") + print("매도3수량 ["+recvvalue[19]+"]"+", 매도3번호 ["+recvvalue[20]+"]"+", 매도3호가 ["+recvvalue[21]+"]") + print("매수4수량 ["+recvvalue[22]+"]"+", 매수4번호 ["+recvvalue[23]+"]"+", 매수4호가 ["+recvvalue[24]+"]") + print("매도4수량 ["+recvvalue[25]+"]"+", 매도4번호 ["+recvvalue[26]+"]"+", 매도4호가 ["+recvvalue[27]+"]") + print("매수5수량 ["+recvvalue[28 ]+"]"+", 매수5번호 ["+recvvalue[29]+"]"+", 매수5호가 ["+recvvalue[30]+"]") + print("매도5수량 ["+recvvalue[31]+"]"+", 매도5번호 ["+recvvalue[32]+"]"+", 매도5호가 ["+recvvalue[33]+"]") + print("====================================") + print("전일정산가 ["+recvvalue[32]+"]") + + +# 해외선물옵션 체결처리 출력라이브러리 +def stockspurchase_overseafut(data_cnt, data): + print("============================================") + menulist = "종목코드|영업일자|장개시일자|장개시시각|장종료일자|장종료시각|전일종가|수신일자|수신시각|본장_전산장구분|체결가격|체결수량|전일대비가|등락률|시가|고가|저가|누적거래량|전일대비부호|체결구분|수신시각2만분의일초|전일정산가|전일정산가대비|전일정산가대비가격|전일정산가대비율" + menustr = menulist.split('|') + pValue = data.split('^') + print(pValue) + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 해외선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_overseafut(data, key, iv): + menulist = "유저ID|계좌번호|주문일자|주문번호|원주문일자|원주문번호|종목명|정정취소구분코드|매도매수구분코드|복합주문구분코드|가격구분코드|FM거래소접수구분코드|주문수량|FMLIMIT가격|FMSTOP주문가격|총체결수량|총체결단가|잔량|FM주문그룹일자|주문그룹번호|주문상세일시|조작상세일시|주문자|체결일자|체결번호|API체결번호|체결수량|FM체결가격|통화코드|위탁수수료|주문매체온라인여부|FM체결금액|선물옵션종목구분코드" + menustr1 = menulist.split('|') + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + print(aes_dec_str) + pValue = aes_dec_str.split('^') + print(pValue) + print("#### 해외선물옵션 체결통보 처리 ####") + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +### 5. 장내채권(일반채권) / 채권지수 ### + +# 장내채권호가 출력라이브러리(일반채권) +def bondhoka_domestic(data): + + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("채권종목코드 ["+recvvalue[ 0]+"]") + print("영업시간 ["+recvvalue[ 1]+"]") + print("====================================") + print("채권매도호가1 ["+recvvalue[ 4]+"]"+", 매도호가수익률1 ["+recvvalue[2]+"]"+", 매도호가잔량1 ["+recvvalue[6]+"]") + print("채권매도호가2 ["+recvvalue[ 10]+"]"+", 매도호가수익률2 ["+recvvalue[8]+"]"+", 매도호가잔량2 ["+recvvalue[12]+"]") + print("채권매도호가3 ["+recvvalue[ 16]+"]"+", 매도호가수익률3 ["+recvvalue[14]+"]"+", 매도호가잔량3 ["+recvvalue[18]+"]") + print("채권매도호가4 ["+recvvalue[ 22]+"]"+", 매도호가수익률4 ["+recvvalue[20]+"]"+", 매도호가잔량4 ["+recvvalue[24]+"]") + print("채권매도호가5 ["+recvvalue[ 28]+"]"+", 매도호가수익률5 ["+recvvalue[26]+"]"+", 매도호가잔량5 ["+recvvalue[30]+"]") + print("채권매수호가1 ["+recvvalue[ 5]+"]"+", 매수호가수익률1 ["+recvvalue[3]+"]"+", 매수호가잔량1 ["+recvvalue[7]+"]") + print("채권매수호가2 ["+recvvalue[ 11]+"]"+", 매수호가수익률2 ["+recvvalue[9]+"]"+", 매수호가잔량2 ["+recvvalue[13]+"]") + print("채권매수호가3 ["+recvvalue[ 17]+"]"+", 매수호가수익률3 ["+recvvalue[15]+"]"+", 매수호가잔량3 ["+recvvalue[19]+"]") + print("채권매수호가4 ["+recvvalue[23]+"]"+", 매수호가수익률4 ["+recvvalue[21]+"]"+", 매수호가잔량4 ["+recvvalue[25]+"]") + print("채권매수호가5 ["+recvvalue[29]+"]"+", 매수호가수익률5 ["+recvvalue[27]+"]"+", 매수호가잔량5 ["+recvvalue[31]+"]") + print("====================================") + print("총매도호가잔량 ["+recvvalue[32]+"]") + print("총매수호가잔량 ["+recvvalue[33]+"]") + + +# 장내채권체결처리 출력라이브러리(일반채권) +def bondpurchase_domestic(data_cnt, data): + print("============================================") + # print(data) + menulist = "표준종목코드|채권종목명|주식체결시간|전일대비부호|전일대비|전일대비율|현재가|체결거래량|시가|고가|저가|전일종가|현재수익률|시가수익률|고가수익률|저가수익률|누적거래량|전일거래량|체결유형코드" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + +# 채권지수 체결처리 출력라이브러리 +def bondindexpurchase_domestic(data_cnt, data): + print("============================================") + # print(data) + menulist = "지수ID|기준일자1|전송시간|총수익지수시가지수|총수익지수최고가|총수익지수최저가|총수익지수|전일총수익지수|총수익지수전일대비|총수익지수전일대비부호|총수익지수전일대비율|순가격지수|시장가격지수|Call재투자지수|Zero재투자지수|선물이론가격|평균듀레이션|평균컨벡서티|평균YTM|평균선도YTM" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +### 앱키 정의 ### + +async def connect(): + try: + + g_appkey = "앱키를 입력하세요" + g_appsecret = "앱 시크릿키를 입력하세요" + + # 해외주식/해외선물(CME, SGX) 유료시세 사용 시 필수(2시간 이내 유료신청정보 동기화) + # access_token = get_access_token(appkey, appsecret) + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 + + ### 1-1. 국내주식 호가, 체결가, 예상체결, 체결통보 ### # 모의투자 국내주식 체결통보: H0STCNI9 + # code_list = [['1','H0STASP0','005930'],['1','H0STCNT0','005930'],['1', 'H0STANC0', '005930'],['1','H0STCNI0','HTS ID를 입력하세요']] + + ### 1-2. 국내주식 실시간회원사, 실시간프로그램매매, 장운영정보 ### + # code_list = [['1', 'H0STMBC0', '005930'], ['1', 'H0STPGM0', '005930'], ['1', 'H0STMKO0', '005930']] + + ### 1-3. 국내주식 시간외 호가, 체결가, 예상체결 ### + # code_list = [['1','H0STOAA0','005930'],['1','H0STOUP0','005930'],['1', 'H0STOAC0', '005930']] + + ### 1-4. 국내지수 체결, 예상체결, 실시간프로그램매매 ### + # code_list = [['1', 'H0UPCNT0', '0001'], ['1', 'H0UPANC0', '0001'], ['1', 'H0UPPGM0', '0001']] + + ### 1-5. ELW 호가, 체결가, 예상체결 ### + # code_list = [['1', 'H0EWASP0', '58J297'],['1', 'H0EWCNT0', '58J297'],['1', 'H0EWANC0', '58J297']] + + ### 1-6. 국내ETF NAV 추이 ### + # code_list = [['1', 'H0STNAV0', '069500']] + + ### 2-1. 해외주식(미국) 호가, 체결가, 체결통보 ### # 모의투자 해외주식 체결통보: H0GSCNI9 + # code_list = [['1','HDFSASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 2-2. 해외주식(미국-주간) 호가, 체결가, 체결통보 ### # 모의투자 해외주식 체결통보: H0GSCNI9 + # code_list = [['1','HDFSASP0','RBAQAAPL'],['1','HDFSCNT0','RBAQAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 2-3. 해외주식(아시아) 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFSASP1','DHKS00003'],['1','HDFSCNT0','DHKS00003'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 3-1. 국내 지수선물옵션 호가, 체결가, 체결통보 ### # 모의투자 선물옵션 체결통보: H0IFCNI9 + # code_list = [['1','H0IFASP0','101T12'],['1','H0IFCNT0','101T12'], # 지수선물호가, 체결가 + # ['1','H0IOASP0','201T11317'],['1','H0IOCNT0','201T11317'], # 지수옵션호가, 체결가 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-2. 국내 상품선물 호가, 체결가, 체결통보 ### + # code_list = [['1','H0CFASP0','175T11'],['1','H0CFCNT0','175T11'], # 상품선물호가, 체결가 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-3. 국내 주식선물옵션 호가, 체결가, 체결통보 ### + # code_list = [['1', 'H0ZFCNT0', '111V06'], ['1', 'H0ZFASP0', '111V06'],['1', 'H0ZFANC0', '111V06'], # 주식선물호가, 체결가, 예상체결 + # ['1', 'H0ZOCNT0', '211V05059'], ['1', 'H0ZOASP0', '211V05059'], ['1', 'H0ZOANC0', '211V05059'], # 주식옵션호가, 체결가, 예상체결 + # ['1','H0IFCNI0','HTS ID를 입력하세요']] # 선물옵션체결통보 + + ### 3-4. 국내 야간옵션(EUREX) 호가, 체결가, 예상체결, 체결통보 ### + # code_list = [['1', 'H0EUCNT0', '101V06'], ['1', 'H0EUASP0', '101V06'], ['1', 'H0EUANC0', '101V06'], ['1', 'H0EUCNI0', 'HTS ID를 입력하세요']] + + ### 3-5. 국내 야간선물(CME) 호가, 체결가, 체결통보 ### + # code_list = [['1', 'H0MFCNT0', '101V06'], ['1', 'H0MFASP0', '101V06'], ['1', 'H0MFCNI0', 'HTS ID를 입력하세요']] + + ### 4. 해외선물옵션 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFFF020','FCAZ22'],['1','HDFFF010','FCAZ22'], # 해외선물 체결가, 호가 + # ['1','HDFFF020','OESH23 C3900'],['1','HDFFF010','OESH23 C3900'], # 해외옵션 체결가, 호가 + # ['1','HDFFF2C0','HTS ID를 입력하세요']] # 해외선물옵션 체결통보 + + ### 5. 장내채권(일반채권) 호가, 체결가 / 채권지수 체결가 ### + # code_list = [['1','H0BJASP0','KR2033022D33'],['1','H0BJCNT0','KR2033022D33'], # 일반채권 체결가, 호가 + # ['1','H0BICNT0','KBPR01']] # 채권지수 체결가 + + ### 1+2+3+4. 국내주식, 해외주식(미국), 해외주식(아시아), 국내 지수선물옵션, 국내 상품선물, 국내 주식선물옵션, 해외선물옵션 호가, 체결가, 체결통보 ### + code_list = [['1','H0STASP0','005930'],['1','H0STCNT0','005930'],['1', 'H0STANC0', '005930'],['1','H0STCNI0','HTS ID를 입력하세요'], + ['1','HDFSASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'], + ['1','HDFSASP1','DHKS00003'],['1','HDFSCNT0','DHKS00003'],['1','H0GSCNI0','HTS ID를 입력하세요'], + ['1','H0IFASP0','101T12'],['1','H0IFCNT0','101T12'],['1','H0IOASP0','201T11317'],['1','H0IOCNT0','201T11317'], ['1','H0CFASP0','175T11'],['1','H0CFCNT0','175T11'],['1', 'H0ZFCNT0', '111V06'], ['1', 'H0ZFASP0', '111V06'],['1', 'H0ZOCNT0', '211V05059'], ['1', 'H0ZOASP0', '211V05059'],['1','H0IFCNI0','HTS ID를 입력하세요'], + ['1','HDFFF020','FCAZ22'],['1','HDFFF010','FCAZ22'],['1','HDFFF020','OESH23 C3900'],['1','HDFFF010','OESH23 C3900'],['1','HDFFF2C0','HTS ID를 입력하세요']] + + senddata_list=[] + + print("url : ", url) + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + data = await websocket.recv() + # await asyncio.sleep(0.5) + print(f"Recev Command is :{data}") # 정제되지 않은 Request / Response 출력 + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0STASP0": # 주식호가tr 일경우의 처리 단계 + print("#### 국내주식 호가 ####") + stockhoka_domestic(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STCNT0": # 주식체결 데이터 처리 + print("#### 국내주식 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STANC0": # 국내주식 예상체결 데이터 처리 + print("#### 국내주식 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockexppurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STOUP0": # 국내주식 시간외체결 데이터 처리 + print("#### 국내주식 시간외체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockoverpurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STOAA0": # 국내주식 시간외호가 데이터 처리 + print("#### 국내주식 시간외호가 ####") + stockoverhoka_domestic(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STOAC0": # 국내주식 시간외예상체결데이터 처리 + print("#### 국내주식 시간외예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockoverexppurchase_domestic(data_cnt, recvstr[3]) + + elif trid0 == "H0STMBC0": # 국내주식 실시간회원사 데이터 처리 + print("#### 국내주식 실시간회원사 ####") + data_cnt = int(recvstr[2]) # 데이터 개수 + stocksmember_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STPGM0": # 국내주식 실시간프로그램매매 데이터 처리 + print("#### 국내주식 실시간프로그램매매 ####") + data_cnt = int(recvstr[2]) # 데이터 개수 + stocksprogramtrade_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0STMKO0": # 국내주식 장운영정보 데이터 처리 + print("#### 국내주식 장운영정보 ####") + data_cnt = int(recvstr[2]) # 데이터 개수 + stocksmarketinfo_domestic(data_cnt, recvstr[3]) + + elif trid0 == "H0STNAV0": # 국내주식 장운영정보 데이터 처리 + print("#### 국내ETF NAV추이 ####") + data_cnt = int(recvstr[2]) # 데이터 개수 + etfnavtrend_domestic(data_cnt, recvstr[3]) + + elif trid0 == "H0UPCNT0": # 국내지수 체결 데이터 처리 + print("#### 국내지수 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + indexpurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0UPANC0": # 국내지수 예상체결 데이터 처리 + print("#### 국내지수 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + indexexppurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0UPPGM0": # 국내지수 실시간프로그램매매 데이터 처리 + print("#### 국내지수 실시간프로그램매매 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + indexprogramtrade_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EWCNT0": # ELW 체결 데이터 처리 + print("#### ELW 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + elwpurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EWASP0": # ELW 호가 데이터 처리 + print("#### ELW 호가 ####") + elwhoka_domestic(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EWANC0": # ELW 예상체결 데이터 처리 + print("#### ELW 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + elwexppurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "HDFSASP0": # 해외주식호가tr 일경우의 처리 단계 + print("#### 해외(미국)주식호가 ####") + stockhoka_overseas_usa(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "HDFSASP1": # 해외주식호가tr 일경우의 처리 단계 + print("#### 해외(아시아)주식호가 ####") + stockhoka_overseas_asia(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "HDFSCNT0": # 해외주식체결 데이터 처리 + print("#### 해외주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_overseas(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0IFASP0": # 지수선물호가 tr 일경우의 처리 단계 + print("#### 지수선물호가 ####") + stockhoka_futs(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0IFCNT0": # 지수선물체결 데이터 처리 + print("#### 지수선물체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_futs(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0IOASP0": # 지수옵션호가 tr 일경우의 처리 단계 + print("#### 지수옵션호가 ####") + stockhoka_optn(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0IOCNT0": # 지수옵션체결 데이터 처리 + print("#### 지수옵션체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_optn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0CFASP0": # 상품선물호가 tr 일경우의 처리 단계 + print("#### 상품선물호가 ####") + stockhoka_productfuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0CFCNT0": # 상품선물체결 데이터 처리 + print("#### 상품선물체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_productfuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFCNT0": # 주식선물 체결 데이터 처리 + print("#### 주식선물 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_stockfuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFASP0": # 주식선물 호가 데이터 처리 + print("#### 주식선물 호가 ####") + stockhoka_stockfuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZFANC0": # 주식선물 예상체결 데이터 처리 + print("#### 주식선물 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_stockfuts(data_cnt, recvstr[3]) + + elif trid0 == "H0ZOCNT0": # 주식옵션 체결 데이터 처리 + print("#### 주식옵션 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_stockoptn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZOASP0": # 주식옵션 호가 데이터 처리 + print("#### 주식옵션 호가 ####") + stockhoka_stockoptn(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0ZOANC0": # 주식옵션 예상체결 데이터 처리 + print("#### 주식옵션 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_stockoptn(data_cnt, recvstr[3]) + + + elif trid0 == "H0MFCNT0": # 야간선물(CME) 체결 데이터 처리 + print("#### 야간선물(CME) 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_cmefuts(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0MFASP0": # 야간선물(CME) 호가 데이터 처리 + print("#### 야간선물(CME) 호가 ####") + stockhoka_cmefuts(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUCNT0": # 야간옵션(EUREX) 체결 데이터 처리 + print("#### 야간옵션(EUREX) 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_eurexoptn(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUASP0": # 야간옵션(EUREX) 호가 데이터 처리 + print("#### 야간옵션(EUREX) 호가 ####") + stockhoka_eurexoptn(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0EUANC0": # 야간옵션(EUREX) 예상체결 데이터 처리 + print("#### 야간옵션(EUREX) 예상체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stocksexppurchase_eurexoptn(data_cnt, recvstr[3]) + + elif trid0 == "HDFFF010": # 해외선물옵션호가 tr 일경우의 처리 단계 + print("#### 해외선물옵션호가 ####") + stockhoka_overseafut(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "HDFFF020": # 해외선물옵션체결 데이터 처리 + print("#### 해외선물옵션체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_overseafut(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0BJCNT0": + # 장내채권 체결 데이터 처리(일반채권) + print("#### 장내채권 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + bondpurchase_domestic(data_cnt, recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0BJASP0": + # 장내채권 호가 데이터 처리(일반채권) + print("#### 장내채권 호가 ####") + bondhoka_domestic(recvstr[3]) + # await asyncio.sleep(0.2) + + elif trid0 == "H0BICNT0": # 채권지수 예상체결 데이터 처리 + print("#### 채권지수 체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + bondindexpurchase_domestic(data_cnt, recvstr[3]) + + elif data[0] == '1': + + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0STCNI0" or trid0 == "H0STCNI9": # 주식체결 통보 처리 + stocksigningnotice_domestic(recvstr[3], aes_key, aes_iv) + # await asyncio.sleep(0.2) + + elif trid0 == "H0GSCNI0" or trid0 == "H0GSCNI9": # 해외주식체결 통보 처리 + stocksigningnotice_overseas(recvstr[3], aes_key, aes_iv) + # await asyncio.sleep(0.2) + + elif trid0 == "H0IFCNI0" or trid0 == "H0IFCNI9": # 지수/상품/주식 선물옵션체결 통보 처리 + stocksigningnotice_futsoptn(recvstr[3], aes_key, aes_iv) + # await asyncio.sleep(0.2) + + elif trid0 == "H0MFCNI0" or trid0 == "H0EUCNI0": # 야간선물옵션(CME, EUREX) 체결 통보 처리 + stocksigningnotice_ngtfutsoptn(recvstr[3], aes_key, aes_iv) + # await asyncio.sleep(0.2) + + elif trid0 == "HDFFF2C0": # 해외선물옵션체결 통보 처리 + stocksigningnotice_overseafut(recvstr[3], aes_key, aes_iv) + # await asyncio.sleep(0.2) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0STCNI0" or trid == "H0STCNI9": # 국내주식 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "H0GSCNI0": # 해외주식 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "H0IFCNI0" or trid == "H0MFCNI0" or trid == "H0EUCNI0": # 지수/상품/주식 선물옵션 & 야간선물옵션 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "HDFFF2C0": # 해외선물옵션 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) diff --git a/한국투자증권(API)/legacy/websocket/python/ws_domestic_stock.py b/한국투자증권(API)/legacy/websocket/python/ws_domestic_stock.py new file mode 100644 index 0000000..c292a11 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_domestic_stock.py @@ -0,0 +1,312 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + + +# 국내주식호가 출력라이브러리 +def stockhoka(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("유가증권 단축 종목코드 [" + recvvalue[0] + "]") + print("영업시간 [" + recvvalue[1] + "]" + "시간구분코드 [" + recvvalue[2] + "]") + print("======================================") + print("매도호가10 [%s] 잔량10 [%s]" % (recvvalue[12], recvvalue[32])) + print("매도호가09 [%s] 잔량09 [%s]" % (recvvalue[11], recvvalue[31])) + print("매도호가08 [%s] 잔량08 [%s]" % (recvvalue[10], recvvalue[30])) + print("매도호가07 [%s] 잔량07 [%s]" % (recvvalue[9], recvvalue[29])) + print("매도호가06 [%s] 잔량06 [%s]" % (recvvalue[8], recvvalue[28])) + print("매도호가05 [%s] 잔량05 [%s]" % (recvvalue[7], recvvalue[27])) + print("매도호가04 [%s] 잔량04 [%s]" % (recvvalue[6], recvvalue[26])) + print("매도호가03 [%s] 잔량03 [%s]" % (recvvalue[5], recvvalue[25])) + print("매도호가02 [%s] 잔량02 [%s]" % (recvvalue[4], recvvalue[24])) + print("매도호가01 [%s] 잔량01 [%s]" % (recvvalue[3], recvvalue[23])) + print("--------------------------------------") + print("매수호가01 [%s] 잔량01 [%s]" % (recvvalue[13], recvvalue[33])) + print("매수호가02 [%s] 잔량02 [%s]" % (recvvalue[14], recvvalue[34])) + print("매수호가03 [%s] 잔량03 [%s]" % (recvvalue[15], recvvalue[35])) + print("매수호가04 [%s] 잔량04 [%s]" % (recvvalue[16], recvvalue[36])) + print("매수호가05 [%s] 잔량05 [%s]" % (recvvalue[17], recvvalue[37])) + print("매수호가06 [%s] 잔량06 [%s]" % (recvvalue[18], recvvalue[38])) + print("매수호가07 [%s] 잔량07 [%s]" % (recvvalue[19], recvvalue[39])) + print("매수호가08 [%s] 잔량08 [%s]" % (recvvalue[20], recvvalue[40])) + print("매수호가09 [%s] 잔량09 [%s]" % (recvvalue[21], recvvalue[41])) + print("매수호가10 [%s] 잔량10 [%s]" % (recvvalue[22], recvvalue[42])) + print("======================================") + print("총매도호가 잔량 [%s]" % (recvvalue[43])) + print("총매도호가 잔량 증감 [%s]" % (recvvalue[54])) + print("총매수호가 잔량 [%s]" % (recvvalue[44])) + print("총매수호가 잔량 증감 [%s]" % (recvvalue[55])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[45])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[46])) + print("시간외 총매도호가 잔량 [%s]" % (recvvalue[56])) + print("시간외 총매수호가 증감 [%s]" % (recvvalue[57])) + print("예상 체결가 [%s]" % (recvvalue[47])) + print("예상 체결량 [%s]" % (recvvalue[48])) + print("예상 거래량 [%s]" % (recvvalue[49])) + print("예상체결 대비 [%s]" % (recvvalue[50])) + print("부호 [%s]" % (recvvalue[51])) + print("예상체결 전일대비율 [%s]" % (recvvalue[52])) + print("누적거래량 [%s]" % (recvvalue[53])) + print("주식매매 구분코드 [%s]" % (recvvalue[58])) + + +# 국내주식체결처리 출력라이브러리 +def stockspurchase(data_cnt, data): + print("============================================") + menulist = "유가증권단축종목코드|주식체결시간|주식현재가|전일대비부호|전일대비|전일대비율|가중평균주식가격|주식시가|주식최고가|주식최저가|매도호가1|매수호가1|체결거래량|누적거래량|누적거래대금|매도체결건수|매수체결건수|순매수체결건수|체결강도|총매도수량|총매수수량|체결구분|매수비율|전일거래량대비등락율|시가시간|시가대비구분|시가대비|최고가시간|고가대비구분|고가대비|최저가시간|저가대비구분|저가대비|영업일자|신장운영구분코드|거래정지여부|매도호가잔량|매수호가잔량|총매도호가잔량|총매수호가잔량|거래량회전율|전일동시간누적거래량|전일동시간누적거래량비율|시간구분코드|임의종료구분코드|정적VI발동기준가" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 국내주식체결통보 출력라이브러리 +def stocksigningnotice_domestic(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[13] == '2': # 체결통보 + print("#### 국내주식 체결 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|체결수량|체결단가|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|주문가격" + menustr1 = menulist.split('|') + else: + print("#### 국내주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류|주문조건|주식단축종목코드|주문수량|주문가격|주식체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|호가조건가격|주문거래소구분|실시간체결창표시여부|필러|신용구분|신용대출일자|체결종목명40|체결단가" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + +async def connect(): + # 웹 소켓에 접속.( 주석은 koreainvest test server for websocket) + ## 시세데이터를 받기위한 데이터를 미리 할당해서 사용한다. + + try: + g_appkey = '앱키를 입력하세요' + g_appsecret = '앱 시크릿키를 입력하세요' + + stockcode = '005930' # 테스트용 임시 종목 설정, 삼성전자 + htsid = 'HTS ID를 입력하세요' # 체결통보용 htsid 입력 + custtype = 'P' # customer type, 개인:'P' 법인 'B' + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + async with websockets.connect(url, ping_interval=None) as websocket: + + """" 주석처리는 더블쿼트 3개로 처리 + """ + print("1.주식호가, 2.주식호가해제, 3.주식체결, 4.주식체결해제, 5.주식체결통보(고객), 6.주식체결통보해제(고객), 7.주식체결통보(모의), 8.주식체결통보해제(모의)") + print("Input Command :") + cmd = input() + + # 입력값 체크 step + if cmd < '0' or cmd > '9': + print("> Wrong Input Data", cmd) + + elif cmd == '0': + print("Exit!!") + + # 입력값에 따라 전송 데이터셋 구분 처리 + if cmd == '1': # 주식호가 등록 + tr_id = 'H0STASP0' + tr_type = '1' + elif cmd == '2': # 주식호가 등록해제 + tr_id = 'H0STASP0' + tr_type = '2' + elif cmd == '3': # 주식체결 등록 + tr_id = 'H0STCNT0' + tr_type = '1' + elif cmd == '4': # 주식체결 등록해제 + tr_id = 'H0STCNT0' + tr_type = '2' + elif cmd == '5': # 주식체결통보 등록(고객용) + tr_id = 'H0STCNI0' # 고객체결통보 + tr_type = '1' + elif cmd == '6': # 주식체결통보 등록해제(고객용) + tr_id = 'H0STCNI0' # 고객체결통보 + tr_type = '2' + elif cmd == '7': # 주식체결통보 등록(모의) + tr_id = 'H0STCNI9' # 테스트용 직원체결통보 + tr_type = '1' + elif cmd == '8': # 주식체결통보 등록해제(모의) + tr_id = 'H0STCNI9' # 테스트용 직원체결통보 + tr_type = '2' + else: + senddata = 'wrong inert data' + + # send json, 체결통보는 tr_key 입력항목이 상이하므로 분리를 한다. + if cmd == '5' or cmd == '6' or cmd == '7' or cmd == '8': + senddata = '{"header":{"approval_key":"' + g_approval_key + '","custtype":"' + custtype + '","tr_type":"' + tr_type + '","content-type":"utf-8"},"body":{"input":{"tr_id":"' + tr_id + '","tr_key":"' + htsid + '"}}}' + else: + senddata = '{"header":{"approval_key":"' + g_approval_key + '","custtype":"' + custtype + '","tr_type":"' + tr_type + '","content-type":"utf-8"},"body":{"input":{"tr_id":"' + tr_id + '","tr_key":"' + stockcode + '"}}}' + + print('Input Command is :', senddata) + + await websocket.send(senddata) + await asyncio.sleep(0.5) + + # 데이터가 오기만 기다린다. + while True: + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print("Recev Command is :", data) + + if data[0] == '0' or data[0] == '1': # 실시간 데이터일 경우 + trid = jsonObject["header"]["tr_id"] + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + if trid0 == "H0STASP0": # 주식호가tr 일경우의 처리 단계 + print("#### 주식호가 ####") + stockhoka(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "H0STCNT0": # 주식체결 데이터 처리 + print("#### 주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase(data_cnt, recvstr[3]) + await asyncio.sleep(0.5) + + elif data[0] == '1': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + if trid0 == "K0STCNI0" or trid0 == "K0STCNI9" or trid0 == "H0STCNI0" or trid0 == "H0STCNI9": # 주실체결 통보 처리 + stocksigningnotice(recvstr[3], aes_key, aes_iv) + + # clearConsole() + # break; + else: + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + if rt_cd == '1': # 에러일 경우 처리 + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + #break + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0STCNI0" or trid == "H0STCNI9": + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) diff --git a/한국투자증권(API)/legacy/websocket/python/ws_overseas_future.py b/한국투자증권(API)/legacy/websocket/python/ws_overseas_future.py new file mode 100644 index 0000000..1d8e58e --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_overseas_future.py @@ -0,0 +1,288 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + +# [필수] 유료 시세 수신을 위한 access_token 발급 함수 +# 해외주식/해외선물 유료 시세 수신 전 반드시 이 함수를 호출해 access_token을 발급받아야 함 +# +# === 해외 유료 시세 수신 안내 === +# ▒ 해외주식 (HDFSASP0, HDFSASP1, HDFSCNT0: 미국, 중국, 일본, 베트남, 홍콩) +# - 무료 시세: 별도 신청 없이 수신 가능 +# - 유료 시세: HTS 또는 MTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7781] 시세신청(실시간) +# > MTS(한국투자 앱): 고객지원 > 거래서비스 신청 > 해외증권 > 해외 실시간 시세 신청 +# +# ▒ 해외선물 (HDFFF020, HDFFF010: CME, SGX / 기타 거래소는 무료 시세 제공) +# - CME, SGX: 무료 시세 없음 → 유료 시세 신청 필수 +# - 유료 시세: HTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7936] 해외선물옵션 실시간 시세신청/조회 +# +# ▒ 유료 시세 수신 절차 +# 1. HTS 또는 MTS에서 유료 시세 신청 +# 2. get_access_token()으로 access_token 발급 (※ 신청 후에 발급해야 유효) +# 3. 토큰 발급 시점 기준 최대 2시간 이내에 유료 권한 자동 반영 +# 4. 이후 웹소켓 연결 → 유료 시세 수신 가능 +def get_access_token(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "appsecret": secret} + PATH = "oauth2/tokenP" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + access_token = res.json()["access_token"] + return access_token + +### 4. 해외선물옵션 ### + +# 해외선물옵션호가 출력라이브러리 +def stockhoka_overseafut(data): + # print(data) + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("종목코드 ["+recvvalue[ 0]+"]") + print("수신일자 ["+recvvalue[ 1]+"]") + print("수신시각 ["+recvvalue[ 2]+"]") + print("전일종가 ["+recvvalue[ 3]+"]") + print("====================================") + print("매수1수량 ["+recvvalue[ 4]+"]"+", 매수1번호 ["+recvvalue[ 5]+"]"+", 매수1호가 ["+recvvalue[ 6]+"]") + print("매도1수량 ["+recvvalue[ 7]+"]"+", 매도1번호 ["+recvvalue[ 8]+"]"+", 매도1호가 ["+recvvalue[ 9]+"]") + print("매수2수량 ["+recvvalue[10]+"]"+", 매수2번호 ["+recvvalue[11]+"]"+", 매수2호가 ["+recvvalue[12]+"]") + print("매도2수량 ["+recvvalue[13]+"]"+", 매도2번호 ["+recvvalue[14]+"]"+", 매도2호가 ["+recvvalue[15]+"]") + print("매수3수량 ["+recvvalue[16]+"]"+", 매수3번호 ["+recvvalue[17]+"]"+", 매수3호가 ["+recvvalue[18]+"]") + print("매도3수량 ["+recvvalue[19]+"]"+", 매도3번호 ["+recvvalue[20]+"]"+", 매도3호가 ["+recvvalue[21]+"]") + print("매수4수량 ["+recvvalue[22]+"]"+", 매수4번호 ["+recvvalue[23]+"]"+", 매수4호가 ["+recvvalue[24]+"]") + print("매도4수량 ["+recvvalue[25]+"]"+", 매도4번호 ["+recvvalue[26]+"]"+", 매도4호가 ["+recvvalue[27]+"]") + print("매수5수량 ["+recvvalue[28 ]+"]"+", 매수5번호 ["+recvvalue[29]+"]"+", 매수5호가 ["+recvvalue[30]+"]") + print("매도5수량 ["+recvvalue[31]+"]"+", 매도5번호 ["+recvvalue[32]+"]"+", 매도5호가 ["+recvvalue[33]+"]") + print("====================================") + print("전일정산가 ["+recvvalue[32]+"]") + + +# 해외선물옵션체결처리 출력라이브러리 +def stockspurchase_overseafut(data_cnt, data): + print("============================================") + menulist = "종목코드|영업일자|장개시일자|장개시시각|장종료일자|장종료시각|전일종가|수신일자|수신시각|본장_전산장구분|체결가격|체결수량|전일대비가|등락률|시가|고가|저가|누적거래량|전일대비부호|체결구분|수신시각2만분의일초|전일정산가|전일정산가대비|전일정산가대비가격|전일정산가대비율" + menustr = menulist.split('|') + pValue = data.split('^') + # print(pValue) + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 해외선물옵션 체결통보 출력라이브러리 +def stocksigningnotice_overseafut(data, key, iv): + menulist = "유저ID|계좌번호|주문일자|주문번호|원주문일자|원주문번호|종목명|정정취소구분코드|매도매수구분코드|복합주문구분코드|가격구분코드|FM거래소접수구분코드|주문수량|FMLIMIT가격|FMSTOP주문가격|총체결수량|총체결단가|잔량|FM주문그룹일자|주문그룹번호|주문상세일시|조작상세일시|주문자|체결일자|체결번호|API체결번호|체결수량|FM체결가격|통화코드|위탁수수료|주문매체온라인여부|FM체결금액|선물옵션종목구분코드" + menustr1 = menulist.split('|') + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + # print(aes_dec_str) + pValue = aes_dec_str.split('^') + # print(pValue) + print("#### 해외선물옵션 체결통보 처리 ####") + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + +### 앱키 정의 ### + +async def connect(): + try: + + g_appkey = "앱키를 입력하세요" + g_appsecret = "앱 시크릿키를 입력하세요" + + # 해외주식/해외선물(CME, SGX) 유료시세 사용 시 필수(2시간 이내 유료신청정보 동기화) + # access_token = get_access_token(appkey, appsecret) + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 + + ### 4. 해외선물옵션 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFFF020','FCAZ22']] # 해외선물체결 + # code_list = [['1','HDFFF010','FCAZ22']] # 해외선물호가 + # code_list = [['1','HDFFF020','OESH23 C3900']] # 해외옵션체결 + # code_list = [['1','HDFFF010','OESH23 C3900']] # 해외옵션호가 + # code_list = [['1','HDFFF2C0','HTS ID를 입력하세요']] # 해외선물옵션체결통보 + code_list = [['1','HDFFF020','FCAZ22'],['1','HDFFF010','FCAZ22'],['1','HDFFF020','OESH23 C3900'],['1','HDFFF010','OESH23 C3900'],['1','HDFFF2C0','HTS ID를 입력하세요']] + + senddata_list=[] + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print(f"Recev Command is :{data}") # 정제되지 않은 Request / Response 출력 + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "HDFFF010": # 해외선물옵션호가 tr 일경우의 처리 단계 + print("#### 해외선물옵션호가 ####") + stockhoka_overseafut(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "HDFFF020": # 해외선물옵션체결 데이터 처리 + print("#### 해외선물옵션체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_overseafut(data_cnt, recvstr[3]) + await asyncio.sleep(0.5) + + elif data[0] == '1': + + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "HDFFF2C0": # 해외선물옵션체결 통보 처리 + stocksigningnotice_overseafut(recvstr[3], aes_key, aes_iv) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "HDFFF2C0": # 해외선물옵션 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) \ No newline at end of file diff --git a/한국투자증권(API)/legacy/websocket/python/ws_overseas_stock.py b/한국투자증권(API)/legacy/websocket/python/ws_overseas_stock.py new file mode 100644 index 0000000..b073f93 --- /dev/null +++ b/한국투자증권(API)/legacy/websocket/python/ws_overseas_stock.py @@ -0,0 +1,303 @@ +# -*- coding: utf-8 -*- +### 모듈 임포트 ### +import os +import sys +import json +import time +import requests +import asyncio +import traceback +import websockets + +from Crypto.Cipher import AES +from Crypto.Util.Padding import unpad +from base64 import b64decode + +clearConsole = lambda: os.system('cls' if os.name in ('nt', 'dos') else 'clear') + +key_bytes = 32 + + +### 함수 정의 ### + +# AES256 DECODE +def aes_cbc_base64_dec(key, iv, cipher_text): + """ + :param key: str type AES256 secret key value + :param iv: str type AES256 Initialize Vector + :param cipher_text: Base64 encoded AES256 str + :return: Base64-AES256 decodec str + """ + cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) + return bytes.decode(unpad(cipher.decrypt(b64decode(cipher_text)), AES.block_size)) + + +# 웹소켓 접속키 발급 +def get_approval(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "secretkey": secret} + PATH = "oauth2/Approval" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + approval_key = res.json()["approval_key"] + return approval_key + +# [필수] 유료 시세 수신을 위한 access_token 발급 함수 +# 해외주식/해외선물 유료 시세 수신 전 반드시 이 함수를 호출해 access_token을 발급받아야 함 +# +# === 해외 유료 시세 수신 안내 === +# ▒ 해외주식 (HDFSASP0, HDFSASP1, HDFSCNT0: 미국, 중국, 일본, 베트남, 홍콩) +# - 무료 시세: 별도 신청 없이 수신 가능 +# - 유료 시세: HTS 또는 MTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7781] 시세신청(실시간) +# > MTS(한국투자 앱): 고객지원 > 거래서비스 신청 > 해외증권 > 해외 실시간 시세 신청 +# +# ▒ 해외선물 (HDFFF020, HDFFF010: CME, SGX / 기타 거래소는 무료 시세 제공) +# - CME, SGX: 무료 시세 없음 → 유료 시세 신청 필수 +# - 유료 시세: HTS에서 신청 후 access_token 발급 필요 +# > HTS(eFriend Plus/Force): [7936] 해외선물옵션 실시간 시세신청/조회 +# +# ▒ 유료 시세 수신 절차 +# 1. HTS 또는 MTS에서 유료 시세 신청 +# 2. get_access_token()으로 access_token 발급 (※ 신청 후에 발급해야 유효) +# 3. 토큰 발급 시점 기준 최대 2시간 이내에 유료 권한 자동 반영 +# 4. 이후 웹소켓 연결 → 유료 시세 수신 가능 +def get_access_token(key, secret): + # url = https://openapivts.koreainvestment.com:29443' # 모의투자계좌 + url = 'https://openapi.koreainvestment.com:9443' # 실전투자계좌 + headers = {"content-type": "application/json"} + body = {"grant_type": "client_credentials", + "appkey": key, + "appsecret": secret} + PATH = "oauth2/tokenP" + URL = f"{url}/{PATH}" + time.sleep(0.05) + res = requests.post(URL, headers=headers, data=json.dumps(body)) + access_token = res.json()["access_token"] + return access_token + +### 2. 해외주식 ### + +# 해외주식호가 출력라이브러리 +def stockhoka_overseas(data): + """ 넘겨받는데이터가 정상인지 확인 + print("stockhoka[%s]"%(data)) + """ + recvvalue = data.split('^') # 수신데이터를 split '^' + + print("실시간종목코드 [" + recvvalue[0] + "]" + ", 종목코드 [" + recvvalue[1] + "]") + print("소숫점자리수 [" + recvvalue[2] + "]") + print("현지일자 [" + recvvalue[3] + "]" + ", 현지시간 [" + recvvalue[4] + "]") + print("한국일자 [" + recvvalue[5] + "]" + ", 한국시간 [" + recvvalue[6] + "]") + print("======================================") + print("매수총 잔량 [%s]" % (recvvalue[7])) + print("매수총잔량대비 [%s]" % (recvvalue[9])) + print("매도총 잔량 [%s]" % (recvvalue[8])) + print("매도총잔략대비 [%s]" % (recvvalue[10])) + print("매수호가 [%s]" % (recvvalue[11])) + print("매도호가 [%s]" % (recvvalue[12])) + print("매수잔량 [%s]" % (recvvalue[13])) + print("매도잔량 [%s]" % (recvvalue[14])) + print("매수잔량대비 [%s]" % (recvvalue[15])) + print("매도잔량대비 [%s]" % (recvvalue[16])) + + +# 해외주식체결처리 출력라이브러리 +def stockspurchase_overseas(data_cnt, data): + print("============================================") + menulist = "실시간종목코드|종목코드|수수점자리수|현지영업일자|현지일자|현지시간|한국일자|한국시간|시가|고가|저가|현재가|대비구분|전일대비|등락율|매수호가|매도호가|매수잔량|매도잔량|체결량|거래량|거래대금|매도체결량|매수체결량|체결강도|시장구분" + menustr = menulist.split('|') + pValue = data.split('^') + i = 0 + for cnt in range(data_cnt): # 넘겨받은 체결데이터 개수만큼 print 한다 + print("### [%d / %d]" % (cnt + 1, data_cnt)) + for menu in menustr: + print("%-13s[%s]" % (menu, pValue[i])) + i += 1 + + +# 해외주식체결통보 출력라이브러리 +def stocksigningnotice_overseas(data, key, iv): + + # AES256 처리 단계 + aes_dec_str = aes_cbc_base64_dec(key, iv, data) + pValue = aes_dec_str.split('^') + + if pValue[12] == '2': # 체결통보 + print("#### 해외주식 체결 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|체결수량|체결단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + else: + print("#### 해외주식 주문·정정·취소·거부 접수 통보 ####") + menulist = "고객 ID|계좌번호|주문번호|원주문번호|매도매수구분|정정구분|주문종류2|단축종목코드|주문수량|주문단가|체결시간|거부여부|체결여부|접수여부|지점번호|주문수량_미출력|계좌명|체결종목명|해외종목구분|담보유형코드|담보대출일자|분할매수매도시작시간|분할매수매도종료시간|시간분할타입유형|체결단가12" + menustr1 = menulist.split('|') + + i = 0 + for menu in menustr1: + print("%s [%s]" % (menu, pValue[i])) + i += 1 + + + +async def connect(): + try: + + g_appkey = '앱키를 입력하세요' + g_appsecret = '앱 시크릿키를 입력하세요' + + # 해외주식/해외선물(CME, SGX) 유료시세 사용 시 필수(2시간 이내 유료신청정보 동기화) + # access_token = get_access_token(appkey, appsecret) + + g_approval_key = get_approval(g_appkey, g_appsecret) + print("approval_key [%s]" % (g_approval_key)) + + # url = 'ws://ops.koreainvestment.com:31000' # 모의투자계좌 + url = 'ws://ops.koreainvestment.com:21000' # 실전투자계좌 + + # 원하는 호출을 [tr_type, tr_id, tr_key] 순서대로 리스트 만들기 + + ### 해외주식(미국) 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFSASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 해외주식(미국-주간) 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFSASP0','RBAQAAPL'],['1','HDFSCNT0','RBAQAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 해외주식(아시아) 호가, 체결가, 체결통보 ### + # code_list = [['1','HDFSASP1','DHKS00003'],['1','HDFSCNT0','DHKS00003'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + ### 해외주식(미국) 호가, 체결가, 체결통보, 해외주식(아시아) 호가, 체결가, 체결통보 ### + code_list = [['1','HDFSASP0','DNASAAPL'],['1','HDFSCNT0','DNASAAPL'],['1','H0GSCNI0','HTS ID를 입력하세요'], + ['1','HDFSASP1','DHKS00003'],['1','HDFSCNT0','DHKS00003'],['1','H0GSCNI0','HTS ID를 입력하세요']] + + senddata_list=[] + + for i,j,k in code_list: + temp = '{"header":{"approval_key": "%s","custtype":"P","tr_type":"%s","content-type":"utf-8"},"body":{"input":{"tr_id":"%s","tr_key":"%s"}}}'%(g_approval_key,i,j,k) + senddata_list.append(temp) + + + async with websockets.connect(url, ping_interval=None) as websocket: + + for senddata in senddata_list: + await websocket.send(senddata) + await asyncio.sleep(0.5) + print(f"Input Command is :{senddata}") + + while True: + + data = await websocket.recv() + # await asyncio.sleep(0.5) + # print(f"Recev Command is :{data}") # 정제되지 않은 Request / Response 출력 + + if data[0] == '0': + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "HDFSASP0": # 해외주식호가tr 일경우의 처리 단계 + print("#### 해외(미국)주식호가 ####") + stockhoka_overseas(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "HDFSASP1": # 해외주식호가tr 일경우의 처리 단계 + print("#### 해외(아시아)주식호가 ####") + stockhoka_overseas(recvstr[3]) + await asyncio.sleep(0.5) + + elif trid0 == "HDFSCNT0": # 해외주식체결 데이터 처리 + print("#### 해외주식체결 ####") + data_cnt = int(recvstr[2]) # 체결데이터 개수 + stockspurchase_overseas(data_cnt, recvstr[3]) + await asyncio.sleep(0.5) + + elif data[0] == '1': + + recvstr = data.split('|') # 수신데이터가 실데이터 이전은 '|'로 나뉘어져있어 split + trid0 = recvstr[1] + + if trid0 == "H0GSCNI0" or trid0 == "H0GSCNI9": # 해외주식체결 통보 처리 + stocksigningnotice_overseas(recvstr[3], aes_key, aes_iv) + + else: + + jsonObject = json.loads(data) + trid = jsonObject["header"]["tr_id"] + + if trid != "PINGPONG": + rt_cd = jsonObject["body"]["rt_cd"] + + if rt_cd == '1': # 에러일 경우 처리 + + if jsonObject["body"]["msg1"] != 'ALREADY IN SUBSCRIBE': + print("### ERROR RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + break + + elif rt_cd == '0': # 정상일 경우 처리 + print("### RETURN CODE [ %s ][ %s ] MSG [ %s ]" % (jsonObject["header"]["tr_key"], rt_cd, jsonObject["body"]["msg1"])) + + # 체결통보 처리를 위한 AES256 KEY, IV 처리 단계 + if trid == "H0GSCNI0": # 해외주식 + aes_key = jsonObject["body"]["output"]["key"] + aes_iv = jsonObject["body"]["output"]["iv"] + print("### TRID [%s] KEY[%s] IV[%s]" % (trid, aes_key, aes_iv)) + + elif trid == "PINGPONG": + print("### RECV [PINGPONG] [%s]" % (data)) + await websocket.pong(data) + print("### SEND [PINGPONG] [%s]" % (data)) + + # ---------------------------------------- + # 모든 함수의 공통 부분(Exception 처리) + # ---------------------------------------- + except Exception as e: + print('Exception Raised!') + print(e) + print('Connect Again!') + time.sleep(0.1) + + # 웹소켓 다시 시작 + await connect() + + +# # 비동기로 서버에 접속한다. +# asyncio.get_event_loop().run_until_complete(connect()) +# asyncio.get_event_loop().close() + +# ----------------------------------------------------------------------------- +# - Name : main +# - Desc : 메인 +# ----------------------------------------------------------------------------- +async def main(): + try: + # 웹소켓 시작 + await connect() + + except Exception as e: + print('Exception Raised!') + print(e) + + +if __name__ == "__main__": + + # noinspection PyBroadException + try: + # --------------------------------------------------------------------- + # Logic Start! + # --------------------------------------------------------------------- + # 웹소켓 시작 + asyncio.run(main()) + + except KeyboardInterrupt: + print("KeyboardInterrupt Exception 발생!") + print(traceback.format_exc()) + sys.exit(-100) + + except Exception: + print("Exception 발생!") + print(traceback.format_exc()) + sys.exit(-200) diff --git a/한국투자증권(API)/pyproject.toml b/한국투자증권(API)/pyproject.toml new file mode 100644 index 0000000..ba5a3dc --- /dev/null +++ b/한국투자증권(API)/pyproject.toml @@ -0,0 +1,15 @@ +[project] +name = "kis-github" +version = "1.0.0" +description = "korea investment open api sample codes" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "pandas>=2.3.1", + "pycryptodome>=3.23.0", + "pyqt6>=6.9.1", + "pyside6>=6.9.1", + "pyyaml>=6.0.2", + "requests>=2.32.4", + "websockets>=15.0.1", +] diff --git a/한국투자증권(API)/requirements.txt b/한국투자증권(API)/requirements.txt new file mode 100644 index 0000000..58d0366 --- /dev/null +++ b/한국투자증권(API)/requirements.txt @@ -0,0 +1,21 @@ +certifi==2025.7.9 +charset-normalizer==3.4.2 +idna==3.10 +numpy==2.3.1 +pandas==2.3.1 +pycryptodome==3.23.0 +pyqt6==6.9.1 +pyqt6-qt6==6.9.1 +pyqt6-sip==13.10.2 +pyside6==6.9.1 +pyside6-addons==6.9.1 +pyside6-essentials==6.9.1 +python-dateutil==2.9.0.post0 +pytz==2025.2 +pyyaml==6.0.2 +requests==2.32.4 +shiboken6==6.9.1 +six==1.17.0 +tzdata==2025.2 +urllib3==2.5.0 +websockets==15.0.1 diff --git a/한국투자증권(API)/stocks_info/domestic_bond_code.py b/한국투자증권(API)/stocks_info/domestic_bond_code.py new file mode 100644 index 0000000..6397cbf --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_bond_code.py @@ -0,0 +1,64 @@ +'''장내채권 종목정보(bond_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def download_and_extract_file(url, output_dir, zip_filename, extracted_filename): + # Download the file + print(f"Downloading {zip_filename}...") + ssl._create_default_https_context = ssl._create_unverified_context + zip_filepath = os.path.join(output_dir, zip_filename) + urllib.request.urlretrieve(url, zip_filepath) + + # Extract the file + print(f"Extracting {zip_filename}...") + with zipfile.ZipFile(zip_filepath, 'r') as zip_ref: + zip_ref.extractall(output_dir) + + return os.path.join(output_dir, extracted_filename) + +def get_bond_master_dataframe(file_path): + print("Parsing the file...") + with open(file_path, mode="r", encoding="cp949") as f: + lines = f.readlines() + + data = [] + for row in lines: + row = row.strip() + bond_type = row[0:2].strip() + bond_cls_code = row[2:4].strip() + stnd_iscd = row[4:16].strip() + rdmp_date = row[-8:].strip() + pblc_date = row[-16:-8].strip() + lstn_date = row[-24:-16].strip() + bond_int_cls_code = row[-26:-24].strip() + sname = row[16:-26].rstrip() # 종목명을 뒤에서부터 추출하여 남은 부분 + + data.append([bond_type, bond_cls_code, stnd_iscd, sname, bond_int_cls_code, + lstn_date, pblc_date, rdmp_date]) + + columns = ['유형', '채권분류코드', '표준코드', '종목명', '채권이자분류코드', + '상장일', '발행일', '상환일'] + + df = pd.DataFrame(data, columns=columns) + return df + +# 채권종목코드 마스터파일 다운로드 및 파일 경로 +url = "https://new.real.download.dws.co.kr/common/master/bond_code.mst.zip" +zip_filename = "bond_code.zip" +extracted_filename = "bond_code.mst" + +file_path = download_and_extract_file(url, base_dir, zip_filename, extracted_filename) + +# 데이터프레임 생성 및 엑셀 파일로 저장 +df_bond = get_bond_master_dataframe(file_path) + +# 엑셀 파일 저장 +print("Saving to Excel...") +df_bond.to_excel('bond_code.xlsx', index=False) +print("Excel file created successfully.") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/domestic_cme_future_code.py b/한국투자증권(API)/stocks_info/domestic_cme_future_code.py new file mode 100644 index 0000000..5582ec9 --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_cme_future_code.py @@ -0,0 +1,44 @@ +'''CME연계 야간선물 종목코드(fo_cme_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_domestic_cme_future_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/fo_cme_code.mst.zip", base_dir + "\\fo_cme_code.mst.zip") + os.chdir(base_dir) + + fo_cme_code_zip = zipfile.ZipFile('fo_cme_code.mst.zip') + fo_cme_code_zip.extractall() + fo_cme_code_zip.close() + file_name = base_dir + "\\fo_cme_code.mst" + columns = ['상품종류','단축코드','표준코드',' 한글종목명', + '행사가',' 기초자산 단축코드',' 기초자산 명'] + df=pd.DataFrame(columns=columns) + ridx=1 + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + a = row[0:1] + b = row[1:10].strip() + c = row[10:22].strip() + d = row[22:63].strip() + e = row[63:72].strip() + f = row[72:81].strip() + g = row[81:].strip() + df.loc[ridx] = [a,b,c,d,e,f,g] + ridx += 1 + df.to_excel('fo_cme_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return df + +df = get_domestic_cme_future_master_dataframe(base_dir) +print("Done") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/domestic_commodity_future_code.py b/한국투자증권(API)/stocks_info/domestic_commodity_future_code.py new file mode 100644 index 0000000..3b98cda --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_commodity_future_code.py @@ -0,0 +1,68 @@ +'''상품선물옵션 종목코드(fo_com_code_mts.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_domestic_com_future_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/fo_com_code.mst.zip", base_dir + "\\fo_com_code.mst.zip") + os.chdir(base_dir) + + fo_com_code_zip = zipfile.ZipFile('fo_com_code.mst.zip') + fo_com_code_zip.extractall() + fo_com_code_zip.close() + file_name = base_dir + "\\fo_com_code.mst" + + # df1 : '상품구분','상품종류','단축코드','표준코드','한글종목명' + tmp_fil1 = base_dir + "\\fo_com_code_part1.tmp" + tmp_fil2 = base_dir + "\\fo_com_code_part2.tmp" + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + rf1 = row[0:55] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:2] + rf1_3 = rf1[2:11].strip() + rf1_4 = rf1[11:23].strip() + rf1_5 = rf1[23:55].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + ',' + rf1_5 + '\n') + rf2 = row[55:].lstrip() + wf2.write(rf2) + wf1.close() + wf2.close() + part1_columns = ['상품구분','상품종류','단축코드','표준코드','한글종목명'] + df1 = pd.read_csv(tmp_fil1, header=None, names=part1_columns, encoding='cp949') + + # df2 : '월물구분코드','기초자산 단축코드','기초자산 명' + tmp_fil3 = base_dir + "\\fo_com_code_part3.tmp" + wf3 = open(tmp_fil3, mode="w") + with open(tmp_fil2, mode="r", encoding="cp949") as f: + for row in f: + rf2 = row[:] + rf2_1 = rf2[8:9] + rf2_2 = rf2[9:12] + rf2_3 = rf2[12:].strip() + wf3.write(rf2_1 + ',' + rf2_2 + ',' + rf2_3 + '\n') + wf3.close() + part2_columns = ['월물구분코드','기초자산 단축코드','기초자산 명'] + df2 = pd.read_csv(tmp_fil3, header=None, names=part2_columns, encoding='cp949') + + # DF : df1 + df2 + DF = pd.concat([df1,df2],axis=1) + # print(len(df1), len(df2), len(DF)) + DF.to_excel('fo_com_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return DF + +df = get_domestic_com_future_master_dataframe(base_dir) +print("Done") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/domestic_elw_code.py b/한국투자증권(API)/stocks_info/domestic_elw_code.py new file mode 100644 index 0000000..f6ce1d5 --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_elw_code.py @@ -0,0 +1,105 @@ +'''국내ELW 종목정보(elw_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def download_and_extract_file(url, output_dir, zip_filename, extracted_filename): + # Download the file + print(f"Downloading {zip_filename}...") + ssl._create_default_https_context = ssl._create_unverified_context + zip_filepath = os.path.join(output_dir, zip_filename) + urllib.request.urlretrieve(url, zip_filepath) + + # Extract the file + print(f"Extracting {zip_filename}...") + with zipfile.ZipFile(zip_filepath, 'r') as zip_ref: + zip_ref.extractall(output_dir) + + return os.path.join(output_dir, extracted_filename) + +def get_elw_master_dataframe(file_path): + print("Parsing the file...") + with open(file_path, mode="r", encoding="cp949") as f: + lines = f.readlines() + + data = [] + for row in lines: + # print(row) + mksc_shrn_iscd = row[0:9].strip() # 단축코드 + stnd_iscd = row[9:21].strip() # 표준코드 + hts_kor_isnm = row[21:50].strip() # 한글 종목명 + + crow = row[50:].strip() + elw_nvlt_optn_cls_code = crow[:1].strip() # ELW권리형태 + elw_ko_barrier = crow[1:14].strip() # ELW조기종료발생기준가격 + bskt_yn = crow[14:15].strip() # 바스켓 여부 (Y/N) + unas_iscd1 = crow[15:24].strip() # 기초자산코드1 + unas_iscd2 = crow[24:33].strip() # 기초자산코드2 + unas_iscd3 = crow[33:42].strip() # 기초자산코드3 + unas_iscd4 = crow[42:51].strip() # 기초자산코드4 + unas_iscd5 = crow[51:60].strip() # 기초자산코드5 + + # Calculate positions from the end of the row + mrkt_prtt_no10 = row[-6:].strip() # 시장 참가자 번호10 + mrkt_prtt_no9 = row[-11:-6].strip() # 시장 참가자 번호9 + mrkt_prtt_no8 = row[-16:-11].strip() # 시장 참가자 번호8 + mrkt_prtt_no7 = row[-21:-16].strip() # 시장 참가자 번호7 + mrkt_prtt_no6 = row[-26:-21].strip() # 시장 참가자 번호6 + mrkt_prtt_no5 = row[-31:-26].strip() # 시장 참가자 번호5 + mrkt_prtt_no4 = row[-36:-31].strip() # 시장 참가자 번호4 + mrkt_prtt_no3 = row[-41:-36].strip() # 시장 참가자 번호3 + mrkt_prtt_no2 = row[-46:-41].strip() # 시장 참가자 번호2 + mrkt_prtt_no1 = row[-51:-46].strip() # 시장 참가자 번호1 + lstn_stcn = row[-66:-51].strip() # 상장주수(천) + prdy_avls = row[-75:-66].strip() # 전일시가총액(억) + paym_date = row[-83:-75].strip() # 지급일 + rght_type_cls_code = row[-84:-83].strip() # 권리 유형 구분 코드 + rmnn_dynu = row[-88:-84].strip() # 잔존 일수 + stck_last_tr_month = row[-96:-88].strip() # 최종거래일 + acpr = row[-105:-96].strip() # 행사가 + elw_pblc_mrkt_prtt_no = row[-110:-105].strip() # 발행사코드 + + elw_pblc_istu_name = row[-11:-110].strip() # 발행사 한글 종목명 + + data.append([mksc_shrn_iscd, stnd_iscd, hts_kor_isnm, + elw_nvlt_optn_cls_code, elw_ko_barrier, bskt_yn, + unas_iscd1, unas_iscd2, unas_iscd3, unas_iscd4, + unas_iscd5, elw_pblc_istu_name, elw_pblc_mrkt_prtt_no, + acpr, stck_last_tr_month, rmnn_dynu, rght_type_cls_code, + paym_date, prdy_avls, lstn_stcn, mrkt_prtt_no1, + mrkt_prtt_no2, mrkt_prtt_no3, mrkt_prtt_no4, + mrkt_prtt_no5, mrkt_prtt_no6, mrkt_prtt_no7, + mrkt_prtt_no8, mrkt_prtt_no9, mrkt_prtt_no10]) + + columns = ['단축코드', '표준코드', '한글종목명', 'ELW권리형태', 'ELW조기종료발생기준가격', + '바스켓 여부', '기초자산코드1', '기초자산코드2', '기초자산코드3', + '기초자산코드4', '기초자산코드5', '발행사 한글 종목명', '발행사코드', + '행사가', '최종거래일', '잔존 일수', '권리 유형 구분 코드', '지급일', + '전일시가총액(억)', '상장주수(천)', '시장 참가자 번호1', + '시장 참가자 번호2', '시장 참가자 번호3', '시장 참가자 번호4', + '시장 참가자 번호5', '시장 참가자 번호6', '시장 참가자 번호7', + '시장 참가자 번호8', '시장 참가자 번호9', '시장 참가자 번호10'] + + df = pd.DataFrame(data, columns=columns) + return df + +# File details +url = "https://new.real.download.dws.co.kr/common/master/elw_code.mst.zip" +zip_filename = "elw_code.zip" +extracted_filename = "elw_code.mst" + +# Download and extract the file +file_path = download_and_extract_file(url, base_dir, zip_filename, extracted_filename) + +# Create the DataFrame +df = get_elw_master_dataframe(file_path) + +# Save to Excel +print("Saving to Excel...") +df.to_excel('elw_code.xlsx', index=False) +print("Excel file created successfully.") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/domestic_eurex_option_code.py b/한국투자증권(API)/stocks_info/domestic_eurex_option_code.py new file mode 100644 index 0000000..e5dbe18 --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_eurex_option_code.py @@ -0,0 +1,68 @@ +'''EUREX연계 야간옵션 종목코드(fo_eurex_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_domestic_eurex_option_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/fo_eurex_code.mst.zip", base_dir + "\\fo_eurex_code.mst.zip") + os.chdir(base_dir) + + fo_eurex_code_zip = zipfile.ZipFile('fo_eurex_code.mst.zip') + fo_eurex_code_zip.extractall() + fo_eurex_code_zip.close() + file_name = base_dir + "\\fo_eurex_code.mst" + + # df1 : '상품종류','단축코드','표준코드','한글종목명' + tmp_fil1 = base_dir + "\\fo_eurex_code_part1.tmp" + tmp_fil2 = base_dir + "\\fo_eurex_code_part2.tmp" + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + rf1 = row[0:59] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:10] + rf1_3 = rf1[10:22].strip() + rf1_4 = rf1[22:59].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + '\n') + rf2 = row[59:].lstrip() + wf2.write(rf2) + wf1.close() + wf2.close() + part1_columns = ['상품종류','단축코드','표준코드','한글종목명'] + df1 = pd.read_csv(tmp_fil1, header=None, names=part1_columns, encoding='cp949') + + # df2 : 'ATM구분','행사가','기초자산 단축코드','기초자산 명' + tmp_fil3 = base_dir + "\\fo_eurex_code_part3.tmp" + wf3 = open(tmp_fil3, mode="w") + with open(tmp_fil2, mode="r", encoding="cp949") as f: + for row in f: + rf2 = row[:] + rf2_1 = rf2[0:1] + rf2_2 = rf2[1:9] + rf2_3 = rf2[9:17] + rf2_4 = rf2[17:].strip() + wf3.write(rf2_1 + ',' + rf2_2 + ',' + rf2_3 + ',' + rf2_4 + '\n') + wf3.close() + part2_columns = ['ATM구분','행사가','기초자산 단축코드','기초자산 명'] + df2 = pd.read_csv(tmp_fil3, header=None, names=part2_columns, encoding='cp949') + + # DF : df1 + df2 + DF = pd.concat([df1,df2],axis=1) + # print(len(df1), len(df2), len(DF)) + DF.to_excel('fo_eurex_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return DF + +df = get_domestic_eurex_option_master_dataframe(base_dir) +print("Done") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/domestic_index_future_code.py b/한국투자증권(API)/stocks_info/domestic_index_future_code.py new file mode 100644 index 0000000..b90254a --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_index_future_code.py @@ -0,0 +1,34 @@ +'''지수선물옵션 종목코드(fo_idx_code_mts.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_domestic_future_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/fo_idx_code_mts.mst.zip", base_dir + "\\fo_idx_code_mts.mst.zip") + os.chdir(base_dir) + + fo_idx_code_zip = zipfile.ZipFile('fo_idx_code_mts.mst.zip') + fo_idx_code_zip.extractall() + fo_idx_code_zip.close() + file_name = base_dir + "\\fo_idx_code_mts.mst" + + columns = ['상품종류','단축코드','표준코드',' 한글종목명',' ATM구분', + ' 행사가',' 월물구분코드',' 기초자산 단축코드',' 기초자산 명'] + df=pd.read_table(file_name, sep='|',encoding='cp949',header=None) + df.columns = columns + df.to_excel('fo_idx_code_mts.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return df + +df = get_domestic_future_master_dataframe(base_dir) +print("Done") diff --git a/한국투자증권(API)/stocks_info/domestic_stock_future_code.py b/한국투자증권(API)/stocks_info/domestic_stock_future_code.py new file mode 100644 index 0000000..01483ca --- /dev/null +++ b/한국투자증권(API)/stocks_info/domestic_stock_future_code.py @@ -0,0 +1,39 @@ +'''선물옵션 종목코드(fo_stk_code_mts.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_domestic_stk_future_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/fo_stk_code_mts.mst.zip", base_dir + "\\fo_stk_code_mts.mst.zip") + os.chdir(base_dir) + + fo_stk_code_zip = zipfile.ZipFile('fo_stk_code_mts.mst.zip') + fo_stk_code_zip.extractall() + fo_stk_code_zip.close() + file_name = base_dir + "\\fo_stk_code_mts.mst" + + fo_stk_code_zip = zipfile.ZipFile('fo_stk_code_mts.mst.zip') + fo_stk_code_zip.extractall() + fo_stk_code_zip.close() + file_name = base_dir + "\\fo_stk_code_mts.mst" + + columns = ['상품종류','단축코드','표준코드',' 한글종목명',' ATM구분', + ' 행사가',' 월물구분코드',' 기초자산 단축코드',' 기초자산 명'] + df=pd.read_table(file_name, sep='|',encoding='cp949',header=None) + df.columns = columns + df.to_excel('fo_stk_code_mts.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return df + +df = get_domestic_stk_future_master_dataframe(base_dir) +print("Done") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/kis_konex_code_mst.py b/한국투자증권(API)/stocks_info/kis_konex_code_mst.py new file mode 100644 index 0000000..9643907 --- /dev/null +++ b/한국투자증권(API)/stocks_info/kis_konex_code_mst.py @@ -0,0 +1,112 @@ +'''코넥스주식 종목정보(konex_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def download_and_extract_file(url, output_dir, zip_filename, extracted_filename): + # Download the file + print(f"Downloading {zip_filename}...") + ssl._create_default_https_context = ssl._create_unverified_context + zip_filepath = os.path.join(output_dir, zip_filename) + urllib.request.urlretrieve(url, zip_filepath) + + # Extract the file + print(f"Extracting {zip_filename}...") + with zipfile.ZipFile(zip_filepath, 'r') as zip_ref: + zip_ref.extractall(output_dir) + + return os.path.join(output_dir, extracted_filename) + +def get_knx_master_dataframe(file_path): + print("Parsing the file...") + with open(file_path, mode="r", encoding="cp949") as f: + lines = f.readlines() + + data = [] + for row in lines: + row = row.strip() + mksc_shrn_iscd = row[0:9].strip() + stnd_iscd = row[9:21].strip() + scrt_grp_cls_code = row[-184:-182].strip() + stck_sdpr = row[-182:-173].strip() + frml_mrkt_deal_qty_unit = row[-173:-168].strip() + ovtm_mrkt_deal_qty_unit = row[-168:-163].strip() + trht_yn = row[-163:-162].strip() + sltr_yn = row[-162:-161].strip() + mang_issu_yn = row[-161:-160].strip() + mrkt_alrm_cls_code = row[-160:-158].strip() + mrkt_alrm_risk_adnt_yn = row[-158:-157].strip() + insn_pbnt_yn = row[-157:-156].strip() + byps_lstn_yn = row[-156:-155].strip() + flng_cls_code = row[-155:-153].strip() + fcam_mod_cls_code = row[-153:-151].strip() + icic_cls_code = row[-151:-149].strip() + marg_rate = row[-149:-146].strip() + crdt_able = row[-146:-145].strip() + crdt_days = row[-145:-142].strip() + prdy_vol = row[-142:-130].strip() + stck_fcam = row[-130:-118].strip() + stck_lstn_date = row[-118:-110].strip() + lstn_stcn = row[-110:-95].strip() + cpfn = row[-95:-74].strip() + stac_month = row[-74:-72].strip() + po_prc = row[-72:-65].strip() + prst_cls_code = row[-65:-64].strip() + ssts_hot_yn = row[-64:-63].strip() + stange_runup_yn = row[-63:-62].strip() + krx300_issu_yn = row[-62:-61].strip() + sale_account = row[-61:-52].strip() + bsop_prfi = row[-52:-43].strip() + op_prfi = row[-43:-34].strip() + thtr_ntin = row[-34:-29].strip() + roe = row[-29:-20].strip() + base_date = row[-20:-12].strip() + prdy_avls_scal = row[-12:-3].strip() + co_crdt_limt_over_yn = row[-3:-2].strip() + secu_lend_able_yn = row[-2:-1].strip() + stln_able_yn = row[-1:].strip() + hts_kor_isnm = row[21:-184].strip() + + data.append([mksc_shrn_iscd, stnd_iscd, hts_kor_isnm, scrt_grp_cls_code, + stck_sdpr, frml_mrkt_deal_qty_unit, ovtm_mrkt_deal_qty_unit, + trht_yn, sltr_yn, mang_issu_yn, mrkt_alrm_cls_code, + mrkt_alrm_risk_adnt_yn, insn_pbnt_yn, byps_lstn_yn, + flng_cls_code, fcam_mod_cls_code, icic_cls_code, marg_rate, + crdt_able, crdt_days, prdy_vol, stck_fcam, stck_lstn_date, + lstn_stcn, cpfn, stac_month, po_prc, prst_cls_code, ssts_hot_yn, + stange_runup_yn, krx300_issu_yn, sale_account, bsop_prfi, + op_prfi, thtr_ntin, roe, base_date, prdy_avls_scal, + co_crdt_limt_over_yn, secu_lend_able_yn, stln_able_yn]) + + columns = ['단축코드', '표준코드', '종목명', '증권그룹구분코드', '주식 기준가', + '정규 시장 매매 수량 단위', '시간외 시장 매매 수량 단위', '거래정지 여부', + '정리매매 여부', '관리 종목 여부', '시장 경고 구분 코드', '시장 경고위험 예고 여부', + '불성실 공시 여부', '우회 상장 여부', '락구분 코드', '액면가 변경 구분 코드', + '증자 구분 코드', '증거금 비율', '신용주문 가능 여부', '신용기간', '전일 거래량', + '주식 액면가', '주식 상장 일자', '상장 주수(천)', '자본금', '결산 월', '공모 가격', + '우선주 구분 코드', '공매도과열종목여부', '이상급등종목여부', 'KRX300 종목 여부', + '매출액', '영업이익', '경상이익', '단기순이익', 'ROE', '기준년월', '전일기준 시가총액(억)', + '회사신용한도초과여부', '담보대출가능여부', '대주가능여부'] + + df = pd.DataFrame(data, columns=columns) + return df + +# 코넥스 종목코드 마스터파일 다운로드 및 파일 경로 +url = "https://new.real.download.dws.co.kr/common/master/konex_code.mst.zip" +zip_filename = "konex_code.zip" +extracted_filename = "konex_code.mst" + +file_path = download_and_extract_file(url, base_dir, zip_filename, extracted_filename) + +# 데이터프레임 생성 및 엑셀 파일로 저장 +df_knx = get_knx_master_dataframe(file_path) + +# 엑셀 파일 저장 +print("Saving to Excel...") +df_knx.to_excel('konex_code.xlsx', index=False) +print("Excel file created successfully.") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/kis_kosdaq_code_mst.py b/한국투자증권(API)/stocks_info/kis_kosdaq_code_mst.py new file mode 100644 index 0000000..8c6cd00 --- /dev/null +++ b/한국투자증권(API)/stocks_info/kis_kosdaq_code_mst.py @@ -0,0 +1,104 @@ +'''코스닥주식종목코드(kosdaq_code.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def kosdaq_master_download(base_dir, verbose=False): + + cwd = os.getcwd() + if (verbose): print(f"current directory is {cwd}") + ssl._create_default_https_context = ssl._create_unverified_context + + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/kosdaq_code.mst.zip", + base_dir + "\\kosdaq_code.zip") + + os.chdir(base_dir) + if (verbose): print(f"change directory to {base_dir}") + kosdaq_zip = zipfile.ZipFile('kosdaq_code.zip') + kosdaq_zip.extractall() + + kosdaq_zip.close() + + if os.path.exists("kosdaq_code.zip"): + os.remove("kosdaq_code.zip") + +def get_kosdaq_master_dataframe(base_dir): + file_name = base_dir + "\\kosdaq_code.mst" + tmp_fil1 = base_dir + "\\kosdaq_code_part1.tmp" + tmp_fil2 = base_dir + "\\kosdaq_code_part2.tmp" + + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + rf1 = row[0:len(row) - 222] + rf1_1 = rf1[0:9].rstrip() + rf1_2 = rf1[9:21].rstrip() + rf1_3 = rf1[21:].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + '\n') + rf2 = row[-222:] + wf2.write(rf2) + + wf1.close() + wf2.close() + + part1_columns = ['단축코드','표준코드','한글종목명'] + df1 = pd.read_csv(tmp_fil1, header=None, names=part1_columns, encoding='cp949') + + field_specs = [2, 1, + 4, 4, 4, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 9, + 5, 5, 1, 1, 1, + 2, 1, 1, 1, 2, + 2, 2, 3, 1, 3, + 12, 12, 8, 15, 21, + 2, 7, 1, 1, 1, + 1, 9, 9, 9, 5, + 9, 8, 9, 3, 1, + 1, 1 + ] + + part2_columns = ['증권그룹구분코드','시가총액 규모 구분 코드 유가', + '지수업종 대분류 코드','지수 업종 중분류 코드','지수업종 소분류 코드','벤처기업 여부 (Y/N)', + '저유동성종목 여부','KRX 종목 여부','ETP 상품구분코드','KRX100 종목 여부 (Y/N)', + 'KRX 자동차 여부','KRX 반도체 여부','KRX 바이오 여부','KRX 은행 여부','기업인수목적회사여부', + 'KRX 에너지 화학 여부','KRX 철강 여부','단기과열종목구분코드','KRX 미디어 통신 여부', + 'KRX 건설 여부','(코스닥)투자주의환기종목여부','KRX 증권 구분','KRX 선박 구분', + 'KRX섹터지수 보험여부','KRX섹터지수 운송여부','KOSDAQ150지수여부 (Y,N)','주식 기준가', + '정규 시장 매매 수량 단위','시간외 시장 매매 수량 단위','거래정지 여부','정리매매 여부', + '관리 종목 여부','시장 경고 구분 코드','시장 경고위험 예고 여부','불성실 공시 여부', + '우회 상장 여부','락구분 코드','액면가 변경 구분 코드','증자 구분 코드','증거금 비율', + '신용주문 가능 여부','신용기간','전일 거래량','주식 액면가','주식 상장 일자','상장 주수(천)', + '자본금','결산 월','공모 가격','우선주 구분 코드','공매도과열종목여부','이상급등종목여부', + 'KRX300 종목 여부 (Y/N)','매출액','영업이익','경상이익','단기순이익','ROE(자기자본이익률)', + '기준년월','전일기준 시가총액 (억)','그룹사 코드','회사신용한도초과여부','담보대출가능여부','대주가능여부' + ] + + df2 = pd.read_fwf(tmp_fil2, widths=field_specs, names=part2_columns) + + df = pd.merge(df1, df2, how='outer', left_index=True, right_index=True) + + # clean temporary file and dataframe + del (df1) + del (df2) + os.remove(tmp_fil1) + os.remove(tmp_fil2) + + print("Done") + + return df + +kosdaq_master_download(base_dir) +df = get_kosdaq_master_dataframe(base_dir) + +df.to_excel('kosdaq_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 +df diff --git a/한국투자증권(API)/stocks_info/kis_kospi_code_mst.py b/한국투자증권(API)/stocks_info/kis_kospi_code_mst.py new file mode 100644 index 0000000..917b13f --- /dev/null +++ b/한국투자증권(API)/stocks_info/kis_kospi_code_mst.py @@ -0,0 +1,108 @@ +'''코스피주식종목코드(kospi_code.mst) 정제 파이썬 파일''' + +import urllib.request +import ssl +import zipfile +import os +import pandas as pd + +base_dir = os.getcwd() + +def kospi_master_download(base_dir, verbose=False): + cwd = os.getcwd() + if (verbose): print(f"current directory is {cwd}") + ssl._create_default_https_context = ssl._create_unverified_context + + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/kospi_code.mst.zip", + base_dir + "\\kospi_code.zip") + + os.chdir(base_dir) + if (verbose): print(f"change directory to {base_dir}") + kospi_zip = zipfile.ZipFile('kospi_code.zip') + kospi_zip.extractall() + + kospi_zip.close() + + if os.path.exists("kospi_code.zip"): + os.remove("kospi_code.zip") + + +def get_kospi_master_dataframe(base_dir): + file_name = base_dir + "\\kospi_code.mst" + tmp_fil1 = base_dir + "\\kospi_code_part1.tmp" + tmp_fil2 = base_dir + "\\kospi_code_part2.tmp" + + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + rf1 = row[0:len(row) - 228] + rf1_1 = rf1[0:9].rstrip() + rf1_2 = rf1[9:21].rstrip() + rf1_3 = rf1[21:].strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + '\n') + rf2 = row[-228:] + wf2.write(rf2) + + wf1.close() + wf2.close() + + part1_columns = ['단축코드', '표준코드', '한글명'] + df1 = pd.read_csv(tmp_fil1, header=None, names=part1_columns, encoding='cp949') + + field_specs = [2, 1, 4, 4, 4, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 9, 5, 5, 1, + 1, 1, 2, 1, 1, + 1, 2, 2, 2, 3, + 1, 3, 12, 12, 8, + 15, 21, 2, 7, 1, + 1, 1, 1, 1, 9, + 9, 9, 5, 9, 8, + 9, 3, 1, 1, 1 + ] + + part2_columns = ['그룹코드', '시가총액규모', '지수업종대분류', '지수업종중분류', '지수업종소분류', + '제조업', '저유동성', '지배구조지수종목', 'KOSPI200섹터업종', 'KOSPI100', + 'KOSPI50', 'KRX', 'ETP', 'ELW발행', 'KRX100', + 'KRX자동차', 'KRX반도체', 'KRX바이오', 'KRX은행', 'SPAC', + 'KRX에너지화학', 'KRX철강', '단기과열', 'KRX미디어통신', 'KRX건설', + 'Non1', 'KRX증권', 'KRX선박', 'KRX섹터_보험', 'KRX섹터_운송', + 'SRI', '기준가', '매매수량단위', '시간외수량단위', '거래정지', + '정리매매', '관리종목', '시장경고', '경고예고', '불성실공시', + '우회상장', '락구분', '액면변경', '증자구분', '증거금비율', + '신용가능', '신용기간', '전일거래량', '액면가', '상장일자', + '상장주수', '자본금', '결산월', '공모가', '우선주', + '공매도과열', '이상급등', 'KRX300', 'KOSPI', '매출액', + '영업이익', '경상이익', '당기순이익', 'ROE', '기준년월', + '시가총액', '그룹사코드', '회사신용한도초과', '담보대출가능', '대주가능' + ] + + df2 = pd.read_fwf(tmp_fil2, widths=field_specs, names=part2_columns) + + df = pd.merge(df1, df2, how='outer', left_index=True, right_index=True) + + # clean temporary file and dataframe + del (df1) + del (df2) + os.remove(tmp_fil1) + os.remove(tmp_fil2) + + print("Done") + + return df + + +kospi_master_download(base_dir) +df = get_kospi_master_dataframe(base_dir) + +#df3 = df[df['KRX증권'] == 'Y'] +df3 = df +# print(df3[['단축코드', '한글명', 'KRX', 'KRX증권', '기준가', '증거금비율', '상장일자', 'ROE']]) +df3.to_excel('kospi_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 +df3 diff --git a/한국투자증권(API)/stocks_info/member_code.py b/한국투자증권(API)/stocks_info/member_code.py new file mode 100644 index 0000000..f300091 --- /dev/null +++ b/한국투자증권(API)/stocks_info/member_code.py @@ -0,0 +1,51 @@ +'''회원사 정보(memcode.mst) 정제 파이썬 파일''' + +import pandas as pd +import urllib.request +import ssl +import os + +# 현재 작업 디렉토리 +base_dir = os.getcwd() + +def download_file(url, output_dir, filename): + # 파일 다운로드 + print(f"Downloading {filename}...") + ssl._create_default_https_context = ssl._create_unverified_context + filepath = os.path.join(output_dir, filename) + urllib.request.urlretrieve(url, filepath) + return filepath + +def parse_memcode_file(file_path): + + print("Parsing the file...") + with open(file_path, mode="r", encoding="cp949") as f: + lines = f.readlines() + + data = [] + for row in lines: + if row.strip(): # 빈 줄 제외 + mbcr_no = row[:5].strip() + mbcr_name = row[5:-2].strip() + glob_yn = row[-2:].strip() + data.append([mbcr_no, mbcr_name, glob_yn]) + + columns = ['회원사코드', '회원사명', '구분(0=국내, 1=외국)'] + df = pd.DataFrame(data, columns=columns) + return df + +# 회원사 종목코드 마스터파일 다운로드 및 파일 경로 +url = "https://new.real.download.dws.co.kr/common/master/memcode.mst" +filename = "memcode.mst" + +# 파일 다운로드 +file_path = download_file(url, base_dir, filename) + +# 데이터프레임 생성 +df_memcode = parse_memcode_file(file_path) + +# 엑셀 파일로 저장 +excel_filename = 'memcode.xlsx' +print("Saving to Excel...") +df_memcode.to_excel(excel_filename, index=False) +print(f"Excel file '{excel_filename}' created successfully.") \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/overseas_future_code.py b/한국투자증권(API)/stocks_info/overseas_future_code.py new file mode 100644 index 0000000..4a4d6dc --- /dev/null +++ b/한국투자증권(API)/stocks_info/overseas_future_code.py @@ -0,0 +1,61 @@ +'''해외선물옵션종목코드 정제 파이썬 파일 : ffcode.mst''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_overseas_future_master_dataframe(base_dir): + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/ffcode.mst.zip", base_dir + "\\ffcode.mst.zip") + os.chdir(base_dir) + + nas_zip = zipfile.ZipFile('ffcode.mst.zip') + nas_zip.extractall() + nas_zip.close() + + file_name = base_dir + "\\ffcode.mst" + columns = ['종목코드', '서버자동주문 가능 종목 여부', '서버자동주문 TWAP 가능 종목 여부', '서버자동 경제지표 주문 가능 종목 여부', + '필러', '종목한글명', '거래소코드 (ISAM KEY 1)', '품목코드 (ISAM KEY 2)', '품목종류', '출력 소수점', '계산 소수점', + '틱사이즈', '틱가치', '계약크기', '가격표시진법', '환산승수', '최다월물여부 0:원월물 1:최다월물', + '최근월물여부 0:원월물 1:최근월물', '스프레드여부', '스프레드기준종목 LEG1 여부', '서브 거래소 코드'] + df=pd.DataFrame(columns=columns) + ridx=1 + print("Downloading...") + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + a = row[:32] # 종목코드 + b = row[32:33].rstrip() # 서버자동주문 가능 종목 여부 + c = row[33:34].rstrip() # 서버자동주문 TWAP 가능 종목 여부 + d = row[34:35] # 서버자동 경제지표 주문 가능 종목 여부 + e = row[35:82].rstrip() # 필러 + f = row[82:107].rstrip() # 종목한글명 + g = row[-92:-82] # 거래소코드 (ISAM KEY 1) + h = row[-82:-72].rstrip() # 품목코드 (ISAM KEY 2) + i = row[-72:-69].rstrip() # 품목종류 + j = row[-69:-64] # 출력 소수점 + k = row[-64:-59].rstrip() # 계산 소수점 + l = row[-59:-45].rstrip() # 틱사이즈 + m = row[-45:-31] # 틱가치 + n = row[-31:-21].rstrip() # 계약크기 + o = row[-21:-17].rstrip() # 가격표시진법 + p = row[-17:-7] # 환산승수 + q = row[-7:-6].rstrip() # 최다월물여부 0:원월물 1:최다월물 + r = row[-6:-5].rstrip() # 최근월물여부 0:원월물 1:최근월물 + s = row[-5:-4].rstrip() # 스프레드여부 + t = row[-4:-3].rstrip() # 스프레드기준종목 LEG1 여부 Y/N + u = row[-3:].rstrip() # 서브 거래소 코드 + + df.loc[ridx] = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u] + ridx += 1 + + df.to_excel('ffcode.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return df + +df = get_overseas_future_master_dataframe(base_dir) +print("Done") diff --git a/한국투자증권(API)/stocks_info/overseas_index_code.py b/한국투자증권(API)/stocks_info/overseas_index_code.py new file mode 100644 index 0000000..fd8e763 --- /dev/null +++ b/한국투자증권(API)/stocks_info/overseas_index_code.py @@ -0,0 +1,81 @@ +''' +* 해외주식지수정보(frgn_code.mst) 정제 파이썬 파일 +* 정제완료된 엑셀파일 : frgn_code.xlsx +* overseas_index_code.py(frgn_code.mst)은 해외지수 정보 제공용으로 개발된 파일로 + 해외주식 정보에 대해 얻고자 할 경우 overseas_stock_code.py(ex. nasmst.cod) 이용하시기 바랍니다. +''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os +import numpy as np + +base_dir = os.getcwd() + +def get_overseas_index_master_dataframe(base_dir): + + # download file + print("Downloading...") + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/frgn_code.mst.zip", base_dir + "\\frgn_code.mst.zip") + os.chdir(base_dir) + + frgn_code_zip = zipfile.ZipFile('frgn_code.mst.zip') + frgn_code_zip.extractall() + frgn_code_zip.close() + file_name = base_dir + "\\frgn_code.mst" + + # df1 : '구분코드','심볼','영문명','한글명' + tmp_fil1 = base_dir + "\\frgn_code_part1.tmp" + tmp_fil2 = base_dir + "\\frgn_code_part2.tmp" + wf1 = open(tmp_fil1, mode="w") + wf2 = open(tmp_fil2, mode="w") + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + if row[0:1] == 'X': + rf1 = row[0:len(row) - 14] + rf_1 = rf1[0:1] + rf1_2 = rf1[1:11] + rf1_3 = rf1[11:40].replace(",","") + rf1_4 = rf1[40:80].replace(",","").strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + '\n') + rf2 = row[-15:] + wf2.write(rf2+'\n') + continue + rf1 = row[0:len(row) - 14] + rf1_1 = rf1[0:1] + rf1_2 = rf1[1:11] + rf1_3 = rf1[11:50].replace(",","") + rf1_4 = row[50:75].replace(",","").strip() + wf1.write(rf1_1 + ',' + rf1_2 + ',' + rf1_3 + ',' + rf1_4 + '\n') + rf2 = row[-15:] + wf2.write(rf2+'\n') + wf1.close() + wf2.close() + part1_columns = ['구분코드','심볼','영문명','한글명'] + df1 = pd.read_csv(tmp_fil1, header=None, names=part1_columns, encoding='cp949') + + # df2 : '종목업종코드','다우30 편입종목여부','나스닥100 편입종목여부', 'S&P 500 편입종목여부','거래소코드','국가구분코드' + + field_specs = [4, 1, 1, 1, 4, 3] + part2_columns = ['종목업종코드','다우30 편입종목여부','나스닥100 편입종목여부', + 'S&P 500 편입종목여부','거래소코드','국가구분코드'] + df2 = pd.read_fwf(tmp_fil2, widths=field_specs, names=part2_columns, encoding='cp949') + + df2['종목업종코드'] = df2['종목업종코드'].str.replace(pat=r'[^A-Z]', repl= r'', regex=True) # 종목업종코드는 잘못 기입되어 있을 수 있으니 참고할 때 반드시 mst 파일과 비교 참고 + df2['다우30 편입종목여부'] = df2['다우30 편입종목여부'].str.replace(pat=r'[^0-1]+', repl= r'', regex=True) # 한글명 길이가 길어서 생긴 오타들 제거 + df2['나스닥100 편입종목여부'] = df2['나스닥100 편입종목여부'].str.replace(pat=r'[^0-1]+', repl= r'', regex=True) + df2['S&P 500 편입종목여부'] = df2['S&P 500 편입종목여부'].str.replace(pat=r'[^0-1]+', repl= r'', regex=True) + + # DF : df1 + df2 + DF = pd.concat([df1,df2],axis=1) + # print(len(df1), len(df2), len(DF)) + DF.to_excel('frgn_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + return DF + +df = get_overseas_index_master_dataframe(base_dir) +print("Done") diff --git a/한국투자증권(API)/stocks_info/overseas_stock_code.py b/한국투자증권(API)/stocks_info/overseas_stock_code.py new file mode 100644 index 0000000..c012975 --- /dev/null +++ b/한국투자증권(API)/stocks_info/overseas_stock_code.py @@ -0,0 +1,75 @@ +'''해외주식종목코드 정제 파이썬 파일 +미국 : nasmst.cod, nysmst.cod, amsmst.cod, +중국 : shsmst.cod, shimst.cod, szsmst.cod, szimst.cod, +일본 : tsemst.cod, +홍콩 : hksmst.cod, +베트남 : hnxmst.cod, hsxmst.cod''' + +''' +※ 유의사항 ※ +실행 환경 혹은 원본 파일의 칼럼 수의 변경으로 간혹 정제코드 파일(overseas_stock_code.py)이 실행되지 않을 수 있습니다. +해당 경우, URL에 아래 링크를 복사+붙여넣기 하여 원본 파일을 다운로드하시기 바랍니다. +. https://new.real.download.dws.co.kr/common/master/{val}mst.cod.zip +. {val} 자리에 원하시는 시장코드를 넣어주세요. +. 'nas','nys','ams','shs','shi','szs','szi','tse','hks','hnx','hsx' +. 순서대로 나스닥, 뉴욕, 아멕스, 상해, 상해지수, 심천, 심천지수, 도쿄, 홍콩, 하노이, 호치민 +''' + +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_overseas_master_dataframe(base_dir,val): + + ssl._create_default_https_context = ssl._create_unverified_context + # urllib.request.urlretrieve(f"https://new.real.download.dws.co.kr/common/master/{val}mst.cod.zip", base_dir + f"\\{val}mst.cod.zip") + urllib.request.urlretrieve(f"https://new.real.download.dws.co.kr/common/master/{val}mst.cod.zip", os.path.join(base_dir, f"{val}mst.cod.zip")) + os.chdir(base_dir) + + overseas_zip = zipfile.ZipFile(f'{val}mst.cod.zip') + overseas_zip.extractall() + overseas_zip.close() + + # file_name = base_dir + f"\\{val}mst.cod" + file_name = os.path.join(base_dir, f"{val}mst.cod") + columns = ['National code', 'Exchange id', 'Exchange code', 'Exchange name', 'Symbol', 'realtime symbol', 'Korea name', 'English name', 'Security type(1:Index,2:Stock,3:ETP(ETF),4:Warrant)', 'currency', 'float position', 'data type', 'base price', 'Bid order size', 'Ask order size', 'market start time(HHMM)', 'market end time(HHMM)', 'DR 여부(Y/N)', 'DR 국가코드', '업종분류코드', '지수구성종목 존재 여부(0:구성종목없음,1:구성종목있음)', 'Tick size Type', '구분코드(001:ETF,002:ETN,003:ETC,004:Others,005:VIX Underlying ETF,006:VIX Underlying ETN)','Tick size type 상세'] + + print(f"Downloading...{val}mst.cod") + # df = pd.read_table(base_dir+f"\\{val}mst.cod",sep='\t',encoding='cp949') + df = pd.read_table(os.path.join(base_dir, f"{val}mst.cod"), sep='\t',encoding='cp949') + df.columns = columns + df.to_excel(f'{val}_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 + + + return df + +cmd = input("1:전부 다운로드, 2:1개의 시장을 다운로드 \n") + +if cmd =='1': # 1. 해외종목코드전체 코드를 다운로드 + + # 순서대로 나스닥, 뉴욕, 아멕스, 상해, 상해지수, 심천, 심천지수, 도쿄, 홍콩, 하노이, 호치민 + lst = ['nas','nys','ams','shs','shi','szs','szi','tse','hks','hnx','hsx'] + + DF=pd.DataFrame() + for i in lst: + temp = get_overseas_master_dataframe(base_dir,i) + DF = pd.concat([DF,temp],axis=0) + print(f"Downloading...overseas_stock_code(all).xlsx") + DF.to_excel('overseas_stock_code(all).xlsx',index=False) # 전체 통합파일 + print("Done") + +elif cmd =='2': # 2. 해외종목코드 전체 코드를 다운로드 + + while True: + cmd2 = input("다운로드하시고자 하는 시장의 코드를 입력하여 주세요. \nnas:나스닥, nys:뉴욕, ams:아멕스, shs:상해, shi:상해지수, szs:심천, szi:심천지수, tse:도쿄, hks:홍콩, hnx:하노이, hsx:호치민\n") + + try: + df = get_overseas_master_dataframe(base_dir,cmd2) + print("Done") + break; + except: + pass \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/sector_code.py b/한국투자증권(API)/stocks_info/sector_code.py new file mode 100644 index 0000000..b097f82 --- /dev/null +++ b/한국투자증권(API)/stocks_info/sector_code.py @@ -0,0 +1,35 @@ +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_sector_master_dataframe(base_dir): + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/idxcode.mst.zip", base_dir + "\\idxcode.zip") + os.chdir(base_dir) + + idxcode_zip = zipfile.ZipFile('idxcode.zip') + idxcode_zip.extractall() + idxcode_zip.close() + + file_name = base_dir + "\\idxcode.mst" + df = pd.DataFrame(columns = ['업종코드', '업종명']) + + ridx = 1 + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + tcode = row[1:5] # 업종코드 4자리 (맨 앞 1자리 제거) + tname = row[3:43].rstrip() #업종명 + df.loc[ridx] = [tcode, tname] + # print(df.loc[ridx]) # 파일 작성중인 것을 확인할 수 있음 + ridx += 1 + + return df + +df2 = get_sector_master_dataframe(base_dir) +df2.to_excel('idxcode.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 +df2 diff --git a/한국투자증권(API)/stocks_info/theme_code.py b/한국투자증권(API)/stocks_info/theme_code.py new file mode 100644 index 0000000..6ca6469 --- /dev/null +++ b/한국투자증권(API)/stocks_info/theme_code.py @@ -0,0 +1,36 @@ +import pandas as pd +import urllib.request +import ssl +import zipfile +import os + +base_dir = os.getcwd() + +def get_theme_master_dataframe(base_dir): + + ssl._create_default_https_context = ssl._create_unverified_context + urllib.request.urlretrieve("https://new.real.download.dws.co.kr/common/master/theme_code.mst.zip", base_dir + "\\theme_code.zip") + os.chdir(base_dir) + + kospi_zip = zipfile.ZipFile('theme_code.zip') + kospi_zip.extractall() + kospi_zip.close() + + file_name = base_dir + "\\theme_code.mst" + df = pd.DataFrame(columns = ['테마코드', '테마명', '종목코드']) + + ridx = 1 + with open(file_name, mode="r", encoding="cp949") as f: + for row in f: + tcode = row[0:3] # 테마코드 + jcode = row[-10:].rstrip() # 테마명 + tname = row[3:-10].rstrip() # 종목코드 + df.loc[ridx] = [tcode, tname, jcode] + # print(df.loc[ridx]) # 파일 작성중인 것을 확인할 수 있음 + ridx += 1 + + return df + +df1 = get_theme_master_dataframe(base_dir) +df1.to_excel('theme_code.xlsx',index=False) # 현재 위치에 엑셀파일로 저장 +df1 \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/업종코드정보.h b/한국투자증권(API)/stocks_info/업종코드정보.h new file mode 100644 index 0000000..508b2d6 --- /dev/null +++ b/한국투자증권(API)/stocks_info/업종코드정보.h @@ -0,0 +1,9 @@ +/***************************************************************************** + * 업종코드정보 + ****************************************************************************/ +typedef struct +{ + char idx_div[1]; /* 시장구분값 ex) 00002(대형주)일 경우 맨 앞자리 0 */ + char idx_code[4]; /* 업종코드 ex) 00002(대형주)일 경우 맨 앞자리를 제외한 0002 */ + char idx_name[40]; /* 업종명 */ +} IDX_CODE; diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(ELW).h b/한국투자증권(API)/stocks_info/종목마스터정보(ELW).h new file mode 100644 index 0000000..f2415c0 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(ELW).h @@ -0,0 +1,40 @@ +/***************************************************************************** + * ELW 종목 코드 파일 구조 + ****************************************************************************/ +typedef struct +{ + char mksc_shrn_iscd [SZ_SHRNCODE]; /* 단축코드 */ + char stnd_iscd [SZ_STNDCODE]; /* 표준코드 */ + char hts_kor_isnm [SZ_KORNAME]; /* 한글종목명 */ + char elw_nvlt_optn_cls_code [1]; /* ELW권리형태 */ + /* 0 : 표준옵션 */ + /* 1 : 디지털옵현 */ + /* 2: 조기종료 옵션 */ + char elw_ko_barrier [13]; /* ELW조기종료발생기준가격 */ + char bskt_yn [1]; /* 바스켓 여부 (Y/N) */ + char unas_iscd1 [SZ_SHRNCODE]; /* 기초자산코드 */ + char unas_iscd2 [SZ_SHRNCODE]; /* 기초자산코드 */ + char unas_iscd3 [SZ_SHRNCODE]; /* 기초자산코드 */ + char unas_iscd4 [SZ_SHRNCODE]; /* 기초자산코드 */ + char unas_iscd5 [SZ_SHRNCODE]; /* 기초자산코드 */ + char elw_pblc_istu_name [SZ_KORNAME]; /* 발행사 한글 종목명 */ + char elw_pblc_mrkt_prtt_no [5]; /* 발행사코드 */ + char acpr [9]; /* 행사가 */ + char stck_last_tr_month [8]; /* 최종거래일 */ + char rmnn_dynu [4]; /* 잔존 일수 */ + char rght_type_cls_code [1]; /* 권리 유형 구분 코드 */ + /* 'C':콜 'E':기타 'P':풋 */ + char paym_date [8]; /* 지급일 */ + char prdy_avls [9]; /* 전일시가총액(억) */ + char lstn_stcn [15]; /* 상장주수(천) */ + char mrkt_prtt_no1 [5]; /* 시장 참가자 번호1 */ + char mrkt_prtt_no2 [5]; /* 시장 참가자 번호2 */ + char mrkt_prtt_no3 [5]; /* 시장 참가자 번호3 */ + char mrkt_prtt_no4 [5]; /* 시장 참가자 번호4 */ + char mrkt_prtt_no5 [5]; /* 시장 참가자 번호5 */ + char mrkt_prtt_no6 [5]; /* 시장 참가자 번호6 */ + char mrkt_prtt_no7 [5]; /* 시장 참가자 번호7 */ + char mrkt_prtt_no8 [5]; /* 시장 참가자 번호8 */ + char mrkt_prtt_no9 [5]; /* 시장 참가자 번호9 */ + char mrkt_prtt_no10 [5]; /* 시장 참가자 번호10 */ +} ST_ELW_CODE; diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(상품선물옵션).h b/한국투자증권(API)/stocks_info/종목마스터정보(상품선물옵션).h new file mode 100644 index 0000000..612b456 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(상품선물옵션).h @@ -0,0 +1,26 @@ +/***************************************************************************** + * 상품 선물/옵션 종목 + ****************************************************************************/ +typedef struct +{ + char com_type[1]; /* 상품구분 */ + /* 1:금리 2:통화 3:상품 */ + char info_type[1]; /* 1:선물 2:SP선물 */ + /* 5:콜옵션 6:풋옵션 */ + char shrn_iscd[SZ_SHRNCODE]; /* 단축코드 (SZ_SHRNCODE=9) */ + char stnd_iscd[SZ_STNDCODE]; /* 표준코드 (SZ_STNDCODE=12) */ + char kor_name[SZ_KORNAME]; /* 한글종목명 (SZ_KORNAME=40) */ + char atm_cls_code[ 1]; /* ATM구분(1:ATM,2:ITM,3:OTM) */ + char acpr[8]; /* 행사가 */ + char mmsc_cls_code[1]; /* 월물구분코드 (0:연결선물, 1:최근월물 */ + /* 2:차근월물 3:차차근월물 4:차차차근월물 */ + /* SP 는 무조건 1 */ + char prod_no[3]; /* 기초자산 단축코드 */ + /* B03 : 3년국채 B05 : 5년국채 */ + /* B10 : 10년국채 MSB : 통안증권 */ + /* USD : 미국달러 JPY : 엔 */ + /* EUR : 유로 GLD : 금 */ + /* LHG : 돈육 CMU : CME미국달러 */ + /* RFR : 3개월무위험금리 */ + char prod_name[SZ_KORNAME]; /* 기초자산 명 (SZ_KORNAME=40) */ +} ST_FO_COM_CODE; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(주식선물옵션).h b/한국투자증권(API)/stocks_info/종목마스터정보(주식선물옵션).h new file mode 100644 index 0000000..715f1eb --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(주식선물옵션).h @@ -0,0 +1,18 @@ +/***************************************************************************** + * 주식 선물/옵션 종목 마스터파일(fo_stk_code_mts.mst) 헤더정보 + ****************************************************************************/ +typedef struct +{ + char info_type[1]; /* 1:코스피 주식선물 2:코스피 주식선물 SP */ + /* 3:코스닥 주식선물 4:코스닥 주식선물 SP */ + /* 5:주식 콜옵션 6:주식 풋옵션 */ + char shrn_iscd[SZ_SHRNCODE]; /* 단축코드 */ + char stnd_iscd[SZ_STNDCODE]; /* 표준코드 */ + char kor_name[SZ_KORNAME]; /* 한글종목명 */ + char atm_cls_code[ 1]; /* ATM구분(1:ATM,2:ITM,3:OTM) */ + char acpr[8]; /* 행사가 */ + char mmsc_cls_code[1]; /* 월물구분코드 (0:연결선물, 1:최근월물 */ + /* 2:차근월물 3:차차근월물 4:차차차근월물 */ + char unas_shrn_iscd[SZ_SHRNCODE]; /* 기초자산 단축코드 */ + char unas_kor_name[SZ_KORNAME]; /* 기초자산 명 */ +} ST_FO_STK_CODE; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(지수선물옵션).h b/한국투자증권(API)/stocks_info/종목마스터정보(지수선물옵션).h new file mode 100644 index 0000000..1ae0398 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(지수선물옵션).h @@ -0,0 +1,23 @@ +/***************************************************************************** + * 지수 선물/옵션 종목 + ****************************************************************************/ +typedef struct +{ + char info_type[1]; /* 1:지수선물 2:지수SP 3:스타선물 4:스타SP */ + /* 5:지수콜옵션 6:지수풋옵션 */ + /* 7:변동성선물 8:변동성SP */ + /* 9:섹터선물 A:섹터SP */ + /* B:미니선물 C:미니SP */ + /* D:미니콜옵션 E:미니풋옵션 */ + /* J:코스닥150콜옵션 K:코스닥150풋옵션 */ + /* L:위클리콜옵션 M:위클리풋옵션 */ + char shrn_iscd[SZ_SHRNCODE]; /* 단축코드 */ + char stnd_iscd[SZ_STNDCODE]; /* 표준코드 */ + char kor_name[SZ_KORNAME]; /* 한글종목명 */ + char atm_cls_code[ 1]; /* ATM구분(1:ATM,2:ITM,3:OTM) */ + char acpr[8]; /* 행사가 */ + char mmsc_cls_code[1]; /* 월물구분코드 (0:연결선물, 1:최근월물 */ + /* 2:차근월물 3:차차근월물 4:차차차근월물 */ + char unas_shrn_iscd[SZ_SHRNCODE]; /* 기초자산 단축코드 */ + char unas_kor_name[SZ_KORNAME]; /* 기초자산 명 */ +} ST_FO_IDX_CODE; diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(채권).h b/한국투자증권(API)/stocks_info/종목마스터정보(채권).h new file mode 100644 index 0000000..62bbb26 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(채권).h @@ -0,0 +1,22 @@ +/***************************************************************************** + * 채권 코드 파일 구조 + ****************************************************************************/ +typedef struct +{ + char type [2]; // A0:장내소매채권, F9:(주식관련사채, 소액채권), C0:국고채권 + char bond_cls_code [2]; // A0: GA:국고채 MA:통안채 BA:금융채 SA:비금융특수채 CA:회사채 + // F9: 03:장내소액채권 02:기타채권 04:장내주식관련사채 MM:매매종류별 + // C0: GA:국고채 MA:통안채 BA:금융채 SA:비금융특수채 MB:지방채 99:기타 + char stnd_iscd [12]; + char sname [40]; + char bond_int_cls_code[2]; // F9/C0 : 01:할인 02:복리 03:이표 04:금리연동 05:분할상환(거리복리) + // 06:분할(거치단리) 07:단리 08:FRN 09:복5단2 + // A0 : 고정금리형 11:할인채 12:복리채 13:이표채 14:단리채 15:복5단2 19:기타 + // A0 : 변동금리형 21:이표채 22:복리채 23:단리채 29:기타 + char lstn_date [8]; // 상장일 + char pblc_date [8]; // 발행 일자 + char rdmp_date [8]; // 상환 일자 + char sale_date [8]; // 매출 일자 + char srfc_intrt [8]; // 표면 이자율(사용안함) + char rdmt_rate [8]; // 만기 상환 비율(사용안함) +} ST_BOND_CODE; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(코넥스).h b/한국투자증권(API)/stocks_info/종목마스터정보(코넥스).h new file mode 100644 index 0000000..9c816e5 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(코넥스).h @@ -0,0 +1,56 @@ +/***************************************************************************** + * 코넥스 종목 코드 파일 구조 + ****************************************************************************/ +typedef struct +{ + char mksc_shrn_iscd[SZ_SHRNCODE]; /* 단축코드 */ + char stnd_iscd[SZ_STNDCODE]; /* 표준코드 */ + char hts_kor_isnm[SZ_KORNAME]; /* 한글종목명 */ + char scrt_grp_cls_code[2]; /* 증권그룹구분코드 */ + /* KN:코넥스 */ + char stck_sdpr[9]; /* 주식 기준가 */ + char frml_mrkt_deal_qty_unit[5]; /* 정규 시장 매매 수량 단위 */ + char ovtm_mrkt_deal_qty_unit[5]; /* 시간외 시장 매매 수량 단위 */ + char trht_yn[1]; /* 거래정지 여부 */ + char sltr_yn[1]; /* 정리매매 여부 */ + char mang_issu_yn[1]; /* 관리 종목 여부 */ + char mrkt_alrm_cls_code[2]; /* 시장 경고 구분 코드 (00:해당없음 01:투자주의 */ + /* 02:투자경고 03:투자위험 */ + char mrkt_alrm_risk_adnt_yn[1]; /* 시장 경고위험 예고 여부 */ + char insn_pbnt_yn[1]; /* 불성실 공시 여부 */ + char byps_lstn_yn[1]; /* 우회 상장 여부 */ + char flng_cls_code[2]; /* 락구분 코드 */ + /* 00:해당사항없음 01:권리락 */ + /* 02:배당락 03:분배락 04:권배락 05:중간배당락 */ + /* 06:권리중간배당락 99:기타 */ + /* SW,SR,EW는 미해당(미해당의경우 SPACE) */ + char fcam_mod_cls_code[2]; /* 액면가 변경 구분 코드 (00:해당없음 */ + /* 01:액면분할 02:액면병합 99:기타) */ + char icic_cls_code[2]; /* 증자 구분 코드 (00:해당없음 01:유상증자 */ + /* 02:무상증자 03:유무상증자 99:기타) */ + char marg_rate[3]; /* 증거금 비율 */ + char crdt_able[1]; /* 신용주문 가능 여부 */ + char crdt_days[3]; /* 신용기간 */ + char prdy_vol[12]; /* 전일 거래량 */ + char stck_fcam[12]; /* 주식 액면가 */ + char stck_lstn_date[8]; /* 주식 상장 일자 */ + char lstn_stcn[15]; /* 상장 주수(천) */ + char cpfn[21]; /* 자본금 */ + char stac_month[2]; /* 결산 월 */ + char po_prc[7]; /* 공모 가격 */ + char prst_cls_code[1]; /* 우선주 구분 코드 (0:해당없음(보통주) */ + /* 1:구형우선주 2:신형우선주) */ + char ssts_hot_yn[1]; /* 공매도과열종목여부 */ + char stange_runup_yn[1]; /* 이상급등종목여부 */ + char krx300_issu_yn[1]; /* KRX300 종목 여부 (Y/N) (실제적으로 필러) */ + char sale_account[9]; /* 매출액 */ + char bsop_prfi[9]; /* 영업이익 */ + char op_prfi[9]; /* 경상이익 */ + char thtr_ntin[5]; /* 단기순이익 */ + char roe[9]; /* ROE(자기자본이익률) */ + char base_date[8]; /* 기준년월 */ + char prdy_avls_scal[9]; /* 전일기준 시가총액 (억) */ + char co_crdt_limt_over_yn[1]; /* 회사신용한도초과여부 */ + char secu_lend_able_yn[1]; /* 담보대출가능여부 */ + char stln_able_yn[1]; /* 대주가능여부 */ +} ST_KNX_CODE; diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(코스닥).h b/한국투자증권(API)/stocks_info/종목마스터정보(코스닥).h new file mode 100644 index 0000000..6a58359 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(코스닥).h @@ -0,0 +1,89 @@ +/***************************************************************************** + * 코스닥 종목 코드 파일 구조 + ****************************************************************************/ +typedef struct +{ + char mksc_shrn_iscd[SZ_SHRNCODE]; /* 단축코드 */ + char stnd_iscd[SZ_STNDCODE]; /* 표준코드 */ + char hts_kor_isnm[SZ_KORNAME]; /* 한글종목명 */ + char scrt_grp_cls_code[2]; /* 증권그룹구분코드 */ + /* ST:주권 MF:증권투자회사 RT:부동산투자회사 */ + /* SC:선박투자회사 IF:사회간접자본투융자회사 */ + /* DR:주식예탁증서 EW:ELW EF:ETF */ + /* SW:신주인수권증권 SR:신주인수권증서 */ + /* BC:수익증권 FE:해외ETF FS:외국주권 */ + char avls_scal_cls_code[1]; /* 시가총액 규모 구분 코드 유가 */ + /* 0:제외 1:KOSDAQ100 2:KOSDAQmid300 3:KOSDAQsmall) */ + char bstp_larg_div_code[4]; /* 지수업종 대분류 코드 */ + char bstp_medm_div_code[4]; /* 지수 업종 중분류 코드 */ + char bstp_smal_div_code[4]; /* 지수업종 소분류 코드 */ + char vntr_issu_yn[1]; /* 벤처기업 여부 (Y/N) */ + char low_current_yn[1]; /* 저유동성종목 여부 */ + char krx_issu_yn[1]; /* KRX 종목 여부 */ + char etp_prod_cls_code[1]; /* ETP 상품구분코드 */ + /* 0:해당없음 1:투자회사형 2:수익증권형 */ + /* 3:ETN 4:손실제한ETN */ + char krx100_issu_yn[1]; /* KRX100 종목 여부 (Y/N) */ + char krx_car_yn[1]; /* KRX 자동차 여부 */ + char krx_smcn_yn[1]; /* KRX 반도체 여부 */ + char krx_bio_yn[1]; /* KRX 바이오 여부 */ + char krx_bank_yn[1]; /* KRX 은행 여부 */ + char etpr_undt_objt_co_yn[1]; /* 기업인수목적회사여부 */ + char krx_enrg_chms_yn[1]; /* KRX 에너지 화학 여부 */ + char krx_stel_yn[1]; /* KRX 철강 여부 */ + char short_over_cls_code[1]; /* 단기과열종목구분코드 0:해당없음 */ + /* 1:지정예고 2:지정 3:지정연장(해제연기) */ + char krx_medi_cmnc_yn[1]; /* KRX 미디어 통신 여부 */ + char krx_cnst_yn[1]; /* KRX 건설 여부 */ + char invt_alrm_yn[1]; /* (코스닥)투자주의환기종목여부 */ + char krx_scrt_yn [1]; /* KRX 증권 구분 */ + char krx_ship_yn [1]; /* KRX 선박 구분 */ + char krx_insu_yn[1]; /* KRX섹터지수 보험여부 */ + char krx_trnp_yn[1]; /* KRX섹터지수 운송여부 */ + char ksq150_nmix_yn[1]; /* KOSDAQ150지수여부 (Y,N) */ + char stck_sdpr[9]; /* 주식 기준가 */ + char frml_mrkt_deal_qty_unit[5]; /* 정규 시장 매매 수량 단위 */ + char ovtm_mrkt_deal_qty_unit[5]; /* 시간외 시장 매매 수량 단위 */ + char trht_yn[1]; /* 거래정지 여부 */ + char sltr_yn[1]; /* 정리매매 여부 */ + char mang_issu_yn[1]; /* 관리 종목 여부 */ + char mrkt_alrm_cls_code[2]; /* 시장 경고 구분 코드 (00:해당없음 01:투자주의 */ + /* 02:투자경고 03:투자위험) */ + char mrkt_alrm_risk_adnt_yn[1]; /* 시장 경고위험 예고 여부 */ + char insn_pbnt_yn[1]; /* 불성실 공시 여부 */ + char byps_lstn_yn[1]; /* 우회 상장 여부 */ + char flng_cls_code[2]; /* 락구분 코드 (00:해당사항없음 01:권리락 */ + /* 02:배당락 03:분배락 04:권배락 05:중간배당락 */ + /* 06:권리중간배당락 99:기타 */ + /* SW,SR,EW는 미해당(SPACE) */ + char fcam_mod_cls_code[2]; /* 액면가 변경 구분 코드 (00:해당없음 */ + /* 01:액면분할 02:액면병합 99:기타 */ + char icic_cls_code[2]; /* 증자 구분 코드 (00:해당없음 01:유상증자 */ + /* 02:무상증자 03:유무상증자 99:기타) */ + char marg_rate[3]; /* 증거금 비율 */ + char crdt_able[1]; /* 신용주문 가능 여부 */ + char crdt_days[3]; /* 신용기간 */ + char prdy_vol[12]; /* 전일 거래량 */ + char stck_fcam[12]; /* 주식 액면가 */ + char stck_lstn_date[8]; /* 주식 상장 일자 */ + char lstn_stcn[15]; /* 상장 주수(천) */ + char cpfn[21]; /* 자본금 */ + char stac_month[2]; /* 결산 월 */ + char po_prc[7]; /* 공모 가격 */ + char prst_cls_code[1]; /* 우선주 구분 코드 (0:해당없음(보통주) */ + /* 1:구형우선주 2:신형우선주 */ + char ssts_hot_yn[1]; /* 공매도과열종목여부 */ + char stange_runup_yn[1]; /* 이상급등종목여부 */ + char krx300_issu_yn[1]; /* KRX300 종목 여부 (Y/N) */ + char sale_account[9]; /* 매출액 */ + char bsop_prfi[9]; /* 영업이익 */ + char op_prfi[9]; /* 경상이익 */ + char thtr_ntin[5]; /* 당기순이익 */ + char roe[9]; /* ROE(자기자본이익률) */ + char base_date[8]; /* 기준년월 */ + char prdy_avls_scal[9]; /* 전일기준 시가총액 (억) */ + char grp_code[3]; /* 그룹사 코드 */ + char co_crdt_limt_over_yn[1]; /* 회사신용한도초과여부 */ + char secu_lend_able_yn[1]; /* 담보대출가능여부 */ + char stln_able_yn[1]; /* 대주가능여부 */ +} ST_KSQ_CODE; diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(코스피).h b/한국투자증권(API)/stocks_info/종목마스터정보(코스피).h new file mode 100644 index 0000000..eb44925 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(코스피).h @@ -0,0 +1,99 @@ +/***************************************************************************** + * ڽ ڵ + ****************************************************************************/ +typedef struct +{ + char mksc_shrn_iscd[SZ_SHRNCODE]; /* ڵ */ + char stnd_iscd[SZ_STNDCODE]; /* ǥڵ */ + char hts_kor_isnm[SZ_KORNAME]; /* ѱ */ + char scrt_grp_cls_code[2]; /* DZ׷챸ڵ */ + /* ST:ֱ MF:ȸ RT:εȸ */ + /* SC:ȸ IF:ȸںȸ */ + /* DR:ֽĿŹ EW:ELW EF:ETF */ + /* SW:μ SR:μ */ + /* BC: FE:ؿETF FS:ֱܱ */ + char avls_scal_cls_code[1]; /* ðѾ Ը ڵ */ + /* (0: 1: 2: 3:) */ + char bstp_larg_div_code[4]; /* з ڵ */ + char bstp_medm_div_code[4]; /* ߺз ڵ */ + char bstp_smal_div_code[4]; /* Һз ڵ */ + char mnin_cls_code_yn[1]; /* ڵ (Y/N) */ + char low_current_yn[1]; /* */ + char sprn_strr_nmix_issu_yn[1]; /* (Y/N) */ + char kospi200_apnt_cls_code[1]; /* KOSPI200 ;(20110401 ) */ + /* 0:̺з 1:Ǽ 2: 3:ö */ + /* 4:ȭ 5: 6: 7:ʼҺ */ + /* 8: Һ */ + char kospi100_issu_yn[1]; /* KOSPI100 */ + char kospi50_issu_yn[1]; /* KOSPI50 */ + char krx_issu_yn[1]; /* KRX */ + char etp_prod_cls_code[1]; /* ETP ǰڵ */ + /* 0:ش 1:ȸ 2: */ + /* 3:ETN 4:սETN */ + char elw_pblc_yn[1]; /* ELW ࿩ (Y/N) */ + char krx100_issu_yn[1]; /* KRX100 (Y/N) */ + char krx_car_yn[1]; /* KRX ڵ */ + char krx_smcn_yn[1]; /* KRX ݵü */ + char krx_bio_yn[1]; /* KRX ̿ */ + char krx_bank_yn[1]; /* KRX */ + char etpr_undt_objt_co_yn[1]; /* μȸ翩 */ + char krx_enrg_chms_yn[1]; /* KRX ȭ */ + char krx_stel_yn[1]; /* KRX ö */ + char short_over_cls_code[1]; /* ܱ񱸺ڵ 0:ش */ + /* 1: 2: 3:() */ + char krx_medi_cmnc_yn[1]; /* KRX ̵ */ + char krx_cnst_yn[1]; /* KRX Ǽ */ + char krx_fnnc_svc_yn[1]; /* (20151218) */ + char krx_scrt_yn [1]; /* KRX */ + char krx_ship_yn [1]; /* KRX */ + char krx_insu_yn[1]; /* KRX 迩 */ + char krx_trnp_yn[1]; /* KRX ۿ */ + char sri_nmix_yn[1]; /* SRI (Y,N) */ + char stck_sdpr[9]; /* ֽ ذ */ + char frml_mrkt_deal_qty_unit[5]; /* Ÿ */ + char ovtm_mrkt_deal_qty_unit[5]; /* ð Ÿ */ + char trht_yn[1]; /* ŷ */ + char sltr_yn[1]; /* Ÿ */ + char mang_issu_yn[1]; /* */ + char mrkt_alrm_cls_code[2]; /* ڵ (00:ش 01: */ + /* 02:ڰ 03: */ + char mrkt_alrm_risk_adnt_yn[1]; /* */ + char insn_pbnt_yn[1]; /* Ҽ */ + char byps_lstn_yn[1]; /* ȸ */ + char flng_cls_code[2]; /* ڵ (00:ش׾ 01:Ǹ */ + /* 02: 03:й 04:ǹ 05:߰ */ + /* 06:Ǹ߰ 99:Ÿ */ + /* S?W,SR,EW ش(SPACE) */ + char fcam_mod_cls_code[2]; /* ׸鰡 ڵ (00:ش */ + /* 01:׸ 02:׸麴 99:Ÿ */ + char icic_cls_code[2]; /* ڵ (00:ش 01: */ + /* 02: 03: 99:Ÿ) */ + char marg_rate[3]; /* ű */ + char crdt_able[1]; /* ſֹ */ + char crdt_days[3]; /* ſⰣ */ + char prdy_vol[12]; /* ŷ */ + char stck_fcam[12]; /* ֽ ׸鰡 */ + char stck_lstn_date[8]; /* ֽ */ + char lstn_stcn[15]; /* ּ(õ) */ + char cpfn[21]; /* ں */ + char stac_month[2]; /* */ + char po_prc[7]; /* */ + char prst_cls_code[1]; /* 켱 ڵ (0:ش() */ + /* 1:켱 2:켱 */ + char ssts_hot_yn[1]; /* ŵ񿩺 */ + char stange_runup_yn[1]; /* ̻޵񿩺 */ + char krx300_issu_yn[1]; /* KRX300 (Y/N) */ + char kospi_issu_yn[1]; /* KOSPI */ + char sale_account[9]; /* */ + char bsop_prfi[9]; /* */ + char op_prfi[9]; /* */ + char thtr_ntin[5]; /* */ + char roe[9]; /* ROE(ڱںͷ) */ + char base_date[8]; /* س */ + char prdy_avls_scal[9]; /* ϱ ðѾ () */ + + char grp_code[3]; /* ׷ ڵ */ + char co_crdt_limt_over_yn[1]; /* ȸſѵʰ */ + char secu_lend_able_yn[1]; /* 㺸Ⱑɿ */ + char stln_able_yn[1]; /* ְɿ */ +} ST_KSP_CODE; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/종목마스터정보(회원사).h b/한국투자증권(API)/stocks_info/종목마스터정보(회원사).h new file mode 100644 index 0000000..eb87412 --- /dev/null +++ b/한국투자증권(API)/stocks_info/종목마스터정보(회원사).h @@ -0,0 +1,9 @@ +/***************************************************************************** + * 회원사 종목 코드 파일 구조 + ****************************************************************************/ +typedef struct +{ + char mbcr_no [ 5]; /* 회원사코드 */ + char mbcr_name [SZ_KORNAME20]; /* 회원사명 */ + char glob_yn [ 1]; /* 구분 0=국내, 1=외국 */ +} ST_MEM_CODE; diff --git a/한국투자증권(API)/stocks_info/테마코드정보.h b/한국투자증권(API)/stocks_info/테마코드정보.h new file mode 100644 index 0000000..e0a0e12 --- /dev/null +++ b/한국투자증권(API)/stocks_info/테마코드정보.h @@ -0,0 +1,10 @@ +/***************************************************************************** + * ׸ڵ + ****************************************************************************/ +typedef struct +{ + char theme_code[3]; /* ׸ڵ */ + char theme_name[40]; /* */ + char shrn_iscd[6]; /* ڵ(ڵ) */ + char filler[3]; /* filler */ +} THEME_CODE; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/해외선물정보.h b/한국투자증권(API)/stocks_info/해외선물정보.h new file mode 100644 index 0000000..faf4760 --- /dev/null +++ b/한국투자증권(API)/stocks_info/해외선물정보.h @@ -0,0 +1,27 @@ +/***************************************************************************** + * ؿ (ffcode.mst) + ****************************************************************************/ +typedef struct ST_FFCODE_TBL +{ + char sSrsCd [ 32]; /* ڵ */ + char sAutoOrdGnrlYN[ 1]; /* ڵֹ */ + char sAutoOrdTwapYN[ 1]; /* ڵֹ TWAP */ + char sAutoOrdEcnmYN[ 1]; /* ڵ ǥ ֹ */ + char sFiller [ 47]; /* ʷ */ + char sSeriesKrNm [ 50]; /* ѱ۸ */ + char sExchCd [ 10]; /* ŷڵ (ISAM KEY 1) */ + char sMrktCd [ 10]; /* ǰڵ (ISAM KEY 2) */ + char sClasCd [ 3]; /* ǰ */ + char sDispDesz [ 5]; /* Ҽ */ + char sCalcDesz [ 5]; /* Ҽ */ + char sTickSz [ 14]; /* ƽ */ + char sTickVal [ 14]; /* ƽġ */ + char sCtrtSz [ 10]; /* ũ */ + char sDispDigit [ 4]; /* ǥ */ + char sMultiplier [ 10]; /* ȯ¼ */ + char sNearFlg [ 1]; /* ִٿ 0: 1:ִٿ */ + char sNearFlgDt [ 1]; /* ֱٿ 0: 1:ֱٿ */ + char sSprdYN [ 1]; /* 忩 */ + char sSprdLeg1YN [ 1]; /* LEG1 Y/N */ + char sExchSubCd [ 2]; /* ŷ ڵ */ +} FFCODE_TBL; diff --git a/한국투자증권(API)/stocks_info/해외옵션정보.h b/한국투자증권(API)/stocks_info/해외옵션정보.h new file mode 100644 index 0000000..45f9cbf --- /dev/null +++ b/한국투자증권(API)/stocks_info/해외옵션정보.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * ؿ ɼ (focode.mst) + ****************************************************************************/ +typedef struct ST_FOCODE_TBL +{ + char sSrsCd [ 32]; /* ڵ (UNIQ-KEY) */ + char sAutoOrdGnrlYN[ 1]; /* ڵֹ */ + char sAutoOrdTwapYN[ 1]; /* ڵֹ TWAP */ + char sAutoOrdEcnmYN[ 1]; /* ڵ ǥ ֹ */ + char sExchSubCd [ 2]; /* ŷ ڵ 2019.12.27 */ + /* 10:ASX 20:BALTIC 30:BMF 40:CBOE */ + /* 50:CME 51:CME_CBOT 52:CME_NYMEX 53:CME_COMEX */ + /* 60:EUREX 70:FTX 80:HKEx */ + /* 90:ICE_US 91:ICE_ 92:ICE_ǰ 93:ICE_SG */ + /* A0:ISE B0:ITA C0:JSE D0:KCBT */ + /* E0:LBMA F0:LME G0:MDEX H0:MDX */ + /* I0:MEFF J0:NYSE K0:OSE L0:SGX */ + /* M0:SSE N0:TFEX O0:TMX P0:HNX */ + char sFiller [ 45]; /* ʷ */ + char sSeriesKrNm [ 50]; /* ѱ۸ */ + char sExchCd [ 10]; /* ŷڵ */ + char sMrktCd [ 10]; /* ǰڵ */ + char sClasCd [ 3]; /* ǰ */ + /* 1: ɼ */ + /* 2: ֽĿɼ (M) */ + /* 3: ɼ */ + /* 4: ɼ */ + /* 5: ֽĿɼ (W) */ + char sDispDesz [ 5]; /* Ҽ */ + char sCalcDesz [ 5]; /* Ҽ */ + char sTickSz [ 14]; /* ƽ */ + char sTickVal [ 14]; /* ƽġ */ + char sCtrtSz [ 10]; /* ũ */ + char sDispDigit [ 4]; /* ǥ */ + char sMultiplier [ 10]; /* ȯ¼ */ + char sSymbol [ 1]; /* ɼ C, P */ + char sStkPrc [ 20]; /* Strike Price */ + char sUndrInstr [ 10]; /* üڵ */ + /* ؿܼ ǰ ڵ */ + /* ֽĿɼ ŷ ڵ */ + /* ex: NAS, NYS, AMS */ + char sUndrAsset [ 32]; /* ü */ + /* ؿܼ ڻ ڵ */ + /* ֽĿɼ Ticker ڵ */ + /* AAPL, TSLA */ + char sRefrAsset [ 32]; /* ڻ Index */ + /* ΰ */ + /* ؿܼΰ ڵ */ + char sIncTickPrc [ 19]; /* ƽذ */ + char sIncTickSz [ 5]; /* ƽ */ + char sYearMon [ 6]; /* */ + char sAtmFlg [ 1]; /* A: ATM, I:ITM, O:OTM */ + char sNearFlg [ 1]; /* ٿ 0: 1:ٿ */ +} FOCODE_TBL; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/해외종목코드정보(미국,중국,일본,홍콩,베트남).h b/한국투자증권(API)/stocks_info/해외종목코드정보(미국,중국,일본,홍콩,베트남).h new file mode 100644 index 0000000..79433cf --- /dev/null +++ b/한국투자증권(API)/stocks_info/해외종목코드정보(미국,중국,일본,홍콩,베트남).h @@ -0,0 +1,35 @@ +/***************************************************************************** + * 해외종목코드정보(미국,중국,일본,홍콩,베트남) + ****************************************************************************/ +struct mastcode { + char ncod[2+1]; /* National code */ + char exid[3+1]; /* Exchange id */ + char excd[3+1]; /* Exchange code */ + char exnm[16+1]; /* Exchange name */ + char symb[16+1]; /* Symbol */ + char rsym[16+1]; /* realtime symbol */ + char knam[64+1]; /* Korea name */ + char enam[64+1]; /* English name */ + char stis[1+1]; /* Security type */ + /* 1:Index */ + /* 2:Stock */ + /* 3:ETP(ETF) */ + /* 4:Warrant */ + char curr[4+1]; /* currency */ + char zdiv[1+1]; /* float position */ + char ztyp[1+1]; /* data type */ + char base[12+1]; /* base price */ + char bnit[8+1]; /* Bid order size */ + char anit[8+1]; /* Ask order size */ + char mstm[4+1]; /* market start time(HHMM) */ + char metm[4+1]; /* market end time(HHMM) */ + char isdr[1+1]; /* DR 여부 :Y, N */ + char drcd[2+1]; /* DR 국가코드 */ + char icod[4+1]; /* 업종분류코드 */ + char sjong[1+1]; /* 지수구성종목 존재 여부 */ + /* 0:구성종목없음 */ + /* 1:구성종목있음 */ + char ttyp[1+1]; /* Tick size Type */ + char etyp[3+1]; /* 001: ETF 002: ETN 003: ETC 004: Others 005: VIX Underlying ETF 006: VIX Underlying ETN*/ + char ttyp_sb[3+1]; /* Tick size type 상세 (ttyp 9일 경우 사용) : 런던 제트라 유로넥스트 */ +}; diff --git a/한국투자증권(API)/stocks_info/해외주식옵션정보.h b/한국투자증권(API)/stocks_info/해외주식옵션정보.h new file mode 100644 index 0000000..e822905 --- /dev/null +++ b/한국투자증권(API)/stocks_info/해외주식옵션정보.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * ؿ ɼ (fostkcode.mst) + ****************************************************************************/ +typedef struct ST_FOSTKCODE_TBL +{ + char sSrsCd [ 32]; /* ڵ (UNIQ-KEY) */ + char sAutoOrdGnrlYN[ 1]; /* ڵֹ */ + char sAutoOrdTwapYN[ 1]; /* ڵֹ TWAP */ + char sAutoOrdEcnmYN[ 1]; /* ڵ ǥ ֹ */ + char sExchSubCd [ 2]; /* ŷ ڵ 2019.12.27 */ + /* 10:ASX 20:BALTIC 30:BMF 40:CBOE */ + /* 50:CME 51:CME_CBOT 52:CME_NYMEX 53:CME_COMEX */ + /* 60:EUREX 70:FTX 80:HKEx */ + /* 90:ICE_US 91:ICE_ 92:ICE_ǰ 93:ICE_SG */ + /* A0:ISE B0:ITA C0:JSE D0:KCBT */ + /* E0:LBMA F0:LME G0:MDEX H0:MDX */ + /* I0:MEFF J0:NYSE K0:OSE L0:SGX */ + /* M0:SSE N0:TFEX O0:TMX P0:HNX */ + char sFiller [ 45]; /* ʷ */ + char sSeriesKrNm [ 50]; /* ѱ۸ */ + char sExchCd [ 10]; /* ŷڵ */ + char sMrktCd [ 10]; /* ǰڵ */ + char sClasCd [ 3]; /* ǰ */ + /* 1: ɼ */ + /* 2: ֽĿɼ (M) */ + /* 3: ɼ */ + /* 4: ɼ */ + /* 5: ֽĿɼ (W) */ + char sDispDesz [ 5]; /* Ҽ */ + char sCalcDesz [ 5]; /* Ҽ */ + char sTickSz [ 14]; /* ƽ */ + char sTickVal [ 14]; /* ƽġ */ + char sCtrtSz [ 10]; /* ũ */ + char sDispDigit [ 4]; /* ǥ */ + char sMultiplier [ 10]; /* ȯ¼ */ + char sSymbol [ 1]; /* ɼ C, P */ + char sStkPrc [ 20]; /* Strike Price */ + char sUndrInstr [ 10]; /* üڵ */ + /* ؿܼ ǰ ڵ */ + /* ֽĿɼ ŷ ڵ */ + /* ex: NAS, NYS, AMS */ + char sUndrAsset [ 32]; /* ü */ + /* ؿܼ ڻ ڵ */ + /* ֽĿɼ Ticker ڵ */ + /* AAPL, TSLA */ + char sRefrAsset [ 32]; /* ڻ Index */ + /* ΰ */ + /* ؿܼΰ ڵ */ + char sIncTickPrc [ 19]; /* ƽذ */ + char sIncTickSz [ 5]; /* ƽ */ + char sYearMon [ 6]; /* */ + char sAtmFlg [ 1]; /* A: ATM, I:ITM, O:OTM */ + char sNearFlg [ 1]; /* ٿ 0: 1:ٿ */ +} FOSTKCODE_TBL; \ No newline at end of file diff --git a/한국투자증권(API)/stocks_info/해외주식지수정보.h b/한국투자증권(API)/stocks_info/해외주식지수정보.h new file mode 100644 index 0000000..85dad23 --- /dev/null +++ b/한국투자증권(API)/stocks_info/해외주식지수정보.h @@ -0,0 +1,29 @@ +/***************************************************************************** + * ؿ ڵ + ****************************************************************************/ +typedef struct +{ + char cls_code[1]; /* ڵ */ + /* W : ֿ */ + /* P : ̱ */ + /* Q : ̱ */ + /* H : ֿ */ + /* D : ̱屹 */ + /* G : 屹 */ + /* F : CME */ + /* M : ݵü */ + /* X : ȯ */ + /* C : ǰ */ + /* R : ݸ */ + /* L : ݸ */ + /* B : ֿ䱹ä */ + char symb[10]; /* ɺ */ + char hts_eng_isnm[39]; /* */ + char hts_kor_isnm[40]; /* ѱ۸ */ + char bstp_cls_code[4]; /* ڵ */ + char dow_30_yn[1]; /* ٿ30 񿩺 0: 1: */ + char nasdaq_100_yn[1]; /* 100 񿩺 0: 1: */ + char snp_500_yn[1]; /* S&P 500 񿩺 0: 1: */ + char exch_cls_code[4]; /* ŷڵ */ + char ntnl_cls_code[3]; /* ڵ */ +} ST_FRGN_CODE;